]> sigrok.org Git - pulseview.git/commitdiff
Moved default device selection into MainWindow
authorJoel Holdsworth <redacted>
Sun, 12 Apr 2015 15:32:38 +0000 (16:32 +0100)
committerUwe Hermann <redacted>
Thu, 11 Jun 2015 18:38:48 +0000 (20:38 +0200)
pv/mainwindow.cpp
pv/session.cpp

index 767ab6f31149bd4881b0db163635c86025c08818..eb567af8dfe077d4954ffe6613333e7bb2f61da2 100644 (file)
@@ -194,7 +194,10 @@ void MainWindow::run_stop()
 void MainWindow::select_device(shared_ptr<devices::Device> device)
 {
        try {
-               session_.set_device(device);
+               if (device)
+                       session_.set_device(device);
+               else
+                       session_.set_default_device();
        } catch(const QString &e) {
                QMessageBox msg(this);
                msg.setText(e);
@@ -540,10 +543,8 @@ void MainWindow::restore_ui_settings()
 
        const shared_ptr<devices::HardwareDevice> device =
                device_manager_.find_device_from_info(dev_info);
-       if (device) {
-               select_device(device);
-               update_device_list();
-       }
+       select_device(device);
+       update_device_list();
 
        settings.endGroup();
 }
index 08bec08e4a5f664b87c0c30f2333c603861ce9fd..d6fef9a7eee143e0de1f3f877654f6e117066719 100644 (file)
@@ -90,7 +90,6 @@ Session::Session(DeviceManager &device_manager) :
        capture_state_(Stopped),
        cur_samplerate_(0)
 {
-       set_default_device();
 }
 
 Session::~Session()