projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added DeviceManager
[pulseview.git]
/
pv
/
dialogs
/
connect.cpp
diff --git
a/pv/dialogs/connect.cpp
b/pv/dialogs/connect.cpp
index 02941f2f6785e02efcff07a80a6520c16d8e36d2..eefd41b7db3e3af982e619c46062ade3523b3e8b 100644
(file)
--- 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
*/
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <boost/foreach.hpp>
+
#include "connect.h"
#include "connect.h"
+#include "pv/devicemanager.h"
+
extern "C" {
/* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */
#define __STDC_FORMAT_MACROS
extern "C" {
/* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */
#define __STDC_FORMAT_MACROS
@@
-27,13
+31,16
@@
extern "C" {
#include <libsigrok/libsigrok.h>
}
#include <libsigrok/libsigrok.h>
}
+using namespace std;
+
extern sr_context *sr_ctx;
namespace pv {
namespace dialogs {
extern sr_context *sr_ctx;
namespace pv {
namespace dialogs {
-Connect::Connect(QWidget *parent) :
+Connect::Connect(QWidget *parent
, pv::DeviceManager &device_manager
) :
QDialog(parent),
QDialog(parent),
+ _device_manager(device_manager),
_layout(this),
_form(this),
_form_layout(&_form),
_layout(this),
_form(this),
_form_layout(&_form),
@@
-148,11
+155,12
@@
void Connect::scan_pressed()
drvopts = g_slist_append(drvopts, src);
}
drvopts = g_slist_append(drvopts, src);
}
- GSList *const devices = sr_driver_scan(driver, drvopts);
+ const list<sr_dev_inst*> 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])
QString text;
if (sdi->vendor && sdi->vendor[0])
@@
-172,9
+180,6
@@
void Connect::scan_pressed()
_device_list.addItem(item);
}
_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);
}
_device_list.setCurrentRow(0);
_button_box.button(QDialogButtonBox::Ok)->setDisabled(false);
}