X-Git-Url: http://git.code-monkey.de/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdialogs%2Fconnect.cpp;h=eefd41b7db3e3af982e619c46062ade3523b3e8b;hp=02941f2f6785e02efcff07a80a6520c16d8e36d2;hb=107ca6d350b51186d12dac9273f6ed130b3f5dd7;hpb=f9541bde559ebdad1dff36bd27a2656ada99c6da diff --git a/pv/dialogs/connect.cpp b/pv/dialogs/connect.cpp index 02941f2..eefd41b 100644 --- a/pv/dialogs/connect.cpp +++ b/pv/dialogs/connect.cpp @@ -18,8 +18,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "connect.h" +#include "pv/devicemanager.h" + extern "C" { /* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */ #define __STDC_FORMAT_MACROS @@ -27,13 +31,16 @@ extern "C" { #include } +using namespace std; + extern sr_context *sr_ctx; namespace pv { namespace dialogs { -Connect::Connect(QWidget *parent) : +Connect::Connect(QWidget *parent, pv::DeviceManager &device_manager) : QDialog(parent), + _device_manager(device_manager), _layout(this), _form(this), _form_layout(&_form), @@ -148,11 +155,12 @@ void Connect::scan_pressed() drvopts = g_slist_append(drvopts, src); } - GSList *const devices = sr_driver_scan(driver, drvopts); + const list devices = _device_manager.driver_scan( + driver, drvopts); - for (GSList *l = devices; l; l = l->next) { + g_slist_free_full(drvopts, (GDestroyNotify)free_drvopts); - sr_dev_inst *const sdi = (sr_dev_inst*)l->data; + BOOST_FOREACH(sr_dev_inst *const sdi, devices) { QString text; if (sdi->vendor && sdi->vendor[0]) @@ -172,9 +180,6 @@ void Connect::scan_pressed() _device_list.addItem(item); } - g_slist_free(devices); - g_slist_free_full(drvopts, (GDestroyNotify)free_drvopts); - _device_list.setCurrentRow(0); _button_box.button(QDialogButtonBox::Ok)->setDisabled(false); }