]> sigrok.org Git - pulseview.git/commitdiff
Fix #1146 by replacing the check box by a combo box
authorSoeren Apel <redacted>
Fri, 20 Jul 2018 17:47:58 +0000 (19:47 +0200)
committerUwe Hermann <redacted>
Sat, 21 Jul 2018 16:57:21 +0000 (18:57 +0200)
pv/dialogs/connect.cpp
pv/dialogs/connect.hpp

index 29d5b0269a05d23777d1a78cccdb38067a2d045b..81f1aee411061ed48f6bea86bd3ec68c05615115 100644 (file)
@@ -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<ustring>::create(
                                conn.toUtf8().constData());
index d9cf0a53cfc689b3142b64ae4d078b2a3b0ed7fc..914c58783ee3693b87ed6b7c2a3232c0eb119a62 100644 (file)
@@ -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_;