add language support

This commit is contained in:
DreamSourceLab 2015-05-25 16:47:33 +08:00
parent 6274829f3e
commit 4b024dd388
32 changed files with 187 additions and 103 deletions

View File

@ -36,5 +36,20 @@
<file>icons/gear.png</file>
<file>icons/wiki.png</file>
<file>icons/wait.gif</file>
<file>icons/file_cn.png</file>
<file>icons/file_dis_cn.png</file>
<file>icons/instant_cn.png</file>
<file>icons/measure_cn.png</file>
<file>icons/measure_dis_cn.png</file>
<file>icons/params_cn.png</file>
<file>icons/params_dis_cn.png</file>
<file>icons/protocol_dis_cn.png</file>
<file>icons/search-bar_cn.png</file>
<file>icons/search-bar_dis_cn.png</file>
<file>icons/start_cn.png</file>
<file>icons/stop_cn.png</file>
<file>icons/trigger_cn.png</file>
<file>icons/trigger_dis_cn.png</file>
<file>icons/protocol_cn.png</file>
</qresource>
</RCC>

BIN
DSView/icons/file_cn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
DSView/icons/instant_cn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
DSView/icons/measure_cn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
DSView/icons/params_cn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
DSView/icons/start_cn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
DSView/icons/stop_cn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 830 B

BIN
DSView/icons/trigger_cn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -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) {

View File

@ -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);

View File

@ -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);

View File

@ -52,17 +52,17 @@ StreamOptions::StreamOptions(QWidget *parent, boost::shared_ptr<pv::device::DevI
QLabel *_info = new QLabel(this);
if (_stream)
_info->setText("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);

View File

@ -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<pv::device::DevInst> dev_inst) :
QDialog(parent),

View File

@ -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();

View File

@ -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<Cursor*>::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);

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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

View File

@ -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();

View File

@ -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()

View File

@ -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);

View File

@ -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<Signal> > sigs(_view.session().get_signals());