X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=7320bf1aa740a488fe014d6e10aac2ba66621aab;hb=aaabd61b1297bae5b719c4d61da4c6fd1a26c111;hp=ca514bf97a703eba3e7a8bc56dbebd23467c439a;hpb=363107a8c9f33d8aeebd9ee8d56f90af87c73ea2;p=pulseview.git diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index ca514bf..7320bf1 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -19,7 +19,7 @@ */ #ifdef ENABLE_SIGROKDECODE -#include +#include #endif #include @@ -60,7 +60,8 @@ MainWindow::MainWindow(DeviceManager &device_manager, const char *open_file_name, QWidget *parent) : QMainWindow(parent), - _device_manager(device_manager) + _device_manager(device_manager), + _session(device_manager) { setup_ui(); if (open_file_name) { @@ -277,11 +278,16 @@ void MainWindow::on_actionOpen_triggered() void MainWindow::on_actionConnect_triggered() { + // Stop any currently running capture session + _session.stop_capture(); + dialogs::Connect dlg(this, _device_manager); - if (!dlg.exec()) - return; - struct sr_dev_inst *const sdi = dlg.get_selected_device(); + // If the user selected a device, select it in the device list. Select the + // current device otherwise. + struct sr_dev_inst *const sdi = dlg.exec() ? + dlg.get_selected_device() : _session.get_device(); + update_device_list(sdi); }