X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fdialogs%2Fconnect.cpp;h=9cd712508d463e0711ede42b79d399c219a1e956;hb=636782c1f942d1acdb56a0561c2e0fd52cc39ddb;hp=eefd41b7db3e3af982e619c46062ade3523b3e8b;hpb=107ca6d350b51186d12dac9273f6ed130b3f5dd7;p=pulseview.git diff --git a/pv/dialogs/connect.cpp b/pv/dialogs/connect.cpp index eefd41b..9cd7125 100644 --- a/pv/dialogs/connect.cpp +++ b/pv/dialogs/connect.cpp @@ -31,7 +31,8 @@ extern "C" { #include } -using namespace std; +using std::list; +using std::string; extern sr_context *sr_ctx; @@ -102,8 +103,8 @@ void Connect::populate_drivers() * and sensors. */ bool supported_device = false; - if ((sr_config_list(drivers[i], SR_CONF_DEVICE_OPTIONS, - &gvar_opts, NULL) == SR_OK)) { + if ((sr_config_list(drivers[i], NULL, NULL, + SR_CONF_DEVICE_OPTIONS, &gvar_opts) == SR_OK)) { hwopts = (const int32_t *)g_variant_get_fixed_array(gvar_opts, &num_opts, sizeof(int32_t)); for (unsigned int j = 0; j < num_opts; j++) @@ -160,17 +161,12 @@ void Connect::scan_pressed() g_slist_free_full(drvopts, (GDestroyNotify)free_drvopts); - BOOST_FOREACH(sr_dev_inst *const sdi, devices) { - - QString text; - if (sdi->vendor && sdi->vendor[0]) - text += QString("%1 ").arg(sdi->vendor); - if (sdi->model && sdi->model[0]) - text += QString("%1 ").arg(sdi->model); - if (sdi->version && sdi->version[0]) - text += QString("%1 ").arg(sdi->version); + BOOST_FOREACH(sr_dev_inst *const sdi, devices) + { + const string title = DeviceManager::format_device_title(sdi); + QString text = QString::fromUtf8(title.c_str()); if (sdi->probes) { - text += QString("with %1 probes").arg( + text += QString(" with %1 probes").arg( g_slist_length(sdi->probes)); } @@ -181,7 +177,7 @@ void Connect::scan_pressed() } _device_list.setCurrentRow(0); - _button_box.button(QDialogButtonBox::Ok)->setDisabled(false); + _button_box.button(QDialogButtonBox::Ok)->setDisabled(_device_list.count() == 0); } void Connect::device_selected(int index) @@ -194,8 +190,8 @@ void Connect::device_selected(int index) unset_connection(); - if ((sr_config_list(driver, SR_CONF_SCAN_OPTIONS, - &gvar_list, NULL) == SR_OK)) { + if ((sr_config_list(driver, NULL, NULL, + SR_CONF_SCAN_OPTIONS, &gvar_list) == SR_OK)) { hwopts = (const int32_t *)g_variant_get_fixed_array(gvar_list, &num_opts, sizeof(int32_t));