2 * This file is part of the PulseView project.
4 * Copyright (C) 2012-2015 Joel Holdsworth <joel@airwebreathe.org.uk>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
27 #include <QFileDialog>
30 #include <QMessageBox>
34 #include "mainbar.hpp"
36 #include <boost/algorithm/string/join.hpp>
38 #include <pv/data/decodesignal.hpp>
39 #include <pv/devicemanager.hpp>
40 #include <pv/devices/hardwaredevice.hpp>
41 #include <pv/devices/inputfile.hpp>
42 #include <pv/devices/sessionfile.hpp>
43 #include <pv/dialogs/connect.hpp>
44 #include <pv/dialogs/inputoutputoptions.hpp>
45 #include <pv/dialogs/storeprogress.hpp>
46 #include <pv/mainwindow.hpp>
47 #include <pv/popups/channels.hpp>
48 #include <pv/popups/deviceoptions.hpp>
49 #include <pv/util.hpp>
50 #include <pv/views/trace/view.hpp>
51 #include <pv/widgets/exportmenu.hpp>
52 #include <pv/widgets/importmenu.hpp>
54 #include <pv/widgets/decodermenu.hpp>
57 #include <libsigrokcxx/libsigrokcxx.hpp>
59 using std::back_inserter;
68 using std::shared_ptr;
72 using sigrok::Capability;
73 using sigrok::ConfigKey;
75 using sigrok::InputFormat;
76 using sigrok::OutputFormat;
78 using boost::algorithm::join;
83 const uint64_t MainBar::MinSampleCount = 100ULL;
84 const uint64_t MainBar::MaxSampleCount = 1000000000000ULL;
85 const uint64_t MainBar::DefaultSampleCount = 1000000;
87 const char *MainBar::SettingOpenDirectory = "MainWindow/OpenDirectory";
88 const char *MainBar::SettingSaveDirectory = "MainWindow/SaveDirectory";
90 MainBar::MainBar(Session &session, QWidget *parent, pv::views::trace::View *view) :
91 StandardBar(session, parent, view, false),
92 action_new_view_(new QAction(this)),
93 action_open_(new QAction(this)),
94 action_save_as_(new QAction(this)),
95 action_save_selection_as_(new QAction(this)),
96 action_connect_(new QAction(this)),
97 open_button_(new QToolButton()),
98 save_button_(new QToolButton()),
99 device_selector_(parent, session.device_manager(), action_connect_),
100 configure_button_(this),
101 configure_button_action_(nullptr),
102 channels_button_(this),
103 channels_button_action_(nullptr),
104 sample_count_(" samples", this),
105 sample_rate_("Hz", this),
106 updating_sample_rate_(false),
107 updating_sample_count_(false),
108 sample_count_supported_(false)
110 , add_decoder_button_(new QToolButton()),
111 menu_decoders_add_(new pv::widgets::DecoderMenu(this, true))
114 setObjectName(QString::fromUtf8("MainBar"));
116 setContextMenuPolicy(Qt::PreventContextMenu);
119 action_new_view_->setText(tr("New &View"));
120 action_new_view_->setIcon(QIcon::fromTheme("window-new",
121 QIcon(":/icons/window-new.png")));
122 connect(action_new_view_, SIGNAL(triggered(bool)),
123 this, SLOT(on_actionNewView_triggered()));
125 action_open_->setText(tr("&Open..."));
126 action_open_->setIcon(QIcon::fromTheme("document-open",
127 QIcon(":/icons/document-open.png")));
128 action_open_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
129 connect(action_open_, SIGNAL(triggered(bool)),
130 this, SLOT(on_actionOpen_triggered()));
132 action_save_as_->setText(tr("&Save As..."));
133 action_save_as_->setIcon(QIcon::fromTheme("document-save-as",
134 QIcon(":/icons/document-save-as.png")));
135 action_save_as_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
136 connect(action_save_as_, SIGNAL(triggered(bool)),
137 this, SLOT(on_actionSaveAs_triggered()));
139 action_save_selection_as_->setText(tr("Save Selected &Range As..."));
140 action_save_selection_as_->setIcon(QIcon::fromTheme("document-save-as",
141 QIcon(":/icons/document-save-as.png")));
142 action_save_selection_as_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
143 connect(action_save_selection_as_, SIGNAL(triggered(bool)),
144 this, SLOT(on_actionSaveSelectionAs_triggered()));
146 widgets::ExportMenu *menu_file_export = new widgets::ExportMenu(this,
147 session.device_manager().context());
148 menu_file_export->setTitle(tr("&Export"));
149 connect(menu_file_export, SIGNAL(format_selected(shared_ptr<sigrok::OutputFormat>)),
150 this, SLOT(export_file(shared_ptr<sigrok::OutputFormat>)));
152 widgets::ImportMenu *menu_file_import = new widgets::ImportMenu(this,
153 session.device_manager().context());
154 menu_file_import->setTitle(tr("&Import"));
155 connect(menu_file_import, SIGNAL(format_selected(shared_ptr<sigrok::InputFormat>)),
156 this, SLOT(import_file(shared_ptr<sigrok::InputFormat>)));
158 action_connect_->setText(tr("&Connect to Device..."));
159 connect(action_connect_, SIGNAL(triggered(bool)),
160 this, SLOT(on_actionConnect_triggered()));
163 widgets::ImportMenu *import_menu = new widgets::ImportMenu(this,
164 session.device_manager().context(), action_open_);
165 connect(import_menu, SIGNAL(format_selected(shared_ptr<sigrok::InputFormat>)),
166 this, SLOT(import_file(shared_ptr<sigrok::InputFormat>)));
168 open_button_->setMenu(import_menu);
169 open_button_->setDefaultAction(action_open_);
170 open_button_->setPopupMode(QToolButton::MenuButtonPopup);
173 vector<QAction*> open_actions;
174 open_actions.push_back(action_save_as_);
175 open_actions.push_back(action_save_selection_as_);
177 widgets::ExportMenu *export_menu = new widgets::ExportMenu(this,
178 session.device_manager().context(), open_actions);
179 connect(export_menu, SIGNAL(format_selected(shared_ptr<sigrok::OutputFormat>)),
180 this, SLOT(export_file(shared_ptr<sigrok::OutputFormat>)));
182 save_button_->setMenu(export_menu);
183 save_button_->setDefaultAction(action_save_as_);
184 save_button_->setPopupMode(QToolButton::MenuButtonPopup);
186 // Device selector menu
187 connect(&device_selector_, SIGNAL(device_selected()),
188 this, SLOT(on_device_selected()));
190 // Setup the decoder button
192 menu_decoders_add_->setTitle(tr("&Add"));
193 connect(menu_decoders_add_, SIGNAL(decoder_selected(srd_decoder*)),
194 this, SLOT(add_decoder(srd_decoder*)));
196 add_decoder_button_->setIcon(QIcon(":/icons/add-decoder.svg"));
197 add_decoder_button_->setPopupMode(QToolButton::InstantPopup);
198 add_decoder_button_->setMenu(menu_decoders_add_);
199 add_decoder_button_->setToolTip(tr("Add low-level, non-stacked protocol decoder"));
202 connect(&sample_count_, SIGNAL(value_changed()),
203 this, SLOT(on_sample_count_changed()));
204 connect(&sample_rate_, SIGNAL(value_changed()),
205 this, SLOT(on_sample_rate_changed()));
207 sample_count_.show_min_max_step(0, UINT64_MAX, 1);
209 set_capture_state(pv::Session::Stopped);
211 configure_button_.setToolTip(tr("Configure Device"));
212 configure_button_.setIcon(QIcon::fromTheme("preferences-system",
213 QIcon(":/icons/preferences-system.png")));
215 channels_button_.setToolTip(tr("Configure Channels"));
216 channels_button_.setIcon(QIcon(":/icons/channels.svg"));
218 add_toolbar_widgets();
220 sample_count_.installEventFilter(this);
221 sample_rate_.installEventFilter(this);
223 // Setup session_ events
224 connect(&session_, SIGNAL(capture_state_changed(int)),
225 this, SLOT(on_capture_state_changed(int)));
226 connect(&session, SIGNAL(device_changed()),
227 this, SLOT(on_device_changed()));
229 update_device_list();
232 void MainBar::update_device_list()
234 DeviceManager &mgr = session_.device_manager();
235 shared_ptr<devices::Device> selected_device = session_.device();
236 list< shared_ptr<devices::Device> > devs;
238 copy(mgr.devices().begin(), mgr.devices().end(), back_inserter(devs));
240 if (std::find(devs.begin(), devs.end(), selected_device) == devs.end())
241 devs.push_back(selected_device);
243 device_selector_.set_device_list(devs, selected_device);
244 update_device_config_widgets();
247 void MainBar::set_capture_state(pv::Session::capture_state state)
249 bool ui_enabled = (state == pv::Session::Stopped) ? true : false;
251 device_selector_.setEnabled(ui_enabled);
252 configure_button_.setEnabled(ui_enabled);
253 channels_button_.setEnabled(ui_enabled);
254 sample_count_.setEnabled(ui_enabled);
255 sample_rate_.setEnabled(ui_enabled);
258 void MainBar::reset_device_selector()
260 device_selector_.reset();
263 QAction* MainBar::action_open() const
268 QAction* MainBar::action_save_as() const
270 return action_save_as_;
273 QAction* MainBar::action_save_selection_as() const
275 return action_save_selection_as_;
278 QAction* MainBar::action_connect() const
280 return action_connect_;
283 void MainBar::update_sample_rate_selector()
285 Glib::VariantContainerBase gvar_dict;
287 const uint64_t *elements = nullptr;
289 map< const ConfigKey*, set<Capability> > keys;
291 if (updating_sample_rate_) {
292 sample_rate_.show_none();
296 const shared_ptr<devices::Device> device = device_selector_.selected_device();
300 assert(!updating_sample_rate_);
301 updating_sample_rate_ = true;
303 const shared_ptr<sigrok::Device> sr_dev = device->device();
306 auto gvar = sr_dev->config_get(ConfigKey::EXTERNAL_CLOCK);
308 bool value = Glib::VariantBase::cast_dynamic<Glib::Variant<bool>>(
310 sample_rate_.allow_user_entered_values(value);
312 } catch (Error& error) {
316 if (sr_dev->config_check(ConfigKey::SAMPLERATE, Capability::LIST)) {
318 gvar_dict = sr_dev->config_list(ConfigKey::SAMPLERATE);
319 } catch (Error& error) {
320 qDebug() << tr("Failed to get sample rate list:") << error.what();
323 sample_rate_.show_none();
324 updating_sample_rate_ = false;
328 if ((gvar_list = g_variant_lookup_value(gvar_dict.gobj(),
329 "samplerate-steps", G_VARIANT_TYPE("at")))) {
330 elements = (const uint64_t *)g_variant_get_fixed_array(
331 gvar_list, &num_elements, sizeof(uint64_t));
333 const uint64_t min = elements[0];
334 const uint64_t max = elements[1];
335 const uint64_t step = elements[2];
337 g_variant_unref(gvar_list);
345 sample_rate_.show_125_list(min, max);
347 // When the step is not 1, we cam't make a 1-2-5-10
348 // list of sample rates, because we may not be able to
349 // make round numbers. Therefore in this case, show a
351 sample_rate_.show_min_max_step(min, max, step);
353 } else if ((gvar_list = g_variant_lookup_value(gvar_dict.gobj(),
354 "samplerates", G_VARIANT_TYPE("at")))) {
355 elements = (const uint64_t *)g_variant_get_fixed_array(
356 gvar_list, &num_elements, sizeof(uint64_t));
357 sample_rate_.show_list(elements, num_elements);
358 g_variant_unref(gvar_list);
360 updating_sample_rate_ = false;
362 update_sample_rate_selector_value();
365 void MainBar::update_sample_rate_selector_value()
367 if (updating_sample_rate_)
370 const shared_ptr<devices::Device> device = device_selector_.selected_device();
375 auto gvar = device->device()->config_get(ConfigKey::SAMPLERATE);
376 uint64_t samplerate =
377 Glib::VariantBase::cast_dynamic<Glib::Variant<guint64>>(gvar).get();
378 assert(!updating_sample_rate_);
379 updating_sample_rate_ = true;
380 sample_rate_.set_value(samplerate);
381 updating_sample_rate_ = false;
382 } catch (Error& error) {
383 qDebug() << tr("Failed to get value of sample rate:") << error.what();
387 void MainBar::update_sample_count_selector()
389 if (updating_sample_count_)
392 const shared_ptr<devices::Device> device = device_selector_.selected_device();
396 const shared_ptr<sigrok::Device> sr_dev = device->device();
398 assert(!updating_sample_count_);
399 updating_sample_count_ = true;
401 if (!sample_count_supported_) {
402 sample_count_.show_none();
403 updating_sample_count_ = false;
407 uint64_t sample_count = sample_count_.value();
408 uint64_t min_sample_count = 0;
409 uint64_t max_sample_count = MaxSampleCount;
410 bool default_count_set = false;
412 if (sample_count == 0) {
413 sample_count = DefaultSampleCount;
414 default_count_set = true;
417 if (sr_dev->config_check(ConfigKey::LIMIT_SAMPLES, Capability::LIST)) {
419 auto gvar = sr_dev->config_list(ConfigKey::LIMIT_SAMPLES);
421 g_variant_get(gvar.gobj(), "(tt)",
422 &min_sample_count, &max_sample_count);
423 } catch (Error& error) {
424 qDebug() << tr("Failed to get sample limit list:") << error.what();
428 min_sample_count = min(max(min_sample_count, MinSampleCount),
431 sample_count_.show_125_list(min_sample_count, max_sample_count);
433 if (sr_dev->config_check(ConfigKey::LIMIT_SAMPLES, Capability::GET)) {
434 auto gvar = sr_dev->config_get(ConfigKey::LIMIT_SAMPLES);
435 sample_count = g_variant_get_uint64(gvar.gobj());
436 if (sample_count == 0) {
437 sample_count = DefaultSampleCount;
438 default_count_set = true;
440 sample_count = min(max(sample_count, MinSampleCount),
444 sample_count_.set_value(sample_count);
446 updating_sample_count_ = false;
448 // If we show the default rate then make sure the device uses the same
449 if (default_count_set)
450 commit_sample_count();
453 void MainBar::update_device_config_widgets()
455 using namespace pv::popups;
457 const shared_ptr<devices::Device> device = device_selector_.selected_device();
459 // Hide the widgets if no device is selected
460 channels_button_action_->setVisible(!!device);
462 configure_button_action_->setVisible(false);
463 sample_count_.show_none();
464 sample_rate_.show_none();
468 const shared_ptr<sigrok::Device> sr_dev = device->device();
472 // Update the configure popup
473 DeviceOptions *const opts = new DeviceOptions(sr_dev, this);
474 configure_button_action_->setVisible(!opts->binding().properties().empty());
475 configure_button_.set_popup(opts);
477 // Update the channels popup
478 Channels *const channels = new Channels(session_, this);
479 channels_button_.set_popup(channels);
481 // Update supported options.
482 sample_count_supported_ = false;
484 if (sr_dev->config_check(ConfigKey::LIMIT_SAMPLES, Capability::SET))
485 sample_count_supported_ = true;
487 // Add notification of reconfigure events
488 disconnect(this, SLOT(on_config_changed()));
489 connect(&opts->binding(), SIGNAL(config_changed()),
490 this, SLOT(on_config_changed()));
492 // Update sweep timing widgets.
493 update_sample_count_selector();
494 update_sample_rate_selector();
497 void MainBar::commit_sample_rate()
499 uint64_t sample_rate = 0;
501 const shared_ptr<devices::Device> device = device_selector_.selected_device();
505 const shared_ptr<sigrok::Device> sr_dev = device->device();
507 sample_rate = sample_rate_.value();
508 if (sample_rate == 0)
512 sr_dev->config_set(ConfigKey::SAMPLERATE,
513 Glib::Variant<guint64>::create(sample_rate));
514 update_sample_rate_selector();
515 } catch (Error& error) {
516 qDebug() << tr("Failed to configure samplerate:") << error.what();
520 // Devices with built-in memory might impose limits on certain
521 // configurations, so let's check what sample count the driver
523 update_sample_count_selector();
526 void MainBar::commit_sample_count()
528 uint64_t sample_count = 0;
530 const shared_ptr<devices::Device> device = device_selector_.selected_device();
534 const shared_ptr<sigrok::Device> sr_dev = device->device();
536 sample_count = sample_count_.value();
537 if (sample_count_supported_) {
539 sr_dev->config_set(ConfigKey::LIMIT_SAMPLES,
540 Glib::Variant<guint64>::create(sample_count));
541 update_sample_count_selector();
542 } catch (Error& error) {
543 qDebug() << tr("Failed to configure sample count:") << error.what();
548 // Devices with built-in memory might impose limits on certain
549 // configurations, so let's check what sample rate the driver
551 update_sample_rate_selector();
554 void MainBar::show_session_error(const QString text, const QString info_text)
556 QMessageBox msg(this);
558 msg.setInformativeText(info_text);
559 msg.setStandardButtons(QMessageBox::Ok);
560 msg.setIcon(QMessageBox::Warning);
564 void MainBar::add_decoder(srd_decoder *decoder)
568 shared_ptr<data::DecodeSignal> signal = session_.add_decode_signal();
570 signal->stack_decoder(decoder);
576 void MainBar::export_file(shared_ptr<OutputFormat> format, bool selection_only)
578 using pv::dialogs::StoreProgress;
580 // Stop any currently running capture session
581 session_.stop_capture();
584 const QString dir = settings.value(SettingSaveDirectory).toString();
586 pair<uint64_t, uint64_t> sample_range;
588 // Selection only? Verify that the cursors are active and fetch their values
589 if (selection_only) {
590 views::trace::View *trace_view =
591 qobject_cast<views::trace::View*>(session_.main_view().get());
593 if (!trace_view->cursors()->enabled()) {
594 show_session_error(tr("Missing Cursors"), tr("You need to set the " \
595 "cursors before you can save the data enclosed by them " \
596 "to a session file (e.g. using the Show Cursors button)."));
600 const double samplerate = session_.get_samplerate();
602 const pv::util::Timestamp& start_time = trace_view->cursors()->first()->time();
603 const pv::util::Timestamp& end_time = trace_view->cursors()->second()->time();
605 const uint64_t start_sample = (uint64_t)max(
606 (double)0, start_time.convert_to<double>() * samplerate);
607 const uint64_t end_sample = (uint64_t)max(
608 (double)0, end_time.convert_to<double>() * samplerate);
610 if ((start_sample == 0) && (end_sample == 0)) {
611 // Both cursors are negative and were clamped to 0
612 show_session_error(tr("Invalid Range"), tr("The cursors don't " \
613 "define a valid range of samples."));
617 sample_range = make_pair(start_sample, end_sample);
619 sample_range = make_pair(0, 0);
622 // Construct the filter
623 const vector<string> exts = format->extensions();
624 QString filter = tr("%1 files ").arg(
625 QString::fromStdString(format->description()));
630 filter += QString("(*.%1);;%2 (*)").arg(
631 QString::fromStdString(join(exts, ", *.")),
634 // Show the file dialog
635 const QString file_name = QFileDialog::getSaveFileName(
636 this, tr("Save File"), dir, filter);
638 if (file_name.isEmpty())
641 const QString abs_path = QFileInfo(file_name).absolutePath();
642 settings.setValue(SettingSaveDirectory, abs_path);
644 // Show the options dialog
645 map<string, Glib::VariantBase> options;
646 if (!format->options().empty()) {
647 dialogs::InputOutputOptions dlg(
648 tr("Export %1").arg(QString::fromStdString(
649 format->description())),
650 format->options(), this);
653 options = dlg.options();
657 session_.set_name(QFileInfo(file_name).fileName());
659 StoreProgress *dlg = new StoreProgress(file_name, format, options,
660 sample_range, session_, this);
664 void MainBar::import_file(shared_ptr<InputFormat> format)
669 const QString dir = settings.value(SettingOpenDirectory).toString();
671 // Construct the filter
672 const vector<string> exts = format->extensions();
673 const QString filter_exts = exts.empty() ? "" : QString::fromStdString("%1 (%2)").arg(
674 tr("%1 files").arg(QString::fromStdString(format->description())),
675 QString::fromStdString("*.%1").arg(QString::fromStdString(join(exts, " *."))));
676 const QString filter_all = QString::fromStdString("%1 (%2)").arg(
677 tr("All Files"), QString::fromStdString("*"));
678 const QString filter = QString::fromStdString("%1%2%3").arg(
679 exts.empty() ? "" : filter_exts,
680 exts.empty() ? "" : ";;",
683 // Show the file dialog
684 const QString file_name = QFileDialog::getOpenFileName(
685 this, tr("Import File"), dir, filter);
687 if (file_name.isEmpty())
690 // Show the options dialog
691 map<string, Glib::VariantBase> options;
692 if (!format->options().empty()) {
693 dialogs::InputOutputOptions dlg(
694 tr("Import %1").arg(QString::fromStdString(
695 format->description())),
696 format->options(), this);
699 options = dlg.options();
702 session_.load_file(file_name, format, options);
704 const QString abs_path = QFileInfo(file_name).absolutePath();
705 settings.setValue(SettingOpenDirectory, abs_path);
708 void MainBar::on_device_selected()
710 shared_ptr<devices::Device> device = device_selector_.selected_device();
713 session_.select_device(device);
715 reset_device_selector();
718 void MainBar::on_device_changed()
720 update_device_list();
721 update_device_config_widgets();
724 void MainBar::on_capture_state_changed(int state)
726 set_capture_state((pv::Session::capture_state)state);
729 void MainBar::on_sample_count_changed()
731 if (!updating_sample_count_)
732 commit_sample_count();
735 void MainBar::on_sample_rate_changed()
737 if (!updating_sample_rate_)
738 commit_sample_rate();
741 void MainBar::on_config_changed()
743 // We want to also call update_sample_rate_selector() here in case
744 // the user changed the SR_CONF_EXTERNAL_CLOCK option. However,
745 // commit_sample_rate() does this already, so we don't call it here
747 commit_sample_count();
748 commit_sample_rate();
751 void MainBar::on_actionNewView_triggered()
756 void MainBar::on_actionOpen_triggered()
759 const QString dir = settings.value(SettingOpenDirectory).toString();
762 const QString file_name = QFileDialog::getOpenFileName(
763 this, tr("Open File"), dir, tr(
764 "sigrok Sessions (*.sr);;"
767 if (!file_name.isEmpty()) {
768 session_.load_file(file_name);
770 const QString abs_path = QFileInfo(file_name).absolutePath();
771 settings.setValue(SettingOpenDirectory, abs_path);
775 void MainBar::on_actionSaveAs_triggered()
777 export_file(session_.device_manager().context()->output_formats()["srzip"]);
780 void MainBar::on_actionSaveSelectionAs_triggered()
782 export_file(session_.device_manager().context()->output_formats()["srzip"], true);
785 void MainBar::on_actionConnect_triggered()
787 // Stop any currently running capture session
788 session_.stop_capture();
790 dialogs::Connect dlg(this, session_.device_manager());
792 // If the user selected a device, select it in the device list. Select the
793 // current device otherwise.
795 session_.select_device(dlg.get_selected_device());
797 update_device_list();
800 void MainBar::add_toolbar_widgets()
802 addAction(action_new_view_);
804 addWidget(open_button_);
805 addWidget(save_button_);
808 StandardBar::add_toolbar_widgets();
810 addWidget(&device_selector_);
811 configure_button_action_ = addWidget(&configure_button_);
812 channels_button_action_ = addWidget(&channels_button_);
813 addWidget(&sample_count_);
814 addWidget(&sample_rate_);
817 addWidget(add_decoder_button_);
821 bool MainBar::eventFilter(QObject *watched, QEvent *event)
823 if (sample_count_supported_ && (watched == &sample_count_ ||
824 watched == &sample_rate_) &&
825 (event->type() == QEvent::ToolTip)) {
827 auto sec = pv::util::Timestamp(sample_count_.value()) / sample_rate_.value();
828 QHelpEvent *help_event = static_cast<QHelpEvent*>(event);
830 QString str = tr("Total sampling time: %1").arg(
831 pv::util::format_time_si(sec, pv::util::SIPrefix::unspecified, 0, "s", false));
832 QToolTip::showText(help_event->globalPos(), str);
840 } // namespace toolbars