]> sigrok.org Git - pulseview.git/blobdiff - pv/toolbars/mainbar.cpp
Add "save selection range as..." to the export menu on the toolbar
[pulseview.git] / pv / toolbars / mainbar.cpp
index b404b3da45b32666f335fbee88d773c657b0b855..50e1908fb66031005cefbbadcbc9439461c1ace3 100644 (file)
@@ -110,9 +110,13 @@ MainBar::MainBar(Session &session, MainWindow &main_window) :
        // Save button
        QToolButton *const save_button = new QToolButton(this);
 
+       vector<QAction *> open_actions;
+       open_actions.push_back(main_window.action_save_as());
+       open_actions.push_back(main_window.action_save_selection_as());
+
        widgets::ExportMenu *export_menu = new widgets::ExportMenu(this,
                session.device_manager().context(),
-               main_window.action_save_as());
+               open_actions);
        connect(export_menu,
                SIGNAL(format_selected(std::shared_ptr<sigrok::OutputFormat>)),
                &main_window_,
@@ -135,13 +139,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 +236,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()
@@ -570,10 +588,11 @@ 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<QHelpEvent*>(event);
 
-               QString str = tr("Total sampling time: %1").arg(pv::util::format_second(sec));
+               QString str = tr("Total sampling time: %1").arg(
+                       pv::util::format_time_si(sec, pv::util::SIPrefix::unspecified, 0, "s", false));
                QToolTip::showText(help_event->globalPos(), str);
 
                return true;