X-Git-Url: http://git.code-monkey.de/?p=pulseview.git;a=blobdiff_plain;f=pv%2Ftoolbars%2Fmainbar.cpp;h=df1363db214ab45c3fbd977f5f2e562f0aaa58c7;hp=16888624bc2f124030005fc481ae6838f5adbba5;hb=970fca0d353f5c6d05c763bf7bdd12aac6f5ea0b;hpb=bc4b9ccfc78d9d0987525360fa6d93bed681951a diff --git a/pv/toolbars/mainbar.cpp b/pv/toolbars/mainbar.cpp index 1688862..df1363d 100644 --- a/pv/toolbars/mainbar.cpp +++ b/pv/toolbars/mainbar.cpp @@ -302,17 +302,21 @@ void MainBar::update_sample_rate_selector() const shared_ptr sr_dev = device->device(); - try { - auto gvar = sr_dev->config_get(ConfigKey::EXTERNAL_CLOCK); - if (gvar.gobj()) { - bool value = Glib::VariantBase::cast_dynamic>( - gvar).get(); - sample_rate_.allow_user_entered_values(value); + sample_rate_.allow_user_entered_values(false); + if (sr_dev->config_check(ConfigKey::EXTERNAL_CLOCK, Capability::GET)) { + try { + auto gvar = sr_dev->config_get(ConfigKey::EXTERNAL_CLOCK); + if (gvar.gobj()) { + bool value = Glib::VariantBase::cast_dynamic>( + gvar).get(); + sample_rate_.allow_user_entered_values(value); + } + } catch (Error& error) { + // Do nothing } - } catch (Error& error) { - // Do nothing } + if (sr_dev->config_check(ConfigKey::SAMPLERATE, Capability::LIST)) { try { gvar_dict = sr_dev->config_list(ConfigKey::SAMPLERATE); @@ -380,7 +384,7 @@ void MainBar::update_sample_rate_selector_value() sample_rate_.set_value(samplerate); updating_sample_rate_ = false; } catch (Error& error) { - qDebug() << tr("Failed to get value of sample rate:") << error.what(); + qDebug() << tr("Failed to get sample rate:") << error.what(); } } @@ -505,8 +509,6 @@ void MainBar::commit_sample_rate() const shared_ptr sr_dev = device->device(); sample_rate = sample_rate_.value(); - if (sample_rate == 0) - return; try { sr_dev->config_set(ConfigKey::SAMPLERATE, @@ -554,8 +556,7 @@ void MainBar::commit_sample_count() void MainBar::show_session_error(const QString text, const QString info_text) { QMessageBox msg(this); - msg.setText(text); - msg.setInformativeText(info_text); + msg.setText(text + "\n\n" + info_text); msg.setStandardButtons(QMessageBox::Ok); msg.setIcon(QMessageBox::Warning); msg.exec(); @@ -603,9 +604,9 @@ void MainBar::export_file(shared_ptr format, bool selection_only) const pv::util::Timestamp& end_time = trace_view->cursors()->second()->time(); const uint64_t start_sample = (uint64_t)max( - (double)0, start_time.convert_to() * samplerate); + 0.0, start_time.convert_to() * samplerate); const uint64_t end_sample = (uint64_t)max( - (double)0, end_time.convert_to() * samplerate); + 0.0, end_time.convert_to() * samplerate); if ((start_sample == 0) && (end_sample == 0)) { // Both cursors are negative and were clamped to 0