From da8fdce9d3a451640c62657bddfa658abf096416 Mon Sep 17 00:00:00 2001 From: PianetaRadio <78976006+PianetaRadio@users.noreply.github.com> Date: Wed, 23 Mar 2022 20:14:16 +0100 Subject: [PATCH] Add COM port list #5 --- CatRadio.pro | 3 +- CatRadio.pro.user | 218 +++++---------------------------- ChangeLog.txt | 3 + dialogconfig.cpp | 57 +++++++-- dialogconfig.h | 2 + dialogconfig.ui | 303 ++++++++++++++++++++++++++++------------------ mainwindow.cpp | 1 + mainwindow.h | 4 +- mainwindow.ui | 25 +++- rigdata.h | 1 + 10 files changed, 302 insertions(+), 315 deletions(-) diff --git a/CatRadio.pro b/CatRadio.pro index c1e8eaa..3662d8a 100644 --- a/CatRadio.pro +++ b/CatRadio.pro @@ -1,4 +1,5 @@ QT += core gui +QT += serialport greaterThan(QT_MAJOR_VERSION, 4): QT += widgets @@ -46,7 +47,7 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin LIBS += -L$$PWD/hamlib/ -lhamlib INCLUDEPATH += $$PWD/hamlib -VERSION = 1.0.0 +VERSION = 1.2.0 RC_ICONS = catradio.ico diff --git a/CatRadio.pro.user b/CatRadio.pro.user index 4506bf6..6593e79 100644 --- a/CatRadio.pro.user +++ b/CatRadio.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -8,7 +8,7 @@ ProjectExplorer.Project.ActiveTarget - 0 + 0 ProjectExplorer.Project.EditorSettings @@ -28,7 +28,7 @@ QmlJSGlobal - 2 + 2 UTF-8 false 4 @@ -91,16 +91,16 @@ ProjectExplorer.Project.Target.0 Desktop - Desktop Qt 6.1.3 MinGW 64-bit - Desktop Qt 6.1.3 MinGW 64-bit - qt.qt6.613.win64_mingw81_kit - 1 - 0 - 0 + Desktop Qt 6.2.4 MinGW 64-bit + Desktop Qt 6.2.4 MinGW 64-bit + qt.qt6.624.win64_mingw_kit + 0 + 0 + 0 0 - C:\Users\Johnny\Documents\QT\build-CatRadio-Desktop_Qt_6_1_3_MinGW_64_bit-Debug - C:/Users/Johnny/Documents/QT/build-CatRadio-Desktop_Qt_6_1_3_MinGW_64_bit-Debug + C:\Users\Johnny\Documents\QT\build-CatRadio-Desktop_Qt_6_2_4_MinGW_64_bit-Debug + C:/Users/Johnny/Documents/QT/build-CatRadio-Desktop_Qt_6_2_4_MinGW_64_bit-Debug true @@ -112,7 +112,7 @@ true Qt4ProjectManager.MakeStep - 2 + 2 Build Build ProjectExplorer.BuildSteps.Build @@ -123,7 +123,7 @@ Qt4ProjectManager.MakeStep clean - 1 + 1 Clean Clean ProjectExplorer.BuildSteps.Clean @@ -131,14 +131,15 @@ 2 false + false Debug Qt4ProjectManager.Qt4BuildConfiguration 2 - C:\Users\Johnny\Documents\QT\build-CatRadio-Desktop_Qt_6_1_3_MinGW_64_bit-Release - C:/Users/Johnny/Documents/QT/build-CatRadio-Desktop_Qt_6_1_3_MinGW_64_bit-Release + C:\Users\Johnny\Documents\QT\build-CatRadio-Desktop_Qt_6_2_4_MinGW_64_bit-Release + C:/Users/Johnny/Documents/QT/build-CatRadio-Desktop_Qt_6_2_4_MinGW_64_bit-Release true @@ -150,7 +151,7 @@ true Qt4ProjectManager.MakeStep - 2 + 2 Build Build ProjectExplorer.BuildSteps.Build @@ -161,7 +162,7 @@ Qt4ProjectManager.MakeStep clean - 1 + 1 Clean Clean ProjectExplorer.BuildSteps.Clean @@ -169,6 +170,7 @@ 2 false + false Release Qt4ProjectManager.Qt4BuildConfiguration @@ -177,8 +179,8 @@ 0 - C:\Users\Johnny\Documents\QT\build-CatRadio-Desktop_Qt_6_1_3_MinGW_64_bit-Profile - C:/Users/Johnny/Documents/QT/build-CatRadio-Desktop_Qt_6_1_3_MinGW_64_bit-Profile + C:\Users\Johnny\Documents\QT\build-CatRadio-Desktop_Qt_6_2_4_MinGW_64_bit-Profile + C:/Users/Johnny/Documents/QT/build-CatRadio-Desktop_Qt_6_2_4_MinGW_64_bit-Profile true @@ -190,7 +192,7 @@ true Qt4ProjectManager.MakeStep - 2 + 2 Build Build ProjectExplorer.BuildSteps.Build @@ -201,7 +203,7 @@ Qt4ProjectManager.MakeStep clean - 1 + 1 Clean Clean ProjectExplorer.BuildSteps.Clean @@ -209,6 +211,7 @@ 2 false + false Profile Qt4ProjectManager.Qt4BuildConfiguration @@ -216,10 +219,10 @@ 0 0 - 3 + 3 - 0 + 0 Deploy Deploy ProjectExplorer.BuildSteps.Deploy @@ -229,7 +232,7 @@ false ProjectExplorer.DefaultDeployConfiguration - 1 + 1 true true @@ -244,175 +247,14 @@ true false true - C:/Users/Johnny/Documents/QT/build-CatRadio-Desktop_Qt_6_1_3_MinGW_64_bit-Release + C:/Users/Johnny/Documents/QT/build-CatRadio-Desktop_Qt_6_2_4_MinGW_64_bit-Debug - 1 - - - - ProjectExplorer.Project.Target.1 - - Desktop - Desktop Qt 5.15.2 MinGW 32-bit - Desktop Qt 5.15.2 MinGW 32-bit - qt.qt5.5152.win32_mingw81_kit - 0 - 0 - 0 - - 0 - C:\Users\Johnny\Documents\QT\build-CatRadio-Desktop_Qt_5_15_2_MinGW_32_bit-Debug - C:/Users/Johnny/Documents/QT/build-CatRadio-Desktop_Qt_5_15_2_MinGW_32_bit-Debug - - - true - QtProjectManager.QMakeBuildStep - false - - - - true - Qt4ProjectManager.MakeStep - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - clean - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - C:\Users\Johnny\Documents\QT\build-CatRadio-Desktop_Qt_5_15_2_MinGW_32_bit-Release - C:/Users/Johnny/Documents/QT/build-CatRadio-Desktop_Qt_5_15_2_MinGW_32_bit-Release - - - true - QtProjectManager.QMakeBuildStep - false - - - - true - Qt4ProjectManager.MakeStep - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - clean - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - 0 - - - 0 - C:\Users\Johnny\Documents\QT\build-CatRadio-Desktop_Qt_5_15_2_MinGW_32_bit-Profile - C:/Users/Johnny/Documents/QT/build-CatRadio-Desktop_Qt_5_15_2_MinGW_32_bit-Profile - - - true - QtProjectManager.QMakeBuildStep - false - - - - true - Qt4ProjectManager.MakeStep - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - clean - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - 0 - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - - false - ProjectExplorer.DefaultDeployConfiguration - - 1 - - true - true - true - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Johnny/Documents/QT/CatRadio/CatRadio.pro - C:/Users/Johnny/Documents/QT/CatRadio/CatRadio.pro - false - true - true - false - true - - 1 + 1 ProjectExplorer.Project.TargetCount - 2 + 1 ProjectExplorer.Project.Updater.FileVersion diff --git a/ChangeLog.txt b/ChangeLog.txt index f567f30..8cb4b21 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -2,6 +2,9 @@ CatRadio (+ New, * Updated, - Removed) +1.2.0 - + + COM port list in the communication config dialog + 1.1.1 - 2022-03-19 * VFO operations: check rig caps before perform VFO operations * Sub VFO: improve sub VFO functions using targetable_vfo caps diff --git a/dialogconfig.cpp b/dialogconfig.cpp index fc8028f..9995365 100644 --- a/dialogconfig.cpp +++ b/dialogconfig.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "rigdata.h" @@ -59,8 +60,17 @@ DialogConfig::DialogConfig(QWidget *parent) : } file.close(); - //* serialSpeed comboBox + //* COM port + ui->comboBox_comPort->clear(); + ui->comboBox_comPort->addItem(""); + foreach (const QSerialPortInfo &comPort, QSerialPortInfo::availablePorts()) //search available COM port + { + ui->comboBox_comPort->addItem(comPort.portName()); + } + + //* serialSpeed ui->comboBox_serialSpeed->clear(); + ui->comboBox_serialSpeed->addItem(""); ui->comboBox_serialSpeed->addItem("4800"); ui->comboBox_serialSpeed->addItem("9600"); ui->comboBox_serialSpeed->addItem("19200"); @@ -69,10 +79,19 @@ DialogConfig::DialogConfig(QWidget *parent) : ui->comboBox_serialSpeed->addItem("115200"); //* Update values in the GUI - ui->comboBox_rigModel->setCurrentIndex(ui->comboBox_rigModel->findText(QString::number(rigCom.rigModel),Qt::MatchStartsWith)); - ui->lineEdit_RigPath->setText(rigCom.rigPort); - ui->comboBox_serialSpeed->setCurrentText(QString::number(rigCom.serialSpeed)); - if (rigCom.civAddr) ui->lineEdit_civAddr->setText(QString::number(rigCom.civAddr,16)); + if (rigCom.netRigctl) + { + ui->checkBox_netRigctl->setChecked(rigCom.netRigctl); + ui->lineEdit_ip->setText(rigCom.rigPort); + ui->comboBox_rigModel->setCurrentIndex(1); + } + else + { + ui->comboBox_rigModel->setCurrentIndex(ui->comboBox_rigModel->findText(QString::number(rigCom.rigModel),Qt::MatchStartsWith)); + ui->comboBox_comPort->setCurrentText(rigCom.rigPort); + ui->comboBox_serialSpeed->setCurrentText(QString::number(rigCom.serialSpeed)); + if (rigCom.civAddr) ui->lineEdit_civAddr->setText(QString::number(rigCom.civAddr,16)); + } ui->spinBox_RefreshRate->setValue(rigCom.rigRefresh); ui->checkBox_fullPoll->setChecked(rigCom.fullPoll); } @@ -87,23 +106,33 @@ void DialogConfig::on_buttonBox_accepted() bool civAddrConv; //* Read settings from GUI + if (ui->checkBox_netRigctl->isChecked()) + { + rigCom.rigModel = 2; + rigCom.netRigctl = true; + rigCom.rigPort = ui->lineEdit_ip->text(); + } + else + { QString rigModel = ui->comboBox_rigModel->currentText(); QRegularExpression regexp("[0-9]+"); QRegularExpressionMatch rigNumber = regexp.match(rigModel); rigCom.rigModel = rigNumber.captured(0).toInt(); - rigCom.rigPort = ui->lineEdit_RigPath->text(); + rigCom.rigPort = ui->comboBox_comPort->currentText(); rigCom.serialSpeed = ui->comboBox_serialSpeed->currentText().toInt(); rigCom.civAddr = ui->lineEdit_civAddr->text().toInt(&civAddrConv,16); + } rigCom.rigRefresh = ui->spinBox_RefreshRate->value(); rigCom.fullPoll = ui->checkBox_fullPoll->isChecked(); //* Save settings in config.ini QSettings configFile(QString("config.ini"), QSettings::IniFormat); configFile.setValue("rigModel", rigCom.rigModel); - configFile.setValue("rigPort", ui->lineEdit_RigPath->text()); + configFile.setValue("rigPort", rigCom.rigPort); configFile.setValue("serialSpeed", ui->comboBox_serialSpeed->currentText()); configFile.setValue("civAddress", ui->lineEdit_civAddr->text().toInt(&civAddrConv,16)); + configFile.setValue("netRigctl", ui->checkBox_netRigctl->isChecked()); configFile.setValue("rigRefresh", ui->spinBox_RefreshRate->value()); configFile.setValue("fullPolling", ui->checkBox_fullPoll->isChecked()); } @@ -115,3 +144,17 @@ int printRigList(const struct rig_caps *rigCaps, void *data) //Load rig list stream << rigCaps->rig_model << " " << rigCaps->mfg_name << " " << rigCaps->model_name << "\n"; return 1; } + +void DialogConfig::on_checkBox_netRigctl_toggled(bool checked) +{ + if (checked) + { + ui->comboBox_rigModel->setCurrentIndex(1); //set NET rigctl + ui->comboBox_comPort->setCurrentText(""); + } + else + { + ui->comboBox_rigModel->setCurrentIndex(0); //set Dummy + ui->lineEdit_ip->setText(""); //clear IP address + } +} diff --git a/dialogconfig.h b/dialogconfig.h index 3afdf77..cdb9892 100644 --- a/dialogconfig.h +++ b/dialogconfig.h @@ -37,6 +37,8 @@ public: private slots: void on_buttonBox_accepted(); + void on_checkBox_netRigctl_toggled(bool checked); + private: Ui::DialogConfig *ui; }; diff --git a/dialogconfig.ui b/dialogconfig.ui index 9473c2c..b897041 100644 --- a/dialogconfig.ui +++ b/dialogconfig.ui @@ -6,138 +6,205 @@ 0 0 - 400 - 300 + 385 + 336 Config - - - - - Model + + + + + 0 + + + COM + + + + + + Model + + + comboBox_rigModel + + + + + + + + + + COM Port + + + comboBox_comPort + + + + + + + + + + Speed + + + comboBox_serialSpeed + + + + + + + + + + ArrowCursor + + + Icom CI-V + + + lineEdit_civAddr + + + + + + + + + hex, Icom only + + + + + + + + + + h + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + TCP + + + + + + NET Rigctl + + + + + + + IP address + + + lineEdit_ip + + + + + + + e.g. 127.0.0.1:4532 + + + + + - - - - - - - Path - - - lineEdit_RigPath - - - - - - - e.g. COM2 or /dev/ttyUSB1 - - - - - - - Speed - - - comboBox_serialSpeed - - - - - - - - - - Refresh Rate - - - spinBox_RefreshRate - - - - - - - 50 - - - 1000 - - - 50 - - - 200 - - - - + Options - - - 11 - - - + + + - - - 7 - - - - - ArrowCursor - - - Icom CI-V - - - - - - - hex, Icom only - - - - - - - - - - h - - - - - - - + - Full polling + Refresh Rate + + + spinBox_RefreshRate + + + + 50 + + + 1000 + + + 50 + + + 200 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Full polling + + + - + Qt::Horizontal @@ -150,9 +217,15 @@ - lineEdit_RigPath + tabWidget_Config + comboBox_rigModel + comboBox_comPort comboBox_serialSpeed + lineEdit_civAddr spinBox_RefreshRate + checkBox_fullPoll + checkBox_netRigctl + lineEdit_ip @@ -163,8 +236,8 @@ accept() - 248 - 254 + 259 + 324 157 @@ -179,8 +252,8 @@ reject() - 316 - 260 + 327 + 324 286 diff --git a/mainwindow.cpp b/mainwindow.cpp index 24b56dd..e3a9894 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -98,6 +98,7 @@ MainWindow::MainWindow(QWidget *parent) rigCom.rigPort = configFile.value("rigPort").toString(); rigCom.serialSpeed = configFile.value("serialSpeed", 9600).toInt(); rigCom.civAddr = configFile.value("civAddress", 0).toInt(); + rigCom.netRigctl = configFile.value("netRigctl", false).toBool(); rigCom.rigRefresh = configFile.value("rigRefresh", 100).toInt(); rigCom.fullPoll = configFile.value("fullPolling", true).toBool(); guiConf.vfoDisplayMode = configFile.value("vfoDisplayMode", 0).toInt(); diff --git a/mainwindow.h b/mainwindow.h index a36f940..b97bdee 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -25,8 +25,8 @@ #define RELEASE_DATE __DATE__ #define VERSION_MAJ 1 -#define VERSION_MIN 1 -#define VERSION_MIC 1 +#define VERSION_MIN 2 +#define VERSION_MIC 0 QT_BEGIN_NAMESPACE diff --git a/mainwindow.ui b/mainwindow.ui index 314231b..da5fa15 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -2,6 +2,9 @@ MainWindow + + Qt::WindowModal + true @@ -10,9 +13,27 @@ 0 0 610 - 604 + 605 + + + 0 + 0 + + + + + 610 + 601 + + + + + 610 + 605 + + CatRadio @@ -1517,7 +1538,7 @@ 0 0 610 - 20 + 21 diff --git a/rigdata.h b/rigdata.h index e38ecbc..960a6a6 100644 --- a/rigdata.h +++ b/rigdata.h @@ -31,6 +31,7 @@ typedef struct { QString rigPort; //COM port or IP address unsigned serialSpeed; //Serial port baud rate int civAddr; //CI-V address (decimal, Icom radio) + bool netRigctl; //TCP NET Rigctl unsigned rigRefresh; //GUI refresh interval (ms) int connected; //connected flag bool fullPoll; //full polling flag