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());
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()
{
uint64_t sample_count = 0;
- if (updating_sample_count_)
- return;
-
const shared_ptr<devices::Device> device =
device_selector_.selected_device();
if (!device)
const shared_ptr<sigrok::Device> sr_dev = device->device();
sample_count = sample_count_.value();
-
- // Set the sample count
- assert(!updating_sample_count_);
- updating_sample_count_ = true;
if (sample_count_supported_)
{
try {
sr_dev->config_set(ConfigKey::LIMIT_SAMPLES,
Glib::Variant<guint64>::create(sample_count));
- on_config_changed();
+ update_sample_count_selector();
} catch (Error error) {
qDebug() << "Failed to configure sample count.";
return;
}
}
- updating_sample_count_ = false;
+
+ // 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()
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()
void MainBar::on_sample_count_changed()
{
- commit_sample_count();
+ if (!updating_sample_count_)
+ commit_sample_count();
}
void MainBar::on_sample_rate_changed()
void MainBar::on_config_changed()
{
commit_sample_count();
- update_sample_count_selector();
commit_sample_rate();
}
{
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;