From 4f21488835b51c77af0f548838f964f9facd43e5 Mon Sep 17 00:00:00 2001 From: dreamsourcelabTAI Date: Tue, 28 Mar 2023 10:53:56 +0800 Subject: [PATCH] fix: Can't resotre the 'Hold Off Time' from file --- DSView/main.cpp | 2 +- DSView/pv/dock/dsotriggerdock.cpp | 18 ++++++++++++------ lang/cn/dlg.json | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/DSView/main.cpp b/DSView/main.cpp index ddce8247..0e266bc1 100644 --- a/DSView/main.cpp +++ b/DSView/main.cpp @@ -184,7 +184,7 @@ bool bHighScale = true; #ifdef DEBUG_INFO if (XLOG_LEVEL_INFO > logLevel){ - dsv_log_level(XLOG_LEVEL_INFO); // on develop mode, set the default log ldevel + dsv_log_level(XLOG_LEVEL_INFO); // on develop mode, set the default log level logLevel = XLOG_LEVEL_INFO; } #endif diff --git a/DSView/pv/dock/dsotriggerdock.cpp b/DSView/pv/dock/dsotriggerdock.cpp index 9eda81cd..a8f12153 100644 --- a/DSView/pv/dock/dsotriggerdock.cpp +++ b/DSView/pv/dock/dsotriggerdock.cpp @@ -64,9 +64,10 @@ DsoTriggerDock::DsoTriggerDock(QWidget *parent, SigSession *session) : _holdoff_label = new QLabel(_widget); _holdoff_comboBox = new DsComboBox(_widget); //tr - _holdoff_comboBox->addItem(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_US), "uS"), QVariant::fromValue(1000)); - _holdoff_comboBox->addItem(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_MS), "mS"), QVariant::fromValue(1000000)); _holdoff_comboBox->addItem(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_S), "S"), QVariant::fromValue(1000000000)); + _holdoff_comboBox->addItem(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_MS), "mS"), QVariant::fromValue(1000000)); + _holdoff_comboBox->addItem(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_US), "uS"), QVariant::fromValue(1000)); + _holdoff_comboBox->setCurrentIndex(0); _holdoff_spinBox = new QSpinBox(_widget); _holdoff_spinBox->setRange(0, 999); @@ -441,9 +442,12 @@ void DsoTriggerDock::update_view() if (gvar != NULL) { uint64_t holdoff = g_variant_get_uint64(gvar); g_variant_unref(gvar); + + auto v = holdoff * 10.0; - for (int i = _holdoff_comboBox->count()-1; i >= 0; i--) { - if (holdoff >= _holdoff_comboBox->itemData(i).toDouble()) { + for (int i=0; i<_holdoff_comboBox->count(); i++) + { + if (v >= _holdoff_comboBox->itemData(i).toDouble()) { _holdoff_comboBox->setCurrentIndex(i); break; } @@ -453,9 +457,11 @@ void DsoTriggerDock::update_view() _holdoff_slider->setRange(0, 10); else _holdoff_slider->setRange(0, 999); - - _holdoff_spinBox->setValue(holdoff * 10.0 / _holdoff_comboBox->currentData().toDouble()); + + auto v1 = holdoff * 10.0 / _holdoff_comboBox->currentData().toDouble(); + _holdoff_spinBox->setValue(v1); } + connect(_holdoff_slider, SIGNAL(valueChanged(int)), this, SLOT(hold_changed(int))); connect(_holdoff_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(hold_changed(int))); diff --git a/lang/cn/dlg.json b/lang/cn/dlg.json index af940b21..5d7e81ed 100644 --- a/lang/cn/dlg.json +++ b/lang/cn/dlg.json @@ -77,7 +77,7 @@ }, { "id": "IDS_DLG_EXIT", - "text": "推出" + "text": "退出" }, { "id": "IDS_DLG_MANUAL_CALIBRATION",