]> sigrok.org Git - pulseview.git/commitdiff
Reset Run button state when closing the last session
authorSoeren Apel <redacted>
Wed, 26 Feb 2020 19:13:50 +0000 (20:13 +0100)
committerSoeren Apel <redacted>
Thu, 27 Feb 2020 08:32:16 +0000 (09:32 +0100)
pv/mainwindow.cpp

index 7d350625a4ddd3e9528dac8403ed75385b881420..6662180c7f19fde5fc5dad428e10bad8d412613c 100644 (file)
@@ -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)