X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=9995e50ac2ef42650ba4d904a3d7b70c287336ff;hb=996b7c9da9b5cb56413e829217e1e7d7d7d520da;hp=e0ef3aa297e4f71e7f3678cc0bbd151ce27696ff;hpb=d2899ad580eea569f3b167e8c9ebcb913194c6b6;p=pulseview.git diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index e0ef3aa2..9995e50a 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -25,6 +25,9 @@ #include #include +#include +#include + #include #include #include @@ -39,6 +42,7 @@ #include "mainwindow.h" #include "devicemanager.h" +#include "device/device.h" #include "dialogs/about.h" #include "dialogs/connect.h" #include "dialogs/storeprogress.h" @@ -57,6 +61,7 @@ #include #include +using boost::shared_ptr; using std::list; namespace pv { @@ -282,11 +287,15 @@ 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(); + list< shared_ptr > devices; + std::copy(_device_manager.devices().begin(), + _device_manager.devices().end(), std::back_inserter(devices)); + _sampling_bar->set_device_list(devices); if (!selected_device && !devices.empty()) { @@ -294,9 +303,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 +375,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()