From 5a0138fa0284c8fbd02dee0b17eb8cd1398fc2fb Mon Sep 17 00:00:00 2001 From: Uwe Risse Date: Thu, 13 Oct 2022 19:00:53 +0200 Subject: [PATCH 1/9] Auto-align drawing of horizontal grids. --- widgets/plotter.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/widgets/plotter.cpp b/widgets/plotter.cpp index 600393579..189f42d40 100644 --- a/widgets/plotter.cpp +++ b/widgets/plotter.cpp @@ -402,7 +402,7 @@ void CPlotter::DrawOverlay() //DrawOverlay() float xx0=float(m_startFreq)/float(m_freqPerDiv); xx0=xx0-int(xx0); int x0=xx0*pixperdiv+0.5; - for( int i=1; i= 0 and x<=m_w) { painter.setPen(QPen(Qt::white, 1,Qt::DotLine)); @@ -413,14 +413,18 @@ void CPlotter::DrawOverlay() //DrawOverlay() painter.setPen(QPen(Qt::white, 1,Qt::DotLine)); if(m_bTotalPower) painter.setPen(QPen(Qt::white, 1,Qt::DashLine)); - for( int i=1; i100) { painter.setPen(QPen(Qt::white, 1,Qt::DotLine)); - for( int i=1; i<5*VERT_DIVS; i++) { //draw horizontal 2 dB grids + for( int i=1; i<5*VERT_DIVS; i++) { //draw horizontal 2 dB grids if(i%5 > 0) { y = int(0.2*i*m_vpixperdiv); painter.drawLine(0, y, w, y); From 0fd396c903b100083074b161497ab7186aa20a3e Mon Sep 17 00:00:00 2001 From: Uwe Risse Date: Fri, 14 Oct 2022 11:56:38 +0200 Subject: [PATCH 2/9] Improve the readability of the signal meter labeling at different font sizes. --- widgets/mainwindow.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index a2ada0969..79a4c25cd 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -1389,8 +1389,16 @@ void MainWindow::set_application_font (QFont const& font) } } qApp->setStyleSheet (ss + "* {" + font_as_stylesheet (font) + '}'); - // ensure a balanced layout of the mode buttons + // ensure a balanced layout of the signal meter and the mode buttons qreal pointSize = m_config.text_font().pointSizeF(); + if (pointSize < 9) ui->signal_meter_widget->setMaximumWidth(50); + if (pointSize == 9) ui->signal_meter_widget->setMaximumWidth(53); + if (pointSize == 10) ui->signal_meter_widget->setMaximumWidth(56); + if (pointSize == 11) ui->signal_meter_widget->setMaximumWidth(59); + if (pointSize == 12) ui->signal_meter_widget->setMaximumWidth(62); + if (pointSize == 13) ui->signal_meter_widget->setMaximumWidth(65); + if (pointSize == 14) ui->signal_meter_widget->setMaximumWidth(70); + if (pointSize > 14) ui->signal_meter_widget->setMaximumWidth(75); if (pointSize < 11) { ui->houndButton->setMaximumWidth(40); ui->ft8Button->setMaximumWidth(40); From f0c5b772df0a9d25e77a38a22d45d954b4b63807 Mon Sep 17 00:00:00 2001 From: Uwe Risse Date: Fri, 14 Oct 2022 14:20:25 +0200 Subject: [PATCH 3/9] Revert "Improve the readability of the signal meter labeling at different font sizes." This reverts commit 0fd396c903b100083074b161497ab7186aa20a3e. --- widgets/mainwindow.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 79a4c25cd..a2ada0969 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -1389,16 +1389,8 @@ void MainWindow::set_application_font (QFont const& font) } } qApp->setStyleSheet (ss + "* {" + font_as_stylesheet (font) + '}'); - // ensure a balanced layout of the signal meter and the mode buttons + // ensure a balanced layout of the mode buttons qreal pointSize = m_config.text_font().pointSizeF(); - if (pointSize < 9) ui->signal_meter_widget->setMaximumWidth(50); - if (pointSize == 9) ui->signal_meter_widget->setMaximumWidth(53); - if (pointSize == 10) ui->signal_meter_widget->setMaximumWidth(56); - if (pointSize == 11) ui->signal_meter_widget->setMaximumWidth(59); - if (pointSize == 12) ui->signal_meter_widget->setMaximumWidth(62); - if (pointSize == 13) ui->signal_meter_widget->setMaximumWidth(65); - if (pointSize == 14) ui->signal_meter_widget->setMaximumWidth(70); - if (pointSize > 14) ui->signal_meter_widget->setMaximumWidth(75); if (pointSize < 11) { ui->houndButton->setMaximumWidth(40); ui->ft8Button->setMaximumWidth(40); From f9df36989c295caa99902b617b43fab3ac284952 Mon Sep 17 00:00:00 2001 From: Uwe Risse Date: Fri, 14 Oct 2022 14:26:48 +0200 Subject: [PATCH 4/9] Improve the scaling of the GUI, keeping the width of the signal meter as small as possible, but ensuring readability at different font sizes. --- widgets/mainwindow.ui | 110 ++++++++++++++++++++++++++++-------------- 1 file changed, 73 insertions(+), 37 deletions(-) diff --git a/widgets/mainwindow.ui b/widgets/mainwindow.ui index 7f363fc6e..2680ea054 100644 --- a/widgets/mainwindow.ui +++ b/widgets/mainwindow.ui @@ -6,7 +6,7 @@ 0 0 - 893 + 901 665 @@ -36,7 +36,6 @@ 10 - 50 false @@ -180,7 +179,6 @@ 10 - 50 false @@ -576,7 +574,7 @@ - + @@ -956,8 +954,17 @@ QLabel[oob="true"] { + + 6 + + + + 0 + 0 + + 100 @@ -982,38 +989,64 @@ QLabel[oob="true"] { - - - - 0 - 0 - + + + 0 - - - 50 - 16777215 - - - - <html><head/><body><p>30dB recommended when only noise present<br/>Green when good<br/>Red when clipping may occur<br/>Yellow when too low</p></body></html> - - - Rx Signal - - - 30dB recommended when only noise present + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 100 + 16777215 + + + + <html><head/><body><p>30dB recommended when only noise present<br/>Green when good<br/>Red when clipping may occur<br/>Yellow when too low</p></body></html> + + + Rx Signal + + + 30dB recommended when only noise present Green when good Red when clipping may occur Yellow when too low - - - QFrame::Panel - - - QFrame::Sunken - - + + + QFrame::Panel + + + QFrame::Sunken + + + + + + + Qt::Horizontal + + + + 0 + 20 + + + + + @@ -2048,9 +2081,6 @@ list. The list can be maintained in Settings (F2). QComboBox::InsertAtBottom - - QComboBox::AdjustToMinimumContentsLength - @@ -2846,6 +2876,12 @@ Double-click to reset to the standard 73 message + + + 0 + 0 + + 100 @@ -3030,8 +3066,8 @@ Double-click to reset to the standard 73 message 0 0 - 893 - 21 + 901 + 22 From 0256bbb80716865c1df5eeac856587a4a5f5c402 Mon Sep 17 00:00:00 2001 From: Uwe Risse Date: Mon, 17 Oct 2022 14:55:40 +0200 Subject: [PATCH 5/9] Improve bandComboBox size and resizing of the left controls. --- widgets/mainwindow.ui | 337 ++++++++++++++++++++++-------------------- 1 file changed, 173 insertions(+), 164 deletions(-) diff --git a/widgets/mainwindow.ui b/widgets/mainwindow.ui index 2680ea054..cc82980cb 100644 --- a/widgets/mainwindow.ui +++ b/widgets/mainwindow.ui @@ -574,75 +574,8 @@ - - - - - Adjust Tx audio level - - - 450 - - - 0 - - - Qt::Vertical - - - true - - - true - - - QSlider::TicksBelow - - - 50 - - - - - - - - 0 - 0 - - - - QLabel { - font-family: MS Shell Dlg 2; - font-size: 16pt; - background-color : black; - color : yellow; -} - - - QFrame::StyledPanel - - - QFrame::Sunken - - - 2 - - - 0 - - - <html><head/><body><p align="center"> 2015 Jun 17 </p><p align="center"> 01:23:45 </p></body></html> - - - Qt::AlignCenter - - - 5 - - - - + + @@ -919,40 +852,42 @@ - - - - - 0 - 0 - - + + - USB dial frequency + Adjust Tx audio level - - QLabel { - font-family: MS Shell Dlg 2; - font-size: 16pt; - color : yellow; - background-color : black; -} -QLabel[oob="true"] { - background-color: red; -} + + 450 - - 14.078 000 + + 0 - - Qt::AlignCenter + + Qt::Vertical - - 5 + + true + + + true + + + QSlider::TicksBelow + + + 50 - + + + + Pwr + + + + 6 @@ -1050,49 +985,7 @@ Yellow when too low - - - - false - - - <html><head/><body><p>If orange or red there has been a rig control failure, click to reset and read the dial frequency. S implies split mode.</p></body></html> - - - If orange or red there has been a rig control failure, click to reset and read the dial frequency. S implies split mode. - - - QPushButton { - font-family: helvetica; - font-size: 9pt; - font-weight: bold; - background-color: white; - color: black; - border-style: solid; - border-width:1px; - border-radius:10px; - border-color: gray; - max-width:20px; - max-height:20px; - min-width:20px; - min-height:20px; -} -QPushButton[state="error"] { - background-color: red; -} -QPushButton[state="warning"] { - background-color: orange; -} -QPushButton[state="ok"] { - background-color: #00ff00; -} - - - ? - - - - + @@ -2874,41 +2767,40 @@ Double-click to reset to the standard 73 message - - + + - + 0 0 - - - 100 - 16777215 - - - <html><head/><body><p>Select operating band or enter frequency in MHz or enter kHz increment followed by k.</p></body></html> + USB dial frequency - - Frequency entry + + QLabel { + font-family: MS Shell Dlg 2; + font-size: 16pt; + color : yellow; + background-color : black; +} +QLabel[oob="true"] { + background-color: red; +} - - Select operating band or enter frequency in MHz or enter kHz increment followed by k. + + 14.078 000 - - true + + Qt::AlignCenter - - QComboBox::NoInsert - - - QComboBox::AdjustToMinimumContentsLengthWithIcon + + 5 - + @@ -3047,13 +2939,131 @@ Double-click to reset to the standard 73 message - - + + + + + 0 + 0 + + + + QLabel { + font-family: MS Shell Dlg 2; + font-size: 16pt; + background-color : black; + color : yellow; +} + + + QFrame::StyledPanel + + + QFrame::Sunken + + + 2 + + + 0 + - Pwr + <html><head/><body><p align="center"> 2015 Jun 17 </p><p align="center"> 01:23:45 </p></body></html> + + + Qt::AlignCenter + + + 5 + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 100 + 16777215 + + + + <html><head/><body><p>Select operating band or enter frequency in MHz or enter kHz increment followed by k.</p></body></html> + + + Frequency entry + + + Select operating band or enter frequency in MHz or enter kHz increment followed by k. + + + true + + + QComboBox::NoInsert + + + QComboBox::AdjustToMinimumContentsLengthWithIcon + + + + + + + false + + + <html><head/><body><p>If orange or red there has been a rig control failure, click to reset and read the dial frequency. S implies split mode.</p></body></html> + + + If orange or red there has been a rig control failure, click to reset and read the dial frequency. S implies split mode. + + + QPushButton { + font-family: helvetica; + font-size: 9pt; + font-weight: bold; + background-color: white; + color: black; + border-style: solid; + border-width:1px; + border-radius:10px; + border-color: gray; + max-width:20px; + max-height:20px; + min-width:20px; + min-height:20px; +} +QPushButton[state="error"] { + background-color: red; +} +QPushButton[state="warning"] { + background-color: orange; +} +QPushButton[state="ok"] { + background-color: #00ff00; +} + + + ? + + + + + @@ -3780,7 +3790,6 @@ Double-click to reset to the standard 73 message stopTxButton tuneButton cbMenus - bandComboBox sbNB dxCallEntry dxGridEntry From 2e59bd79d393fcda589d34ce9e6f74673ccef619 Mon Sep 17 00:00:00 2001 From: Uwe Risse Date: Mon, 17 Oct 2022 17:53:05 +0200 Subject: [PATCH 6/9] Some more fine tuning to the GUI. --- widgets/mainwindow.ui | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/widgets/mainwindow.ui b/widgets/mainwindow.ui index cc82980cb..c61d86392 100644 --- a/widgets/mainwindow.ui +++ b/widgets/mainwindow.ui @@ -2979,7 +2979,7 @@ QLabel[oob="true"] { - + @@ -2996,7 +2996,7 @@ QLabel[oob="true"] { - 100 + 16777215 16777215 From 35d758647de0ee799a03ac8a0633e3d873b055f6 Mon Sep 17 00:00:00 2001 From: Uwe Risse Date: Sun, 23 Oct 2022 13:05:29 +0200 Subject: [PATCH 7/9] Check the network address of the UDP server for errors before accepting it. Thanks to Mike W9MDB. --- Configuration.cpp | 24 ++++++++++++++++++++++++ Network/MessageClient.cpp | 1 + 2 files changed, 25 insertions(+) diff --git a/Configuration.cpp b/Configuration.cpp index e45bc99af..919d13400 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -1388,7 +1388,9 @@ void Configuration::impl::initialize_models () ui_->TX_audio_source_button_group->button (rig_params_.audio_source)->setChecked (true); ui_->CAT_poll_interval_spin_box->setValue (rig_params_.poll_interval); ui_->opCallEntry->setText (opCall_); + ui_->udp_server_line_edit->setEnabled(false); ui_->udp_server_line_edit->setText (udp_server_name_); + ui_->udp_server_line_edit->setEnabled(true); on_udp_server_line_edit_editingFinished (); ui_->udp_server_port_spin_box->setValue (udp_server_port_); load_network_interfaces (ui_->udp_interfaces_combo_box, udp_interface_names_); @@ -2449,6 +2451,27 @@ void Configuration::impl::on_udp_server_line_edit_textChanged (QString const&) void Configuration::impl::on_udp_server_line_edit_editingFinished () { + if (this->isVisible()) + { + int q1,q2,q3,q4; + char tmpbuf[2]; + int n = sscanf(ui_->udp_server_line_edit->text ().trimmed ().toLatin1(), "%d.%d.%d.%d.%1s", &q1, &q2, &q3, &q4, tmpbuf); + const char *iperr; + switch(n) + { + case 0: iperr = "Error before first number";break; + case 1: iperr = "Error between first and second number";break; + case 2: iperr = "Error between second and third number";break; + case 3: iperr = "Error between third and fourth number";break; + case 4: iperr = ""; break; + default: iperr = "Unknown error n=" + n; + } + if (n != 4) + { + MessageBox::warning_message (this, tr ("Error in network address"), tr (iperr)); + return; + } + if (udp_server_name_edited_) { auto const& server = ui_->udp_server_line_edit->text ().trimmed (); @@ -2468,6 +2491,7 @@ void Configuration::impl::on_udp_server_line_edit_editingFinished () check_multicast (ha); } } + } } void Configuration::impl::host_info_results (QHostInfo host_info) diff --git a/Network/MessageClient.cpp b/Network/MessageClient.cpp index 94f564bc5..1991f1593 100644 --- a/Network/MessageClient.cpp +++ b/Network/MessageClient.cpp @@ -137,6 +137,7 @@ void MessageClient::impl::host_info_results (QHostInfo host_info) if (QHostInfo::NoError != host_info.error ()) { Q_EMIT self_->error ("UDP server DNS lookup failed: " + host_info.errorString ()); + return; } else { From bc8ee62900cffa13b36e0c107ae2fdaab3633be8 Mon Sep 17 00:00:00 2001 From: Uwe Risse Date: Tue, 1 Nov 2022 14:52:49 +0100 Subject: [PATCH 8/9] Suppress "Transmit digital gain" overlay unless PWR attenuator is being adjusted. --- widgets/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index a2ada0969..43e9c7f2d 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -7999,7 +7999,7 @@ void MainWindow::on_outAttenuation_valueChanged (int a) tt_str = tr ("Transmit digital gain "); } tt_str += (a ? QString::number (-dBAttn, 'f', 1) : "0") + "dB"; - if (!m_block_pwr_tooltip) { + if (ui->outAttenuation->hasFocus() && !m_block_pwr_tooltip) { QToolTip::showText (QCursor::pos (), tt_str, ui->outAttenuation); } QString curBand = ui->bandComboBox->currentText(); From 0cd2935b8ca4d277400041122c1a700d83a8aec4 Mon Sep 17 00:00:00 2001 From: Uwe Risse Date: Tue, 1 Nov 2022 16:40:08 +0100 Subject: [PATCH 9/9] Prevent some possible segfault errors (patch by Mike W9MDB). --- Transceiver/DXLabSuiteCommanderTransceiver.cpp | 4 ++++ widgets/mainwindow.cpp | 12 +++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Transceiver/DXLabSuiteCommanderTransceiver.cpp b/Transceiver/DXLabSuiteCommanderTransceiver.cpp index 2014c1044..a96480662 100644 --- a/Transceiver/DXLabSuiteCommanderTransceiver.cpp +++ b/Transceiver/DXLabSuiteCommanderTransceiver.cpp @@ -444,8 +444,12 @@ QString DXLabSuiteCommanderTransceiver::command_with_reply (QString const& cmd) // qDebug () << i << ":" << hex << int (result[i]); // } + if (result != NULL) + { CAT_TRACE (cmd << " -> " << QString {result}); return result; // converting raw UTF-8 bytes to QString + } + return ""; } bool DXLabSuiteCommanderTransceiver::write_to_port (QString const& s) diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 43e9c7f2d..d78e2f857 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -90,6 +90,7 @@ #include "ExportCabrillo.h" #include "ui_mainwindow.h" #include "moc_mainwindow.cpp" +#include "Logger.hpp" #define FCL fortran_charlen_t @@ -1385,7 +1386,9 @@ void MainWindow::set_application_font (QFont const& font) QFile sf {sheet}; if (sf.open (QFile::ReadOnly | QFile::Text)) { - ss = sf.readAll () + ss; + QString tmp = sf.readAll(); + if (tmp != NULL) ss = sf.readAll () + tmp; + else qDebug() << "tmp==NULL at sf.readAll"; } } qApp->setStyleSheet (ss + "* {" + font_as_stylesheet (font) + '}'); @@ -4023,7 +4026,8 @@ void MainWindow::readFromStdout() //readFromStdout if(f.open(QIODevice::ReadOnly | QIODevice::Text)) { QTextStream s(&f); QString t=s.readAll(); - m_msgAvgWidget->displayAvg(t); + if (t != NULL) m_msgAvgWidget->displayAvg(t); + else qDebug() << "tmp==NULL at s.readAll"; } } } @@ -6152,7 +6156,9 @@ void MainWindow::on_addButton_clicked() //Add button // preserve symlinks f1.open (QFile::WriteOnly | QFile::Text); // truncates f2.seek (0); - f1.write (f2.readAll ()); // copy contents + QByteArray tmp = f2.readAll(); + if (tmp != (const char*)NULL) f1.write (tmp); // copy contents + else qDebug() << "tmp==NULL at f1.write"; f2.remove (); } }