]> sigrok.org Git - pulseview.git/commitdiff
Session/MainBar: Fix device change handling
authorSoeren Apel <redacted>
Sat, 27 Aug 2016 20:23:28 +0000 (22:23 +0200)
committerSoeren Apel <redacted>
Sat, 27 Aug 2016 20:23:28 +0000 (22:23 +0200)
pv/session.cpp
pv/session.hpp
pv/toolbars/mainbar.cpp
pv/toolbars/mainbar.hpp

index b18d27ff9e8065f796b8434c21808a5568130737..da9da12628690cc0b408c1cd5c9eb449bd78ceea 100644 (file)
@@ -270,7 +270,7 @@ void Session::set_device(shared_ptr<devices::Device> device)
                device_->open();
        } catch (const QString &e) {
                device_.reset();
-               device_selected();
+               device_changed();
                throw;
        }
 
@@ -280,7 +280,7 @@ void Session::set_device(shared_ptr<devices::Device> device)
                });
 
        update_signals();
-       device_selected();
+       device_changed();
 }
 
 void Session::set_default_device()
index 258addb9a72de29108c63a94f9afd3dec3deaaa5..e7a90ae9c720707f97a3796f8a588257a240e42d 100644 (file)
@@ -204,7 +204,7 @@ private:
 
 Q_SIGNALS:
        void capture_state_changed(int state);
-       void device_selected();
+       void device_changed();
 
        void signals_changed();
 
index 6a5992bf53ce60e7872d0e895ba09f49f35646d6..1875d3c415a34fab1cb8d2c0e65c5e486c16e7cd 100644 (file)
@@ -236,6 +236,8 @@ MainBar::MainBar(Session &session, MainWindow &main_window) :
        // Device selector menu
        connect(&device_selector_, SIGNAL(device_selected()),
                this, SLOT(on_device_selected()));
+       connect(&session, SIGNAL(device_changed()),
+               this, SLOT(on_device_changed()));
 
        // Setup the decoder button
 #ifdef ENABLE_DECODE
@@ -301,8 +303,6 @@ MainBar::MainBar(Session &session, MainWindow &main_window) :
        sample_count_.installEventFilter(this);
        sample_rate_.installEventFilter(this);
 
-       QMetaObject::connectSlotsByName(this);
-
        // Setup session_ events
        connect(&session_, SIGNAL(capture_state_changed(int)), this,
                SLOT(capture_state_changed(int)));
@@ -909,7 +909,11 @@ void MainBar::on_device_selected()
        }
 
        select_device(device);
+}
 
+void MainBar::on_device_changed()
+{
+       update_device_list();
        update_device_config_widgets();
 }
 
index c05a146e28f77518744cf50cb37a0232bf8b2b52..a50d1101d144704f940586656be901f6e109dbb7 100644 (file)
@@ -147,6 +147,7 @@ private Q_SLOTS:
        void import_file(std::shared_ptr<sigrok::InputFormat> format);
 
        void on_device_selected();
+       void on_device_changed();
        void on_sample_count_changed();
        void on_sample_rate_changed();
        void on_run_stop();