X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=0b2805b18e44a1ee0908b2715476d62466faf58e;hp=e0ef3aa297e4f71e7f3678cc0bbd151ce27696ff;hb=19adbc2c342b190161ec1223377a3619974b91f7;hpb=5b8b1e47bd0d8c0d2519f83855a84f1820f1955e diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index e0ef3aa2..0b2805b1 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -39,6 +39,7 @@ #include "mainwindow.h" #include "devicemanager.h" +#include "devinst.h" #include "dialogs/about.h" #include "dialogs/connect.h" #include "dialogs/storeprogress.h" @@ -57,6 +58,7 @@ #include #include +using boost::shared_ptr; using std::list; namespace pv { @@ -282,11 +284,11 @@ void MainWindow::session_error( Q_ARG(QString, info_text)); } -void MainWindow::update_device_list(struct sr_dev_inst *selected_device) +void MainWindow::update_device_list(shared_ptr selected_device) { assert(_sampling_bar); - const list &devices = _device_manager.devices(); + const list< shared_ptr > &devices = _device_manager.devices(); _sampling_bar->set_device_list(devices); if (!selected_device && !devices.empty()) { @@ -294,9 +296,10 @@ void MainWindow::update_device_list(struct sr_dev_inst *selected_device) selected_device = devices.front(); // Try and find the demo device and select that by default - BOOST_FOREACH (struct sr_dev_inst *sdi, devices) - if (strcmp(sdi->driver->name, "demo") == 0) { - selected_device = sdi; + BOOST_FOREACH (shared_ptr dev_inst, devices) + if (strcmp(dev_inst->dev_inst()->driver->name, + "demo") == 0) { + selected_device = dev_inst; } } @@ -365,10 +368,10 @@ void MainWindow::on_actionConnect_triggered() // 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() ? + shared_ptr dev_inst = dlg.exec() ? dlg.get_selected_device() : _session.get_device(); - update_device_list(sdi); + update_device_list(dev_inst); } void MainWindow::on_actionQuit_triggered()