From: Soeren Apel Date: Wed, 26 Feb 2020 19:13:50 +0000 (+0100) Subject: Reset Run button state when closing the last session X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=09ab7056e772e3b85889eb1c508597b3cc7bfbe4;p=pulseview.git Reset Run button state when closing the last session --- diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 7d350625..6662180c 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -569,10 +569,16 @@ void MainWindow::setup_ui() void MainWindow::update_acq_button(Session *session) { - int state = session->get_capture_state(); + int state; + QString run_caption; - const QString run_caption = - session->using_file_device() ? tr("Reload") : tr("Run"); + if (session) { + state = session->get_capture_state(); + run_caption = session->using_file_device() ? tr("Reload") : tr("Run"); + } else { + state = Session::Stopped; + run_caption = tr("Run"); + } const QIcon *icons[] = {&icon_grey_, &icon_red_, &icon_green_}; run_stop_button_->setIcon(*icons[state]); @@ -847,6 +853,9 @@ void MainWindow::on_tab_close_requested(int index) tr("This session contains unsaved data. Close it anyway?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)) remove_session(session); + + if (sessions_.empty()) + update_acq_button(nullptr); } void MainWindow::on_show_decoder_selector(Session *session)