From: Soeren Apel Date: Fri, 20 Jul 2018 17:47:58 +0000 (+0200) Subject: Fix #1146 by replacing the check box by a combo box X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=521bac13ae900d74005e5d76e2c88f586ec7367a;p=pulseview.git Fix #1146 by replacing the check box by a combo box --- diff --git a/pv/dialogs/connect.cpp b/pv/dialogs/connect.cpp index 29d5b026..81f1aee4 100644 --- a/pv/dialogs/connect.cpp +++ b/pv/dialogs/connect.cpp @@ -95,10 +95,13 @@ 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); @@ -229,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()); diff --git a/pv/dialogs/connect.hpp b/pv/dialogs/connect.hpp index d9cf0a53..914c5878 100644 --- a/pv/dialogs/connect.hpp +++ b/pv/dialogs/connect.hpp @@ -94,7 +94,7 @@ private: QWidget *tcp_config_; QLineEdit *tcp_host_; QSpinBox *tcp_port_; - QCheckBox *tcp_use_vxi_; + QComboBox *tcp_protocol_; QPushButton scan_button_; QListWidget device_list_;