]> sigrok.org Git - pulseview.git/blobdiff - pv/toolbars/mainbar.cpp
MainBar: Only show "total sampling time" tooltip if supported by device.
[pulseview.git] / pv / toolbars / mainbar.cpp
index fff245d31e8d44b3b3986480f339c44a031b7ce9..06d4f409b718a77e9546d076d7ebe7b496d6debf 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_,
@@ -582,12 +586,14 @@ void MainBar::on_config_changed()
 
 bool MainBar::eventFilter(QObject *watched, QEvent *event)
 {
-       if ((watched == &sample_count_ || watched == &sample_rate_) &&
+       if (sample_count_supported_ &&
+               (watched == &sample_count_ || watched == &sample_rate_) &&
                (event->type() == QEvent::ToolTip)) {
                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;