diff --git a/DSView/DSView.qrc b/DSView/DSView.qrc
index bf8d2d0c..00b550b7 100644
--- a/DSView/DSView.qrc
+++ b/DSView/DSView.qrc
@@ -36,5 +36,20 @@
icons/gear.png
icons/wiki.png
icons/wait.gif
+ icons/file_cn.png
+ icons/file_dis_cn.png
+ icons/instant_cn.png
+ icons/measure_cn.png
+ icons/measure_dis_cn.png
+ icons/params_cn.png
+ icons/params_dis_cn.png
+ icons/protocol_dis_cn.png
+ icons/search-bar_cn.png
+ icons/search-bar_dis_cn.png
+ icons/start_cn.png
+ icons/stop_cn.png
+ icons/trigger_cn.png
+ icons/trigger_dis_cn.png
+ icons/protocol_cn.png
diff --git a/DSView/icons/file_cn.png b/DSView/icons/file_cn.png
new file mode 100644
index 00000000..00096c50
Binary files /dev/null and b/DSView/icons/file_cn.png differ
diff --git a/DSView/icons/file_dis_cn.png b/DSView/icons/file_dis_cn.png
new file mode 100644
index 00000000..b6e24584
Binary files /dev/null and b/DSView/icons/file_dis_cn.png differ
diff --git a/DSView/icons/instant_cn.png b/DSView/icons/instant_cn.png
new file mode 100644
index 00000000..0e586094
Binary files /dev/null and b/DSView/icons/instant_cn.png differ
diff --git a/DSView/icons/measure_cn.png b/DSView/icons/measure_cn.png
new file mode 100644
index 00000000..71619a88
Binary files /dev/null and b/DSView/icons/measure_cn.png differ
diff --git a/DSView/icons/measure_dis_cn.png b/DSView/icons/measure_dis_cn.png
new file mode 100644
index 00000000..d023a23d
Binary files /dev/null and b/DSView/icons/measure_dis_cn.png differ
diff --git a/DSView/icons/params_cn.png b/DSView/icons/params_cn.png
new file mode 100644
index 00000000..86e2811f
Binary files /dev/null and b/DSView/icons/params_cn.png differ
diff --git a/DSView/icons/params_dis_cn.png b/DSView/icons/params_dis_cn.png
new file mode 100644
index 00000000..fcb8a611
Binary files /dev/null and b/DSView/icons/params_dis_cn.png differ
diff --git a/DSView/icons/protocol_cn.png b/DSView/icons/protocol_cn.png
new file mode 100644
index 00000000..213fd151
Binary files /dev/null and b/DSView/icons/protocol_cn.png differ
diff --git a/DSView/icons/protocol_dis_cn.png b/DSView/icons/protocol_dis_cn.png
new file mode 100644
index 00000000..005d3add
Binary files /dev/null and b/DSView/icons/protocol_dis_cn.png differ
diff --git a/DSView/icons/search-bar_cn.png b/DSView/icons/search-bar_cn.png
new file mode 100644
index 00000000..b8a249e4
Binary files /dev/null and b/DSView/icons/search-bar_cn.png differ
diff --git a/DSView/icons/search-bar_dis_cn.png b/DSView/icons/search-bar_dis_cn.png
new file mode 100644
index 00000000..f21aa2d4
Binary files /dev/null and b/DSView/icons/search-bar_dis_cn.png differ
diff --git a/DSView/icons/start_cn.png b/DSView/icons/start_cn.png
new file mode 100644
index 00000000..6052468a
Binary files /dev/null and b/DSView/icons/start_cn.png differ
diff --git a/DSView/icons/stop_cn.png b/DSView/icons/stop_cn.png
new file mode 100644
index 00000000..da13d848
Binary files /dev/null and b/DSView/icons/stop_cn.png differ
diff --git a/DSView/icons/trigger_cn.png b/DSView/icons/trigger_cn.png
new file mode 100644
index 00000000..8f98b4dd
Binary files /dev/null and b/DSView/icons/trigger_cn.png differ
diff --git a/DSView/icons/trigger_dis_cn.png b/DSView/icons/trigger_dis_cn.png
new file mode 100644
index 00000000..e17bfce7
Binary files /dev/null and b/DSView/icons/trigger_dis_cn.png differ
diff --git a/DSView/main.cpp b/DSView/main.cpp
index 0d3a763f..bd131f65 100644
--- a/DSView/main.cpp
+++ b/DSView/main.cpp
@@ -61,10 +61,21 @@ int main(int argc, char *argv[])
QApplication a(argc, argv);
- // Set some application metadata
- QApplication::setApplicationVersion(DS_VERSION_STRING);
- QApplication::setApplicationName("DSView(Beta)");
- QApplication::setOrganizationDomain("http://www.DreamSourceLab.com");
+ // Language
+#ifdef LANGUAGE_ZH_CN
+ QTranslator qtTrans;
+ qtTrans.load(":/qt_zh_CN");
+ a.installTranslator(&qtTrans);
+
+ QTranslator DSViewTrans;
+ DSViewTrans.load(":/DSView_zh");
+ a.installTranslator(&DSViewTrans);
+#endif
+
+ // Set some application metadata
+ QApplication::setApplicationVersion(DS_VERSION_STRING);
+ QApplication::setApplicationName("DSView(Beta)");
+ QApplication::setOrganizationDomain("http://www.DreamSourceLab.com");
// Parse arguments
while (1) {
diff --git a/DSView/pv/dialogs/deviceoptions.cpp b/DSView/pv/dialogs/deviceoptions.cpp
index 633cc631..ade12c06 100644
--- a/DSView/pv/dialogs/deviceoptions.cpp
+++ b/DSView/pv/dialogs/deviceoptions.cpp
@@ -157,8 +157,8 @@ void DeviceOptions::setup_probes()
row = index / 8;
}
- QPushButton *_enable_all_probes = new QPushButton("Enable All", this);
- QPushButton *_disable_all_probes = new QPushButton("Disable All", this);
+ QPushButton *_enable_all_probes = new QPushButton(tr("Enable All"), this);
+ QPushButton *_disable_all_probes = new QPushButton(tr("Disable All"), this);
connect(_enable_all_probes, SIGNAL(clicked()),
this, SLOT(enable_all_probes()));
@@ -194,8 +194,8 @@ void DeviceOptions::zero_adj()
QDialog::reject();
QMessageBox msg(this);
- msg.setText("Information");
- msg.setInformativeText("Zero adjustment program will be started. This may take a few minutes!");
+ msg.setText(tr("Information"));
+ msg.setInformativeText(tr("Zero adjustment program will be started. This may take a few minutes!"));
//msg.setStandardButtons(QMessageBox::);
msg.addButton(tr("Ok"), QMessageBox::AcceptRole);
msg.addButton(tr("Cancel"), QMessageBox::RejectRole);
diff --git a/DSView/pv/dialogs/search.cpp b/DSView/pv/dialogs/search.cpp
index 6bdc5dc8..13dd3d72 100644
--- a/DSView/pv/dialogs/search.cpp
+++ b/DSView/pv/dialogs/search.cpp
@@ -56,10 +56,10 @@ Search::Search(QWidget *parent, struct sr_dev_inst *sdi, QString pattern) :
QGridLayout *search_layout = new QGridLayout();
search_layout->addWidget(search_label, 0, 1);
- search_layout->addWidget(new QLabel("Search Value: "), 1,0, Qt::AlignRight);
+ search_layout->addWidget(new QLabel(tr("Search Value: ")), 1,0, Qt::AlignRight);
search_layout->addWidget(&search_lineEdit, 1, 1);
search_layout->addWidget(new QLabel(" "), 2,0);
- search_layout->addWidget(new QLabel("X: Don't care\n0: Low level\n1: High level\nR: Rising edge\nF: Falling edge\nC: Rising/Falling edge"), 3, 0);
+ search_layout->addWidget(new QLabel(tr("X: Don't care\n0: Low level\n1: High level\nR: Rising edge\nF: Falling edge\nC: Rising/Falling edge")), 3, 0);
search_layout->addWidget(&search_buttonBox, 4, 2);
//search_layout->addStretch(1);
diff --git a/DSView/pv/dialogs/streamoptions.cpp b/DSView/pv/dialogs/streamoptions.cpp
index a56d3b89..610c5beb 100644
--- a/DSView/pv/dialogs/streamoptions.cpp
+++ b/DSView/pv/dialogs/streamoptions.cpp
@@ -52,17 +52,17 @@ StreamOptions::StreamOptions(QWidget *parent, boost::shared_ptrsetText("Stream Mode Active!");
+ _info->setText(tr("Stream Mode Active!"));
else
- _info->setText("Buffer Mode Active!");
+ _info->setText(tr("Buffer Mode Active!"));
_layout.addWidget(_info);
if (_stream) {
_op0 = new QRadioButton(this);
_op1 = new QRadioButton(this);
- _op0->setText("16 Channels, Max 10MHz sample rate");
- _op1->setText(" 8 Channels, Max 25MHz sample rate");
+ _op0->setText(tr("16 Channels, Max 10MHz sample rate"));
+ _op1->setText(tr(" 8 Channels, Max 25MHz sample rate"));
_layout.addWidget(_op0);
_layout.addWidget(_op1);
diff --git a/DSView/pv/dialogs/waitingdialog.cpp b/DSView/pv/dialogs/waitingdialog.cpp
index eb3960c4..8e2b0e52 100644
--- a/DSView/pv/dialogs/waitingdialog.cpp
+++ b/DSView/pv/dialogs/waitingdialog.cpp
@@ -37,7 +37,7 @@ using namespace std;
namespace pv {
namespace dialogs {
-const QString WaitingDialog::TIPS_INFO = "Waiting";
+const QString WaitingDialog::TIPS_INFO = tr("Waiting");
WaitingDialog::WaitingDialog(QWidget *parent, boost::shared_ptr dev_inst) :
QDialog(parent),
diff --git a/DSView/pv/dock/dsotriggerdock.cpp b/DSView/pv/dock/dsotriggerdock.cpp
index d123691f..357b9d02 100644
--- a/DSView/pv/dock/dsotriggerdock.cpp
+++ b/DSView/pv/dock/dsotriggerdock.cpp
@@ -45,7 +45,7 @@ DsoTriggerDock::DsoTriggerDock(QWidget *parent, SigSession &session) :
QWidget(parent),
_session(session)
{
- QLabel *position_label = new QLabel("Trigger Position: ", this);
+ QLabel *position_label = new QLabel(tr("Trigger Position: "), this);
position_spinBox = new QSpinBox(this);
position_spinBox->setRange(0, 99);
position_spinBox->setButtonSymbols(QAbstractSpinBox::NoButtons);
@@ -55,23 +55,23 @@ DsoTriggerDock::DsoTriggerDock(QWidget *parent, SigSession &session) :
connect(position_spinBox, SIGNAL(valueChanged(int)), position_slider, SLOT(setValue(int)));
connect(position_slider, SIGNAL(valueChanged(int)), this, SLOT(pos_changed(int)));
- QLabel *tSource_labe = new QLabel("Trigger Sources: ", this);
- QRadioButton *auto_radioButton = new QRadioButton("Auto");
+ QLabel *tSource_labe = new QLabel(tr("Trigger Sources: "), this);
+ QRadioButton *auto_radioButton = new QRadioButton(tr("Auto"));
auto_radioButton->setChecked(true);
- QRadioButton *ch0_radioButton = new QRadioButton("Channel 0");
- QRadioButton *ch1_radioButton = new QRadioButton("Channel 1");
- QRadioButton *ch0a1_radioButton = new QRadioButton("Channel 0 && Channel 1");
- QRadioButton *ch0o1_radioButton = new QRadioButton("Channel 0 | Channel 1");
+ QRadioButton *ch0_radioButton = new QRadioButton(tr("Channel 0"));
+ QRadioButton *ch1_radioButton = new QRadioButton(tr("Channel 1"));
+ QRadioButton *ch0a1_radioButton = new QRadioButton(tr("Channel 0 && Channel 1"));
+ QRadioButton *ch0o1_radioButton = new QRadioButton(tr("Channel 0 | Channel 1"));
connect(auto_radioButton, SIGNAL(clicked()), this, SLOT(source_changed()));
connect(ch0_radioButton, SIGNAL(clicked()), this, SLOT(source_changed()));
connect(ch1_radioButton, SIGNAL(clicked()), this, SLOT(source_changed()));
connect(ch0a1_radioButton, SIGNAL(clicked()), this, SLOT(source_changed()));
connect(ch0o1_radioButton, SIGNAL(clicked()), this, SLOT(source_changed()));
- QLabel *tType_labe = new QLabel("Trigger Types: ", this);
- QRadioButton *rising_radioButton = new QRadioButton("Rising Edge");
+ QLabel *tType_labe = new QLabel(tr("Trigger Types: "), this);
+ QRadioButton *rising_radioButton = new QRadioButton(tr("Rising Edge"));
rising_radioButton->setChecked(true);
- QRadioButton *falling_radioButton = new QRadioButton("Falling Edge");
+ QRadioButton *falling_radioButton = new QRadioButton(tr("Falling Edge"));
connect(rising_radioButton, SIGNAL(clicked()), this, SLOT(type_changed()));
connect(falling_radioButton, SIGNAL(clicked()), this, SLOT(type_changed()));
@@ -141,8 +141,8 @@ void DsoTriggerDock::pos_changed(int pos)
g_variant_new_uint16((uint16_t)pos));
if (!ret) {
QMessageBox msg(this);
- msg.setText("Trigger Setting Issue");
- msg.setInformativeText("Change horiz trigger position failed!");
+ msg.setText(tr("Trigger Setting Issue"));
+ msg.setInformativeText(tr("Change horiz trigger position failed!"));
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
@@ -163,8 +163,8 @@ void DsoTriggerDock::source_changed()
g_variant_new_byte(id));
if (!ret) {
QMessageBox msg(this);
- msg.setText("Trigger Setting Issue");
- msg.setInformativeText("Change trigger source failed!");
+ msg.setText(tr("Trigger Setting Issue"));
+ msg.setInformativeText(tr("Change trigger source failed!"));
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
@@ -181,8 +181,8 @@ void DsoTriggerDock::type_changed()
g_variant_new_byte(id));
if (!ret) {
QMessageBox msg(this);
- msg.setText("Trigger Setting Issue");
- msg.setInformativeText("Change trigger type failed!");
+ msg.setText(tr("Trigger Setting Issue"));
+ msg.setInformativeText(tr("Change trigger type failed!"));
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
diff --git a/DSView/pv/dock/measuredock.cpp b/DSView/pv/dock/measuredock.cpp
index 211acdff..b37dd04a 100644
--- a/DSView/pv/dock/measuredock.cpp
+++ b/DSView/pv/dock/measuredock.cpp
@@ -52,8 +52,8 @@ MeasureDock::MeasureDock(QWidget *parent, View &view, SigSession &session) :
_view(view)
{
- _mouse_groupBox = new QGroupBox("Mouse measurement", this);
- _fen_checkBox = new QCheckBox("Enable floating measurement", this);
+ _mouse_groupBox = new QGroupBox(tr("Mouse measurement"), this);
+ _fen_checkBox = new QCheckBox(tr("Enable floating measurement"), this);
_fen_checkBox->setChecked(true);
_width_label = new QLabel("#####", this);
_period_label = new QLabel("#####", this);
@@ -62,13 +62,13 @@ MeasureDock::MeasureDock(QWidget *parent, View &view, SigSession &session) :
_mouse_layout = new QGridLayout();
_mouse_layout->addWidget(_fen_checkBox, 0, 0, 1, 2);
- _mouse_layout->addWidget(new QLabel("Width: ", this), 1, 0);
+ _mouse_layout->addWidget(new QLabel(tr("Width: "), this), 1, 0);
_mouse_layout->addWidget(_width_label, 1, 1);
- _mouse_layout->addWidget(new QLabel("Period: ", this), 2, 0);
+ _mouse_layout->addWidget(new QLabel(tr("Period: "), this), 2, 0);
_mouse_layout->addWidget(_period_label, 2, 1);
- _mouse_layout->addWidget(new QLabel("Frequency: ", this), 3, 0);
+ _mouse_layout->addWidget(new QLabel(tr("Frequency: "), this), 3, 0);
_mouse_layout->addWidget(_freq_label, 3, 1);
- _mouse_layout->addWidget(new QLabel("Duty Cycle: ", this), 4, 0);
+ _mouse_layout->addWidget(new QLabel(tr("Duty Cycle: "), this), 4, 0);
_mouse_layout->addWidget(_duty_label, 4, 1);
_mouse_layout->addWidget(new QLabel(this), 0, 2);
_mouse_layout->addWidget(new QLabel(this), 1, 2);
@@ -79,7 +79,7 @@ MeasureDock::MeasureDock(QWidget *parent, View &view, SigSession &session) :
_mouse_groupBox->setLayout(_mouse_layout);
- _cursor_groupBox = new QGroupBox("Cursor measurement", this);
+ _cursor_groupBox = new QGroupBox(tr("Cursor measurement"), this);
_t1_comboBox = new QComboBox(this);
_t2_comboBox = new QComboBox(this);
_t3_comboBox = new QComboBox(this);
@@ -94,30 +94,30 @@ MeasureDock::MeasureDock(QWidget *parent, View &view, SigSession &session) :
_t3_last_index = 0;
_cursor_layout = new QGridLayout();
- _cursor_layout->addWidget(new QLabel("T1: ", this), 0, 0);
+ _cursor_layout->addWidget(new QLabel(tr("T1: "), this), 0, 0);
_cursor_layout->addWidget(_t1_comboBox, 0, 1);
- _cursor_layout->addWidget(new QLabel("T2: ", this), 1, 0);
+ _cursor_layout->addWidget(new QLabel(tr("T2: "), this), 1, 0);
_cursor_layout->addWidget(_t2_comboBox, 1, 1);
- _cursor_layout->addWidget(new QLabel("T3: ", this), 2, 0);
+ _cursor_layout->addWidget(new QLabel(tr("T3: "), this), 2, 0);
_cursor_layout->addWidget(_t3_comboBox, 2, 1);
- _cursor_layout->addWidget(new QLabel("|T2 - T1|: ", this), 3, 0);
+ _cursor_layout->addWidget(new QLabel(tr("|T2 - T1|: "), this), 3, 0);
_cursor_layout->addWidget(_delta_label_t1t2, 3, 1);
- _cursor_layout->addWidget(new QLabel("Delta Samples: ", this), 3, 2);
+ _cursor_layout->addWidget(new QLabel(tr("Delta Samples: "), this), 3, 2);
_cursor_layout->addWidget(_cnt_label_t1t2, 3, 3);
- _cursor_layout->addWidget(new QLabel("|T3 - T2|: ", this), 4, 0);
+ _cursor_layout->addWidget(new QLabel(tr("|T3 - T2|: "), this), 4, 0);
_cursor_layout->addWidget(_delta_label_t2t3, 4, 1);
- _cursor_layout->addWidget(new QLabel("Delta Samples: ", this), 4, 2);
+ _cursor_layout->addWidget(new QLabel(tr("Delta Samples: "), this), 4, 2);
_cursor_layout->addWidget(_cnt_label_t2t3, 4, 3);
- _cursor_layout->addWidget(new QLabel("|T3 - T1|: ", this), 5, 0);
+ _cursor_layout->addWidget(new QLabel(tr("|T3 - T1|: "), this), 5, 0);
_cursor_layout->addWidget(_delta_label_t1t3, 5, 1);
- _cursor_layout->addWidget(new QLabel("Delta Samples: ", this), 5, 2);
+ _cursor_layout->addWidget(new QLabel(tr("Delta Samples: "), this), 5, 2);
_cursor_layout->addWidget(_cnt_label_t1t3, 5, 3);
- _cursor_layout->addWidget(new QLabel("Cursors", this), 6, 0);
- _cursor_layout->addWidget(new QLabel("Time/Samples", this), 6, 1);
+ _cursor_layout->addWidget(new QLabel(tr("Cursors"), this), 6, 0);
+ _cursor_layout->addWidget(new QLabel(tr("Time/Samples"), this), 6, 1);
_cursor_layout->addWidget(new QLabel(this), 0, 4);
_cursor_layout->addWidget(new QLabel(this), 1, 4);
@@ -185,7 +185,7 @@ void MeasureDock::cursor_update()
for(std::list::iterator i = _view.get_cursorList().begin();
i != _view.get_cursorList().end(); i++) {
- QString curCursor = "Cursor "+QString::number(index);
+ QString curCursor = tr("Cursor ")+QString::number(index);
_t1_comboBox->addItem(curCursor);
_t2_comboBox->addItem(curCursor);
_t3_comboBox->addItem(curCursor);
diff --git a/DSView/pv/dock/protocoldock.cpp b/DSView/pv/dock/protocoldock.cpp
index 083f2568..5b6ea0bf 100644
--- a/DSView/pv/dock/protocoldock.cpp
+++ b/DSView/pv/dock/protocoldock.cpp
@@ -107,8 +107,8 @@ void ProtocolDock::add_protocol()
{
if (_session.get_device()->dev_inst()->mode != LOGIC) {
QMessageBox msg(this);
- msg.setText("Protocol Analyzer");
- msg.setInformativeText("Protocol Analyzer is only valid in Digital Mode!");
+ msg.setText(tr("Protocol Analyzer"));
+ msg.setInformativeText(tr("Protocol Analyzer is only valid in Digital Mode!"));
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
@@ -203,8 +203,8 @@ void ProtocolDock::del_protocol()
_protocol_index_list.clear();
} else {
QMessageBox msg(this);
- msg.setText("Protocol Analyzer");
- msg.setInformativeText("No Protocol Analyzer to delete!");
+ msg.setText(tr("Protocol Analyzer"));
+ msg.setInformativeText(tr("No Protocol Analyzer to delete!"));
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
diff --git a/DSView/pv/dock/searchdock.cpp b/DSView/pv/dock/searchdock.cpp
index 7fe6e768..3233b825 100644
--- a/DSView/pv/dock/searchdock.cpp
+++ b/DSView/pv/dock/searchdock.cpp
@@ -120,8 +120,8 @@ void SearchDock::on_previous()
last_pos = _view.get_search_pos();
if (last_pos == 0) {
QMessageBox msg(this);
- msg.setText("Search");
- msg.setInformativeText("Search cursor at the start position!");
+ msg.setText(tr("Search"));
+ msg.setInformativeText(tr("Search cursor at the start position!"));
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
@@ -130,8 +130,8 @@ void SearchDock::on_previous()
data = (uint8_t*)_session.get_buf(unit_size, length);
if (data == NULL) {
QMessageBox msg(this);
- msg.setText("Search");
- msg.setInformativeText("No Sample data!");
+ msg.setText(tr("Search"));
+ msg.setInformativeText(tr("No Sample data!"));
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
@@ -140,8 +140,8 @@ void SearchDock::on_previous()
const bool ret = search_value(data, unit_size, length, last_pos, 1, value);
if (!ret) {
QMessageBox msg(this);
- msg.setText("Search");
- msg.setInformativeText("Pattern " + value + " not found!");
+ msg.setText(tr("Search"));
+ msg.setInformativeText(tr("Pattern ") + value + tr(" not found!"));
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
@@ -165,8 +165,8 @@ void SearchDock::on_next()
last_pos = _view.get_search_pos();
if (last_pos == length - 1) {
QMessageBox msg(this);
- msg.setText("Search");
- msg.setInformativeText("Search cursor at the end position!");
+ msg.setText(tr("Search"));
+ msg.setInformativeText(tr("Search cursor at the end position!"));
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
@@ -174,8 +174,8 @@ void SearchDock::on_next()
} else {
if (data == NULL) {
QMessageBox msg(this);
- msg.setText("Search");
- msg.setInformativeText("No Sample data!");
+ msg.setText(tr("Search"));
+ msg.setInformativeText(tr("No Sample data!"));
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
@@ -184,8 +184,8 @@ void SearchDock::on_next()
const int ret = search_value(data, unit_size, length, last_pos, 0, value);
if (!ret) {
QMessageBox msg(this);
- msg.setText("Search");
- msg.setInformativeText("Pattern " + value + " not found!");
+ msg.setText(tr("Search"));
+ msg.setInformativeText(tr("Pattern ") + value + tr(" not found!"));
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
diff --git a/DSView/pv/dock/triggerdock.cpp b/DSView/pv/dock/triggerdock.cpp
index 3f1a91f0..2cae1272 100644
--- a/DSView/pv/dock/triggerdock.cpp
+++ b/DSView/pv/dock/triggerdock.cpp
@@ -47,11 +47,11 @@ TriggerDock::TriggerDock(QWidget *parent, SigSession &session) :
font.setStyleHint(QFont::Monospace);
font.setFixedPitch(true);
- simple_radioButton = new QRadioButton("Simple Trigger", this);
+ simple_radioButton = new QRadioButton(tr("Simple Trigger"), this);
simple_radioButton->setChecked(true);
- adv_radioButton = new QRadioButton("Advanced Trigger", this);
+ adv_radioButton = new QRadioButton(tr("Advanced Trigger"), this);
- position_label = new QLabel("Trigger Position: ", this);
+ position_label = new QLabel(tr("Trigger Position: "), this);
position_spinBox = new QSpinBox(this);
position_spinBox->setRange(0, 99);
position_spinBox->setButtonSymbols(QAbstractSpinBox::NoButtons);
@@ -60,7 +60,7 @@ TriggerDock::TriggerDock(QWidget *parent, SigSession &session) :
connect(position_slider, SIGNAL(valueChanged(int)), position_spinBox, SLOT(setValue(int)));
connect(position_spinBox, SIGNAL(valueChanged(int)), position_slider, SLOT(setValue(int)));
- stages_label = new QLabel("Total Trigger Stages: ", this);
+ stages_label = new QLabel(tr("Total Trigger Stages: "), this);
stages_label->setDisabled(true);
stages_comboBox = new QComboBox(this);
for (i = 1; i <= TriggerStages; i++)
@@ -131,11 +131,11 @@ TriggerDock::TriggerDock(QWidget *parent, SigSession &session) :
stage_glayout->addWidget(_inv1_comboBox, 3, 1);
stage_glayout->addWidget(_count1_spinBox, 3, 2);
stage_layout->addLayout(stage_glayout);
- stage_layout->addSpacing(100);
- stage_layout->addWidget(new QLabel("X: Don't care\n0: Low level\n1: High level\nR: Rising edge\nF: Falling edge\nC: Rising/Falling edge"));
+ stage_layout->addSpacing(20);
+ stage_layout->addWidget(new QLabel(tr("X: Don't care\n0: Low level\n1: High level\nR: Rising edge\nF: Falling edge\nC: Rising/Falling edge")));
stage_layout->addStretch(1);
- QGroupBox *_stage_groupBox = new QGroupBox("Stage"+QString::number(i), this);
+ QGroupBox *_stage_groupBox = new QGroupBox(tr("Stage")+QString::number(i), this);
_stage_groupBox->setFlat(true);
_stage_groupBox->setLayout(stage_layout);
_stage_groupBox_list.push_back(_stage_groupBox);
@@ -221,8 +221,8 @@ void TriggerDock::adv_trigger()
}
if (stream) {
QMessageBox msg(this);
- msg.setText("Trigger");
- msg.setInformativeText("Stram Mode Don't Support Advanced Trigger!");
+ msg.setText(tr("Trigger"));
+ msg.setInformativeText(tr("Stram Mode Don't Support Advanced Trigger!"));
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
@@ -234,8 +234,8 @@ void TriggerDock::adv_trigger()
}
} else {
QMessageBox msg(this);
- msg.setText("Trigger");
- msg.setInformativeText("Advanced Trigger need DSLogic Hardware Support!");
+ msg.setText(tr("Trigger"));
+ msg.setInformativeText(tr("Advanced Trigger need DSLogic Hardware Support!"));
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
diff --git a/DSView/pv/mainwindow.cpp b/DSView/pv/mainwindow.cpp
index b37dc504..4a3ba30e 100644
--- a/DSView/pv/mainwindow.cpp
+++ b/DSView/pv/mainwindow.cpp
@@ -443,8 +443,8 @@ void MainWindow::test_data_error()
#endif
_session.stop_capture();
QMessageBox msg(this);
- msg.setText("Data Error");
- msg.setInformativeText("the receive data are not consist with pre-defined test data");
+ msg.setText(tr("Data Error"));
+ msg.setInformativeText(tr("the receive data are not consist with pre-defined test data"));
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
@@ -454,8 +454,8 @@ void MainWindow::malloc_error()
{
_session.stop_capture();
QMessageBox msg(this);
- msg.setText("Malloc Error");
- msg.setInformativeText("Memory is not enough for this sample!\nPlease reduce the sample depth!");
+ msg.setText(tr("Malloc Error"));
+ msg.setInformativeText(tr("Memory is not enough for this sample!\nPlease reduce the sample depth!"));
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
diff --git a/DSView/pv/toolbars/filebar.cpp b/DSView/pv/toolbars/filebar.cpp
index 9efc9cf7..12816b12 100644
--- a/DSView/pv/toolbars/filebar.cpp
+++ b/DSView/pv/toolbars/filebar.cpp
@@ -82,7 +82,11 @@ FileBar::FileBar(SigSession &session, QWidget *parent) :
connect(_action_capture, SIGNAL(triggered()), this, SLOT(on_actionCapture_triggered()));
_file_button.setPopupMode(QToolButton::InstantPopup);
+#ifdef LANGUAGE_ZH_CN
+ _file_button.setIcon(QIcon(":/icons/file_cn.png"));
+#else
_file_button.setIcon(QIcon(":/icons/file.png"));
+#endif
addWidget(&_file_button);
}
@@ -122,8 +126,8 @@ void FileBar::on_actionExport_triggered(){
void* buf = _session.get_buf(unit_size, length);
if (!buf) {
QMessageBox msg(this);
- msg.setText("Data Export");
- msg.setInformativeText("No Data to Save!");
+ msg.setText(tr("Data Export"));
+ msg.setInformativeText(tr("No Data to Save!"));
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
@@ -156,15 +160,15 @@ void FileBar::on_actionSave_triggered()
void* buf = _session.get_buf(unit_size, length);
if (!buf) {
QMessageBox msg(this);
- msg.setText("File Save");
- msg.setInformativeText("No Data to Save!");
+ msg.setText(tr("File Save"));
+ msg.setInformativeText(tr("No Data to Save!"));
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
} else if (_session.get_device()->dev_inst()->mode != LOGIC) {
QMessageBox msg(this);
- msg.setText("File Save");
- msg.setInformativeText("DSView currently only support saving logic data to file!");
+ msg.setText(tr("File Save"));
+ msg.setInformativeText(tr("DSView currently only support saving logic data to file!"));
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
@@ -189,8 +193,13 @@ void FileBar::on_actionCapture_triggered()
void FileBar::enable_toggle(bool enable)
{
_file_button.setDisabled(!enable);
+#ifdef LANGUAGE_ZH_CN
+ _file_button.setIcon(enable ? QIcon(":/icons/file_cn.png") :
+ QIcon(":/icons/file_dis_cn.png"));
+#else
_file_button.setIcon(enable ? QIcon(":/icons/file.png") :
QIcon(":/icons/file_dis.png"));
+#endif
}
} // namespace toolbars
diff --git a/DSView/pv/toolbars/samplingbar.cpp b/DSView/pv/toolbars/samplingbar.cpp
index 289fce77..4e4957de 100644
--- a/DSView/pv/toolbars/samplingbar.cpp
+++ b/DSView/pv/toolbars/samplingbar.cpp
@@ -88,9 +88,15 @@ SamplingBar::SamplingBar(SigSession &session, QWidget *parent) :
_sample_rate(this),
_updating_sample_rate(false),
_updating_sample_count(false),
+ #ifdef LANGUAGE_ZH_CN
+ _icon_stop(":/icons/stop_cn.png"),
+ _icon_start(":/icons/start_cn.png"),
+ _icon_instant(":/icons/instant_cn.png"),
+ #else
_icon_stop(":/icons/stop.png"),
_icon_start(":/icons/start.png"),
_icon_instant(":/icons/instant.png"),
+ #endif
_run_stop_button(this),
_instant_button(this),
_instant(false)
@@ -106,8 +112,13 @@ SamplingBar::SamplingBar(SigSession &session, QWidget *parent) :
connect(&_instant_button, SIGNAL(clicked()),
this, SLOT(on_instant_stop()));
+#ifdef LANGUAGE_ZH_CN
+ _configure_button.setIcon(QIcon::fromTheme("configure",
+ QIcon(":/icons/params_cn.png")));
+#else
_configure_button.setIcon(QIcon::fromTheme("configure",
QIcon(":/icons/params.png")));
+#endif
_run_stop_button.setIcon(_icon_start);
_instant_button.setIcon(_icon_instant);
@@ -313,8 +324,13 @@ void SamplingBar::set_sampling(bool sampling)
}
_configure_button.setEnabled(!sampling);
+#ifdef LANGUAGE_ZH_CN
+ _configure_button.setIcon(sampling ? QIcon(":/icons/params_dis_cn.png") :
+ QIcon(":/icons/params_cn.png"));
+#else
_configure_button.setIcon(sampling ? QIcon(":/icons/params_dis.png") :
QIcon(":/icons/params.png"));
+#endif
}
void SamplingBar::set_sample_rate(uint64_t sample_rate)
@@ -674,8 +690,8 @@ void SamplingBar::on_run_stop()
g_variant_unref(gvar);
if (zero) {
QMessageBox msg(this);
- msg.setText("Zero Adjustment");
- msg.setInformativeText("Please adjust zero skew and save the result!");
+ msg.setText(tr("Zero Adjustment"));
+ msg.setInformativeText(tr("Please adjust zero skew and save the result!"));
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
@@ -704,11 +720,11 @@ void SamplingBar::on_instant_stop()
g_variant_unref(gvar);
if (zero) {
QMessageBox msg(this);
- msg.setText("Zero Adjustment");
+ msg.setText(tr("Zero Adjustment"));
if(strcmp(dev_inst->dev_inst()->driver->name, "DSLogic") == 0)
- msg.setInformativeText("Please adjust zero skew and save the result!\nPlease left both of channels unconnect for zero adjustment!");
+ msg.setInformativeText(tr("Please adjust zero skew and save the result!\nPlease left both of channels unconnect for zero adjustment!"));
else
- msg.setInformativeText("Please adjust zero skew and save the result!");
+ msg.setInformativeText(tr("Please adjust zero skew and save the result!"));
msg.setStandardButtons(QMessageBox::Ok);
msg.setIcon(QMessageBox::Warning);
msg.exec();
diff --git a/DSView/pv/toolbars/trigbar.cpp b/DSView/pv/toolbars/trigbar.cpp
index 9be5bf5e..143f9a30 100644
--- a/DSView/pv/toolbars/trigbar.cpp
+++ b/DSView/pv/toolbars/trigbar.cpp
@@ -45,6 +45,22 @@ TrigBar::TrigBar(QWidget *parent) :
connect(&_search_button, SIGNAL(clicked()),
this, SLOT(search_clicked()));
+#ifdef LANGUAGE_ZH_CN
+ _trig_button.setIcon(QIcon::fromTheme("trig",
+ QIcon(":/icons/trigger_cn.png")));
+ _trig_button.setCheckable(true);
+ _protocol_button.setIcon(QIcon::fromTheme("trig",
+ QIcon(":/icons/protocol_cn.png")));
+#ifdef ENABLE_DECODE
+ _protocol_button.setCheckable(true);
+#endif
+ _measure_button.setIcon(QIcon::fromTheme("trig",
+ QIcon(":/icons/measure_cn.png")));
+ _measure_button.setCheckable(true);
+ _search_button.setIcon(QIcon::fromTheme("trig",
+ QIcon(":/icons/search-bar_cn.png")));
+ _search_button.setCheckable(true);
+#else
_trig_button.setIcon(QIcon::fromTheme("trig",
QIcon(":/icons/trigger.png")));
_trig_button.setCheckable(true);
@@ -59,6 +75,7 @@ TrigBar::TrigBar(QWidget *parent) :
_search_button.setIcon(QIcon::fromTheme("trig",
QIcon(":/icons/search-bar.png")));
_search_button.setCheckable(true);
+#endif
addWidget(&_trig_button);
addWidget(&_protocol_button);
@@ -93,6 +110,16 @@ void TrigBar::enable_toggle(bool enable)
_measure_button.setDisabled(!enable);
_search_button.setDisabled(!enable);
+#ifdef LANGUAGE_ZH_CN
+ _trig_button.setIcon(enable ? QIcon::fromTheme("trig", QIcon(":/icons/trigger_cn.png")) :
+ QIcon::fromTheme("trig", QIcon(":/icons/trigger_dis_cn.png")));
+ _protocol_button.setIcon(enable ? QIcon::fromTheme("trig", QIcon(":/icons/protocol_cn.png")) :
+ QIcon::fromTheme("trig", QIcon(":/icons/protocol_dis_cn.png")));
+ _measure_button.setIcon(enable ? QIcon::fromTheme("trig", QIcon(":/icons/measure_cn.png")) :
+ QIcon::fromTheme("trig", QIcon(":/icons/measure_dis_cn.png")));
+ _search_button.setIcon(enable ? QIcon::fromTheme("trig", QIcon(":/icons/search-bar_cn.png")) :
+ QIcon::fromTheme("trig", QIcon(":/icons/search-bar_dis_cn.png")));
+#else
_trig_button.setIcon(enable ? QIcon::fromTheme("trig", QIcon(":/icons/trigger.png")) :
QIcon::fromTheme("trig", QIcon(":/icons/trigger_dis.png")));
_protocol_button.setIcon(enable ? QIcon::fromTheme("trig", QIcon(":/icons/protocol.png")) :
@@ -101,13 +128,19 @@ void TrigBar::enable_toggle(bool enable)
QIcon::fromTheme("trig", QIcon(":/icons/measure_dis.png")));
_search_button.setIcon(enable ? QIcon::fromTheme("trig", QIcon(":/icons/search-bar.png")) :
QIcon::fromTheme("trig", QIcon(":/icons/search-bar_dis.png")));
+#endif
}
void TrigBar::enable_protocol(bool enable)
{
_protocol_button.setDisabled(!enable);
+#ifdef LANGUAGE_ZH_CN
+ _protocol_button.setIcon(enable ? QIcon::fromTheme("trig", QIcon(":/icons/protocol_cn.png")) :
+ QIcon::fromTheme("trig", QIcon(":/icons/protocol_dis_cn.png")));
+#else
_protocol_button.setIcon(enable ? QIcon::fromTheme("trig", QIcon(":/icons/protocol.png")) :
QIcon::fromTheme("trig", QIcon(":/icons/protocol_dis.png")));
+#endif
}
void TrigBar::close_all()
diff --git a/DSView/pv/view/dsosignal.cpp b/DSView/pv/view/dsosignal.cpp
index 62a22168..c099af80 100644
--- a/DSView/pv/view/dsosignal.cpp
+++ b/DSView/pv/view/dsosignal.cpp
@@ -844,14 +844,14 @@ void DsoSignal::paint_type_options(QPainter &p, int right, bool hover, int actio
p.setBrush((hover && action == CHEN) ? _colour.darker() : _colour);
p.drawRect(chEn_rect);
p.setPen(Qt::white);
- p.drawText(chEn_rect, Qt::AlignCenter | Qt::AlignVCenter, enabled() ? "EN" : "DIS");
+ p.drawText(chEn_rect, Qt::AlignCenter | Qt::AlignVCenter, enabled() ? tr("EN") : tr("DIS"));
p.setPen(Qt::transparent);
p.setBrush(enabled() ? ((hover && action == ACDC) ? _colour.darker() : _colour) : dsDisable);
p.drawRect(acdc_rect);
p.setPen(Qt::white);
- p.drawText(acdc_rect, Qt::AlignCenter | Qt::AlignVCenter, (_acCoupling == SR_GND_COUPLING) ? "GND" :
- (_acCoupling == SR_DC_COUPLING) ? "DC" : "AC");
+ p.drawText(acdc_rect, Qt::AlignCenter | Qt::AlignVCenter, (_acCoupling == SR_GND_COUPLING) ? tr("GND") :
+ (_acCoupling == SR_DC_COUPLING) ? tr("DC") : tr("AC"));
// paint the probe factor selector
GVariant* gvar;
@@ -904,10 +904,10 @@ void DsoSignal::paint_measure(QPainter &p)
QString freq_string = abs(_period) > 1000000 ? QString::number(1000000000/_period, 'f', 2) + "Hz" :
abs(_period) > 1000 ? QString::number(1000000/_period, 'f', 2) + "kHz" : QString::number(1000/_period, 'f', 2) + "MHz";
p.setPen(_colour);
- p.drawText(QRectF(0, 100*index + UpMargin, get_view_rect().width()*0.9, 20), Qt::AlignRight | Qt::AlignVCenter, "Max: "+max_string+" ");
- p.drawText(QRectF(0, 100*index + UpMargin + 20, get_view_rect().width()*0.9, 20), Qt::AlignRight | Qt::AlignVCenter, "Min: "+min_string+" ");
- p.drawText(QRectF(0, 100*index + UpMargin + 40, get_view_rect().width()*0.9, 20), Qt::AlignRight | Qt::AlignVCenter, "Period: "+period_string+" ");
- p.drawText(QRectF(0, 100*index + UpMargin + 60, get_view_rect().width()*0.9, 20), Qt::AlignRight | Qt::AlignVCenter, "Frequency: "+freq_string+" ");
+ p.drawText(QRectF(0, 100*index + UpMargin, get_view_rect().width()*0.9, 20), Qt::AlignRight | Qt::AlignVCenter, tr("Max: ")+max_string+" ");
+ p.drawText(QRectF(0, 100*index + UpMargin + 20, get_view_rect().width()*0.9, 20), Qt::AlignRight | Qt::AlignVCenter, tr("Min: ")+min_string+" ");
+ p.drawText(QRectF(0, 100*index + UpMargin + 40, get_view_rect().width()*0.9, 20), Qt::AlignRight | Qt::AlignVCenter, tr("Period: ")+period_string+" ");
+ p.drawText(QRectF(0, 100*index + UpMargin + 60, get_view_rect().width()*0.9, 20), Qt::AlignRight | Qt::AlignVCenter, tr("Frequency: ")+freq_string+" ");
if (_autoV) {
const uint8_t vscale = abs(_max - _min);
diff --git a/DSView/pv/view/viewport.cpp b/DSView/pv/view/viewport.cpp
index 87737fc2..251129a1 100644
--- a/DSView/pv/view/viewport.cpp
+++ b/DSView/pv/view/viewport.cpp
@@ -612,13 +612,13 @@ void Viewport::paintMeasure(QPainter &p)
p.setPen(Qt::black);
p.drawText(measure1_rect, Qt::AlignRight | Qt::AlignVCenter,
- "Width: " + _mm_width);
+ tr("Width: ") + _mm_width);
p.drawText(measure2_rect, Qt::AlignRight | Qt::AlignVCenter,
- "Period: " + _mm_period);
+ tr("Period: ") + _mm_period);
p.drawText(measure3_rect, Qt::AlignRight | Qt::AlignVCenter,
- "Frequency: " + _mm_freq);
+ tr("Frequency: ") + _mm_freq);
p.drawText(measure4_rect, Qt::AlignRight | Qt::AlignVCenter,
- "Duty Cycle: " + _mm_duty);
+ tr("Duty Cycle: ") + _mm_duty);
}
} else if (_measure_type == DSO) {
const vector< boost::shared_ptr > sigs(_view.session().get_signals());