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 { 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 a2ada0969..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 (); } } @@ -7999,7 +8005,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(); diff --git a/widgets/mainwindow.ui b/widgets/mainwindow.ui index 84aa8497f..733dc4dc9 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,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 - - - - + + @@ -921,43 +852,54 @@ - - - - - 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 + + + + 0 + 0 + + 100 @@ -982,84 +924,68 @@ 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 + + + + + - - - - 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; -} - - - ? - - - - + @@ -2048,9 +1974,6 @@ list. The list can be maintained in Settings (F2). QComboBox::InsertAtBottom - - QComboBox::AdjustToMinimumContentsLength - @@ -2844,35 +2767,40 @@ Double-click to reset to the standard 73 message - - - - - 100 - 16777215 - + + + + + 0 + 0 + - <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 - + @@ -3011,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 + + + + + 16777215 + 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; +} + + + ? + + + + + @@ -3030,8 +3076,8 @@ Double-click to reset to the standard 73 message 0 0 - 893 - 21 + 901 + 22 @@ -3744,7 +3790,6 @@ Double-click to reset to the standard 73 message stopTxButton tuneButton cbMenus - bandComboBox sbNB dxCallEntry dxGridEntry 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);