X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Ftoolbars%2Fmainbar.cpp;h=fff245d31e8d44b3b3986480f339c44a031b7ce9;hb=60d9b99a32e551cffd2b537d3e157d578a761c9b;hp=0bf2270259b8f58138da8fb89bf19c605f0b6192;hpb=449aec3cba1974d34a9c9a66b3cf8fc5208b62f4;p=pulseview.git diff --git a/pv/toolbars/mainbar.cpp b/pv/toolbars/mainbar.cpp index 0bf2270..fff245d 100644 --- a/pv/toolbars/mainbar.cpp +++ b/pv/toolbars/mainbar.cpp @@ -135,13 +135,19 @@ MainBar::MainBar(Session &session, MainWindow &main_window) : add_decoder_button->setMenu(main_window_.menu_decoder_add()); #endif - // Setup the menu + // Setup the burger menu QMenu *const menu = new QMenu(this); + QMenu *const menu_view = new QMenu; + menu_view->setTitle(tr("&View")); + menu_view->addAction(main_window.action_view_sticky_scrolling()); + QMenu *const menu_help = new QMenu; menu_help->setTitle(tr("&Help")); menu_help->addAction(main_window.action_about()); + menu->addAction(menu_view->menuAction()); + menu->addSeparator(); menu->addAction(menu_help->menuAction()); menu->addSeparator(); menu->addAction(main_window.action_quit()); @@ -226,6 +232,14 @@ void MainBar::set_capture_state(pv::Session::capture_state state) run_stop_button_.setText((state == pv::Session::Stopped) ? tr("Run") : tr("Stop")); run_stop_button_.setShortcut(QKeySequence(Qt::Key_Space)); + + bool ui_enabled = (state == pv::Session::Stopped) ? true : false; + + device_selector_.setEnabled(ui_enabled); + configure_button_.setEnabled(ui_enabled); + channels_button_.setEnabled(ui_enabled); + sample_count_.setEnabled(ui_enabled); + sample_rate_.setEnabled(ui_enabled); } void MainBar::update_sample_rate_selector() @@ -493,6 +507,11 @@ void MainBar::commit_sample_count() return; } } + + // Devices with built-in memory might impose limits on certain + // configurations, so let's check what sample rate the driver + // lets us use now. + update_sample_rate_selector(); } void MainBar::commit_sample_rate() @@ -518,6 +537,11 @@ void MainBar::commit_sample_rate() qDebug() << "Failed to configure samplerate."; return; } + + // Devices with built-in memory might impose limits on certain + // configurations, so let's check what sample count the driver + // lets us use now. + update_sample_count_selector(); } void MainBar::on_device_selected() @@ -560,7 +584,7 @@ bool MainBar::eventFilter(QObject *watched, QEvent *event) { if ((watched == &sample_count_ || watched == &sample_rate_) && (event->type() == QEvent::ToolTip)) { - double sec = (double)sample_count_.value() / sample_rate_.value(); + auto sec = pv::util::Timestamp(sample_count_.value()) / sample_rate_.value(); QHelpEvent *help_event = static_cast(event); QString str = tr("Total sampling time: %1").arg(pv::util::format_second(sec));