]> sigrok.org Git - pulseview.git/blobdiff - pv/mainwindow.cpp
Moved DeviceManager::use_device and release_device into DevInst
[pulseview.git] / pv / mainwindow.cpp
index 0b2805b18e44a1ee0908b2715476d62466faf58e..9995e50ac2ef42650ba4d904a3d7b70c287336ff 100644 (file)
@@ -25,6 +25,9 @@
 #include <boost/bind.hpp>
 #include <boost/foreach.hpp>
 
+#include <algorithm>
+#include <iterator>
+
 #include <QAction>
 #include <QApplication>
 #include <QButtonGroup>
@@ -39,7 +42,7 @@
 #include "mainwindow.h"
 
 #include "devicemanager.h"
-#include "devinst.h"
+#include "device/device.h"
 #include "dialogs/about.h"
 #include "dialogs/connect.h"
 #include "dialogs/storeprogress.h"
@@ -284,11 +287,15 @@ void MainWindow::session_error(
                Q_ARG(QString, info_text));
 }
 
-void MainWindow::update_device_list(shared_ptr<pv::DevInst> selected_device)
+void MainWindow::update_device_list(
+       shared_ptr<pv::device::DevInst> selected_device)
 {
        assert(_sampling_bar);
 
-       const list< shared_ptr<DevInst> > &devices = _device_manager.devices();
+       list< shared_ptr<device::DevInst> > 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()) {
@@ -296,7 +303,7 @@ void MainWindow::update_device_list(shared_ptr<pv::DevInst> selected_device)
                selected_device = devices.front();
 
                // Try and find the demo device and select that by default
-               BOOST_FOREACH (shared_ptr<pv::DevInst> dev_inst, devices)
+               BOOST_FOREACH (shared_ptr<pv::device::DevInst> dev_inst, devices)
                        if (strcmp(dev_inst->dev_inst()->driver->name,
                                "demo") == 0) {
                                selected_device = dev_inst;
@@ -368,7 +375,7 @@ void MainWindow::on_actionConnect_triggered()
 
        // If the user selected a device, select it in the device list. Select the
        // current device otherwise.
-       shared_ptr<DevInst> dev_inst = dlg.exec() ?
+       shared_ptr<device::DevInst> dev_inst = dlg.exec() ?
                dlg.get_selected_device() : _session.get_device();
 
        update_device_list(dev_inst);