X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fdialogs%2Fconnect.cpp;h=81f1aee411061ed48f6bea86bd3ec68c05615115;hb=8835b5e7c3c6e07e9b99e31a1fb31e600cdab76d;hp=43112ae5537f9e99cfeef0edc31c93aed13bd6de;hpb=1ebe875c5a51548c5182353e76c090215a3e5930;p=pulseview.git
diff --git a/pv/dialogs/connect.cpp b/pv/dialogs/connect.cpp
index 43112ae..81f1aee 100644
--- a/pv/dialogs/connect.cpp
+++ b/pv/dialogs/connect.cpp
@@ -14,16 +14,15 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * along with this program; if not, see .
*/
#include
#include
-#include
#include
+#include
#include
#include "connect.hpp"
@@ -42,7 +41,6 @@ using Glib::VariantBase;
using sigrok::ConfigKey;
using sigrok::Driver;
-using sigrok::Error;
using pv::devices::HardwareDevice;
@@ -97,13 +95,19 @@ Connect::Connect(QWidget *parent, pv::DeviceManager &device_manager) :
tcp_port_->setRange(1, 65535);
tcp_port_->setValue(5555);
tcp_config_layout->addWidget(tcp_port_);
- tcp_use_vxi_ = new QCheckBox();
- tcp_use_vxi_->setText(tr("Use VXI"));
+
tcp_config_layout->addSpacing(30);
- tcp_config_layout->addWidget(tcp_use_vxi_);
+ tcp_config_layout->addWidget(new QLabel(tr("Protocol:")));
+ tcp_protocol_ = new QComboBox();
+ tcp_protocol_->addItem("Raw TCP", QVariant("tcp-raw/%1/%2"));
+ tcp_protocol_->addItem("VXI", QVariant("vxi/%1/%2"));
+ tcp_config_layout->addWidget(tcp_protocol_);
tcp_config_layout->setContentsMargins(0, 0, 0, 0);
tcp_config_->setEnabled(false);
+ // Let the device list occupy only the minimum space needed
+ device_list_.setMaximumHeight(device_list_.minimumSizeHint().height());
+
QVBoxLayout *vbox_if = new QVBoxLayout;
vbox_if->addWidget(radiobtn_usb);
vbox_if->addWidget(radiobtn_serial);
@@ -228,11 +232,10 @@ void Connect::scan_pressed()
QString host = tcp_host_->text();
QString port = tcp_port_->text();
if (!host.isEmpty()) {
- QString conn;
- if (tcp_use_vxi_->isChecked())
- conn = QString("vxi/%1/%2").arg(host, port);
- else
- conn = QString("tcp-raw/%1/%2").arg(host, port);
+ QString conn =
+ tcp_protocol_->itemData(tcp_protocol_->currentIndex()).toString();
+
+ conn = conn.arg(host, port);
drvopts[ConfigKey::CONN] = Variant::create(
conn.toUtf8().constData());
@@ -245,13 +248,10 @@ void Connect::scan_pressed()
for (shared_ptr device : devices) {
assert(device);
- QString text = QString::fromStdString(
- device->display_name(device_manager_));
- text += QString(" with %1 channels").arg(
- device->device()->channels().size());
+ QString text = QString::fromStdString(device->display_name(device_manager_));
+ text += QString(" with %1 channels").arg(device->device()->channels().size());
- QListWidgetItem *const item = new QListWidgetItem(text,
- &device_list_);
+ QListWidgetItem *const item = new QListWidgetItem(text, &device_list_);
item->setData(Qt::UserRole, qVariantFromValue(device));
device_list_.addItem(item);
}