diff --git a/DSView/pv/dock/triggerdock.cpp b/DSView/pv/dock/triggerdock.cpp index 1e382b91..ee4ae6f2 100644 --- a/DSView/pv/dock/triggerdock.cpp +++ b/DSView/pv/dock/triggerdock.cpp @@ -369,11 +369,12 @@ void TriggerDock::device_change() if (stream || strcmp(_session.get_device()->dev_inst()->driver->name, "DSLogic") != 0) { - position_spinBox->setDisabled(true); - position_slider->setDisabled(true); + const int maxRange = SR_MB(11)*100/_session.get_device()->get_sample_limit(); + position_spinBox->setRange(0, maxRange); + position_slider->setRange(0, maxRange); } else { - position_spinBox->setDisabled(false); - position_slider->setDisabled(false); + position_spinBox->setRange(0, 99); + position_slider->setRange(0, 99); } } diff --git a/DSView/pv/mainwindow.cpp b/DSView/pv/mainwindow.cpp index 9725804a..b37dc504 100644 --- a/DSView/pv/mainwindow.cpp +++ b/DSView/pv/mainwindow.cpp @@ -180,7 +180,7 @@ void MainWindow::setup_ui() connect(_sampling_bar, SIGNAL(device_selected()), this, SLOT(update_device_list())); - connect(_sampling_bar, SIGNAL(device_updated()), &_session, + connect(_sampling_bar, SIGNAL(device_updated()), this, SLOT(reload())); connect(_sampling_bar, SIGNAL(run_stop()), this, SLOT(run_stop())); @@ -317,6 +317,12 @@ void MainWindow::update_device_list() _logo_bar->dsl_connected(false); } +void MainWindow::reload() +{ + _trigger_widget->device_change(); + _session.reload(); +} + void MainWindow::load_file(QString file_name) { try { diff --git a/DSView/pv/mainwindow.h b/DSView/pv/mainwindow.h index a52e901c..34566805 100644 --- a/DSView/pv/mainwindow.h +++ b/DSView/pv/mainwindow.h @@ -90,6 +90,8 @@ private slots: */ void update_device_list(); + void reload(); + void show_session_error( const QString text, const QString info_text); diff --git a/DSView/pv/toolbars/samplingbar.cpp b/DSView/pv/toolbars/samplingbar.cpp index b7414547..289fce77 100644 --- a/DSView/pv/toolbars/samplingbar.cpp +++ b/DSView/pv/toolbars/samplingbar.cpp @@ -667,19 +667,21 @@ void SamplingBar::on_run_stop() const shared_ptr dev_inst = get_selected_device(); if (!dev_inst) return; - GVariant* gvar = dev_inst->get_config(NULL, NULL, SR_CONF_ZERO); - if (gvar != NULL) { - bool zero = g_variant_get_boolean(gvar); - g_variant_unref(gvar); - if (zero) { - QMessageBox msg(this); - msg.setText("Zero Adjustment"); - msg.setInformativeText("Please adjust zero skew and save the result!"); - msg.setStandardButtons(QMessageBox::Ok); - msg.setIcon(QMessageBox::Warning); - msg.exec(); - zero_adj(); - return; + if (dev_inst->dev_inst()->mode == DSO) { + GVariant* gvar = dev_inst->get_config(NULL, NULL, SR_CONF_ZERO); + if (gvar != NULL) { + bool zero = g_variant_get_boolean(gvar); + g_variant_unref(gvar); + if (zero) { + QMessageBox msg(this); + msg.setText("Zero Adjustment"); + msg.setInformativeText("Please adjust zero skew and save the result!"); + msg.setStandardButtons(QMessageBox::Ok); + msg.setIcon(QMessageBox::Warning); + msg.exec(); + zero_adj(); + return; + } } } run_stop(); @@ -695,22 +697,24 @@ void SamplingBar::on_instant_stop() const shared_ptr dev_inst = get_selected_device(); if (!dev_inst) return; - GVariant* gvar = dev_inst->get_config(NULL, NULL, SR_CONF_ZERO); - if (gvar != NULL) { - bool zero = g_variant_get_boolean(gvar); - g_variant_unref(gvar); - if (zero) { - QMessageBox msg(this); - msg.setText("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!"); - else - msg.setInformativeText("Please adjust zero skew and save the result!"); - msg.setStandardButtons(QMessageBox::Ok); - msg.setIcon(QMessageBox::Warning); - msg.exec(); - zero_adj(); - return; + if (dev_inst->dev_inst()->mode == DSO) { + GVariant* gvar = dev_inst->get_config(NULL, NULL, SR_CONF_ZERO); + if (gvar != NULL) { + bool zero = g_variant_get_boolean(gvar); + g_variant_unref(gvar); + if (zero) { + QMessageBox msg(this); + msg.setText("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!"); + else + msg.setInformativeText("Please adjust zero skew and save the result!"); + msg.setStandardButtons(QMessageBox::Ok); + msg.setIcon(QMessageBox::Warning); + msg.exec(); + zero_adj(); + return; + } } } instant_stop(); diff --git a/DSView/pv/view/ruler.cpp b/DSView/pv/view/ruler.cpp index ac920785..0a3b8015 100644 --- a/DSView/pv/view/ruler.cpp +++ b/DSView/pv/view/ruler.cpp @@ -102,9 +102,8 @@ QString Ruler::format_freq(double period, unsigned precision) } else { const int order = ceil(log10f(period)); assert(order >= FirstSIPrefixPower); - const unsigned int prefix = ceil((order - FirstSIPrefixPower) / 3.0f); - const double multiplier = pow(10.0, - static_cast(- prefix * 3 - FirstSIPrefixPower)); + const int prefix = ceil((order - FirstSIPrefixPower) / 3.0f); + const double multiplier = pow(10.0, max(-prefix * 3.0 - FirstSIPrefixPower, 0.0)); QString s; QTextStream ts(&s); @@ -115,11 +114,10 @@ QString Ruler::format_freq(double period, unsigned precision) } } -QString Ruler::format_time(double t, unsigned int prefix, +QString Ruler::format_time(double t, int prefix, unsigned int precision) { - const double multiplier = pow(10.0, - static_cast(- prefix * 3 - FirstSIPrefixPower + 6)); + const double multiplier = pow(10.0, -prefix * 3 - FirstSIPrefixPower + 6.0); QString s; QTextStream ts(&s); diff --git a/DSView/pv/view/ruler.h b/DSView/pv/view/ruler.h index 1f322470..c22d8cce 100644 --- a/DSView/pv/view/ruler.h +++ b/DSView/pv/view/ruler.h @@ -63,7 +63,7 @@ public: public: Ruler(View &parent); - static QString format_time(double t, unsigned int prefix, + static QString format_time(double t, int prefix, unsigned precision = pricision); static QString format_freq(double period, unsigned precision = pricision); QString format_time(double t); diff --git a/DSView/pv/view/viewport.cpp b/DSView/pv/view/viewport.cpp index 4ed6c381..0c362370 100644 --- a/DSView/pv/view/viewport.cpp +++ b/DSView/pv/view/viewport.cpp @@ -320,7 +320,7 @@ void Viewport::paintProgress(QPainter &p) if (triggred) p.drawText(status_rect, Qt::AlignCenter | Qt::AlignVCenter, - "Triggered! " + QString::number(captured_progress)+"% Captured"); + "Triggered! " + QString::number(1-captured_progress)+"% Captured"); else p.drawText(status_rect, Qt::AlignCenter | Qt::AlignVCenter,