From 7093ac104a6781798893887227b5465a3b23796e Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 18 Aug 2022 10:24:07 -0700 Subject: [PATCH 001/207] Removed unused variables, corrected spelling. --- wfmain.cpp | 7 ------- wfmain.h | 2 -- wfmain.ui | 4 ++-- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index c55d6cc..2877d76 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -1048,7 +1048,6 @@ void wfmain::setUIToPrefs() ui->drawPeakChk->setChecked(prefs.drawPeaks); on_drawPeakChk_clicked(prefs.drawPeaks); - drawPeaks = prefs.drawPeaks; underlayMode = prefs.underlayMode; switch(underlayMode) @@ -3591,9 +3590,6 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e //spectrumPlasma.resize(spectrumPlasmaSize); plasmaMutex.unlock(); - // HACK DO NOT CHECK IN: - drawPeaks = false; - drawPlasma = true; if(!spectrumDrawLock) { @@ -3678,7 +3674,6 @@ void wfmain::computePlasma() } } plasmaMutex.unlock(); - } void wfmain::receiveSpectrumMode(spectrumMode spectMode) @@ -3882,10 +3877,8 @@ void wfmain::on_drawPeakChk_clicked(bool checked) if(checked) { on_clearPeakBtn_clicked(); // clear - drawPeaks = true; } else { - drawPeaks = false; #if QCUSTOMPLOT_VERSION >= 0x020000 plot->graph(1)->data()->clear(); diff --git a/wfmain.h b/wfmain.h index 55fc8d2..6ec4a6d 100644 --- a/wfmain.h +++ b/wfmain.h @@ -672,7 +672,6 @@ private: QVector spectrumPlasma; unsigned int spectrumPlasmaSize = 64; underlay_t underlayMode = underlayNone; - bool drawPlasma = true; QMutex plasmaMutex; void resizePlasmaBuffer(int newSize); @@ -687,7 +686,6 @@ private: unsigned int wfLengthMax; bool onFullscreen; - bool drawPeaks; bool freqTextSelected; void checkFreqSel(); diff --git a/wfmain.ui b/wfmain.ui index 2e0d107..a935e8c 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -18,7 +18,7 @@ - 3 + 0 @@ -2974,7 +2974,7 @@ - Uneerlay Buffer Size: + Underlay Buffer Size: From c59050e632c9172f361707c49cdecd60c3a29dcc Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 18 Aug 2022 10:54:54 -0700 Subject: [PATCH 002/207] Removed issue with plasma buffer resizing with the waterfall. --- wfmain.cpp | 35 +++++++++++++++++++++++------------ wfmain.h | 2 ++ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 2877d76..943cfaf 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -1079,7 +1079,7 @@ void wfmain::setUIToPrefs() ui->wfLengthSlider->setValue(prefs.wflength); prepareWf(prefs.wflength); - + preparePlasma(); ui->topLevelSlider->setValue(prefs.plotCeiling); ui->botLevelSlider->setValue(prefs.plotFloor); @@ -2079,17 +2079,6 @@ void wfmain::prepareWf(unsigned int wfLength) QByteArray empty((int)spectWidth, '\x01'); spectrumPeaks = QByteArray( (int)spectWidth, '\x01' ); - if(spectrumPlasmaSize == 0) - spectrumPlasmaSize = 128; - - //spectrumPlasma.resize(spectrumPlasmaSize); - for(unsigned int p=0; p < spectrumPlasmaSize; p++) - { - spectrumPlasma.append(empty); - } - - //wfimage.resize(wfLengthMax); - if((unsigned int)wfimage.size() < wfLengthMax) { unsigned int i=0; @@ -3646,6 +3635,28 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e } } +void wfmain::preparePlasma() +{ + if(plasmaPrepared) + return; + QByteArray empty((int)spectWidth, '\x01'); + + if(spectrumPlasmaSize == 0) + spectrumPlasmaSize = 128; + + plasmaMutex.lock(); + spectrumPlasma.clear(); + + for(unsigned int p=0; p < spectrumPlasmaSize; p++) + { + spectrumPlasma.append(empty); + } + + spectrumPlasma.squeeze(); + plasmaMutex.unlock(); + plasmaPrepared = true; +} + void wfmain::computePlasma() { plasmaMutex.lock(); diff --git a/wfmain.h b/wfmain.h index 6ec4a6d..5c7988f 100644 --- a/wfmain.h +++ b/wfmain.h @@ -573,6 +573,8 @@ private: void setPlotTheme(QCustomPlot *plot, bool isDark); void prepareWf(); void prepareWf(unsigned int wfLength); + void preparePlasma(); + bool plasmaPrepared = false; void computePlasma(); void showHideSpectrum(bool show); void getInitialRigState(); From a7587963b07eccb1e5129bbe13ad15b3a7414ee9 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 18 Aug 2022 11:07:29 -0700 Subject: [PATCH 003/207] Fixed issue where the waterfall colors re-scaled to min-max versus user preference upon wf length change. --- wfmain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wfmain.cpp b/wfmain.cpp index 943cfaf..805e7d0 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -2098,7 +2098,7 @@ void wfmain::prepareWf(unsigned int wfLength) colorMap->data()->setValueRange(QCPRange(0, wfLength-1)); colorMap->data()->setKeyRange(QCPRange(0, spectWidth-1)); - colorMap->setDataRange(QCPRange(0, rigCaps.spectAmpMax)); + colorMap->setDataRange(QCPRange(prefs.plotFloor, prefs.plotCeiling)); colorMap->setGradient(static_cast(ui->wfthemeCombo->currentData().toInt())); if(colorMapData == Q_NULLPTR) From ebb2c59a45e023ee7ec2fae1852297c4863b090f Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 18 Aug 2022 11:11:57 -0700 Subject: [PATCH 004/207] Added "pre-sorted" flag to plasma average mode plotting. --- wfmain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wfmain.cpp b/wfmain.cpp index 805e7d0..8eb7196 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -3597,7 +3597,7 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e plot->graph(1)->setData(x,y2, true); // peaks } else if (underlayMode != underlayNone) { computePlasma(); - plot->graph(1)->setData(x,spectrumPlasmaLine); + plot->graph(1)->setData(x,spectrumPlasmaLine, true); } else { plot->graph(1)->setData(x,y2, true); // peaks, but probably cleared out } From 1d14d9520e296b252f77fa91930dd6137113981c Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 18 Aug 2022 11:52:41 -0700 Subject: [PATCH 005/207] Fixed issue where spectrum greater than 128 was negative. --- wfmain.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 8eb7196..074f4c0 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -3555,6 +3555,7 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e QVector x(spectWidth), y(spectWidth), y2(spectWidth); + // TODO: Keep x around unless the frequency range changes. Should save a little time. for(int i=0; i < spectWidth; i++) { x[i] = (i * (endFreq-startFreq)/spectWidth) + startFreq; @@ -3669,7 +3670,7 @@ void wfmain::computePlasma() { for(int pos=0; pos < specPlasmaSize; pos++) { - spectrumPlasmaLine[col] += spectrumPlasma[pos][col]; + spectrumPlasmaLine[col] += (unsigned char)spectrumPlasma[pos][col]; } spectrumPlasmaLine[col] = spectrumPlasmaLine[col] / specPlasmaSize; } @@ -3679,8 +3680,8 @@ void wfmain::computePlasma() { for(int pos=0; pos < specPlasmaSize; pos++) { - if((double)(spectrumPlasma[pos][col]) > spectrumPlasmaLine[col]) - spectrumPlasmaLine[col] = spectrumPlasma[pos][col]; + if((double)((unsigned char)spectrumPlasma[pos][col]) > spectrumPlasmaLine[col]) + spectrumPlasmaLine[col] = (unsigned char)spectrumPlasma[pos][col]; } } } From a947ba6b189f663fbe506e5aea577165bb2b643a Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 18 Aug 2022 16:40:10 -0700 Subject: [PATCH 006/207] Added support for qcp 1.3 --- wfmain.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/wfmain.cpp b/wfmain.cpp index 074f4c0..475bd6d 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -3593,6 +3593,8 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e freqIndicatorLine->start->setCoords(freq.MHzDouble,0); freqIndicatorLine->end->setCoords(freq.MHzDouble,rigCaps.spectAmpMax); } + +#if QCUSTOMPLOT_VERSION >= 0x020000 if(underlayMode == underlayPeakHold) { plot->graph(1)->setData(x,y2, true); // peaks @@ -3602,6 +3604,17 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e } else { plot->graph(1)->setData(x,y2, true); // peaks, but probably cleared out } +#else + if(underlayMode == underlayPeakHold) + { + plot->graph(1)->setData(x,y2); // peaks + } else if (underlayMode != underlayNone) { + computePlasma(); + plot->graph(1)->setData(x,spectrumPlasmaLine); + } else { + plot->graph(1)->setData(x,y2); // peaks, but probably cleared out + } +#endif if(updateRange) plot->yAxis->setRange(prefs.plotFloor, prefs.plotCeiling); From d8dc9daa1501841afec6002bd204deacf39330ac Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 18 Aug 2022 16:45:58 -0700 Subject: [PATCH 007/207] One more thing for qcp 1.3 --- wfmain.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/wfmain.cpp b/wfmain.cpp index 475bd6d..d29e68f 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -3587,6 +3587,8 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e updateRange = true; //ui->qcp->addGraph(); +#if QCUSTOMPLOT_VERSION >= 0x020000 + plot->graph(0)->setData(x,y, true); if((freq.MHzDouble < endFreq) && (freq.MHzDouble > startFreq)) { @@ -3594,7 +3596,6 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e freqIndicatorLine->end->setCoords(freq.MHzDouble,rigCaps.spectAmpMax); } -#if QCUSTOMPLOT_VERSION >= 0x020000 if(underlayMode == underlayPeakHold) { plot->graph(1)->setData(x,y2, true); // peaks @@ -3605,6 +3606,13 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e plot->graph(1)->setData(x,y2, true); // peaks, but probably cleared out } #else + plot->graph(0)->setData(x,y); + if((freq.MHzDouble < endFreq) && (freq.MHzDouble > startFreq)) + { + freqIndicatorLine->start->setCoords(freq.MHzDouble,0); + freqIndicatorLine->end->setCoords(freq.MHzDouble,rigCaps.spectAmpMax); + } + if(underlayMode == underlayPeakHold) { plot->graph(1)->setData(x,y2); // peaks From 088d34af8be7d6759e75627ae2f765629c7ab203 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 18 Aug 2022 20:54:50 -0700 Subject: [PATCH 008/207] Removed checkbox from prior peak hold mode. --- wfmain.cpp | 21 --------------------- wfmain.h | 2 -- wfmain.ui | 15 ++++----------- 3 files changed, 4 insertions(+), 34 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index d29e68f..e381bba 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -1046,9 +1046,6 @@ void wfmain::setUIToPrefs() ui->useSystemThemeChk->setChecked(prefs.useSystemTheme); on_useSystemThemeChk_clicked(prefs.useSystemTheme); - ui->drawPeakChk->setChecked(prefs.drawPeaks); - on_drawPeakChk_clicked(prefs.drawPeaks); - underlayMode = prefs.underlayMode; switch(underlayMode) { @@ -3905,24 +3902,6 @@ void wfmain::on_clearPeakBtn_clicked() return; } -void wfmain::on_drawPeakChk_clicked(bool checked) -{ - if(checked) - { - on_clearPeakBtn_clicked(); // clear - - } else { - -#if QCUSTOMPLOT_VERSION >= 0x020000 - plot->graph(1)->data()->clear(); -#else - plot->graph(1)->clearData(); -#endif - - } - prefs.drawPeaks = checked; -} - void wfmain::on_fullScreenChk_clicked(bool checked) { if(checked) diff --git a/wfmain.h b/wfmain.h index 5c7988f..664dc8a 100644 --- a/wfmain.h +++ b/wfmain.h @@ -297,8 +297,6 @@ private slots: void on_clearPeakBtn_clicked(); - void on_drawPeakChk_clicked(bool checked); - void on_fullScreenChk_clicked(bool checked); void on_goFreqBtn_clicked(); diff --git a/wfmain.ui b/wfmain.ui index a935e8c..6b92776 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -6,7 +6,7 @@ 0 0 - 1002 + 1032 569 @@ -18,7 +18,7 @@ - 0 + 3 @@ -2820,13 +2820,6 @@ - - - - Draw Peaks - - - @@ -4006,7 +3999,7 @@ 0 0 - 1002 + 1032 21 @@ -4028,7 +4021,7 @@ - + From ab65f8e38dc7dd053601c4ae682c34ad27d30e42 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 18 Aug 2022 20:56:24 -0700 Subject: [PATCH 009/207] Finally remembered to remove annoying commented-out code. --- wfmain.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/wfmain.cpp b/wfmain.cpp index e381bba..01fe55b 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -3583,7 +3583,6 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e if((plotFloor != oldPlotFloor) || (plotCeiling != oldPlotCeiling)) updateRange = true; - //ui->qcp->addGraph(); #if QCUSTOMPLOT_VERSION >= 0x020000 plot->graph(0)->setData(x,y, true); From 1423e7c3007192649b6ae81eeb505b678b6d1991 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Fri, 19 Aug 2022 09:41:13 -0700 Subject: [PATCH 010/207] Added color picker functions and demonstration UI elements --- qledlabel.cpp | 50 +++++++++++++++++- qledlabel.h | 6 +++ wfmain.cpp | 55 +++++++++++++++++++ wfmain.h | 10 ++++ wfmain.ui | 143 +++++++++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 261 insertions(+), 3 deletions(-) diff --git a/qledlabel.cpp b/qledlabel.cpp index 640b1c4..5370b5e 100644 --- a/qledlabel.cpp +++ b/qledlabel.cpp @@ -38,4 +38,52 @@ void QLedLabel::setState(State state) void QLedLabel::setState(bool state) { setState(state ? StateOk : StateError); -} \ No newline at end of file +} + +void QLedLabel::setColor(QColor customColor, bool applyGradient=true) +{ + QColor top,middle,bottom; + this->baseColor = customColor; + + if(applyGradient) + { + top = customColor.lighter(200); + middle = customColor; + bottom = customColor.darker(200); + } else { + top = customColor; + middle = customColor; + bottom = customColor; + } + + // Stop 0 is the upper corner color, white-ish + // Stop 0.4 is the middle color + // Stop 1 is the bottom-right corner, darker. + + QString colorSS = QString("color: white;\ + border-radius: %1;background-color: \ + qlineargradient(spread:pad, x1:0.04, \ + y1:0.0565909, x2:0.799, y2:0.795, \ + stop:0 \ + rgba(%2, %3, %4, %5), \ + stop:0.41206 \ + rgba(%6, %7, %8, %9), \ + stop:1 \ + rgba(%10, %11, %12, %13));").arg(SIZE / 3) + .arg(top.red()).arg(top.green()).arg(top.blue()).arg(top.alpha()) + .arg(middle.red()).arg(middle.green()).arg(middle.blue()).arg(middle.alpha()) + .arg(bottom.red()).arg(bottom.green()).arg(bottom.blue()).arg(bottom.alpha()); + + setStyleSheet(colorSS); +} + +void QLedLabel::setColor(QString colorString, bool applyGradient=true) +{ + QColor c = QColor(colorString); + setColor(c, applyGradient); +} + +QColor QLedLabel::getColor() +{ + return baseColor; +} diff --git a/qledlabel.h b/qledlabel.h index b5dc706..824fbac 100644 --- a/qledlabel.h +++ b/qledlabel.h @@ -22,6 +22,12 @@ signals: public slots: void setState(State state); void setState(bool state); + void setColor(QColor customColor, bool applyGradient); + void setColor(QString colorString, bool applyGradient); + QColor getColor(); + +private: + QColor baseColor; }; #endif // QLEDLABEL_H diff --git a/wfmain.cpp b/wfmain.cpp index 01fe55b..4e07fd3 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6219,3 +6219,58 @@ void wfmain::on_debugBtn_clicked() // adjustSize(); } + +void wfmain::setColorElement(QColor color, + QLedLabel *led, + QLabel *label, + QLineEdit *lineText) +{ + if(led != Q_NULLPTR) + { + led->setColor(color, true); + } + if(label != Q_NULLPTR) + { + label->setText(color.name(QColor::HexArgb)); + } + if(lineText != Q_NULLPTR) + { + lineText->setText(color.name(QColor::HexArgb)); + } +} + +void wfmain::setColorElement(QColor color, QLedLabel *led, QLabel *label) +{ + setColorElement(color, led, label, Q_NULLPTR); +} + +void wfmain::setColorElement(QColor color, QLedLabel *led, QLineEdit *lineText) +{ + setColorElement(color, led, Q_NULLPTR, lineText); +} + +QColor wfmain::getColor(QColor initialColor) +{ + QColorDialog::ColorDialogOptions options; + options.setFlag(QColorDialog::ShowAlphaChannel, true); + options.setFlag(QColorDialog::DontUseNativeDialog, true); + QColor selColor = QColorDialog::getColor(initialColor, this, "Select Color", options); + return selColor; +} + +void wfmain::getSetColor(QLedLabel *led, QLabel *label) +{ + QColor selColor = getColor(led->getColor()); + setColorElement(selColor, led, label); +} + +void wfmain::getSetColor(QLedLabel *led, QLineEdit *line) +{ + QColor selColor = getColor(led->getColor()); + setColorElement(selColor, led, line); +} + +void wfmain::on_colorSetBtnGrid_clicked() +{ + getSetColor(ui->colorSwatchGrid, ui->colorLabelGrid); +} diff --git a/wfmain.h b/wfmain.h index 664dc8a..ba21879 100644 --- a/wfmain.h +++ b/wfmain.h @@ -16,6 +16,8 @@ #include #include #include +#include +#include #include "logcategories.h" #include "commhandler.h" @@ -553,6 +555,8 @@ private slots: void on_underlayAverageBuffer_toggled(bool checked); + void on_colorSetBtnGrid_clicked(); + private: Ui::wfmain *ui; void closeEvent(QCloseEvent *event); @@ -833,6 +837,12 @@ private: void useColors(); // set the plot up void setDefPrefs(); // populate default values to default prefs void setTuningSteps(); + void setColorElement(QColor color, QLedLabel *led, QLabel *label); + void setColorElement(QColor color, QLedLabel *led, QLineEdit *lineText); + void setColorElement(QColor color, QLedLabel *led, QLabel *label, QLineEdit *lineText); + QColor getColor(QColor initialColor); + void getSetColor(QLedLabel *led, QLabel *label); + void getSetColor(QLedLabel *led, QLineEdit *line); quint64 roundFrequency(quint64 frequency, unsigned int tsHz); quint64 roundFrequencyWithStep(quint64 oldFreq, int steps,\ diff --git a/wfmain.ui b/wfmain.ui index 6b92776..682777e 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -3081,6 +3081,139 @@ + + + + + 0 + 0 + + + + User-defined colors + + + + + + true + + + + + 0 + 0 + 767 + 192 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Grid... + + + + + + + PushButton + + + + + + + TextLabel + + + + + + + TextLabel + + + + + + + PushButton + + + + + + + PushButton + + + + + + + PushButton + + + + + + + GRID + + + + + + + PushButton + + + + + + + TextLabel + + + + + + + + 15 + 15 + + + + + 15 + 15 + + + + + + + + + + + @@ -3089,7 +3222,7 @@ 20 - 40 + 20 @@ -4017,11 +4150,17 @@
meter.h
1 + + QLedLabel + QWidget +
qledlabel.h
+ 1 +
- + From 4b0ce8537e242b6dcd37be151d91c3e21cadea31 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Fri, 19 Aug 2022 10:32:06 -0700 Subject: [PATCH 011/207] Added line input to color functions --- qledlabel.cpp | 3 ++- wfmain.cpp | 30 ++++++++++++++++++++++++++++++ wfmain.h | 5 +++++ wfmain.ui | 35 ++++++++++++++++++++++------------- 4 files changed, 59 insertions(+), 14 deletions(-) diff --git a/qledlabel.cpp b/qledlabel.cpp index 5370b5e..c146071 100644 --- a/qledlabel.cpp +++ b/qledlabel.cpp @@ -12,6 +12,7 @@ QLedLabel::QLedLabel(QWidget* parent) : { //Set to ok by default setState(StateOkBlue); + baseColor = QColor(0, 115, 255, 255); setFixedSize(SIZE, SIZE); } @@ -69,7 +70,7 @@ void QLedLabel::setColor(QColor customColor, bool applyGradient=true) stop:0.41206 \ rgba(%6, %7, %8, %9), \ stop:1 \ - rgba(%10, %11, %12, %13));").arg(SIZE / 3) + rgba(%10, %11, %12, %13));").arg(SIZE / 2) .arg(top.red()).arg(top.green()).arg(top.blue()).arg(top.alpha()) .arg(middle.red()).arg(middle.green()).arg(middle.blue()).arg(middle.alpha()) .arg(bottom.red()).arg(bottom.green()).arg(bottom.blue()).arg(bottom.alpha()); diff --git a/wfmain.cpp b/wfmain.cpp index 4e07fd3..5e66c31 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6270,7 +6270,37 @@ void wfmain::getSetColor(QLedLabel *led, QLineEdit *line) setColorElement(selColor, led, line); } +QString wfmain::setColorFromString(QString colorstr, QLedLabel *led) +{ + if(led==Q_NULLPTR) + return "ERROR"; + + if(!colorstr.startsWith("#")) + { + colorstr.prepend("#"); + } + if(colorstr.length() != 9) + { + // TODO: Tell user about AA RR GG BB + return led->getColor().name(QColor::HexArgb); + } + led->setColor(colorstr, true); + return led->getColor().name(QColor::HexArgb); +} + void wfmain::on_colorSetBtnGrid_clicked() { getSetColor(ui->colorSwatchGrid, ui->colorLabelGrid); } + +void wfmain::on_colorSetBtnPlotBackground_clicked() +{ + getSetColor(ui->colorSwatchPlotBackground, ui->colorLinePlotBackground); +} + +void wfmain::on_colorLinePlotBackground_editingFinished() +{ + QString c = ui->colorLinePlotBackground->text(); + c = setColorFromString(c, ui->colorSwatchPlotBackground); + ui->colorLinePlotBackground->setText(c); +} diff --git a/wfmain.h b/wfmain.h index ba21879..bc99071 100644 --- a/wfmain.h +++ b/wfmain.h @@ -557,6 +557,10 @@ private slots: void on_colorSetBtnGrid_clicked(); + void on_colorSetBtnPlotBackground_clicked(); + + void on_colorLinePlotBackground_editingFinished(); + private: Ui::wfmain *ui; void closeEvent(QCloseEvent *event); @@ -843,6 +847,7 @@ private: QColor getColor(QColor initialColor); void getSetColor(QLedLabel *led, QLabel *label); void getSetColor(QLedLabel *led, QLineEdit *line); + QString setColorFromString(QString aarrggbb, QLedLabel *led); quint64 roundFrequency(quint64 frequency, unsigned int tsHz); quint64 roundFrequencyWithStep(quint64 oldFreq, int steps,\ diff --git a/wfmain.ui b/wfmain.ui index 682777e..020ba1e 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -3135,13 +3135,6 @@
- - - - TextLabel - - - @@ -3164,9 +3157,9 @@ - + - PushButton + Plot Background... @@ -3195,18 +3188,34 @@ - 15 - 15 + 0 + 0 - 15 - 15 + 65535 + 65535
+ + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + From b77715e0d8440b59dc640b7e1024e4db6e772432 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sun, 21 Aug 2022 00:17:44 -0700 Subject: [PATCH 012/207] Color preferences. We can now set a single color and also detach the settings tab. --- colorprefs.h | 30 +++++ qledlabel.cpp | 6 + qledlabel.h | 3 +- wfmain.cpp | 83 +++++++++++- wfmain.h | 14 ++ wfmain.ui | 365 ++++++++++++++++++++++++++++++++++++++++++-------- wfview.pro | 1 + 7 files changed, 437 insertions(+), 65 deletions(-) create mode 100644 colorprefs.h diff --git a/colorprefs.h b/colorprefs.h new file mode 100644 index 0000000..cbdcf61 --- /dev/null +++ b/colorprefs.h @@ -0,0 +1,30 @@ +#ifndef COLORPREFS_H +#define COLORPREFS_H + +#include +#include + +struct colorPrefsType{ + int presetNum = -1; + QString presetName = QString("uninitialized"); + + QColor gridColor; + QColor textColor; + QColor spectrumLine; + QColor spectrumFill; + QColor underlayLine; + QColor underlayFill; + QColor plotBackground; + QColor tuningLine; + + QColor meterLevel; + QColor meterAverage; + QColor meterPeak; + + QColor wfBackground; + QColor wfGrid; + QColor wfText; +}; + + +#endif // COLORPREFS_H diff --git a/qledlabel.cpp b/qledlabel.cpp index c146071..9829fdf 100644 --- a/qledlabel.cpp +++ b/qledlabel.cpp @@ -6,6 +6,7 @@ static const QString greenSS = QString("color: white;border-radius: %1;backgroun static const QString redSS = QString("color: white;border-radius: %1;background-color: qlineargradient(spread:pad, x1:0.145, y1:0.16, x2:0.92, y2:0.988636, stop:0 rgba(255, 12, 12, 255), stop:0.869347 rgba(103, 0, 0, 255));").arg(SIZE / 2); static const QString orangeSS = QString("color: white;border-radius: %1;background-color: qlineargradient(spread:pad, x1:0.232, y1:0.272, x2:0.98, y2:0.959773, stop:0 rgba(255, 113, 4, 255), stop:1 rgba(91, 41, 7, 255))").arg(SIZE / 2); static const QString blueSS = QString("color: white;border-radius: %1;background-color: qlineargradient(spread:pad, x1:0.04, y1:0.0565909, x2:0.799, y2:0.795, stop:0 rgba(203, 220, 255, 255), stop:0.41206 rgba(0, 115, 255, 255), stop:1 rgba(0, 49, 109, 255));").arg(SIZE / 2); +static const QString blankSS = QString("color: white;border-radius: %1;background-color: qlineargradient(spread:pad, x1:0.04, y1:0.0565909, x2:0.799, y2:0.795, stop:0 rgba(203, 220, 255, 0), stop:0.41206 rgba(0, 115, 255, 0), stop:1 rgba(0, 49, 109, 0));").arg(SIZE / 2); QLedLabel::QLedLabel(QWidget* parent) : QLabel(parent) @@ -30,6 +31,11 @@ void QLedLabel::setState(State state) setStyleSheet(redSS); break; case StateOkBlue: + setStyleSheet(blueSS); + break; + case StateBlank: + setStyleSheet(blankSS); + break; default: setStyleSheet(blueSS); break; diff --git a/qledlabel.h b/qledlabel.h index 824fbac..3cb2c66 100644 --- a/qledlabel.h +++ b/qledlabel.h @@ -13,7 +13,8 @@ public: StateOk, StateOkBlue, StateWarning, - StateError + StateError, + StateBlank }; diff --git a/wfmain.cpp b/wfmain.cpp index 5e66c31..69c9967 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6290,17 +6290,90 @@ QString wfmain::setColorFromString(QString colorstr, QLedLabel *led) void wfmain::on_colorSetBtnGrid_clicked() { - getSetColor(ui->colorSwatchGrid, ui->colorLabelGrid); + getSetColor(ui->colorSwatchGrid, ui->colorEditGrid); } void wfmain::on_colorSetBtnPlotBackground_clicked() { - getSetColor(ui->colorSwatchPlotBackground, ui->colorLinePlotBackground); + getSetColor(ui->colorSwatchPlotBackground, ui->colorEditPlotBackground); } void wfmain::on_colorLinePlotBackground_editingFinished() { - QString c = ui->colorLinePlotBackground->text(); - c = setColorFromString(c, ui->colorSwatchPlotBackground); - ui->colorLinePlotBackground->setText(c); + +} + +void wfmain::useColorPreset(colorPrefsType *cp) +{ + // Apply the given preset to the UI elements + // prototyped from setPlotTheme() + if(cp == Q_NULLPTR) + return; + + plot->setBackground(cp->plotBackground); + + plot->xAxis->grid()->setPen(cp->gridColor); + plot->yAxis->grid()->setPen(cp->gridColor); + + plot->legend->setTextColor(cp->textColor); + plot->legend->setBorderPen(cp->gridColor); + plot->legend->setBrush(cp->gridColor); + + plot->xAxis->setTickLabelColor(cp->gridColor); + plot->xAxis->setLabelColor(cp->textColor); + plot->yAxis->setTickLabelColor(cp->gridColor); + plot->yAxis->setLabelColor(cp->textColor); + + plot->xAxis->setBasePen(cp->textColor); + plot->xAxis->setTickPen(cp->textColor); + plot->yAxis->setBasePen(cp->textColor); + plot->yAxis->setTickPen(cp->textColor); + + freqIndicatorLine->setPen(QPen(cp->tuningLine)); + + plot->graph(0)->setPen(QPen(cp->spectrumLine)); + plot->graph(0)->setBrush(QBrush(cp->spectrumFill)); + + plot->graph(1)->setPen(QPen(cp->underlayLine)); + plot->graph(1)->setBrush(QBrush(cp->underlayFill)); + +} + + +void wfmain::on_colorSetBtnText_clicked() +{ + +} + +void wfmain::on_colorSetBtnSpecLine_clicked() +{ + +} + +void wfmain::on_colorSetBtnSpecFill_clicked() +{ + +} + +void wfmain::on_colorEditPlotBackground_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QString c = ui->colorEditPlotBackground->text(); + c = setColorFromString(c, ui->colorSwatchPlotBackground); + ui->colorEditPlotBackground->setText(c); + colorPreset[pos].plotBackground = c; + useColorPreset(&colorPreset[pos]); +} + +void wfmain::on_colorPopOutBtn_clicked() +{ + QWidget *settingsPop = new QWidget; + QWidget *settingsTab = ui->tabWidget->currentWidget(); + ui->tabWidget->removeTab(ui->tabWidget->indexOf(settingsTab)); + QGridLayout *g = new QGridLayout; + QTabWidget *t = new QTabWidget; + settingsPop->setLayout(g); + g->addWidget(t); + t->addTab(settingsTab, "Settings"); + settingsPop->show(); } diff --git a/wfmain.h b/wfmain.h index bc99071..006d79f 100644 --- a/wfmain.h +++ b/wfmain.h @@ -37,6 +37,7 @@ #include "rigctld.h" #include "aboutbox.h" #include "selectradio.h" +#include "colorprefs.h" #include #include @@ -561,6 +562,16 @@ private slots: void on_colorLinePlotBackground_editingFinished(); + void on_colorSetBtnText_clicked(); + + void on_colorSetBtnSpecLine_clicked(); + + void on_colorSetBtnSpecFill_clicked(); + + void on_colorEditPlotBackground_editingFinished(); + + void on_colorPopOutBtn_clicked(); + private: Ui::wfmain *ui; void closeEvent(QCloseEvent *event); @@ -791,6 +802,8 @@ private: } colorScheme; + colorPrefsType colorPreset[5]; + struct preferences { bool useFullScreen; bool useDarkMode; @@ -839,6 +852,7 @@ private: void setDefaultColors(); // populate with default values void useColors(); // set the plot up + void useColorPreset(colorPrefsType *cp); void setDefPrefs(); // populate default values to default prefs void setTuningSteps(); void setColorElement(QColor color, QLedLabel *led, QLabel *label); diff --git a/wfmain.ui b/wfmain.ui index 020ba1e..f90f61e 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -3090,7 +3090,7 @@ - User-defined colors + User-defined Color Editor @@ -3104,87 +3104,186 @@ 0 0 767 - 192 + 372 - - - - Qt::Horizontal - - - - 40 - 20 - - - + + - - - - Grid... - - - - - - - PushButton - - + + - + + + + 90 + 16777215 + + - TextLabel + #AARRGGBB - - + + + + + 90 + 16777215 + + - PushButton + #AARRGGBB - - + + + + + + + + - PushButton + Overlay Line + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Rename Preset + + + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Meter Average + + + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Spectrum Fill - + - Plot Background... + Preset: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + + + + 90 + 16777215 + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + + + + + + + + + + + 90 + 16777215 + + - GRID + #AARRGGBB - - - - PushButton - - - - - - - TextLabel - - - - + @@ -3200,8 +3299,15 @@ - - + + + + Spectrum Line + + + + + 90 @@ -3213,8 +3319,149 @@ - - + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Plot Background + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Text + + + + + + + Meter Level + + + + + + + + + + Grid + + + + + + + Make Current + + + + + + + Save Preset + + + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Meter Peak + + + + + + + Pop-Out + + + + + + + Overlay Fill + + + + + + + Tuning Line + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + diff --git a/wfview.pro b/wfview.pro index c9cd8aa..f3118dd 100644 --- a/wfview.pro +++ b/wfview.pro @@ -176,6 +176,7 @@ SOURCES += main.cpp\ aboutbox.cpp HEADERS += wfmain.h \ + colorprefs.h \ commhandler.h \ rigcommander.h \ freqmemory.h \ From ac8a98049e936bba064713f4c315952647803676 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sun, 21 Aug 2022 00:33:59 -0700 Subject: [PATCH 013/207] More connections from picker to UI. --- wfmain.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 69c9967..6604836 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6288,11 +6288,6 @@ QString wfmain::setColorFromString(QString colorstr, QLedLabel *led) return led->getColor().name(QColor::HexArgb); } -void wfmain::on_colorSetBtnGrid_clicked() -{ - getSetColor(ui->colorSwatchGrid, ui->colorEditGrid); -} - void wfmain::on_colorSetBtnPlotBackground_clicked() { getSetColor(ui->colorSwatchPlotBackground, ui->colorEditPlotBackground); @@ -6355,6 +6350,15 @@ void wfmain::on_colorSetBtnSpecFill_clicked() } +void wfmain::on_colorSetBtnGrid_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + getSetColor(ui->colorSwatchGrid, ui->colorEditGrid); + QColor c = ui->colorSwatchPlotBackground->getColor(); + colorPreset[pos].gridColor = c; + useColorPreset(&colorPreset[pos]); +} + void wfmain::on_colorEditPlotBackground_editingFinished() { int pos = ui->colorPresetCombo->currentIndex(); @@ -6376,4 +6380,5 @@ void wfmain::on_colorPopOutBtn_clicked() g->addWidget(t); t->addTab(settingsTab, "Settings"); settingsPop->show(); + //connect(settingsPop, SIGNAL(destroyed(QObject*)), this, foo()); } From 2a509a61774305206c78b2bcb73ed0a0fb568465 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sun, 21 Aug 2022 16:47:17 -0700 Subject: [PATCH 014/207] Color editing for a few parameters is working. Lots of new helper functions introduced to make coding simpler. --- colorprefs.h | 3 + meter.cpp | 11 ++ meter.h | 3 + qledlabel.cpp | 10 ++ qledlabel.h | 2 + wfmain.cpp | 246 ++++++++++++++++++++++---- wfmain.h | 23 ++- wfmain.ui | 475 +++++++++++++++++++++++++++++++------------------- 8 files changed, 555 insertions(+), 218 deletions(-) diff --git a/colorprefs.h b/colorprefs.h index cbdcf61..aa2a4bf 100644 --- a/colorprefs.h +++ b/colorprefs.h @@ -20,6 +20,9 @@ struct colorPrefsType{ QColor meterLevel; QColor meterAverage; QColor meterPeak; + QColor meterLowerLine; + QColor meterLowText; + QColor wfBackground; QColor wfGrid; diff --git a/meter.cpp b/meter.cpp index bc606ef..611c2e7 100644 --- a/meter.cpp +++ b/meter.cpp @@ -48,6 +48,17 @@ meter::meter(QWidget *parent) : QWidget(parent) } +void meter::setColors(QColor current, QColor peak, + QColor average, QColor lowLine, + QColor lowText) +{ + currentColor = current; + peakColor = peak; + averageColor = average; + lowLineColor = lowLine; + lowTextColor = lowText; +} + void meter::clearMeterOnPTTtoggle() { // When a meter changes type, such as the fixed S -- TxPo meter, diff --git a/meter.h b/meter.h index d94657c..fc29168 100644 --- a/meter.h +++ b/meter.h @@ -30,6 +30,9 @@ public slots: void setMeterShortString(QString); QString getMeterShortString(); meterKind getMeterType(); + void setColors(QColor current, QColor peak, + QColor average, QColor lowLine, + QColor lowText); private: diff --git a/qledlabel.cpp b/qledlabel.cpp index 9829fdf..d85ca8a 100644 --- a/qledlabel.cpp +++ b/qledlabel.cpp @@ -90,6 +90,16 @@ void QLedLabel::setColor(QString colorString, bool applyGradient=true) setColor(c, applyGradient); } +void QLedLabel::setColor(QColor c) +{ + this->setColor(c, true); +} + +void QLedLabel::setColor(QString s) +{ + this->setColor(s, true); +} + QColor QLedLabel::getColor() { return baseColor; diff --git a/qledlabel.h b/qledlabel.h index 3cb2c66..d4117c9 100644 --- a/qledlabel.h +++ b/qledlabel.h @@ -25,6 +25,8 @@ public slots: void setState(bool state); void setColor(QColor customColor, bool applyGradient); void setColor(QString colorString, bool applyGradient); + void setColor(QColor c); + void setColor(QString s); QColor getColor(); private: diff --git a/wfmain.cpp b/wfmain.cpp index 6604836..a70fa1e 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -71,6 +71,9 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s qDebug(logSystem()) << "Running setUIToPrefs()"; setUIToPrefs(); + setDefaultColorPresets(); + loadColorPresetToUIandPlots(0); + qDebug(logSystem()) << "Running setInititalTiming()"; setInitialTiming(); @@ -6249,7 +6252,7 @@ void wfmain::setColorElement(QColor color, QLedLabel *led, QLineEdit *lineText) setColorElement(color, led, Q_NULLPTR, lineText); } -QColor wfmain::getColor(QColor initialColor) +QColor wfmain::getColorFromPicker(QColor initialColor) { QColorDialog::ColorDialogOptions options; options.setFlag(QColorDialog::ShowAlphaChannel, true); @@ -6260,13 +6263,13 @@ QColor wfmain::getColor(QColor initialColor) void wfmain::getSetColor(QLedLabel *led, QLabel *label) { - QColor selColor = getColor(led->getColor()); + QColor selColor = getColorFromPicker(led->getColor()); setColorElement(selColor, led, label); } void wfmain::getSetColor(QLedLabel *led, QLineEdit *line) { - QColor selColor = getColor(led->getColor()); + QColor selColor = getColorFromPicker(led->getColor()); setColorElement(selColor, led, line); } @@ -6288,16 +6291,17 @@ QString wfmain::setColorFromString(QString colorstr, QLedLabel *led) return led->getColor().name(QColor::HexArgb); } -void wfmain::on_colorSetBtnPlotBackground_clicked() -{ - getSetColor(ui->colorSwatchPlotBackground, ui->colorEditPlotBackground); -} - void wfmain::on_colorLinePlotBackground_editingFinished() { } +void wfmain::useCurrentColorPreset() +{ + int pos = ui->colorPresetCombo->currentIndex(); + useColorPreset(&colorPreset[pos]); +} + void wfmain::useColorPreset(colorPrefsType *cp) { // Apply the given preset to the UI elements @@ -6305,6 +6309,8 @@ void wfmain::useColorPreset(colorPrefsType *cp) if(cp == Q_NULLPTR) return; + qInfo(logSystem()) << "Setting plots to color preset " << cp->presetNum; + plot->setBackground(cp->plotBackground); plot->xAxis->grid()->setPen(cp->gridColor); @@ -6334,39 +6340,39 @@ void wfmain::useColorPreset(colorPrefsType *cp) } - -void wfmain::on_colorSetBtnText_clicked() +void wfmain::setColorButtonOperations(QColor *colorStore, + QLineEdit *e, QLedLabel *d) { + // Call this function with a pointer into the colorPreset color you + // wish to edit. + if(colorStore==Q_NULLPTR) + { + qInfo(logSystem()) << "ERROR, invalid pointer to color received."; + return; + } + getSetColor(d, e); + QColor t = d->getColor(); + colorStore->setNamedColor(t.name()); + //colorStore->setBlue(100); + useCurrentColorPreset(); } -void wfmain::on_colorSetBtnSpecLine_clicked() +void wfmain::setColorLineEditOperations(QColor *colorStore, + QLineEdit *e, QLedLabel *d) { + // Call this function with a pointer into the colorPreset color you + // wish to edit. + if(colorStore==Q_NULLPTR) + { + qInfo(logSystem()) << "ERROR, invalid pointer to color received."; + return; + } -} - -void wfmain::on_colorSetBtnSpecFill_clicked() -{ - -} - -void wfmain::on_colorSetBtnGrid_clicked() -{ - int pos = ui->colorPresetCombo->currentIndex(); - getSetColor(ui->colorSwatchGrid, ui->colorEditGrid); - QColor c = ui->colorSwatchPlotBackground->getColor(); - colorPreset[pos].gridColor = c; - useColorPreset(&colorPreset[pos]); -} - -void wfmain::on_colorEditPlotBackground_editingFinished() -{ - int pos = ui->colorPresetCombo->currentIndex(); - QString c = ui->colorEditPlotBackground->text(); - c = setColorFromString(c, ui->colorSwatchPlotBackground); - ui->colorEditPlotBackground->setText(c); - colorPreset[pos].plotBackground = c; - useColorPreset(&colorPreset[pos]); + QString colorStrValidated = setColorFromString(e->text(), d); + e->setText(colorStrValidated); + colorStore->setNamedColor(colorStrValidated); + useCurrentColorPreset(); } void wfmain::on_colorPopOutBtn_clicked() @@ -6382,3 +6388,173 @@ void wfmain::on_colorPopOutBtn_clicked() settingsPop->show(); //connect(settingsPop, SIGNAL(destroyed(QObject*)), this, foo()); } + +// Color Helper Functions: +void wfmain::setDefaultColorPresets() +{ + // Default wfview colors in each preset + // gets overridden after preferences are loaded + for(int pn=0; pn < numColorPresetsTotal; pn++) + { + qInfo(logSystem()) << "Setting default color preset " << pn; + colorPrefsType *p = &colorPreset[pn]; + + p->presetNum = pn; + //p->presetName = new QString("%1").arg(pn); + + // Colors are "#AARRGGBB" (AA=0xff is opaque) + // or as (r, g, b, a) + // Since the UI shows ##AARRGGBB, we should use + // that format in the code when convenient. + + p->gridColor = QColor(0,0,0,255); + p->textColor = QColor(Qt::white); + p->spectrumLine = QColor(Qt::yellow); + p->spectrumFill = QColor("transparent"); + p->underlayLine = QColor(20+200/4.0*1,70*(1.6-1/4.0), 150, 150).lighter(200); + p->underlayFill = QColor(20+200/4.0*1,70*(1.6-1/4.0), 150, 150); + p->plotBackground = QColor(Qt::black); + p->tuningLine = QColor(Qt::blue); + + p->meterLevel = QColor("#148CD2").darker(); + p->meterAverage = QColor("#3FB7CD"); + p->meterPeak = QColor("#3CA0DB").lighter(); + p->meterLowerLine = QColor("#eff0f1"); + p->meterLowText = QColor("#eff0f1"); + + p->wfBackground = QColor(Qt::black); + p->wfGrid = QColor(Qt::white); + p->wfText = QColor(Qt::white); + + qInfo(logSystem()) << "default color preset [" << pn << "] set to pn.presetNum index [" << p->presetNum << "]"; + } +} + +void wfmain::setEditAndLedFromColor(QColor c, QLineEdit *e, QLedLabel *d) +{ + bool blockSignals = true; + if(e != Q_NULLPTR) + { + e->blockSignals(blockSignals); + e->setText(c.name()); + e->blockSignals(false); + } + if(d != Q_NULLPTR) + { + d->setColor(c); + } +} + +void wfmain::loadColorPresetToUIandPlots(int presetNumber) +{ + if(presetNumber >= numColorPresetsTotal) + { + qDebug(logSystem()) << "WARNING: asked for preset number [" << presetNumber << "], which is out of range."; + return; + } + + colorPrefsType p = colorPreset[presetNumber]; + qInfo(logSystem()) << "color preset number [" << presetNumber << "] requested for UI load, which has internal index of [" << p.presetNum << "]"; + setEditAndLedFromColor(p.gridColor, ui->colorEditGrid, ui->colorSwatchGrid); + + setEditAndLedFromColor(p.spectrumLine, ui->colorEditSpecLine, ui->colorSwatchSpecLine); + setEditAndLedFromColor(p.spectrumFill, ui->colorEditSpecFill, ui->colorSwatchSpecFill); + setEditAndLedFromColor(p.underlayLine, ui->colorEditOverlayLine, ui->colorSwatchOverlayLine); + setEditAndLedFromColor(p.underlayFill, ui->colorEditOverlayFill, ui->colorSwatchOverlayFill); + setEditAndLedFromColor(p.plotBackground, ui->colorEditPlotBackground, ui->colorSwatchPlotBackground); + setEditAndLedFromColor(p.tuningLine, ui->colorEditTuningLine, ui->colorSwatchTuningLine); + + setEditAndLedFromColor(p.meterLevel, ui->colorEditMeterLevel, ui->colorSwatchMeterLevel); + setEditAndLedFromColor(p.meterAverage, ui->colorEditMeterAvg, ui->colorSwatchMeterAverage); + setEditAndLedFromColor(p.meterPeak, ui->colorEditMeterPeak, ui->colorSwatchMeterPeak); + setEditAndLedFromColor(p.meterLowerLine, ui->colorEditMeterScale, ui->colorSwatchMeterScale); + setEditAndLedFromColor(p.meterLowText, ui->colorEditMeterText, ui->colorSwatchMeterText); + + setEditAndLedFromColor(p.wfBackground, ui->colorEditWfBackground, ui->colorSwatchWfBackground); + setEditAndLedFromColor(p.wfGrid, ui->colorEditWfGrid, ui->colorSwatchWfGrid); + setEditAndLedFromColor(p.wfText, ui->colorEditWfText, ui->colorSwatchWfText); + + useColorPreset(&p); +} + + +void wfmain::on_colorPresetCombo_currentIndexChanged(int index) +{ + qInfo(logSystem()) << "color preset combo box set to index: " << index; + loadColorPresetToUIandPlots(index); +} + +// Color buttons and lineEdit action functions: + +// Grid: +void wfmain::on_colorSetBtnGrid_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].gridColor); + setColorButtonOperations(c, ui->colorEditGrid, ui->colorSwatchGrid); +} +void wfmain::on_colorEditGrid_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].gridColor); + setColorLineEditOperations(c, ui->colorEditGrid, ui->colorSwatchGrid); +} + +// Text: +void wfmain::on_colorSetBtnText_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].textColor); + setColorButtonOperations(c, ui->colorEditText, ui->colorSwatchText); +} +void wfmain::on_colorEditText_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].textColor); + setColorLineEditOperations(c, ui->colorEditText, ui->colorSwatchText); +} + +// SpecLine: +void wfmain::on_colorEditSpecLine_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].spectrumLine); + setColorLineEditOperations(c, ui->colorEditSpecLine, ui->colorSwatchSpecLine); +} +void wfmain::on_colorSetBtnSpecLine_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].spectrumLine); + setColorButtonOperations(c, ui->colorEditSpecLine, ui->colorSwatchSpecLine); +} + +// SpecFill: +void wfmain::on_colorSetBtnSpecFill_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].spectrumFill); + setColorButtonOperations(c, ui->colorEditSpecFill, ui->colorSwatchSpecFill); +} +void wfmain::on_colorEditSpecFill_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].spectrumFill); + setColorLineEditOperations(c, ui->colorEditSpecFill, ui->colorSwatchSpecFill); +} + +// PlotBackground: +void wfmain::on_colorEditPlotBackground_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].plotBackground); + setColorLineEditOperations(c, ui->colorEditPlotBackground, ui->colorSwatchPlotBackground); +} +void wfmain::on_colorSetBtnPlotBackground_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].plotBackground); + setColorButtonOperations(c, ui->colorEditPlotBackground, ui->colorSwatchPlotBackground); +} + + + diff --git a/wfmain.h b/wfmain.h index 006d79f..ea109be 100644 --- a/wfmain.h +++ b/wfmain.h @@ -52,6 +52,7 @@ #include "rtaudio/RtAudio.h" #endif +#define numColorPresetsTotal (5) namespace Ui { class wfmain; @@ -572,6 +573,16 @@ private slots: void on_colorPopOutBtn_clicked(); + void on_colorPresetCombo_currentIndexChanged(int index); + + void on_colorEditSpecLine_editingFinished(); + + void on_colorEditGrid_editingFinished(); + + void on_colorEditText_editingFinished(); + + void on_colorEditSpecFill_editingFinished(); + private: Ui::wfmain *ui; void closeEvent(QCloseEvent *event); @@ -802,7 +813,7 @@ private: } colorScheme; - colorPrefsType colorPreset[5]; + colorPrefsType colorPreset[numColorPresetsTotal]; struct preferences { bool useFullScreen; @@ -852,16 +863,22 @@ private: void setDefaultColors(); // populate with default values void useColors(); // set the plot up - void useColorPreset(colorPrefsType *cp); void setDefPrefs(); // populate default values to default prefs void setTuningSteps(); void setColorElement(QColor color, QLedLabel *led, QLabel *label); void setColorElement(QColor color, QLedLabel *led, QLineEdit *lineText); void setColorElement(QColor color, QLedLabel *led, QLabel *label, QLineEdit *lineText); - QColor getColor(QColor initialColor); + QColor getColorFromPicker(QColor initialColor); void getSetColor(QLedLabel *led, QLabel *label); void getSetColor(QLedLabel *led, QLineEdit *line); QString setColorFromString(QString aarrggbb, QLedLabel *led); + void setDefaultColorPresets(); + void loadColorPresetToUIandPlots(int presetNumber); + void useColorPreset(colorPrefsType *cp); + void useCurrentColorPreset(); + void setEditAndLedFromColor(QColor c, QLineEdit *e, QLedLabel *d); + void setColorButtonOperations(QColor *colorStore, QLineEdit *e, QLedLabel *d); + void setColorLineEditOperations(QColor *colorStore, QLineEdit *e, QLedLabel *d); quint64 roundFrequency(quint64 frequency, unsigned int tsHz); quint64 roundFrequencyWithStep(quint64 oldFreq, int steps,\ diff --git a/wfmain.ui b/wfmain.ui index f90f61e..4b441f7 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -3104,102 +3104,37 @@ 0 0 767 - 372 + 522 - - - - - - - - - - - 90 - 16777215 - - + + - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - - - - - - Overlay Line - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Rename Preset - - - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Meter Average + Meter Scale - + - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + @@ -3212,6 +3147,22 @@ + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + @@ -3219,16 +3170,145 @@ - - + + + + + + + + - Preset: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + Waterfall Back + + + + Meter Text + + + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Save Preset + + + + + + + Rename Preset + + + + + + + Text + + + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Pop-Out + + + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Make Current + + + + + + + Meter Peak + + + + + + + + + + Meter Level + + + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + @@ -3264,25 +3344,6 @@ - - - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - @@ -3293,8 +3354,8 @@ - 65535 - 65535 + 16777215 + 16777215 @@ -3306,8 +3367,8 @@ - - + + 90 @@ -3319,8 +3380,8 @@ - - + + 90 @@ -3332,42 +3393,58 @@ - - + + + + + - Plot Background + Meter Average - - - - Qt::Horizontal + + + + Underlay Fill - + + + + + - 40 - 20 + 90 + 16777215 - - - - - Text + #AARRGGBB - - + + + + + + + + 90 + 16777215 + + - Meter Level + #AARRGGBB - - + + + + Underlay Line + + @@ -3376,25 +3453,8 @@ - - - - Make Current - - - - - - - Save Preset - - - - - - - - + + 90 @@ -3419,36 +3479,25 @@ - - + + - Meter Peak + Preset: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + - Pop-Out - - - - - - - Overlay Fill - - - - - - - Tuning Line + Plot Background - + 90 @@ -3460,8 +3509,74 @@ - - + + + + Tuning Line + + + + + + + Waterfall Grid + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + + + Waterfall Text + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + From ecb9b8fbb4c166900a634c1f8616019c134e10b3 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sun, 21 Aug 2022 17:52:52 -0700 Subject: [PATCH 015/207] Now all colors can be edited. --- colorprefs.h | 2 + wfmain.cpp | 217 +++++++++++++++- wfmain.h | 52 ++++ wfmain.ui | 710 +++++++++++++++++++++++++++------------------------ 4 files changed, 639 insertions(+), 342 deletions(-) diff --git a/colorprefs.h b/colorprefs.h index aa2a4bf..fd9c005 100644 --- a/colorprefs.h +++ b/colorprefs.h @@ -9,6 +9,7 @@ struct colorPrefsType{ QString presetName = QString("uninitialized"); QColor gridColor; + QColor axisColor; QColor textColor; QColor spectrumLine; QColor spectrumFill; @@ -26,6 +27,7 @@ struct colorPrefsType{ QColor wfBackground; QColor wfGrid; + QColor wfAxis; QColor wfText; }; diff --git a/wfmain.cpp b/wfmain.cpp index a70fa1e..ad34847 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6320,15 +6320,15 @@ void wfmain::useColorPreset(colorPrefsType *cp) plot->legend->setBorderPen(cp->gridColor); plot->legend->setBrush(cp->gridColor); - plot->xAxis->setTickLabelColor(cp->gridColor); - plot->xAxis->setLabelColor(cp->textColor); - plot->yAxis->setTickLabelColor(cp->gridColor); - plot->yAxis->setLabelColor(cp->textColor); + plot->xAxis->setTickLabelColor(cp->textColor); + plot->xAxis->setLabelColor(cp->gridColor); + plot->yAxis->setTickLabelColor(cp->textColor); + plot->yAxis->setLabelColor(cp->gridColor); - plot->xAxis->setBasePen(cp->textColor); - plot->xAxis->setTickPen(cp->textColor); - plot->yAxis->setBasePen(cp->textColor); - plot->yAxis->setTickPen(cp->textColor); + plot->xAxis->setBasePen(cp->axisColor); + plot->xAxis->setTickPen(cp->axisColor); + plot->yAxis->setBasePen(cp->axisColor); + plot->yAxis->setTickPen(cp->axisColor); freqIndicatorLine->setPen(QPen(cp->tuningLine)); @@ -6338,6 +6338,21 @@ void wfmain::useColorPreset(colorPrefsType *cp) plot->graph(1)->setPen(QPen(cp->underlayLine)); plot->graph(1)->setBrush(QBrush(cp->underlayFill)); + wf->yAxis->setBasePen(cp->wfAxis); + wf->yAxis->setTickPen(cp->wfAxis); + wf->xAxis->setBasePen(cp->wfAxis); + wf->xAxis->setTickPen(cp->wfAxis); + + wf->xAxis->setLabelColor(cp->wfGrid); + wf->yAxis->setLabelColor(cp->wfGrid); + + wf->xAxis->setTickLabelColor(cp->wfText); + wf->yAxis->setTickLabelColor(cp->wfText); + + wf->setBackground(cp->wfBackground); + + ui->meterSPoWidget->setColors(cp->meterLevel, cp->meterPeak, cp->meterAverage, cp->meterLowerLine, cp->meterLowText); + ui->meter2Widget->setColors(cp->meterLevel, cp->meterPeak, cp->meterAverage, cp->meterLowerLine, cp->meterLowText); } void wfmain::setColorButtonOperations(QColor *colorStore, @@ -6408,6 +6423,7 @@ void wfmain::setDefaultColorPresets() // that format in the code when convenient. p->gridColor = QColor(0,0,0,255); + p->axisColor = QColor(Qt::white); p->textColor = QColor(Qt::white); p->spectrumLine = QColor(Qt::yellow); p->spectrumFill = QColor("transparent"); @@ -6423,6 +6439,7 @@ void wfmain::setDefaultColorPresets() p->meterLowText = QColor("#eff0f1"); p->wfBackground = QColor(Qt::black); + p->wfAxis = QColor(Qt::white); p->wfGrid = QColor(Qt::white); p->wfText = QColor(Qt::white); @@ -6459,8 +6476,8 @@ void wfmain::loadColorPresetToUIandPlots(int presetNumber) setEditAndLedFromColor(p.spectrumLine, ui->colorEditSpecLine, ui->colorSwatchSpecLine); setEditAndLedFromColor(p.spectrumFill, ui->colorEditSpecFill, ui->colorSwatchSpecFill); - setEditAndLedFromColor(p.underlayLine, ui->colorEditOverlayLine, ui->colorSwatchOverlayLine); - setEditAndLedFromColor(p.underlayFill, ui->colorEditOverlayFill, ui->colorSwatchOverlayFill); + setEditAndLedFromColor(p.underlayLine, ui->colorEditUnderlayLine, ui->colorSwatchUnderlayLine); + setEditAndLedFromColor(p.underlayFill, ui->colorEditUnderlayFill, ui->colorSwatchUnderlayFill); setEditAndLedFromColor(p.plotBackground, ui->colorEditPlotBackground, ui->colorSwatchPlotBackground); setEditAndLedFromColor(p.tuningLine, ui->colorEditTuningLine, ui->colorSwatchTuningLine); @@ -6500,6 +6517,20 @@ void wfmain::on_colorEditGrid_editingFinished() setColorLineEditOperations(c, ui->colorEditGrid, ui->colorSwatchGrid); } +// Axis: +void wfmain::on_colorSetBtnAxis_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].axisColor); + setColorButtonOperations(c, ui->colorEditAxis, ui->colorSwatchAxis); +} +void wfmain::on_colorEditAxis_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].axisColor); + setColorLineEditOperations(c, ui->colorEditAxis, ui->colorSwatchAxis); +} + // Text: void wfmain::on_colorSetBtnText_clicked() { @@ -6556,5 +6587,171 @@ void wfmain::on_colorSetBtnPlotBackground_clicked() setColorButtonOperations(c, ui->colorEditPlotBackground, ui->colorSwatchPlotBackground); } +// Underlay Line: +void wfmain::on_colorSetBtnUnderlayLine_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].underlayLine); + setColorButtonOperations(c, ui->colorEditUnderlayLine, ui->colorSwatchUnderlayLine); +} +void wfmain::on_colorEditUnderlayLine_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].underlayLine); + setColorLineEditOperations(c, ui->colorEditUnderlayLine, ui->colorSwatchUnderlayLine); +} +// Underlay Fill: +void wfmain::on_colorSetBtnUnderlayFill_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].underlayFill); + setColorButtonOperations(c, ui->colorEditUnderlayFill, ui->colorSwatchUnderlayFill); +} +void wfmain::on_colorEditUnderlayFill_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].underlayFill); + setColorLineEditOperations(c, ui->colorEditUnderlayFill, ui->colorSwatchUnderlayFill); +} + +// WF Background: +void wfmain::on_colorSetBtnwfBackground_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].wfBackground); + setColorButtonOperations(c, ui->colorEditWfBackground, ui->colorSwatchWfBackground); +} +void wfmain::on_colorEditWfBackground_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].wfBackground); + setColorLineEditOperations(c, ui->colorEditWfBackground, ui->colorSwatchWfBackground); +} + +// WF Grid: +void wfmain::on_colorSetBtnWfGrid_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].wfGrid); + setColorButtonOperations(c, ui->colorEditWfGrid, ui->colorSwatchWfGrid); +} +void wfmain::on_colorEditWfGrid_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].wfGrid); + setColorLineEditOperations(c, ui->colorEditWfGrid, ui->colorSwatchWfGrid); +} + +// WF Axis: +void wfmain::on_colorSetBtnWfAxis_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].wfAxis); + setColorButtonOperations(c, ui->colorEditWfAxis, ui->colorSwatchWfAxis); +} +void wfmain::on_colorEditWfAxis_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].wfAxis); + setColorLineEditOperations(c, ui->colorEditWfAxis, ui->colorSwatchWfAxis); +} + +// WF Text: +void wfmain::on_colorSetBtnWfText_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].wfText); + setColorButtonOperations(c, ui->colorEditWfText, ui->colorSwatchWfText); +} +void wfmain::on_colorEditWfText_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].wfText); + setColorLineEditOperations(c, ui->colorEditWfText, ui->colorSwatchWfText); +} + +// Tuning Line: +void wfmain::on_colorSetBtnTuningLine_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].tuningLine); + setColorButtonOperations(c, ui->colorEditTuningLine, ui->colorSwatchTuningLine); +} +void wfmain::on_colorEditTuningLine_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].tuningLine); + setColorLineEditOperations(c, ui->colorEditTuningLine, ui->colorSwatchTuningLine); +} + +// Meter Level: +void wfmain::on_colorSetBtnMeterLevel_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].meterLevel); + setColorButtonOperations(c, ui->colorEditMeterLevel, ui->colorSwatchMeterLevel); +} +void wfmain::on_colorEditMeterLevel_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].meterLevel); + setColorLineEditOperations(c, ui->colorEditMeterLevel, ui->colorSwatchMeterLevel); +} + +// Meter Average: +void wfmain::on_colorSetBtnMeterAvg_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].meterAverage); + setColorButtonOperations(c, ui->colorEditMeterAvg, ui->colorSwatchMeterAverage); +} +void wfmain::on_colorEditMeterAvg_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].meterAverage); + setColorLineEditOperations(c, ui->colorEditMeterAvg, ui->colorSwatchMeterAverage); +} + +// Meter Peak: +void wfmain::on_colorSetBtnMeterPeak_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].meterPeak); + setColorButtonOperations(c, ui->colorEditMeterPeak, ui->colorSwatchMeterPeak); +} +void wfmain::on_colorEditMeterPeak_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].meterPeak); + setColorLineEditOperations(c, ui->colorEditMeterPeak, ui->colorSwatchMeterPeak); +} + +// Meter Scale (line): +void wfmain::on_colorSetBtnMeterScale_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].meterLowerLine); + setColorButtonOperations(c, ui->colorEditMeterScale, ui->colorSwatchMeterScale); +} +void wfmain::on_colorEditMeterScale_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].meterLowerLine); + setColorLineEditOperations(c, ui->colorEditMeterScale, ui->colorSwatchMeterScale); +} + +// Meter Text: +void wfmain::on_colorSetBtnMeterText_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].meterLowText); + setColorButtonOperations(c, ui->colorEditMeterText, ui->colorSwatchMeterText); +} +void wfmain::on_colorEditMeterText_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].meterLowText); + setColorLineEditOperations(c, ui->colorEditMeterText, ui->colorSwatchMeterText); +} diff --git a/wfmain.h b/wfmain.h index ea109be..35a147d 100644 --- a/wfmain.h +++ b/wfmain.h @@ -583,6 +583,58 @@ private slots: void on_colorEditSpecFill_editingFinished(); + void on_colorSetBtnAxis_clicked(); + + void on_colorEditAxis_editingFinished(); + + void on_colorSetBtnUnderlayLine_clicked(); + + void on_colorEditUnderlayLine_editingFinished(); + + void on_colorSetBtnUnderlayFill_clicked(); + + void on_colorEditUnderlayFill_editingFinished(); + + void on_colorSetBtnwfBackground_clicked(); + + void on_colorEditWfBackground_editingFinished(); + + void on_colorSetBtnWfGrid_clicked(); + + void on_colorEditWfGrid_editingFinished(); + + void on_colorSetBtnWfAxis_clicked(); + + void on_colorEditWfAxis_editingFinished(); + + void on_colorSetBtnWfText_clicked(); + + void on_colorEditWfText_editingFinished(); + + void on_colorSetBtnTuningLine_clicked(); + + void on_colorEditTuningLine_editingFinished(); + + void on_colorSetBtnMeterLevel_clicked(); + + void on_colorEditMeterLevel_editingFinished(); + + void on_colorSetBtnMeterAvg_clicked(); + + void on_colorEditMeterAvg_editingFinished(); + + void on_colorSetBtnMeterPeak_clicked(); + + void on_colorEditMeterPeak_editingFinished(); + + void on_colorSetBtnMeterScale_clicked(); + + void on_colorEditMeterScale_editingFinished(); + + void on_colorSetBtnMeterText_clicked(); + + void on_colorEditMeterText_editingFinished(); + private: Ui::wfmain *ui; void closeEvent(QCloseEvent *event); diff --git a/wfmain.ui b/wfmain.ui index 4b441f7..86e1e77 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -3102,21 +3102,197 @@ 0 - 0 + -100 767 - 522 + 582 - - + + - Meter Scale + Make Current - - + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Plot Background + + + + + + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Axis + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Text + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + @@ -3131,11 +3307,8 @@ - - - - - + + 90 @@ -3147,168 +3320,23 @@ - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Spectrum Fill - - - - + - - - - - + + - Waterfall Back + Underlay Line - - + + - Meter Text + Waterfall Grid - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Save Preset - - - - - - - Rename Preset - - - - - - - Text - - - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Pop-Out - - - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Make Current - - - - - - - Meter Peak - - - - - - - - - - Meter Level - - - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - @@ -3344,6 +3372,69 @@ + + + + Tuning Line + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + + + Underlay Fill + + + + + + + Pop-Out + + + + + + + Save Preset + + + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + @@ -3360,91 +3451,11 @@ - - - - Spectrum Line - - + + - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - - - Meter Average - - - - - - - Underlay Fill - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Underlay Line - - + + @@ -3453,76 +3464,6 @@ - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Preset: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Plot Background - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Tuning Line - - - - - - - Waterfall Grid - - - @@ -3536,11 +3477,8 @@ - - - - - + + 90 @@ -3552,17 +3490,14 @@ - - - - - + + - Waterfall Text + Meter Peak - + @@ -3575,8 +3510,119 @@ - - + + + + + + + Meter Scale + + + + + + + Spectrum Fill + + + + + + + + + + Rename Preset + + + + + + + Waterfall Back + + + + + + + + + + + + + Preset: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Spectrum Line + + + + + + + Meter Average + + + + + + + + + + Meter Level + + + + + + + Meter Text + + + + + + + + + + Waterfall Text + + + + + + + Waterfall Axis + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + From 93b1af6eb60637c69d93b03aa31c28411a847152 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sun, 21 Aug 2022 18:05:20 -0700 Subject: [PATCH 016/207] Removed unused function --- wfmain.cpp | 7 +------ wfmain.h | 2 -- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index ad34847..d5ffdc1 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6223,6 +6223,7 @@ void wfmain::on_debugBtn_clicked() } +// Color Helper Functions: void wfmain::setColorElement(QColor color, QLedLabel *led, QLabel *label, @@ -6291,11 +6292,6 @@ QString wfmain::setColorFromString(QString colorstr, QLedLabel *led) return led->getColor().name(QColor::HexArgb); } -void wfmain::on_colorLinePlotBackground_editingFinished() -{ - -} - void wfmain::useCurrentColorPreset() { int pos = ui->colorPresetCombo->currentIndex(); @@ -6404,7 +6400,6 @@ void wfmain::on_colorPopOutBtn_clicked() //connect(settingsPop, SIGNAL(destroyed(QObject*)), this, foo()); } -// Color Helper Functions: void wfmain::setDefaultColorPresets() { // Default wfview colors in each preset diff --git a/wfmain.h b/wfmain.h index 35a147d..a67296d 100644 --- a/wfmain.h +++ b/wfmain.h @@ -561,8 +561,6 @@ private slots: void on_colorSetBtnPlotBackground_clicked(); - void on_colorLinePlotBackground_editingFinished(); - void on_colorSetBtnText_clicked(); void on_colorSetBtnSpecLine_clicked(); From a84fb6d09131abaf8ea3d93b53d3393d1f995efd Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sun, 21 Aug 2022 21:19:08 -0700 Subject: [PATCH 017/207] Cleaner tab add/remove code for the settings tab. --- wfmain.cpp | 49 +++++++++++++++++++++++++++++++++++++------------ wfmain.h | 10 +++++++++- 2 files changed, 46 insertions(+), 13 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index d5ffdc1..730dab4 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -53,6 +53,7 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s setupKeyShortcuts(); setupMainUI(); + prepareSettingsWindow(); setSerialDevicesUI(); @@ -880,8 +881,18 @@ void wfmain::setupMainUI() [=](const unsigned char &newValue) { issueCmdUniquePriority(cmdSetTPBFOuter, newValue);} ); +} +void wfmain::prepareSettingsWindow() +{ + settingsTabisAttached = true; + // settingsTab; + settingsWidgetWindow = new QWidget; + settingsWidgetLayout = new QGridLayout; + settingsWidgetTab = new QTabWidget; + settingsWidgetWindow->setLayout(settingsWidgetLayout); + settingsWidgetLayout->addWidget(settingsWidgetTab); } void wfmain::updateSizes(int tabIndex) @@ -6223,7 +6234,8 @@ void wfmain::on_debugBtn_clicked() } -// Color Helper Functions: +// ---------- color helper functions: ---------- // + void wfmain::setColorElement(QColor color, QLedLabel *led, QLabel *label, @@ -6388,16 +6400,25 @@ void wfmain::setColorLineEditOperations(QColor *colorStore, void wfmain::on_colorPopOutBtn_clicked() { - QWidget *settingsPop = new QWidget; - QWidget *settingsTab = ui->tabWidget->currentWidget(); - ui->tabWidget->removeTab(ui->tabWidget->indexOf(settingsTab)); - QGridLayout *g = new QGridLayout; - QTabWidget *t = new QTabWidget; - settingsPop->setLayout(g); - g->addWidget(t); - t->addTab(settingsTab, "Settings"); - settingsPop->show(); - //connect(settingsPop, SIGNAL(destroyed(QObject*)), this, foo()); + + if(settingsTabisAttached) + { + settingsTab = ui->tabWidget->currentWidget(); + ui->tabWidget->removeTab(ui->tabWidget->indexOf(settingsTab)); + settingsWidgetTab->addTab(settingsTab, "Settings"); + settingsWidgetWindow->show(); + ui->colorPopOutBtn->setText("Re-attach"); + settingsTabisAttached = false; + } else { + settingsTab = settingsWidgetTab->currentWidget(); + + settingsWidgetTab->removeTab(settingsWidgetTab->indexOf(settingsTab)); + ui->tabWidget->addTab(settingsTab, "Settings"); + settingsWidgetWindow->close(); + + ui->colorPopOutBtn->setText("Pop-Out"); + settingsTabisAttached = true; + } } void wfmain::setDefaultColorPresets() @@ -6496,7 +6517,9 @@ void wfmain::on_colorPresetCombo_currentIndexChanged(int index) loadColorPresetToUIandPlots(index); } -// Color buttons and lineEdit action functions: +// ---------- end color helper functions ---------- // + +// ---------- Color UI slots ----------// // Grid: void wfmain::on_colorSetBtnGrid_clicked() @@ -6750,3 +6773,5 @@ void wfmain::on_colorEditMeterText_editingFinished() QColor *c = &(colorPreset[pos].meterLowText); setColorLineEditOperations(c, ui->colorEditMeterText, ui->colorSwatchMeterText); } + +// ---------- End color UI slots ----------// diff --git a/wfmain.h b/wfmain.h index a67296d..fd8b9ed 100644 --- a/wfmain.h +++ b/wfmain.h @@ -428,7 +428,6 @@ private slots: void on_dataModeBtn_toggled(bool checked); - void on_transmitBtn_clicked(); void on_adjRefBtn_clicked(); @@ -930,6 +929,15 @@ private: void setColorButtonOperations(QColor *colorStore, QLineEdit *e, QLedLabel *d); void setColorLineEditOperations(QColor *colorStore, QLineEdit *e, QLedLabel *d); + void detachSettingsTab(); + void reattachSettingsTab(); + void prepareSettingsWindow(); + QWidget *settingsWidgetWindow; + QWidget *settingsTab; + QGridLayout *settingsWidgetLayout; + QTabWidget *settingsWidgetTab; + bool settingsTabisAttached = true; + quint64 roundFrequency(quint64 frequency, unsigned int tsHz); quint64 roundFrequencyWithStep(quint64 oldFreq, int steps,\ unsigned int tsHz); From 16237a47f54afcb089a6fdc321e08ed6820ecade Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sun, 21 Aug 2022 21:32:49 -0700 Subject: [PATCH 018/207] Slightly better closing for settings --- wfmain.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wfmain.cpp b/wfmain.cpp index 730dab4..4c9f24c 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -886,13 +886,17 @@ void wfmain::setupMainUI() void wfmain::prepareSettingsWindow() { settingsTabisAttached = true; - // settingsTab; + settingsWidgetWindow = new QWidget; settingsWidgetLayout = new QGridLayout; settingsWidgetTab = new QTabWidget; settingsWidgetWindow->setLayout(settingsWidgetLayout); settingsWidgetLayout->addWidget(settingsWidgetTab); + settingsWidgetWindow->setWindowFlag(Qt::WindowCloseButtonHint, false); + //settingsWidgetWindow->setWindowFlag(Qt::WindowMinimizeButtonHint, false); + //settingsWidgetWindow->setWindowFlag(Qt::WindowMaximizeButtonHint, false); + // TODO: Capture an event when the window closes and handle accordingly. } void wfmain::updateSizes(int tabIndex) @@ -6408,6 +6412,7 @@ void wfmain::on_colorPopOutBtn_clicked() settingsWidgetTab->addTab(settingsTab, "Settings"); settingsWidgetWindow->show(); ui->colorPopOutBtn->setText("Re-attach"); + ui->tabWidget->setCurrentIndex(0); settingsTabisAttached = false; } else { settingsTab = settingsWidgetTab->currentWidget(); @@ -6417,6 +6422,7 @@ void wfmain::on_colorPopOutBtn_clicked() settingsWidgetWindow->close(); ui->colorPopOutBtn->setText("Pop-Out"); + ui->tabWidget->setCurrentIndex(3); settingsTabisAttached = true; } } From 1388c756c43d954f047afd14ea9068cea9808c7f Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sun, 21 Aug 2022 21:51:50 -0700 Subject: [PATCH 019/207] Fixed alpha channel issue --- wfmain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 4c9f24c..62c068f 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6380,7 +6380,7 @@ void wfmain::setColorButtonOperations(QColor *colorStore, } getSetColor(d, e); QColor t = d->getColor(); - colorStore->setNamedColor(t.name()); + colorStore->setNamedColor(t.name(QColor::HexArgb)); //colorStore->setBlue(100); useCurrentColorPreset(); } @@ -6475,7 +6475,7 @@ void wfmain::setEditAndLedFromColor(QColor c, QLineEdit *e, QLedLabel *d) if(e != Q_NULLPTR) { e->blockSignals(blockSignals); - e->setText(c.name()); + e->setText(c.name(QColor::HexArgb)); e->blockSignals(false); } if(d != Q_NULLPTR) From d11ae30b1ac11c664a4655025ba2e518395a3b92 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sun, 21 Aug 2022 23:50:02 -0700 Subject: [PATCH 020/207] Fixed bug relate to pressing cancel in the color picker. --- meter.cpp | 2 +- wfmain.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/meter.cpp b/meter.cpp index 611c2e7..478f90a 100644 --- a/meter.cpp +++ b/meter.cpp @@ -236,7 +236,7 @@ void meter::paintEvent(QPaintEvent *) void meter::drawLabel(QPainter *qp) { - qp->setPen(lowLineColor); + qp->setPen(lowTextColor); qp->drawText(0,scaleTextYstart, label ); } diff --git a/wfmain.cpp b/wfmain.cpp index 62c068f..ee1d68d 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6275,7 +6275,10 @@ QColor wfmain::getColorFromPicker(QColor initialColor) options.setFlag(QColorDialog::ShowAlphaChannel, true); options.setFlag(QColorDialog::DontUseNativeDialog, true); QColor selColor = QColorDialog::getColor(initialColor, this, "Select Color", options); - return selColor; + if(selColor.isValid()) + return selColor; + else + return initialColor; } void wfmain::getSetColor(QLedLabel *led, QLabel *label) From 952585261c123134a290295b3456ff45d37d6e35 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sun, 21 Aug 2022 23:54:37 -0700 Subject: [PATCH 021/207] Forgot text color from default load-in --- wfmain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wfmain.cpp b/wfmain.cpp index ee1d68d..b227b1f 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6498,7 +6498,7 @@ void wfmain::loadColorPresetToUIandPlots(int presetNumber) colorPrefsType p = colorPreset[presetNumber]; qInfo(logSystem()) << "color preset number [" << presetNumber << "] requested for UI load, which has internal index of [" << p.presetNum << "]"; setEditAndLedFromColor(p.gridColor, ui->colorEditGrid, ui->colorSwatchGrid); - + setEditAndLedFromColor(p.textColor, ui->colorEditText, ui->colorSwatchText); setEditAndLedFromColor(p.spectrumLine, ui->colorEditSpecLine, ui->colorSwatchSpecLine); setEditAndLedFromColor(p.spectrumFill, ui->colorEditSpecFill, ui->colorSwatchSpecFill); setEditAndLedFromColor(p.underlayLine, ui->colorEditUnderlayLine, ui->colorSwatchUnderlayLine); From 92904f8ae585b4447065e5acbe98b83e937d894e Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sun, 21 Aug 2022 23:59:48 -0700 Subject: [PATCH 022/207] Forgot the axis color from default. --- wfmain.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wfmain.cpp b/wfmain.cpp index b227b1f..c541204 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6498,6 +6498,7 @@ void wfmain::loadColorPresetToUIandPlots(int presetNumber) colorPrefsType p = colorPreset[presetNumber]; qInfo(logSystem()) << "color preset number [" << presetNumber << "] requested for UI load, which has internal index of [" << p.presetNum << "]"; setEditAndLedFromColor(p.gridColor, ui->colorEditGrid, ui->colorSwatchGrid); + setEditAndLedFromColor(p.axisColor, ui->colorEditAxis, ui->colorSwatchAxis); setEditAndLedFromColor(p.textColor, ui->colorEditText, ui->colorSwatchText); setEditAndLedFromColor(p.spectrumLine, ui->colorEditSpecLine, ui->colorSwatchSpecLine); setEditAndLedFromColor(p.spectrumFill, ui->colorEditSpecFill, ui->colorSwatchSpecFill); @@ -6514,6 +6515,7 @@ void wfmain::loadColorPresetToUIandPlots(int presetNumber) setEditAndLedFromColor(p.wfBackground, ui->colorEditWfBackground, ui->colorSwatchWfBackground); setEditAndLedFromColor(p.wfGrid, ui->colorEditWfGrid, ui->colorSwatchWfGrid); + setEditAndLedFromColor(p.wfAxis, ui->colorEditWfAxis, ui->colorSwatchWfAxis); setEditAndLedFromColor(p.wfText, ui->colorEditWfText, ui->colorSwatchWfText); useColorPreset(&p); From 7e4d3f76d5ef3bbfac1c23c0d4a93244d82ba4ab Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Mon, 22 Aug 2022 09:04:19 -0700 Subject: [PATCH 023/207] Fixed stretched grid color swatch. This has to be a qt uic bug. --- wfmain.ui | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/wfmain.ui b/wfmain.ui index 86e1e77..d643fd5 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -3436,20 +3436,7 @@ - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - + From 59d2d735e6e55174090ef90c9fa5febc7a5c61e0 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Mon, 22 Aug 2022 09:44:00 -0700 Subject: [PATCH 024/207] Added preset names --- colorprefs.h | 16 +- wfmain.cpp | 39 +++- wfmain.h | 2 + wfmain.ui | 612 +++++++++++++++++++++++++-------------------------- 4 files changed, 353 insertions(+), 316 deletions(-) diff --git a/colorprefs.h b/colorprefs.h index fd9c005..5678f64 100644 --- a/colorprefs.h +++ b/colorprefs.h @@ -6,8 +6,9 @@ struct colorPrefsType{ int presetNum = -1; - QString presetName = QString("uninitialized"); + QString *presetName = Q_NULLPTR; + // Spectrum line plot: QColor gridColor; QColor axisColor; QColor textColor; @@ -18,17 +19,18 @@ struct colorPrefsType{ QColor plotBackground; QColor tuningLine; + // Waterfall: + QColor wfBackground; + QColor wfGrid; + QColor wfAxis; + QColor wfText; + + // Meters: QColor meterLevel; QColor meterAverage; QColor meterPeak; QColor meterLowerLine; QColor meterLowText; - - - QColor wfBackground; - QColor wfGrid; - QColor wfAxis; - QColor wfText; }; diff --git a/wfmain.cpp b/wfmain.cpp index c541204..b28c917 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6324,7 +6324,7 @@ void wfmain::useColorPreset(colorPrefsType *cp) if(cp == Q_NULLPTR) return; - qInfo(logSystem()) << "Setting plots to color preset " << cp->presetNum; + qInfo(logSystem()) << "Setting plots to color preset number " << cp->presetNum << ", with name " << *(cp->presetName); plot->setBackground(cp->plotBackground); @@ -6440,7 +6440,10 @@ void wfmain::setDefaultColorPresets() colorPrefsType *p = &colorPreset[pn]; p->presetNum = pn; - //p->presetName = new QString("%1").arg(pn); + if(p->presetName == Q_NULLPTR) + { + p->presetName = new QString( QString("Preset %1").arg(pn) ); + } // Colors are "#AARRGGBB" (AA=0xff is opaque) // or as (r, g, b, a) @@ -6468,7 +6471,8 @@ void wfmain::setDefaultColorPresets() p->wfGrid = QColor(Qt::white); p->wfText = QColor(Qt::white); - qInfo(logSystem()) << "default color preset [" << pn << "] set to pn.presetNum index [" << p->presetNum << "]"; + qInfo(logSystem()) << "default color preset [" << pn << "] set to pn.presetNum index [" << p->presetNum << "]" << ", with name " << *(p->presetName); + ui->colorPresetCombo->setItemText(pn, *(p->presetName)); } } @@ -6786,3 +6790,32 @@ void wfmain::on_colorEditMeterText_editingFinished() } // ---------- End color UI slots ----------// + +void wfmain::on_colorRenamePresetBtn_clicked() +{ + int p = ui->colorPresetCombo->currentIndex(); + QString newName; + QMessageBox msgBox; + + bool ok = false; + newName = QInputDialog::getText(this, tr("QInputDialog::getText()"), + tr("Preset Name (32 characters max):"), QLineEdit::Normal, + ui->colorPresetCombo->currentText(), &ok); + if(!ok) + return; + + if(ok && (newName.length() < 33) && !newName.isEmpty()) + { + colorPreset[p].presetName->clear(); + colorPreset[p].presetName->append(newName); + ui->colorPresetCombo->setItemText(p, *(colorPreset[p].presetName)); + qInfo(logSystem()) << "Setting color preset number " << p << " to have text " << newName << ", as read in preset data: " << *(colorPreset[p].presetName) << ", and as read from combo box: " << ui->colorPresetCombo->currentText(); + } else { + if(newName.isEmpty() || (newName.length() > 32)) + { + msgBox.setText("Error, name must be at least one character and not exceed 32 characters."); + msgBox.exec(); + } + } + +} diff --git a/wfmain.h b/wfmain.h index fd8b9ed..25e93f3 100644 --- a/wfmain.h +++ b/wfmain.h @@ -632,6 +632,8 @@ private slots: void on_colorEditMeterText_editingFinished(); + void on_colorRenamePresetBtn_clicked(); + private: Ui::wfmain *ui; void closeEvent(QCloseEvent *event); diff --git a/wfmain.ui b/wfmain.ui index d643fd5..c060ab7 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -3102,24 +3102,14 @@ 0 - -100 + 0 767 582 - - - - Make Current - - - - - - - - + + 90 @@ -3131,42 +3121,27 @@ - - - - - 90 - 16777215 - - + + + + + - #AARRGGBB + Waterfall Back - - - - - 90 - 16777215 - - + + - #AARRGGBB + Meter Scale - - - - - 90 - 16777215 - - + + - #AARRGGBB + Meter Peak @@ -3183,61 +3158,6 @@ - - - - Plot Background - - - - - - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - @@ -3251,25 +3171,11 @@ - - - - Axis - - + + - - - - - 90 - 16777215 - - - - #AARRGGBB - - + + @@ -3278,8 +3184,58 @@ - - + + + + + + + Grid + + + + + + + + + + + + + Meter Text + + + + + + + Spectrum Fill + + + + + + + + + + Meter Level + + + + + + + + + + Rename Preset + + + + + 90 @@ -3291,21 +3247,83 @@ - - - - - - - Qt::Horizontal + + + + Waterfall Text - + + + + + + Waterfall Grid + + + + + + + + + + + + - 40 - 20 + 90 + 16777215 - + + #AARRGGBB + + + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + @@ -3320,20 +3338,10 @@ - - - - - + + - Underlay Line - - - - - - - Waterfall Grid + Axis @@ -3372,6 +3380,16 @@ + + + + Spectrum Line + + + + + + @@ -3379,48 +3397,11 @@ - - - - - 90 - 16777215 - - - - #AARRGGBB - - + + - - - - - - - Underlay Fill - - - - - - - Pop-Out - - - - - - - Save Preset - - - - - - - - + + 90 @@ -3435,22 +3416,75 @@ - - - - - - - - - - - + + - Grid + Pop-Out + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Waterfall Axis + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Underlay Fill + + + + + + @@ -3464,8 +3498,15 @@ - - + + + + Plot Background + + + + + 90 @@ -3477,13 +3518,79 @@ - - + + - Meter Peak + Meter Average + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Save Preset + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Preset: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Underlay Line + + + + + + @@ -3497,120 +3604,13 @@ - - - - - - - Meter Scale - - - - - - - Spectrum Fill - - - - - - - + - Rename Preset + Revert - - - - Waterfall Back - - - - - - - - - - - - - Preset: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Spectrum Line - - - - - - - Meter Average - - - - - - - - - - Meter Level - - - - - - - Meter Text - - - - - - - - - - Waterfall Text - - - - - - - Waterfall Axis - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - From 6f7f1f84ec80579407cc4f2a8a53ff75f302f165 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Mon, 22 Aug 2022 16:49:35 -0700 Subject: [PATCH 025/207] Added presets and preset naming to the settings file. --- wfmain.cpp | 150 ++++++++++++++++++++++++++++++++++++++++++----------- wfmain.h | 1 + wfmain.ui | 2 +- 3 files changed, 122 insertions(+), 31 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index b28c917..0f4dc8c 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -63,6 +63,8 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s getSettingsFilePath(settingsFile); setupPlots(); + setDefaultColorPresets(); + loadSettings(); // Look for saved preferences setAudioDevicesUI(); @@ -72,7 +74,6 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s qDebug(logSystem()) << "Running setUIToPrefs()"; setUIToPrefs(); - setDefaultColorPresets(); loadColorPresetToUIandPlots(0); qDebug(logSystem()) << "Running setInititalTiming()"; @@ -1101,6 +1102,14 @@ void wfmain::setUIToPrefs() plot->yAxis->setRange(QCPRange(prefs.plotFloor, prefs.plotCeiling)); colorMap->setDataRange(QCPRange(prefs.plotFloor, prefs.plotCeiling)); + colorPrefsType p; + for(int pn=0; pn < numColorPresetsTotal; pn++) + { + p = colorPreset[pn]; + if(p.presetName != Q_NULLPTR) + ui->colorPresetCombo->setItemText(pn, *p.presetName); + } + ui->wfthemeCombo->setCurrentIndex(ui->wfthemeCombo->findData(prefs.wftheme)); colorMap->setGradient(static_cast(prefs.wftheme)); @@ -1362,6 +1371,55 @@ void wfmain::loadSettings() prefs.meter2Type = static_cast(settings->value("Meter2Type", defPrefs.meter2Type).toInt()); settings->endGroup(); + // Load in the color presets. The default values are already loaded. + + settings->beginGroup("ColorPresets"); + settings->value("currentColorPresetNumber", prefs.currentColorPresetNumber).toInt(); + if(prefs.currentColorPresetNumber > numColorPresetsTotal-1) + prefs.currentColorPresetNumber = 0; + + int numPresetsInFile = settings->beginReadArray("ColorPreset"); + // We will use the number of presets that the working copy of wfview + // supports, as we must never exceed the available number. + if(numPresetsInFile > 0) + { + colorPrefsType *p; + QString tempName; + for(int pn=0; pn < numColorPresetsTotal; pn++) + { + settings->setArrayIndex(pn); + p = &(colorPreset[pn]); + p->presetNum = settings->value("presetNum", p->presetNum).toInt(); + tempName = settings->value("presetName", *p->presetName).toString(); + if((!tempName.isEmpty()) && tempName.length() < 33) + { + p->presetName->clear(); + p->presetName->append(tempName); + } + p->gridColor.setNamedColor(settings->value("gridColor", p->gridColor.name(QColor::HexArgb)).toString()); + p->axisColor.setNamedColor(settings->value("axisColor", p->axisColor.name(QColor::HexArgb)).toString()); + p->textColor.setNamedColor(settings->value("textColor", p->textColor.name(QColor::HexArgb)).toString()); + p->spectrumLine.setNamedColor(settings->value("spectrumLine", p->spectrumLine.name(QColor::HexArgb)).toString()); + p->spectrumFill.setNamedColor(settings->value("spectrumFill", p->spectrumFill.name(QColor::HexArgb)).toString()); + p->underlayLine.setNamedColor(settings->value("underlayLine", p->underlayLine.name(QColor::HexArgb)).toString()); + p->underlayFill.setNamedColor(settings->value("underlayFill", p->underlayFill.name(QColor::HexArgb)).toString()); + p->plotBackground.setNamedColor(settings->value("plotBackground", p->plotBackground.name(QColor::HexArgb)).toString()); + p->tuningLine.setNamedColor(settings->value("tuningLine", p->tuningLine.name(QColor::HexArgb)).toString()); + p->wfBackground.setNamedColor(settings->value("wfBackground", p->wfBackground.name(QColor::HexArgb)).toString()); + p->wfGrid.setNamedColor(settings->value("wfGrid", p->wfGrid.name(QColor::HexArgb)).toString()); + p->wfAxis.setNamedColor(settings->value("wfAxis", p->wfAxis.name(QColor::HexArgb)).toString()); + p->wfText.setNamedColor(settings->value("wfText", p->wfText.name(QColor::HexArgb)).toString()); + p->meterLevel.setNamedColor(settings->value("meterLevel", p->meterLevel.name(QColor::HexArgb)).toString()); + p->meterAverage.setNamedColor(settings->value("meterAverage", p->meterAverage.name(QColor::HexArgb)).toString()); + p->meterPeak.setNamedColor(settings->value("meterPeak", p->meterPeak.name(QColor::HexArgb)).toString()); + p->meterLowerLine.setNamedColor(settings->value("meterLowerLine", p->meterLowerLine.name(QColor::HexArgb)).toString()); + p->meterLowText.setNamedColor(settings->value("meterLowText", p->meterLowText.name(QColor::HexArgb)).toString()); + } + } + settings->endArray(); + settings->endGroup(); + + // Load color schemes: // Per this bug: https://forum.qt.io/topic/24725/solved-qvariant-will-drop-alpha-value-when-save-qcolor/5 // the alpha channel is dropped when converting raw qvariant of QColor. Therefore, we are storing as unsigned int and converting back. @@ -1935,8 +1993,40 @@ void wfmain::saveSettings() settings->endArray(); settings->endGroup(); - // Note: X and Y get the same colors. See setPlotTheme() function + // Color presets: + settings->beginGroup("ColorPresets"); + settings->setValue("currentColorPresetNumber", prefs.currentColorPresetNumber); + settings->beginWriteArray("ColorPreset", numColorPresetsTotal); + colorPrefsType *p; + for(int pn=0; pn < numColorPresetsTotal; pn++) + { + p = &(colorPreset[pn]); + settings->setArrayIndex(pn); + settings->setValue("presetNum", p->presetNum); + settings->setValue("presetName", *(p->presetName)); + settings->setValue("gridColor", p->gridColor.name(QColor::HexArgb)); + settings->setValue("axisColor", p->axisColor.name(QColor::HexArgb)); + settings->setValue("textColor", p->textColor.name(QColor::HexArgb)); + settings->setValue("spectrumLine", p->spectrumLine.name(QColor::HexArgb)); + settings->setValue("spectrumFill", p->spectrumFill.name(QColor::HexArgb)); + settings->setValue("underlayLine", p->underlayLine.name(QColor::HexArgb)); + settings->setValue("underlayFill", p->underlayFill.name(QColor::HexArgb)); + settings->setValue("plotBackground", p->plotBackground.name(QColor::HexArgb)); + settings->setValue("tuningLine", p->tuningLine.name(QColor::HexArgb)); + settings->setValue("wfBackground", p->wfBackground.name(QColor::HexArgb)); + settings->setValue("wfGrid", p->wfGrid.name(QColor::HexArgb)); + settings->setValue("wfAxis", p->wfAxis.name(QColor::HexArgb)); + settings->setValue("wfText", p->wfText.name(QColor::HexArgb)); + settings->setValue("meterLevel", p->meterLevel.name(QColor::HexArgb)); + settings->setValue("meterAverage", p->meterAverage.name(QColor::HexArgb)); + settings->setValue("meterPeak", p->meterPeak.name(QColor::HexArgb)); + settings->setValue("meterLowerLine", p->meterLowerLine.name(QColor::HexArgb)); + settings->setValue("meterLowText", p->meterLowText.name(QColor::HexArgb)); + } + settings->endArray(); + settings->endGroup(); + // Note: X and Y get the same colors. See setPlotTheme() function settings->beginGroup("DarkColors"); settings->setValue("Dark_PlotBackground", prefs.colorScheme.Dark_PlotBackground.rgba()); settings->setValue("Dark_PlotAxisPen", prefs.colorScheme.Dark_PlotAxisPen.rgba()); @@ -6525,10 +6615,38 @@ void wfmain::loadColorPresetToUIandPlots(int presetNumber) useColorPreset(&p); } +void wfmain::on_colorRenamePresetBtn_clicked() +{ + int p = ui->colorPresetCombo->currentIndex(); + QString newName; + QMessageBox msgBox; + + bool ok = false; + newName = QInputDialog::getText(this, tr("QInputDialog::getText()"), + tr("Preset Name (32 characters max):"), QLineEdit::Normal, + ui->colorPresetCombo->currentText(), &ok); + if(!ok) + return; + + if(ok && (newName.length() < 33) && !newName.isEmpty()) + { + colorPreset[p].presetName->clear(); + colorPreset[p].presetName->append(newName); + ui->colorPresetCombo->setItemText(p, *(colorPreset[p].presetName)); + qInfo(logSystem()) << "Setting color preset number " << p << " to have text " << newName << ", as read in preset data: " << *(colorPreset[p].presetName) << ", and as read from combo box: " << ui->colorPresetCombo->currentText(); + } else { + if(newName.isEmpty() || (newName.length() > 32)) + { + msgBox.setText("Error, name must be at least one character and not exceed 32 characters."); + msgBox.exec(); + } + } +} void wfmain::on_colorPresetCombo_currentIndexChanged(int index) { qInfo(logSystem()) << "color preset combo box set to index: " << index; + prefs.currentColorPresetNumber = index; loadColorPresetToUIandPlots(index); } @@ -6791,31 +6909,3 @@ void wfmain::on_colorEditMeterText_editingFinished() // ---------- End color UI slots ----------// -void wfmain::on_colorRenamePresetBtn_clicked() -{ - int p = ui->colorPresetCombo->currentIndex(); - QString newName; - QMessageBox msgBox; - - bool ok = false; - newName = QInputDialog::getText(this, tr("QInputDialog::getText()"), - tr("Preset Name (32 characters max):"), QLineEdit::Normal, - ui->colorPresetCombo->currentText(), &ok); - if(!ok) - return; - - if(ok && (newName.length() < 33) && !newName.isEmpty()) - { - colorPreset[p].presetName->clear(); - colorPreset[p].presetName->append(newName); - ui->colorPresetCombo->setItemText(p, *(colorPreset[p].presetName)); - qInfo(logSystem()) << "Setting color preset number " << p << " to have text " << newName << ", as read in preset data: " << *(colorPreset[p].presetName) << ", and as read from combo box: " << ui->colorPresetCombo->currentText(); - } else { - if(newName.isEmpty() || (newName.length() > 32)) - { - msgBox.setText("Error, name must be at least one character and not exceed 32 characters."); - msgBox.exec(); - } - } - -} diff --git a/wfmain.h b/wfmain.h index 25e93f3..11fd2ec 100644 --- a/wfmain.h +++ b/wfmain.h @@ -887,6 +887,7 @@ private: bool enableRigCtlD; quint16 rigCtlPort; colors colorScheme; + int currentColorPresetNumber = 0; QString virtualSerialPort; unsigned char localAFgain; unsigned int wflength; diff --git a/wfmain.ui b/wfmain.ui index c060ab7..e0e785f 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -3554,7 +3554,7 @@ - Save Preset + Save Presets From da1cd8b14fac9d4caced6750b701b73cfcfb2a3c Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Mon, 22 Aug 2022 17:57:54 -0700 Subject: [PATCH 026/207] Added our "classic" color schemes back in. More tuning needed but a good start. --- wfmain.cpp | 179 +++++++++++++++++++---------------------------------- wfmain.h | 16 ++--- wfmain.ui | 15 ++--- 3 files changed, 75 insertions(+), 135 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 0f4dc8c..1130e34 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -57,13 +57,13 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s setSerialDevicesUI(); - setDefaultColors(); setDefPrefs(); getSettingsFilePath(settingsFile); setupPlots(); setDefaultColorPresets(); + setDefaultColors(); loadSettings(); // Look for saved preferences @@ -1059,9 +1059,6 @@ void wfmain::setUIToPrefs() ui->fullScreenChk->setChecked(prefs.useFullScreen); on_fullScreenChk_clicked(prefs.useFullScreen); - ui->useDarkThemeChk->setChecked(prefs.useDarkMode); - on_useDarkThemeChk_clicked(prefs.useDarkMode); - ui->useSystemThemeChk->setChecked(prefs.useSystemTheme); on_useSystemThemeChk_clicked(prefs.useSystemTheme); @@ -1298,9 +1295,9 @@ void wfmain::setupKeyShortcuts() void wfmain::setDefPrefs() { defPrefs.useFullScreen = false; - defPrefs.useDarkMode = true; defPrefs.useSystemTheme = false; defPrefs.drawPeaks = true; + defPrefs.currentColorPresetNumber = 0; defPrefs.underlayMode = underlayNone; defPrefs.underlayBufferSize = 64; defPrefs.wfAntiAlias = false; @@ -1345,7 +1342,6 @@ void wfmain::loadSettings() // UI: (full screen, dark theme, draw peaks, colors, etc) settings->beginGroup("Interface"); prefs.useFullScreen = settings->value("UseFullScreen", defPrefs.useFullScreen).toBool(); - prefs.useDarkMode = settings->value("UseDarkMode", defPrefs.useDarkMode).toBool(); prefs.useSystemTheme = settings->value("UseSystemTheme", defPrefs.useSystemTheme).toBool(); prefs.wftheme = settings->value("WFTheme", defPrefs.wftheme).toInt(); prefs.plotFloor = settings->value("plotFloor", defPrefs.plotFloor).toInt(); @@ -1419,40 +1415,6 @@ void wfmain::loadSettings() settings->endArray(); settings->endGroup(); - - // Load color schemes: - // Per this bug: https://forum.qt.io/topic/24725/solved-qvariant-will-drop-alpha-value-when-save-qcolor/5 - // the alpha channel is dropped when converting raw qvariant of QColor. Therefore, we are storing as unsigned int and converting back. - - settings->beginGroup("DarkColors"); - prefs.colorScheme.Dark_PlotBackground = QColor::fromRgba(settings->value("Dark_PlotBackground", defaultColors.Dark_PlotBackground.rgba()).toUInt()); - prefs.colorScheme.Dark_PlotAxisPen = QColor::fromRgba(settings->value("Dark_PlotAxisPen", defaultColors.Dark_PlotAxisPen.rgba()).toUInt()); - - prefs.colorScheme.Dark_PlotLegendTextColor = QColor::fromRgba(settings->value("Dark_PlotLegendTextColor", defaultColors.Dark_PlotLegendTextColor.rgba()).toUInt()); - prefs.colorScheme.Dark_PlotLegendBorderPen = QColor::fromRgba(settings->value("Dark_PlotLegendBorderPen", defaultColors.Dark_PlotLegendBorderPen.rgba()).toUInt()); - prefs.colorScheme.Dark_PlotLegendBrush = QColor::fromRgba(settings->value("Dark_PlotLegendBrush", defaultColors.Dark_PlotLegendBrush.rgba()).toUInt()); - - prefs.colorScheme.Dark_PlotTickLabel = QColor::fromRgba(settings->value("Dark_PlotTickLabel", defaultColors.Dark_PlotTickLabel.rgba()).toUInt()); - prefs.colorScheme.Dark_PlotBasePen = QColor::fromRgba(settings->value("Dark_PlotBasePen", defaultColors.Dark_PlotBasePen.rgba()).toUInt()); - prefs.colorScheme.Dark_PlotTickPen = QColor::fromRgba(settings->value("Dark_PlotTickPen", defaultColors.Dark_PlotTickPen.rgba()).toUInt()); - - prefs.colorScheme.Dark_PeakPlotLine = QColor::fromRgba(settings->value("Dark_PeakPlotLine", defaultColors.Dark_PeakPlotLine.rgba()).toUInt()); - prefs.colorScheme.Dark_TuningLine = QColor::fromRgba(settings->value("Dark_TuningLine", defaultColors.Dark_TuningLine.rgba()).toUInt()); - settings->endGroup(); - - settings->beginGroup("LightColors"); - prefs.colorScheme.Light_PlotBackground = QColor::fromRgba(settings->value("Light_PlotBackground", defaultColors.Light_PlotBackground.rgba()).toUInt()); - prefs.colorScheme.Light_PlotAxisPen = QColor::fromRgba(settings->value("Light_PlotAxisPen", defaultColors.Light_PlotAxisPen.rgba()).toUInt()); - prefs.colorScheme.Light_PlotLegendTextColor = QColor::fromRgba(settings->value("Light_PlotLegendTextColo", defaultColors.Light_PlotLegendTextColor.rgba()).toUInt()); - prefs.colorScheme.Light_PlotLegendBorderPen = QColor::fromRgba(settings->value("Light_PlotLegendBorderPen", defaultColors.Light_PlotLegendBorderPen.rgba()).toUInt()); - prefs.colorScheme.Light_PlotLegendBrush = QColor::fromRgba(settings->value("Light_PlotLegendBrush", defaultColors.Light_PlotLegendBrush.rgba()).toUInt()); - prefs.colorScheme.Light_PlotTickLabel = QColor::fromRgba(settings->value("Light_PlotTickLabel", defaultColors.Light_PlotTickLabel.rgba()).toUInt()); - prefs.colorScheme.Light_PlotBasePen = QColor::fromRgba(settings->value("Light_PlotBasePen", defaultColors.Light_PlotBasePen.rgba()).toUInt()); - prefs.colorScheme.Light_PlotTickPen = QColor::fromRgba(settings->value("Light_PlotTickPen", defaultColors.Light_PlotTickPen.rgba()).toUInt()); - prefs.colorScheme.Light_PeakPlotLine = QColor::fromRgba(settings->value("Light_PeakPlotLine", defaultColors.Light_PeakPlotLine.rgba()).toUInt()); - prefs.colorScheme.Light_TuningLine = QColor::fromRgba(settings->value("Light_TuningLine", defaultColors.Light_TuningLine.rgba()).toUInt()); - settings->endGroup(); - // Radio and Comms: C-IV addr, port to use settings->beginGroup("Radio"); prefs.radioCIVAddr = (unsigned char)settings->value("RigCIVuInt", defPrefs.radioCIVAddr).toInt(); @@ -1911,7 +1873,6 @@ void wfmain::saveSettings() settings->beginGroup("Interface"); settings->setValue("UseFullScreen", prefs.useFullScreen); settings->setValue("UseSystemTheme", prefs.useSystemTheme); - settings->setValue("UseDarkMode", prefs.useDarkMode); settings->setValue("DrawPeaks", prefs.drawPeaks); settings->setValue("underlayMode", prefs.underlayMode); settings->setValue("underlayBufferSize", prefs.underlayBufferSize); @@ -2026,51 +1987,6 @@ void wfmain::saveSettings() settings->endArray(); settings->endGroup(); - // Note: X and Y get the same colors. See setPlotTheme() function - settings->beginGroup("DarkColors"); - settings->setValue("Dark_PlotBackground", prefs.colorScheme.Dark_PlotBackground.rgba()); - settings->setValue("Dark_PlotAxisPen", prefs.colorScheme.Dark_PlotAxisPen.rgba()); - settings->setValue("Dark_PlotLegendTextColor", prefs.colorScheme.Dark_PlotLegendTextColor.rgba()); - settings->setValue("Dark_PlotLegendBorderPen", prefs.colorScheme.Dark_PlotLegendBorderPen.rgba()); - settings->setValue("Dark_PlotLegendBrush", prefs.colorScheme.Dark_PlotLegendBrush.rgba()); - settings->setValue("Dark_PlotTickLabel", prefs.colorScheme.Dark_PlotTickLabel.rgba()); - settings->setValue("Dark_PlotBasePen", prefs.colorScheme.Dark_PlotBasePen.rgba()); - settings->setValue("Dark_PlotTickPen", prefs.colorScheme.Dark_PlotTickPen.rgba()); - settings->setValue("Dark_PeakPlotLine", prefs.colorScheme.Dark_PeakPlotLine.rgba()); - settings->setValue("Dark_TuningLine", prefs.colorScheme.Dark_TuningLine.rgba()); - settings->endGroup(); - - settings->beginGroup("LightColors"); - settings->setValue("Light_PlotBackground", prefs.colorScheme.Light_PlotBackground.rgba()); - settings->setValue("Light_PlotAxisPen", prefs.colorScheme.Light_PlotAxisPen.rgba()); - settings->setValue("Light_PlotLegendTextColor", prefs.colorScheme.Light_PlotLegendTextColor.rgba()); - settings->setValue("Light_PlotLegendBorderPen", prefs.colorScheme.Light_PlotLegendBorderPen.rgba()); - settings->setValue("Light_PlotLegendBrush", prefs.colorScheme.Light_PlotLegendBrush.rgba()); - settings->setValue("Light_PlotTickLabel", prefs.colorScheme.Light_PlotTickLabel.rgba()); - settings->setValue("Light_PlotBasePen", prefs.colorScheme.Light_PlotBasePen.rgba()); - settings->setValue("Light_PlotTickPen", prefs.colorScheme.Light_PlotTickPen.rgba()); - settings->setValue("Light_PeakPlotLine", prefs.colorScheme.Light_PeakPlotLine.rgba()); - settings->setValue("Light_TuningLine", prefs.colorScheme.Light_TuningLine.rgba()); - - settings->endGroup(); - - // This is a reference to see how the preference file is encoded. - settings->beginGroup("StandardColors"); - - settings->setValue("white", QColor(Qt::white).rgba()); - settings->setValue("black", QColor(Qt::black).rgba()); - - settings->setValue("red_opaque", QColor(Qt::red).rgba()); - settings->setValue("red_translucent", QColor(255,0,0,128).rgba()); - settings->setValue("green_opaque", QColor(Qt::green).rgba()); - settings->setValue("green_translucent", QColor(0,255,0,128).rgba()); - settings->setValue("blue_opaque", QColor(Qt::blue).rgba()); - settings->setValue("blue_translucent", QColor(0,0,255,128).rgba()); - settings->setValue("cyan", QColor(Qt::cyan).rgba()); - settings->setValue("magenta", QColor(Qt::magenta).rgba()); - settings->setValue("yellow", QColor(Qt::yellow).rgba()); - settings->endGroup(); - settings->beginGroup("Server"); settings->setValue("ServerEnabled", serverConfig.enabled); @@ -2655,14 +2571,6 @@ void wfmain::showStatusBarText(QString text) ui->statusBar->showMessage(text, 5000); } -void wfmain::on_useDarkThemeChk_clicked(bool checked) -{ - //setAppTheme(checked); - setPlotTheme(wf, checked); - setPlotTheme(plot, checked); - prefs.useDarkMode = checked; -} - void wfmain::on_useSystemThemeChk_clicked(bool checked) { setAppTheme(!checked); @@ -2696,31 +2604,65 @@ void wfmain::setAppTheme(bool isCustom) void wfmain::setDefaultColors() { - defaultColors.Dark_PlotBackground = QColor(0,0,0,255); - defaultColors.Dark_PlotAxisPen = QColor(75,75,75,255); - defaultColors.Dark_PlotLegendTextColor = QColor(255,255,255,255); - defaultColors.Dark_PlotLegendBorderPen = QColor(255,255,255,255); - defaultColors.Dark_PlotLegendBrush = QColor(0,0,0,200); - defaultColors.Dark_PlotTickLabel = QColor(Qt::white); - defaultColors.Dark_PlotBasePen = QColor(Qt::white); - defaultColors.Dark_PlotTickPen = QColor(Qt::white); - defaultColors.Dark_PeakPlotLine = QColor(Qt::yellow); - defaultColors.Dark_TuningLine = QColor(Qt::cyan); + // These are some intended built-in color schemes. + // They can be user-modified and may be restored simply + // by removing the relevent color preset preference file entries. - defaultColors.Light_PlotBackground = QColor(255,255,255,255); - defaultColors.Light_PlotAxisPen = QColor(200,200,200,255); - defaultColors.Light_PlotLegendTextColor = QColor(0,0,0,255); - defaultColors.Light_PlotLegendBorderPen = QColor(0,0,0,255); - defaultColors.Light_PlotLegendBrush = QColor(255,255,255,200); - defaultColors.Light_PlotTickLabel = QColor(Qt::black); - defaultColors.Light_PlotBasePen = QColor(Qt::black); - defaultColors.Light_PlotTickPen = QColor(Qt::black); - defaultColors.Light_PeakPlotLine = QColor(Qt::blue); - defaultColors.Light_TuningLine = QColor(Qt::blue); + colorPrefsType *pDark = &colorPreset[0]; + colorPrefsType *pLight = &colorPreset[1]; + + // Dark: + pDark->presetName->clear(); + pDark->presetName->append("Dark"); + pDark->plotBackground = QColor(0,0,0,255); + pDark->axisColor = QColor(Qt::white); + pDark->textColor = QColor(255,255,255,255); + pDark->gridColor = QColor("transparent"); + pDark->spectrumFill = QColor("transparent"); + pDark->spectrumLine = QColor(Qt::yellow); + pDark->underlayLine = QColor(20+200/4.0*1,70*(1.6-1/4.0), 150, 150).lighter(200); + pDark->underlayFill = QColor(20+200/4.0*1,70*(1.6-1/4.0), 150, 150); + pDark->tuningLine = QColor(Qt::cyan); + + pDark->meterLevel = QColor("#148CD2").darker(); + pDark->meterAverage = QColor("#3FB7CD"); + pDark->meterPeak = QColor("#3CA0DB").lighter(); + pDark->meterLowerLine = QColor("#eff0f1"); + pDark->meterLowText = QColor("#eff0f1"); + + pDark->wfBackground = QColor(Qt::black); + pDark->wfAxis = QColor(Qt::white); + pDark->wfGrid = QColor("transparent"); + pDark->wfText = QColor(Qt::white); + + // Bright: + pLight->presetName->clear(); + pLight->presetName->append("Bright"); + pLight->plotBackground = QColor(Qt::white); + pLight->axisColor = QColor(200,200,200,255); + pLight->gridColor = QColor("transparent"); + pLight->textColor = QColor(Qt::black); + pLight->spectrumFill = QColor("transparent"); + pLight->spectrumLine = QColor(Qt::black); + pLight->underlayLine = QColor(Qt::blue); + pLight->tuningLine = QColor(Qt::darkBlue); + + pLight->meterAverage = QColor("#3FB7CD"); + pLight->meterPeak = QColor("#3CA0DB"); + pLight->meterLowerLine = QColor(Qt::black); + pLight->meterLowText = QColor(Qt::black); + + pLight->wfBackground = QColor(Qt::white); + pLight->wfAxis = QColor(200,200,200,255); + pLight->wfGrid = QColor("transparent"); + pLight->wfText = QColor(Qt::black); } void wfmain::setPlotTheme(QCustomPlot *plot, bool isDark) { + + // TODO: Remove this function + /* if(isDark) { plot->setBackground(prefs.colorScheme.Dark_PlotBackground); @@ -2767,6 +2709,7 @@ void wfmain::setPlotTheme(QCustomPlot *plot, bool isDark) plot->graph(0)->setPen(prefs.colorScheme.Light_PeakPlotLine); freqIndicatorLine->setPen(prefs.colorScheme.Light_TuningLine); } + */ } void wfmain::doCmd(commandtype cmddata) @@ -6909,3 +6852,11 @@ void wfmain::on_colorEditMeterText_editingFinished() // ---------- End color UI slots ----------// + +void wfmain::on_colorRevertPresetBtn_clicked() +{ + // revert to default colors: + // TODO: Add arguments to setDefaultColors() + //int pn = ui->colorPresetCombo->currentIndex(); + //setDefaultColors(); +} diff --git a/wfmain.h b/wfmain.h index 11fd2ec..f2e082d 100644 --- a/wfmain.h +++ b/wfmain.h @@ -329,14 +329,8 @@ private slots: void on_scopeEdgeCombo_currentIndexChanged(int index); - // void on_modeSelectCombo_currentIndexChanged(int index); - - void on_useDarkThemeChk_clicked(bool checked); - void on_modeSelectCombo_activated(int index); - // void on_freqDial_actionTriggered(int action); - void on_freqDial_valueChanged(int value); void on_band6mbtn_clicked(); @@ -385,7 +379,6 @@ private slots: void on_saveSettingsBtn_clicked(); - void on_debugBtn_clicked(); void on_pttEnableChk_clicked(bool checked); @@ -634,6 +627,8 @@ private slots: void on_colorRenamePresetBtn_clicked(); + void on_colorRevertPresetBtn_clicked(); + private: Ui::wfmain *ui; void closeEvent(QCloseEvent *event); @@ -649,6 +644,7 @@ private: QCPItemLine * freqIndicatorLine; //commHandler *comm; void setAppTheme(bool isCustom); + // TODO: Remove this function void setPlotTheme(QCustomPlot *plot, bool isDark); void prepareWf(); void prepareWf(unsigned int wfLength); @@ -839,6 +835,8 @@ private: datekind datesetpoint; freqMemory mem; + + // TODO: Remove colorScheme in favor of colorPreset struct colors { QColor Dark_PlotBackground; QColor Dark_PlotAxisPen; @@ -868,7 +866,6 @@ private: struct preferences { bool useFullScreen; - bool useDarkMode; bool useSystemTheme; bool drawPeaks; underlay_t underlayMode = underlayNone; @@ -886,7 +883,6 @@ private: bool enableLAN; bool enableRigCtlD; quint16 rigCtlPort; - colors colorScheme; int currentColorPresetNumber = 0; QString virtualSerialPort; unsigned char localAFgain; @@ -910,7 +906,7 @@ private: audioSetup rxSetup; audioSetup txSetup; - + // TODO: Remove colors defaultColors; void setDefaultColors(); // populate with default values diff --git a/wfmain.ui b/wfmain.ui index e0e785f..0a68604 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -2847,13 +2847,6 @@ - - - - Waterfall Dark Theme - - - @@ -2865,16 +2858,16 @@ - + - Use System Theme + Anti-Alias Waterfall - + - Anti-Alias Waterfall + Use System Theme From 9afc44ce42cbef685f83bf6ffdf5272e7d92838b Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Mon, 22 Aug 2022 18:09:20 -0700 Subject: [PATCH 027/207] Refresh the meter when updating colors immediately. --- meter.cpp | 1 + wfmain.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/meter.cpp b/meter.cpp index 478f90a..b3d10a2 100644 --- a/meter.cpp +++ b/meter.cpp @@ -57,6 +57,7 @@ void meter::setColors(QColor current, QColor peak, averageColor = average; lowLineColor = lowLine; lowTextColor = lowText; + this->update(); } void meter::clearMeterOnPTTtoggle() diff --git a/wfmain.cpp b/wfmain.cpp index 1130e34..41ecbd6 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -2622,7 +2622,7 @@ void wfmain::setDefaultColors() pDark->spectrumLine = QColor(Qt::yellow); pDark->underlayLine = QColor(20+200/4.0*1,70*(1.6-1/4.0), 150, 150).lighter(200); pDark->underlayFill = QColor(20+200/4.0*1,70*(1.6-1/4.0), 150, 150); - pDark->tuningLine = QColor(Qt::cyan); + pDark->tuningLine = QColor("#ff55ffff"); pDark->meterLevel = QColor("#148CD2").darker(); pDark->meterAverage = QColor("#3FB7CD"); From fa0752518d5e73af3e72d15a20af6c3dd83a2e35 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Mon, 22 Aug 2022 19:39:20 -0700 Subject: [PATCH 028/207] More color tuning! --- wfmain.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wfmain.cpp b/wfmain.cpp index 41ecbd6..abc4d4d 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -2620,7 +2620,8 @@ void wfmain::setDefaultColors() pDark->gridColor = QColor("transparent"); pDark->spectrumFill = QColor("transparent"); pDark->spectrumLine = QColor(Qt::yellow); - pDark->underlayLine = QColor(20+200/4.0*1,70*(1.6-1/4.0), 150, 150).lighter(200); + //pDark->underlayLine = QColor(20+200/4.0*1,70*(1.6-1/4.0), 150, 150).lighter(200); + pDark->underlayLine = QColor("#9633ff55"); pDark->underlayFill = QColor(20+200/4.0*1,70*(1.6-1/4.0), 150, 150); pDark->tuningLine = QColor("#ff55ffff"); From 2a456b2adb4d3f8133a0edc0811e9c71f589b4cd Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Mon, 22 Aug 2022 20:44:58 -0700 Subject: [PATCH 029/207] Small cleanup. --- wfmain.cpp | 62 ------------------------------------------------------ wfmain.h | 32 ---------------------------- 2 files changed, 94 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index abc4d4d..128d8b2 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -985,12 +985,6 @@ void wfmain::setInitialTiming() delayedCommand->setSingleShot(false); connect(delayedCommand, SIGNAL(timeout()), this, SLOT(sendRadioCommandLoop())); - // TODO: Remove this: -// periodicPollingTimer = new QTimer(this); -// periodicPollingTimer->setInterval(10); -// periodicPollingTimer->setSingleShot(false); - //connect(periodicPollingTimer, SIGNAL(timeout()), this, SLOT(sendRadioCommandLoop())); - pttTimer = new QTimer(this); pttTimer->setInterval(180*1000); // 3 minute max transmit time in ms pttTimer->setSingleShot(true); @@ -2659,60 +2653,6 @@ void wfmain::setDefaultColors() pLight->wfText = QColor(Qt::black); } -void wfmain::setPlotTheme(QCustomPlot *plot, bool isDark) -{ - - // TODO: Remove this function - /* - if(isDark) - { - plot->setBackground(prefs.colorScheme.Dark_PlotBackground); - //plot->setBackground(QColor(0,0,0,255)); - - plot->xAxis->grid()->setPen(prefs.colorScheme.Dark_PlotAxisPen); - plot->yAxis->grid()->setPen(prefs.colorScheme.Dark_PlotAxisPen); - - plot->legend->setTextColor(prefs.colorScheme.Dark_PlotLegendTextColor); - plot->legend->setBorderPen(prefs.colorScheme.Dark_PlotLegendBorderPen); - plot->legend->setBrush(prefs.colorScheme.Dark_PlotLegendBrush); - - plot->xAxis->setTickLabelColor(prefs.colorScheme.Dark_PlotTickLabel); - plot->xAxis->setLabelColor(prefs.colorScheme.Dark_PlotTickLabel); - plot->yAxis->setTickLabelColor(prefs.colorScheme.Dark_PlotTickLabel); - plot->yAxis->setLabelColor(prefs.colorScheme.Dark_PlotTickLabel); - - plot->xAxis->setBasePen(prefs.colorScheme.Dark_PlotBasePen); - plot->xAxis->setTickPen(prefs.colorScheme.Dark_PlotTickPen); - plot->yAxis->setBasePen(prefs.colorScheme.Dark_PlotBasePen); - plot->yAxis->setTickPen(prefs.colorScheme.Dark_PlotTickPen); - plot->graph(0)->setPen(prefs.colorScheme.Dark_PeakPlotLine); - freqIndicatorLine->setPen(prefs.colorScheme.Dark_TuningLine); - } else { - //color = ui->groupBox->palette().color(QPalette::Button); - - plot->setBackground(prefs.colorScheme.Light_PlotBackground); - plot->xAxis->grid()->setPen(prefs.colorScheme.Light_PlotAxisPen); - plot->yAxis->grid()->setPen(prefs.colorScheme.Light_PlotAxisPen); - - plot->legend->setTextColor(prefs.colorScheme.Light_PlotLegendTextColor); - plot->legend->setBorderPen(prefs.colorScheme.Light_PlotLegendBorderPen); - plot->legend->setBrush(prefs.colorScheme.Light_PlotLegendBrush); - - plot->xAxis->setTickLabelColor(prefs.colorScheme.Light_PlotTickLabel); - plot->xAxis->setLabelColor(prefs.colorScheme.Light_PlotTickLabel); - plot->yAxis->setTickLabelColor(prefs.colorScheme.Light_PlotTickLabel); - plot->yAxis->setLabelColor(prefs.colorScheme.Light_PlotTickLabel); - - plot->xAxis->setBasePen(prefs.colorScheme.Light_PlotBasePen); - plot->xAxis->setTickPen(prefs.colorScheme.Light_PlotTickPen); - plot->yAxis->setBasePen(prefs.colorScheme.Light_PlotBasePen); - plot->yAxis->setTickPen(prefs.colorScheme.Light_PlotTickLabel); - plot->graph(0)->setPen(prefs.colorScheme.Light_PeakPlotLine); - freqIndicatorLine->setPen(prefs.colorScheme.Light_TuningLine); - } - */ -} - void wfmain::doCmd(commandtype cmddata) { cmds cmd = cmddata.cmd; @@ -2837,10 +2777,8 @@ void wfmain::doCmd(commandtype cmddata) doCmd(cmd); break; } - } - void wfmain::doCmd(cmds cmd) { // Use this function to take action upon a command. diff --git a/wfmain.h b/wfmain.h index f2e082d..f0d7e8e 100644 --- a/wfmain.h +++ b/wfmain.h @@ -642,10 +642,7 @@ private: QCustomPlot *plot; // line plot QCustomPlot *wf; // waterfall image QCPItemLine * freqIndicatorLine; - //commHandler *comm; void setAppTheme(bool isCustom); - // TODO: Remove this function - void setPlotTheme(QCustomPlot *plot, bool isDark); void prepareWf(); void prepareWf(unsigned int wfLength); void preparePlasma(); @@ -836,32 +833,6 @@ private: freqMemory mem; - // TODO: Remove colorScheme in favor of colorPreset - struct colors { - QColor Dark_PlotBackground; - QColor Dark_PlotAxisPen; - QColor Dark_PlotLegendTextColor; - QColor Dark_PlotLegendBorderPen; - QColor Dark_PlotLegendBrush; - QColor Dark_PlotTickLabel; - QColor Dark_PlotBasePen; - QColor Dark_PlotTickPen; - QColor Dark_PeakPlotLine; - QColor Dark_TuningLine; - - QColor Light_PlotBackground; - QColor Light_PlotAxisPen; - QColor Light_PlotLegendTextColor; - QColor Light_PlotLegendBorderPen; - QColor Light_PlotLegendBrush; - QColor Light_PlotTickLabel; - QColor Light_PlotBasePen; - QColor Light_PlotTickPen; - QColor Light_PeakPlotLine; - QColor Light_TuningLine; - - } colorScheme; - colorPrefsType colorPreset[numColorPresetsTotal]; struct preferences { @@ -906,9 +877,6 @@ private: audioSetup rxSetup; audioSetup txSetup; - // TODO: Remove - colors defaultColors; - void setDefaultColors(); // populate with default values void useColors(); // set the plot up void setDefPrefs(); // populate default values to default prefs From 8012a58bd9ceb469ecdbe870d80a2857da1b3430 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Mon, 22 Aug 2022 21:22:01 -0700 Subject: [PATCH 030/207] Added separate colors for the high meter scale and the peak indicator. --- colorprefs.h | 3 +- meter.cpp | 49 ++-- meter.h | 5 +- wfmain.cpp | 53 ++-- wfmain.h | 12 +- wfmain.ui | 683 ++++++++++++++++++++++++++------------------------- 6 files changed, 433 insertions(+), 372 deletions(-) diff --git a/colorprefs.h b/colorprefs.h index 5678f64..7db11fc 100644 --- a/colorprefs.h +++ b/colorprefs.h @@ -28,7 +28,8 @@ struct colorPrefsType{ // Meters: QColor meterLevel; QColor meterAverage; - QColor meterPeak; + QColor meterPeakLevel; + QColor meterPeakScale; QColor meterLowerLine; QColor meterLowText; }; diff --git a/meter.cpp b/meter.cpp index b3d10a2..9a24035 100644 --- a/meter.cpp +++ b/meter.cpp @@ -48,13 +48,21 @@ meter::meter(QWidget *parent) : QWidget(parent) } -void meter::setColors(QColor current, QColor peak, +void meter::setColors(QColor current, QColor peakScale, QColor peakLevel, QColor average, QColor lowLine, QColor lowText) { currentColor = current; - peakColor = peak; + + peakColor = peakLevel; // color for the peak level indicator + highLineColor = peakScale; // color for the red side of the scale + highTextColor = peakScale; // color for the red side of the scale's text + averageColor = average; + + midScaleColor = QColor(Qt::yellow); + centerTuningColor = QColor(Qt::green); + lowLineColor = lowLine; lowTextColor = lowText; this->update(); @@ -299,9 +307,8 @@ void meter::drawScaleRaw(QPainter *qp) // Line: X1, Y1 -->to--> X2, Y2 qp->drawLine(mXstart,scaleLineYstart,peakRedLevel+mXstart,scaleLineYstart); - qp->setPen(Qt::red); + qp->setPen(highLineColor); qp->drawLine(peakRedLevel+mXstart,scaleLineYstart,255+mXstart,scaleLineYstart); - } void meter::drawScaleVd(QPainter *qp) @@ -338,7 +345,7 @@ void meter::drawScaleVd(QPainter *qp) // Line: X1, Y1 -->to--> X2, Y2 qp->drawLine(mXstart,scaleLineYstart,peakRedLevel+mXstart,scaleLineYstart); - qp->setPen(Qt::red); + qp->setPen(highLineColor); qp->drawLine(peakRedLevel+mXstart,scaleLineYstart,255+mXstart,scaleLineYstart); } @@ -349,7 +356,7 @@ void meter::drawScaleCenter(QPainter *qp) qp->setPen(lowLineColor); qp->drawText(60+mXstart,scaleTextYstart, QString("-")); - qp->setPen(Qt::green); + qp->setPen(centerTuningColor); // Attempt to draw the zero at the actual center qp->drawText(128-2+mXstart,scaleTextYstart, QString("0")); @@ -360,7 +367,7 @@ void meter::drawScaleCenter(QPainter *qp) qp->setPen(lowLineColor); qp->drawLine(mXstart,scaleLineYstart,128-32+mXstart,scaleLineYstart); - qp->setPen(Qt::green); + qp->setPen(centerTuningColor); qp->drawLine(128-32+mXstart,scaleLineYstart,128+32+mXstart,scaleLineYstart); qp->setPen(lowLineColor); @@ -394,7 +401,7 @@ void meter::drawScalePo(QPainter *qp) //qDebug() << "meter i: " << i; dnPerWatt = (213-143.0f) / 50.0f; // 1.4 dn per watt // P=5 here. - qp->setPen(Qt::yellow); + qp->setPen(midScaleColor); int k=0; for(i=mXstart+143; isetPen(Qt::red); + qp->setPen(highTextColor); for(i=mXstart+213; ito--> X2, Y2 qp->drawLine(mXstart,scaleLineYstart,213+mXstart,scaleLineYstart); - qp->setPen(Qt::red); + qp->setPen(highLineColor); qp->drawLine(213+mXstart,scaleLineYstart,255+mXstart,scaleLineYstart); (void)qp; @@ -444,7 +451,7 @@ void meter::drawScaleALC(QPainter *qp) alc +=20; } - qp->setPen(Qt::red); + qp->setPen(highTextColor); for(; isetPen(lowLineColor); qp->drawLine(mXstart,scaleLineYstart,100+mXstart,scaleLineYstart); - qp->setPen(Qt::red); + qp->setPen(highLineColor); qp->drawLine(100+mXstart,scaleLineYstart,255+mXstart,scaleLineYstart); (void)qp; @@ -495,7 +502,7 @@ void meter::drawScaleComp(QPainter *qp) // Line: X1, Y1 -->to--> X2, Y2 qp->drawLine(mXstart,scaleLineYstart,peakRedLevel+mXstart,scaleLineYstart); - qp->setPen(Qt::red); + qp->setPen(highLineColor); qp->drawLine(peakRedLevel+mXstart,scaleLineYstart,255+mXstart,scaleLineYstart); } @@ -507,27 +514,29 @@ void meter::drawScaleSWR(QPainter *qp) // 0080=SWR2.0, // 0120=SWR3.0 + qp->setPen(lowTextColor); qp->drawText(mXstart,scaleTextYstart, QString("1.0")); qp->drawText(24+mXstart,scaleTextYstart, QString("1.3")); qp->drawText(48+mXstart,scaleTextYstart, QString("1.5")); qp->drawText(80+mXstart,scaleTextYstart, QString("2.0")); qp->drawText(100+mXstart,scaleTextYstart, QString("2.5")); + qp->setPen(highTextColor); qp->drawText(120+mXstart,scaleTextYstart, QString("3.0")); + qp->setPen(lowLineColor); qp->drawLine( 0+mXstart,scaleTextYstart, 0+mXstart, scaleTextYstart+5); qp->drawLine( 24+mXstart,scaleTextYstart, 24+mXstart, scaleTextYstart+5); qp->drawLine( 48+mXstart,scaleTextYstart, 48+mXstart, scaleTextYstart+5); qp->drawLine( 80+mXstart,scaleTextYstart, 80+mXstart, scaleTextYstart+5); qp->drawLine(100+mXstart,scaleTextYstart,100+mXstart, scaleTextYstart+5); // does not draw? + qp->setPen(highLineColor); qp->drawLine(120+mXstart,scaleTextYstart,120+mXstart, scaleTextYstart+5); qp->setPen(lowLineColor); qp->drawLine(mXstart,scaleLineYstart,100+mXstart,scaleLineYstart); - qp->setPen(Qt::red); + qp->setPen(highLineColor); qp->drawLine(100+mXstart,scaleLineYstart,255+mXstart,scaleLineYstart); - - } void meter::drawScaleId(QPainter *qp) @@ -565,7 +574,7 @@ void meter::drawScaleId(QPainter *qp) // Line: X1, Y1 -->to--> X2, Y2 qp->drawLine(mXstart,scaleLineYstart,peakRedLevel+mXstart,scaleLineYstart); - qp->setPen(Qt::red); + qp->setPen(highLineColor); qp->drawLine(peakRedLevel+mXstart,scaleLineYstart,255+mXstart,scaleLineYstart); } @@ -594,7 +603,7 @@ void meter::drawScaleS(QPainter *qp) s = 20; i+=20; - qp->setPen(Qt::red); + qp->setPen(highTextColor); for(; isetPen(lowLineColor); - qp->drawLine(mXstart,scaleLineYstart,peakRedLevel+mXstart,scaleLineYstart); - qp->setPen(Qt::red); + qp->setPen(highLineColor); qp->drawLine(peakRedLevel+mXstart,scaleLineYstart,255+mXstart,scaleLineYstart); - } diff --git a/meter.h b/meter.h index fc29168..b57e362 100644 --- a/meter.h +++ b/meter.h @@ -30,7 +30,7 @@ public slots: void setMeterShortString(QString); QString getMeterShortString(); meterKind getMeterType(); - void setColors(QColor current, QColor peak, + void setColors(QColor current, QColor peakScale, QColor peakLevel, QColor average, QColor lowLine, QColor lowText); @@ -87,6 +87,9 @@ private: QColor highTextColor; QColor highLineColor; + QColor midScaleColor; + QColor centerTuningColor; + }; #endif // METER_H diff --git a/wfmain.cpp b/wfmain.cpp index 128d8b2..9b1f2bc 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -1401,7 +1401,8 @@ void wfmain::loadSettings() p->wfText.setNamedColor(settings->value("wfText", p->wfText.name(QColor::HexArgb)).toString()); p->meterLevel.setNamedColor(settings->value("meterLevel", p->meterLevel.name(QColor::HexArgb)).toString()); p->meterAverage.setNamedColor(settings->value("meterAverage", p->meterAverage.name(QColor::HexArgb)).toString()); - p->meterPeak.setNamedColor(settings->value("meterPeak", p->meterPeak.name(QColor::HexArgb)).toString()); + p->meterPeakLevel.setNamedColor(settings->value("meterPeakLevel", p->meterPeakLevel.name(QColor::HexArgb)).toString()); + p->meterPeakScale.setNamedColor(settings->value("meterPeakScale", p->meterPeakScale.name(QColor::HexArgb)).toString()); p->meterLowerLine.setNamedColor(settings->value("meterLowerLine", p->meterLowerLine.name(QColor::HexArgb)).toString()); p->meterLowText.setNamedColor(settings->value("meterLowText", p->meterLowText.name(QColor::HexArgb)).toString()); } @@ -1974,7 +1975,8 @@ void wfmain::saveSettings() settings->setValue("wfText", p->wfText.name(QColor::HexArgb)); settings->setValue("meterLevel", p->meterLevel.name(QColor::HexArgb)); settings->setValue("meterAverage", p->meterAverage.name(QColor::HexArgb)); - settings->setValue("meterPeak", p->meterPeak.name(QColor::HexArgb)); + settings->setValue("meterPeakScale", p->meterPeakScale.name(QColor::HexArgb)); + settings->setValue("meterPeakLevel", p->meterPeakLevel.name(QColor::HexArgb)); settings->setValue("meterLowerLine", p->meterLowerLine.name(QColor::HexArgb)); settings->setValue("meterLowText", p->meterLowText.name(QColor::HexArgb)); } @@ -2621,7 +2623,8 @@ void wfmain::setDefaultColors() pDark->meterLevel = QColor("#148CD2").darker(); pDark->meterAverage = QColor("#3FB7CD"); - pDark->meterPeak = QColor("#3CA0DB").lighter(); + pDark->meterPeakScale = QColor(Qt::red); + pDark->meterPeakLevel = QColor("#3CA0DB").lighter(); pDark->meterLowerLine = QColor("#eff0f1"); pDark->meterLowText = QColor("#eff0f1"); @@ -2643,7 +2646,8 @@ void wfmain::setDefaultColors() pLight->tuningLine = QColor(Qt::darkBlue); pLight->meterAverage = QColor("#3FB7CD"); - pLight->meterPeak = QColor("#3CA0DB"); + pLight->meterPeakLevel = QColor("#3CA0DB"); + pLight->meterPeakScale = QColor(Qt::darkRed); pLight->meterLowerLine = QColor(Qt::black); pLight->meterLowText = QColor(Qt::black); @@ -6338,8 +6342,8 @@ void wfmain::useColorPreset(colorPrefsType *cp) wf->setBackground(cp->wfBackground); - ui->meterSPoWidget->setColors(cp->meterLevel, cp->meterPeak, cp->meterAverage, cp->meterLowerLine, cp->meterLowText); - ui->meter2Widget->setColors(cp->meterLevel, cp->meterPeak, cp->meterAverage, cp->meterLowerLine, cp->meterLowText); + ui->meterSPoWidget->setColors(cp->meterLevel, cp->meterPeakScale, cp->meterPeakLevel, cp->meterAverage, cp->meterLowerLine, cp->meterLowText); + ui->meter2Widget->setColors(cp->meterLevel, cp->meterPeakScale, cp->meterPeakLevel, cp->meterAverage, cp->meterLowerLine, cp->meterLowText); } void wfmain::setColorButtonOperations(QColor *colorStore, @@ -6434,7 +6438,8 @@ void wfmain::setDefaultColorPresets() p->meterLevel = QColor("#148CD2").darker(); p->meterAverage = QColor("#3FB7CD"); - p->meterPeak = QColor("#3CA0DB").lighter(); + p->meterPeakLevel = QColor("#3CA0DB").lighter(); + p->meterPeakScale = QColor(Qt::red); p->meterLowerLine = QColor("#eff0f1"); p->meterLowText = QColor("#eff0f1"); @@ -6485,7 +6490,8 @@ void wfmain::loadColorPresetToUIandPlots(int presetNumber) setEditAndLedFromColor(p.meterLevel, ui->colorEditMeterLevel, ui->colorSwatchMeterLevel); setEditAndLedFromColor(p.meterAverage, ui->colorEditMeterAvg, ui->colorSwatchMeterAverage); - setEditAndLedFromColor(p.meterPeak, ui->colorEditMeterPeak, ui->colorSwatchMeterPeak); + setEditAndLedFromColor(p.meterPeakLevel, ui->colorEditMeterPeakLevel, ui->colorSwatchMeterPeakLevel); + setEditAndLedFromColor(p.meterPeakScale, ui->colorEditMeterPeakScale, ui->colorSwatchMeterPeakScale); setEditAndLedFromColor(p.meterLowerLine, ui->colorEditMeterScale, ui->colorSwatchMeterScale); setEditAndLedFromColor(p.meterLowText, ui->colorEditMeterText, ui->colorSwatchMeterText); @@ -6747,18 +6753,32 @@ void wfmain::on_colorEditMeterAvg_editingFinished() setColorLineEditOperations(c, ui->colorEditMeterAvg, ui->colorSwatchMeterAverage); } -// Meter Peak: -void wfmain::on_colorSetBtnMeterPeak_clicked() +// Meter Peak Level: +void wfmain::on_colorSetBtnMeterPeakLevel_clicked() { int pos = ui->colorPresetCombo->currentIndex(); - QColor *c = &(colorPreset[pos].meterPeak); - setColorButtonOperations(c, ui->colorEditMeterPeak, ui->colorSwatchMeterPeak); + QColor *c = &(colorPreset[pos].meterPeakLevel); + setColorButtonOperations(c, ui->colorEditMeterPeakLevel, ui->colorSwatchMeterPeakLevel); } -void wfmain::on_colorEditMeterPeak_editingFinished() +void wfmain::on_colorEditMeterPeakLevel_editingFinished() { int pos = ui->colorPresetCombo->currentIndex(); - QColor *c = &(colorPreset[pos].meterPeak); - setColorLineEditOperations(c, ui->colorEditMeterPeak, ui->colorSwatchMeterPeak); + QColor *c = &(colorPreset[pos].meterPeakLevel); + setColorLineEditOperations(c, ui->colorEditMeterPeakLevel, ui->colorSwatchMeterPeakLevel); +} + +// Meter Peak Scale: +void wfmain::on_colorSetBtnMeterPeakScale_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].meterPeakScale); + setColorButtonOperations(c, ui->colorEditMeterPeakScale, ui->colorSwatchMeterPeakScale); +} +void wfmain::on_colorEditMeterPeakScale_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor *c = &(colorPreset[pos].meterPeakScale); + setColorLineEditOperations(c, ui->colorEditMeterPeakScale, ui->colorSwatchMeterPeakScale); } // Meter Scale (line): @@ -6799,3 +6819,6 @@ void wfmain::on_colorRevertPresetBtn_clicked() //int pn = ui->colorPresetCombo->currentIndex(); //setDefaultColors(); } + + + diff --git a/wfmain.h b/wfmain.h index f0d7e8e..d35c811 100644 --- a/wfmain.h +++ b/wfmain.h @@ -613,10 +613,6 @@ private slots: void on_colorEditMeterAvg_editingFinished(); - void on_colorSetBtnMeterPeak_clicked(); - - void on_colorEditMeterPeak_editingFinished(); - void on_colorSetBtnMeterScale_clicked(); void on_colorEditMeterScale_editingFinished(); @@ -629,6 +625,14 @@ private slots: void on_colorRevertPresetBtn_clicked(); + void on_colorSetBtnMeterPeakLevel_clicked(); + + void on_colorEditMeterPeakLevel_editingFinished(); + + void on_colorSetBtnMeterPeakScale_clicked(); + + void on_colorEditMeterPeakScale_editingFinished(); + private: Ui::wfmain *ui; void closeEvent(QCloseEvent *event); diff --git a/wfmain.ui b/wfmain.ui index 0a68604..1dea96e 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -3095,139 +3095,13 @@ 0 - 0 + -369 767 - 582 + 612 - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - - - Waterfall Back - - - - - - - Meter Scale - - - - - - - Meter Peak - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - - - - - - Text - - - - - - - - - - Grid - - - - - - - - - - - - - Meter Text - - - - - - - Spectrum Fill - - - - - - - - - - Meter Level - - - - - - - - - - Rename Preset - - - - + @@ -3240,101 +3114,10 @@ - - + + - Waterfall Text - - - - - - - Waterfall Grid - - - - - - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Axis + Text @@ -3373,28 +3156,22 @@ - - + + - Spectrum Line + Rename Preset - - - - - + + - Tuning Line + Meter Level - - - - - + + 90 @@ -3406,42 +3183,6 @@ - - - - - - - Pop-Out - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - Waterfall Axis - - - @@ -3455,8 +3196,38 @@ - - + + + + + + + Underlay Line + + + + + + + Revert + + + + + + + + + + + + + Meter Peak Level + + + + + 90 @@ -3468,16 +3239,25 @@ - - + + + + + + + + + + + 90 + 16777215 + + - Underlay Fill + #AARRGGBB - - - @@ -3491,26 +3271,6 @@ - - - - Plot Background - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - @@ -3518,8 +3278,8 @@ - - + + 90 @@ -3531,6 +3291,145 @@ + + + + Waterfall Axis + + + + + + + Axis + + + + + + + Underlay Fill + + + + + + + Meter Scale + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + + + Meter Text + + + + + + + + + + Spectrum Line + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Waterfall Grid + + + + + + + + + + Waterfall Back + + + + + + + + + @@ -3544,6 +3443,42 @@ + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + + + Waterfall Text + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + @@ -3551,18 +3486,14 @@ - - - - - 90 - 16777215 - - - - #AARRGGBB - - + + + + + + + + @@ -3574,18 +3505,8 @@ - - - - Underlay Line - - - - - - - - + + 90 @@ -3597,13 +3518,115 @@ - - + + - Revert + Grid + + + + + + + Plot Background + + + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + + + + + + Tuning Line + + + + + + + Spectrum Fill + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Pop-Out + + + + + + + Meter Peak Scale + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + From d49b6cd082151278f6231072fb8e148994a3a72d Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Mon, 22 Aug 2022 21:22:45 -0700 Subject: [PATCH 031/207] Oops, forgot to clarify the button name. --- wfmain.ui | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wfmain.ui b/wfmain.ui index 1dea96e..3e78a4e 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -3095,7 +3095,7 @@ 0 - -369 + -409 767 612 @@ -3607,7 +3607,7 @@ - Meter Peak Scale + Meter High Scale From 7e80eb0ed7e4bf29119c7c2aff33491ef1fb99d6 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Mon, 22 Aug 2022 21:31:31 -0700 Subject: [PATCH 032/207] Cleaned up lots of debug info messages. --- wfmain.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 9b1f2bc..a39b0f3 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6163,7 +6163,6 @@ void wfmain::on_underlayPeakHold_toggled(bool checked) prefs.underlayMode = underlayMode; on_clearPeakBtn_clicked(); } - } void wfmain::on_underlayPeakBuffer_toggled(bool checked) @@ -6300,7 +6299,7 @@ void wfmain::useColorPreset(colorPrefsType *cp) if(cp == Q_NULLPTR) return; - qInfo(logSystem()) << "Setting plots to color preset number " << cp->presetNum << ", with name " << *(cp->presetName); + //qInfo(logSystem()) << "Setting plots to color preset number " << cp->presetNum << ", with name " << *(cp->presetName); plot->setBackground(cp->plotBackground); @@ -6360,7 +6359,6 @@ void wfmain::setColorButtonOperations(QColor *colorStore, getSetColor(d, e); QColor t = d->getColor(); colorStore->setNamedColor(t.name(QColor::HexArgb)); - //colorStore->setBlue(100); useCurrentColorPreset(); } @@ -6412,7 +6410,7 @@ void wfmain::setDefaultColorPresets() // gets overridden after preferences are loaded for(int pn=0; pn < numColorPresetsTotal; pn++) { - qInfo(logSystem()) << "Setting default color preset " << pn; + //qInfo(logSystem()) << "Setting default color preset " << pn; colorPrefsType *p = &colorPreset[pn]; p->presetNum = pn; @@ -6448,7 +6446,7 @@ void wfmain::setDefaultColorPresets() p->wfGrid = QColor(Qt::white); p->wfText = QColor(Qt::white); - qInfo(logSystem()) << "default color preset [" << pn << "] set to pn.presetNum index [" << p->presetNum << "]" << ", with name " << *(p->presetName); + //qInfo(logSystem()) << "default color preset [" << pn << "] set to pn.presetNum index [" << p->presetNum << "]" << ", with name " << *(p->presetName); ui->colorPresetCombo->setItemText(pn, *(p->presetName)); } } @@ -6477,7 +6475,7 @@ void wfmain::loadColorPresetToUIandPlots(int presetNumber) } colorPrefsType p = colorPreset[presetNumber]; - qInfo(logSystem()) << "color preset number [" << presetNumber << "] requested for UI load, which has internal index of [" << p.presetNum << "]"; + //qInfo(logSystem()) << "color preset number [" << presetNumber << "] requested for UI load, which has internal index of [" << p.presetNum << "]"; setEditAndLedFromColor(p.gridColor, ui->colorEditGrid, ui->colorSwatchGrid); setEditAndLedFromColor(p.axisColor, ui->colorEditAxis, ui->colorSwatchAxis); setEditAndLedFromColor(p.textColor, ui->colorEditText, ui->colorSwatchText); @@ -6521,7 +6519,6 @@ void wfmain::on_colorRenamePresetBtn_clicked() colorPreset[p].presetName->clear(); colorPreset[p].presetName->append(newName); ui->colorPresetCombo->setItemText(p, *(colorPreset[p].presetName)); - qInfo(logSystem()) << "Setting color preset number " << p << " to have text " << newName << ", as read in preset data: " << *(colorPreset[p].presetName) << ", and as read from combo box: " << ui->colorPresetCombo->currentText(); } else { if(newName.isEmpty() || (newName.length() > 32)) { @@ -6533,7 +6530,6 @@ void wfmain::on_colorRenamePresetBtn_clicked() void wfmain::on_colorPresetCombo_currentIndexChanged(int index) { - qInfo(logSystem()) << "color preset combo box set to index: " << index; prefs.currentColorPresetNumber = index; loadColorPresetToUIandPlots(index); } From b8ba9a16dc9db063144a27edc3c49451e7ee694d Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Tue, 23 Aug 2022 10:35:59 -0700 Subject: [PATCH 033/207] Added protection against transparent colors. Added revert feature to revert to default color preset for the selected preset. Added save single preset capability. --- wfmain.cpp | 268 +++++++++++++++++++++++++++++++++-------------------- wfmain.h | 5 +- 2 files changed, 169 insertions(+), 104 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index a39b0f3..7a4bb0d 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -63,7 +63,6 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s setupPlots(); setDefaultColorPresets(); - setDefaultColors(); loadSettings(); // Look for saved preferences @@ -1381,7 +1380,7 @@ void wfmain::loadSettings() p = &(colorPreset[pn]); p->presetNum = settings->value("presetNum", p->presetNum).toInt(); tempName = settings->value("presetName", *p->presetName).toString(); - if((!tempName.isEmpty()) && tempName.length() < 33) + if((!tempName.isEmpty()) && tempName.length() < 11) { p->presetName->clear(); p->presetName->append(tempName); @@ -2598,63 +2597,111 @@ void wfmain::setAppTheme(bool isCustom) } } -void wfmain::setDefaultColors() +void wfmain::setDefaultColors(int presetNumber) { - // These are some intended built-in color schemes. - // They can be user-modified and may be restored simply - // by removing the relevent color preset preference file entries. + // These are the default color schemes + if(presetNumber > numColorPresetsTotal-1) + return; - colorPrefsType *pDark = &colorPreset[0]; - colorPrefsType *pLight = &colorPreset[1]; + colorPrefsType *p = &colorPreset[presetNumber]; - // Dark: - pDark->presetName->clear(); - pDark->presetName->append("Dark"); - pDark->plotBackground = QColor(0,0,0,255); - pDark->axisColor = QColor(Qt::white); - pDark->textColor = QColor(255,255,255,255); - pDark->gridColor = QColor("transparent"); - pDark->spectrumFill = QColor("transparent"); - pDark->spectrumLine = QColor(Qt::yellow); - //pDark->underlayLine = QColor(20+200/4.0*1,70*(1.6-1/4.0), 150, 150).lighter(200); - pDark->underlayLine = QColor("#9633ff55"); - pDark->underlayFill = QColor(20+200/4.0*1,70*(1.6-1/4.0), 150, 150); - pDark->tuningLine = QColor("#ff55ffff"); + // Begin every parameter with these safe defaults first: + if(p->presetName == Q_NULLPTR) + { + p->presetName = new QString(); + } + p->presetName->clear(); + p->presetName->append(QString("%1").arg(presetNumber)); + p->presetNum = presetNumber; + p->gridColor = QColor(0,0,0,255); + p->axisColor = QColor(Qt::white); + p->textColor = QColor(Qt::white); + p->spectrumLine = QColor(Qt::yellow); + p->spectrumFill = QColor("transparent"); + p->underlayLine = QColor(20+200/4.0*1,70*(1.6-1/4.0), 150, 150).lighter(200); + p->underlayFill = QColor(20+200/4.0*1,70*(1.6-1/4.0), 150, 150); + p->plotBackground = QColor(Qt::black); + p->tuningLine = QColor(Qt::blue); - pDark->meterLevel = QColor("#148CD2").darker(); - pDark->meterAverage = QColor("#3FB7CD"); - pDark->meterPeakScale = QColor(Qt::red); - pDark->meterPeakLevel = QColor("#3CA0DB").lighter(); - pDark->meterLowerLine = QColor("#eff0f1"); - pDark->meterLowText = QColor("#eff0f1"); + p->meterLevel = QColor("#148CD2").darker(); + p->meterAverage = QColor("#3FB7CD"); + p->meterPeakLevel = QColor("#3CA0DB").lighter(); + p->meterPeakScale = QColor(Qt::red); + p->meterLowerLine = QColor("#eff0f1"); + p->meterLowText = QColor("#eff0f1"); - pDark->wfBackground = QColor(Qt::black); - pDark->wfAxis = QColor(Qt::white); - pDark->wfGrid = QColor("transparent"); - pDark->wfText = QColor(Qt::white); + p->wfBackground = QColor(Qt::black); + p->wfAxis = QColor(Qt::white); + p->wfGrid = QColor(Qt::white); + p->wfText = QColor(Qt::white); - // Bright: - pLight->presetName->clear(); - pLight->presetName->append("Bright"); - pLight->plotBackground = QColor(Qt::white); - pLight->axisColor = QColor(200,200,200,255); - pLight->gridColor = QColor("transparent"); - pLight->textColor = QColor(Qt::black); - pLight->spectrumFill = QColor("transparent"); - pLight->spectrumLine = QColor(Qt::black); - pLight->underlayLine = QColor(Qt::blue); - pLight->tuningLine = QColor(Qt::darkBlue); + //qInfo(logSystem()) << "default color preset [" << pn << "] set to pn.presetNum index [" << p->presetNum << "]" << ", with name " << *(p->presetName); - pLight->meterAverage = QColor("#3FB7CD"); - pLight->meterPeakLevel = QColor("#3CA0DB"); - pLight->meterPeakScale = QColor(Qt::darkRed); - pLight->meterLowerLine = QColor(Qt::black); - pLight->meterLowText = QColor(Qt::black); + switch (presetNumber) + { + case 0: + { + // Dark + p->presetName->clear(); + p->presetName->append("Dark"); + p->plotBackground = QColor(0,0,0,255); + p->axisColor = QColor(Qt::white); + p->textColor = QColor(255,255,255,255); + p->gridColor = QColor(0,0,0,255); + p->spectrumFill = QColor("transparent"); + p->spectrumLine = QColor(Qt::yellow); + p->underlayLine = QColor("#9633ff55"); + p->underlayFill = QColor(20+200/4.0*1,70*(1.6-1/4.0), 150, 150); + p->tuningLine = QColor("#ff55ffff"); - pLight->wfBackground = QColor(Qt::white); - pLight->wfAxis = QColor(200,200,200,255); - pLight->wfGrid = QColor("transparent"); - pLight->wfText = QColor(Qt::black); + p->meterLevel = QColor("#148CD2").darker(); + p->meterAverage = QColor("#3FB7CD"); + p->meterPeakScale = QColor(Qt::red); + p->meterPeakLevel = QColor("#3CA0DB").lighter(); + p->meterLowerLine = QColor("#eff0f1"); + p->meterLowText = QColor("#eff0f1"); + + p->wfBackground = QColor(Qt::black); + p->wfAxis = QColor(Qt::white); + p->wfGrid = QColor("transparent"); + p->wfText = QColor(Qt::white); + break; + } + case 1: + { + // Bright + p->presetName->clear(); + p->presetName->append("Bright"); + p->plotBackground = QColor(Qt::white); + p->axisColor = QColor(200,200,200,255); + p->gridColor = QColor(255,255,255,0); + p->textColor = QColor(Qt::black); + p->spectrumFill = QColor("transparent"); + p->spectrumLine = QColor(Qt::black); + p->underlayLine = QColor(Qt::blue); + p->tuningLine = QColor(Qt::darkBlue); + + p->meterAverage = QColor("#3FB7CD"); + p->meterPeakLevel = QColor("#3CA0DB"); + p->meterPeakScale = QColor(Qt::darkRed); + p->meterLowerLine = QColor(Qt::black); + p->meterLowText = QColor(Qt::black); + + p->wfBackground = QColor(Qt::white); + p->wfAxis = QColor(200,200,200,255); + p->wfGrid = QColor("transparent"); + p->wfText = QColor(Qt::black); + break; + } + + case 2: + case 3: + case 4: + default: + break; + + } + ui->colorPresetCombo->setItemText(presetNumber, *(p->presetName)); } void wfmain::doCmd(commandtype cmddata) @@ -6250,8 +6297,26 @@ QColor wfmain::getColorFromPicker(QColor initialColor) options.setFlag(QColorDialog::ShowAlphaChannel, true); options.setFlag(QColorDialog::DontUseNativeDialog, true); QColor selColor = QColorDialog::getColor(initialColor, this, "Select Color", options); + int alphaVal = 0; + bool ok = false; + if(selColor.isValid()) + { + if(selColor.alpha() == 0) + { + alphaVal = QInputDialog::getInt(this, tr("Specify Opacity"), + tr("You specified an opacity value of 0. \nDo you want to change it? (0=transparent, 255=opaque)"), 0, 0, 255, 1, + &ok); + if(!ok) + { + return selColor; + } else { + selColor.setAlpha(alphaVal); + return selColor; + } + } return selColor; + } else return initialColor; } @@ -6410,44 +6475,7 @@ void wfmain::setDefaultColorPresets() // gets overridden after preferences are loaded for(int pn=0; pn < numColorPresetsTotal; pn++) { - //qInfo(logSystem()) << "Setting default color preset " << pn; - colorPrefsType *p = &colorPreset[pn]; - - p->presetNum = pn; - if(p->presetName == Q_NULLPTR) - { - p->presetName = new QString( QString("Preset %1").arg(pn) ); - } - - // Colors are "#AARRGGBB" (AA=0xff is opaque) - // or as (r, g, b, a) - // Since the UI shows ##AARRGGBB, we should use - // that format in the code when convenient. - - p->gridColor = QColor(0,0,0,255); - p->axisColor = QColor(Qt::white); - p->textColor = QColor(Qt::white); - p->spectrumLine = QColor(Qt::yellow); - p->spectrumFill = QColor("transparent"); - p->underlayLine = QColor(20+200/4.0*1,70*(1.6-1/4.0), 150, 150).lighter(200); - p->underlayFill = QColor(20+200/4.0*1,70*(1.6-1/4.0), 150, 150); - p->plotBackground = QColor(Qt::black); - p->tuningLine = QColor(Qt::blue); - - p->meterLevel = QColor("#148CD2").darker(); - p->meterAverage = QColor("#3FB7CD"); - p->meterPeakLevel = QColor("#3CA0DB").lighter(); - p->meterPeakScale = QColor(Qt::red); - p->meterLowerLine = QColor("#eff0f1"); - p->meterLowText = QColor("#eff0f1"); - - p->wfBackground = QColor(Qt::black); - p->wfAxis = QColor(Qt::white); - p->wfGrid = QColor(Qt::white); - p->wfText = QColor(Qt::white); - - //qInfo(logSystem()) << "default color preset [" << pn << "] set to pn.presetNum index [" << p->presetNum << "]" << ", with name " << *(p->presetName); - ui->colorPresetCombo->setItemText(pn, *(p->presetName)); + setDefaultColors(pn); } } @@ -6508,21 +6536,21 @@ void wfmain::on_colorRenamePresetBtn_clicked() QMessageBox msgBox; bool ok = false; - newName = QInputDialog::getText(this, tr("QInputDialog::getText()"), - tr("Preset Name (32 characters max):"), QLineEdit::Normal, + newName = QInputDialog::getText(this, tr("Rename Preset"), + tr("Preset Name (10 characters max):"), QLineEdit::Normal, ui->colorPresetCombo->currentText(), &ok); if(!ok) return; - if(ok && (newName.length() < 33) && !newName.isEmpty()) + if(ok && (newName.length() < 11) && !newName.isEmpty()) { colorPreset[p].presetName->clear(); colorPreset[p].presetName->append(newName); ui->colorPresetCombo->setItemText(p, *(colorPreset[p].presetName)); } else { - if(newName.isEmpty() || (newName.length() > 32)) + if(newName.isEmpty() || (newName.length() > 10)) { - msgBox.setText("Error, name must be at least one character and not exceed 32 characters."); + msgBox.setText("Error, name must be at least one character and not exceed 10 characters."); msgBox.exec(); } } @@ -6534,6 +6562,13 @@ void wfmain::on_colorPresetCombo_currentIndexChanged(int index) loadColorPresetToUIandPlots(index); } +void wfmain::on_colorRevertPresetBtn_clicked() +{ + int pn = ui->colorPresetCombo->currentIndex(); + setDefaultColors(pn); + loadColorPresetToUIandPlots(pn); +} + // ---------- end color helper functions ---------- // // ---------- Color UI slots ----------// @@ -6807,14 +6842,41 @@ void wfmain::on_colorEditMeterText_editingFinished() // ---------- End color UI slots ----------// - -void wfmain::on_colorRevertPresetBtn_clicked() +void wfmain::on_colorSavePresetBtn_clicked() { - // revert to default colors: - // TODO: Add arguments to setDefaultColors() - //int pn = ui->colorPresetCombo->currentIndex(); - //setDefaultColors(); + int pn = ui->colorPresetCombo->currentIndex(); + + settings->beginGroup("ColorPresets"); + settings->setValue("currentColorPresetNumber", prefs.currentColorPresetNumber); + settings->beginWriteArray("ColorPreset", numColorPresetsTotal); + + colorPrefsType *p; + p = &(colorPreset[pn]); + + settings->setArrayIndex(pn); + settings->setValue("presetNum", p->presetNum); + settings->setValue("presetName", *(p->presetName)); + settings->setValue("gridColor", p->gridColor.name(QColor::HexArgb)); + settings->setValue("axisColor", p->axisColor.name(QColor::HexArgb)); + settings->setValue("textColor", p->textColor.name(QColor::HexArgb)); + settings->setValue("spectrumLine", p->spectrumLine.name(QColor::HexArgb)); + settings->setValue("spectrumFill", p->spectrumFill.name(QColor::HexArgb)); + settings->setValue("underlayLine", p->underlayLine.name(QColor::HexArgb)); + settings->setValue("underlayFill", p->underlayFill.name(QColor::HexArgb)); + settings->setValue("plotBackground", p->plotBackground.name(QColor::HexArgb)); + settings->setValue("tuningLine", p->tuningLine.name(QColor::HexArgb)); + settings->setValue("wfBackground", p->wfBackground.name(QColor::HexArgb)); + settings->setValue("wfGrid", p->wfGrid.name(QColor::HexArgb)); + settings->setValue("wfAxis", p->wfAxis.name(QColor::HexArgb)); + settings->setValue("wfText", p->wfText.name(QColor::HexArgb)); + settings->setValue("meterLevel", p->meterLevel.name(QColor::HexArgb)); + settings->setValue("meterAverage", p->meterAverage.name(QColor::HexArgb)); + settings->setValue("meterPeakScale", p->meterPeakScale.name(QColor::HexArgb)); + settings->setValue("meterPeakLevel", p->meterPeakLevel.name(QColor::HexArgb)); + settings->setValue("meterLowerLine", p->meterLowerLine.name(QColor::HexArgb)); + settings->setValue("meterLowText", p->meterLowText.name(QColor::HexArgb)); + + settings->endArray(); + settings->endGroup(); + settings->sync(); } - - - diff --git a/wfmain.h b/wfmain.h index d35c811..2504899 100644 --- a/wfmain.h +++ b/wfmain.h @@ -633,6 +633,8 @@ private slots: void on_colorEditMeterPeakScale_editingFinished(); + void on_colorSavePresetBtn_clicked(); + private: Ui::wfmain *ui; void closeEvent(QCloseEvent *event); @@ -881,7 +883,8 @@ private: audioSetup rxSetup; audioSetup txSetup; - void setDefaultColors(); // populate with default values + void setDefaultColors(int presetNumber); // populate with default values + void useColors(); // set the plot up void setDefPrefs(); // populate default values to default prefs void setTuningSteps(); From 147156780828b16bf9077a32cdf65524a7170bb8 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Tue, 23 Aug 2022 10:41:26 -0700 Subject: [PATCH 034/207] Clarified what some controls do in the UI related to color and underlay. --- wfmain.ui | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/wfmain.ui b/wfmain.ui index 3e78a4e..acbeefb 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -2916,6 +2916,9 @@ + + No underlay graphics + None @@ -2929,6 +2932,9 @@ + + Indefinite peak hold + Peak Hold @@ -2939,6 +2945,9 @@ + + Peak value within the buffer + Peak @@ -2949,6 +2958,9 @@ + + Average value within the buffer + Average @@ -2972,6 +2984,9 @@ 16777215 + + Size of buffer for spectrum data. Shorter values are more responsive. + 8 @@ -3095,7 +3110,7 @@ 0 - -409 + 0 767 612 @@ -3129,6 +3144,9 @@ 16777215 + + Select a color preset here. + 1 @@ -3158,6 +3176,9 @@ + + Rename the selected color preset. Max length is 10 characters. + Rename Preset @@ -3208,6 +3229,9 @@ + + Revert the selected color preset to the default. + Revert @@ -3266,6 +3290,9 @@ 16777215 + + Color text format is #AARRGGBB, where AA is the "alpha" channel, and value "00" is totally transparent, and "ff" is totally opaque. + #AARRGGBB @@ -3481,8 +3508,11 @@ + + Saves the current preset to the settings file. + - Save Presets + Save Preset @@ -3599,6 +3629,9 @@ + + <html><head/><body><p>Pop out (or pop back in) the entire Settings tab. </p><p>NOTE: Press this button again to re-insert the tab when finished. </p></body></html> + Pop-Out From 31f62fde671eb1c4fd9cda8876e5f843d8d0e579 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Tue, 23 Aug 2022 10:47:19 -0700 Subject: [PATCH 035/207] Moved some preset controls. --- wfmain.ui | 908 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 465 insertions(+), 443 deletions(-) diff --git a/wfmain.ui b/wfmain.ui index acbeefb..bf5d5d7 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -3018,6 +3018,13 @@ + + + + Enable PTT Controls + + + @@ -3068,14 +3075,108 @@ 0 - + - Enable PTT Controls + Color scheme - + + + Preset: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 90 + 0 + + + + + 90 + 16777215 + + + + Select a color preset here. + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + + + + Saves the current preset to the settings file. + + + Save Preset + + + + + + + Revert the selected color preset to the default. + + + Revert + + + + + + + Rename the selected color preset. Max length is 10 characters. + + + Rename Preset + + + + + + + <html><head/><body><p>Pop out (or pop back in) the entire Settings tab. </p><p>NOTE: Press this button again to re-insert the tab when finished. </p></body></html> + + + Pop-Out + + + + + Qt::Horizontal @@ -3091,6 +3192,18 @@ + + + 0 + 0 + + + + + 0 + 250 + + 0 @@ -3112,86 +3225,14 @@ 0 0 767 - 612 + 582 - - - - - 90 - 16777215 - - - - #AARRGGBB - - + + - - - - Text - - - - - - - - 90 - 16777215 - - - - Select a color preset here. - - - - 1 - - - - - 2 - - - - - 3 - - - - - 4 - - - - - 5 - - - - - - - - Rename the selected color preset. Max length is 10 characters. - - - Rename Preset - - - - - - - Meter Level - - - - + @@ -3204,8 +3245,11 @@ - - + + + + + 90 @@ -3217,60 +3261,49 @@ - - - - - + + - Underlay Line - - - - - - - Revert the selected color preset to the default. - - - Revert - - - - - - - - - - - - - Meter Peak Level - - - - - - - - 90 - 16777215 - - - - #AARRGGBB + Waterfall Grid - + - + + + + Spectrum Fill + + + + + + + Underlay Fill + + + + - - + + + + Meter Average + + + + + + + Meter High Scale + + + + + 90 @@ -3282,7 +3315,24 @@ - + + + + + + + Waterfall Back + + + + + + + Plot Background + + + + @@ -3298,89 +3348,8 @@ - - - - Meter Average - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Waterfall Axis - - - - - - - Axis - - - - - - - Underlay Fill - - - - - - - Meter Scale - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - - - Meter Text - - - - - - - - - - Spectrum Line - - - - + 90 @@ -3392,229 +3361,7 @@ - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Waterfall Grid - - - - - - - - - - Waterfall Back - - - - - - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - - - Waterfall Text - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Saves the current preset to the settings file. - - - Save Preset - - - - - - - - - - - - - - - - Preset: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Grid - - - - - - - - - - Plot Background - - - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - - - - - - Tuning Line - - - - - - - Spectrum Fill - - - - @@ -3627,24 +3374,193 @@ - - - - <html><head/><body><p>Pop out (or pop back in) the entire Settings tab. </p><p>NOTE: Press this button again to re-insert the tab when finished. </p></body></html> - + + - Pop-Out + Waterfall Text - - + + + + + - Meter High Scale + Axis - + + + + + + + + + + Waterfall Axis + + + + + + + + + + Grid + + + + + + + + + + + + + + + + Tuning Line + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Text + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Meter Peak Level + + + + + + + @@ -3657,9 +3573,115 @@ - + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Spectrum Line + + + + + + + + + + Meter Text + + + + + + + Underlay Line + + + + + + + Meter Scale + + + + + + + Meter Level + + + From c989dba9f9fab81407cf8a937acb2e5843adea11 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Tue, 23 Aug 2022 10:56:16 -0700 Subject: [PATCH 036/207] Color preset UI now expands to fit. Finally. --- wfmain.ui | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/wfmain.ui b/wfmain.ui index bf5d5d7..fd03aa4 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -3025,6 +3025,22 @@ + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + @@ -3193,9 +3209,9 @@ - + 0 - 0 + 1 @@ -3216,6 +3232,9 @@ + + QAbstractScrollArea::AdjustToContents + true From d3493988af20ca9f3fbf550af757f7ff327680c8 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Tue, 23 Aug 2022 17:01:11 -0700 Subject: [PATCH 037/207] Minor ui adjustment --- wfmain.ui | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wfmain.ui b/wfmain.ui index fd03aa4..bf6abc8 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -18,7 +18,7 @@ - 3 + 0 @@ -931,6 +931,9 @@ 80 + + Sets the floor for the waterfall and spectrum displays + 160 From 9fb74ed6e13ff70bac4482859db45174edf8eee8 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Tue, 23 Aug 2022 22:24:05 -0700 Subject: [PATCH 038/207] Audio metering initial. Very messy but you can select TxRxAudio as the meter type and wfview will show you TX or RX audio depending upon if you are transmitting or not. You can also select only TxAudio or RxAudio. This is nice for looking at Tx audio levels prior to transmitting, for example, or metering the radio's "monitor" audio while transmitting. --- audioconverter.cpp | 4 +++- audioconverter.h | 3 ++- audiohandler.cpp | 12 +++++++++--- audiohandler.h | 6 ++++++ pahandler.cpp | 4 ++-- rigcommander.cpp | 7 +++++++ rigcommander.h | 8 ++++++++ rthandler.cpp | 4 ++-- udpbase.h | 9 +++++++++ udphandler.cpp | 31 +++++++++++++++++++++++++++++++ udphandler.h | 14 ++++++++++++-- wfmain.cpp | 31 ++++++++++++++++++++++++++++++- wfmain.h | 2 ++ 13 files changed, 123 insertions(+), 12 deletions(-) diff --git a/audioconverter.cpp b/audioconverter.cpp index 2316229..d97da05 100644 --- a/audioconverter.cpp +++ b/audioconverter.cpp @@ -157,7 +157,9 @@ bool audioConverter::convert(audioPacket audio) if (samplesF.size() > 0) { - audio.amplitude = samplesF.array().abs().maxCoeff(); + audio.amplitudePeak = samplesF.array().abs().maxCoeff(); + audio.amplitudeRMS = samplesF.squaredNorm(); + // Set the volume samplesF *= audio.volume; diff --git a/audioconverter.h b/audioconverter.h index a0d2953..b3a1492 100644 --- a/audioconverter.h +++ b/audioconverter.h @@ -29,7 +29,8 @@ struct audioPacket { quint16 sent; QByteArray data; quint8 guid[GUIDLEN]; - float amplitude; + float amplitudePeak; + float amplitudeRMS; qreal volume = 1.0; }; diff --git a/audiohandler.cpp b/audiohandler.cpp index cf49045..6968410 100644 --- a/audiohandler.cpp +++ b/audiohandler.cpp @@ -270,12 +270,18 @@ void audioHandler::convertedOutput(audioPacket packet) { } */ lastSentSeq = packet.seq; + amplitude = packet.amplitudePeak; + computeLevels(); emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun, isOverrun); - - amplitude = packet.amplitude; } } +void audioHandler::computeLevels() +{ + if(levelMean) + levelMean[(levelPosition++)%levelSize] = amplitude * 255; +} + void audioHandler::getNextAudioChunk() { if (audioDevice) { @@ -312,7 +318,7 @@ void audioHandler::convertedInput(audioPacket audio) qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Time since last audio packet" << lastReceived.msecsTo(QTime::currentTime()) << "Expected around" << setup.blockSize ; } lastReceived = QTime::currentTime(); - amplitude = audio.amplitude; + amplitude = audio.amplitudePeak; emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun, isOverrun); } } diff --git a/audiohandler.h b/audiohandler.h index a793973..7c8412b 100644 --- a/audiohandler.h +++ b/audiohandler.h @@ -116,6 +116,12 @@ private: float amplitude=0.0; qreal volume = 1.0; + unsigned char *levelMean = Q_NULLPTR; + unsigned char *levelPeak = Q_NULLPTR; + unsigned char levelSize = 50; + unsigned char levelPosition = 0; + void computeLevels(); + audioSetup setup; OpusEncoder* encoder = Q_NULLPTR; diff --git a/pahandler.cpp b/pahandler.cpp index 9db91d1..f437e0c 100644 --- a/pahandler.cpp +++ b/pahandler.cpp @@ -278,7 +278,7 @@ void paHandler::convertedOutput(audioPacket packet) { currentLatency = packet.time.msecsTo(QTime::currentTime()) + (info->outputLatency * 1000); } - amplitude = packet.amplitude; + amplitude = packet.amplitudePeak; emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun, isOverrun); } } @@ -289,7 +289,7 @@ void paHandler::convertedInput(audioPacket packet) { if (packet.data.size() > 0) { emit haveAudioData(packet); - amplitude = packet.amplitude; + amplitude = packet.amplitudePeak; const PaStreamInfo* info = Pa_GetStreamInfo(audio); currentLatency = packet.time.msecsTo(QTime::currentTime()) + (info->inputLatency * 1000); emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun, isOverrun); diff --git a/rigcommander.cpp b/rigcommander.cpp index c0d3ea6..d6ea80c 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -166,6 +166,8 @@ void rigCommander::commSetup(unsigned char rigCivAddr, udpPreferences prefs, aud // Connect for errors/alerts connect(udp, SIGNAL(haveNetworkError(QString, QString)), this, SLOT(handleSerialPortError(QString, QString))); connect(udp, SIGNAL(haveNetworkStatus(networkStatus)), this, SLOT(handleStatusUpdate(networkStatus))); + connect(udp, SIGNAL(haveNetworkAudioLevels(networkAudioLevels)), this, SLOT(handleNetworkAudioLevels(networkAudioLevels))); + connect(ptty, SIGNAL(haveSerialPortError(QString, QString)), this, SLOT(handleSerialPortError(QString, QString))); connect(this, SIGNAL(getMoreDebug()), ptty, SLOT(debugThis())); @@ -245,6 +247,11 @@ void rigCommander::handleStatusUpdate(const networkStatus status) emit haveStatusUpdate(status); } +void rigCommander::handleNetworkAudioLevels(networkAudioLevels l) +{ + emit haveNetworkAudioLevels(l); +} + bool rigCommander::usingLAN() { return usingNativeLAN; diff --git a/rigcommander.h b/rigcommander.h index 7921b24..e26941e 100644 --- a/rigcommander.h +++ b/rigcommander.h @@ -36,6 +36,7 @@ enum meterKind { meterRxdB, meterTxMod, meterRxAudio, + meterAudio, meterLatency }; @@ -277,6 +278,7 @@ public slots: // Housekeeping: void handleStatusUpdate(const networkStatus status); + void handleNetworkAudioLevels(networkAudioLevels); void radioSelection(QList radios); void radioUsage(quint8 radio, quint8 busy, QString name, QString ip); void setCurrentRadio(quint8 radio); @@ -288,6 +290,7 @@ signals: void commReady(); void haveSerialPortError(const QString port, const QString errorText); void haveStatusUpdate(const networkStatus status); + void haveNetworkAudioLevels(const networkAudioLevels l); void dataForComm(const QByteArray &outData); void toggleRTS(bool rtsOn); @@ -397,6 +400,11 @@ private: quint16 decodeTone(QByteArray eTone); quint16 decodeTone(QByteArray eTone, bool &tinv, bool &rinv); + unsigned char audioLevelRxMean[50]; + unsigned char audioLevelRxPeak[50]; + unsigned char audioLevelTxMean[50]; + unsigned char audioLevelTxPeak[50]; + void parseMode(); void parseSpectrum(); void parseWFData(); diff --git a/rthandler.cpp b/rthandler.cpp index f848c38..73b8edb 100644 --- a/rthandler.cpp +++ b/rthandler.cpp @@ -331,7 +331,7 @@ void rtHandler::convertedOutput(audioPacket packet) audioMutex.lock(); arrayBuffer.append(packet.data); audioMutex.unlock(); - amplitude = packet.amplitude; + amplitude = packet.amplitudePeak; currentLatency = packet.time.msecsTo(QTime::currentTime()) + (outFormat.durationForBytes(audio->getStreamLatency() * (outFormat.sampleSize() / 8) * outFormat.channelCount())/1000); emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun, isOverrun); } @@ -342,7 +342,7 @@ void rtHandler::convertedInput(audioPacket packet) { if (packet.data.size() > 0) { emit haveAudioData(packet); - amplitude = packet.amplitude; + amplitude = packet.amplitudePeak; currentLatency = packet.time.msecsTo(QTime::currentTime()) + (outFormat.durationForBytes(audio->getStreamLatency() * (outFormat.sampleSize() / 8) * outFormat.channelCount())/1000); emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun, isOverrun); } diff --git a/udpbase.h b/udpbase.h index f042b4d..e5c67cf 100644 --- a/udpbase.h +++ b/udpbase.h @@ -37,6 +37,15 @@ struct udpPreferences { quint8 waterfallFormat; }; +struct networkAudioLevels { + bool haveTxLevels = false; + bool haveRxLevels = false; + quint8 rxAudioRMS = 0; + quint8 txAudioRMS = 0; + quint8 rxAudioPeak = 0; + quint8 txAudioPeak = 0; +}; + struct networkStatus { quint8 rxAudioBufferPercent; quint8 txAudioBufferPercent; diff --git a/udphandler.cpp b/udphandler.cpp index f0ffd60..fd32779 100644 --- a/udphandler.cpp +++ b/udphandler.cpp @@ -149,6 +149,17 @@ void udpHandler::getRxLevels(quint16 amplitude,quint16 latency,quint16 current, status.rxCurrentLatency = current; status.rxUnderrun = under; status.rxOverrun = over; + audioLevelsRxPeak[(audioLevelsRxPeakPosition++)%audioLevelBufferSize] = amplitude; + if((audioLevelsRxPeakPosition++)%3 == 0) + { + // calculate mean and emit signal + unsigned char mean = findMean(audioLevelsRxPeak); + networkAudioLevels l; + l.haveRxLevels = true; + l.rxAudioPeak = mean; + //qDebug(logSystem()) << "audio level meter being emitted from udpHandler"; + emit haveNetworkAudioLevels(l); + } } void udpHandler::getTxLevels(quint16 amplitude,quint16 latency, quint16 current, bool under, bool over) { @@ -157,6 +168,26 @@ void udpHandler::getTxLevels(quint16 amplitude,quint16 latency, quint16 current, status.txCurrentLatency = current; status.txUnderrun = under; status.txOverrun = over; + audioLevelsTxPeak[(audioLevelsTxPeakPosition++)%audioLevelBufferSize] = amplitude; + if((audioLevelsTxPeakPosition++)%3 == 0) + { + // calculate mean and emit signal + unsigned char mean = findMean(audioLevelsTxPeak); + networkAudioLevels l; + l.haveTxLevels = true; + l.txAudioPeak = mean; + emit haveNetworkAudioLevels(l); + } +} + +unsigned char udpHandler::findMean(unsigned char *data) +{ + unsigned int sum=0; + for(int p=0; p < audioLevelBufferSize; p++) + { + sum += data[p]; + } + return sum / audioLevelBufferSize; } void udpHandler::dataReceived() diff --git a/udphandler.h b/udphandler.h index 8300805..231577c 100644 --- a/udphandler.h +++ b/udphandler.h @@ -29,7 +29,7 @@ #include "udpcivdata.h" #include "udpaudio.h" - +#define audioLevelBufferSize (3) // Class to handle the connection/disconnection of the radio. class udpHandler: public udpBase @@ -58,7 +58,8 @@ public slots: void setCurrentRadio(quint8 radio); void getRxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over); void getTxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over); - + //void handleRxLevels(networkAudioLevels); + //void handleTxLevels(networkAudioLevels); signals: void haveDataFromPort(QByteArray data); // emit this when we have data, connect to rigcommander @@ -67,6 +68,7 @@ signals: void haveChangeLatency(quint16 value); void haveSetVolume(unsigned char value); void haveNetworkStatus(networkStatus); + void haveNetworkAudioLevels(networkAudioLevels); void haveBaudRate(quint32 baudrate); void requestRadioSelection(QList radios); void setRadioUsage(quint8, quint8 busy, QString name, QString mac); @@ -122,6 +124,14 @@ private: quint16 txSampleRates = 0; networkStatus status; bool splitWf = false; + + unsigned char audioLevelsTxPeak[audioLevelBufferSize]; + unsigned char audioLevelsRxPeak[audioLevelBufferSize]; + unsigned char audioLevelsTxPeakPosition = 0; + unsigned char audioLevelsRxPeakPosition = 0; + unsigned char findMean(unsigned char *d); + + }; diff --git a/wfmain.cpp b/wfmain.cpp index c55d6cc..6ed376b 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -47,6 +47,7 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s qRegisterMetaType(); qRegisterMetaType>(); qRegisterMetaType(); + qRegisterMetaType(); haveRigCaps = false; @@ -424,6 +425,7 @@ void wfmain::makeRig() // Rig status and Errors: connect(rig, SIGNAL(haveSerialPortError(QString, QString)), this, SLOT(receiveSerialPortError(QString, QString))); connect(rig, SIGNAL(haveStatusUpdate(networkStatus)), this, SLOT(receiveStatusUpdate(networkStatus))); + connect(rig, SIGNAL(haveNetworkAudioLevels(networkAudioLevels)), this, SLOT(receiveNetworkAudioLevels(networkAudioLevels))); connect(rig, SIGNAL(requestRadioSelection(QList)), this, SLOT(radioSelection(QList))); connect(rig, SIGNAL(setRadioUsage(quint8, quint8, QString, QString)), selRad, SLOT(setInUse(quint8, quint8, QString, QString))); connect(selRad, SIGNAL(selectedRadio(quint8)), rig, SLOT(setCurrentRadio(quint8))); @@ -615,6 +617,22 @@ void wfmain::receiveStatusUpdate(networkStatus status) //qInfo(logSystem()) << "Got Status Update" << status.rxAudioLevel; } +void wfmain::receiveNetworkAudioLevels(networkAudioLevels l) +{ + qInfo(logSystem()) << "audio level meter received."; + meterKind m = meterNone; + if(l.haveRxLevels) + { + m = meterRxAudio; + receiveMeter(m, l.rxAudioPeak); + } + if(l.haveTxLevels) + { + m = meterTxMod; + receiveMeter(m, l.txAudioPeak); + } +} + void wfmain::setupPlots() { spectrumDrawLock = true; @@ -746,6 +764,10 @@ void wfmain::setupMainUI() ui->meter2selectionCombo->addItem("Voltage", meterVoltage); ui->meter2selectionCombo->addItem("Current", meterCurrent); ui->meter2selectionCombo->addItem("Center", meterCenter); + ui->meter2selectionCombo->addItem("TxRxAudio", meterAudio); + ui->meter2selectionCombo->addItem("RxAudio", meterRxAudio); + ui->meter2selectionCombo->addItem("TxAudio", meterTxMod); + ui->meter2Widget->hide(); ui->meter2selectionCombo->show(); @@ -5096,6 +5118,12 @@ void wfmain::receiveMeter(meterKind inMeter, unsigned char level) if(ui->meter2Widget->getMeterType() == inMeter) { ui->meter2Widget->setLevel(level); + } else if ( (ui->meter2Widget->getMeterType() == meterAudio) && + (inMeter == meterTxMod) && amTransmitting) { + ui->meter2Widget->setLevel(level); + } else if ( (ui->meter2Widget->getMeterType() == meterAudio) && + (inMeter == meterRxAudio) && !amTransmitting) { + ui->meter2Widget->setLevel(level); } break; } @@ -5765,7 +5793,8 @@ void wfmain::on_meter2selectionCombo_activated(int index) } else { ui->meter2Widget->show(); ui->meter2Widget->setMeterType(newMeterType); - insertPeriodicCommandUnique(newCmd); + if((newMeterType!=meterRxAudio) && (newMeterType!=meterTxMod) && (newMeterType!=meterAudio)) + insertPeriodicCommandUnique(newCmd); } prefs.meter2Type = newMeterType; diff --git a/wfmain.h b/wfmain.h index 55fc8d2..446967a 100644 --- a/wfmain.h +++ b/wfmain.h @@ -275,6 +275,7 @@ private slots: void receiveFoundRigID(rigCapabilities rigCaps); void receiveSerialPortError(QString port, QString errorText); void receiveStatusUpdate(networkStatus status); + void receiveNetworkAudioLevels(networkAudioLevels l); void handlePlotClick(QMouseEvent *); void handlePlotDoubleClick(QMouseEvent *); void handleWFClick(QMouseEvent *); @@ -943,6 +944,7 @@ Q_DECLARE_METATYPE(struct SERVERCONFIG) Q_DECLARE_METATYPE(struct timekind) Q_DECLARE_METATYPE(struct datekind) Q_DECLARE_METATYPE(struct networkStatus) +Q_DECLARE_METATYPE(struct networkAudioLevels) Q_DECLARE_METATYPE(enum rigInput) Q_DECLARE_METATYPE(enum meterKind) Q_DECLARE_METATYPE(enum spectrumMode) From f7e787e09791a3602f1bb2335fd07c83a6534fee Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Tue, 23 Aug 2022 23:10:58 -0700 Subject: [PATCH 039/207] Log scale for audio meters --- meter.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ meter.h | 2 ++ 2 files changed, 54 insertions(+) diff --git a/meter.cpp b/meter.cpp index bc606ef..5c6d712 100644 --- a/meter.cpp +++ b/meter.cpp @@ -196,8 +196,37 @@ void meter::paintEvent(QPaintEvent *) painter.drawRect(mXstart+peak-1,mYstart,1,barHeight); + } else if ( (meterType == meterAudio) || + (meterType == meterTxMod) || + (meterType == meterRxAudio)) + { + // Log scale but still 0-255: + int logCurrent = (int)((1-audiopot[255-current])*255); + int logAverage = (int)((1-audiopot[255-average])*255); + int logPeak = (int)((1-audiopot[255-peak])*255); + + // X, Y, Width, Height + painter.drawRect(mXstart,mYstart,logCurrent,barHeight); + + // Average: + painter.setPen(averageColor); + painter.setBrush(averageColor); + painter.drawRect(mXstart+logAverage-1,mYstart,1,barHeight); // bar is 1 pixel wide, height = meter start? + + // Peak: + painter.setPen(peakColor); + painter.setBrush(peakColor); + if(peak > peakRedLevel) + { + painter.setBrush(Qt::red); + painter.setPen(Qt::red); + } + + painter.drawRect(mXstart+logPeak-1,mYstart,2,barHeight); + } else { + // X, Y, Width, Height painter.drawRect(mXstart,mYstart,current,barHeight); @@ -292,6 +321,29 @@ void meter::drawScaleRaw(QPainter *qp) } +void meter::drawScale_dBFs(QPainter *qp) +{ + qp->setPen(lowTextColor); + //qp->setFont(QFont("Arial", fontSize)); + peakRedLevel = 193; + + qp->drawText(mXstart,scaleTextYstart, QString("")); + qp->drawText(20+mXstart,scaleTextYstart, QString("-15dB")); + qp->drawText(38+mXstart,scaleTextYstart, QString("-12dB")); + qp->drawText(71+mXstart,scaleTextYstart, QString("-9dB")); + qp->drawText(124+mXstart,scaleTextYstart, QString("-6dB")); + qp->drawText(193+mXstart,scaleTextYstart, QString("-3dB")); + qp->drawText(255+mXstart,scaleTextYstart, QString("0dB")); + + // Now the lines: + qp->setPen(lowLineColor); + + // Line: X1, Y1 -->to--> X2, Y2 + qp->drawLine(mXstart,scaleLineYstart,peakRedLevel+mXstart,scaleLineYstart); + qp->setPen(Qt::red); + qp->drawLine(peakRedLevel+mXstart,scaleLineYstart,255+mXstart,scaleLineYstart); +} + void meter::drawScaleVd(QPainter *qp) { qp->setPen(lowTextColor); diff --git a/meter.h b/meter.h index d94657c..1576bd9 100644 --- a/meter.h +++ b/meter.h @@ -9,6 +9,7 @@ #include #include "rigcommander.h" // for meter types +#include "audiotaper.h" class meter : public QWidget { @@ -68,6 +69,7 @@ private: void drawScaleVd(QPainter *qp); void drawScaleId(QPainter *qp); void drawScaleComp(QPainter *qp); + void drawScale_dBFs(QPainter *qp); void drawScaleRaw(QPainter *qp); void drawLabel(QPainter *qp); From 2afcef5ef000eb0dfec338dbabc5f16b34da95aa Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Tue, 23 Aug 2022 23:17:57 -0700 Subject: [PATCH 040/207] log scale, incomplete, needs tickmarks, etc. --- meter.cpp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/meter.cpp b/meter.cpp index 5c6d712..669b3cc 100644 --- a/meter.cpp +++ b/meter.cpp @@ -164,6 +164,22 @@ void meter::paintEvent(QPaintEvent *) case meterNone: return; break; + case meterAudio: + label = "dB"; + peakRedLevel = 241; + drawScale_dBFs(&painter); + break; + case meterRxAudio: + label = "Rx"; + peakRedLevel = 241; + drawScale_dBFs(&painter); + break; + case meterTxMod: + label = "Tx"; + peakRedLevel = 241; + drawScale_dBFs(&painter); + break; + default: label = "DN"; peakRedLevel = 241; @@ -327,12 +343,11 @@ void meter::drawScale_dBFs(QPainter *qp) //qp->setFont(QFont("Arial", fontSize)); peakRedLevel = 193; - qp->drawText(mXstart,scaleTextYstart, QString("")); - qp->drawText(20+mXstart,scaleTextYstart, QString("-15dB")); - qp->drawText(38+mXstart,scaleTextYstart, QString("-12dB")); - qp->drawText(71+mXstart,scaleTextYstart, QString("-9dB")); - qp->drawText(124+mXstart,scaleTextYstart, QString("-6dB")); - qp->drawText(193+mXstart,scaleTextYstart, QString("-3dB")); + qp->drawText(20+mXstart,scaleTextYstart, QString("-15")); + qp->drawText(38+mXstart,scaleTextYstart, QString("-12")); + qp->drawText(71+mXstart,scaleTextYstart, QString("-9")); + qp->drawText(124+mXstart,scaleTextYstart, QString("-6")); + qp->drawText(193+mXstart,scaleTextYstart, QString("-3")); qp->drawText(255+mXstart,scaleTextYstart, QString("0dB")); // Now the lines: From d90eb6f11f157c512c498235982ff19261b16446 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Wed, 24 Aug 2022 10:17:11 -0700 Subject: [PATCH 041/207] Using peak scale color now --- meter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meter.cpp b/meter.cpp index a78d4ab..324136d 100644 --- a/meter.cpp +++ b/meter.cpp @@ -374,7 +374,7 @@ void meter::drawScale_dBFs(QPainter *qp) // Line: X1, Y1 -->to--> X2, Y2 qp->drawLine(mXstart,scaleLineYstart,peakRedLevel+mXstart,scaleLineYstart); - qp->setPen(Qt::red); + qp->setPen(highLineColor); qp->drawLine(peakRedLevel+mXstart,scaleLineYstart,255+mXstart,scaleLineYstart); } From 4ea7ec80905c697bf908aaf07acb0e60e221f283 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Wed, 24 Aug 2022 15:02:00 -0700 Subject: [PATCH 042/207] Fixed up signals and slots related to audio levels, removed extra junk code, added preliminary RMS and Peak audio availablility. --- audiohandler.cpp | 11 ++--------- audiohandler.h | 8 +------- pahandler.cpp | 4 ++-- pahandler.h | 2 +- rthandler.cpp | 4 ++-- rthandler.h | 2 +- udpaudio.cpp | 12 ++++++------ udpaudio.h | 10 +++++----- udphandler.cpp | 50 +++++++++++++++++++++++++++++++++--------------- udphandler.h | 15 +++++++++------ 10 files changed, 64 insertions(+), 54 deletions(-) diff --git a/audiohandler.cpp b/audiohandler.cpp index 6968410..3f68bd8 100644 --- a/audiohandler.cpp +++ b/audiohandler.cpp @@ -271,17 +271,10 @@ void audioHandler::convertedOutput(audioPacket packet) { */ lastSentSeq = packet.seq; amplitude = packet.amplitudePeak; - computeLevels(); - emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun, isOverrun); + emit haveLevels(getAmplitude(), static_cast(packet.amplitudeRMS * 255.0), setup.latency, currentLatency, isUnderrun, isOverrun); } } -void audioHandler::computeLevels() -{ - if(levelMean) - levelMean[(levelPosition++)%levelSize] = amplitude * 255; -} - void audioHandler::getNextAudioChunk() { if (audioDevice) { @@ -319,7 +312,7 @@ void audioHandler::convertedInput(audioPacket audio) } lastReceived = QTime::currentTime(); amplitude = audio.amplitudePeak; - emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun, isOverrun); + emit haveLevels(getAmplitude(), audio.amplitudeRMS, setup.latency, currentLatency, isUnderrun, isOverrun); } } diff --git a/audiohandler.h b/audiohandler.h index 7c8412b..760b215 100644 --- a/audiohandler.h +++ b/audiohandler.h @@ -70,7 +70,7 @@ signals: void audioMessage(QString message); void sendLatency(quint16 newSize); void haveAudioData(const audioPacket& data); - void haveLevels(quint16 amplitude,quint16 latency,quint16 current,bool under,bool over); + void haveLevels(quint16 amplitudePeak, quint16 amplitudeRMS, quint16 latency,quint16 current,bool under,bool over); void setupConverter(QAudioFormat in, QAudioFormat out, quint8 opus, quint8 resamp); void sendToConverter(audioPacket audio); @@ -116,12 +116,6 @@ private: float amplitude=0.0; qreal volume = 1.0; - unsigned char *levelMean = Q_NULLPTR; - unsigned char *levelPeak = Q_NULLPTR; - unsigned char levelSize = 50; - unsigned char levelPosition = 0; - void computeLevels(); - audioSetup setup; OpusEncoder* encoder = Q_NULLPTR; diff --git a/pahandler.cpp b/pahandler.cpp index f437e0c..d27886c 100644 --- a/pahandler.cpp +++ b/pahandler.cpp @@ -279,7 +279,7 @@ void paHandler::convertedOutput(audioPacket packet) { } amplitude = packet.amplitudePeak; - emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun, isOverrun); + emit haveLevels(getAmplitude(), static_cast(packet.amplitudeRMS * 255.0), setup.latency, currentLatency, isUnderrun, isOverrun); } } @@ -292,7 +292,7 @@ void paHandler::convertedInput(audioPacket packet) amplitude = packet.amplitudePeak; const PaStreamInfo* info = Pa_GetStreamInfo(audio); currentLatency = packet.time.msecsTo(QTime::currentTime()) + (info->inputLatency * 1000); - emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun, isOverrun); + emit haveLevels(getAmplitude(), packet.amplitudeRMS, setup.latency, currentLatency, isUnderrun, isOverrun); } } diff --git a/pahandler.h b/pahandler.h index a8fac05..c9bd474 100644 --- a/pahandler.h +++ b/pahandler.h @@ -55,7 +55,7 @@ signals: void audioMessage(QString message); void sendLatency(quint16 newSize); void haveAudioData(const audioPacket& data); - void haveLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over); + void haveLevels(quint16 amplitudePeak, quint16 amplitudeRMS, quint16 latency, quint16 current, bool under, bool over); void setupConverter(QAudioFormat in, QAudioFormat out, quint8 opus, quint8 resamp); void sendToConverter(audioPacket audio); diff --git a/rthandler.cpp b/rthandler.cpp index 73b8edb..b203402 100644 --- a/rthandler.cpp +++ b/rthandler.cpp @@ -333,7 +333,7 @@ void rtHandler::convertedOutput(audioPacket packet) audioMutex.unlock(); amplitude = packet.amplitudePeak; currentLatency = packet.time.msecsTo(QTime::currentTime()) + (outFormat.durationForBytes(audio->getStreamLatency() * (outFormat.sampleSize() / 8) * outFormat.channelCount())/1000); - emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun, isOverrun); + emit haveLevels(getAmplitude(), packet.amplitudeRMS, setup.latency, currentLatency, isUnderrun, isOverrun); } @@ -344,7 +344,7 @@ void rtHandler::convertedInput(audioPacket packet) emit haveAudioData(packet); amplitude = packet.amplitudePeak; currentLatency = packet.time.msecsTo(QTime::currentTime()) + (outFormat.durationForBytes(audio->getStreamLatency() * (outFormat.sampleSize() / 8) * outFormat.channelCount())/1000); - emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun, isOverrun); + emit haveLevels(getAmplitude(), static_cast(packet.amplitudeRMS * 255.0), setup.latency, currentLatency, isUnderrun, isOverrun); } } diff --git a/rthandler.h b/rthandler.h index c48a2b4..2b73b12 100644 --- a/rthandler.h +++ b/rthandler.h @@ -61,7 +61,7 @@ signals: void audioMessage(QString message); void sendLatency(quint16 newSize); void haveAudioData(const audioPacket& data); - void haveLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over); + void haveLevels(quint16 amplitudePeak, quint16 amplitudeRMS, quint16 latency, quint16 current, bool under, bool over); void setupConverter(QAudioFormat in, QAudioFormat out, quint8 opus, quint8 resamp); void sendToConverter(audioPacket audio); diff --git a/udpaudio.cpp b/udpaudio.cpp index dc1e5c5..1326a67 100644 --- a/udpaudio.cpp +++ b/udpaudio.cpp @@ -159,13 +159,13 @@ void udpAudio::setVolume(unsigned char value) emit haveSetVolume(value); } -void udpAudio::getRxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over) { +void udpAudio::getRxLevels(quint16 amplitudePeak, quint16 amplitudeRMS, quint16 latency, quint16 current, bool under, bool over) { - emit haveRxLevels(amplitude, latency, current, under, over); + emit haveRxLevels(amplitudePeak, amplitudeRMS, latency, current, under, over); } -void udpAudio::getTxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over) { - emit haveTxLevels(amplitude, latency, current, under, over); +void udpAudio::getTxLevels(quint16 amplitudePeak, quint16 amplitudeRMS, quint16 latency, quint16 current, bool under, bool over) { + emit haveTxLevels(amplitudePeak, amplitudeRMS, latency, current, under, over); } void udpAudio::dataReceived() @@ -256,7 +256,7 @@ void udpAudio::startAudio() { connect(this, SIGNAL(haveAudioData(audioPacket)), rxaudio, SLOT(incomingAudio(audioPacket))); connect(this, SIGNAL(haveChangeLatency(quint16)), rxaudio, SLOT(changeLatency(quint16))); connect(this, SIGNAL(haveSetVolume(unsigned char)), rxaudio, SLOT(setVolume(unsigned char))); - connect(rxaudio, SIGNAL(haveLevels(quint16, quint16, quint16, bool, bool)), this, SLOT(getRxLevels(quint16, quint16, quint16, bool, bool))); + connect(rxaudio, SIGNAL(haveLevels(quint16, quint16, quint16, quint16, bool, bool)), this, SLOT(getRxLevels(quint16, quint16, quint16, quint16, bool, bool))); connect(rxAudioThread, SIGNAL(finished()), rxaudio, SLOT(deleteLater())); @@ -290,7 +290,7 @@ void udpAudio::startAudio() { connect(this, SIGNAL(setupTxAudio(audioSetup)), txaudio, SLOT(init(audioSetup))); connect(txaudio, SIGNAL(haveAudioData(audioPacket)), this, SLOT(receiveAudioData(audioPacket))); - connect(txaudio, SIGNAL(haveLevels(quint16, quint16, quint16, bool, bool)), this, SLOT(getTxLevels(quint16, quint16, quint16, bool, bool))); + connect(txaudio, SIGNAL(haveLevels(quint16, quint16, quint16, quint16, bool, bool)), this, SLOT(getTxLevels(quint16, quint16, quint16, quint16, bool, bool))); connect(txAudioThread, SIGNAL(finished()), txaudio, SLOT(deleteLater())); emit setupTxAudio(txSetup); diff --git a/udpaudio.h b/udpaudio.h index 884edef..3ab6d42 100644 --- a/udpaudio.h +++ b/udpaudio.h @@ -51,14 +51,14 @@ signals: void haveChangeLatency(quint16 value); void haveSetVolume(unsigned char value); - void haveRxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over); - void haveTxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over); + void haveRxLevels(quint16 amplitudePeak, quint16 amplitudeRMS, quint16 latency, quint16 current, bool under, bool over); + void haveTxLevels(quint16 amplitudePeak, quint16 amplitudeRMS, quint16 latency, quint16 current, bool under, bool over); public slots: void changeLatency(quint16 value); void setVolume(unsigned char value); - void getRxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over); - void getTxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over); + void getRxLevels(quint16 amplitude, quint16 amplitudeRMS, quint16 latency, quint16 current, bool under, bool over); + void getTxLevels(quint16 amplitude, quint16 amplitudeRMS, quint16 latency, quint16 current, bool under, bool over); void receiveAudioData(audioPacket audio); private: @@ -85,4 +85,4 @@ private: }; -#endif \ No newline at end of file +#endif diff --git a/udphandler.cpp b/udphandler.cpp index fd32779..f075d6b 100644 --- a/udphandler.cpp +++ b/udphandler.cpp @@ -143,41 +143,50 @@ void udpHandler::receiveDataFromUserToRig(QByteArray data) } } -void udpHandler::getRxLevels(quint16 amplitude,quint16 latency,quint16 current, bool under, bool over) { - status.rxAudioLevel = amplitude; +void udpHandler::getRxLevels(quint16 amplitudePeak, quint16 amplitudeRMS,quint16 latency,quint16 current, bool under, bool over) { + status.rxAudioLevel = amplitudePeak; status.rxLatency = latency; status.rxCurrentLatency = current; status.rxUnderrun = under; status.rxOverrun = over; - audioLevelsRxPeak[(audioLevelsRxPeakPosition++)%audioLevelBufferSize] = amplitude; - if((audioLevelsRxPeakPosition++)%3 == 0) + audioLevelsRxPeak[(audioLevelsRxPosition)%audioLevelBufferSize] = amplitudePeak; + audioLevelsRxRMS[(audioLevelsRxPosition)%audioLevelBufferSize] = amplitudeRMS; + + if((audioLevelsRxPosition)%3 == 0) { // calculate mean and emit signal - unsigned char mean = findMean(audioLevelsRxPeak); + unsigned char meanPeak = findMax(audioLevelsRxPeak); + unsigned char meanRMS = findMean(audioLevelsRxRMS); networkAudioLevels l; l.haveRxLevels = true; - l.rxAudioPeak = mean; - //qDebug(logSystem()) << "audio level meter being emitted from udpHandler"; + l.rxAudioPeak = meanPeak; + l.rxAudioRMS = meanRMS; emit haveNetworkAudioLevels(l); } + audioLevelsRxPosition++; } -void udpHandler::getTxLevels(quint16 amplitude,quint16 latency, quint16 current, bool under, bool over) { - status.txAudioLevel = amplitude; +void udpHandler::getTxLevels(quint16 amplitudePeak, quint16 amplitudeRMS ,quint16 latency, quint16 current, bool under, bool over) { + status.txAudioLevel = amplitudePeak; status.txLatency = latency; status.txCurrentLatency = current; status.txUnderrun = under; status.txOverrun = over; - audioLevelsTxPeak[(audioLevelsTxPeakPosition++)%audioLevelBufferSize] = amplitude; - if((audioLevelsTxPeakPosition++)%3 == 0) + audioLevelsTxPeak[(audioLevelsTxPosition)%audioLevelBufferSize] = amplitudePeak; + audioLevelsTxRMS[(audioLevelsTxPosition)%audioLevelBufferSize] = amplitudeRMS; + + if((audioLevelsTxPosition)%3 == 0) { // calculate mean and emit signal - unsigned char mean = findMean(audioLevelsTxPeak); + unsigned char meanPeak = findMax(audioLevelsTxPeak); + unsigned char meanRMS = findMean(audioLevelsTxRMS); networkAudioLevels l; l.haveTxLevels = true; - l.txAudioPeak = mean; + l.txAudioPeak = meanPeak; + l.txAudioRMS = meanRMS; emit haveNetworkAudioLevels(l); } + audioLevelsTxPosition++; } unsigned char udpHandler::findMean(unsigned char *data) @@ -190,6 +199,17 @@ unsigned char udpHandler::findMean(unsigned char *data) return sum / audioLevelBufferSize; } +unsigned char udpHandler::findMax(unsigned char *data) +{ + unsigned int max=0; + for(int p=0; p < audioLevelBufferSize; p++) + { + if(data[p] > max) + max = data[p]; + } + return max; +} + void udpHandler::dataReceived() { while (udp->hasPendingDatagrams()) { @@ -348,8 +368,8 @@ void udpHandler::dataReceived() QObject::connect(audio, SIGNAL(haveAudioData(audioPacket)), this, SLOT(receiveAudioData(audioPacket))); QObject::connect(this, SIGNAL(haveChangeLatency(quint16)), audio, SLOT(changeLatency(quint16))); QObject::connect(this, SIGNAL(haveSetVolume(unsigned char)), audio, SLOT(setVolume(unsigned char))); - QObject::connect(audio, SIGNAL(haveRxLevels(quint16, quint16, quint16, bool, bool)), this, SLOT(getRxLevels(quint16, quint16, quint16, bool, bool))); - QObject::connect(audio, SIGNAL(haveTxLevels(quint16, quint16, quint16, bool, bool)), this, SLOT(getTxLevels(quint16, quint16, quint16, bool, bool))); + QObject::connect(audio, SIGNAL(haveRxLevels(quint16, quint16, quint16, quint16, bool, bool)), this, SLOT(getRxLevels(quint16, quint16, quint16, quint16, bool, bool))); + QObject::connect(audio, SIGNAL(haveTxLevels(quint16, quint16, quint16, quint16, bool, bool)), this, SLOT(getTxLevels(quint16, quint16, quint16, quint16, bool, bool))); } qInfo(logUdp()) << this->metaObject()->className() << "Got serial and audio request success, device name: " << devName; diff --git a/udphandler.h b/udphandler.h index 231577c..74cca92 100644 --- a/udphandler.h +++ b/udphandler.h @@ -56,10 +56,8 @@ public slots: void setVolume(unsigned char value); void init(); void setCurrentRadio(quint8 radio); - void getRxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over); - void getTxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over); - //void handleRxLevels(networkAudioLevels); - //void handleTxLevels(networkAudioLevels); + void getRxLevels(quint16 amplitudePeak, quint16 amplitudeRMS, quint16 latency, quint16 current, bool under, bool over); + void getTxLevels(quint16 amplitudePeak, quint16 amplitudeRMS, quint16 latency, quint16 current, bool under, bool over); signals: void haveDataFromPort(QByteArray data); // emit this when we have data, connect to rigcommander @@ -127,9 +125,14 @@ private: unsigned char audioLevelsTxPeak[audioLevelBufferSize]; unsigned char audioLevelsRxPeak[audioLevelBufferSize]; - unsigned char audioLevelsTxPeakPosition = 0; - unsigned char audioLevelsRxPeakPosition = 0; + + unsigned char audioLevelsTxRMS[audioLevelBufferSize]; + unsigned char audioLevelsRxRMS[audioLevelBufferSize]; + + unsigned char audioLevelsTxPosition = 0; + unsigned char audioLevelsRxPosition = 0; unsigned char findMean(unsigned char *d); + unsigned char findMax(unsigned char *d); }; From fbf1c4bce9924c61074fd32e1e7d60ff963f58c0 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Wed, 24 Aug 2022 15:21:29 -0700 Subject: [PATCH 043/207] Removed annoying debug message. --- wfmain.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 25d6e58..1cc79a0 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -623,17 +623,16 @@ void wfmain::receiveStatusUpdate(networkStatus status) void wfmain::receiveNetworkAudioLevels(networkAudioLevels l) { - qInfo(logSystem()) << "audio level meter received."; meterKind m = meterNone; if(l.haveRxLevels) { m = meterRxAudio; - receiveMeter(m, l.rxAudioPeak); + receiveMeter(m, l.rxAudioRMS); } if(l.haveTxLevels) { m = meterTxMod; - receiveMeter(m, l.txAudioPeak); + receiveMeter(m, l.txAudioRMS); } } From 9623226b0c2000335cfa88ce79e2fd4ff7bee60c Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Wed, 24 Aug 2022 16:06:41 -0700 Subject: [PATCH 044/207] Added average metering. --- audioconverter.cpp | 2 +- meter.cpp | 16 ++++++++++++++++ meter.h | 1 + wfmain.cpp | 21 +++++++++++++++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/audioconverter.cpp b/audioconverter.cpp index d97da05..d25f3f5 100644 --- a/audioconverter.cpp +++ b/audioconverter.cpp @@ -158,7 +158,7 @@ bool audioConverter::convert(audioPacket audio) { audio.amplitudePeak = samplesF.array().abs().maxCoeff(); - audio.amplitudeRMS = samplesF.squaredNorm(); + audio.amplitudeRMS = samplesF.array().abs().mean(); // Set the volume samplesF *= audio.volume; diff --git a/meter.cpp b/meter.cpp index 324136d..34dfa01 100644 --- a/meter.cpp +++ b/meter.cpp @@ -320,6 +320,22 @@ void meter::setLevel(int current) this->update(); } +void meter::setLevels(int current, int peak) +{ + this->current = current; + this->peak = peak; + + avgLevels[(avgPosition++)%averageBalisticLength] = current; + int sum=0; + for(unsigned int i=0; i < (unsigned int)std::min(avgPosition, (int)avgLevels.size()); i++) + { + sum += avgLevels.at(i); + } + this->average = sum / std::min(avgPosition, (int)avgLevels.size()); + + this->update(); +} + void meter::setLevels(int current, int peak, int average) { this->current = current; diff --git a/meter.h b/meter.h index 073a443..4e03ced 100644 --- a/meter.h +++ b/meter.h @@ -24,6 +24,7 @@ public slots: void updateDrawing(int num); void setLevels(int current, int peak, int average); + void setLevels(int current, int peak); // calculate avg void setLevel(int current); void clearMeterOnPTTtoggle(); void clearMeter(); diff --git a/wfmain.cpp b/wfmain.cpp index 1cc79a0..5a5ce6b 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -623,6 +623,26 @@ void wfmain::receiveStatusUpdate(networkStatus status) void wfmain::receiveNetworkAudioLevels(networkAudioLevels l) { + meterKind m2mtr = ui->meter2Widget->getMeterType(); + if(m2mtr == meterAudio) + { + if(amTransmitting) + { + if(l.haveTxLevels) + ui->meter2Widget->setLevels(l.txAudioRMS, l.txAudioPeak); + } else { + if(l.haveRxLevels) + ui->meter2Widget->setLevels(l.rxAudioRMS, l.rxAudioPeak); + } + } else if (m2mtr == meterTxMod) { + if(l.haveTxLevels) + ui->meter2Widget->setLevels(l.txAudioRMS, l.txAudioPeak); + } else if (m2mtr == meterRxAudio) { + if(l.haveRxLevels) + ui->meter2Widget->setLevels(l.rxAudioRMS, l.rxAudioPeak); + } + + /* meterKind m = meterNone; if(l.haveRxLevels) { @@ -634,6 +654,7 @@ void wfmain::receiveNetworkAudioLevels(networkAudioLevels l) m = meterTxMod; receiveMeter(m, l.txAudioRMS); } + */ } void wfmain::setupPlots() From 0f226fdca5e209710a1718300481fab400bc4315 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Wed, 24 Aug 2022 21:52:36 -0700 Subject: [PATCH 045/207] Added tic marks, removed audio RMS calculation for now at least. --- audioconverter.cpp | 7 ++++++- meter.cpp | 17 +++++++++++++++-- udphandler.cpp | 4 ++-- udphandler.h | 2 +- wfmain.cpp | 11 +++++++---- 5 files changed, 31 insertions(+), 10 deletions(-) diff --git a/audioconverter.cpp b/audioconverter.cpp index d25f3f5..58fd58f 100644 --- a/audioconverter.cpp +++ b/audioconverter.cpp @@ -158,7 +158,12 @@ bool audioConverter::convert(audioPacket audio) { audio.amplitudePeak = samplesF.array().abs().maxCoeff(); - audio.amplitudeRMS = samplesF.array().abs().mean(); + //audio.amplitudeRMS = samplesF.array().abs().mean(); // zero for tx audio + //audio.amplitudeRMS = samplesF.norm() / sqrt(samplesF.size()); // too high values. Zero for tx audio. + //audio.amplitudeRMS = samplesF.squaredNorm(); // tx not zero. Values higher than peak sometimes + //audio.amplitudeRMS = samplesF.norm(); // too small values. also too small on TX + //audio.amplitudeRMS = samplesF.blueNorm(); // scale same as norm, too small. + // Set the volume samplesF *= audio.volume; diff --git a/meter.cpp b/meter.cpp index 34dfa01..0c25677 100644 --- a/meter.cpp +++ b/meter.cpp @@ -378,12 +378,25 @@ void meter::drawScale_dBFs(QPainter *qp) //qp->setFont(QFont("Arial", fontSize)); peakRedLevel = 193; - qp->drawText(20+mXstart,scaleTextYstart, QString("-15")); + qp->drawText(20+mXstart-5,scaleTextYstart, QString("-15")); qp->drawText(38+mXstart,scaleTextYstart, QString("-12")); qp->drawText(71+mXstart,scaleTextYstart, QString("-9")); qp->drawText(124+mXstart,scaleTextYstart, QString("-6")); qp->drawText(193+mXstart,scaleTextYstart, QString("-3")); - qp->drawText(255+mXstart,scaleTextYstart, QString("0dB")); + qp->drawText(255+mXstart,scaleTextYstart, QString("0")); + + // Low ticks: + qp->setPen(lowLineColor); + qp->drawLine(20+mXstart,scaleTextYstart, 20+mXstart, scaleTextYstart+5); + qp->drawLine(38+mXstart,scaleTextYstart, 38+mXstart, scaleTextYstart+5); + qp->drawLine(71+mXstart,scaleTextYstart, 71+mXstart, scaleTextYstart+5); + qp->drawLine(124+mXstart,scaleTextYstart, 124+mXstart, scaleTextYstart+5); + + + // High ticks: + qp->setPen(highLineColor); + qp->drawLine(193+mXstart,scaleTextYstart, 193+mXstart, scaleTextYstart+5); + qp->drawLine(255+mXstart,scaleTextYstart, 255+mXstart, scaleTextYstart+5); // Now the lines: qp->setPen(lowLineColor); diff --git a/udphandler.cpp b/udphandler.cpp index f075d6b..a666b90 100644 --- a/udphandler.cpp +++ b/udphandler.cpp @@ -152,7 +152,7 @@ void udpHandler::getRxLevels(quint16 amplitudePeak, quint16 amplitudeRMS,quint16 audioLevelsRxPeak[(audioLevelsRxPosition)%audioLevelBufferSize] = amplitudePeak; audioLevelsRxRMS[(audioLevelsRxPosition)%audioLevelBufferSize] = amplitudeRMS; - if((audioLevelsRxPosition)%3 == 0) + if((audioLevelsRxPosition)%4 == 0) { // calculate mean and emit signal unsigned char meanPeak = findMax(audioLevelsRxPeak); @@ -175,7 +175,7 @@ void udpHandler::getTxLevels(quint16 amplitudePeak, quint16 amplitudeRMS ,quint1 audioLevelsTxPeak[(audioLevelsTxPosition)%audioLevelBufferSize] = amplitudePeak; audioLevelsTxRMS[(audioLevelsTxPosition)%audioLevelBufferSize] = amplitudeRMS; - if((audioLevelsTxPosition)%3 == 0) + if((audioLevelsTxPosition)%4 == 0) { // calculate mean and emit signal unsigned char meanPeak = findMax(audioLevelsTxPeak); diff --git a/udphandler.h b/udphandler.h index 74cca92..157006e 100644 --- a/udphandler.h +++ b/udphandler.h @@ -29,7 +29,7 @@ #include "udpcivdata.h" #include "udpaudio.h" -#define audioLevelBufferSize (3) +#define audioLevelBufferSize (4) // Class to handle the connection/disconnection of the radio. class udpHandler: public udpBase diff --git a/wfmain.cpp b/wfmain.cpp index 5a5ce6b..b7bcb69 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -623,7 +623,9 @@ void wfmain::receiveStatusUpdate(networkStatus status) void wfmain::receiveNetworkAudioLevels(networkAudioLevels l) { + /* meterKind m2mtr = ui->meter2Widget->getMeterType(); + if(m2mtr == meterAudio) { if(amTransmitting) @@ -641,20 +643,21 @@ void wfmain::receiveNetworkAudioLevels(networkAudioLevels l) if(l.haveRxLevels) ui->meter2Widget->setLevels(l.rxAudioRMS, l.rxAudioPeak); } + */ + - /* meterKind m = meterNone; if(l.haveRxLevels) { m = meterRxAudio; - receiveMeter(m, l.rxAudioRMS); + receiveMeter(m, l.rxAudioPeak); } if(l.haveTxLevels) { m = meterTxMod; - receiveMeter(m, l.txAudioRMS); + receiveMeter(m, l.txAudioPeak); } - */ + } void wfmain::setupPlots() From 4f4abfc41a9b8071fb3983b553d2bbe224939490 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Wed, 24 Aug 2022 22:02:20 -0700 Subject: [PATCH 046/207] Cleaner COMP label without the "0" position --- meter.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/meter.cpp b/meter.cpp index 0c25677..09e234b 100644 --- a/meter.cpp +++ b/meter.cpp @@ -177,7 +177,7 @@ void meter::paintEvent(QPaintEvent *) drawScaleId(&painter); break; case meterComp: - label = "CMP"; + label = "CMP(dB)"; peakRedLevel = 100; drawScaleComp(&painter); break; @@ -185,17 +185,17 @@ void meter::paintEvent(QPaintEvent *) return; break; case meterAudio: - label = "dB"; + label = "dBfs"; peakRedLevel = 241; drawScale_dBFs(&painter); break; case meterRxAudio: - label = "Rx"; + label = "Rx(dBfs)"; peakRedLevel = 241; drawScale_dBFs(&painter); break; case meterTxMod: - label = "Tx"; + label = "Tx(dBfs)"; peakRedLevel = 241; drawScale_dBFs(&painter); break; @@ -375,7 +375,6 @@ void meter::drawScaleRaw(QPainter *qp) void meter::drawScale_dBFs(QPainter *qp) { qp->setPen(lowTextColor); - //qp->setFont(QFont("Arial", fontSize)); peakRedLevel = 193; qp->drawText(20+mXstart-5,scaleTextYstart, QString("-15")); @@ -580,6 +579,7 @@ void meter::drawScaleComp(QPainter *qp) float dBperDn = (float)(highPointdB-midPointdB) / float(highPointDn-midPointDn); int i=mXstart; + i+=midPointDn/4; // skip the 0 for cleaner label space for(; idrawText(i,scaleTextYstart, QString("%1").arg( (int)((i-mXstart) * (float(midPointdB) / float(midPointDn)) )) ); From 39cf34af23636043fa85cf338b481ece66e87d92 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Wed, 24 Aug 2022 22:23:32 -0700 Subject: [PATCH 047/207] Fixed dB meter, it needed the scale multiplied by 2. --- meter.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/meter.cpp b/meter.cpp index 09e234b..25990e0 100644 --- a/meter.cpp +++ b/meter.cpp @@ -377,11 +377,12 @@ void meter::drawScale_dBFs(QPainter *qp) qp->setPen(lowTextColor); peakRedLevel = 193; - qp->drawText(20+mXstart-5,scaleTextYstart, QString("-15")); - qp->drawText(38+mXstart,scaleTextYstart, QString("-12")); - qp->drawText(71+mXstart,scaleTextYstart, QString("-9")); - qp->drawText(124+mXstart,scaleTextYstart, QString("-6")); - qp->drawText(193+mXstart,scaleTextYstart, QString("-3")); + if(meterType==meterAudio) + qp->drawText(20+mXstart,scaleTextYstart, QString("-30")); + qp->drawText(38+mXstart+2,scaleTextYstart, QString("-24")); + qp->drawText(71+mXstart,scaleTextYstart, QString("-18")); + qp->drawText(124+mXstart,scaleTextYstart, QString("-12")); + qp->drawText(193+mXstart,scaleTextYstart, QString("-6")); qp->drawText(255+mXstart,scaleTextYstart, QString("0")); // Low ticks: From 76389c0fbddc5d5ab527df45e5d57e7c6c1f4bb8 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Thu, 25 Aug 2022 10:37:46 +0200 Subject: [PATCH 048/207] added color picker support --- CHANGELOG | 4 ++++ WHATSNEW | 16 +++++++++------- wfserver.pro | 2 +- wfview.pro | 2 +- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index a10f418..859d66a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ # CHANGELOG + +- 20220824 + Merge branch 'color' + updated to v1.41 - 20220819 version bumped to 1.4 diff --git a/WHATSNEW b/WHATSNEW index 270f5ae..9563571 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -1,5 +1,5 @@ -The following highlights are in this 1.x-release: +The following highlights are in this 1.41-release: New major change is the audio transport mechanism. Lower latencies. About box updated to include Patreon site @@ -16,12 +16,14 @@ The following highlights are in this 1.x-release: split/combine (or default). Split only makes sense for LAN and Combine for USB. added radio status display with meters for audio (speaker/mic) selector for audio: QT, PortAudio, RealTime audio -+ version bumped to 1.4 -- rethinking of a new version schema that makes more sense -+ temporary squashed logs; may redo later -+ audio fixes at exit -+ introduction of peak decays at the scope -+ resizing of top and bottom scope/waterfall -+ various fixes on the spectrum display + version bumped to 1.4 -- rethinking of a new version schema that makes more sense + temporary squashed logs; may redo later + audio fixes at exit + introduction of peak decays at the scope + resizing of top and bottom scope/waterfall + various fixes on the spectrum display ++ added color picker support for all kinds of vsual elements + Notes: diff --git a/wfserver.pro b/wfserver.pro index 779a7ed..15ccf0e 100644 --- a/wfserver.pro +++ b/wfserver.pro @@ -13,7 +13,7 @@ TEMPLATE = app CONFIG += console -DEFINES += WFVIEW_VERSION=\\\"1.4\\\" +DEFINES += WFVIEW_VERSION=\\\"1.41\\\" DEFINES += BUILD_WFSERVER diff --git a/wfview.pro b/wfview.pro index d9443fb..1e9d2b3 100644 --- a/wfview.pro +++ b/wfview.pro @@ -11,7 +11,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport TARGET = wfview TEMPLATE = app -DEFINES += WFVIEW_VERSION=\\\"1.4\\\" +DEFINES += WFVIEW_VERSION=\\\"1.41\\\" DEFINES += BUILD_WFVIEW From 7145de132f87f4ef3bdb8f8f0994be64861710b9 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Fri, 26 Aug 2022 09:08:23 +0200 Subject: [PATCH 049/207] audiometer support and changes to WHATSNEW/CHANGELOG --- CHANGELOG | 5 +++++ WHATSNEW | 4 ++-- wfserver.pro | 2 +- wfview.pro | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 859d66a..65ce82f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,9 +1,14 @@ # CHANGELOG +- 20220926 Merge branch 'audiometer' + This adds audiometer for the second meter TxAudio, RxAudio and TxRxAudio + updated to v.1.42 - 20220824 Merge branch 'color' + This adds color picker support so that you can define several UI element colors updated to v1.41 + - 20220819 version bumped to 1.4 diff --git a/WHATSNEW b/WHATSNEW index 9563571..f01187c 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -22,8 +22,8 @@ The following highlights are in this 1.41-release: introduction of peak decays at the scope resizing of top and bottom scope/waterfall various fixes on the spectrum display -+ added color picker support for all kinds of vsual elements - ++ 1.41 added color picker support for all kinds of vsual elements ++ 1.42 added three additional second meter choices. RxAudio, TxAdio, and TxRxAudio Notes: diff --git a/wfserver.pro b/wfserver.pro index 15ccf0e..77b4725 100644 --- a/wfserver.pro +++ b/wfserver.pro @@ -13,7 +13,7 @@ TEMPLATE = app CONFIG += console -DEFINES += WFVIEW_VERSION=\\\"1.41\\\" +DEFINES += WFVIEW_VERSION=\\\"1.42\\\" DEFINES += BUILD_WFSERVER diff --git a/wfview.pro b/wfview.pro index 1e9d2b3..9decce0 100644 --- a/wfview.pro +++ b/wfview.pro @@ -11,7 +11,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport TARGET = wfview TEMPLATE = app -DEFINES += WFVIEW_VERSION=\\\"1.41\\\" +DEFINES += WFVIEW_VERSION=\\\"1.42\\\" DEFINES += BUILD_WFVIEW From d658e212200f790e56462514b0d2656f56aefe2c Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Fri, 9 Sep 2022 09:28:52 -0700 Subject: [PATCH 050/207] Fixed issue where build paths with a space in the name would cause the git hash to fail capture. --- wfview.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wfview.pro b/wfview.pro index 9decce0..a94aa2f 100644 --- a/wfview.pro +++ b/wfview.pro @@ -91,7 +91,7 @@ QMAKE_INFO_PLIST = ../wfview/resources/Info.plist !win32:DEFINES += HOST=\\\"`hostname`\\\" UNAME=\\\"`whoami`\\\" -!win32:DEFINES += GITSHORT="\\\"$(shell git -C $$PWD rev-parse --short HEAD)\\\"" +!win32:DEFINES += GITSHORT="\\\"$(shell git -C \"$$PWD\" rev-parse --short HEAD)\\\"" win32:DEFINES += GITSHORT=\\\"$$system(git -C $$PWD rev-parse --short HEAD)\\\" win32:DEFINES += HOST=\\\"wfview.org\\\" From a1d2f57d8b20db0f8bf28742c08de031789c7e17 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Fri, 9 Sep 2022 09:34:31 -0700 Subject: [PATCH 051/207] Main window may now be made smaller. Settings combo box sizes now limited. --- wfmain.ui | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wfmain.ui b/wfmain.ui index bf6abc8..eccb692 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -7,7 +7,7 @@ 0 0 1032 - 569 + 582 @@ -2177,7 +2177,7 @@ - 1 + 0 @@ -2702,7 +2702,7 @@ - 300 + 120 16777215 @@ -2722,7 +2722,7 @@ - 300 + 120 16777215 @@ -4121,7 +4121,7 @@ - 300 + 100 16777215 @@ -4144,7 +4144,7 @@ - 300 + 100 16777215 From 2198e3ca19694c8f3fc90d66ab3e6dd55247dd2f Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Fri, 9 Sep 2022 09:41:32 -0700 Subject: [PATCH 052/207] Found an extra 10 pixels due to some layout padding I left in accidently. --- wfmain.ui | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/wfmain.ui b/wfmain.ui index eccb692..7d6ac6f 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -18,7 +18,7 @@ - 0 + 3 @@ -2153,10 +2153,10 @@ - 10 + 0 - 10 + 0 @@ -2736,9 +2736,12 @@ Qt::Horizontal + + QSizePolicy::Fixed + - 40 + 15 20 @@ -2770,6 +2773,19 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + From c97f0f78261e331846a2b3bd010f319bd0781849 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Fri, 9 Sep 2022 19:54:16 +0200 Subject: [PATCH 053/207] v1.43: resize bug fixed --- CHANGELOG | 16 +++++++++++++++- WHATSNEW | 1 + wfserver.pro | 2 +- wfview.pro | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 65ce82f..7bb3b3f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,21 @@ # CHANGELOG +- 20220909 + Merge branch resize: -- 20220926 Merge branch 'audiometer' + Found an extra 10 pixels due to some layout padding I left in + accidently. + + Main window may now be made smaller. Settings combo box sizes now + limited. + + Fixed issue where build paths with a space in the name would cause the + git hash to fail capture. + + updated to v1.43 + +- 20220826 + Merge branch 'audiometer' This adds audiometer for the second meter TxAudio, RxAudio and TxRxAudio updated to v.1.42 - 20220824 diff --git a/WHATSNEW b/WHATSNEW index f01187c..dbafb9c 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -24,6 +24,7 @@ The following highlights are in this 1.41-release: various fixes on the spectrum display + 1.41 added color picker support for all kinds of vsual elements + 1.42 added three additional second meter choices. RxAudio, TxAdio, and TxRxAudio ++ 1.43 fixed resizing issues. Notes: diff --git a/wfserver.pro b/wfserver.pro index 77b4725..24a5bef 100644 --- a/wfserver.pro +++ b/wfserver.pro @@ -13,7 +13,7 @@ TEMPLATE = app CONFIG += console -DEFINES += WFVIEW_VERSION=\\\"1.42\\\" +DEFINES += WFVIEW_VERSION=\\\"1.43\\\" DEFINES += BUILD_WFSERVER diff --git a/wfview.pro b/wfview.pro index a94aa2f..e43a11c 100644 --- a/wfview.pro +++ b/wfview.pro @@ -11,7 +11,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport TARGET = wfview TEMPLATE = app -DEFINES += WFVIEW_VERSION=\\\"1.42\\\" +DEFINES += WFVIEW_VERSION=\\\"1.43\\\" DEFINES += BUILD_WFVIEW From 3290b64a0b765a70d82039755770f77735c1326d Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Wed, 14 Sep 2022 17:07:23 -0700 Subject: [PATCH 054/207] Added logging window capability with termbin support. --- logcategories.cpp | 1 + logcategories.h | 1 + loggingwindow.cpp | 152 ++++++++++++++++++++++++++++++++++++++++ loggingwindow.h | 59 ++++++++++++++++ loggingwindow.ui | 172 ++++++++++++++++++++++++++++++++++++++++++++++ main.cpp | 21 ++++-- wfmain.cpp | 122 +++++++++++++++++++++++++++++++- wfmain.h | 16 ++++- wfmain.ui | 9 ++- wfview.pro | 3 + 10 files changed, 547 insertions(+), 9 deletions(-) create mode 100644 loggingwindow.cpp create mode 100644 loggingwindow.h create mode 100644 loggingwindow.ui diff --git a/logcategories.cpp b/logcategories.cpp index da4c6d7..3b9e0cd 100644 --- a/logcategories.cpp +++ b/logcategories.cpp @@ -3,6 +3,7 @@ Q_LOGGING_CATEGORY(logSystem, "system") Q_LOGGING_CATEGORY(logSerial, "serial") Q_LOGGING_CATEGORY(logGui, "gui") +Q_LOGGING_CATEGORY(logUser, "user") Q_LOGGING_CATEGORY(logRig, "rig") Q_LOGGING_CATEGORY(logAudio, "audio") Q_LOGGING_CATEGORY(logUdp, "udp") diff --git a/logcategories.h b/logcategories.h index 987278d..82cca61 100644 --- a/logcategories.h +++ b/logcategories.h @@ -6,6 +6,7 @@ Q_DECLARE_LOGGING_CATEGORY(logSystem) Q_DECLARE_LOGGING_CATEGORY(logSerial) Q_DECLARE_LOGGING_CATEGORY(logGui) +Q_DECLARE_LOGGING_CATEGORY(logUser) Q_DECLARE_LOGGING_CATEGORY(logRig) Q_DECLARE_LOGGING_CATEGORY(logAudio) Q_DECLARE_LOGGING_CATEGORY(logUdp) diff --git a/loggingwindow.cpp b/loggingwindow.cpp new file mode 100644 index 0000000..9903d1b --- /dev/null +++ b/loggingwindow.cpp @@ -0,0 +1,152 @@ +#include "loggingwindow.h" +#include "ui_loggingwindow.h" + +loggingWindow::loggingWindow(QWidget *parent) : + QWidget(parent), + ui(new Ui::loggingWindow) +{ + ui->setupUi(this); + ui->logTextDisplay->setReadOnly(true); + ui->userAnnotationText->setFocus(); + ui->annotateBtn->setDefault(true); + ui->logTextDisplay->setFocusPolicy(Qt::NoFocus); + ui->annotateBtn->setFocusPolicy(Qt::NoFocus); + +#ifdef Q_OS_MAC + logFilename = QStandardPaths::standardLocations(QStandardPaths::DownloadLocation)[0] + "/wfview.log"; + logDirectory = QStandardPaths::standardLocations(QStandardPaths::DownloadLocation)[0]; + +#else + logFilename= QStandardPaths::standardLocations(QStandardPaths::TempLocation)[0] + "/wfview.log"; + logDirectory = QStandardPaths::standardLocations(QStandardPaths::TempLocation)[0]; +#endif + clipboard = QApplication::clipboard(); + socket = new QTcpSocket(this); + connect(socket, SIGNAL(connected()), this, SLOT(connectedToHost())); + connect(socket, SIGNAL(disconnected()), this, SLOT(disconnectedFromHost())); + connect(socket, SIGNAL(readyRead()), this, SLOT(handleDataFromLoggingHost())); + connect(socket, SIGNAL(hostFound()), this, SLOT(handleLoggingHostError())); + connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(handleLoggingHostError(QAbstractSocket::SocketError))); +} + +loggingWindow::~loggingWindow() +{ + QMutexLocker lock(&textMutex); + delete ui; +} + +void loggingWindow::acceptLogText(QString text) +{ + QMutexLocker lock(&textMutex); + ui->logTextDisplay->appendPlainText(text); +} + +void loggingWindow::sendToTermbin() +{ + qInfo(logGui()) << "Sending data to termbin.com. Standby."; + socket->connectToHost("termbin.com", 9999); + ui->sendToPasteBtn->setDisabled(true); +} + +void loggingWindow::handleDataFromLoggingHost() +{ + qInfo(logGui()) << "Receiving data from logging host."; + QString URL; + QByteArray data = socket->readAll(); + if(data.length() < 256) + { + URL = QString(data).trimmed(); + if(!URL.isEmpty()) + { + clipboard->setText(URL); + qInfo(logGui()) << "Sent log to URL: " << URL; + msgBox.setText("Your log has been posted, and the URL has been copied to the clipboard."); + msgBox.setInformativeText(URL); + msgBox.exec(); + } + } else { + qDebug(logGui()) << "Error, return from logging host too large. Received " << data.length() << " bytes."; + } +} + +void loggingWindow::disconnectedFromHost() +{ + qInfo(logGui()) << "Disconnected from logging host"; + ui->sendToPasteBtn->setDisabled(false); +} + +void loggingWindow::connectedToHost() +{ + qInfo(logGui()) << "Connected to logging host"; + QMutexLocker lock(&textMutex); + QTextStream outText(socket); + outText << ui->logTextDisplay->toPlainText(); + outText << "\n----------\nSent from wfview version "; + outText << WFVIEW_VERSION << "\n----------\n"; +} + +void loggingWindow::handleLoggingHostError(QAbstractSocket::SocketError error) +{ + qInfo(logGui()) << "Error connecting to logging host. Check internet connection. Error code: " << error; +} + +void loggingWindow::on_clearDisplayBtn_clicked() +{ + QMutexLocker lock(&textMutex); + // Only clears the displayed text, not the log file. + ui->logTextDisplay->clear(); +} + +void loggingWindow::on_openDirBtn_clicked() +{ + QString cmd; +#ifdef Q_OS_MAC + cmd = "open " + logDirectory; +#endif +#ifdef Q_OS_LINUX + cmd = "xdg-open " + logDirectory; +#endif +#ifdef Q_OS_WIN + cmd = "start " + logDirectory; +#endif + system(cmd.toLocal8Bit().data()); +} + +void loggingWindow::on_openLogFileBtn_clicked() +{ + QString cmd; +#ifdef Q_OS_MAC + cmd = "open " + logFilename; +#endif +#ifdef Q_OS_LINUX + cmd = "xdg-open " + logFilename; +#endif +#ifdef Q_OS_WIN + cmd = "start " + logFilename; +#endif + system(cmd.toLocal8Bit().data()); +} + +void loggingWindow::on_sendToPasteBtn_clicked() +{ + sendToTermbin(); +} + +void loggingWindow::on_annotateBtn_clicked() +{ + QMutexLocker lock(&textMutex); + if(ui->userAnnotationText->text().isEmpty()) + return; + qInfo(logUser()) << ui->userAnnotationText->text(); + ui->userAnnotationText->clear(); +} + +void loggingWindow::on_userAnnotationText_returnPressed() +{ + on_annotateBtn_clicked(); +} + +void loggingWindow::on_copyPathBtn_clicked() +{ + clipboard->setText(logFilename); +} diff --git a/loggingwindow.h b/loggingwindow.h new file mode 100644 index 0000000..f75044c --- /dev/null +++ b/loggingwindow.h @@ -0,0 +1,59 @@ +#ifndef LOGGINGWINDOW_H +#define LOGGINGWINDOW_H + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "logcategories.h" + +namespace Ui { +class loggingWindow; +} + +class loggingWindow : public QWidget +{ + Q_OBJECT + +public: + explicit loggingWindow(QWidget *parent = nullptr); + ~loggingWindow(); + void acceptLogText(QString text); + +private slots: + void connectedToHost(); + void disconnectedFromHost(); + void handleDataFromLoggingHost(); + void handleLoggingHostError(QAbstractSocket::SocketError); + + void on_clearDisplayBtn_clicked(); + + void on_openDirBtn_clicked(); + + void on_openLogFileBtn_clicked(); + + void on_sendToPasteBtn_clicked(); + + void on_annotateBtn_clicked(); + + void on_userAnnotationText_returnPressed(); + + void on_copyPathBtn_clicked(); + +private: + Ui::loggingWindow *ui; + QClipboard *clipboard; + QMessageBox msgBox; + QMutex textMutex; + QString logFilename; + QString logDirectory; + QTcpSocket *socket; + void sendToTermbin(); +}; + +#endif // LOGGINGWINDOW_H diff --git a/loggingwindow.ui b/loggingwindow.ui new file mode 100644 index 0000000..81c7d62 --- /dev/null +++ b/loggingwindow.ui @@ -0,0 +1,172 @@ + + + loggingWindow + + + + 0 + 0 + 554 + 300 + + + + Form + + + + + + + Ubuntu Mono + + + + true + + + + + + + 0 + + + 0 + + + + + + 75 + 0 + + + + + 75 + 16777215 + + + + Annotation: + + + + + + + + 290 + 0 + + + + + Ubuntu Mono + + + + + + + + + 85 + 0 + + + + + 85 + 16777215 + + + + Adds user-text to the log. + + + Annotate + + + + + + + + + 0 + + + 0 + + + + + Clears the display. Does not clear the log file. + + + Clear Display + + + + + + + Makes a best-effort to ask the host system to open the log file directory. + + + Open Log Directory + + + + + + + Makes a best-effort to ask the host system to open the logfile. + + + Open Log + + + + + + + Copy the path of the log file to your clipboard. + + + Copy Path + + + + + + + <html><head/><body><p>Sends text to termbin.com. Some personal information (such as your username) is in the log file, so do not click this button unless you are ok sharing your log file. This is a quick way to receive a URL, pointing to your log file text, that you can send to other people. </p></body></html> + + + Send to Termbin.com + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + diff --git a/main.cpp b/main.cpp index 8e945ae..d74e959 100644 --- a/main.cpp +++ b/main.cpp @@ -12,13 +12,16 @@ #include #include "wfmain.h" + +// Copyright 2017-2022 Elliott H. Liggett #include "logcategories.h" -// Copyright 2017-2021 Elliott H. Liggett - +#ifdef BUILD_WFSERVER // Smart pointer to log file QScopedPointer m_logFile; QMutex logMutex; +#endif + bool debugMode=false; #ifdef BUILD_WFSERVER @@ -42,9 +45,9 @@ bool debugMode=false; #endif } -#endif void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg); +#endif int main(int argc, char *argv[]) { @@ -65,7 +68,7 @@ int main(int argc, char *argv[]) #endif #ifdef QT_DEBUG - debugMode = true; + //debugMode = true; #endif QString serialPortCL; @@ -160,12 +163,15 @@ int main(int argc, char *argv[]) } +#ifdef BUILD_WFSERVER + // Set the logging file before doing anything else. m_logFile.reset(new QFile(logFilename)); // Open the file logging m_logFile.data()->open(QFile::WriteOnly | QFile::Truncate | QFile::Text); // Set handler qInstallMessageHandler(messageHandler); +#endif qInfo(logSystem()) << version; qDebug(logSystem()) << QString("SerialPortCL as set by parser: %1").arg(serialPortCL); @@ -183,7 +189,7 @@ int main(int argc, char *argv[]) w = new servermain(serialPortCL, hostCL, settingsFile); #else a.setWheelScrollLines(1); // one line per wheel click - wfmain w(serialPortCL, hostCL, settingsFile); + wfmain w(serialPortCL, hostCL, settingsFile, debugMode); w.show(); #endif @@ -191,6 +197,7 @@ int main(int argc, char *argv[]) } +#ifdef BUILD_WFSERVER void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg) { @@ -201,6 +208,7 @@ void messageHandler(QtMsgType type, const QMessageLogContext& context, const QSt } QMutexLocker locker(&logMutex); QTextStream out(m_logFile.data()); + QString text; // Write the date of recording out << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz "); @@ -229,5 +237,8 @@ void messageHandler(QtMsgType type, const QMessageLogContext& context, const QSt #ifdef BUILD_WFSERVER std::cout << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz ").toLocal8Bit().toStdString() << msg.toLocal8Bit().toStdString() << "\n"; #endif + text = out.readAll(); out.flush(); // Clear the buffered data + //mainwindow.handleLogText(test); } +#endif diff --git a/wfmain.cpp b/wfmain.cpp index b7bcb69..0f62b6e 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -5,10 +5,22 @@ #include "rigidentities.h" #include "logcategories.h" -// This code is copyright 2017-2020 Elliott H. Liggett +// This code is copyright 2017-2022 Elliott H. Liggett // All rights reserved -wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString settingsFile, QWidget *parent ) : +// Log support: +//static void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg); +QScopedPointer m_logFile; +QMutex logMutex; +QMutex logTextMutex; +QVector logStringBuffer; +#ifdef QT_DEBUG +bool debugModeLogging = true; +#else +bool debugModeLogging = false; +#endif + +wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString settingsFile, bool debugMode, QWidget *parent ) : QMainWindow(parent), ui(new Ui::wfmain) { @@ -16,10 +28,14 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s QGuiApplication::setApplicationName(QString("wfview")); setWindowIcon(QIcon( QString(":resources/wfview.png"))); + this->debugMode = debugMode; + debugModeLogging = debugMode; ui->setupUi(this); setWindowTitle(QString("wfview")); + initLogging(); + this->serialPortCL = serialPortCL; this->hostCL = hostCL; @@ -29,6 +45,7 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s trxadj = new transceiverAdjustments(); abtBox = new aboutbox(); selRad = new selectRadio(); + logWindow = new loggingWindow(); qRegisterMetaType(); // Needs to be registered early. qRegisterMetaType(); @@ -6932,3 +6949,104 @@ void wfmain::on_colorSavePresetBtn_clicked() settings->endGroup(); settings->sync(); } + +void wfmain::on_showLogBtn_clicked() +{ + logWindow->show(); +} + +void wfmain::initLogging() +{ +#ifdef Q_OS_MAC + logFilename= QStandardPaths::standardLocations(QStandardPaths::DownloadLocation)[0] + "/wfview.log"; +#else + logFilename= QStandardPaths::standardLocations(QStandardPaths::TempLocation)[0] + "/wfview.log"; +#endif + // Set the logging file before doing anything else. + m_logFile.reset(new QFile(logFilename)); + // Open the file logging + m_logFile.data()->open(QFile::WriteOnly | QFile::Truncate | QFile::Text); + // Set handler + qInstallMessageHandler(messageHandler); + + logCheckingTimer.setInterval(50); + connect(&logCheckingTimer, SIGNAL(timeout()), this, SLOT(logCheck())); + logCheckingTimer.start(); +} + +void wfmain::logCheck() +{ + // This is called by a timer to check for new log messages and copy + // the messages into the logWindow. + QMutexLocker locker(&logTextMutex); + int size = logStringBuffer.size(); + for(int i=0; i < size; i++) + { + handleLogText(logStringBuffer.back()); + logStringBuffer.pop_back(); + } +} + +void wfmain::handleLogText(QString text) +{ + // This function is just a pass-through + logWindow->acceptLogText(text); +} + +void wfmain::messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg) +{ + // Open stream file writes + + // TODO: Fix this parameter: + + if (type == QtDebugMsg && !debugModeLogging) + { + return; + } + + QMutexLocker locker(&logMutex); + QTextStream out(m_logFile.data()); + QString text; + + // Write the date of recording + out << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz "); + text.append(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz ")); + // By type determine to what level belongs message + + switch (type) + { + case QtDebugMsg: + out << "DBG "; + text.append("DBG "); + break; + case QtInfoMsg: + out << "INF "; + text.append("INF "); + break; + case QtWarningMsg: + out << "WRN "; + text.append("WRN "); + break; + case QtCriticalMsg: + out << "CRT "; + text.append("CRT "); + break; + case QtFatalMsg: + out << "FTL "; + text.append("FLT "); + break; + } + // Write to the output category of the message and the message itself + out << context.category << ": " << msg << "\n"; + out.flush(); // Clear the buffered data + + text.append(context.category); + text.append(": "); + text.append(msg); + logTextMutex.lock(); + logStringBuffer.push_back(text); + logTextMutex.unlock(); + //logStringBuffer[logStringBufferPosition%logStringBufferSize] = text; + //logStringBufferPosition++; +} + diff --git a/wfmain.h b/wfmain.h index a8120a9..88a806a 100644 --- a/wfmain.h +++ b/wfmain.h @@ -38,6 +38,7 @@ #include "aboutbox.h" #include "selectradio.h" #include "colorprefs.h" +#include "loggingwindow.h" #include #include @@ -63,10 +64,12 @@ class wfmain : public QMainWindow Q_OBJECT public: - explicit wfmain(const QString serialPortCL, const QString hostCL, const QString settingsFile, QWidget *parent = 0); + explicit wfmain(const QString serialPortCL, const QString hostCL, const QString settingsFile, bool debugMode, QWidget *parent = 0); QString serialPortCL; QString hostCL; ~wfmain(); + static void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg); + void handleLogText(QString text); signals: // Basic to rig: @@ -292,6 +295,7 @@ private slots: void radioSelection(QList radios); void setRadioTimeDateSend(); + void logCheck(); // void on_getFreqBtn_clicked(); @@ -636,9 +640,12 @@ private slots: void on_colorSavePresetBtn_clicked(); + void on_showLogBtn_clicked(); + private: Ui::wfmain *ui; void closeEvent(QCloseEvent *event); + bool debugMode; QSettings *settings=Q_NULLPTR; void loadSettings(); void saveSettings(); @@ -646,6 +653,11 @@ private: void createSettingsListItems(); void connectSettingsList(); + void initLogging(); + QTimer logCheckingTimer; + int logCheckingOldPosition = 0; + QString logFilename; + QCustomPlot *plot; // line plot QCustomPlot *wf; // waterfall image QCPItemLine * freqIndicatorLine; @@ -976,6 +988,7 @@ private: transceiverAdjustments *trxadj; aboutbox *abtBox; selectRadio *selRad; + loggingWindow *logWindow; udpServer* udp = Q_NULLPTR; rigCtlD* rigCtl = Q_NULLPTR; @@ -1027,6 +1040,7 @@ Q_DECLARE_METATYPE(enum spectrumMode) Q_DECLARE_METATYPE(QList) Q_DECLARE_METATYPE(rigstate*) +//void (*wfmain::logthistext)(QString text) = NULL; #endif // WFMAIN_H #endif diff --git a/wfmain.ui b/wfmain.ui index 7d6ac6f..234d3b5 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -3262,7 +3262,7 @@ 0 0 - 767 + 204 582 @@ -4609,6 +4609,13 @@ + + + + Log + + + diff --git a/wfview.pro b/wfview.pro index e43a11c..797e98f 100644 --- a/wfview.pro +++ b/wfview.pro @@ -147,6 +147,7 @@ win32:INCLUDEPATH += ../r8brain-free-src INCLUDEPATH += resampler SOURCES += main.cpp\ + loggingwindow.cpp \ wfmain.cpp \ commhandler.cpp \ rigcommander.cpp \ @@ -178,6 +179,7 @@ SOURCES += main.cpp\ HEADERS += wfmain.h \ colorprefs.h \ commhandler.h \ + loggingwindow.h \ rigcommander.h \ freqmemory.h \ rigidentities.h \ @@ -213,6 +215,7 @@ HEADERS += wfmain.h \ FORMS += wfmain.ui \ calibrationwindow.ui \ + loggingwindow.ui \ satellitesetup.ui \ selectradio.ui \ repeatersetup.ui \ From 8b688548c20aaad0916712be616bc75bb239741a Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Wed, 14 Sep 2022 17:53:22 -0700 Subject: [PATCH 055/207] Keep the logging window up after the message box. Added "log" logging category. --- logcategories.cpp | 1 + logcategories.h | 1 + loggingwindow.cpp | 31 ++++++++++++++++++++++--------- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/logcategories.cpp b/logcategories.cpp index 3b9e0cd..c5a7bdc 100644 --- a/logcategories.cpp +++ b/logcategories.cpp @@ -3,6 +3,7 @@ Q_LOGGING_CATEGORY(logSystem, "system") Q_LOGGING_CATEGORY(logSerial, "serial") Q_LOGGING_CATEGORY(logGui, "gui") +Q_LOGGING_CATEGORY(logLogger, "log") Q_LOGGING_CATEGORY(logUser, "user") Q_LOGGING_CATEGORY(logRig, "rig") Q_LOGGING_CATEGORY(logAudio, "audio") diff --git a/logcategories.h b/logcategories.h index 82cca61..3fbfae3 100644 --- a/logcategories.h +++ b/logcategories.h @@ -6,6 +6,7 @@ Q_DECLARE_LOGGING_CATEGORY(logSystem) Q_DECLARE_LOGGING_CATEGORY(logSerial) Q_DECLARE_LOGGING_CATEGORY(logGui) +Q_DECLARE_LOGGING_CATEGORY(logLogger) Q_DECLARE_LOGGING_CATEGORY(logUser) Q_DECLARE_LOGGING_CATEGORY(logRig) Q_DECLARE_LOGGING_CATEGORY(logAudio) diff --git a/loggingwindow.cpp b/loggingwindow.cpp index 9903d1b..10eeea3 100644 --- a/loggingwindow.cpp +++ b/loggingwindow.cpp @@ -6,6 +6,7 @@ loggingWindow::loggingWindow(QWidget *parent) : ui(new Ui::loggingWindow) { ui->setupUi(this); + this->setWindowTitle("Log"); ui->logTextDisplay->setReadOnly(true); ui->userAnnotationText->setFocus(); ui->annotateBtn->setDefault(true); @@ -25,7 +26,6 @@ loggingWindow::loggingWindow(QWidget *parent) : connect(socket, SIGNAL(connected()), this, SLOT(connectedToHost())); connect(socket, SIGNAL(disconnected()), this, SLOT(disconnectedFromHost())); connect(socket, SIGNAL(readyRead()), this, SLOT(handleDataFromLoggingHost())); - connect(socket, SIGNAL(hostFound()), this, SLOT(handleLoggingHostError())); connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(handleLoggingHostError(QAbstractSocket::SocketError))); } @@ -43,14 +43,14 @@ void loggingWindow::acceptLogText(QString text) void loggingWindow::sendToTermbin() { - qInfo(logGui()) << "Sending data to termbin.com. Standby."; + qInfo(logLogger()) << "Sending data to termbin.com. Standby."; socket->connectToHost("termbin.com", 9999); ui->sendToPasteBtn->setDisabled(true); } void loggingWindow::handleDataFromLoggingHost() { - qInfo(logGui()) << "Receiving data from logging host."; + qInfo(logLogger()) << "Receiving data from logging host."; QString URL; QByteArray data = socket->readAll(); if(data.length() < 256) @@ -59,25 +59,29 @@ void loggingWindow::handleDataFromLoggingHost() if(!URL.isEmpty()) { clipboard->setText(URL); - qInfo(logGui()) << "Sent log to URL: " << URL; + qInfo(logLogger()) << "Sent log to URL: " << URL; msgBox.setText("Your log has been posted, and the URL has been copied to the clipboard."); - msgBox.setInformativeText(URL); + msgBox.setInformativeText("" + URL + ""); msgBox.exec(); + // For whatever reason, showing the message box hides this window. + this->show(); + this->raise(); + this->activateWindow(); } } else { - qDebug(logGui()) << "Error, return from logging host too large. Received " << data.length() << " bytes."; + qDebug(logLogger()) << "Error, return from logging host too large. Received " << data.length() << " bytes."; } } void loggingWindow::disconnectedFromHost() { - qInfo(logGui()) << "Disconnected from logging host"; + qInfo(logLogger()) << "Disconnected from logging host"; ui->sendToPasteBtn->setDisabled(false); } void loggingWindow::connectedToHost() { - qInfo(logGui()) << "Connected to logging host"; + qInfo(logLogger()) << "Connected to logging host"; QMutexLocker lock(&textMutex); QTextStream outText(socket); outText << ui->logTextDisplay->toPlainText(); @@ -87,7 +91,16 @@ void loggingWindow::connectedToHost() void loggingWindow::handleLoggingHostError(QAbstractSocket::SocketError error) { - qInfo(logGui()) << "Error connecting to logging host. Check internet connection. Error code: " << error; + switch(error) + { + case QAbstractSocket::RemoteHostClosedError: + qInfo(logLogger()) << "Disconnected from logging host."; + break; + + default: + qInfo(logLogger()) << "Error connecting to logging host. Check internet connection. Error code: " << error; + break; + } } void loggingWindow::on_clearDisplayBtn_clicked() From 1b6cff85f4ce04178c2d6a4c4b6d2ba79ba1b42c Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Wed, 14 Sep 2022 18:15:20 -0700 Subject: [PATCH 056/207] Removed audio volume logging. --- audiohandler.cpp | 1 - pahandler.cpp | 3 --- rthandler.cpp | 3 --- 3 files changed, 7 deletions(-) diff --git a/audiohandler.cpp b/audiohandler.cpp index 3f68bd8..2244960 100644 --- a/audiohandler.cpp +++ b/audiohandler.cpp @@ -230,7 +230,6 @@ void audioHandler::stop() void audioHandler::setVolume(unsigned char volume) { this->volume = audiopot[volume]; - qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "setVolume: " << volume << "(" << this->volume << ")"; } diff --git a/pahandler.cpp b/pahandler.cpp index d27886c..a3c4860 100644 --- a/pahandler.cpp +++ b/pahandler.cpp @@ -214,14 +214,11 @@ bool paHandler::init(audioSetup setup) void paHandler::setVolume(unsigned char volume) { - #ifdef Q_OS_WIN this->volume = audiopot[volume] * 5; #else this->volume = audiopot[volume]; #endif - - qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "setVolume: " << volume << "(" << this->volume << ")"; } void paHandler::incomingAudio(audioPacket packet) diff --git a/rthandler.cpp b/rthandler.cpp index b203402..f1d7313 100644 --- a/rthandler.cpp +++ b/rthandler.cpp @@ -253,10 +253,7 @@ errorHandler: void rtHandler::setVolume(unsigned char volume) { - this->volume = audiopot[volume]; - - qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "setVolume: " << volume << "(" << this->volume << ")"; } void rtHandler::incomingAudio(audioPacket packet) From 73b9c88e5e84f09b131d78b1b3987dacec8edf4f Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Wed, 14 Sep 2022 18:32:28 -0700 Subject: [PATCH 057/207] Cut log window polling rate in half for lower CPU. 100ms is plenty fast. --- wfmain.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 0f62b6e..7e1b1ab 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6969,7 +6969,8 @@ void wfmain::initLogging() // Set handler qInstallMessageHandler(messageHandler); - logCheckingTimer.setInterval(50); + // Interval timer for log window updates: + logCheckingTimer.setInterval(100); connect(&logCheckingTimer, SIGNAL(timeout()), this, SLOT(logCheck())); logCheckingTimer.start(); } @@ -6997,8 +6998,6 @@ void wfmain::messageHandler(QtMsgType type, const QMessageLogContext& context, c { // Open stream file writes - // TODO: Fix this parameter: - if (type == QtDebugMsg && !debugModeLogging) { return; @@ -7046,7 +7045,5 @@ void wfmain::messageHandler(QtMsgType type, const QMessageLogContext& context, c logTextMutex.lock(); logStringBuffer.push_back(text); logTextMutex.unlock(); - //logStringBuffer[logStringBufferPosition%logStringBufferSize] = text; - //logStringBufferPosition++; } From 42e3ee444dd755d9009d82b63435db2038de4fe1 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Wed, 14 Sep 2022 18:35:45 -0700 Subject: [PATCH 058/207] Removed word wrapping from the log --- loggingwindow.ui | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/loggingwindow.ui b/loggingwindow.ui index 81c7d62..19587d1 100644 --- a/loggingwindow.ui +++ b/loggingwindow.ui @@ -21,6 +21,12 @@ Ubuntu Mono + + false + + + QPlainTextEdit::NoWrap + true From 95994ed737fa553d40566b87ee23afb99cdb7abe Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 15 Sep 2022 09:33:09 -0700 Subject: [PATCH 059/207] Restored version to log file, fixed reversed log entries. --- loggingwindow.cpp | 10 ++++++++-- loggingwindow.h | 3 +++ wfmain.cpp | 8 +++++++- wfmain.h | 1 + 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/loggingwindow.cpp b/loggingwindow.cpp index 10eeea3..342e0b7 100644 --- a/loggingwindow.cpp +++ b/loggingwindow.cpp @@ -113,6 +113,7 @@ void loggingWindow::on_clearDisplayBtn_clicked() void loggingWindow::on_openDirBtn_clicked() { QString cmd; + int rtnval = 0; #ifdef Q_OS_MAC cmd = "open " + logDirectory; #endif @@ -122,12 +123,15 @@ void loggingWindow::on_openDirBtn_clicked() #ifdef Q_OS_WIN cmd = "start " + logDirectory; #endif - system(cmd.toLocal8Bit().data()); + rtnval = system(cmd.toLocal8Bit().data()); + if(rtnval) + qInfo(logLogger()) << "Error, open log directory command returned error code " << rtnval; } void loggingWindow::on_openLogFileBtn_clicked() { QString cmd; + int rtnval = 0; #ifdef Q_OS_MAC cmd = "open " + logFilename; #endif @@ -137,7 +141,9 @@ void loggingWindow::on_openLogFileBtn_clicked() #ifdef Q_OS_WIN cmd = "start " + logFilename; #endif - system(cmd.toLocal8Bit().data()); + rtnval = system(cmd.toLocal8Bit().data()); + if(rtnval) + qInfo(logLogger()) << "Error, open log file command returned error code " << rtnval; } void loggingWindow::on_sendToPasteBtn_clicked() diff --git a/loggingwindow.h b/loggingwindow.h index f75044c..ca57585 100644 --- a/loggingwindow.h +++ b/loggingwindow.h @@ -45,6 +45,9 @@ private slots: void on_copyPathBtn_clicked(); +signals: + void setDebugMode(bool debugOn); + private: Ui::loggingWindow *ui; QClipboard *clipboard; diff --git a/wfmain.cpp b/wfmain.cpp index 7e1b1ab..4feb158 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -30,11 +30,17 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s setWindowIcon(QIcon( QString(":resources/wfview.png"))); this->debugMode = debugMode; debugModeLogging = debugMode; + version = QString("wfview version: %1 (Git:%2 on %3 at %4 by %5@%6)\nOperating System: %7 (%8)\nBuild Qt Version %9. Current Qt Version: %10\n") + .arg(QString(WFVIEW_VERSION)) + .arg(GITSHORT).arg(__DATE__).arg(__TIME__).arg(UNAME).arg(HOST) + .arg(QSysInfo::prettyProductName()).arg(QSysInfo::buildCpuArchitecture()) + .arg(QT_VERSION_STR).arg(qVersion()); ui->setupUi(this); setWindowTitle(QString("wfview")); initLogging(); + qInfo(logSystem()) << version; this->serialPortCL = serialPortCL; this->hostCL = hostCL; @@ -7043,7 +7049,7 @@ void wfmain::messageHandler(QtMsgType type, const QMessageLogContext& context, c text.append(": "); text.append(msg); logTextMutex.lock(); - logStringBuffer.push_back(text); + logStringBuffer.push_front(text); logTextMutex.unlock(); } diff --git a/wfmain.h b/wfmain.h index 88a806a..2d2563d 100644 --- a/wfmain.h +++ b/wfmain.h @@ -646,6 +646,7 @@ private: Ui::wfmain *ui; void closeEvent(QCloseEvent *event); bool debugMode; + QString version; QSettings *settings=Q_NULLPTR; void loadSettings(); void saveSettings(); From 2225953d039c7d06723750d0c1ca85b3bdf3d606 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 15 Sep 2022 09:42:19 -0700 Subject: [PATCH 060/207] Added debug logging button, however, it doesn't propagate the debug signal through all the modules yet. So, for now, it is hidden. --- loggingwindow.cpp | 7 +++++++ loggingwindow.h | 2 ++ loggingwindow.ui | 10 ++++++++++ wfmain.cpp | 9 ++++++++- wfmain.h | 1 + 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/loggingwindow.cpp b/loggingwindow.cpp index 342e0b7..1e0a1ae 100644 --- a/loggingwindow.cpp +++ b/loggingwindow.cpp @@ -27,6 +27,8 @@ loggingWindow::loggingWindow(QWidget *parent) : connect(socket, SIGNAL(disconnected()), this, SLOT(disconnectedFromHost())); connect(socket, SIGNAL(readyRead()), this, SLOT(handleDataFromLoggingHost())); connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(handleLoggingHostError(QAbstractSocket::SocketError))); + + ui->debugBtn->setHidden(true); // this button doesn't work yet. } loggingWindow::~loggingWindow() @@ -169,3 +171,8 @@ void loggingWindow::on_copyPathBtn_clicked() { clipboard->setText(logFilename); } + +void loggingWindow::on_debugBtn_clicked(bool checked) +{ + emit setDebugMode(checked); +} diff --git a/loggingwindow.h b/loggingwindow.h index ca57585..c331700 100644 --- a/loggingwindow.h +++ b/loggingwindow.h @@ -45,6 +45,8 @@ private slots: void on_copyPathBtn_clicked(); + void on_debugBtn_clicked(bool checked); + signals: void setDebugMode(bool debugOn); diff --git a/loggingwindow.ui b/loggingwindow.ui index 19587d1..87b2751 100644 --- a/loggingwindow.ui +++ b/loggingwindow.ui @@ -106,6 +106,16 @@ 0 + + + + Enable or disable debug logging + + + Debug + + + diff --git a/wfmain.cpp b/wfmain.cpp index 4feb158..efd8384 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -39,6 +39,7 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s setWindowTitle(QString("wfview")); + logWindow = new loggingWindow(); initLogging(); qInfo(logSystem()) << version; @@ -51,7 +52,6 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s trxadj = new transceiverAdjustments(); abtBox = new aboutbox(); selRad = new selectRadio(); - logWindow = new loggingWindow(); qRegisterMetaType(); // Needs to be registered early. qRegisterMetaType(); @@ -6975,6 +6975,8 @@ void wfmain::initLogging() // Set handler qInstallMessageHandler(messageHandler); + connect(logWindow, SIGNAL(setDebugMode(bool)), this, SLOT(setDebugLogging(bool))); + // Interval timer for log window updates: logCheckingTimer.setInterval(100); connect(&logCheckingTimer, SIGNAL(timeout()), this, SLOT(logCheck())); @@ -7000,6 +7002,11 @@ void wfmain::handleLogText(QString text) logWindow->acceptLogText(text); } +void wfmain::setDebugLogging(bool debugModeOn) +{ + this->debugMode = debugModeOn; +} + void wfmain::messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg) { // Open stream file writes diff --git a/wfmain.h b/wfmain.h index 2d2563d..337f3b1 100644 --- a/wfmain.h +++ b/wfmain.h @@ -296,6 +296,7 @@ private slots: void setRadioTimeDateSend(); void logCheck(); + void setDebugLogging(bool debugModeOn); // void on_getFreqBtn_clicked(); From d25c9ca2459f399fdc8f6df11f742bfe367736e8 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 15 Sep 2022 09:49:03 -0700 Subject: [PATCH 061/207] Removed extra output on non-server builds. --- main.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index d74e959..e317348 100644 --- a/main.cpp +++ b/main.cpp @@ -171,13 +171,12 @@ int main(int argc, char *argv[]) m_logFile.data()->open(QFile::WriteOnly | QFile::Truncate | QFile::Text); // Set handler qInstallMessageHandler(messageHandler); -#endif qInfo(logSystem()) << version; qDebug(logSystem()) << QString("SerialPortCL as set by parser: %1").arg(serialPortCL); qDebug(logSystem()) << QString("remote host as set by parser: %1").arg(hostCL); qDebug(logSystem()) << QString("CIV as set by parser: %1").arg(civCL); - +#endif #ifdef BUILD_WFSERVER #ifdef Q_OS_WIN SetConsoleCtrlHandler((PHANDLER_ROUTINE)cleanup, TRUE); From c5f626065aa6a0fcd8bc2d0e7f699f6a2c154ff1 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 15 Sep 2022 09:53:50 -0700 Subject: [PATCH 062/207] Debug mode can now be toggled from the logging window. --- loggingwindow.cpp | 2 -- wfmain.cpp | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/loggingwindow.cpp b/loggingwindow.cpp index 1e0a1ae..15af169 100644 --- a/loggingwindow.cpp +++ b/loggingwindow.cpp @@ -27,8 +27,6 @@ loggingWindow::loggingWindow(QWidget *parent) : connect(socket, SIGNAL(disconnected()), this, SLOT(disconnectedFromHost())); connect(socket, SIGNAL(readyRead()), this, SLOT(handleDataFromLoggingHost())); connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(handleLoggingHostError(QAbstractSocket::SocketError))); - - ui->debugBtn->setHidden(true); // this button doesn't work yet. } loggingWindow::~loggingWindow() diff --git a/wfmain.cpp b/wfmain.cpp index efd8384..b659955 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -7005,6 +7005,7 @@ void wfmain::handleLogText(QString text) void wfmain::setDebugLogging(bool debugModeOn) { this->debugMode = debugModeOn; + debugModeLogging = debugModeOn; } void wfmain::messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg) From 4e3af7cccd08a880ab74b69a60a1c9ef55416f30 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 15 Sep 2022 11:52:08 -0700 Subject: [PATCH 063/207] Changed font for better compatibility. Added some controls for scrolling behavior. --- loggingwindow.cpp | 25 +++++++++++++++++++++++++ loggingwindow.h | 8 ++++++++ loggingwindow.ui | 27 +++++++++++++++------------ wfmain.cpp | 9 +++++++++ 4 files changed, 57 insertions(+), 12 deletions(-) diff --git a/loggingwindow.cpp b/loggingwindow.cpp index 15af169..1efb623 100644 --- a/loggingwindow.cpp +++ b/loggingwindow.cpp @@ -13,6 +13,11 @@ loggingWindow::loggingWindow(QWidget *parent) : ui->logTextDisplay->setFocusPolicy(Qt::NoFocus); ui->annotateBtn->setFocusPolicy(Qt::NoFocus); + QFont font("Monospace"); + font.setStyleHint(QFont::TypeWriter); + ui->logTextDisplay->setFont(font); + ui->userAnnotationText->setFont(font); + #ifdef Q_OS_MAC logFilename = QStandardPaths::standardLocations(QStandardPaths::DownloadLocation)[0] + "/wfview.log"; logDirectory = QStandardPaths::standardLocations(QStandardPaths::DownloadLocation)[0]; @@ -27,6 +32,12 @@ loggingWindow::loggingWindow(QWidget *parent) : connect(socket, SIGNAL(disconnected()), this, SLOT(disconnectedFromHost())); connect(socket, SIGNAL(readyRead()), this, SLOT(handleDataFromLoggingHost())); connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(handleLoggingHostError(QAbstractSocket::SocketError))); + + vertLogScroll = ui->logTextDisplay->verticalScrollBar(); + horizLogScroll = ui->logTextDisplay->horizontalScrollBar(); + + vertLogScroll->setValue(vertLogScroll->maximum()); + horizLogScroll->setValue(horizLogScroll->minimum()); } loggingWindow::~loggingWindow() @@ -35,10 +46,18 @@ loggingWindow::~loggingWindow() delete ui; } +void loggingWindow::setInitialDebugState(bool debugModeEnabled) +{ + ui->debugBtn->blockSignals(true); + ui->debugBtn->setChecked(debugModeEnabled); + ui->debugBtn->blockSignals(false); +} + void loggingWindow::acceptLogText(QString text) { QMutexLocker lock(&textMutex); ui->logTextDisplay->appendPlainText(text); + horizLogScroll->setValue(horizLogScroll->minimum()); } void loggingWindow::sendToTermbin() @@ -174,3 +193,9 @@ void loggingWindow::on_debugBtn_clicked(bool checked) { emit setDebugMode(checked); } + +void loggingWindow::on_toBottomBtn_clicked() +{ + vertLogScroll->setValue(vertLogScroll->maximum()); + horizLogScroll->setValue(horizLogScroll->minimum()); +} diff --git a/loggingwindow.h b/loggingwindow.h index c331700..26f3598 100644 --- a/loggingwindow.h +++ b/loggingwindow.h @@ -9,6 +9,7 @@ #include #include #include +#include #include "logcategories.h" @@ -25,6 +26,9 @@ public: ~loggingWindow(); void acceptLogText(QString text); +public slots: + void setInitialDebugState(bool debugModeEnabled); + private slots: void connectedToHost(); void disconnectedFromHost(); @@ -47,6 +51,8 @@ private slots: void on_debugBtn_clicked(bool checked); + void on_toBottomBtn_clicked(); + signals: void setDebugMode(bool debugOn); @@ -54,6 +60,8 @@ private: Ui::loggingWindow *ui; QClipboard *clipboard; QMessageBox msgBox; + QScrollBar *vertLogScroll; + QScrollBar *horizLogScroll; QMutex textMutex; QString logFilename; QString logDirectory; diff --git a/loggingwindow.ui b/loggingwindow.ui index 87b2751..dbd14ab 100644 --- a/loggingwindow.ui +++ b/loggingwindow.ui @@ -6,7 +6,7 @@ 0 0 - 554 + 625 300 @@ -16,11 +16,6 @@ - - - Ubuntu Mono - - false @@ -67,10 +62,8 @@ 0 - - - Ubuntu Mono - + + You may enter your own log notes here. @@ -109,20 +102,30 @@ - Enable or disable debug logging + <html><head/><body><p>Enable or disable debug logging. Use the &quot;-d&quot; or &quot;--debug&quot; flag to open wfview with debug logging enabled on startup. </p></body></html> Debug + + + + Scroll to bottom + + + To Bottom + + + Clears the display. Does not clear the log file. - Clear Display + Clear diff --git a/wfmain.cpp b/wfmain.cpp index b659955..88e1cae 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -41,6 +41,7 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s logWindow = new loggingWindow(); initLogging(); + logWindow->setInitialDebugState(debugMode); qInfo(logSystem()) << version; this->serialPortCL = serialPortCL; @@ -6958,7 +6959,15 @@ void wfmain::on_colorSavePresetBtn_clicked() void wfmain::on_showLogBtn_clicked() { + if(logWindow->isMinimized()) + { + logWindow->raise(); + logWindow->activateWindow(); + return; + } logWindow->show(); + logWindow->raise(); + logWindow->activateWindow(); } void wfmain::initLogging() From d4ae4181ed94aa4964c903a620dacb29879441ad Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 15 Sep 2022 11:52:52 -0700 Subject: [PATCH 064/207] Clarified control label to Scroll Down versus To Bottom. --- loggingwindow.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loggingwindow.ui b/loggingwindow.ui index dbd14ab..f53bd31 100644 --- a/loggingwindow.ui +++ b/loggingwindow.ui @@ -115,7 +115,7 @@ Scroll to bottom - To Bottom + Scroll Down From 940f5fb9615ef5370a5f22ea0629f7e995b58fdc Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 15 Sep 2022 11:55:45 -0700 Subject: [PATCH 065/207] Renamed URL message box in case we add an additional message box later. --- loggingwindow.cpp | 6 +++--- loggingwindow.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/loggingwindow.cpp b/loggingwindow.cpp index 1efb623..09248a3 100644 --- a/loggingwindow.cpp +++ b/loggingwindow.cpp @@ -79,9 +79,9 @@ void loggingWindow::handleDataFromLoggingHost() { clipboard->setText(URL); qInfo(logLogger()) << "Sent log to URL: " << URL; - msgBox.setText("Your log has been posted, and the URL has been copied to the clipboard."); - msgBox.setInformativeText("" + URL + ""); - msgBox.exec(); + URLmsgBox.setText("Your log has been posted, and the URL has been copied to the clipboard."); + URLmsgBox.setInformativeText("" + URL + ""); + URLmsgBox.exec(); // For whatever reason, showing the message box hides this window. this->show(); this->raise(); diff --git a/loggingwindow.h b/loggingwindow.h index 26f3598..67be898 100644 --- a/loggingwindow.h +++ b/loggingwindow.h @@ -59,7 +59,7 @@ signals: private: Ui::loggingWindow *ui; QClipboard *clipboard; - QMessageBox msgBox; + QMessageBox URLmsgBox; QScrollBar *vertLogScroll; QScrollBar *horizLogScroll; QMutex textMutex; From b849df9f7f5d38d6a1a8d24137c248c50dd70910 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 15 Sep 2022 11:59:04 -0700 Subject: [PATCH 066/207] Better scrolling behavior. The log is now aware if you are not at the bottom and will not force scroll if so. Otherwise, it will bring the horizontal scroll back to the left-edge. --- loggingwindow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/loggingwindow.cpp b/loggingwindow.cpp index 09248a3..ade0661 100644 --- a/loggingwindow.cpp +++ b/loggingwindow.cpp @@ -57,7 +57,10 @@ void loggingWindow::acceptLogText(QString text) { QMutexLocker lock(&textMutex); ui->logTextDisplay->appendPlainText(text); - horizLogScroll->setValue(horizLogScroll->minimum()); + if(vertLogScroll->value() == vertLogScroll->maximum()) + { + horizLogScroll->setValue(horizLogScroll->minimum()); + } } void loggingWindow::sendToTermbin() From d90104a79ec07513123786cf7c8b17e45d6d65b1 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 15 Sep 2022 14:09:16 -0700 Subject: [PATCH 067/207] Added flush to the text stream to termbin. --- loggingwindow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/loggingwindow.cpp b/loggingwindow.cpp index ade0661..3ed9cf2 100644 --- a/loggingwindow.cpp +++ b/loggingwindow.cpp @@ -109,6 +109,7 @@ void loggingWindow::connectedToHost() outText << ui->logTextDisplay->toPlainText(); outText << "\n----------\nSent from wfview version "; outText << WFVIEW_VERSION << "\n----------\n"; + outText.flush(); } void loggingWindow::handleLoggingHostError(QAbstractSocket::SocketError error) From de46d62346f30c8d3df5c37a80dd73a2b426633b Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 15 Sep 2022 14:13:14 -0700 Subject: [PATCH 068/207] Removed extra disconnect message from logging host. --- loggingwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/loggingwindow.cpp b/loggingwindow.cpp index 3ed9cf2..124008c 100644 --- a/loggingwindow.cpp +++ b/loggingwindow.cpp @@ -117,11 +117,11 @@ void loggingWindow::handleLoggingHostError(QAbstractSocket::SocketError error) switch(error) { case QAbstractSocket::RemoteHostClosedError: - qInfo(logLogger()) << "Disconnected from logging host."; + //qInfo(logLogger()) << "Disconnected from logging host."; break; default: - qInfo(logLogger()) << "Error connecting to logging host. Check internet connection. Error code: " << error; + qWarning(logLogger()) << "Error connecting to logging host. Check internet connection. Error code: " << error; break; } } From 6ed1a8e80e96d00793ae298bed6118bde0f07ea2 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 15 Sep 2022 16:31:27 -0700 Subject: [PATCH 069/207] Changed windows 'open log' command to launch notepad. --- loggingwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loggingwindow.cpp b/loggingwindow.cpp index 124008c..789b31d 100644 --- a/loggingwindow.cpp +++ b/loggingwindow.cpp @@ -162,7 +162,7 @@ void loggingWindow::on_openLogFileBtn_clicked() cmd = "xdg-open " + logFilename; #endif #ifdef Q_OS_WIN - cmd = "start " + logFilename; + cmd = "notepad " + logFilename; #endif rtnval = system(cmd.toLocal8Bit().data()); if(rtnval) From b54f724ce9860d9994224a0f59b34ed2c13f021c Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 15 Sep 2022 17:04:01 -0700 Subject: [PATCH 070/207] Removed some additional padding that was left in parts of the UI. --- wfmain.ui | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/wfmain.ui b/wfmain.ui index 234d3b5..341aa5a 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -2406,6 +2406,21 @@ Network Connected Radios + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + @@ -2868,6 +2883,9 @@ + + Enables interpolation between pixels. Note that this will increase CPU usage. + Interpolate Waterfall @@ -3249,6 +3267,18 @@ User-defined Color Editor + + 0 + + + 0 + + + 0 + + + 0 + @@ -3262,7 +3292,7 @@ 0 0 - 204 + 794 582 @@ -4680,7 +4710,7 @@ - + From 221086ed4f341b1e264151534e53651e7579e2a9 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 15 Sep 2022 17:35:29 -0700 Subject: [PATCH 071/207] Minor edit to margins --- wfmain.ui | 58 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/wfmain.ui b/wfmain.ui index 341aa5a..68f5855 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -18,7 +18,7 @@ - 3 + 0 @@ -31,6 +31,18 @@ Spectrum + + 0 + + + 7 + + + 0 + + + 0 + @@ -1038,7 +1050,19 @@ Preamp/Att - + + + 4 + + + 4 + + + 4 + + + 4 + @@ -2320,7 +2344,19 @@ Serial Connected Radios - + + + 3 + + + 5 + + + 3 + + + 5 + @@ -2405,21 +2441,21 @@ Network Connected Radios - + 6 - 0 + 3 - 0 + 5 - 0 + 3 - 0 + 5 @@ -3244,7 +3280,7 @@ - + 0 @@ -3271,7 +3307,7 @@ 0 - 0 + 4 0 @@ -3280,7 +3316,7 @@ 0 - + QAbstractScrollArea::AdjustToContents From 7e2682170f5443fdd575896d8703e650817b03ee Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 16 Sep 2022 20:51:16 +0100 Subject: [PATCH 072/207] Make Windows expand audio combo when clicked --- wfmain.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wfmain.cpp b/wfmain.cpp index 88e1cae..2b4713d 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6152,6 +6152,14 @@ void wfmain::setAudioDevicesUI() } + // Make the audio comboboxes expand when clicked (only needed for Windows) +#ifdef Q_OS_WIN + ui->audioInputCombo->setStyleSheet("QComboBox QAbstractItemView {min-width: 300px;}"); + ui->audioOutputCombo->setStyleSheet("QComboBox QAbstractItemView {min-width: 300px;}"); + ui->serverTXAudioOutputCombo->setStyleSheet("QComboBox QAbstractItemView {min-width: 300px;}"); + ui->serverRXAudioInputCombo->setStyleSheet("QComboBox QAbstractItemView {min-width: 300px;}"); +#endif + // Stop blocking signals so we can set the current values ui->audioInputCombo->blockSignals(false); ui->audioOutputCombo->blockSignals(false); From aba2928d42218c8c612654dd7f4a77613b1e0e1e Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Fri, 16 Sep 2022 13:22:58 -0700 Subject: [PATCH 073/207] Added dedication in the about box. --- aboutbox.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/aboutbox.cpp b/aboutbox.cpp index ba8de0f..03715c1 100644 --- a/aboutbox.cpp +++ b/aboutbox.cpp @@ -15,10 +15,12 @@ aboutbox::aboutbox(QWidget *parent) : ui->topText->setText("wfview version " + QString(WFVIEW_VERSION)); QString head = QString(""); - QString copyright = QString("Copyright 2017-2021 Elliott H. Liggett, W6EL. All rights reserved. wfview source code is licensed under the GNU GPLv3."); + QString copyright = QString("Copyright 2017-2022 Elliott H. Liggett, W6EL. All rights reserved. wfview source code is licensed under the GNU GPLv3."); QString nacode = QString("

Networking, audio, rigctl server, and much more written by Phil Taylor, M0VSE"); QString doctest = QString("

Testing, documentation, bug fixes, and development mentorship from
Roeland Jansen, PA3MET, and Jim Nijkamp, PA8E."); + QString dedication = QString("

This version of wfview is dedicated to the ones we lost."); + #if defined(Q_OS_LINUX) QString ssCredit = QString("

Stylesheet qdarkstyle used under MIT license, stored in /usr/share/wfview/stylesheets/."); #else @@ -83,7 +85,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."); // String it all together: - QString aboutText = head + copyright + "\n" + nacode + "\n" + doctest + wfviewcommunityack; + QString aboutText = head + copyright + "\n" + nacode + "\n" + doctest + dedication + wfviewcommunityack; aboutText.append(website + "\n" + donate + "\n"+ docs + support + contact +"\n"); aboutText.append("\n" + ssCredit + "\n" + rsCredit + "\n"); From cf50e9d18a271b55040d580118a69e3803319420 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Fri, 16 Sep 2022 13:43:01 -0700 Subject: [PATCH 074/207] Added an additional combo box for the audio system selection under the Radio Server page of settings. --- wfmain.cpp | 19 +++++++++++++++++-- wfmain.h | 2 ++ wfmain.ui | 32 +++++++++++++++++++++++++++++--- 3 files changed, 48 insertions(+), 5 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 2b4713d..2863619 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -949,7 +949,6 @@ void wfmain::setupMainUI() connect(this->trxadj, &transceiverAdjustments::setTPBFOuter, [=](const unsigned char &newValue) { issueCmdUniquePriority(cmdSetTPBFOuter, newValue);} ); - } void wfmain::prepareSettingsWindow() @@ -1531,7 +1530,10 @@ void wfmain::loadSettings() prefs.audioSystem = static_cast(settings->value("AudioSystem", defPrefs.audioSystem).toInt()); ui->audioSystemCombo->blockSignals(true); + ui->audioSystemServerCombo->blockSignals(true); ui->audioSystemCombo->setCurrentIndex(prefs.audioSystem); + ui->audioSystemServerCombo->setCurrentIndex(prefs.audioSystem); + ui->audioSystemServerCombo->blockSignals(false); ui->audioSystemCombo->blockSignals(false); @@ -3473,6 +3475,7 @@ void wfmain::receiveRigID(rigCapabilities rigCaps) ui->connectBtn->setText("Disconnect"); // We must be connected now. ui->audioSystemCombo->setEnabled(false); + ui->audioSystemServerCombo->setEnabled(false); prepareWf(ui->wfLengthSlider->value()); if(usingLAN) @@ -4892,6 +4895,7 @@ void wfmain::on_connectBtn_clicked() emit sendCloseComm(); ui->connectBtn->setText("Connect"); ui->audioSystemCombo->setEnabled(true); + ui->audioSystemServerCombo->setEnabled(true); haveRigCaps = false; rigName->setText("NONE"); } @@ -6222,6 +6226,18 @@ void wfmain::on_audioSystemCombo_currentIndexChanged(int value) { prefs.audioSystem = static_cast(value); setAudioDevicesUI(); // Force all audio devices to update + ui->audioSystemServerCombo->blockSignals(true); + ui->audioSystemServerCombo->setCurrentIndex(value); + ui->audioSystemServerCombo->blockSignals(false); +} + +void wfmain::on_audioSystemServerCombo_currentIndexChanged(int value) +{ + prefs.audioSystem = static_cast(value); + setAudioDevicesUI(); // Force all audio devices to update + ui->audioSystemCombo->blockSignals(true); + ui->audioSystemCombo->setCurrentIndex(value); + ui->audioSystemCombo->blockSignals(false); } void wfmain::on_topLevelSlider_valueChanged(int value) @@ -7077,4 +7093,3 @@ void wfmain::messageHandler(QtMsgType type, const QMessageLogContext& context, c logStringBuffer.push_front(text); logTextMutex.unlock(); } - diff --git a/wfmain.h b/wfmain.h index 337f3b1..e52bdb5 100644 --- a/wfmain.h +++ b/wfmain.h @@ -643,6 +643,8 @@ private slots: void on_showLogBtn_clicked(); + void on_audioSystemServerCombo_currentIndexChanged(int index); + private: Ui::wfmain *ui; void closeEvent(QCloseEvent *event); diff --git a/wfmain.ui b/wfmain.ui index 68f5855..cf0ea7c 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -18,7 +18,7 @@ - 0 + 3 @@ -2809,7 +2809,7 @@ - QT Audio + Qt Audio @@ -4185,7 +4185,7 @@
- + @@ -4232,6 +4232,32 @@ + + + + Audio System + + + + + + + + Qt Audio + + + + + PortAudio + + + + + RT Audio + + + + From 81607a80699541cefc3ac9013d196ae787b25fee Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Sat, 17 Sep 2022 10:26:13 +0200 Subject: [PATCH 075/207] merged log branch and updated to 1.44 --- CHANGELOG | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ WHATSNEW | 2 +- wfserver.pro | 2 +- wfview.pro | 2 +- 4 files changed, 52 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7bb3b3f..3a511c1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,54 @@ # CHANGELOG + +- 20220915 + + Merge branch log: + + Minor edit to margins + + Removed some additional padding that was left in parts of the UI. + + Changed windows 'open log' command to launch notepad. + + Removed extra disconnect message from logging host. + + Added flush to the text stream to termbin. + + Better scrolling behavior. The log is now aware if you are not at the + bottom and will not force scroll if so. Otherwise, it will bring the + horizontal scroll back to the left-edge. + + Renamed URL message box in case we add an additional message box later. + + Clarified control label to Scroll Down versus To Bottom. + + Changed font for better compatibility. Added some controls for scrolling + behavior. + + Debug mode can now be toggled from the logging window. + + Removed extra output on non-server builds. + + Added debug logging button, however, it doesn't propagate the debug + signal through all the modules yet. So, for now, it is hidden. + + Restored version to log file, fixed reversed log entries. + + updated to v.1.44 +- 20220914 + + Removed word wrapping from the log + + Cut log window polling rate in half for lower CPU. 100ms is plenty fast. + + Removed audio volume logging. + + Keep the logging window up after the message box. Added "log" logging + category. + + Added logging window capability with termbin support. + - 20220909 Merge branch resize: diff --git a/WHATSNEW b/WHATSNEW index dbafb9c..45eb4e8 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -25,7 +25,7 @@ The following highlights are in this 1.41-release: + 1.41 added color picker support for all kinds of vsual elements + 1.42 added three additional second meter choices. RxAudio, TxAdio, and TxRxAudio + 1.43 fixed resizing issues. - ++1.44 added logging window. you can send the logs to termbin.com and share the link on the forum Notes: diff --git a/wfserver.pro b/wfserver.pro index 24a5bef..41e74e9 100644 --- a/wfserver.pro +++ b/wfserver.pro @@ -13,7 +13,7 @@ TEMPLATE = app CONFIG += console -DEFINES += WFVIEW_VERSION=\\\"1.43\\\" +DEFINES += WFVIEW_VERSION=\\\"1.44\\\" DEFINES += BUILD_WFSERVER diff --git a/wfview.pro b/wfview.pro index 797e98f..784ca7a 100644 --- a/wfview.pro +++ b/wfview.pro @@ -11,7 +11,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport TARGET = wfview TEMPLATE = app -DEFINES += WFVIEW_VERSION=\\\"1.43\\\" +DEFINES += WFVIEW_VERSION=\\\"1.44\\\" DEFINES += BUILD_WFVIEW From b13de1d9eee1d53b7b812429c16f08157da1d2f0 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Sat, 17 Sep 2022 10:36:07 +0200 Subject: [PATCH 076/207] missing space and lowercased Termbin.com to termbin.com --- WHATSNEW | 2 +- loggingwindow.ui | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index 45eb4e8..d68e8ec 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -25,7 +25,7 @@ The following highlights are in this 1.41-release: + 1.41 added color picker support for all kinds of vsual elements + 1.42 added three additional second meter choices. RxAudio, TxAdio, and TxRxAudio + 1.43 fixed resizing issues. -+1.44 added logging window. you can send the logs to termbin.com and share the link on the forum ++ 1.44 added logging window. you can send the logs to termbin.com and share the link on the forum Notes: diff --git a/loggingwindow.ui b/loggingwindow.ui index f53bd31..717366c 100644 --- a/loggingwindow.ui +++ b/loggingwindow.ui @@ -165,7 +165,7 @@ <html><head/><body><p>Sends text to termbin.com. Some personal information (such as your username) is in the log file, so do not click this button unless you are ok sharing your log file. This is a quick way to receive a URL, pointing to your log file text, that you can send to other people. </p></body></html> - Send to Termbin.com + Send to termbin.com
From 0735c35cecda40952794bdd13c5ad3819f33b1fe Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sat, 17 Sep 2022 12:05:32 -0700 Subject: [PATCH 077/207] Fixed bug where the frequency dial skipped extra when crossing zero. --- wfmain.cpp | 69 ++++++++++++++---------------------------------------- wfmain.ui | 18 +++++++++++--- 2 files changed, 32 insertions(+), 55 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 2863619..4a93e01 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -4247,7 +4247,7 @@ void wfmain::on_modeSelectCombo_activated(int index) void wfmain::on_freqDial_valueChanged(int value) { - int maxVal = ui->freqDial->maximum(); + int fullSweep = ui->freqDial->maximum() - ui->freqDial->minimum(); freqt f; f.Hz = 0; @@ -4255,12 +4255,6 @@ void wfmain::on_freqDial_valueChanged(int value) volatile int delta = 0; - int directPath = 0; - int crossingPath = 0; - - int distToMaxNew = 0; - int distToMaxOld = 0; - if(freqLock) { ui->freqDial->blockSignals(true); @@ -4268,50 +4262,25 @@ void wfmain::on_freqDial_valueChanged(int value) ui->freqDial->blockSignals(false); return; } - - if(value == 0) + + delta = (value - oldFreqDialVal); + + if(delta > fullSweep/2) { - distToMaxNew = 0; - } else { - distToMaxNew = maxVal - value; + // counter-clockwise past the zero mark + // ie, from +3000 to 3990, old=3000, new = 3990, new-old = 990 + // desired delta here would actually be -10 + delta = delta - fullSweep; + } else if (delta < -fullSweep/2) + { + // clock-wise past the zero mark + // ie, from +3990 to 3000, old=3990, new = 3000, new-old = -990 + // desired delta here would actually be +10 + delta = fullSweep + delta; } - if(oldFreqDialVal != 0) - { - distToMaxOld = maxVal - oldFreqDialVal; - } else { - distToMaxOld = 0; - } - - directPath = abs(value - oldFreqDialVal); - if(value < maxVal / 2) - { - crossingPath = value + distToMaxOld; - } else { - crossingPath = distToMaxNew + oldFreqDialVal; - } - - if(directPath > crossingPath) - { - // use crossing path, it is shorter - delta = crossingPath; - // now calculate the direction: - if( value > oldFreqDialVal) - { - // CW - delta = delta; - } else { - // CCW - delta *= -1; - } - - } else { - // use direct path - // crossing path is larger than direct path, use direct path - //delta = directPath; - // now calculate the direction - delta = value - oldFreqDialVal; - } + // The step size is 10, which forces the knob to not skip a step crossing zero. + delta = delta / ui->freqDial->singleStep(); // With the number of steps and direction of steps established, // we can now adjust the frequency: @@ -4321,12 +4290,8 @@ void wfmain::on_freqDial_valueChanged(int value) if(f.Hz > 0) { freq = f; - oldFreqDialVal = value; - ui->freqLabel->setText(QString("%1").arg(f.MHzDouble, 0, 'f')); - - //emit setFrequency(0,f); issueCmdUniquePriority(cmdSetFreq, f); } else { ui->freqDial->blockSignals(true); diff --git a/wfmain.ui b/wfmain.ui index cf0ea7c..bff4683 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -18,7 +18,7 @@ - 3 + 0 @@ -338,6 +338,18 @@ Tuning Dial + + 3000 + + + 4000 + + + 10 + + + 100 + true @@ -3328,7 +3340,7 @@ 0 0 - 794 + 204 582 @@ -4772,7 +4784,7 @@ - + From fca463f346aac30f8dba7b71c06d150d79644ed0 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sat, 17 Sep 2022 20:57:49 +0100 Subject: [PATCH 078/207] Add "Cancel" to connect button --- wfmain.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 2b4713d..992d3d8 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -195,6 +195,8 @@ void wfmain::openRig() // showRigSettings(); // rig setting dialog box for network/serial, CIV, hostname, port, baud rate, serial device, etc // TODO: How do we know if the setting was loaded? + ui->audioSystemCombo->setEnabled(false); + ui->connectBtn->setText("Cancel"); // We are attempting to connect // TODO: Use these if they are found if(!serialPortCL.isEmpty()) @@ -3336,6 +3338,7 @@ void wfmain::receiveRigID(rigCapabilities rigCaps) ui->topLevelSlider->setMaximum(rigCaps.spectAmpMax); haveRigCaps = true; + // Added so that server receives rig capabilities. emit sendRigCaps(rigCaps); rpt->setRig(rigCaps); @@ -3471,8 +3474,8 @@ void wfmain::receiveRigID(rigCapabilities rigCaps) ui->useRTSforPTTchk->setChecked(rigCaps.useRTSforPTT); ui->useRTSforPTTchk->blockSignals(false); - ui->connectBtn->setText("Disconnect"); // We must be connected now. ui->audioSystemCombo->setEnabled(false); + ui->connectBtn->setText("Disconnect"); // We must be connected now. prepareWf(ui->wfLengthSlider->value()); if(usingLAN) @@ -4895,10 +4898,15 @@ void wfmain::on_connectBtn_clicked() haveRigCaps = false; rigName->setText("NONE"); } - else + else { emit sendCloseComm(); // Just in case there is a failed connection open. - openRig(); + if (ui->connectBtn->text() != "Cancel") { + openRig(); + } + else { + ui->connectBtn->setText("Connect"); + } } } From 77f48f5f0c7298407844b3b20c758b7f4925b897 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sat, 17 Sep 2022 21:04:46 +0100 Subject: [PATCH 079/207] Update wfmain.cpp Add enable/disable audioSystemServerCombo --- wfmain.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wfmain.cpp b/wfmain.cpp index 553487c..2b33db3 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -195,7 +195,9 @@ void wfmain::openRig() // showRigSettings(); // rig setting dialog box for network/serial, CIV, hostname, port, baud rate, serial device, etc // TODO: How do we know if the setting was loaded? + ui->audioSystemServerCombo->setEnabled(false); ui->audioSystemCombo->setEnabled(false); + ui->connectBtn->setText("Cancel"); // We are attempting to connect // TODO: Use these if they are found @@ -3477,6 +3479,7 @@ void wfmain::receiveRigID(rigCapabilities rigCaps) ui->useRTSforPTTchk->blockSignals(false); ui->audioSystemCombo->setEnabled(false); + ui->audioSystemServerCombo->setEnabled(false); ui->connectBtn->setText("Disconnect"); // We must be connected now. From 4dcc7c47537139e12277a3ec98bbd95f1545f954 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sat, 17 Sep 2022 22:31:43 +0100 Subject: [PATCH 080/207] Move connect button --- wfmain.cpp | 10 +++++----- wfmain.ui | 33 +++++++++++++++++++++++---------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 2b33db3..55b937e 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -198,7 +198,7 @@ void wfmain::openRig() ui->audioSystemServerCombo->setEnabled(false); ui->audioSystemCombo->setEnabled(false); - ui->connectBtn->setText("Cancel"); // We are attempting to connect + ui->connectBtn->setText("Cancel connection"); // We are attempting to connect // TODO: Use these if they are found if(!serialPortCL.isEmpty()) @@ -3481,7 +3481,7 @@ void wfmain::receiveRigID(rigCapabilities rigCaps) ui->audioSystemCombo->setEnabled(false); ui->audioSystemServerCombo->setEnabled(false); - ui->connectBtn->setText("Disconnect"); // We must be connected now. + ui->connectBtn->setText("Disconnect from Radio"); // We must be connected now. prepareWf(ui->wfLengthSlider->value()); if(usingLAN) @@ -4864,7 +4864,7 @@ void wfmain::on_connectBtn_clicked() if (haveRigCaps) { emit sendCloseComm(); - ui->connectBtn->setText("Connect"); + ui->connectBtn->setText("Connect to Radio"); ui->audioSystemCombo->setEnabled(true); ui->audioSystemServerCombo->setEnabled(true); haveRigCaps = false; @@ -4873,11 +4873,11 @@ void wfmain::on_connectBtn_clicked() else { emit sendCloseComm(); // Just in case there is a failed connection open. - if (ui->connectBtn->text() != "Cancel") { + if (ui->connectBtn->text() != "Cancel connection") { openRig(); } else { - ui->connectBtn->setText("Connect"); + ui->connectBtn->setText("Connect to Radio"); } } } diff --git a/wfmain.ui b/wfmain.ui index bff4683..3ac271b 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -18,7 +18,7 @@ - 0 + 3 @@ -2861,13 +2861,6 @@ 0 - - - - Connect - - - @@ -3340,8 +3333,8 @@ 0 0 - 204 - 582 + 194 + 563 @@ -4720,6 +4713,26 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Connect to Radio + + + From 0c22f81690d01bc7577dc33a2dacb646483a700b Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sat, 17 Sep 2022 22:43:40 +0100 Subject: [PATCH 081/207] Remove focus from connect button once clicked. --- wfmain.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/wfmain.cpp b/wfmain.cpp index 55b937e..d030d8d 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -4880,6 +4880,7 @@ void wfmain::on_connectBtn_clicked() ui->connectBtn->setText("Connect to Radio"); } } + ui->connectBtn->clearFocus(); } void wfmain::on_sqlSlider_valueChanged(int value) From a7ba90656902e3a5e3968765aeeca17329c8e131 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sat, 17 Sep 2022 15:02:21 -0700 Subject: [PATCH 082/207] Log will automatically scroll to bottom on show. --- loggingwindow.cpp | 6 ++++++ loggingwindow.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/loggingwindow.cpp b/loggingwindow.cpp index 789b31d..c9ad5be 100644 --- a/loggingwindow.cpp +++ b/loggingwindow.cpp @@ -46,6 +46,12 @@ loggingWindow::~loggingWindow() delete ui; } +void loggingWindow::showEvent(QShowEvent *event) +{ + (void)event; + on_toBottomBtn_clicked(); +} + void loggingWindow::setInitialDebugState(bool debugModeEnabled) { ui->debugBtn->blockSignals(true); diff --git a/loggingwindow.h b/loggingwindow.h index 67be898..dda0efa 100644 --- a/loggingwindow.h +++ b/loggingwindow.h @@ -34,7 +34,7 @@ private slots: void disconnectedFromHost(); void handleDataFromLoggingHost(); void handleLoggingHostError(QAbstractSocket::SocketError); - + void showEvent(QShowEvent* event); void on_clearDisplayBtn_clicked(); void on_openDirBtn_clicked(); From c09c548eb0df5bcb804d7667138c17730fa61662 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Sun, 18 Sep 2022 13:04:13 +0200 Subject: [PATCH 083/207] log, connect and dial changed/fixed; bumped to v1.45 --- CHANGELOG | 22 +++++ WHATSNEW | 7 +- mac | 122 ++++++++++++++++++++++++++ rxmac | 244 +++++++++++++++++++++++++++++++++++++++++++++++++++ wfserver.pro | 2 +- wfview.pro | 2 +- 6 files changed, 396 insertions(+), 3 deletions(-) create mode 100644 mac create mode 100644 rxmac diff --git a/CHANGELOG b/CHANGELOG index 3a511c1..6335c22 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,27 @@ # CHANGELOG +- 20220918 + + merged bits from log branch into master + + updated to v.1.45 + + +- 20220917 + + Log will automatically scroll to bottom on show. + + Remove focus from connect button once clicked. + + Move connect button + + Update wfmain.cpp + + Add enable/disable audioSystemServerCombo + + Add "Cancel" to connect button + + Fixed bug where the frequency dial skipped extra when crossing zero. - 20220915 diff --git a/WHATSNEW b/WHATSNEW index d68e8ec..f40f71c 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -25,7 +25,12 @@ The following highlights are in this 1.41-release: + 1.41 added color picker support for all kinds of vsual elements + 1.42 added three additional second meter choices. RxAudio, TxAdio, and TxRxAudio + 1.43 fixed resizing issues. -+ 1.44 added logging window. you can send the logs to termbin.com and share the link on the forum ++ 1.44 added logging window. you can send the logs to termbin.com and share the link on the forum ++ 1.45 some more log enhancements + moved connect button and added cancel option + add enable/disable audioSystemServerCombo + Fixed bug where the frequency dial skipped extra when crossing zero. + Notes: diff --git a/mac b/mac new file mode 100644 index 0000000..74c9e21 --- /dev/null +++ b/mac @@ -0,0 +1,122 @@ +servermain.cpp: if (radio->rigThread != Q_NULLPTR) +servermain.cpp: radio->rigThread->quit(); +servermain.cpp: radio->rigThread->wait(); +servermain.cpp: if (radio->rigThread != Q_NULLPTR) +servermain.cpp: QMetaObject::invokeMethod(radio->rig, [=]() { +servermain.cpp: radio->rig->commSetup(radio->civAddr, radio->serialPort, radio->baudRate, QString("none"),prefs.tcpPort,radio->waterfallFormat); +servermain.cpp: if (radio->rigThread == Q_NULLPTR) +servermain.cpp: radio->rig = new rigCommander(radio->guid); +servermain.cpp: radio->rigThread = new QThread(this); +servermain.cpp: radio->rigThread->setObjectName("rigCommander()"); +servermain.cpp: radio->rig->moveToThread(radio->rigThread); +servermain.cpp: connect(radio->rigThread, SIGNAL(started()), radio->rig, SLOT(process())); +servermain.cpp: connect(radio->rigThread, SIGNAL(finished()), radio->rig, SLOT(deleteLater())); +servermain.cpp: radio->rigThread->start(); +servermain.cpp: connect(radio->rig, SIGNAL(haveSerialPortError(QString, QString)), this, SLOT(receiveSerialPortError(QString, QString))); +servermain.cpp: connect(radio->rig, SIGNAL(haveStatusUpdate(networkStatus)), this, SLOT(receiveStatusUpdate(networkStatus))); +servermain.cpp: connect(this, SIGNAL(setRTSforPTT(bool)), radio->rig, SLOT(setRTSforPTT(bool))); +servermain.cpp: connect(radio->rig, SIGNAL(haveBaudRate(quint32)), this, SLOT(receiveBaudRate(quint32))); +servermain.cpp: connect(this, SIGNAL(sendCloseComm()), radio->rig, SLOT(closeComm())); +servermain.cpp: connect(this, SIGNAL(sendChangeLatency(quint16)), radio->rig, SLOT(changeLatency(quint16))); +servermain.cpp: //connect(this, SIGNAL(getRigCIV()), radio->rig, SLOT(findRigs())); +servermain.cpp: //connect(this, SIGNAL(setRigID(unsigned char)), radio->rig, SLOT(setRigID(unsigned char))); +servermain.cpp: connect(radio->rig, SIGNAL(discoveredRigID(rigCapabilities)), this, SLOT(receiveFoundRigID(rigCapabilities))); +servermain.cpp: connect(radio->rig, SIGNAL(commReady()), this, SLOT(receiveCommReady())); +servermain.cpp: connect(this, SIGNAL(requestRigState()), radio->rig, SLOT(sendState())); +servermain.cpp: connect(this, SIGNAL(stateUpdated()), radio->rig, SLOT(stateUpdated())); +servermain.cpp: connect(radio->rig, SIGNAL(stateInfo(rigstate*)), this, SLOT(receiveStateInfo(rigstate*))); +servermain.cpp: connect(this, SIGNAL(setCIVAddr(unsigned char)), radio->rig, SLOT(setCIVAddr(unsigned char))); +servermain.cpp: connect(radio->rig, SIGNAL(havePTTStatus(bool)), this, SLOT(receivePTTstatus(bool))); +servermain.cpp: connect(this, SIGNAL(setPTT(bool)), radio->rig, SLOT(setPTT(bool))); +servermain.cpp: connect(this, SIGNAL(getPTT()), radio->rig, SLOT(getPTT())); +servermain.cpp: connect(this, SIGNAL(getDebug()), radio->rig, SLOT(getDebug())); +servermain.cpp: if (radio->rigThread->isRunning()) { +servermain.cpp: if (radio->rigThread != Q_NULLPTR) +servermain.cpp: radio->rigThread->disconnect(); +servermain.cpp: radio->rig->disconnect(); +servermain.cpp: delete radio->rigThread; +servermain.cpp: delete radio->rig; +servermain.cpp: radio->rig = Q_NULLPTR; +servermain.cpp: if (sender != Q_NULLPTR && radio->rig != Q_NULLPTR && !memcmp(sender->getGUID(), radio->guid, GUIDLEN)) +servermain.cpp: if (radio->civAddr == 0) +servermain.cpp: if (!radio->rigAvailable) { +servermain.cpp: if (radio->connectTimer == Q_NULLPTR) { +servermain.cpp: radio->connectTimer = new QTimer(); +servermain.cpp: connect(radio->connectTimer, &QTimer::timeout, this, std::bind(&servermain::connectToRig, this, radio)); +servermain.cpp: radio->connectTimer->start(500); +servermain.cpp: qInfo(logSystem()) << "Skipping automatic CIV, using user-supplied value of " << radio->civAddr; +servermain.cpp: QMetaObject::invokeMethod(radio->rig, [=]() { +servermain.cpp: radio->rig->setRigID(radio->civAddr); +servermain.cpp: if (sender != Q_NULLPTR && radio->rig != Q_NULLPTR && !radio->rigAvailable && !memcmp(sender->getGUID(), radio->guid, GUIDLEN)) +servermain.cpp: radio->rigCaps = rigCaps; +servermain.cpp: if (radio->rigThread != Q_NULLPTR) +servermain.cpp: if (radio->rig != Q_NULLPTR) { +servermain.cpp: connect(radio->rig, SIGNAL(haveAudioData(audioPacket)), udp, SLOT(receiveAudioData(audioPacket))); +servermain.cpp: connect(radio->rig, SIGNAL(haveDataForServer(QByteArray)), udp, SLOT(dataForServer(QByteArray))); +servermain.cpp: //connect(udp, SIGNAL(haveDataFromServer(QByteArray)), radio->rig, SLOT(dataFromServer(QByteArray))); +udpserver.cpp: sendConnectionInfo(current, radio->guid); +udpserver.cpp: if (!memcmp(radio->guid, current->guid, GUIDLEN) || config->rigs.size() == 1) +udpserver.cpp: sendConnectionInfo(current, radio->guid); +udpserver.cpp: if ((!memcmp(radio->guid, current->guid, GUIDLEN) || config->rigs.size()==1) && radio->txaudio == Q_NULLPTR && !config->lan) +udpserver.cpp: radio->txAudioSetup.codec = current->txCodec; +udpserver.cpp: radio->txAudioSetup.sampleRate=current->txSampleRate; +udpserver.cpp: radio->txAudioSetup.isinput = false; +udpserver.cpp: radio->txAudioSetup.latency = current->txBufferLen; +udpserver.cpp: if (radio->txAudioSetup.type == qtAudio) { +udpserver.cpp: radio->txaudio = new audioHandler(); +udpserver.cpp: else if (radio->txAudioSetup.type == portAudio) { +udpserver.cpp: radio->txaudio = new paHandler(); +udpserver.cpp: else if (radio->txAudioSetup.type == rtAudio) { +udpserver.cpp: radio->txaudio = new rtHandler(); +udpserver.cpp: //radio->txaudio = new audioHandler(); +udpserver.cpp: radio->txAudioThread = new QThread(this); +udpserver.cpp: radio->txAudioThread->setObjectName("txAudio()"); +udpserver.cpp: radio->txaudio->moveToThread(radio->txAudioThread); +udpserver.cpp: radio->txAudioThread->start(QThread::TimeCriticalPriority); +udpserver.cpp: connect(this, SIGNAL(setupTxAudio(audioSetup)), radio->txaudio, SLOT(init(audioSetup))); +udpserver.cpp: connect(radio->txAudioThread, SIGNAL(finished()), radio->txaudio, SLOT(deleteLater())); +udpserver.cpp: QMetaObject::invokeMethod(radio->txaudio, [=]() { +udpserver.cpp: radio->txaudio->init(radio->txAudioSetup); +udpserver.cpp: emit setupTxAudio(radio->txAudioSetup); +udpserver.cpp: connect(this, SIGNAL(haveAudioData(audioPacket)), radio->txaudio, SLOT(incomingAudio(audioPacket))); +udpserver.cpp: if ((!memcmp(radio->guid, current->guid, GUIDLEN) || config->rigs.size() == 1) && radio->rxaudio == Q_NULLPTR && !config->lan) +udpserver.cpp: radio->rxAudioSetup.codec = current->rxCodec; +udpserver.cpp: radio->rxAudioSetup.sampleRate=current->rxSampleRate; +udpserver.cpp: radio->rxAudioSetup.latency = current->txBufferLen; +udpserver.cpp: radio->rxAudioSetup.isinput = true; +udpserver.cpp: memcpy(radio->rxAudioSetup.guid, radio->guid, GUIDLEN); +udpserver.cpp: //radio->rxaudio = new audioHandler(); +udpserver.cpp: if (radio->rxAudioSetup.type == qtAudio) { +udpserver.cpp: radio->rxaudio = new audioHandler(); +udpserver.cpp: else if (radio->rxAudioSetup.type == portAudio) { +udpserver.cpp: radio->rxaudio = new paHandler(); +udpserver.cpp: else if (radio->rxAudioSetup.type == rtAudio) { +udpserver.cpp: radio->rxaudio = new rtHandler(); +udpserver.cpp: radio->rxAudioThread = new QThread(this); +udpserver.cpp: radio->rxAudioThread->setObjectName("rxAudio()"); +udpserver.cpp: radio->rxaudio->moveToThread(radio->rxAudioThread); +udpserver.cpp: radio->rxAudioThread->start(QThread::TimeCriticalPriority); +udpserver.cpp: connect(radio->rxAudioThread, SIGNAL(finished()), radio->rxaudio, SLOT(deleteLater())); +udpserver.cpp: connect(radio->rxaudio, SIGNAL(haveAudioData(audioPacket)), this, SLOT(receiveAudioData(audioPacket))); +udpserver.cpp: QMetaObject::invokeMethod(radio->rxaudio, [=]() { +udpserver.cpp: radio->rxaudio->init(radio->rxAudioSetup); +udpserver.cpp: connect(this, SIGNAL(setupRxAudio(audioSetup)), radio->rxaudio, SLOT(init(audioSetup))); +udpserver.cpp: setupRxAudio(radio->rxAudioSetup); +udpserver.cpp: if (!memcmp(radio->guid, current->guid, sizeof(radio->guid)) || config->rigs.size()==1) +udpserver.cpp: QMetaObject::invokeMethod(radio->rig, [=]() { +udpserver.cpp: radio->rig->dataFromServer(r.mid(0x15));; +udpserver.cpp: if (!memcmp(guid, radio->guid, GUIDLEN) || config->rigs.size()==1) +udpserver.cpp: memcpy(p.guid, radio->guid, GUIDLEN); +udpserver.cpp: memcpy(p.name, radio->rigName.toLocal8Bit(), sizeof(p.name)); +udpserver.cpp: if (radio->rigAvailable) { +udpserver.cpp: if (!memcmp(radio->guid, guid, GUIDLEN) || config->rigs.size() == 1) +udpserver.cpp: if (radio->rxAudioThread != Q_NULLPTR) { +udpserver.cpp: radio->rxAudioThread->quit(); +udpserver.cpp: radio->rxAudioThread->wait(); +udpserver.cpp: radio->rxaudio = Q_NULLPTR; +udpserver.cpp: radio->rxAudioThread = Q_NULLPTR; +udpserver.cpp: if (radio->txAudioThread != Q_NULLPTR) { +udpserver.cpp: radio->txAudioThread->quit(); +udpserver.cpp: radio->txAudioThread->wait(); +udpserver.cpp: radio->txaudio = Q_NULLPTR; +udpserver.cpp: radio->txAudioThread = Q_NULLPTR; diff --git a/rxmac b/rxmac new file mode 100644 index 0000000..f6832ec --- /dev/null +++ b/rxmac @@ -0,0 +1,244 @@ +mac:servermain.cpp: if (radio->rigThread != Q_NULLPTR) +mac:servermain.cpp: radio->rigThread->quit(); +mac:servermain.cpp: radio->rigThread->wait(); +mac:servermain.cpp: if (radio->rigThread != Q_NULLPTR) +mac:servermain.cpp: QMetaObject::invokeMethod(radio->rig, [=]() { +mac:servermain.cpp: radio->rig->commSetup(radio->civAddr, radio->serialPort, radio->baudRate, QString("none"),prefs.tcpPort,radio->waterfallFormat); +mac:servermain.cpp: if (radio->rigThread == Q_NULLPTR) +mac:servermain.cpp: radio->rig = new rigCommander(radio->guid); +mac:servermain.cpp: radio->rigThread = new QThread(this); +mac:servermain.cpp: radio->rigThread->setObjectName("rigCommander()"); +mac:servermain.cpp: radio->rig->moveToThread(radio->rigThread); +mac:servermain.cpp: connect(radio->rigThread, SIGNAL(started()), radio->rig, SLOT(process())); +mac:servermain.cpp: connect(radio->rigThread, SIGNAL(finished()), radio->rig, SLOT(deleteLater())); +mac:servermain.cpp: radio->rigThread->start(); +mac:servermain.cpp: connect(radio->rig, SIGNAL(haveSerialPortError(QString, QString)), this, SLOT(receiveSerialPortError(QString, QString))); +mac:servermain.cpp: connect(radio->rig, SIGNAL(haveStatusUpdate(networkStatus)), this, SLOT(receiveStatusUpdate(networkStatus))); +mac:servermain.cpp: connect(this, SIGNAL(setRTSforPTT(bool)), radio->rig, SLOT(setRTSforPTT(bool))); +mac:servermain.cpp: connect(radio->rig, SIGNAL(haveBaudRate(quint32)), this, SLOT(receiveBaudRate(quint32))); +mac:servermain.cpp: connect(this, SIGNAL(sendCloseComm()), radio->rig, SLOT(closeComm())); +mac:servermain.cpp: connect(this, SIGNAL(sendChangeLatency(quint16)), radio->rig, SLOT(changeLatency(quint16))); +mac:servermain.cpp: //connect(this, SIGNAL(getRigCIV()), radio->rig, SLOT(findRigs())); +mac:servermain.cpp: //connect(this, SIGNAL(setRigID(unsigned char)), radio->rig, SLOT(setRigID(unsigned char))); +mac:servermain.cpp: connect(radio->rig, SIGNAL(discoveredRigID(rigCapabilities)), this, SLOT(receiveFoundRigID(rigCapabilities))); +mac:servermain.cpp: connect(radio->rig, SIGNAL(commReady()), this, SLOT(receiveCommReady())); +mac:servermain.cpp: connect(this, SIGNAL(requestRigState()), radio->rig, SLOT(sendState())); +mac:servermain.cpp: connect(this, SIGNAL(stateUpdated()), radio->rig, SLOT(stateUpdated())); +mac:servermain.cpp: connect(radio->rig, SIGNAL(stateInfo(rigstate*)), this, SLOT(receiveStateInfo(rigstate*))); +mac:servermain.cpp: connect(this, SIGNAL(setCIVAddr(unsigned char)), radio->rig, SLOT(setCIVAddr(unsigned char))); +mac:servermain.cpp: connect(radio->rig, SIGNAL(havePTTStatus(bool)), this, SLOT(receivePTTstatus(bool))); +mac:servermain.cpp: connect(this, SIGNAL(setPTT(bool)), radio->rig, SLOT(setPTT(bool))); +mac:servermain.cpp: connect(this, SIGNAL(getPTT()), radio->rig, SLOT(getPTT())); +mac:servermain.cpp: connect(this, SIGNAL(getDebug()), radio->rig, SLOT(getDebug())); +mac:servermain.cpp: if (radio->rigThread->isRunning()) { +mac:servermain.cpp: if (radio->rigThread != Q_NULLPTR) +mac:servermain.cpp: radio->rigThread->disconnect(); +mac:servermain.cpp: radio->rig->disconnect(); +mac:servermain.cpp: delete radio->rigThread; +mac:servermain.cpp: delete radio->rig; +mac:servermain.cpp: radio->rig = Q_NULLPTR; +mac:servermain.cpp: if (sender != Q_NULLPTR && radio->rig != Q_NULLPTR && !memcmp(sender->getGUID(), radio->guid, GUIDLEN)) +mac:servermain.cpp: if (radio->civAddr == 0) +mac:servermain.cpp: if (!radio->rigAvailable) { +mac:servermain.cpp: if (radio->connectTimer == Q_NULLPTR) { +mac:servermain.cpp: radio->connectTimer = new QTimer(); +mac:servermain.cpp: connect(radio->connectTimer, &QTimer::timeout, this, std::bind(&servermain::connectToRig, this, radio)); +mac:servermain.cpp: radio->connectTimer->start(500); +mac:servermain.cpp: qInfo(logSystem()) << "Skipping automatic CIV, using user-supplied value of " << radio->civAddr; +mac:servermain.cpp: QMetaObject::invokeMethod(radio->rig, [=]() { +mac:servermain.cpp: radio->rig->setRigID(radio->civAddr); +mac:servermain.cpp: if (sender != Q_NULLPTR && radio->rig != Q_NULLPTR && !radio->rigAvailable && !memcmp(sender->getGUID(), radio->guid, GUIDLEN)) +mac:servermain.cpp: radio->rigCaps = rigCaps; +mac:servermain.cpp: if (radio->rigThread != Q_NULLPTR) +mac:servermain.cpp: if (radio->rig != Q_NULLPTR) { +mac:servermain.cpp: connect(radio->rig, SIGNAL(haveAudioData(audioPacket)), udp, SLOT(receiveAudioData(audioPacket))); +mac:servermain.cpp: connect(radio->rig, SIGNAL(haveDataForServer(QByteArray)), udp, SLOT(dataForServer(QByteArray))); +mac:servermain.cpp: //connect(udp, SIGNAL(haveDataFromServer(QByteArray)), radio->rig, SLOT(dataFromServer(QByteArray))); +mac:udpserver.cpp: sendConnectionInfo(current, radio->guid); +mac:udpserver.cpp: if (!memcmp(radio->guid, current->guid, GUIDLEN) || config->rigs.size() == 1) +mac:udpserver.cpp: sendConnectionInfo(current, radio->guid); +mac:udpserver.cpp: if ((!memcmp(radio->guid, current->guid, GUIDLEN) || config->rigs.size()==1) && radio->txaudio == Q_NULLPTR && !config->lan) +mac:udpserver.cpp: radio->txAudioSetup.codec = current->txCodec; +mac:udpserver.cpp: radio->txAudioSetup.sampleRate=current->txSampleRate; +mac:udpserver.cpp: radio->txAudioSetup.isinput = false; +mac:udpserver.cpp: radio->txAudioSetup.latency = current->txBufferLen; +mac:udpserver.cpp: if (radio->txAudioSetup.type == qtAudio) { +mac:udpserver.cpp: radio->txaudio = new audioHandler(); +mac:udpserver.cpp: else if (radio->txAudioSetup.type == portAudio) { +mac:udpserver.cpp: radio->txaudio = new paHandler(); +mac:udpserver.cpp: else if (radio->txAudioSetup.type == rtAudio) { +mac:udpserver.cpp: radio->txaudio = new rtHandler(); +mac:udpserver.cpp: //radio->txaudio = new audioHandler(); +mac:udpserver.cpp: radio->txAudioThread = new QThread(this); +mac:udpserver.cpp: radio->txAudioThread->setObjectName("txAudio()"); +mac:udpserver.cpp: radio->txaudio->moveToThread(radio->txAudioThread); +mac:udpserver.cpp: radio->txAudioThread->start(QThread::TimeCriticalPriority); +mac:udpserver.cpp: connect(this, SIGNAL(setupTxAudio(audioSetup)), radio->txaudio, SLOT(init(audioSetup))); +mac:udpserver.cpp: connect(radio->txAudioThread, SIGNAL(finished()), radio->txaudio, SLOT(deleteLater())); +mac:udpserver.cpp: QMetaObject::invokeMethod(radio->txaudio, [=]() { +mac:udpserver.cpp: radio->txaudio->init(radio->txAudioSetup); +mac:udpserver.cpp: emit setupTxAudio(radio->txAudioSetup); +mac:udpserver.cpp: connect(this, SIGNAL(haveAudioData(audioPacket)), radio->txaudio, SLOT(incomingAudio(audioPacket))); +mac:udpserver.cpp: if ((!memcmp(radio->guid, current->guid, GUIDLEN) || config->rigs.size() == 1) && radio->rxaudio == Q_NULLPTR && !config->lan) +mac:udpserver.cpp: radio->rxAudioSetup.codec = current->rxCodec; +mac:udpserver.cpp: radio->rxAudioSetup.sampleRate=current->rxSampleRate; +mac:udpserver.cpp: radio->rxAudioSetup.latency = current->txBufferLen; +mac:udpserver.cpp: radio->rxAudioSetup.isinput = true; +mac:udpserver.cpp: memcpy(radio->rxAudioSetup.guid, radio->guid, GUIDLEN); +mac:udpserver.cpp: //radio->rxaudio = new audioHandler(); +mac:udpserver.cpp: if (radio->rxAudioSetup.type == qtAudio) { +mac:udpserver.cpp: radio->rxaudio = new audioHandler(); +mac:udpserver.cpp: else if (radio->rxAudioSetup.type == portAudio) { +mac:udpserver.cpp: radio->rxaudio = new paHandler(); +mac:udpserver.cpp: else if (radio->rxAudioSetup.type == rtAudio) { +mac:udpserver.cpp: radio->rxaudio = new rtHandler(); +mac:udpserver.cpp: radio->rxAudioThread = new QThread(this); +mac:udpserver.cpp: radio->rxAudioThread->setObjectName("rxAudio()"); +mac:udpserver.cpp: radio->rxaudio->moveToThread(radio->rxAudioThread); +mac:udpserver.cpp: radio->rxAudioThread->start(QThread::TimeCriticalPriority); +mac:udpserver.cpp: connect(radio->rxAudioThread, SIGNAL(finished()), radio->rxaudio, SLOT(deleteLater())); +mac:udpserver.cpp: connect(radio->rxaudio, SIGNAL(haveAudioData(audioPacket)), this, SLOT(receiveAudioData(audioPacket))); +mac:udpserver.cpp: QMetaObject::invokeMethod(radio->rxaudio, [=]() { +mac:udpserver.cpp: radio->rxaudio->init(radio->rxAudioSetup); +mac:udpserver.cpp: connect(this, SIGNAL(setupRxAudio(audioSetup)), radio->rxaudio, SLOT(init(audioSetup))); +mac:udpserver.cpp: setupRxAudio(radio->rxAudioSetup); +mac:udpserver.cpp: if (!memcmp(radio->guid, current->guid, sizeof(radio->guid)) || config->rigs.size()==1) +mac:udpserver.cpp: QMetaObject::invokeMethod(radio->rig, [=]() { +mac:udpserver.cpp: radio->rig->dataFromServer(r.mid(0x15));; +mac:udpserver.cpp: if (!memcmp(guid, radio->guid, GUIDLEN) || config->rigs.size()==1) +mac:udpserver.cpp: memcpy(p.guid, radio->guid, GUIDLEN); +mac:udpserver.cpp: memcpy(p.name, radio->rigName.toLocal8Bit(), sizeof(p.name)); +mac:udpserver.cpp: if (radio->rigAvailable) { +mac:udpserver.cpp: if (!memcmp(radio->guid, guid, GUIDLEN) || config->rigs.size() == 1) +mac:udpserver.cpp: if (radio->rxAudioThread != Q_NULLPTR) { +mac:udpserver.cpp: radio->rxAudioThread->quit(); +mac:udpserver.cpp: radio->rxAudioThread->wait(); +mac:udpserver.cpp: radio->rxaudio = Q_NULLPTR; +mac:udpserver.cpp: radio->rxAudioThread = Q_NULLPTR; +mac:udpserver.cpp: if (radio->txAudioThread != Q_NULLPTR) { +mac:udpserver.cpp: radio->txAudioThread->quit(); +mac:udpserver.cpp: radio->txAudioThread->wait(); +mac:udpserver.cpp: radio->txaudio = Q_NULLPTR; +mac:udpserver.cpp: radio->txAudioThread = Q_NULLPTR; +servermain.cpp: if (radio->rigThread != Q_NULLPTR) +servermain.cpp: radio->rigThread->quit(); +servermain.cpp: radio->rigThread->wait(); +servermain.cpp: if (radio->rigThread != Q_NULLPTR) +servermain.cpp: QMetaObject::invokeMethod(radio->rig, [=]() { +servermain.cpp: radio->rig->commSetup(radio->civAddr, radio->serialPort, radio->baudRate, QString("none"),prefs.tcpPort,radio->waterfallFormat); +servermain.cpp: if (radio->rigThread == Q_NULLPTR) +servermain.cpp: radio->rig = new rigCommander(radio->guid); +servermain.cpp: radio->rigThread = new QThread(this); +servermain.cpp: radio->rigThread->setObjectName("rigCommander()"); +servermain.cpp: radio->rig->moveToThread(radio->rigThread); +servermain.cpp: connect(radio->rigThread, SIGNAL(started()), radio->rig, SLOT(process())); +servermain.cpp: connect(radio->rigThread, SIGNAL(finished()), radio->rig, SLOT(deleteLater())); +servermain.cpp: radio->rigThread->start(); +servermain.cpp: connect(radio->rig, SIGNAL(haveSerialPortError(QString, QString)), this, SLOT(receiveSerialPortError(QString, QString))); +servermain.cpp: connect(radio->rig, SIGNAL(haveStatusUpdate(networkStatus)), this, SLOT(receiveStatusUpdate(networkStatus))); +servermain.cpp: connect(this, SIGNAL(setRTSforPTT(bool)), radio->rig, SLOT(setRTSforPTT(bool))); +servermain.cpp: connect(radio->rig, SIGNAL(haveBaudRate(quint32)), this, SLOT(receiveBaudRate(quint32))); +servermain.cpp: connect(this, SIGNAL(sendCloseComm()), radio->rig, SLOT(closeComm())); +servermain.cpp: connect(this, SIGNAL(sendChangeLatency(quint16)), radio->rig, SLOT(changeLatency(quint16))); +servermain.cpp: //connect(this, SIGNAL(getRigCIV()), radio->rig, SLOT(findRigs())); +servermain.cpp: //connect(this, SIGNAL(setRigID(unsigned char)), radio->rig, SLOT(setRigID(unsigned char))); +servermain.cpp: connect(radio->rig, SIGNAL(discoveredRigID(rigCapabilities)), this, SLOT(receiveFoundRigID(rigCapabilities))); +servermain.cpp: connect(radio->rig, SIGNAL(commReady()), this, SLOT(receiveCommReady())); +servermain.cpp: connect(this, SIGNAL(requestRigState()), radio->rig, SLOT(sendState())); +servermain.cpp: connect(this, SIGNAL(stateUpdated()), radio->rig, SLOT(stateUpdated())); +servermain.cpp: connect(radio->rig, SIGNAL(stateInfo(rigstate*)), this, SLOT(receiveStateInfo(rigstate*))); +servermain.cpp: connect(this, SIGNAL(setCIVAddr(unsigned char)), radio->rig, SLOT(setCIVAddr(unsigned char))); +servermain.cpp: connect(radio->rig, SIGNAL(havePTTStatus(bool)), this, SLOT(receivePTTstatus(bool))); +servermain.cpp: connect(this, SIGNAL(setPTT(bool)), radio->rig, SLOT(setPTT(bool))); +servermain.cpp: connect(this, SIGNAL(getPTT()), radio->rig, SLOT(getPTT())); +servermain.cpp: connect(this, SIGNAL(getDebug()), radio->rig, SLOT(getDebug())); +servermain.cpp: if (radio->rigThread->isRunning()) { +servermain.cpp: if (radio->rigThread != Q_NULLPTR) +servermain.cpp: radio->rigThread->disconnect(); +servermain.cpp: radio->rig->disconnect(); +servermain.cpp: delete radio->rigThread; +servermain.cpp: delete radio->rig; +servermain.cpp: radio->rig = Q_NULLPTR; +servermain.cpp: if (sender != Q_NULLPTR && radio->rig != Q_NULLPTR && !memcmp(sender->getGUID(), radio->guid, GUIDLEN)) +servermain.cpp: if (radio->civAddr == 0) +servermain.cpp: if (!radio->rigAvailable) { +servermain.cpp: if (radio->connectTimer == Q_NULLPTR) { +servermain.cpp: radio->connectTimer = new QTimer(); +servermain.cpp: connect(radio->connectTimer, &QTimer::timeout, this, std::bind(&servermain::connectToRig, this, radio)); +servermain.cpp: radio->connectTimer->start(500); +servermain.cpp: qInfo(logSystem()) << "Skipping automatic CIV, using user-supplied value of " << radio->civAddr; +servermain.cpp: QMetaObject::invokeMethod(radio->rig, [=]() { +servermain.cpp: radio->rig->setRigID(radio->civAddr); +servermain.cpp: if (sender != Q_NULLPTR && radio->rig != Q_NULLPTR && !radio->rigAvailable && !memcmp(sender->getGUID(), radio->guid, GUIDLEN)) +servermain.cpp: radio->rigCaps = rigCaps; +servermain.cpp: if (radio->rigThread != Q_NULLPTR) +servermain.cpp: if (radio->rig != Q_NULLPTR) { +servermain.cpp: connect(radio->rig, SIGNAL(haveAudioData(audioPacket)), udp, SLOT(receiveAudioData(audioPacket))); +servermain.cpp: connect(radio->rig, SIGNAL(haveDataForServer(QByteArray)), udp, SLOT(dataForServer(QByteArray))); +servermain.cpp: //connect(udp, SIGNAL(haveDataFromServer(QByteArray)), radio->rig, SLOT(dataFromServer(QByteArray))); +udpserver.cpp: sendConnectionInfo(current, radio->guid); +udpserver.cpp: if (!memcmp(radio->guid, current->guid, GUIDLEN) || config->rigs.size() == 1) +udpserver.cpp: sendConnectionInfo(current, radio->guid); +udpserver.cpp: if ((!memcmp(radio->guid, current->guid, GUIDLEN) || config->rigs.size()==1) && radio->txaudio == Q_NULLPTR && !config->lan) +udpserver.cpp: radio->txAudioSetup.codec = current->txCodec; +udpserver.cpp: radio->txAudioSetup.sampleRate=current->txSampleRate; +udpserver.cpp: radio->txAudioSetup.isinput = false; +udpserver.cpp: radio->txAudioSetup.latency = current->txBufferLen; +udpserver.cpp: if (radio->txAudioSetup.type == qtAudio) { +udpserver.cpp: radio->txaudio = new audioHandler(); +udpserver.cpp: else if (radio->txAudioSetup.type == portAudio) { +udpserver.cpp: radio->txaudio = new paHandler(); +udpserver.cpp: else if (radio->txAudioSetup.type == rtAudio) { +udpserver.cpp: radio->txaudio = new rtHandler(); +udpserver.cpp: //radio->txaudio = new audioHandler(); +udpserver.cpp: radio->txAudioThread = new QThread(this); +udpserver.cpp: radio->txAudioThread->setObjectName("txAudio()"); +udpserver.cpp: radio->txaudio->moveToThread(radio->txAudioThread); +udpserver.cpp: radio->txAudioThread->start(QThread::TimeCriticalPriority); +udpserver.cpp: connect(this, SIGNAL(setupTxAudio(audioSetup)), radio->txaudio, SLOT(init(audioSetup))); +udpserver.cpp: connect(radio->txAudioThread, SIGNAL(finished()), radio->txaudio, SLOT(deleteLater())); +udpserver.cpp: QMetaObject::invokeMethod(radio->txaudio, [=]() { +udpserver.cpp: radio->txaudio->init(radio->txAudioSetup); +udpserver.cpp: emit setupTxAudio(radio->txAudioSetup); +udpserver.cpp: connect(this, SIGNAL(haveAudioData(audioPacket)), radio->txaudio, SLOT(incomingAudio(audioPacket))); +udpserver.cpp: if ((!memcmp(radio->guid, current->guid, GUIDLEN) || config->rigs.size() == 1) && radio->rxaudio == Q_NULLPTR && !config->lan) +udpserver.cpp: radio->rxAudioSetup.codec = current->rxCodec; +udpserver.cpp: radio->rxAudioSetup.sampleRate=current->rxSampleRate; +udpserver.cpp: radio->rxAudioSetup.latency = current->txBufferLen; +udpserver.cpp: radio->rxAudioSetup.isinput = true; +udpserver.cpp: memcpy(radio->rxAudioSetup.guid, radio->guid, GUIDLEN); +udpserver.cpp: //radio->rxaudio = new audioHandler(); +udpserver.cpp: if (radio->rxAudioSetup.type == qtAudio) { +udpserver.cpp: radio->rxaudio = new audioHandler(); +udpserver.cpp: else if (radio->rxAudioSetup.type == portAudio) { +udpserver.cpp: radio->rxaudio = new paHandler(); +udpserver.cpp: else if (radio->rxAudioSetup.type == rtAudio) { +udpserver.cpp: radio->rxaudio = new rtHandler(); +udpserver.cpp: radio->rxAudioThread = new QThread(this); +udpserver.cpp: radio->rxAudioThread->setObjectName("rxAudio()"); +udpserver.cpp: radio->rxaudio->moveToThread(radio->rxAudioThread); +udpserver.cpp: radio->rxAudioThread->start(QThread::TimeCriticalPriority); +udpserver.cpp: connect(radio->rxAudioThread, SIGNAL(finished()), radio->rxaudio, SLOT(deleteLater())); +udpserver.cpp: connect(radio->rxaudio, SIGNAL(haveAudioData(audioPacket)), this, SLOT(receiveAudioData(audioPacket))); +udpserver.cpp: QMetaObject::invokeMethod(radio->rxaudio, [=]() { +udpserver.cpp: radio->rxaudio->init(radio->rxAudioSetup); +udpserver.cpp: connect(this, SIGNAL(setupRxAudio(audioSetup)), radio->rxaudio, SLOT(init(audioSetup))); +udpserver.cpp: setupRxAudio(radio->rxAudioSetup); +udpserver.cpp: if (!memcmp(radio->guid, current->guid, sizeof(radio->guid)) || config->rigs.size()==1) +udpserver.cpp: QMetaObject::invokeMethod(radio->rig, [=]() { +udpserver.cpp: radio->rig->dataFromServer(r.mid(0x15));; +udpserver.cpp: if (!memcmp(guid, radio->guid, GUIDLEN) || config->rigs.size()==1) +udpserver.cpp: memcpy(p.guid, radio->guid, GUIDLEN); +udpserver.cpp: memcpy(p.name, radio->rigName.toLocal8Bit(), sizeof(p.name)); +udpserver.cpp: if (radio->rigAvailable) { +udpserver.cpp: if (!memcmp(radio->guid, guid, GUIDLEN) || config->rigs.size() == 1) +udpserver.cpp: if (radio->rxAudioThread != Q_NULLPTR) { +udpserver.cpp: radio->rxAudioThread->quit(); +udpserver.cpp: radio->rxAudioThread->wait(); +udpserver.cpp: radio->rxaudio = Q_NULLPTR; +udpserver.cpp: radio->rxAudioThread = Q_NULLPTR; +udpserver.cpp: if (radio->txAudioThread != Q_NULLPTR) { +udpserver.cpp: radio->txAudioThread->quit(); +udpserver.cpp: radio->txAudioThread->wait(); +udpserver.cpp: radio->txaudio = Q_NULLPTR; +udpserver.cpp: radio->txAudioThread = Q_NULLPTR; diff --git a/wfserver.pro b/wfserver.pro index 41e74e9..658d0a0 100644 --- a/wfserver.pro +++ b/wfserver.pro @@ -13,7 +13,7 @@ TEMPLATE = app CONFIG += console -DEFINES += WFVIEW_VERSION=\\\"1.44\\\" +DEFINES += WFVIEW_VERSION=\\\"1.45\\\" DEFINES += BUILD_WFSERVER diff --git a/wfview.pro b/wfview.pro index 784ca7a..31d9cc4 100644 --- a/wfview.pro +++ b/wfview.pro @@ -11,7 +11,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport TARGET = wfview TEMPLATE = app -DEFINES += WFVIEW_VERSION=\\\"1.44\\\" +DEFINES += WFVIEW_VERSION=\\\"1.45\\\" DEFINES += BUILD_WFVIEW From 8638086f3f7e1ad8aaf30c6882afa7d2ad48d022 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Sun, 18 Sep 2022 13:05:08 +0200 Subject: [PATCH 084/207] removed lingering files --- mac | 122 ----------------------------- rxmac | 244 ---------------------------------------------------------- 2 files changed, 366 deletions(-) delete mode 100644 mac delete mode 100644 rxmac diff --git a/mac b/mac deleted file mode 100644 index 74c9e21..0000000 --- a/mac +++ /dev/null @@ -1,122 +0,0 @@ -servermain.cpp: if (radio->rigThread != Q_NULLPTR) -servermain.cpp: radio->rigThread->quit(); -servermain.cpp: radio->rigThread->wait(); -servermain.cpp: if (radio->rigThread != Q_NULLPTR) -servermain.cpp: QMetaObject::invokeMethod(radio->rig, [=]() { -servermain.cpp: radio->rig->commSetup(radio->civAddr, radio->serialPort, radio->baudRate, QString("none"),prefs.tcpPort,radio->waterfallFormat); -servermain.cpp: if (radio->rigThread == Q_NULLPTR) -servermain.cpp: radio->rig = new rigCommander(radio->guid); -servermain.cpp: radio->rigThread = new QThread(this); -servermain.cpp: radio->rigThread->setObjectName("rigCommander()"); -servermain.cpp: radio->rig->moveToThread(radio->rigThread); -servermain.cpp: connect(radio->rigThread, SIGNAL(started()), radio->rig, SLOT(process())); -servermain.cpp: connect(radio->rigThread, SIGNAL(finished()), radio->rig, SLOT(deleteLater())); -servermain.cpp: radio->rigThread->start(); -servermain.cpp: connect(radio->rig, SIGNAL(haveSerialPortError(QString, QString)), this, SLOT(receiveSerialPortError(QString, QString))); -servermain.cpp: connect(radio->rig, SIGNAL(haveStatusUpdate(networkStatus)), this, SLOT(receiveStatusUpdate(networkStatus))); -servermain.cpp: connect(this, SIGNAL(setRTSforPTT(bool)), radio->rig, SLOT(setRTSforPTT(bool))); -servermain.cpp: connect(radio->rig, SIGNAL(haveBaudRate(quint32)), this, SLOT(receiveBaudRate(quint32))); -servermain.cpp: connect(this, SIGNAL(sendCloseComm()), radio->rig, SLOT(closeComm())); -servermain.cpp: connect(this, SIGNAL(sendChangeLatency(quint16)), radio->rig, SLOT(changeLatency(quint16))); -servermain.cpp: //connect(this, SIGNAL(getRigCIV()), radio->rig, SLOT(findRigs())); -servermain.cpp: //connect(this, SIGNAL(setRigID(unsigned char)), radio->rig, SLOT(setRigID(unsigned char))); -servermain.cpp: connect(radio->rig, SIGNAL(discoveredRigID(rigCapabilities)), this, SLOT(receiveFoundRigID(rigCapabilities))); -servermain.cpp: connect(radio->rig, SIGNAL(commReady()), this, SLOT(receiveCommReady())); -servermain.cpp: connect(this, SIGNAL(requestRigState()), radio->rig, SLOT(sendState())); -servermain.cpp: connect(this, SIGNAL(stateUpdated()), radio->rig, SLOT(stateUpdated())); -servermain.cpp: connect(radio->rig, SIGNAL(stateInfo(rigstate*)), this, SLOT(receiveStateInfo(rigstate*))); -servermain.cpp: connect(this, SIGNAL(setCIVAddr(unsigned char)), radio->rig, SLOT(setCIVAddr(unsigned char))); -servermain.cpp: connect(radio->rig, SIGNAL(havePTTStatus(bool)), this, SLOT(receivePTTstatus(bool))); -servermain.cpp: connect(this, SIGNAL(setPTT(bool)), radio->rig, SLOT(setPTT(bool))); -servermain.cpp: connect(this, SIGNAL(getPTT()), radio->rig, SLOT(getPTT())); -servermain.cpp: connect(this, SIGNAL(getDebug()), radio->rig, SLOT(getDebug())); -servermain.cpp: if (radio->rigThread->isRunning()) { -servermain.cpp: if (radio->rigThread != Q_NULLPTR) -servermain.cpp: radio->rigThread->disconnect(); -servermain.cpp: radio->rig->disconnect(); -servermain.cpp: delete radio->rigThread; -servermain.cpp: delete radio->rig; -servermain.cpp: radio->rig = Q_NULLPTR; -servermain.cpp: if (sender != Q_NULLPTR && radio->rig != Q_NULLPTR && !memcmp(sender->getGUID(), radio->guid, GUIDLEN)) -servermain.cpp: if (radio->civAddr == 0) -servermain.cpp: if (!radio->rigAvailable) { -servermain.cpp: if (radio->connectTimer == Q_NULLPTR) { -servermain.cpp: radio->connectTimer = new QTimer(); -servermain.cpp: connect(radio->connectTimer, &QTimer::timeout, this, std::bind(&servermain::connectToRig, this, radio)); -servermain.cpp: radio->connectTimer->start(500); -servermain.cpp: qInfo(logSystem()) << "Skipping automatic CIV, using user-supplied value of " << radio->civAddr; -servermain.cpp: QMetaObject::invokeMethod(radio->rig, [=]() { -servermain.cpp: radio->rig->setRigID(radio->civAddr); -servermain.cpp: if (sender != Q_NULLPTR && radio->rig != Q_NULLPTR && !radio->rigAvailable && !memcmp(sender->getGUID(), radio->guid, GUIDLEN)) -servermain.cpp: radio->rigCaps = rigCaps; -servermain.cpp: if (radio->rigThread != Q_NULLPTR) -servermain.cpp: if (radio->rig != Q_NULLPTR) { -servermain.cpp: connect(radio->rig, SIGNAL(haveAudioData(audioPacket)), udp, SLOT(receiveAudioData(audioPacket))); -servermain.cpp: connect(radio->rig, SIGNAL(haveDataForServer(QByteArray)), udp, SLOT(dataForServer(QByteArray))); -servermain.cpp: //connect(udp, SIGNAL(haveDataFromServer(QByteArray)), radio->rig, SLOT(dataFromServer(QByteArray))); -udpserver.cpp: sendConnectionInfo(current, radio->guid); -udpserver.cpp: if (!memcmp(radio->guid, current->guid, GUIDLEN) || config->rigs.size() == 1) -udpserver.cpp: sendConnectionInfo(current, radio->guid); -udpserver.cpp: if ((!memcmp(radio->guid, current->guid, GUIDLEN) || config->rigs.size()==1) && radio->txaudio == Q_NULLPTR && !config->lan) -udpserver.cpp: radio->txAudioSetup.codec = current->txCodec; -udpserver.cpp: radio->txAudioSetup.sampleRate=current->txSampleRate; -udpserver.cpp: radio->txAudioSetup.isinput = false; -udpserver.cpp: radio->txAudioSetup.latency = current->txBufferLen; -udpserver.cpp: if (radio->txAudioSetup.type == qtAudio) { -udpserver.cpp: radio->txaudio = new audioHandler(); -udpserver.cpp: else if (radio->txAudioSetup.type == portAudio) { -udpserver.cpp: radio->txaudio = new paHandler(); -udpserver.cpp: else if (radio->txAudioSetup.type == rtAudio) { -udpserver.cpp: radio->txaudio = new rtHandler(); -udpserver.cpp: //radio->txaudio = new audioHandler(); -udpserver.cpp: radio->txAudioThread = new QThread(this); -udpserver.cpp: radio->txAudioThread->setObjectName("txAudio()"); -udpserver.cpp: radio->txaudio->moveToThread(radio->txAudioThread); -udpserver.cpp: radio->txAudioThread->start(QThread::TimeCriticalPriority); -udpserver.cpp: connect(this, SIGNAL(setupTxAudio(audioSetup)), radio->txaudio, SLOT(init(audioSetup))); -udpserver.cpp: connect(radio->txAudioThread, SIGNAL(finished()), radio->txaudio, SLOT(deleteLater())); -udpserver.cpp: QMetaObject::invokeMethod(radio->txaudio, [=]() { -udpserver.cpp: radio->txaudio->init(radio->txAudioSetup); -udpserver.cpp: emit setupTxAudio(radio->txAudioSetup); -udpserver.cpp: connect(this, SIGNAL(haveAudioData(audioPacket)), radio->txaudio, SLOT(incomingAudio(audioPacket))); -udpserver.cpp: if ((!memcmp(radio->guid, current->guid, GUIDLEN) || config->rigs.size() == 1) && radio->rxaudio == Q_NULLPTR && !config->lan) -udpserver.cpp: radio->rxAudioSetup.codec = current->rxCodec; -udpserver.cpp: radio->rxAudioSetup.sampleRate=current->rxSampleRate; -udpserver.cpp: radio->rxAudioSetup.latency = current->txBufferLen; -udpserver.cpp: radio->rxAudioSetup.isinput = true; -udpserver.cpp: memcpy(radio->rxAudioSetup.guid, radio->guid, GUIDLEN); -udpserver.cpp: //radio->rxaudio = new audioHandler(); -udpserver.cpp: if (radio->rxAudioSetup.type == qtAudio) { -udpserver.cpp: radio->rxaudio = new audioHandler(); -udpserver.cpp: else if (radio->rxAudioSetup.type == portAudio) { -udpserver.cpp: radio->rxaudio = new paHandler(); -udpserver.cpp: else if (radio->rxAudioSetup.type == rtAudio) { -udpserver.cpp: radio->rxaudio = new rtHandler(); -udpserver.cpp: radio->rxAudioThread = new QThread(this); -udpserver.cpp: radio->rxAudioThread->setObjectName("rxAudio()"); -udpserver.cpp: radio->rxaudio->moveToThread(radio->rxAudioThread); -udpserver.cpp: radio->rxAudioThread->start(QThread::TimeCriticalPriority); -udpserver.cpp: connect(radio->rxAudioThread, SIGNAL(finished()), radio->rxaudio, SLOT(deleteLater())); -udpserver.cpp: connect(radio->rxaudio, SIGNAL(haveAudioData(audioPacket)), this, SLOT(receiveAudioData(audioPacket))); -udpserver.cpp: QMetaObject::invokeMethod(radio->rxaudio, [=]() { -udpserver.cpp: radio->rxaudio->init(radio->rxAudioSetup); -udpserver.cpp: connect(this, SIGNAL(setupRxAudio(audioSetup)), radio->rxaudio, SLOT(init(audioSetup))); -udpserver.cpp: setupRxAudio(radio->rxAudioSetup); -udpserver.cpp: if (!memcmp(radio->guid, current->guid, sizeof(radio->guid)) || config->rigs.size()==1) -udpserver.cpp: QMetaObject::invokeMethod(radio->rig, [=]() { -udpserver.cpp: radio->rig->dataFromServer(r.mid(0x15));; -udpserver.cpp: if (!memcmp(guid, radio->guid, GUIDLEN) || config->rigs.size()==1) -udpserver.cpp: memcpy(p.guid, radio->guid, GUIDLEN); -udpserver.cpp: memcpy(p.name, radio->rigName.toLocal8Bit(), sizeof(p.name)); -udpserver.cpp: if (radio->rigAvailable) { -udpserver.cpp: if (!memcmp(radio->guid, guid, GUIDLEN) || config->rigs.size() == 1) -udpserver.cpp: if (radio->rxAudioThread != Q_NULLPTR) { -udpserver.cpp: radio->rxAudioThread->quit(); -udpserver.cpp: radio->rxAudioThread->wait(); -udpserver.cpp: radio->rxaudio = Q_NULLPTR; -udpserver.cpp: radio->rxAudioThread = Q_NULLPTR; -udpserver.cpp: if (radio->txAudioThread != Q_NULLPTR) { -udpserver.cpp: radio->txAudioThread->quit(); -udpserver.cpp: radio->txAudioThread->wait(); -udpserver.cpp: radio->txaudio = Q_NULLPTR; -udpserver.cpp: radio->txAudioThread = Q_NULLPTR; diff --git a/rxmac b/rxmac deleted file mode 100644 index f6832ec..0000000 --- a/rxmac +++ /dev/null @@ -1,244 +0,0 @@ -mac:servermain.cpp: if (radio->rigThread != Q_NULLPTR) -mac:servermain.cpp: radio->rigThread->quit(); -mac:servermain.cpp: radio->rigThread->wait(); -mac:servermain.cpp: if (radio->rigThread != Q_NULLPTR) -mac:servermain.cpp: QMetaObject::invokeMethod(radio->rig, [=]() { -mac:servermain.cpp: radio->rig->commSetup(radio->civAddr, radio->serialPort, radio->baudRate, QString("none"),prefs.tcpPort,radio->waterfallFormat); -mac:servermain.cpp: if (radio->rigThread == Q_NULLPTR) -mac:servermain.cpp: radio->rig = new rigCommander(radio->guid); -mac:servermain.cpp: radio->rigThread = new QThread(this); -mac:servermain.cpp: radio->rigThread->setObjectName("rigCommander()"); -mac:servermain.cpp: radio->rig->moveToThread(radio->rigThread); -mac:servermain.cpp: connect(radio->rigThread, SIGNAL(started()), radio->rig, SLOT(process())); -mac:servermain.cpp: connect(radio->rigThread, SIGNAL(finished()), radio->rig, SLOT(deleteLater())); -mac:servermain.cpp: radio->rigThread->start(); -mac:servermain.cpp: connect(radio->rig, SIGNAL(haveSerialPortError(QString, QString)), this, SLOT(receiveSerialPortError(QString, QString))); -mac:servermain.cpp: connect(radio->rig, SIGNAL(haveStatusUpdate(networkStatus)), this, SLOT(receiveStatusUpdate(networkStatus))); -mac:servermain.cpp: connect(this, SIGNAL(setRTSforPTT(bool)), radio->rig, SLOT(setRTSforPTT(bool))); -mac:servermain.cpp: connect(radio->rig, SIGNAL(haveBaudRate(quint32)), this, SLOT(receiveBaudRate(quint32))); -mac:servermain.cpp: connect(this, SIGNAL(sendCloseComm()), radio->rig, SLOT(closeComm())); -mac:servermain.cpp: connect(this, SIGNAL(sendChangeLatency(quint16)), radio->rig, SLOT(changeLatency(quint16))); -mac:servermain.cpp: //connect(this, SIGNAL(getRigCIV()), radio->rig, SLOT(findRigs())); -mac:servermain.cpp: //connect(this, SIGNAL(setRigID(unsigned char)), radio->rig, SLOT(setRigID(unsigned char))); -mac:servermain.cpp: connect(radio->rig, SIGNAL(discoveredRigID(rigCapabilities)), this, SLOT(receiveFoundRigID(rigCapabilities))); -mac:servermain.cpp: connect(radio->rig, SIGNAL(commReady()), this, SLOT(receiveCommReady())); -mac:servermain.cpp: connect(this, SIGNAL(requestRigState()), radio->rig, SLOT(sendState())); -mac:servermain.cpp: connect(this, SIGNAL(stateUpdated()), radio->rig, SLOT(stateUpdated())); -mac:servermain.cpp: connect(radio->rig, SIGNAL(stateInfo(rigstate*)), this, SLOT(receiveStateInfo(rigstate*))); -mac:servermain.cpp: connect(this, SIGNAL(setCIVAddr(unsigned char)), radio->rig, SLOT(setCIVAddr(unsigned char))); -mac:servermain.cpp: connect(radio->rig, SIGNAL(havePTTStatus(bool)), this, SLOT(receivePTTstatus(bool))); -mac:servermain.cpp: connect(this, SIGNAL(setPTT(bool)), radio->rig, SLOT(setPTT(bool))); -mac:servermain.cpp: connect(this, SIGNAL(getPTT()), radio->rig, SLOT(getPTT())); -mac:servermain.cpp: connect(this, SIGNAL(getDebug()), radio->rig, SLOT(getDebug())); -mac:servermain.cpp: if (radio->rigThread->isRunning()) { -mac:servermain.cpp: if (radio->rigThread != Q_NULLPTR) -mac:servermain.cpp: radio->rigThread->disconnect(); -mac:servermain.cpp: radio->rig->disconnect(); -mac:servermain.cpp: delete radio->rigThread; -mac:servermain.cpp: delete radio->rig; -mac:servermain.cpp: radio->rig = Q_NULLPTR; -mac:servermain.cpp: if (sender != Q_NULLPTR && radio->rig != Q_NULLPTR && !memcmp(sender->getGUID(), radio->guid, GUIDLEN)) -mac:servermain.cpp: if (radio->civAddr == 0) -mac:servermain.cpp: if (!radio->rigAvailable) { -mac:servermain.cpp: if (radio->connectTimer == Q_NULLPTR) { -mac:servermain.cpp: radio->connectTimer = new QTimer(); -mac:servermain.cpp: connect(radio->connectTimer, &QTimer::timeout, this, std::bind(&servermain::connectToRig, this, radio)); -mac:servermain.cpp: radio->connectTimer->start(500); -mac:servermain.cpp: qInfo(logSystem()) << "Skipping automatic CIV, using user-supplied value of " << radio->civAddr; -mac:servermain.cpp: QMetaObject::invokeMethod(radio->rig, [=]() { -mac:servermain.cpp: radio->rig->setRigID(radio->civAddr); -mac:servermain.cpp: if (sender != Q_NULLPTR && radio->rig != Q_NULLPTR && !radio->rigAvailable && !memcmp(sender->getGUID(), radio->guid, GUIDLEN)) -mac:servermain.cpp: radio->rigCaps = rigCaps; -mac:servermain.cpp: if (radio->rigThread != Q_NULLPTR) -mac:servermain.cpp: if (radio->rig != Q_NULLPTR) { -mac:servermain.cpp: connect(radio->rig, SIGNAL(haveAudioData(audioPacket)), udp, SLOT(receiveAudioData(audioPacket))); -mac:servermain.cpp: connect(radio->rig, SIGNAL(haveDataForServer(QByteArray)), udp, SLOT(dataForServer(QByteArray))); -mac:servermain.cpp: //connect(udp, SIGNAL(haveDataFromServer(QByteArray)), radio->rig, SLOT(dataFromServer(QByteArray))); -mac:udpserver.cpp: sendConnectionInfo(current, radio->guid); -mac:udpserver.cpp: if (!memcmp(radio->guid, current->guid, GUIDLEN) || config->rigs.size() == 1) -mac:udpserver.cpp: sendConnectionInfo(current, radio->guid); -mac:udpserver.cpp: if ((!memcmp(radio->guid, current->guid, GUIDLEN) || config->rigs.size()==1) && radio->txaudio == Q_NULLPTR && !config->lan) -mac:udpserver.cpp: radio->txAudioSetup.codec = current->txCodec; -mac:udpserver.cpp: radio->txAudioSetup.sampleRate=current->txSampleRate; -mac:udpserver.cpp: radio->txAudioSetup.isinput = false; -mac:udpserver.cpp: radio->txAudioSetup.latency = current->txBufferLen; -mac:udpserver.cpp: if (radio->txAudioSetup.type == qtAudio) { -mac:udpserver.cpp: radio->txaudio = new audioHandler(); -mac:udpserver.cpp: else if (radio->txAudioSetup.type == portAudio) { -mac:udpserver.cpp: radio->txaudio = new paHandler(); -mac:udpserver.cpp: else if (radio->txAudioSetup.type == rtAudio) { -mac:udpserver.cpp: radio->txaudio = new rtHandler(); -mac:udpserver.cpp: //radio->txaudio = new audioHandler(); -mac:udpserver.cpp: radio->txAudioThread = new QThread(this); -mac:udpserver.cpp: radio->txAudioThread->setObjectName("txAudio()"); -mac:udpserver.cpp: radio->txaudio->moveToThread(radio->txAudioThread); -mac:udpserver.cpp: radio->txAudioThread->start(QThread::TimeCriticalPriority); -mac:udpserver.cpp: connect(this, SIGNAL(setupTxAudio(audioSetup)), radio->txaudio, SLOT(init(audioSetup))); -mac:udpserver.cpp: connect(radio->txAudioThread, SIGNAL(finished()), radio->txaudio, SLOT(deleteLater())); -mac:udpserver.cpp: QMetaObject::invokeMethod(radio->txaudio, [=]() { -mac:udpserver.cpp: radio->txaudio->init(radio->txAudioSetup); -mac:udpserver.cpp: emit setupTxAudio(radio->txAudioSetup); -mac:udpserver.cpp: connect(this, SIGNAL(haveAudioData(audioPacket)), radio->txaudio, SLOT(incomingAudio(audioPacket))); -mac:udpserver.cpp: if ((!memcmp(radio->guid, current->guid, GUIDLEN) || config->rigs.size() == 1) && radio->rxaudio == Q_NULLPTR && !config->lan) -mac:udpserver.cpp: radio->rxAudioSetup.codec = current->rxCodec; -mac:udpserver.cpp: radio->rxAudioSetup.sampleRate=current->rxSampleRate; -mac:udpserver.cpp: radio->rxAudioSetup.latency = current->txBufferLen; -mac:udpserver.cpp: radio->rxAudioSetup.isinput = true; -mac:udpserver.cpp: memcpy(radio->rxAudioSetup.guid, radio->guid, GUIDLEN); -mac:udpserver.cpp: //radio->rxaudio = new audioHandler(); -mac:udpserver.cpp: if (radio->rxAudioSetup.type == qtAudio) { -mac:udpserver.cpp: radio->rxaudio = new audioHandler(); -mac:udpserver.cpp: else if (radio->rxAudioSetup.type == portAudio) { -mac:udpserver.cpp: radio->rxaudio = new paHandler(); -mac:udpserver.cpp: else if (radio->rxAudioSetup.type == rtAudio) { -mac:udpserver.cpp: radio->rxaudio = new rtHandler(); -mac:udpserver.cpp: radio->rxAudioThread = new QThread(this); -mac:udpserver.cpp: radio->rxAudioThread->setObjectName("rxAudio()"); -mac:udpserver.cpp: radio->rxaudio->moveToThread(radio->rxAudioThread); -mac:udpserver.cpp: radio->rxAudioThread->start(QThread::TimeCriticalPriority); -mac:udpserver.cpp: connect(radio->rxAudioThread, SIGNAL(finished()), radio->rxaudio, SLOT(deleteLater())); -mac:udpserver.cpp: connect(radio->rxaudio, SIGNAL(haveAudioData(audioPacket)), this, SLOT(receiveAudioData(audioPacket))); -mac:udpserver.cpp: QMetaObject::invokeMethod(radio->rxaudio, [=]() { -mac:udpserver.cpp: radio->rxaudio->init(radio->rxAudioSetup); -mac:udpserver.cpp: connect(this, SIGNAL(setupRxAudio(audioSetup)), radio->rxaudio, SLOT(init(audioSetup))); -mac:udpserver.cpp: setupRxAudio(radio->rxAudioSetup); -mac:udpserver.cpp: if (!memcmp(radio->guid, current->guid, sizeof(radio->guid)) || config->rigs.size()==1) -mac:udpserver.cpp: QMetaObject::invokeMethod(radio->rig, [=]() { -mac:udpserver.cpp: radio->rig->dataFromServer(r.mid(0x15));; -mac:udpserver.cpp: if (!memcmp(guid, radio->guid, GUIDLEN) || config->rigs.size()==1) -mac:udpserver.cpp: memcpy(p.guid, radio->guid, GUIDLEN); -mac:udpserver.cpp: memcpy(p.name, radio->rigName.toLocal8Bit(), sizeof(p.name)); -mac:udpserver.cpp: if (radio->rigAvailable) { -mac:udpserver.cpp: if (!memcmp(radio->guid, guid, GUIDLEN) || config->rigs.size() == 1) -mac:udpserver.cpp: if (radio->rxAudioThread != Q_NULLPTR) { -mac:udpserver.cpp: radio->rxAudioThread->quit(); -mac:udpserver.cpp: radio->rxAudioThread->wait(); -mac:udpserver.cpp: radio->rxaudio = Q_NULLPTR; -mac:udpserver.cpp: radio->rxAudioThread = Q_NULLPTR; -mac:udpserver.cpp: if (radio->txAudioThread != Q_NULLPTR) { -mac:udpserver.cpp: radio->txAudioThread->quit(); -mac:udpserver.cpp: radio->txAudioThread->wait(); -mac:udpserver.cpp: radio->txaudio = Q_NULLPTR; -mac:udpserver.cpp: radio->txAudioThread = Q_NULLPTR; -servermain.cpp: if (radio->rigThread != Q_NULLPTR) -servermain.cpp: radio->rigThread->quit(); -servermain.cpp: radio->rigThread->wait(); -servermain.cpp: if (radio->rigThread != Q_NULLPTR) -servermain.cpp: QMetaObject::invokeMethod(radio->rig, [=]() { -servermain.cpp: radio->rig->commSetup(radio->civAddr, radio->serialPort, radio->baudRate, QString("none"),prefs.tcpPort,radio->waterfallFormat); -servermain.cpp: if (radio->rigThread == Q_NULLPTR) -servermain.cpp: radio->rig = new rigCommander(radio->guid); -servermain.cpp: radio->rigThread = new QThread(this); -servermain.cpp: radio->rigThread->setObjectName("rigCommander()"); -servermain.cpp: radio->rig->moveToThread(radio->rigThread); -servermain.cpp: connect(radio->rigThread, SIGNAL(started()), radio->rig, SLOT(process())); -servermain.cpp: connect(radio->rigThread, SIGNAL(finished()), radio->rig, SLOT(deleteLater())); -servermain.cpp: radio->rigThread->start(); -servermain.cpp: connect(radio->rig, SIGNAL(haveSerialPortError(QString, QString)), this, SLOT(receiveSerialPortError(QString, QString))); -servermain.cpp: connect(radio->rig, SIGNAL(haveStatusUpdate(networkStatus)), this, SLOT(receiveStatusUpdate(networkStatus))); -servermain.cpp: connect(this, SIGNAL(setRTSforPTT(bool)), radio->rig, SLOT(setRTSforPTT(bool))); -servermain.cpp: connect(radio->rig, SIGNAL(haveBaudRate(quint32)), this, SLOT(receiveBaudRate(quint32))); -servermain.cpp: connect(this, SIGNAL(sendCloseComm()), radio->rig, SLOT(closeComm())); -servermain.cpp: connect(this, SIGNAL(sendChangeLatency(quint16)), radio->rig, SLOT(changeLatency(quint16))); -servermain.cpp: //connect(this, SIGNAL(getRigCIV()), radio->rig, SLOT(findRigs())); -servermain.cpp: //connect(this, SIGNAL(setRigID(unsigned char)), radio->rig, SLOT(setRigID(unsigned char))); -servermain.cpp: connect(radio->rig, SIGNAL(discoveredRigID(rigCapabilities)), this, SLOT(receiveFoundRigID(rigCapabilities))); -servermain.cpp: connect(radio->rig, SIGNAL(commReady()), this, SLOT(receiveCommReady())); -servermain.cpp: connect(this, SIGNAL(requestRigState()), radio->rig, SLOT(sendState())); -servermain.cpp: connect(this, SIGNAL(stateUpdated()), radio->rig, SLOT(stateUpdated())); -servermain.cpp: connect(radio->rig, SIGNAL(stateInfo(rigstate*)), this, SLOT(receiveStateInfo(rigstate*))); -servermain.cpp: connect(this, SIGNAL(setCIVAddr(unsigned char)), radio->rig, SLOT(setCIVAddr(unsigned char))); -servermain.cpp: connect(radio->rig, SIGNAL(havePTTStatus(bool)), this, SLOT(receivePTTstatus(bool))); -servermain.cpp: connect(this, SIGNAL(setPTT(bool)), radio->rig, SLOT(setPTT(bool))); -servermain.cpp: connect(this, SIGNAL(getPTT()), radio->rig, SLOT(getPTT())); -servermain.cpp: connect(this, SIGNAL(getDebug()), radio->rig, SLOT(getDebug())); -servermain.cpp: if (radio->rigThread->isRunning()) { -servermain.cpp: if (radio->rigThread != Q_NULLPTR) -servermain.cpp: radio->rigThread->disconnect(); -servermain.cpp: radio->rig->disconnect(); -servermain.cpp: delete radio->rigThread; -servermain.cpp: delete radio->rig; -servermain.cpp: radio->rig = Q_NULLPTR; -servermain.cpp: if (sender != Q_NULLPTR && radio->rig != Q_NULLPTR && !memcmp(sender->getGUID(), radio->guid, GUIDLEN)) -servermain.cpp: if (radio->civAddr == 0) -servermain.cpp: if (!radio->rigAvailable) { -servermain.cpp: if (radio->connectTimer == Q_NULLPTR) { -servermain.cpp: radio->connectTimer = new QTimer(); -servermain.cpp: connect(radio->connectTimer, &QTimer::timeout, this, std::bind(&servermain::connectToRig, this, radio)); -servermain.cpp: radio->connectTimer->start(500); -servermain.cpp: qInfo(logSystem()) << "Skipping automatic CIV, using user-supplied value of " << radio->civAddr; -servermain.cpp: QMetaObject::invokeMethod(radio->rig, [=]() { -servermain.cpp: radio->rig->setRigID(radio->civAddr); -servermain.cpp: if (sender != Q_NULLPTR && radio->rig != Q_NULLPTR && !radio->rigAvailable && !memcmp(sender->getGUID(), radio->guid, GUIDLEN)) -servermain.cpp: radio->rigCaps = rigCaps; -servermain.cpp: if (radio->rigThread != Q_NULLPTR) -servermain.cpp: if (radio->rig != Q_NULLPTR) { -servermain.cpp: connect(radio->rig, SIGNAL(haveAudioData(audioPacket)), udp, SLOT(receiveAudioData(audioPacket))); -servermain.cpp: connect(radio->rig, SIGNAL(haveDataForServer(QByteArray)), udp, SLOT(dataForServer(QByteArray))); -servermain.cpp: //connect(udp, SIGNAL(haveDataFromServer(QByteArray)), radio->rig, SLOT(dataFromServer(QByteArray))); -udpserver.cpp: sendConnectionInfo(current, radio->guid); -udpserver.cpp: if (!memcmp(radio->guid, current->guid, GUIDLEN) || config->rigs.size() == 1) -udpserver.cpp: sendConnectionInfo(current, radio->guid); -udpserver.cpp: if ((!memcmp(radio->guid, current->guid, GUIDLEN) || config->rigs.size()==1) && radio->txaudio == Q_NULLPTR && !config->lan) -udpserver.cpp: radio->txAudioSetup.codec = current->txCodec; -udpserver.cpp: radio->txAudioSetup.sampleRate=current->txSampleRate; -udpserver.cpp: radio->txAudioSetup.isinput = false; -udpserver.cpp: radio->txAudioSetup.latency = current->txBufferLen; -udpserver.cpp: if (radio->txAudioSetup.type == qtAudio) { -udpserver.cpp: radio->txaudio = new audioHandler(); -udpserver.cpp: else if (radio->txAudioSetup.type == portAudio) { -udpserver.cpp: radio->txaudio = new paHandler(); -udpserver.cpp: else if (radio->txAudioSetup.type == rtAudio) { -udpserver.cpp: radio->txaudio = new rtHandler(); -udpserver.cpp: //radio->txaudio = new audioHandler(); -udpserver.cpp: radio->txAudioThread = new QThread(this); -udpserver.cpp: radio->txAudioThread->setObjectName("txAudio()"); -udpserver.cpp: radio->txaudio->moveToThread(radio->txAudioThread); -udpserver.cpp: radio->txAudioThread->start(QThread::TimeCriticalPriority); -udpserver.cpp: connect(this, SIGNAL(setupTxAudio(audioSetup)), radio->txaudio, SLOT(init(audioSetup))); -udpserver.cpp: connect(radio->txAudioThread, SIGNAL(finished()), radio->txaudio, SLOT(deleteLater())); -udpserver.cpp: QMetaObject::invokeMethod(radio->txaudio, [=]() { -udpserver.cpp: radio->txaudio->init(radio->txAudioSetup); -udpserver.cpp: emit setupTxAudio(radio->txAudioSetup); -udpserver.cpp: connect(this, SIGNAL(haveAudioData(audioPacket)), radio->txaudio, SLOT(incomingAudio(audioPacket))); -udpserver.cpp: if ((!memcmp(radio->guid, current->guid, GUIDLEN) || config->rigs.size() == 1) && radio->rxaudio == Q_NULLPTR && !config->lan) -udpserver.cpp: radio->rxAudioSetup.codec = current->rxCodec; -udpserver.cpp: radio->rxAudioSetup.sampleRate=current->rxSampleRate; -udpserver.cpp: radio->rxAudioSetup.latency = current->txBufferLen; -udpserver.cpp: radio->rxAudioSetup.isinput = true; -udpserver.cpp: memcpy(radio->rxAudioSetup.guid, radio->guid, GUIDLEN); -udpserver.cpp: //radio->rxaudio = new audioHandler(); -udpserver.cpp: if (radio->rxAudioSetup.type == qtAudio) { -udpserver.cpp: radio->rxaudio = new audioHandler(); -udpserver.cpp: else if (radio->rxAudioSetup.type == portAudio) { -udpserver.cpp: radio->rxaudio = new paHandler(); -udpserver.cpp: else if (radio->rxAudioSetup.type == rtAudio) { -udpserver.cpp: radio->rxaudio = new rtHandler(); -udpserver.cpp: radio->rxAudioThread = new QThread(this); -udpserver.cpp: radio->rxAudioThread->setObjectName("rxAudio()"); -udpserver.cpp: radio->rxaudio->moveToThread(radio->rxAudioThread); -udpserver.cpp: radio->rxAudioThread->start(QThread::TimeCriticalPriority); -udpserver.cpp: connect(radio->rxAudioThread, SIGNAL(finished()), radio->rxaudio, SLOT(deleteLater())); -udpserver.cpp: connect(radio->rxaudio, SIGNAL(haveAudioData(audioPacket)), this, SLOT(receiveAudioData(audioPacket))); -udpserver.cpp: QMetaObject::invokeMethod(radio->rxaudio, [=]() { -udpserver.cpp: radio->rxaudio->init(radio->rxAudioSetup); -udpserver.cpp: connect(this, SIGNAL(setupRxAudio(audioSetup)), radio->rxaudio, SLOT(init(audioSetup))); -udpserver.cpp: setupRxAudio(radio->rxAudioSetup); -udpserver.cpp: if (!memcmp(radio->guid, current->guid, sizeof(radio->guid)) || config->rigs.size()==1) -udpserver.cpp: QMetaObject::invokeMethod(radio->rig, [=]() { -udpserver.cpp: radio->rig->dataFromServer(r.mid(0x15));; -udpserver.cpp: if (!memcmp(guid, radio->guid, GUIDLEN) || config->rigs.size()==1) -udpserver.cpp: memcpy(p.guid, radio->guid, GUIDLEN); -udpserver.cpp: memcpy(p.name, radio->rigName.toLocal8Bit(), sizeof(p.name)); -udpserver.cpp: if (radio->rigAvailable) { -udpserver.cpp: if (!memcmp(radio->guid, guid, GUIDLEN) || config->rigs.size() == 1) -udpserver.cpp: if (radio->rxAudioThread != Q_NULLPTR) { -udpserver.cpp: radio->rxAudioThread->quit(); -udpserver.cpp: radio->rxAudioThread->wait(); -udpserver.cpp: radio->rxaudio = Q_NULLPTR; -udpserver.cpp: radio->rxAudioThread = Q_NULLPTR; -udpserver.cpp: if (radio->txAudioThread != Q_NULLPTR) { -udpserver.cpp: radio->txAudioThread->quit(); -udpserver.cpp: radio->txAudioThread->wait(); -udpserver.cpp: radio->txaudio = Q_NULLPTR; -udpserver.cpp: radio->txAudioThread = Q_NULLPTR; From a04f7f57d363988ac7e508509f7b36046816bf22 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sun, 18 Sep 2022 14:59:03 +0100 Subject: [PATCH 085/207] Fix server user handling --- wfmain.cpp | 137 ++++++++++++++++++++++++++--------------- wfmain.h | 6 +- wfmain.ui | 35 ++++++++++- wfview.vcxproj | 38 ++++++++++-- wfview.vcxproj.filters | 15 +++++ wfview.vcxproj.user | 4 +- 6 files changed, 171 insertions(+), 64 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index d030d8d..fbdb8dd 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -1738,17 +1738,24 @@ void wfmain::loadSettings() int row = 0; ui->serverUsersTable->setRowCount(0); - foreach(SERVERUSER user, serverConfig.users) + QList::iterator user = serverConfig.users.begin(); + + while (user != serverConfig.users.end()) { - if (user.username != "" && user.password != "") + if (user->username != "" && user->password != "") { - serverAddUserLine(user.username, user.password, user.userType); + serverAddUserLine(user->username, user->password, user->userType); row++; + user++; + } + else { + user = serverConfig.users.erase(user); } } if (row == 0) { serverAddUserLine("", "", 0); + ui->serverAddUserBtn->setEnabled(false); } settings->endGroup(); @@ -1794,58 +1801,110 @@ void wfmain::serverAddUserLine(const QString& user, const QString& pass, const i ui->serverUsersTable->blockSignals(true); ui->serverUsersTable->insertRow(ui->serverUsersTable->rowCount()); - ui->serverUsersTable->setItem(ui->serverUsersTable->rowCount() - 1, 0, new QTableWidgetItem(user)); + + ui->serverUsersTable->setItem(ui->serverUsersTable->rowCount() - 1, 0, new QTableWidgetItem()); ui->serverUsersTable->setItem(ui->serverUsersTable->rowCount() - 1, 1, new QTableWidgetItem()); ui->serverUsersTable->setItem(ui->serverUsersTable->rowCount() - 1, 2, new QTableWidgetItem()); + ui->serverUsersTable->setItem(ui->serverUsersTable->rowCount() - 1, 3, new QTableWidgetItem()); + + + + QLineEdit* username = new QLineEdit(); + username->setProperty("row", (int)ui->serverUsersTable->rowCount() - 1); + username->setProperty("col", (int)0); + username->setText(user); + connect(username, SIGNAL(editingFinished()), this, SLOT(onServerUserFieldChanged())); + ui->serverUsersTable->setCellWidget(ui->serverUsersTable->rowCount() - 1, 0, username); QLineEdit* password = new QLineEdit(); password->setProperty("row", (int)ui->serverUsersTable->rowCount() - 1); + password->setProperty("col", (int)1); password->setEchoMode(QLineEdit::PasswordEchoOnEdit); password->setText(pass); - connect(password, SIGNAL(editingFinished()), this, SLOT(onServerPasswordChanged())); + connect(password, SIGNAL(editingFinished()), this, SLOT(onServerUserFieldChanged())); ui->serverUsersTable->setCellWidget(ui->serverUsersTable->rowCount() - 1, 1, password); QComboBox* comboBox = new QComboBox(); comboBox->insertItems(0, { "Full User","Full with no TX","Monitor only" }); + comboBox->setProperty("row", (int)ui->serverUsersTable->rowCount() - 1); + comboBox->setProperty("col", (int)2); comboBox->setCurrentIndex(type); + connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onServerUserFieldChanged())); ui->serverUsersTable->setCellWidget(ui->serverUsersTable->rowCount() - 1, 2, comboBox); + + QPushButton* button = new QPushButton(); + button->setText("Delete"); + button->setProperty("row", (int)ui->serverUsersTable->rowCount() - 1); + button->setProperty("col", (int)3); + connect(button, SIGNAL(clicked()), this, SLOT(onServerUserFieldChanged())); + ui->serverUsersTable->setCellWidget(ui->serverUsersTable->rowCount() - 1, 3, button); + ui->serverUsersTable->blockSignals(false); } -void wfmain::onServerPasswordChanged() +void wfmain::onServerUserFieldChanged() { + int row = sender()->property("row").toInt(); - QLineEdit* password = (QLineEdit*)ui->serverUsersTable->cellWidget(row, 1); - QByteArray pass; - passcode(password->text(), pass); - password->setText(pass); - qInfo() << "password row" << row << "changed"; - serverConfig.users.clear(); - for (int rows = 0; rows < ui->serverUsersTable->model()->rowCount(); rows++) + int col = sender()->property("col").toInt(); + qInfo() << "User field col" << col << "row" << row << "changed"; + + // This is a new user line so add to serverUsersTable + if (serverConfig.users.length() <= row) { - if (ui->serverUsersTable->item(rows, 0) != NULL) + qInfo() << "Something bad has happened, serverConfig.users is shorter than table!"; + } + else + { + if (col == 0) { - SERVERUSER user; - user.username = ui->serverUsersTable->item(rows, 0)->text(); - QLineEdit* password = (QLineEdit*)ui->serverUsersTable->cellWidget(rows, 1); - user.password = password->text(); - QComboBox* comboBox = (QComboBox*)ui->serverUsersTable->cellWidget(rows, 2); - user.userType = comboBox->currentIndex(); - serverConfig.users.append(user); + QLineEdit* username = (QLineEdit*)ui->serverUsersTable->cellWidget(row, 0); + if (username->text() != serverConfig.users[row].username) { + serverConfig.users[row].username = username->text(); + } } - else { - ui->serverUsersTable->removeRow(rows); + else if (col == 1) + { + QLineEdit* password = (QLineEdit*)ui->serverUsersTable->cellWidget(row, 1); + QByteArray pass; + passcode(password->text(), pass); + if (QString(pass) != serverConfig.users[row].password) { + serverConfig.users[row].password = pass; + qDebug() << "New Password" << password->text() << "New Password" << serverConfig.users[row].password; + } } + else if (col == 2) + { + QComboBox* comboBox = (QComboBox*)ui->serverUsersTable->cellWidget(row, 2); + serverConfig.users[row].userType = comboBox->currentIndex(); + } + else if (col == 3) + { + serverConfig.users.removeAt(row); + ui->serverUsersTable->setRowCount(0); + foreach(SERVERUSER user, serverConfig.users) + { + serverAddUserLine(user.username, user.password, user.userType); + } + } + if (row == ui->serverUsersTable->rowCount() - 1) { + ui->serverAddUserBtn->setEnabled(true); + } + } } -void wfmain::on_serverUsersTable_cellClicked(int row, int col) +void wfmain::on_serverAddUserBtn_clicked() { - qInfo() << "Clicked on " << row << "," << col; - if (row == ui->serverUsersTable->model()->rowCount() - 1 && ui->serverUsersTable->item(row, 0) != NULL) { - serverAddUserLine("", "", 0); - } + serverAddUserLine("", "", 0); + SERVERUSER user; + user.username = ""; + user.password = ""; + user.userType = 0; + serverConfig.users.append(user); + + ui->serverAddUserBtn->setEnabled(false); } @@ -1909,28 +1968,6 @@ void wfmain::on_serverTXAudioOutputCombo_currentIndexChanged(int value) } -void wfmain::on_serverUsersTable_cellChanged(int row, int column) -{ - qInfo() << "Cell Changed:" << row << "," << column; - - serverConfig.users.clear(); - for (int rows = 0; rows < ui->serverUsersTable->model()->rowCount(); rows++) - { - if (ui->serverUsersTable->item(rows, 0) != NULL) - { - SERVERUSER user; - user.username = ui->serverUsersTable->item(rows, 0)->text(); - QLineEdit* password = (QLineEdit*)ui->serverUsersTable->cellWidget(rows, 1); - user.password = password->text(); - QComboBox* comboBox = (QComboBox*)ui->serverUsersTable->cellWidget(rows, 2); - user.userType = comboBox->currentIndex(); - serverConfig.users.append(user); - } - else { - ui->serverUsersTable->removeRow(rows); - } - } -} void wfmain::saveSettings() diff --git a/wfmain.h b/wfmain.h index e52bdb5..c96965f 100644 --- a/wfmain.h +++ b/wfmain.h @@ -526,14 +526,14 @@ private slots: void on_setClockBtn_clicked(); void on_serverEnableCheckbox_clicked(bool checked); - void on_serverUsersTable_cellClicked(int row, int col); void on_serverControlPortText_textChanged(QString text); void on_serverCivPortText_textChanged(QString text); void on_serverAudioPortText_textChanged(QString text); void on_serverTXAudioOutputCombo_currentIndexChanged(int value); void on_serverRXAudioInputCombo_currentIndexChanged(int value); - void onServerPasswordChanged(); - void on_serverUsersTable_cellChanged(int row, int column); + void onServerUserFieldChanged(); + + void on_serverAddUserBtn_clicked(); void on_useRTSforPTTchk_clicked(bool checked); diff --git a/wfmain.ui b/wfmain.ui index 3ac271b..dffab18 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -2213,7 +2213,7 @@ - 0 + 3 @@ -4310,7 +4310,7 @@ 0 - 3 + 4 false @@ -4348,6 +4348,11 @@ Admin + + + Delete? + + @@ -4365,6 +4370,30 @@
+ + + + + + Add User + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + @@ -4797,7 +4826,7 @@ - + diff --git a/wfview.vcxproj b/wfview.vcxproj index 3ca575a..69b22ec 100644 --- a/wfview.vcxproj +++ b/wfview.vcxproj @@ -57,7 +57,7 @@ Sync release\ MaxSpeed - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION="1.2e";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX="/usr/local";GITSHORT="1aa45dc";HOST="wfview.org";UNAME="build";NDEBUG;QT_NO_DEBUG;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION="1.45";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX="/usr/local";GITSHORT="8638086";HOST="wfview.org";UNAME="build";NDEBUG;QT_NO_DEBUG;%(PreprocessorDefinitions) false MultiThreadedDLL @@ -66,7 +66,7 @@ Level3 true - ..\portaudio\msvc\Win32\Release\portaudio_x86.lib;..\opus\win32\VS2015\Win32\Release\opus.lib;shell32.lib;%(AdditionalDependencies) + ..\portaudio\msvc\Win32\Release\portaudio_x86.lib;ole32.lib;..\opus\win32\VS2015\Win32\Release\opus.lib;shell32.lib;%(AdditionalDependencies) ..\portaudio\msvc\Win32\Release;..\opus\win32\VS2015\Win32\Release;C:\opensslx86\lib;C:\Utils\my_sql\mysql-5.7.25-win32\lib;C:\Utils\postgresqlx86\pgsql\lib;%(AdditionalLibraryDirectories) "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions) true @@ -85,7 +85,7 @@ 0 - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.2e\";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX=\"/usr/local\";GITSHORT=\"1aa45dc\";HOST=\"wfview.org\";UNAME=\"build\";NDEBUG;QT_NO_DEBUG;QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.45\";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX=\"/usr/local\";GITSHORT=\"8638086\";HOST=\"wfview.org\";UNAME=\"build\";NDEBUG;QT_NO_DEBUG;QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) msvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cppdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cppUic'ing %(Identity)...$(ProjectDir)ui_%(Filename).h @@ -99,7 +99,7 @@ Sync debug\ Disabled - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION="1.2e";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX="/usr/local";GITSHORT="1aa45dc";HOST="wfview.org";UNAME="build";%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION="1.45";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX="/usr/local";GITSHORT="8638086";HOST="wfview.org";UNAME="build";%(PreprocessorDefinitions) false MultiThreadedDebugDLL true @@ -107,7 +107,7 @@ Level3 true - ..\portaudio\msvc\Win32\Debug\portaudio_x86.lib;..\opus\win32\VS2015\Win32\Debug\opus.lib;shell32.lib;%(AdditionalDependencies) + ..\portaudio\msvc\Win32\Debug\portaudio_x86.lib;ole32.lib;..\opus\win32\VS2015\Win32\Debug\opus.lib;shell32.lib;%(AdditionalDependencies) ..\portaudio\msvc\Win32\Debug;..\opus\win32\VS2015\Win32\Debug;C:\opensslx86\lib;C:\Utils\my_sql\mysql-5.7.25-win32\lib;C:\Utils\postgresqlx86\pgsql\lib;%(AdditionalLibraryDirectories) "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions) true @@ -124,7 +124,7 @@ 0 - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.2e\";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX=\"/usr/local\";GITSHORT=\"1aa45dc\";HOST=\"wfview.org\";UNAME=\"build\";QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.45\";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX=\"/usr/local\";GITSHORT=\"8638086\";HOST=\"wfview.org\";UNAME=\"build\";QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) msvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cppdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cppUic'ing %(Identity)...$(ProjectDir)ui_%(Filename).h @@ -136,6 +136,7 @@ + @@ -203,6 +204,7 @@ + @@ -215,6 +217,16 @@ + + + + + + + + + + @@ -418,6 +430,8 @@ + + Document true @@ -475,6 +489,7 @@ + @@ -500,6 +515,17 @@ + + + + + + + + + + + diff --git a/wfview.vcxproj.filters b/wfview.vcxproj.filters index a8fca3d..52a8284 100644 --- a/wfview.vcxproj.filters +++ b/wfview.vcxproj.filters @@ -71,6 +71,9 @@ Source Files + + Source Files + Source Files @@ -160,6 +163,9 @@ Header Files + + Header Files + Header Files @@ -169,6 +175,9 @@ Header Files + + Header Files + Header Files @@ -260,6 +269,8 @@ + + Generated Files @@ -307,6 +318,7 @@ + @@ -317,6 +329,9 @@ Form Files + + Form Files + Form Files diff --git a/wfview.vcxproj.user b/wfview.vcxproj.user index 2d805e3..71025e6 100644 --- a/wfview.vcxproj.user +++ b/wfview.vcxproj.user @@ -7,9 +7,9 @@ PATH=$(QTDIR)\bin%3bC:\QT\5.15.2\MSVC2019\bin%3b$(QTDIR)\bin%3bC:\QT\5.15.2\MSVC2019\bin%3b$(PATH) - 2022-04-18T13:23:03.5252168Z + 2022-09-18T13:19:41.5782674Z - 2022-04-18T13:23:05.0598803Z + 2022-09-18T13:19:41.9056515Z \ No newline at end of file From 079f03886f3d832ffec8aacc61c3c30c3f5bbe16 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sun, 18 Sep 2022 15:02:31 +0100 Subject: [PATCH 086/207] Remove password from log! --- wfmain.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index fbdb8dd..57548ee 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -1848,7 +1848,7 @@ void wfmain::onServerUserFieldChanged() int row = sender()->property("row").toInt(); int col = sender()->property("col").toInt(); - qInfo() << "User field col" << col << "row" << row << "changed"; + qDebug() << "Server User field col" << col << "row" << row << "changed"; // This is a new user line so add to serverUsersTable if (serverConfig.users.length() <= row) @@ -1871,7 +1871,6 @@ void wfmain::onServerUserFieldChanged() passcode(password->text(), pass); if (QString(pass) != serverConfig.users[row].password) { serverConfig.users[row].password = pass; - qDebug() << "New Password" << password->text() << "New Password" << serverConfig.users[row].password; } } else if (col == 2) From 4bd80cb9e5b579d13478c3b25798d6af27182ed8 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sun, 18 Sep 2022 15:23:37 +0100 Subject: [PATCH 087/207] Make sure both audio system button are disabled when connected to radio and enabled when not. --- wfmain.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wfmain.cpp b/wfmain.cpp index 57548ee..5816a66 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -1558,6 +1558,7 @@ void wfmain::loadSettings() // If LAN is enabled, server gets its audio straight from the LAN ui->serverRXAudioInputCombo->setEnabled(!prefs.enableLAN); ui->serverTXAudioOutputCombo->setEnabled(!prefs.enableLAN); + ui->audioSystemServerCombo->setEnabled(!prefs.enableLAN); ui->baudRateCombo->setEnabled(!prefs.enableLAN); ui->serialDeviceListCombo->setEnabled(!prefs.enableLAN); @@ -4769,6 +4770,7 @@ void wfmain::on_serialEnableBtn_clicked(bool checked) ui->serialDeviceListCombo->setEnabled(checked); ui->serverRXAudioInputCombo->setEnabled(checked); ui->serverTXAudioOutputCombo->setEnabled(checked); + } void wfmain::on_lanEnableBtn_clicked(bool checked) @@ -4914,6 +4916,8 @@ void wfmain::on_connectBtn_clicked() } else { ui->connectBtn->setText("Connect to Radio"); + ui->audioSystemCombo->setEnabled(true); + ui->audioSystemServerCombo->setEnabled(true); } } ui->connectBtn->clearFocus(); From bb2593be6f1d80447726d5cfbedda585b3ffa93e Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sun, 18 Sep 2022 12:22:11 -0700 Subject: [PATCH 088/207] Fixed clear peaks button to work with the plasma underlay. --- wfmain.cpp | 13 +++++++++++++ wfmain.h | 1 + 2 files changed, 14 insertions(+) diff --git a/wfmain.cpp b/wfmain.cpp index 5816a66..9ba5ca0 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -4053,6 +4053,7 @@ void wfmain::on_clearPeakBtn_clicked() if(haveRigCaps) { spectrumPeaks = QByteArray( (int)spectWidth, '\x01' ); + clearPlasmaBuffer(); } return; } @@ -6307,6 +6308,18 @@ void wfmain::resizePlasmaBuffer(int newSize) plasmaMutex.unlock(); } +void wfmain::clearPlasmaBuffer() +{ + QByteArray empty((int)spectWidth, '\x01'); + plasmaMutex.lock(); + int pSize = spectrumPlasma.size(); + for(int i=0; i < pSize; i++) + { + spectrumPlasma[i] = empty; + } + plasmaMutex.unlock(); +} + void wfmain::on_underlayNone_toggled(bool checked) { ui->underlayBufferSlider->setDisabled(checked); diff --git a/wfmain.h b/wfmain.h index c96965f..5660fe5 100644 --- a/wfmain.h +++ b/wfmain.h @@ -771,6 +771,7 @@ private: underlay_t underlayMode = underlayNone; QMutex plasmaMutex; void resizePlasmaBuffer(int newSize); + void clearPlasmaBuffer(); double plotFloor = 0; double plotCeiling = 160; From 881823a8392a60b4eb2e775e26e264396da11c83 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sun, 18 Sep 2022 13:13:33 -0700 Subject: [PATCH 089/207] Added controls for custom scope edges, hide/show scope controls depending upon the scope mode the radio reports. --- wfmain.cpp | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++- wfmain.h | 3 +++ wfmain.ui | 18 ++++++++++--- 3 files changed, 90 insertions(+), 5 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 9ba5ca0..fbc8b07 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -2158,6 +2158,7 @@ void wfmain::showHideSpectrum(bool show) ui->wfLengthSlider->setEnabled(show); ui->wfthemeCombo->setVisible(show); ui->toFixedBtn->setVisible(show); + ui->customEdgeBtn->setVisible(show); ui->clearPeakBtn->setVisible(show); // And the labels: @@ -3872,6 +3873,7 @@ void wfmain::receiveSpectrumMode(spectrumMode spectMode) ui->spectrumModeCombo->blockSignals(false); } } + setUISpectrumControlsToMode(spectMode); } @@ -4197,7 +4199,29 @@ void wfmain::on_fCEbtn_clicked() void wfmain::on_spectrumModeCombo_currentIndexChanged(int index) { - emit setScopeMode(static_cast(ui->spectrumModeCombo->itemData(index).toInt())); + spectrumMode smode = static_cast(ui->spectrumModeCombo->itemData(index).toInt()); + emit setScopeMode(smode); + setUISpectrumControlsToMode(smode); +} + +void wfmain::setUISpectrumControlsToMode(spectrumMode smode) +{ + if((smode==spectModeCenter) || (smode==spectModeScrollC)) + { + ui->specEdgeLabel->hide(); + ui->scopeEdgeCombo->hide(); + ui->customEdgeBtn->hide(); + ui->toFixedBtn->show(); + ui->specSpanLabel->show(); + ui->scopeBWCombo->show(); + } else { + ui->specEdgeLabel->show(); + ui->scopeEdgeCombo->show(); + ui->customEdgeBtn->show(); + ui->toFixedBtn->hide(); + ui->specSpanLabel->hide(); + ui->scopeBWCombo->hide(); + } } void wfmain::on_fEnterBtn_clicked() @@ -7123,3 +7147,51 @@ void wfmain::messageHandler(QtMsgType type, const QMessageLogContext& context, c logStringBuffer.push_front(text); logTextMutex.unlock(); } + +void wfmain::on_customEdgeBtn_clicked() +{ + double lowFreq = oldLowerFreq; + double highFreq = oldUpperFreq; + QString freqstring = QString("%1, %2").arg(lowFreq).arg(highFreq); + bool ok; + + QString userFreq = QInputDialog::getText(this, "Scope Edges", + "Please enter desired scope edges, in MHz, \ +with a comma between the low and high range.", + QLineEdit::Normal, freqstring, &ok); + if(!ok) + return; + + QString clean = userFreq.trimmed().replace(" ", ""); + QStringList freqs = clean.split(","); + if(freqs.length() == 2) + { + lowFreq = QString(freqs.at(0)).toDouble(&ok); + if(ok) + { + highFreq = QString(freqs.at(1)).toDouble(&ok); + if(ok) + { + qDebug(logGui()) << "setting edge to: " << lowFreq << ", " << highFreq << ", edge num: " << ui->scopeEdgeCombo->currentIndex() + 1; + emit setScopeFixedEdge(lowFreq, highFreq, ui->scopeEdgeCombo->currentIndex() + 1); + return; + } + } + goto errMsg; + } else { + goto errMsg; + } + +errMsg: + { + QMessageBox URLmsgBox; + URLmsgBox.setText("Error, could not interpret your input.\ +
Please make sure to place a comma between the frequencies.\ +
For example: '7.200, 7.300'"); + URLmsgBox.exec(); + + return; + } + + +} diff --git a/wfmain.h b/wfmain.h index 5660fe5..f4ff6a2 100644 --- a/wfmain.h +++ b/wfmain.h @@ -645,6 +645,8 @@ private slots: void on_audioSystemServerCombo_currentIndexChanged(int index); + void on_customEdgeBtn_clicked(); + private: Ui::wfmain *ui; void closeEvent(QCloseEvent *event); @@ -786,6 +788,7 @@ private: bool onFullscreen; bool freqTextSelected; void checkFreqSel(); + void setUISpectrumControlsToMode(spectrumMode smode); double oldLowerFreq; double oldUpperFreq; diff --git a/wfmain.ui b/wfmain.ui index dffab18..e31ba7c 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -18,7 +18,7 @@ - 3 + 0 @@ -117,6 +117,16 @@
+ + + + Define a custom (fixed) scope edge + + + Custom Edge + + + @@ -3333,8 +3343,8 @@ 0 0 - 194 - 563 + 204 + 582 @@ -4826,7 +4836,7 @@ - + From 520b1d051a344f6ff94a20e801e1e570fe3557a8 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Mon, 19 Sep 2022 17:06:00 +0200 Subject: [PATCH 090/207] Added controls for custom scope edges, hide/show scope controls depending upon the scope mode the radio reports. Fixed clear peaks button to work with the plasma underlay. both audio system button are disabled when connected to radio and enabled when not. Remove password from log Fix server user handling --- .swp | Bin 0 -> 12288 bytes CHANGELOG | 18 +++++++++++++++++- WHATSNEW | 6 ++++++ wfserver.pro | 2 +- wfview.pro | 2 +- 5 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 .swp diff --git a/.swp b/.swp new file mode 100644 index 0000000000000000000000000000000000000000..9ac6df118950b743ee36e5481a3cb8bfc5ba3def GIT binary patch literal 12288 zcmeI%zYBsu6u|Lk(9l%WKVY>>8ASaF4UM*6BqW%bUN!c2^(R$ZV^de@5=fI!^gVb! z?g!`d12@Rcd$Y;Z9y>iTt?_ugT5}|lto=|$i+rdsr_p*JD<_C{Dhxg^FWiR-1P~}w zpymzS{`07JJ8iqw^vZl0dn14V0tg_000IagfWVgt=-85jsi~6HRn4;Xma{Gi0R#|0 z009ILKmY**5I_I{1b$FJnfv- Date: Mon, 19 Sep 2022 17:08:50 +0200 Subject: [PATCH 091/207] removed .swp --- .swp | Bin 12288 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .swp diff --git a/.swp b/.swp deleted file mode 100644 index 9ac6df118950b743ee36e5481a3cb8bfc5ba3def..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI%zYBsu6u|Lk(9l%WKVY>>8ASaF4UM*6BqW%bUN!c2^(R$ZV^de@5=fI!^gVb! z?g!`d12@Rcd$Y;Z9y>iTt?_ugT5}|lto=|$i+rdsr_p*JD<_C{Dhxg^FWiR-1P~}w zpymzS{`07JJ8iqw^vZl0dn14V0tg_000IagfWVgt=-85jsi~6HRn4;Xma{Gi0R#|0 z009ILKmY**5I_I{1b$FJnfv- Date: Tue, 20 Sep 2022 08:58:12 -0700 Subject: [PATCH 092/207] Added dialog box to the toFixed button where an edge can be selected. --- aboutbox.cpp | 9 +++++---- wfmain.cpp | 25 ++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/aboutbox.cpp b/aboutbox.cpp index 03715c1..4c3549e 100644 --- a/aboutbox.cpp +++ b/aboutbox.cpp @@ -15,9 +15,10 @@ aboutbox::aboutbox(QWidget *parent) : ui->topText->setText("wfview version " + QString(WFVIEW_VERSION)); QString head = QString(""); - QString copyright = QString("Copyright 2017-2022 Elliott H. Liggett, W6EL. All rights reserved. wfview source code is licensed under the GNU GPLv3."); + QString copyright = QString("Copyright 2017-2022 Elliott H. Liggett, W6EL. All rights reserved.
wfview source code is licensed under the GNU GPLv3."); QString nacode = QString("

Networking, audio, rigctl server, and much more written by Phil Taylor, M0VSE"); - QString doctest = QString("

Testing, documentation, bug fixes, and development mentorship from
Roeland Jansen, PA3MET, and Jim Nijkamp, PA8E."); + QString scm = QString("

Source code and issues managed by Roeland Jansen, PA3MET"); + QString doctest = QString("

Testing and development mentorship from Jim Nijkamp, PA8E."); QString dedication = QString("

This version of wfview is dedicated to the ones we lost."); @@ -35,7 +36,7 @@ aboutbox::aboutbox(QWidget *parent) : QString support = QString("

For support, please visit the official wfview support forum."); QString gitcodelink = QString("").arg(GITSHORT); - QString contact = QString("
email W6EL: kilocharlie8@gmail.com"); + QString contact = QString("
email W6EL: kilocharlie8 at gmail.com"); QString buildInfo = QString("

Build " + gitcodelink + QString(GITSHORT) + "
on " + QString(__DATE__) + " at " + __TIME__ + " by " + UNAME + "@" + HOST); QString end = QString(""); @@ -85,7 +86,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."); // String it all together: - QString aboutText = head + copyright + "\n" + nacode + "\n" + doctest + dedication + wfviewcommunityack; + QString aboutText = head + copyright + "\n" + nacode + "\n" + scm + "\n" + doctest + dedication + wfviewcommunityack; aboutText.append(website + "\n" + donate + "\n"+ docs + support + contact +"\n"); aboutText.append("\n" + ssCredit + "\n" + rsCredit + "\n"); diff --git a/wfmain.cpp b/wfmain.cpp index fbc8b07..fe5f46f 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -4915,9 +4915,28 @@ void wfmain::on_vspCombo_currentIndexChanged(int value) void wfmain::on_toFixedBtn_clicked() { - emit setScopeFixedEdge(oldLowerFreq, oldUpperFreq, ui->scopeEdgeCombo->currentIndex()+1); - emit setScopeEdge(ui->scopeEdgeCombo->currentIndex()+1); - issueDelayedCommand(cmdScopeFixedMode); + int currentEdge = ui->scopeEdgeCombo->currentIndex(); + bool dialogOk = false; + bool numOk = false; + + QStringList edges; + edges << "1" << "2" << "3" << "4"; + + QString item = QInputDialog::getItem(this, "Select Edge", "Edge to replace:", edges, currentEdge, false, &dialogOk); + + if(dialogOk) + { + int edge = QString(item).toInt(&numOk,10); + if(numOk) + { + emit setScopeFixedEdge(oldLowerFreq, oldUpperFreq, edge); + emit setScopeEdge(edge); + ui->scopeEdgeCombo->blockSignals(true); + ui->scopeEdgeCombo->setCurrentIndex(edge-1); + ui->scopeEdgeCombo->blockSignals(false); + issueDelayedCommand(cmdScopeFixedMode); + } + } } From 9ecdd02246059943dbe7e798b9bc4e1d96c3883c Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Tue, 20 Sep 2022 19:06:12 +0200 Subject: [PATCH 093/207] Added dialog box to the toFixed button where an edge can be selected; bumped to v1.47 --- CHANGELOG | 5 +++++ WHATSNEW | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 444aec8..2008924 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,10 @@ # CHANGELOG +- 20220920 + + Added dialog box to the toFixed button where an edge can be selected. + + updated to v1.47 - 20220918 diff --git a/WHATSNEW b/WHATSNEW index 79db3a2..6b0b567 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -30,12 +30,13 @@ The following highlights are in this 1.41-release: moved connect button and added cancel option add enable/disable audioSystemServerCombo Fixed bug where the frequency dial skipped extra when crossing zero. -+1.46 Added controls for custom scope edges, hide/show scope controls ++ 1.46 Added controls for custom scope edges, hide/show scope controls depending upon the scope mode the radio reports. Fixed clear peaks button to work with the plasma underlay. both audio system button are disabled when connected to radio and enabled when not. Remove password from log Fix server user handling ++ 1.47 Added dialog box to the toFixed button where an edge can be selected. Notes: From ae6f1f2ca35ab0eaeb79d2c25f7fb1e98f250a6d Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Tue, 20 Sep 2022 18:56:36 +0100 Subject: [PATCH 094/207] Add quick fix for rigctld fmv issue --- rigctld.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/rigctld.cpp b/rigctld.cpp index a3eadae..ce05783 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -313,6 +313,28 @@ void rigCtlClient::socketReadyRead() } } + else if (command[0] == "fmv") { + QString resp; + + if (rigState->getChar(CURRENTVFO) == 0) { + resp.append(QString("%1").arg(rigState->getInt64(VFOAFREQ))); + } + else { + resp.append(QString("%1").arg(rigState->getInt64(VFOBFREQ))); + } + response.append(resp); + resp = ""; + response.append(QString("%1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE)))); + response.append(QString("%1").arg(getFilter(rigState->getChar(MODE), rigState->getChar(FILTER)))); + + if (rigState->getChar(CURRENTVFO) == 0) { + resp.append("VFOA"); + } + else { + resp.append("VFOB"); + } + response.append(resp); + } else if (command[0] == "f" || command[0] == "get_freq") { QString resp; From 3dbfc94419a3048f381579c1a9494088e68f86c9 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Wed, 21 Sep 2022 15:38:28 +0100 Subject: [PATCH 095/207] Fix that was stopping users being created when none existed --- wfmain.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wfmain.cpp b/wfmain.cpp index fe5f46f..b37118e 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -1756,6 +1756,12 @@ void wfmain::loadSettings() if (row == 0) { serverAddUserLine("", "", 0); + SERVERUSER user; + user.username = ""; + user.password = ""; + user.userType = 0; + serverConfig.users.append(user); + ui->serverAddUserBtn->setEnabled(false); } From 12ea418f1e3fa85dd234bf1e935af5dfaba73e61 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Wed, 21 Sep 2022 17:01:44 +0200 Subject: [PATCH 096/207] updated CHANGELOG and WHATSNEW --- CHANGELOG | 4 ++++ WHATSNEW | 1 + 2 files changed, 5 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 2008924..7d7ebf4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ # CHANGELOG +- 20220921 + + Fix that was stopping users being created when none existed + - 20220920 Added dialog box to the toFixed button where an edge can be selected. diff --git a/WHATSNEW b/WHATSNEW index 6b0b567..2dff96f 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -37,6 +37,7 @@ The following highlights are in this 1.41-release: Remove password from log Fix server user handling + 1.47 Added dialog box to the toFixed button where an edge can be selected. + Fix that was stopping users being created when none existed Notes: From 71537c21e179100713c123179b1334d0fa546c54 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Wed, 21 Sep 2022 17:03:36 +0200 Subject: [PATCH 097/207] updated CHANGELOG and WHATSNEW --- CHANGELOG | 2 ++ WHATSNEW | 1 + 2 files changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 7d7ebf4..49ca52f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,8 @@ - 20220920 Added dialog box to the toFixed button where an edge can be selected. + + Add quick fix for rigctld fmv issue updated to v1.47 diff --git a/WHATSNEW b/WHATSNEW index 2dff96f..8cae7ea 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -38,6 +38,7 @@ The following highlights are in this 1.41-release: Fix server user handling + 1.47 Added dialog box to the toFixed button where an edge can be selected. Fix that was stopping users being created when none existed + compound fmv command (rigctl(d)) added Notes: From 11c1d2f5df44b329fe390e3dc2d47130e6daab38 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 22 Sep 2022 20:53:57 -0700 Subject: [PATCH 098/207] Hide UI elements not needed for non-spectrum radios. --- wfmain.cpp | 31 +++++++++++++++++++++++-------- wfmain.ui | 6 +++--- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index b37118e..e5d736b 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -984,7 +984,7 @@ void wfmain::updateSizes(int tabIndex) if((i!=tabIndex) && tabIndex != 0) ui->tabWidget->widget(i)->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); // allows size to be any size that fits the tab bar - if(tabIndex==0 && !rigCaps.hasSpectrum) + if(tabIndex==0) { ui->tabWidget->widget(0)->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); @@ -996,12 +996,6 @@ void wfmain::updateSizes(int tabIndex) resize(minimumSize()); adjustSize(); // main window - } else if(tabIndex==0 && rigCaps.hasSpectrum) { - // At main tab (0) and we have spectrum: - ui->tabWidget->widget(0)->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - - resize(minimumSizeHint()); - adjustSize(); // Without this call, the window retains the size of the previous tab. } else { // At some other tab, with or without spectrum: ui->tabWidget->widget(tabIndex)->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); @@ -3383,8 +3377,29 @@ void wfmain::receiveRigID(rigCapabilities rigCaps) this->spectWidth = rigCaps.spectLenMax; // used once haveRigCaps is true. //wfCeiling = rigCaps.spectAmpMax; //plotCeiling = rigCaps.spectAmpMax; - ui->topLevelSlider->setMaximum(rigCaps.spectAmpMax); + if(rigCaps.hasSpectrum) + { + ui->topLevelSlider->setVisible(true); + ui->labelTop->setVisible(true); + ui->botLevelSlider->setVisible(true); + ui->labelBot->setVisible(true); + ui->scopeRefLevelSlider->setVisible(true); + ui->refLabel->setVisible(true); + ui->wfLengthSlider->setVisible(true); + ui->lenLabel->setVisible(true); + ui->topLevelSlider->setMaximum(rigCaps.spectAmpMax); + ui->botLevelSlider->setMaximum(rigCaps.spectAmpMax); + } else { + ui->scopeRefLevelSlider->setVisible(false); + ui->refLabel->setVisible(false); + ui->wfLengthSlider->setVisible(false); + ui->lenLabel->setVisible(false); + ui->topLevelSlider->setVisible(false); + ui->labelTop->setVisible(false); + ui->botLevelSlider->setVisible(false); + ui->labelBot->setVisible(false); + } haveRigCaps = true; // Added so that server receives rig capabilities. diff --git a/wfmain.ui b/wfmain.ui index e31ba7c..705a71f 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -812,7 +812,7 @@
- + 16777215 @@ -866,7 +866,7 @@ - + 16777215 @@ -4836,7 +4836,7 @@ - + From 9c49395fa0700901f122d20dcefbb5e02a9a84dd Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 22 Sep 2022 21:06:49 -0700 Subject: [PATCH 099/207] Additional resize fixes for non-spectrum rigs. --- wfmain.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index e5d736b..2af2fd7 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -980,8 +980,8 @@ void wfmain::updateSizes(int tabIndex) if(!rigCaps.hasSpectrum) { // Set "ignore" size policy for non-selected tabs: - for(int i=0;itabWidget->count();i++) - if((i!=tabIndex) && tabIndex != 0) + for(int i=1;itabWidget->count();i++) + if((i!=tabIndex)) ui->tabWidget->widget(i)->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); // allows size to be any size that fits the tab bar if(tabIndex==0) @@ -991,8 +991,8 @@ void wfmain::updateSizes(int tabIndex) ui->tabWidget->widget(0)->setMaximumSize(ui->tabWidget->widget(0)->minimumSizeHint()); ui->tabWidget->widget(0)->adjustSize(); // tab this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); - this->setMaximumSize(QSize(1024,350)); - this->setMinimumSize(QSize(1024,350)); + this->setMaximumSize(QSize(940,350)); + this->setMinimumSize(QSize(940,350)); resize(minimumSize()); adjustSize(); // main window @@ -1002,6 +1002,7 @@ void wfmain::updateSizes(int tabIndex) this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); this->setMinimumSize(QSize(1024, 600)); // not large enough for settings tab this->setMaximumSize(QSize(65535,65535)); + resize(minimumSize()); adjustSize(); } } else { @@ -3568,6 +3569,7 @@ void wfmain::receiveRigID(rigCapabilities rigCaps) } } } + updateSizes(ui->tabWidget->currentIndex()); } void wfmain::initPeriodicCommands() From 79531712b0644443c1e478bd366878bf8d14739f Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 22 Sep 2022 21:14:05 -0700 Subject: [PATCH 100/207] Fixed glitch when tabs are changed prior to rigcaps. --- wfmain.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 2af2fd7..8b22eb7 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -973,8 +973,7 @@ void wfmain::prepareSettingsWindow() void wfmain::updateSizes(int tabIndex) { - if(!haveRigCaps) - return; + // This function does nothing unless you are using a rig without spectrum. // This is a hack. It is not great, but it seems to work ok. if(!rigCaps.hasSpectrum) From 1aff6b9cb65e7f3b1c9c74f9cd9ec83565d4f4c8 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Fri, 23 Sep 2022 07:55:07 +0200 Subject: [PATCH 101/207] resize fixes for non-spectrum rigs, bug fixing users, updated to v1.48 --- CHANGELOG | 11 +++++++++++ WHATSNEW | 5 +++++ wfserver.pro | 2 +- wfview.pro | 2 +- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 49ca52f..c5b7489 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,16 @@ # CHANGELOG +- 20220923 + + Fixed glitch when tabs are changed prior to rigcaps. + + Additional resize fixes for non-spectrum rigs. + + Hide UI elements not needed for non-spectrum radios. + + + updated to v1.48 + - 20220921 Fix that was stopping users being created when none existed diff --git a/WHATSNEW b/WHATSNEW index 8cae7ea..0248f1e 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -39,6 +39,11 @@ The following highlights are in this 1.41-release: + 1.47 Added dialog box to the toFixed button where an edge can be selected. Fix that was stopping users being created when none existed compound fmv command (rigctl(d)) added ++ 1.48 Fixed glitch when tabs are changed prior to rigcaps. + Additional resize fixes for non-spectrum rigs. + Hide UI elements not needed for non-spectrum radios. + Fix that was stopping users being created when none existed + Notes: diff --git a/wfserver.pro b/wfserver.pro index c48624d..c805028 100644 --- a/wfserver.pro +++ b/wfserver.pro @@ -13,7 +13,7 @@ TEMPLATE = app CONFIG += console -DEFINES += WFVIEW_VERSION=\\\"1.46\\\" +DEFINES += WFVIEW_VERSION=\\\"1.48\\\" DEFINES += BUILD_WFSERVER diff --git a/wfview.pro b/wfview.pro index f60af98..36ad558 100644 --- a/wfview.pro +++ b/wfview.pro @@ -11,7 +11,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport TARGET = wfview TEMPLATE = app -DEFINES += WFVIEW_VERSION=\\\"1.46\\\" +DEFINES += WFVIEW_VERSION=\\\"1.48\\\" DEFINES += BUILD_WFVIEW From 3ee237e736169307409c545a3e64d6859bc69ce2 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 23 Sep 2022 15:45:39 +0100 Subject: [PATCH 102/207] Fix logfile/directory opening in Windows --- loggingwindow.cpp | 46 ++++++++++++++++++++++++---------------------- loggingwindow.h | 3 +++ 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/loggingwindow.cpp b/loggingwindow.cpp index c9ad5be..c9c6b67 100644 --- a/loggingwindow.cpp +++ b/loggingwindow.cpp @@ -142,37 +142,39 @@ void loggingWindow::on_clearDisplayBtn_clicked() void loggingWindow::on_openDirBtn_clicked() { QString cmd; - int rtnval = 0; -#ifdef Q_OS_MAC - cmd = "open " + logDirectory; -#endif + bool rtn = false; + QStringList arg; + const QFileInfo dir(logDirectory); + #ifdef Q_OS_LINUX - cmd = "xdg-open " + logDirectory; + cmd = "xdg-open"; +#elif defined(Q_OS_WIN) + cmd = QStandardPaths::findExecutable("explorer.exe"); + if (!dir.isDir()) + arg += QLatin1String("/select,"); +#else + cmd = "open"; #endif -#ifdef Q_OS_WIN - cmd = "start " + logDirectory; -#endif - rtnval = system(cmd.toLocal8Bit().data()); - if(rtnval) - qInfo(logLogger()) << "Error, open log directory command returned error code " << rtnval; + arg += QDir::toNativeSeparators(dir.canonicalFilePath());; + rtn = QProcess::startDetached(cmd, arg); + if(!rtn) + qInfo(logLogger()) << "Error, open log directory" << logDirectory << "command failed"; } void loggingWindow::on_openLogFileBtn_clicked() { QString cmd; - int rtnval = 0; -#ifdef Q_OS_MAC - cmd = "open " + logFilename; -#endif + bool rtn = false; #ifdef Q_OS_LINUX - cmd = "xdg-open " + logFilename; + cmd = "xdg-open"; +#elif defined(Q_OS_WIN) + cmd = QStandardPaths::findExecutable("notepad.exe"); +#else + cmd = "open"; #endif -#ifdef Q_OS_WIN - cmd = "notepad " + logFilename; -#endif - rtnval = system(cmd.toLocal8Bit().data()); - if(rtnval) - qInfo(logLogger()) << "Error, open log file command returned error code " << rtnval; + rtn = QProcess::startDetached(cmd, { logFilename }); + if(!rtn) + qInfo(logLogger()) << "Error, open log file command failed"; } void loggingWindow::on_sendToPasteBtn_clicked() diff --git a/loggingwindow.h b/loggingwindow.h index dda0efa..de11348 100644 --- a/loggingwindow.h +++ b/loggingwindow.h @@ -10,6 +10,9 @@ #include #include #include +#include +#include +#include #include "logcategories.h" From 26510c41663b24eeb33a0654984b420bd70f4af5 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 23 Sep 2022 16:46:33 +0100 Subject: [PATCH 103/207] Use date/time for log name if none specified --- loggingwindow.cpp | 16 ++++++---------- loggingwindow.h | 2 +- main.cpp | 10 ++++++---- servermain.cpp | 2 +- servermain.h | 2 +- wfmain.cpp | 10 +++------- wfmain.h | 2 +- 7 files changed, 19 insertions(+), 25 deletions(-) diff --git a/loggingwindow.cpp b/loggingwindow.cpp index c9c6b67..e182223 100644 --- a/loggingwindow.cpp +++ b/loggingwindow.cpp @@ -1,7 +1,8 @@ #include "loggingwindow.h" #include "ui_loggingwindow.h" -loggingWindow::loggingWindow(QWidget *parent) : +loggingWindow::loggingWindow(QString logFile, QWidget *parent) : + logFilename(logFile), QWidget(parent), ui(new Ui::loggingWindow) { @@ -12,20 +13,15 @@ loggingWindow::loggingWindow(QWidget *parent) : ui->annotateBtn->setDefault(true); ui->logTextDisplay->setFocusPolicy(Qt::NoFocus); ui->annotateBtn->setFocusPolicy(Qt::NoFocus); + + QDir d = QFileInfo(logFilename).absoluteDir(); + logDirectory = d.absolutePath(); QFont font("Monospace"); font.setStyleHint(QFont::TypeWriter); ui->logTextDisplay->setFont(font); ui->userAnnotationText->setFont(font); -#ifdef Q_OS_MAC - logFilename = QStandardPaths::standardLocations(QStandardPaths::DownloadLocation)[0] + "/wfview.log"; - logDirectory = QStandardPaths::standardLocations(QStandardPaths::DownloadLocation)[0]; - -#else - logFilename= QStandardPaths::standardLocations(QStandardPaths::TempLocation)[0] + "/wfview.log"; - logDirectory = QStandardPaths::standardLocations(QStandardPaths::TempLocation)[0]; -#endif clipboard = QApplication::clipboard(); socket = new QTcpSocket(this); connect(socket, SIGNAL(connected()), this, SLOT(connectedToHost())); @@ -157,7 +153,7 @@ void loggingWindow::on_openDirBtn_clicked() #endif arg += QDir::toNativeSeparators(dir.canonicalFilePath());; rtn = QProcess::startDetached(cmd, arg); - if(!rtn) + if(rtn) qInfo(logLogger()) << "Error, open log directory" << logDirectory << "command failed"; } diff --git a/loggingwindow.h b/loggingwindow.h index de11348..24e7e4c 100644 --- a/loggingwindow.h +++ b/loggingwindow.h @@ -25,7 +25,7 @@ class loggingWindow : public QWidget Q_OBJECT public: - explicit loggingWindow(QWidget *parent = nullptr); + explicit loggingWindow(QString logFile, QWidget *parent = NULL); ~loggingWindow(); void acceptLogText(QString text); diff --git a/main.cpp b/main.cpp index e317348..d000415 100644 --- a/main.cpp +++ b/main.cpp @@ -74,10 +74,12 @@ int main(int argc, char *argv[]) QString serialPortCL; QString hostCL; QString civCL; + QDateTime date = QDateTime::currentDateTime(); + QString formattedTime = date.toString("dd.MM.yyyy hh:mm:ss"); #ifdef Q_OS_MAC - QString logFilename= QStandardPaths::standardLocations(QStandardPaths::DownloadLocation)[0] + "/wfview.log"; + QString logFilename = (QString("%1/%2-%3.log").arg(QStandardPaths::standardLocations(QStandardPaths::DownloadLocation)[0]).arg(a.applicationName()).arg(date.toString("yyyyMMddhhmmss"))); #else - QString logFilename= QStandardPaths::standardLocations(QStandardPaths::TempLocation)[0] + "/wfview.log"; + QString logFilename = (QString("%1/%2-%3.log").arg(QStandardPaths::standardLocations(QStandardPaths::TempLocation)[0]).arg(a.applicationName()).arg(date.toString("yyyyMMddhhmmss"))); #endif QString settingsFile = NULL; QString currentArg; @@ -185,10 +187,10 @@ int main(int argc, char *argv[]) signal(SIGTERM, cleanup); signal(SIGKILL, cleanup); #endif - w = new servermain(serialPortCL, hostCL, settingsFile); + w = new servermain(serialPortCL, hostCL, logFilename, settingsFile); #else a.setWheelScrollLines(1); // one line per wheel click - wfmain w(serialPortCL, hostCL, settingsFile, debugMode); + wfmain w(serialPortCL, hostCL, settingsFile, logFilename, debugMode); w.show(); #endif diff --git a/servermain.cpp b/servermain.cpp index c2942c5..9ef2aa8 100644 --- a/servermain.cpp +++ b/servermain.cpp @@ -8,7 +8,7 @@ // This code is copyright 2017-2020 Elliott H. Liggett // All rights reserved -servermain::servermain(const QString serialPortCL, const QString hostCL, const QString settingsFile) +servermain::servermain(const QString serialPortCL, const QString hostCL, const QString settingsFile, const QString logFile) { this->serialPortCL = serialPortCL; this->hostCL = hostCL; diff --git a/servermain.h b/servermain.h index 1b7e3a8..fead26d 100644 --- a/servermain.h +++ b/servermain.h @@ -46,7 +46,7 @@ class servermain : public QObject Q_OBJECT public: - servermain(const QString serialPortCL, const QString hostCL, const QString settingsFile); + servermain(const QString serialPortCL, const QString hostCL, const QString logFile, const QString settingsFile); QString serialPortCL; QString hostCL; ~servermain(); diff --git a/wfmain.cpp b/wfmain.cpp index 8b22eb7..b814bb8 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -20,7 +20,8 @@ bool debugModeLogging = true; bool debugModeLogging = false; #endif -wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString settingsFile, bool debugMode, QWidget *parent ) : +wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString settingsFile, const QString logFile, bool debugMode, QWidget *parent ) : + logFilename(logFile), QMainWindow(parent), ui(new Ui::wfmain) { @@ -39,7 +40,7 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s setWindowTitle(QString("wfview")); - logWindow = new loggingWindow(); + logWindow = new loggingWindow(logFile); initLogging(); logWindow->setInitialDebugState(debugMode); qInfo(logSystem()) << version; @@ -7091,11 +7092,6 @@ void wfmain::on_showLogBtn_clicked() void wfmain::initLogging() { -#ifdef Q_OS_MAC - logFilename= QStandardPaths::standardLocations(QStandardPaths::DownloadLocation)[0] + "/wfview.log"; -#else - logFilename= QStandardPaths::standardLocations(QStandardPaths::TempLocation)[0] + "/wfview.log"; -#endif // Set the logging file before doing anything else. m_logFile.reset(new QFile(logFilename)); // Open the file logging diff --git a/wfmain.h b/wfmain.h index f4ff6a2..95f5f84 100644 --- a/wfmain.h +++ b/wfmain.h @@ -64,7 +64,7 @@ class wfmain : public QMainWindow Q_OBJECT public: - explicit wfmain(const QString serialPortCL, const QString hostCL, const QString settingsFile, bool debugMode, QWidget *parent = 0); + explicit wfmain(const QString serialPortCL, const QString hostCL, const QString settingsFile, const QString logFile, bool debugMode, QWidget *parent = 0); QString serialPortCL; QString hostCL; ~wfmain(); From 7fc3a7bf79a6e740d149b7b02c69b6acdbe79e66 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 23 Sep 2022 16:49:32 +0100 Subject: [PATCH 104/207] Quick fix to remove a debug --- loggingwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loggingwindow.cpp b/loggingwindow.cpp index e182223..217181d 100644 --- a/loggingwindow.cpp +++ b/loggingwindow.cpp @@ -153,7 +153,7 @@ void loggingWindow::on_openDirBtn_clicked() #endif arg += QDir::toNativeSeparators(dir.canonicalFilePath());; rtn = QProcess::startDetached(cmd, arg); - if(rtn) + if(!rtn) qInfo(logLogger()) << "Error, open log directory" << logDirectory << "command failed"; } From c62d8832f1ad5f4b204b4dc8bd79705172ba62b1 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 23 Sep 2022 17:02:06 +0100 Subject: [PATCH 105/207] Hopefully fix compile warning on linux --- loggingwindow.h | 6 +++--- main.cpp | 6 ++---- wfmain.h | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/loggingwindow.h b/loggingwindow.h index 24e7e4c..d7afe71 100644 --- a/loggingwindow.h +++ b/loggingwindow.h @@ -60,14 +60,14 @@ signals: void setDebugMode(bool debugOn); private: - Ui::loggingWindow *ui; + Ui::loggingWindow* ui; + QString logFilename; + QString logDirectory; QClipboard *clipboard; QMessageBox URLmsgBox; QScrollBar *vertLogScroll; QScrollBar *horizLogScroll; QMutex textMutex; - QString logFilename; - QString logDirectory; QTcpSocket *socket; void sendToTermbin(); }; diff --git a/main.cpp b/main.cpp index d000415..88d020e 100644 --- a/main.cpp +++ b/main.cpp @@ -74,13 +74,11 @@ int main(int argc, char *argv[]) QString serialPortCL; QString hostCL; QString civCL; + QDateTime date = QDateTime::currentDateTime(); QString formattedTime = date.toString("dd.MM.yyyy hh:mm:ss"); -#ifdef Q_OS_MAC - QString logFilename = (QString("%1/%2-%3.log").arg(QStandardPaths::standardLocations(QStandardPaths::DownloadLocation)[0]).arg(a.applicationName()).arg(date.toString("yyyyMMddhhmmss"))); -#else QString logFilename = (QString("%1/%2-%3.log").arg(QStandardPaths::standardLocations(QStandardPaths::TempLocation)[0]).arg(a.applicationName()).arg(date.toString("yyyyMMddhhmmss"))); -#endif + QString settingsFile = NULL; QString currentArg; diff --git a/wfmain.h b/wfmain.h index 95f5f84..1240126 100644 --- a/wfmain.h +++ b/wfmain.h @@ -650,6 +650,7 @@ private slots: private: Ui::wfmain *ui; void closeEvent(QCloseEvent *event); + QString logFilename; bool debugMode; QString version; QSettings *settings=Q_NULLPTR; @@ -662,7 +663,6 @@ private: void initLogging(); QTimer logCheckingTimer; int logCheckingOldPosition = 0; - QString logFilename; QCustomPlot *plot; // line plot QCustomPlot *wf; // waterfall image From 5216e783909a65dc8b34d581c133150ae54341ba Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 23 Sep 2022 17:07:30 +0100 Subject: [PATCH 106/207] Another compile warning fix attempt --- loggingwindow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loggingwindow.h b/loggingwindow.h index d7afe71..4a478f9 100644 --- a/loggingwindow.h +++ b/loggingwindow.h @@ -60,8 +60,8 @@ signals: void setDebugMode(bool debugOn); private: - Ui::loggingWindow* ui; QString logFilename; + Ui::loggingWindow* ui; QString logDirectory; QClipboard *clipboard; QMessageBox URLmsgBox; From b6d9c26ebb78718aac9ca10311e02542b0876f01 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 23 Sep 2022 17:11:25 +0100 Subject: [PATCH 107/207] another warning fix --- loggingwindow.cpp | 4 ++-- loggingwindow.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/loggingwindow.cpp b/loggingwindow.cpp index 217181d..7c7f45a 100644 --- a/loggingwindow.cpp +++ b/loggingwindow.cpp @@ -1,8 +1,8 @@ #include "loggingwindow.h" #include "ui_loggingwindow.h" -loggingWindow::loggingWindow(QString logFile, QWidget *parent) : - logFilename(logFile), +loggingWindow::loggingWindow(QString logFilename, QWidget *parent) : + logFilename(logFilename), QWidget(parent), ui(new Ui::loggingWindow) { diff --git a/loggingwindow.h b/loggingwindow.h index 4a478f9..60ab3ff 100644 --- a/loggingwindow.h +++ b/loggingwindow.h @@ -25,7 +25,7 @@ class loggingWindow : public QWidget Q_OBJECT public: - explicit loggingWindow(QString logFile, QWidget *parent = NULL); + explicit loggingWindow(QString logFilename, QWidget *parent = NULL); ~loggingWindow(); void acceptLogText(QString text); @@ -60,8 +60,8 @@ signals: void setDebugMode(bool debugOn); private: - QString logFilename; Ui::loggingWindow* ui; + QString logFilename; QString logDirectory; QClipboard *clipboard; QMessageBox URLmsgBox; From d9190a5060ae35ccff3bd824c3c606202f982331 Mon Sep 17 00:00:00 2001 From: M0VSE Date: Fri, 23 Sep 2022 17:18:42 +0100 Subject: [PATCH 108/207] Finally fix compile warning! --- loggingwindow.cpp | 4 ++-- loggingwindow.h | 2 +- wfmain.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/loggingwindow.cpp b/loggingwindow.cpp index 7c7f45a..709db1b 100644 --- a/loggingwindow.cpp +++ b/loggingwindow.cpp @@ -2,9 +2,9 @@ #include "ui_loggingwindow.h" loggingWindow::loggingWindow(QString logFilename, QWidget *parent) : - logFilename(logFilename), QWidget(parent), - ui(new Ui::loggingWindow) + ui(new Ui::loggingWindow), + logFilename(logFilename) { ui->setupUi(this); this->setWindowTitle("Log"); diff --git a/loggingwindow.h b/loggingwindow.h index 60ab3ff..d453eb7 100644 --- a/loggingwindow.h +++ b/loggingwindow.h @@ -25,7 +25,7 @@ class loggingWindow : public QWidget Q_OBJECT public: - explicit loggingWindow(QString logFilename, QWidget *parent = NULL); + explicit loggingWindow(QString logFilename, QWidget *parent = 0); ~loggingWindow(); void acceptLogText(QString text); diff --git a/wfmain.cpp b/wfmain.cpp index b814bb8..dc459e8 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -21,9 +21,9 @@ bool debugModeLogging = false; #endif wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString settingsFile, const QString logFile, bool debugMode, QWidget *parent ) : - logFilename(logFile), QMainWindow(parent), - ui(new Ui::wfmain) + ui(new Ui::wfmain), + logFilename(logFile) { QGuiApplication::setApplicationDisplayName("wfview"); QGuiApplication::setApplicationName(QString("wfview")); From 70fbd989f125c130d53f16676f20457d5466e542 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Fri, 23 Sep 2022 18:33:40 +0200 Subject: [PATCH 109/207] additional logging fixes --- CHANGELOG | 5 +++++ WHATSNEW | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c5b7489..244f5c1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,12 @@ # CHANGELOG + - 20220923 + Use date/time for log name if none specified + + Fix logfile/directory opening in Windows + Fixed glitch when tabs are changed prior to rigcaps. Additional resize fixes for non-spectrum rigs. diff --git a/WHATSNEW b/WHATSNEW index 0248f1e..ad582b7 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -43,8 +43,8 @@ The following highlights are in this 1.41-release: Additional resize fixes for non-spectrum rigs. Hide UI elements not needed for non-spectrum radios. Fix that was stopping users being created when none existed - - + Use date/time for log name if none specified + Fix logfile/directory opening in Windows Notes: From f838e224981128fd7b5f14d150937cf107388cf4 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 23 Sep 2022 17:42:36 +0100 Subject: [PATCH 110/207] Remove redundant CL args --- main.cpp | 40 +++++----------------------------------- servermain.cpp | 4 +--- servermain.h | 4 +--- wfmain.cpp | 28 +++------------------------- wfmain.h | 4 +--- 5 files changed, 11 insertions(+), 69 deletions(-) diff --git a/main.cpp b/main.cpp index 88d020e..90c3eb5 100644 --- a/main.cpp +++ b/main.cpp @@ -71,10 +71,6 @@ int main(int argc, char *argv[]) //debugMode = true; #endif - QString serialPortCL; - QString hostCL; - QString civCL; - QDateTime date = QDateTime::currentDateTime(); QString formattedTime = date.toString("dd.MM.yyyy hh:mm:ss"); QString logFilename = (QString("%1/%2-%3.log").arg(QStandardPaths::standardLocations(QStandardPaths::TempLocation)[0]).arg(a.applicationName()).arg(date.toString("yyyyMMddhhmmss"))); @@ -83,7 +79,7 @@ int main(int argc, char *argv[]) QString currentArg; - const QString helpText = QString("\nUsage: -p --port /dev/port, -h --host remotehostname, -c --civ 0xAddr, -l --logfile filename.log, -s --settings filename.ini, -d --debug, -v --version\n"); // TODO... + const QString helpText = QString("\nUsage: -l --logfile filename.log, -s --settings filename.ini, -d --debug, -v --version\n"); // TODO... #ifdef BUILD_WFSERVER const QString version = QString("wfserver version: %1 (Git:%2 on %3 at %4 by %5@%6)\nOperating System: %7 (%8)\nBuild Qt Version %9. Current Qt Version: %10\n") .arg(QString(WFVIEW_VERSION)) @@ -102,34 +98,10 @@ int main(int argc, char *argv[]) //qInfo() << "Argc: " << c << " argument: " << argv[c]; currentArg = QString(argv[c]); - if ((currentArg == "-p") || (currentArg == "--port")) - { - if (argc > c) - { - serialPortCL = argv[c + 1]; - c += 1; - } - } - else if ((currentArg == "-d") || (currentArg == "--debug")) + if ((currentArg == "-d") || (currentArg == "--debug")) { debugMode = true; } - else if ((currentArg == "-h") || (currentArg == "--host")) - { - if(argc > c) - { - hostCL = argv[c+1]; - c+=1; - } - } - else if ((currentArg == "-c") || (currentArg == "--civ")) - { - if (argc > c) - { - civCL = argv[c + 1]; - c += 1; - } - } else if ((currentArg == "-l") || (currentArg == "--logfile")) { if (argc > c) @@ -173,9 +145,7 @@ int main(int argc, char *argv[]) qInstallMessageHandler(messageHandler); qInfo(logSystem()) << version; - qDebug(logSystem()) << QString("SerialPortCL as set by parser: %1").arg(serialPortCL); - qDebug(logSystem()) << QString("remote host as set by parser: %1").arg(hostCL); - qDebug(logSystem()) << QString("CIV as set by parser: %1").arg(civCL); + #endif #ifdef BUILD_WFSERVER #ifdef Q_OS_WIN @@ -185,10 +155,10 @@ int main(int argc, char *argv[]) signal(SIGTERM, cleanup); signal(SIGKILL, cleanup); #endif - w = new servermain(serialPortCL, hostCL, logFilename, settingsFile); + w = new servermain(logFilename, settingsFile); #else a.setWheelScrollLines(1); // one line per wheel click - wfmain w(serialPortCL, hostCL, settingsFile, logFilename, debugMode); + wfmain w(settingsFile, logFilename, debugMode); w.show(); #endif diff --git a/servermain.cpp b/servermain.cpp index 9ef2aa8..3257bfa 100644 --- a/servermain.cpp +++ b/servermain.cpp @@ -8,10 +8,8 @@ // This code is copyright 2017-2020 Elliott H. Liggett // All rights reserved -servermain::servermain(const QString serialPortCL, const QString hostCL, const QString settingsFile, const QString logFile) +servermain::servermain(const QString settingsFile, const QString logFile) { - this->serialPortCL = serialPortCL; - this->hostCL = hostCL; qRegisterMetaType (); // Needs to be registered early. qRegisterMetaType (); diff --git a/servermain.h b/servermain.h index fead26d..b19d8ca 100644 --- a/servermain.h +++ b/servermain.h @@ -46,9 +46,7 @@ class servermain : public QObject Q_OBJECT public: - servermain(const QString serialPortCL, const QString hostCL, const QString logFile, const QString settingsFile); - QString serialPortCL; - QString hostCL; + servermain(const QString logFile, const QString settingsFile); ~servermain(); signals: diff --git a/wfmain.cpp b/wfmain.cpp index dc459e8..eb39c98 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -20,7 +20,7 @@ bool debugModeLogging = true; bool debugModeLogging = false; #endif -wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString settingsFile, const QString logFile, bool debugMode, QWidget *parent ) : +wfmain::wfmain(const QString settingsFile, const QString logFile, bool debugMode, QWidget *parent ) : QMainWindow(parent), ui(new Ui::wfmain), logFilename(logFile) @@ -45,9 +45,6 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s logWindow->setInitialDebugState(debugMode); qInfo(logSystem()) << version; - this->serialPortCL = serialPortCL; - this->hostCL = hostCL; - cal = new calibrationWindow(); rpt = new repeaterSetup(); sat = new satelliteSetup(); @@ -201,20 +198,6 @@ void wfmain::openRig() ui->connectBtn->setText("Cancel connection"); // We are attempting to connect - // TODO: Use these if they are found - if(!serialPortCL.isEmpty()) - { - qDebug(logSystem()) << "Serial port specified by user: " << serialPortCL; - } else { - qDebug(logSystem()) << "Serial port not specified. "; - } - - if(!hostCL.isEmpty()) - { - qDebug(logSystem()) << "Remote host name specified by user: " << hostCL; - } - - makeRig(); if (prefs.enableLAN) @@ -226,16 +209,11 @@ void wfmain::openRig() emit sendCommSetup(prefs.radioCIVAddr, udpPrefs, rxSetup, txSetup, prefs.virtualSerialPort, prefs.tcpPort); } else { ui->serialEnableBtn->setChecked(true); - if( (prefs.serialPortRadio.toLower() == QString("auto")) && (serialPortCL.isEmpty())) + if( (prefs.serialPortRadio.toLower() == QString("auto"))) { findSerialPort(); } else { - if(serialPortCL.isEmpty()) - { - serialPortRig = prefs.serialPortRadio; - } else { - serialPortRig = serialPortCL; - } + serialPortRig = prefs.serialPortRadio; } usingLAN = false; emit sendCommSetup(prefs.radioCIVAddr, serialPortRig, prefs.serialPortBaud,prefs.virtualSerialPort, prefs.tcpPort,prefs.waterfallFormat); diff --git a/wfmain.h b/wfmain.h index 1240126..e7e1ebf 100644 --- a/wfmain.h +++ b/wfmain.h @@ -64,9 +64,7 @@ class wfmain : public QMainWindow Q_OBJECT public: - explicit wfmain(const QString serialPortCL, const QString hostCL, const QString settingsFile, const QString logFile, bool debugMode, QWidget *parent = 0); - QString serialPortCL; - QString hostCL; + explicit wfmain(const QString settingsFile, const QString logFile, bool debugMode, QWidget *parent = 0); ~wfmain(); static void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg); void handleLogText(QString text); From 32d214b24fcb82c70628348c05e8f692200ecc56 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Fri, 23 Sep 2022 18:48:41 +0200 Subject: [PATCH 111/207] Remove redundant CL args --- CHANGELOG | 4 +++- WHATSNEW | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 244f5c1..eca1444 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,7 +9,9 @@ Fixed glitch when tabs are changed prior to rigcaps. - Additional resize fixes for non-spectrum rigs. + Remove redundant CL args + + Additional resize fixes for non-spectrum rigs. Hide UI elements not needed for non-spectrum radios. diff --git a/WHATSNEW b/WHATSNEW index ad582b7..c74bf9e 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -45,6 +45,7 @@ The following highlights are in this 1.41-release: Fix that was stopping users being created when none existed Use date/time for log name if none specified Fix logfile/directory opening in Windows + Remove redundant CL args Notes: From 6e7d006b0e7735ab4bcc4e59ede4f4198735e0a4 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 23 Sep 2022 18:40:01 +0100 Subject: [PATCH 112/207] Delete quit confirmation checkbox --- wfmain.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wfmain.cpp b/wfmain.cpp index eb39c98..fee1ddb 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -147,6 +147,7 @@ void wfmain::closeEvent(QCloseEvent *event) QApplication::exit(); } QCheckBox *cb = new QCheckBox("Don't ask me again"); + cb->setToolTip("Don't ask me to confirm exit again"); QMessageBox msgbox; msgbox.setText("Are you sure you wish to exit?\n"); msgbox.setIcon(QMessageBox::Icon::Question); @@ -174,6 +175,7 @@ void wfmain::closeEvent(QCloseEvent *event) } else { event->ignore(); } + delete cb; } void wfmain::openRig() From e93086f6ac1e83bf027160f8759f7916ea5209d0 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Fri, 23 Sep 2022 19:48:42 +0200 Subject: [PATCH 113/207] Delete quit confirmation checkbox --- CHANGELOG | 3 ++- WHATSNEW | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index eca1444..d885b31 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,8 @@ - 20220923 + Delete quit confirmation checkbox + Use date/time for log name if none specified Fix logfile/directory opening in Windows @@ -15,7 +17,6 @@ Hide UI elements not needed for non-spectrum radios. - updated to v1.48 - 20220921 diff --git a/WHATSNEW b/WHATSNEW index c74bf9e..44bd95f 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -46,6 +46,7 @@ The following highlights are in this 1.41-release: Use date/time for log name if none specified Fix logfile/directory opening in Windows Remove redundant CL args + Delete quit confirmation checkbox Notes: From 70101487a3a9cc6938134df17704adfab83bda0e Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Fri, 23 Sep 2022 22:14:49 +0200 Subject: [PATCH 114/207] ready for v1.50 --- wfserver.pro | 2 +- wfview.pro | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wfserver.pro b/wfserver.pro index c805028..695e502 100644 --- a/wfserver.pro +++ b/wfserver.pro @@ -13,7 +13,7 @@ TEMPLATE = app CONFIG += console -DEFINES += WFVIEW_VERSION=\\\"1.48\\\" +DEFINES += WFVIEW_VERSION=\\\"1.50\\\" DEFINES += BUILD_WFSERVER diff --git a/wfview.pro b/wfview.pro index 36ad558..fdf1b11 100644 --- a/wfview.pro +++ b/wfview.pro @@ -11,7 +11,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport TARGET = wfview TEMPLATE = app -DEFINES += WFVIEW_VERSION=\\\"1.48\\\" +DEFINES += WFVIEW_VERSION=\\\"1.50\\\" DEFINES += BUILD_WFVIEW From d8e244f33a6f420224b8e618c963b15beb4510a1 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 26 Sep 2022 01:44:49 +0100 Subject: [PATCH 115/207] First look at a passband indicator --- rigcommander.cpp | 32 +++++++++++++++++++++++++++ rigcommander.h | 3 +++ wfmain.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++++++-- wfmain.h | 12 +++++++---- 4 files changed, 97 insertions(+), 6 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index d6ea80c..27d30ac 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -872,6 +872,35 @@ void rigCommander::getDuplexMode() prepDataAndSend(payload); } +void rigCommander::getPassband() +{ + QByteArray payload; + payload.setRawData("\x1A\x03", 2); + + /* + int cmd; + if (mode == modeLSB || mode == modeUSB || mode == modeLSB_D || mode == modeUSB_D) + cmd = 1; + else if (mode == modeAM) + cmd = 4; + else if (mode == modeFM) + cmd = 7; + else if (mode == modeCW || mode == modeCW_R) + cmd = 10; + else if (mode == modeRTTY || mode == modeRTTY_R) + cmd = 11; + else if (mode == modePSK || mode == modePSK_R) + cmd = 12; + else + cmd = 1; + + payload.append(bcdEncodeInt(cmd)); + */ + + qDebug() << "Requesting Passband" << payload; + prepDataAndSend(payload); +} + void rigCommander::getTransmitFrequency() { QByteArray payload; @@ -2511,6 +2540,9 @@ void rigCommander::parseRegisters1A() // band stacking register parseBandStackReg(); break; + case '\x03': + emit havePassband(bcdHexToUChar((quint8)payloadIn[2])); + break; case '\x04': state.set(AGC, (quint8)payloadIn[2], false); break; diff --git a/rigcommander.h b/rigcommander.h index e26941e..3655e41 100644 --- a/rigcommander.h +++ b/rigcommander.h @@ -157,6 +157,8 @@ public slots: void setManualNotch(bool enabled); void getManualNotch(); + void getPassband(); + // Repeater: void setDuplexMode(duplexMode dm); void getDuplexMode(); @@ -321,6 +323,7 @@ signals: void haveBandStackReg(freqt f, char mode, char filter, bool dataOn); void haveRitEnabled(bool ritEnabled); void haveRitFrequency(int ritHz); + void havePassband(quint8 pass); // Repeater: void haveDuplexMode(duplexMode); diff --git a/wfmain.cpp b/wfmain.cpp index fee1ddb..f46499e 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -61,6 +61,7 @@ wfmain::wfmain(const QString settingsFile, const QString logFile, bool debugMode qRegisterMetaType(); qRegisterMetaType(); qRegisterMetaType(); + qRegisterMetaType(); qRegisterMetaType(); qRegisterMetaType (); qRegisterMetaType (); @@ -283,6 +284,7 @@ void wfmain::rigConnections() connect(this, SIGNAL(scopeDisplayEnable()), rig, SLOT(enableSpectrumDisplay())); connect(rig, SIGNAL(haveMode(unsigned char, unsigned char)), this, SLOT(receiveMode(unsigned char, unsigned char))); connect(rig, SIGNAL(haveDataMode(bool)), this, SLOT(receiveDataModeStatus(bool))); + connect(rig, SIGNAL(havePassband(quint8)), this, SLOT(receivePassband(quint8))); connect(rpt, SIGNAL(getDuplexMode()), rig, SLOT(getDuplexMode())); connect(rpt, SIGNAL(setDuplexMode(duplexMode)), rig, SLOT(setDuplexMode(duplexMode))); @@ -302,6 +304,7 @@ void wfmain::rigConnections() connect(this, SIGNAL(getDuplexMode()), rig, SLOT(getDuplexMode())); + connect(this, SIGNAL(getPassband()), rig, SLOT(getPassband())); connect(this, SIGNAL(getTone()), rig, SLOT(getTone())); connect(this, SIGNAL(getTSQL()), rig, SLOT(getTSQL())); connect(this, SIGNAL(getRptAccessMode()), rig, SLOT(getRptAccessMode())); @@ -676,10 +679,16 @@ void wfmain::setupPlots() wf = ui->waterfall; + passbandIndicator = new QCPItemRect(plot); + passbandIndicator->setAntialiased(true); + passbandIndicator->setPen(QPen(Qt::red)); + passbandIndicator->setBrush(QBrush(Qt::red)); + freqIndicatorLine = new QCPItemLine(plot); freqIndicatorLine->setAntialiased(true); freqIndicatorLine->setPen(QPen(Qt::blue)); + ui->plot->addGraph(); // primary ui->plot->addGraph(0, 0); // secondary, peaks, same axis as first. ui->plot->addLayer( "Top Layer", ui->plot->layer("main")); @@ -704,8 +713,11 @@ void wfmain::setupPlots() plot->graph(1)->setPen(QPen(color.lighter(200))); plot->graph(1)->setBrush(QBrush(color)); - freqIndicatorLine->start->setCoords(0.5,0); - freqIndicatorLine->end->setCoords(0.5,160); + freqIndicatorLine->start->setCoords(0.5, 0); + freqIndicatorLine->end->setCoords(0.5, 160); + + passbandIndicator->topLeft->setCoords(0.5, 0); + passbandIndicator->bottomRight->setCoords(0.5, 160); // Plot user interaction connect(plot, SIGNAL(mouseDoubleClick(QMouseEvent*)), this, SLOT(handlePlotDoubleClick(QMouseEvent*))); @@ -2982,6 +2994,9 @@ void wfmain::doCmd(cmds cmd) case cmdGetDuplexMode: emit getDuplexMode(); break; + case cmdGetPassband: + emit getPassband(); + break; case cmdGetTone: emit getTone(); break; @@ -3576,6 +3591,9 @@ void wfmain::initPeriodicCommands() insertSlowPeriodicCommand(cmdGetAntenna, 128); } insertSlowPeriodicCommand(cmdGetDuplexMode, 128); + + // Get passband + insertPeriodicCommand(cmdGetPassband, 128); } void wfmain::insertPeriodicCommand(cmds cmd, unsigned char priority) @@ -3750,6 +3768,20 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e { freqIndicatorLine->start->setCoords(freq.MHzDouble,0); freqIndicatorLine->end->setCoords(freq.MHzDouble,rigCaps.spectAmpMax); + + if (currentModeIndex == modeCW || currentModeIndex == modeRTTY || currentModeIndex == modeAM) { + passbandIndicator->topLeft->setCoords(freq.MHzDouble - (passBand/2), 0); + passbandIndicator->bottomRight->setCoords(freq.MHzDouble + (passBand/2), rigCaps.spectAmpMax); + } + else if (currentModeIndex == modeLSB) { + passbandIndicator->topLeft->setCoords(freq.MHzDouble - passBand - 0.0001, 0); + passbandIndicator->bottomRight->setCoords(freq.MHzDouble - 0.0001, rigCaps.spectAmpMax); + } + else if (currentModeIndex == modeUSB) { + passbandIndicator->topLeft->setCoords(freq.MHzDouble + 0.0001, 0); + passbandIndicator->bottomRight->setCoords(freq.MHzDouble + 0.0001 + passBand, rigCaps.spectAmpMax); + } + } if(underlayMode == underlayPeakHold) @@ -5259,6 +5291,24 @@ void wfmain::receiveLANGain(unsigned char level) processModLevel(inputLAN, level); } +void wfmain::receivePassband(quint8 pass) +{ + int calc; + if (currentModeIndex == modeAM) { + calc = 200 + (pass * 200); + } + else if (pass <= 10) + { + calc = 50 + (pass * 50); + } + else { + calc = 600 + ((pass - 10) * 100); + } + passBand = (double)(calc / 1000000.0); + + qInfo() << "Got Passband" << passBand << "(" << pass << ")"; +} + void wfmain::receiveMeter(meterKind inMeter, unsigned char level) { @@ -6562,6 +6612,8 @@ void wfmain::useColorPreset(colorPrefsType *cp) plot->yAxis->setTickPen(cp->axisColor); freqIndicatorLine->setPen(QPen(cp->tuningLine)); + //passbandIndicator->setPen(QPen(cp->tuningLine)); + //passbandIndicator->setBrush(QBrush(cp->tuningLine)); plot->graph(0)->setPen(QPen(cp->spectrumLine)); plot->graph(0)->setBrush(QBrush(cp->spectrumFill)); diff --git a/wfmain.h b/wfmain.h index e7e1ebf..2517afe 100644 --- a/wfmain.h +++ b/wfmain.h @@ -75,7 +75,7 @@ signals: void setRigID(unsigned char rigID); void setRTSforPTT(bool enabled); - // Power + void sendPowerOn(); void sendPowerOff(); @@ -98,6 +98,7 @@ signals: // Repeater: void getDuplexMode(); + void getPassband(); void getTone(); void getTSQL(); void getDTCS(); @@ -239,7 +240,7 @@ private slots: void receiveRITValue(int ritValHz); void receiveModInput(rigInput input, bool dataOn); //void receiveDuplexMode(duplexMode dm); - + void receivePassband(quint8 pass); // Levels: @@ -665,6 +666,7 @@ private: QCustomPlot *plot; // line plot QCustomPlot *wf; // waterfall image QCPItemLine * freqIndicatorLine; + QCPItemRect* passbandIndicator; void setAppTheme(bool isCustom); void prepareWf(); void prepareWf(unsigned int wfLength); @@ -779,6 +781,7 @@ private: double wfCeiling = 160; double oldPlotFloor = -1; double oldPlotCeiling = 999; + double passBand = 0.0; QVector wfimage; unsigned int wfLengthMax; @@ -800,7 +803,7 @@ private: cmdGetDataMode, cmdSetModeFilter, cmdSetDataModeOn, cmdSetDataModeOff, cmdGetRitEnabled, cmdGetRitValue, cmdSpecOn, cmdSpecOff, cmdDispEnable, cmdDispDisable, cmdGetRxGain, cmdSetRxRfGain, cmdGetAfGain, cmdSetAfGain, cmdGetSql, cmdSetSql, cmdGetIFShift, cmdSetIFShift, cmdGetTPBFInner, cmdSetTPBFInner, - cmdGetTPBFOuter, cmdSetTPBFOuter, cmdGetATUStatus, + cmdGetTPBFOuter, cmdSetTPBFOuter, cmdGetATUStatus, cmdGetPassband, cmdSetATU, cmdStartATU, cmdGetSpectrumMode, cmdGetSpectrumSpan, cmdScopeCenterMode, cmdScopeFixedMode, cmdGetPTT, cmdSetPTT, cmdGetTxPower, cmdSetTxPower, cmdGetMicGain, cmdSetMicGain, cmdSetModLevel, @@ -999,7 +1002,7 @@ private: udpServer* udp = Q_NULLPTR; rigCtlD* rigCtl = Q_NULLPTR; QThread* serverThread = Q_NULLPTR; - + void bandStackBtnClick(); bool waitingForBandStackRtn; char bandStkBand; @@ -1043,6 +1046,7 @@ Q_DECLARE_METATYPE(struct networkAudioLevels) Q_DECLARE_METATYPE(enum rigInput) Q_DECLARE_METATYPE(enum meterKind) Q_DECLARE_METATYPE(enum spectrumMode) +Q_DECLARE_METATYPE(enum mode_kind) Q_DECLARE_METATYPE(QList) Q_DECLARE_METATYPE(rigstate*) From 9d9a817f978cecf367799419d7958e8dd7d60ae4 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 26 Sep 2022 11:59:16 +0100 Subject: [PATCH 116/207] Allow changing of passband color --- colorprefs.h | 1 + wfmain.cpp | 29 +- wfmain.h | 4 + wfmain.ui | 934 +++++++++++++++++++++++--------------------- wfview.vcxproj.user | 4 +- 5 files changed, 519 insertions(+), 453 deletions(-) diff --git a/colorprefs.h b/colorprefs.h index 7db11fc..48a61d2 100644 --- a/colorprefs.h +++ b/colorprefs.h @@ -18,6 +18,7 @@ struct colorPrefsType{ QColor underlayFill; QColor plotBackground; QColor tuningLine; + QColor passband; // Waterfall: QColor wfBackground; diff --git a/wfmain.cpp b/wfmain.cpp index f46499e..0d8ae4f 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -1453,6 +1453,7 @@ void wfmain::loadSettings() p->underlayFill.setNamedColor(settings->value("underlayFill", p->underlayFill.name(QColor::HexArgb)).toString()); p->plotBackground.setNamedColor(settings->value("plotBackground", p->plotBackground.name(QColor::HexArgb)).toString()); p->tuningLine.setNamedColor(settings->value("tuningLine", p->tuningLine.name(QColor::HexArgb)).toString()); + p->passband.setNamedColor(settings->value("passband", p->tuningLine.name(QColor::HexArgb)).toString()); p->wfBackground.setNamedColor(settings->value("wfBackground", p->wfBackground.name(QColor::HexArgb)).toString()); p->wfGrid.setNamedColor(settings->value("wfGrid", p->wfGrid.name(QColor::HexArgb)).toString()); p->wfAxis.setNamedColor(settings->value("wfAxis", p->wfAxis.name(QColor::HexArgb)).toString()); @@ -2073,6 +2074,7 @@ void wfmain::saveSettings() settings->setValue("underlayFill", p->underlayFill.name(QColor::HexArgb)); settings->setValue("plotBackground", p->plotBackground.name(QColor::HexArgb)); settings->setValue("tuningLine", p->tuningLine.name(QColor::HexArgb)); + settings->setValue("passband", p->passband.name(QColor::HexArgb)); settings->setValue("wfBackground", p->wfBackground.name(QColor::HexArgb)); settings->setValue("wfGrid", p->wfGrid.name(QColor::HexArgb)); settings->setValue("wfAxis", p->wfAxis.name(QColor::HexArgb)); @@ -2728,6 +2730,7 @@ void wfmain::setDefaultColors(int presetNumber) p->underlayFill = QColor(20+200/4.0*1,70*(1.6-1/4.0), 150, 150); p->plotBackground = QColor(Qt::black); p->tuningLine = QColor(Qt::blue); + p->passband = QColor(Qt::blue); p->meterLevel = QColor("#148CD2").darker(); p->meterAverage = QColor("#3FB7CD"); @@ -2759,6 +2762,7 @@ void wfmain::setDefaultColors(int presetNumber) p->underlayLine = QColor("#9633ff55"); p->underlayFill = QColor(20+200/4.0*1,70*(1.6-1/4.0), 150, 150); p->tuningLine = QColor("#ff55ffff"); + p->passband = QColor("#ff55ffcc"); p->meterLevel = QColor("#148CD2").darker(); p->meterAverage = QColor("#3FB7CD"); @@ -2786,6 +2790,7 @@ void wfmain::setDefaultColors(int presetNumber) p->spectrumLine = QColor(Qt::black); p->underlayLine = QColor(Qt::blue); p->tuningLine = QColor(Qt::darkBlue); + p->passband = QColor(Qt::blue); p->meterAverage = QColor("#3FB7CD"); p->meterPeakLevel = QColor("#3CA0DB"); @@ -6612,8 +6617,8 @@ void wfmain::useColorPreset(colorPrefsType *cp) plot->yAxis->setTickPen(cp->axisColor); freqIndicatorLine->setPen(QPen(cp->tuningLine)); - //passbandIndicator->setPen(QPen(cp->tuningLine)); - //passbandIndicator->setBrush(QBrush(cp->tuningLine)); + passbandIndicator->setPen(QPen(cp->passband)); + passbandIndicator->setBrush(QBrush(cp->passband)); plot->graph(0)->setPen(QPen(cp->spectrumLine)); plot->graph(0)->setBrush(QBrush(cp->spectrumFill)); @@ -6741,6 +6746,7 @@ void wfmain::loadColorPresetToUIandPlots(int presetNumber) setEditAndLedFromColor(p.underlayFill, ui->colorEditUnderlayFill, ui->colorSwatchUnderlayFill); setEditAndLedFromColor(p.plotBackground, ui->colorEditPlotBackground, ui->colorSwatchPlotBackground); setEditAndLedFromColor(p.tuningLine, ui->colorEditTuningLine, ui->colorSwatchTuningLine); + setEditAndLedFromColor(p.passband, ui->colorEditPassband, ui->colorSwatchPassband); setEditAndLedFromColor(p.meterLevel, ui->colorEditMeterLevel, ui->colorSwatchMeterLevel); setEditAndLedFromColor(p.meterAverage, ui->colorEditMeterAvg, ui->colorSwatchMeterAverage); @@ -6974,16 +6980,30 @@ void wfmain::on_colorEditWfText_editingFinished() void wfmain::on_colorSetBtnTuningLine_clicked() { int pos = ui->colorPresetCombo->currentIndex(); - QColor *c = &(colorPreset[pos].tuningLine); + QColor* c = &(colorPreset[pos].tuningLine); setColorButtonOperations(c, ui->colorEditTuningLine, ui->colorSwatchTuningLine); } void wfmain::on_colorEditTuningLine_editingFinished() { int pos = ui->colorPresetCombo->currentIndex(); - QColor *c = &(colorPreset[pos].tuningLine); + QColor* c = &(colorPreset[pos].tuningLine); setColorLineEditOperations(c, ui->colorEditTuningLine, ui->colorSwatchTuningLine); } +// Passband: +void wfmain::on_colorSetBtnPassband_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor* c = &(colorPreset[pos].passband); + setColorButtonOperations(c, ui->colorEditPassband, ui->colorSwatchTuningLine); +} +void wfmain::on_colorEditPassband_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor* c = &(colorPreset[pos].passband); + setColorLineEditOperations(c, ui->colorEditPassband, ui->colorSwatchTuningLine); +} + // Meter Level: void wfmain::on_colorSetBtnMeterLevel_clicked() { @@ -7093,6 +7113,7 @@ void wfmain::on_colorSavePresetBtn_clicked() settings->setValue("underlayFill", p->underlayFill.name(QColor::HexArgb)); settings->setValue("plotBackground", p->plotBackground.name(QColor::HexArgb)); settings->setValue("tuningLine", p->tuningLine.name(QColor::HexArgb)); + settings->setValue("passband", p->passband.name(QColor::HexArgb)); settings->setValue("wfBackground", p->wfBackground.name(QColor::HexArgb)); settings->setValue("wfGrid", p->wfGrid.name(QColor::HexArgb)); settings->setValue("wfAxis", p->wfAxis.name(QColor::HexArgb)); diff --git a/wfmain.h b/wfmain.h index 2517afe..b0e74ed 100644 --- a/wfmain.h +++ b/wfmain.h @@ -610,6 +610,10 @@ private slots: void on_colorEditTuningLine_editingFinished(); + void on_colorSetBtnPassband_clicked(); + + void on_colorEditPassband_editingFinished(); + void on_colorSetBtnMeterLevel_clicked(); void on_colorEditMeterLevel_editingFinished(); diff --git a/wfmain.ui b/wfmain.ui index 705a71f..357c15a 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -6,8 +6,8 @@ 0 0 - 1032 - 582 + 1147 + 636 @@ -18,7 +18,7 @@ - 0 + 3 @@ -2223,7 +2223,7 @@ - 3 + 1 @@ -3343,388 +3343,12 @@ 0 0 - 204 - 582 + 908 + 362 - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Waterfall Grid - - - - - - - - - - Spectrum Fill - - - - - - - Underlay Fill - - - - - - - - - - Meter Average - - - - - - - Meter High Scale - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - - - Waterfall Back - - - - - - - Plot Background - - - - - - - - 90 - 16777215 - - - - Color text format is #AARRGGBB, where AA is the "alpha" channel, and value "00" is totally transparent, and "ff" is totally opaque. - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Waterfall Text - - - - - - - - - - Axis - - - - - - - - - - - - - Waterfall Axis - - - - - - - - - - Grid - - - - - - - - - - - - - - - - Tuning Line - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Text - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Meter Peak Level - - - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - + Qt::Horizontal @@ -3737,69 +3361,485 @@ - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Spectrum Line - - - - - - - - - - Meter Text - - - - - - - Underlay Line - - - - - - - Meter Scale - - - - - - - Meter Level - - + + + + + + Axis + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Meter Text + + + + + + + Meter Scale + + + + + + + Underlay Fill + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Waterfall Grid + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Underlay Line + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Grid + + + + + + + Meter High Scale + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 90 + 16777215 + + + + Color text format is #AARRGGBB, where AA is the "alpha" channel, and value "00" is totally transparent, and "ff" is totally opaque. + + + #AARRGGBB + + + + + + + Tuning Line + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Meter Level + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Plot Background + + + + + + + Waterfall Axis + + + + + + + Spectrum Fill + + + + + + + Spectrum Line + + + + + + + Text + + + + + + + Passband + + + + + + + Waterfall Text + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Meter Peak Level + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Meter Average + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Waterfall Back + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4808,7 +4848,7 @@ 0 0 - 1032 + 1147 21 diff --git a/wfview.vcxproj.user b/wfview.vcxproj.user index 71025e6..cb86757 100644 --- a/wfview.vcxproj.user +++ b/wfview.vcxproj.user @@ -7,9 +7,9 @@ PATH=$(QTDIR)\bin%3bC:\QT\5.15.2\MSVC2019\bin%3b$(QTDIR)\bin%3bC:\QT\5.15.2\MSVC2019\bin%3b$(PATH) - 2022-09-18T13:19:41.5782674Z + 2022-09-26T10:48:44.8024404Z - 2022-09-18T13:19:41.9056515Z + 2022-09-26T10:48:45.0730287Z \ No newline at end of file From 0c530303c7409dab2150f2804d81032e102c0771 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 26 Sep 2022 12:10:41 +0100 Subject: [PATCH 117/207] Move to 3 columns --- wfmain.ui | 685 +++++++++++++++++++++++++++----------------- wfview.vcxproj.user | 4 +- 2 files changed, 424 insertions(+), 265 deletions(-) diff --git a/wfmain.ui b/wfmain.ui index 357c15a..9c70979 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -6,8 +6,8 @@ 0 0 - 1147 - 636 + 1119 + 896 @@ -3333,7 +3333,7 @@ - QAbstractScrollArea::AdjustToContents + QAbstractScrollArea::AdjustIgnored true @@ -3343,8 +3343,8 @@ 0 0 - 908 - 362 + 897 + 547 @@ -3363,10 +3363,136 @@ - - + + 0 + + + 6 + + + + + + 90 + 16777215 + + - Axis + #AARRGGBB + + + + + + + Passband + + + + + + + Waterfall Axis + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 23 + 0 + + + + + + + + + 23 + 0 + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Plot Background + + + + + + + Meter Text + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 23 + 0 + + + + + + + + + 23 + 0 + + + + + + + + Meter High Scale @@ -3383,29 +3509,39 @@ - - - - Meter Text + + + + + 23 + 0 + - - + + - Meter Scale + Text - - + + - Underlay Fill + Grid - - + + + + Waterfall Text + + + + + 90 @@ -3417,15 +3553,71 @@ - - - - Waterfall Grid + + + + + 23 + 0 + - - + + + + + 23 + 0 + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 23 + 0 + + + + + + + + Meter Scale + + + + + 90 @@ -3444,8 +3636,36 @@ - - + + + + Meter Peak Level + + + + + + + Meter Level + + + + + + + Spectrum Line + + + + + + + Waterfall Back + + + + + 90 @@ -3470,22 +3690,8 @@ - - - - Grid - - - - - - - Meter High Scale - - - - - + + 90 @@ -3497,8 +3703,15 @@ - - + + + + Spectrum Fill + + + + + 90 @@ -3510,19 +3723,6 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -3539,6 +3739,63 @@ + + + + Meter Average + + + + + + + + 23 + 0 + + + + + + + + + 23 + 0 + + + + + + + + + 23 + 0 + + + + + + + + + 23 + 0 + + + + + + + + + 23 + 0 + + + + @@ -3546,23 +3803,40 @@ - - - + + + - 90 - 16777215 + 23 + 0 - - #AARRGGBB - - - + + + + + 23 + 0 + + + + + + + + + 23 + 0 + + + + + + - Meter Level + Waterfall Grid @@ -3579,56 +3853,7 @@ - - - - Plot Background - - - - - - - Waterfall Axis - - - - - - - Spectrum Fill - - - - - - - Spectrum Line - - - - - - - Text - - - - - - - Passband - - - - - - - Waterfall Text - - - - + @@ -3641,44 +3866,8 @@ - - - - Meter Peak Level - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - + + 90 @@ -3691,69 +3880,34 @@ - - - - - + + - 90 - 16777215 + 23 + 0 - - #AARRGGBB - - - - + + + - 90 - 16777215 + 23 + 0 + + + + - #AARRGGBB + Axis - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Meter Average - - - - - + + 90 @@ -3778,66 +3932,71 @@ - - - - Waterfall Back + + + + + 23 + 0 + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + 23 + 0 + + + - - + + + + + 90 + 16777215 + + + + #AARRGGBB + + - - + + + + Underlay Fill + + - - + + + + + 90 + 16777215 + + + + #AARRGGBB + + - - - - - - - - - - - - - - - - - + + + + Qt::Horizontal + + + + 40 + 20 + + +
@@ -4848,7 +5007,7 @@ 0 0 - 1147 + 1119 21 @@ -4876,7 +5035,7 @@ - + diff --git a/wfview.vcxproj.user b/wfview.vcxproj.user index cb86757..b8cb75f 100644 --- a/wfview.vcxproj.user +++ b/wfview.vcxproj.user @@ -7,9 +7,9 @@ PATH=$(QTDIR)\bin%3bC:\QT\5.15.2\MSVC2019\bin%3b$(QTDIR)\bin%3bC:\QT\5.15.2\MSVC2019\bin%3b$(PATH) - 2022-09-26T10:48:44.8024404Z + 2022-09-26T11:09:20.6823982Z - 2022-09-26T10:48:45.0730287Z + 2022-09-26T11:09:20.9493996Z \ No newline at end of file From 65b4a9cc17e9e644793d2468577538ea8de68232 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Mon, 26 Sep 2022 11:53:56 -0700 Subject: [PATCH 118/207] Added click-drag tuning. Needs refinement but it's a start. --- wfmain.cpp | 29 ++++++++++++++++++++++++++++- wfmain.h | 5 +++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/wfmain.cpp b/wfmain.cpp index 0d8ae4f..bf5c35f 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -724,6 +724,8 @@ void wfmain::setupPlots() connect(wf, SIGNAL(mouseDoubleClick(QMouseEvent*)), this, SLOT(handleWFDoubleClick(QMouseEvent*))); connect(plot, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(handlePlotClick(QMouseEvent*))); connect(wf, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(handleWFClick(QMouseEvent*))); + connect(plot, SIGNAL(mouseRelease(QMouseEvent*)), this, SLOT(handlePlotMouseRelease(QMouseEvent*))); + connect(plot, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(handlePlotMouseMove(QMouseEvent *))); connect(wf, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(handleWFScroll(QWheelEvent*))); connect(plot, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(handlePlotScroll(QWheelEvent*))); spectrumDrawLock = false; @@ -3969,6 +3971,31 @@ void wfmain::handlePlotClick(QMouseEvent *me) { double x = plot->xAxis->pixelToCoord(me->pos().x()); showStatusBarText(QString("Selected %1 MHz").arg(x)); + this->mousePressFreq = x; +} + +void wfmain::handlePlotMouseRelease(QMouseEvent *me) +{ + this->mouseReleaseFreq = plot->xAxis->pixelToCoord(me->pos().x()); + double delta = mouseReleaseFreq - mousePressFreq; + qInfo(logGui()) << "Mouse release delta: " << delta; +} + +void wfmain::handlePlotMouseMove(QMouseEvent *me) +{ + if(me->buttons() == Qt::LeftButton) + { + double delta = plot->xAxis->pixelToCoord(me->pos().x()) - mousePressFreq; + qInfo(logGui()) << "Mouse moving delta: " << delta; + if( (( delta < -0.0001 ) || (delta > 0.0001)) && ((delta < 0.501) && (delta > -0.501)) ) + { + freqt freqGo; + freqGo.Hz = ( freq.MHzDouble + delta)*1E6; + //freqGo.Hz = roundFrequency(freqGo.Hz, tsWfScrollHz); + freqGo.MHzDouble = (float)freqGo.Hz / 1E6; + issueCmdUniquePriority(cmdSetFreq, freqGo); + } + } } void wfmain::handleWFClick(QMouseEvent *me) @@ -5311,7 +5338,7 @@ void wfmain::receivePassband(quint8 pass) } passBand = (double)(calc / 1000000.0); - qInfo() << "Got Passband" << passBand << "(" << pass << ")"; + qDebug(logGui()) << "Got Passband" << passBand << "(" << pass << ")"; } void wfmain::receiveMeter(meterKind inMeter, unsigned char level) diff --git a/wfmain.h b/wfmain.h index b0e74ed..5dd239b 100644 --- a/wfmain.h +++ b/wfmain.h @@ -283,6 +283,8 @@ private slots: void receiveStatusUpdate(networkStatus status); void receiveNetworkAudioLevels(networkAudioLevels l); void handlePlotClick(QMouseEvent *); + void handlePlotMouseRelease(QMouseEvent *); + void handlePlotMouseMove(QMouseEvent *); void handlePlotDoubleClick(QMouseEvent *); void handleWFClick(QMouseEvent *); void handleWFDoubleClick(QMouseEvent *); @@ -787,6 +789,9 @@ private: double oldPlotCeiling = 999; double passBand = 0.0; + double mousePressFreq = 0.0; + double mouseReleaseFreq = 0.0; + QVector wfimage; unsigned int wfLengthMax; From ac0771f03418230a9389e00d07e967ebc901c853 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 26 Sep 2022 20:46:25 +0100 Subject: [PATCH 119/207] Add passband for FM mode --- wfmain.cpp | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index bf5c35f..ecc2885 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -3776,18 +3776,29 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e freqIndicatorLine->start->setCoords(freq.MHzDouble,0); freqIndicatorLine->end->setCoords(freq.MHzDouble,rigCaps.spectAmpMax); - if (currentModeIndex == modeCW || currentModeIndex == modeRTTY || currentModeIndex == modeAM) { - passbandIndicator->topLeft->setCoords(freq.MHzDouble - (passBand/2), 0); - passbandIndicator->bottomRight->setCoords(freq.MHzDouble + (passBand/2), rigCaps.spectAmpMax); + if (currentModeInfo.mk == modeCW || currentModeIndex == modeRTTY || currentModeIndex == modeAM) { + passbandIndicator->topLeft->setCoords(freq.MHzDouble - (passBand / 2), 0); + passbandIndicator->bottomRight->setCoords(freq.MHzDouble + (passBand / 2), rigCaps.spectAmpMax); } - else if (currentModeIndex == modeLSB) { + else if (currentModeInfo.mk == modeLSB) { passbandIndicator->topLeft->setCoords(freq.MHzDouble - passBand - 0.0001, 0); passbandIndicator->bottomRight->setCoords(freq.MHzDouble - 0.0001, rigCaps.spectAmpMax); } - else if (currentModeIndex == modeUSB) { + else if (currentModeInfo.mk == modeUSB) { passbandIndicator->topLeft->setCoords(freq.MHzDouble + 0.0001, 0); passbandIndicator->bottomRight->setCoords(freq.MHzDouble + 0.0001 + passBand, rigCaps.spectAmpMax); } + else if (currentModeInfo.mk == modeFM) { + if (currentModeInfo.filter == 1) + passBand = 0.015; + else if (currentModeInfo.filter == 2) + passBand = 0.010; + else + passBand = 0.007; + + passbandIndicator->topLeft->setCoords(freq.MHzDouble - (passBand / 2), 0); + passbandIndicator->bottomRight->setCoords(freq.MHzDouble + (passBand / 2), rigCaps.spectAmpMax); + } } @@ -4082,6 +4093,8 @@ void wfmain::receiveMode(unsigned char mode, unsigned char filter) } } currentModeIndex = mode; + currentModeInfo.mk = (mode_kind)mode; + currentModeInfo.filter = filter; } else { qInfo(logSystem()) << __func__ << "Invalid mode " << mode << " received. "; } @@ -4099,7 +4112,6 @@ void wfmain::receiveMode(unsigned char mode, unsigned char filter) (void)filter; - // Note: we need to know if the DATA mode is active to reach mode-D // some kind of queued query: if (rigCaps.hasDataModes && rigCaps.hasTransmit) @@ -5326,7 +5338,7 @@ void wfmain::receiveLANGain(unsigned char level) void wfmain::receivePassband(quint8 pass) { int calc; - if (currentModeIndex == modeAM) { + if (currentModeInfo.mk == modeAM) { calc = 200 + (pass * 200); } else if (pass <= 10) From 08b62244718d3fad731b034c2ef65c3fa338c8c8 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 26 Sep 2022 21:22:02 +0100 Subject: [PATCH 120/207] Add PSK modes to IC-7610 and to passband. --- freqmemory.h | 6 +++--- rigcommander.cpp | 28 ++++------------------------ wfmain.cpp | 27 +++++++++++++-------------- 3 files changed, 20 insertions(+), 41 deletions(-) diff --git a/freqmemory.h b/freqmemory.h index 96d3c6b..0067158 100644 --- a/freqmemory.h +++ b/freqmemory.h @@ -17,6 +17,8 @@ enum mode_kind { modeFM=0x05, modeCW_R=0x07, modeRTTY_R=0x08, + modePSK = 0x12, + modePSK_R = 0x13, modeLSB_D=0x80, modeUSB_D=0x81, modeDV=0x17, @@ -29,9 +31,7 @@ enum mode_kind { modedPMR, modeNXDN_VN, modeNXDN_N, - modeDCR, - modePSK, - modePSK_R + modeDCR }; struct mode_info { diff --git a/rigcommander.cpp b/rigcommander.cpp index 27d30ac..a85b847 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -876,28 +876,6 @@ void rigCommander::getPassband() { QByteArray payload; payload.setRawData("\x1A\x03", 2); - - /* - int cmd; - if (mode == modeLSB || mode == modeUSB || mode == modeLSB_D || mode == modeUSB_D) - cmd = 1; - else if (mode == modeAM) - cmd = 4; - else if (mode == modeFM) - cmd = 7; - else if (mode == modeCW || mode == modeCW_R) - cmd = 10; - else if (mode == modeRTTY || mode == modeRTTY_R) - cmd = 11; - else if (mode == modePSK || mode == modePSK_R) - cmd = 12; - else - cmd = 1; - - payload.append(bcdEncodeInt(cmd)); - */ - - qDebug() << "Requesting Passband" << payload; prepDataAndSend(payload); } @@ -3271,8 +3249,8 @@ void rigCommander::determineRigCaps() rigCaps.bands.push_back(bandGen); rigCaps.bsr[bandGen] = 0x11; rigCaps.modes = commonModes; - rigCaps.modes.insert(rigCaps.modes.end(), {createMode(modePSK, 0x12, "PSK"), - createMode(modePSK_R, 0x13, "PSK-R")}); + rigCaps.modes.insert(rigCaps.modes.end(), { createMode(modePSK, 0x12, "PSK"), + createMode(modePSK_R, 0x13, "PSK-R") }); rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x97"); break; case model7610: @@ -3305,6 +3283,8 @@ void rigCommander::determineRigCaps() rigCaps.bands.push_back(band630m); rigCaps.bands.push_back(band2200m); rigCaps.modes = commonModes; + rigCaps.modes.insert(rigCaps.modes.end(), { createMode(modePSK, 0x12, "PSK"), + createMode(modePSK_R, 0x13, "PSK-R") }); rigCaps.hasRXAntenna = true; rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x01\x12"); break; diff --git a/wfmain.cpp b/wfmain.cpp index ecc2885..5e92480 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -3776,30 +3776,29 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e freqIndicatorLine->start->setCoords(freq.MHzDouble,0); freqIndicatorLine->end->setCoords(freq.MHzDouble,rigCaps.spectAmpMax); - if (currentModeInfo.mk == modeCW || currentModeIndex == modeRTTY || currentModeIndex == modeAM) { - passbandIndicator->topLeft->setCoords(freq.MHzDouble - (passBand / 2), 0); - passbandIndicator->bottomRight->setCoords(freq.MHzDouble + (passBand / 2), rigCaps.spectAmpMax); - } - else if (currentModeInfo.mk == modeLSB) { + if (currentModeInfo.mk == modeLSB || currentModeInfo.mk == modePSK_R) { passbandIndicator->topLeft->setCoords(freq.MHzDouble - passBand - 0.0001, 0); passbandIndicator->bottomRight->setCoords(freq.MHzDouble - 0.0001, rigCaps.spectAmpMax); } - else if (currentModeInfo.mk == modeUSB) { + else if (currentModeInfo.mk == modeUSB || currentModeInfo.mk == modePSK) { passbandIndicator->topLeft->setCoords(freq.MHzDouble + 0.0001, 0); passbandIndicator->bottomRight->setCoords(freq.MHzDouble + 0.0001 + passBand, rigCaps.spectAmpMax); } - else if (currentModeInfo.mk == modeFM) { - if (currentModeInfo.filter == 1) - passBand = 0.015; - else if (currentModeInfo.filter == 2) - passBand = 0.010; - else - passBand = 0.007; - + else + { + if (currentModeInfo.mk == modeFM) { + if (currentModeInfo.filter == 1) + passBand = 0.015; + else if (currentModeInfo.filter == 2) + passBand = 0.010; + else + passBand = 0.007; + } passbandIndicator->topLeft->setCoords(freq.MHzDouble - (passBand / 2), 0); passbandIndicator->bottomRight->setCoords(freq.MHzDouble + (passBand / 2), rigCaps.spectAmpMax); } + } if(underlayMode == underlayPeakHold) From 87ebd0cdcc98c70f2e653cdfd3a5ca1082c9492a Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sun, 25 Sep 2022 11:15:45 +0100 Subject: [PATCH 121/207] Fix default audio device selection and hopefully fix device language issue --- wfmain.cpp | 75 +++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 18 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 5e92480..60b29b0 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -1642,10 +1642,10 @@ void wfmain::loadSettings() ui->audioTXCodecCombo->setCurrentIndex(f); ui->audioRXCodecCombo->blockSignals(false); - rxSetup.name = settings->value("AudioOutput", "").toString(); + rxSetup.name = settings->value("AudioOutput", "Default Output Device").toString(); qInfo(logGui()) << "Got Audio Output from Settings: " << rxSetup.name; - txSetup.name = settings->value("AudioInput", "").toString(); + txSetup.name = settings->value("AudioInput", "Default Input Device").toString(); qInfo(logGui()) << "Got Audio Input from Settings: " << txSetup.name; @@ -1722,8 +1722,8 @@ void wfmain::loadSettings() memcpy(rigTemp->guid, QUuid::fromString(guid).toRfc4122().constData(), GUIDLEN); #endif - rigTemp->rxAudioSetup.name = settings->value("ServerAudioInput", "").toString(); - rigTemp->txAudioSetup.name = settings->value("ServerAudioOutput", "").toString(); + rigTemp->rxAudioSetup.name = settings->value("ServerAudioInput", "Default Input Device").toString(); + rigTemp->txAudioSetup.name = settings->value("ServerAudioOutput", "Default Output Device").toString(); serverConfig.rigs.append(rigTemp); int row = 0; @@ -6160,10 +6160,18 @@ void wfmain::setAudioDevicesUI() ui->serverTXAudioOutputCombo->clear(); ui->serverRXAudioInputCombo->clear(); - qDebug(logSystem()) << "Finding audio devices, output=" << rxSetup.name << "input="<audioInputCombo->addItem(deviceInfo.deviceName(), QVariant::fromValue(deviceInfo)); ui->serverRXAudioInputCombo->addItem(deviceInfo.deviceName(), QVariant::fromValue(deviceInfo)); - inCount++; #ifdef Q_OS_WIN } #endif + inCount++; } - const auto audioOutputs = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput); - for (const QAudioDeviceInfo& deviceInfo : audioOutputs) { + foreach(const QAudioDeviceInfo & deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) + { + if (outCount == 0) + defaultAudioOutputName = QString(deviceInfo.deviceName().toLocal8Bit()); #ifdef Q_OS_WIN if (deviceInfo.realm() == "wasapi") { #endif + qInfo(logGui()) << "Output:" << deviceInfo.deviceName() << "realm" << deviceInfo.realm(); ui->audioOutputCombo->addItem(deviceInfo.deviceName(), QVariant::fromValue(deviceInfo)); ui->serverTXAudioOutputCombo->addItem(deviceInfo.deviceName(), QVariant::fromValue(deviceInfo)); - outCount++; #ifdef Q_OS_WIN } #endif + outCount++; } break; } @@ -6226,6 +6241,7 @@ void wfmain::setAudioDevicesUI() ui->audioInputCombo->addItem(info->name, i); ui->serverRXAudioInputCombo->addItem(info->name, i); if (i == Pa_GetDefaultInputDevice()) { + defaultAudioInputName = info->name; defaultAudioInputIndex = inCount; } inCount++; @@ -6235,6 +6251,7 @@ void wfmain::setAudioDevicesUI() ui->audioOutputCombo->addItem(info->name, i); ui->serverTXAudioOutputCombo->addItem(info->name, i); if (i == Pa_GetDefaultOutputDevice()) { + defaultAudioOutputName = info->name; defaultAudioOutputIndex = outCount; } outCount++; @@ -6291,6 +6308,7 @@ void wfmain::setAudioDevicesUI() ui->audioInputCombo->addItem(QString::fromStdString(info.name), i); ui->serverRXAudioInputCombo->addItem(QString::fromStdString(info.name), i); if (info.isDefaultInput) { + defaultAudioInputName = QString::fromStdString(info.name); defaultAudioInputIndex = inCount; } inCount++; @@ -6300,6 +6318,7 @@ void wfmain::setAudioDevicesUI() ui->audioOutputCombo->addItem(QString::fromStdString(info.name), i); ui->serverTXAudioOutputCombo->addItem(QString::fromStdString(info.name), i); if (info.isDefaultOutput) { + defaultAudioOutputName = QString::fromStdString(info.name); defaultAudioOutputIndex = outCount; } outCount++; @@ -6333,21 +6352,38 @@ void wfmain::setAudioDevicesUI() int audioInputIndex = ui->audioInputCombo->findText(txSetup.name); if (audioInputIndex != -1) { + qInfo(logGui()) << "Found Audio Input Device: " << txSetup.name; ui->audioInputCombo->setCurrentIndex(audioInputIndex); } else { - qDebug(logSystem()) << "Audio input not found"; - ui->audioInputCombo->setCurrentIndex(defaultAudioInputIndex); + qWarning(logGui()) << "Audio Input Device: " << txSetup.name << "Not Found, trying to select default"; + audioInputIndex = ui->audioInputCombo->findText(defaultAudioInputName); + if (audioInputIndex != -1) { + ui->audioInputCombo->setCurrentIndex(audioInputIndex); + } + else { + qWarning(logGui()) << "Unable to select default input device,"<< defaultAudioInputName << " help....."; + } + } + //on_audioInputCombo_currentIndexChanged(ui->audioInputCombo->currentIndex()); int audioOutputIndex = ui->audioOutputCombo->findText(rxSetup.name); if (audioOutputIndex != -1) { + qInfo(logGui()) << "Found Audio Output Device: " << rxSetup.name; ui->audioOutputCombo->setCurrentIndex(audioOutputIndex); } else { - qDebug(logSystem()) << "Audio output not found"; - ui->audioOutputCombo->setCurrentIndex(defaultAudioOutputIndex); + qWarning(logGui()) << "Audio output Device: " << rxSetup.name << "Not Found, trying to select default"; + audioOutputIndex = ui->audioOutputCombo->findText(defaultAudioOutputName); + if (audioOutputIndex != -1) { + ui->audioOutputCombo->setCurrentIndex(audioOutputIndex); + } + else { + qWarning(logGui()) << "Unable to select default output device," << defaultAudioOutputName << " help....."; + } } + //on_audioOutputCombo_currentIndexChanged(ui->audioOutputCombo->currentIndex()); if (!serverConfig.rigs.isEmpty()) @@ -6357,23 +6393,26 @@ void wfmain::setAudioDevicesUI() serverConfig.rigs.first()->rxAudioSetup.type = prefs.audioSystem; serverConfig.rigs.first()->txAudioSetup.type = prefs.audioSystem; + ui->serverRXAudioInputCombo->setCurrentIndex(defaultAudioInputIndex); int serverAudioInputIndex = ui->serverRXAudioInputCombo->findText(serverConfig.rigs.first()->rxAudioSetup.name); if (serverAudioInputIndex != -1) { ui->serverRXAudioInputCombo->setCurrentIndex(serverAudioInputIndex); } else { - // Set to default - ui->serverRXAudioInputCombo->setCurrentIndex(defaultAudioInputIndex); + qWarning(logGui()) << "Server audio input NOT FOUND " << serverConfig.rigs.first()->rxAudioSetup.name << "not selecting default"; } qInfo(logGui()) << "Got Server Audio Output: " << serverConfig.rigs.first()->txAudioSetup.name; + + ui->serverTXAudioOutputCombo->setCurrentIndex(defaultAudioOutputIndex); int serverAudioOutputIndex = ui->serverTXAudioOutputCombo->findText(serverConfig.rigs.first()->txAudioSetup.name); if (serverAudioOutputIndex != -1) { ui->serverTXAudioOutputCombo->setCurrentIndex(serverAudioOutputIndex); } else { - ui->serverTXAudioOutputCombo->setCurrentIndex(defaultAudioOutputIndex); + qWarning(logGui()) << "Server audio output NOT FOUND " << serverConfig.rigs.first()->txAudioSetup.name << "not selecting default"; } + } qDebug(logSystem()) << "Audio devices done."; From 518e1700ae3d24356c4d6dd21238441aa3e561ff Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sun, 25 Sep 2022 11:32:43 +0100 Subject: [PATCH 122/207] Remove logging of audio device realm --- wfmain.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 60b29b0..b0f9122 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6188,7 +6188,6 @@ void wfmain::setAudioDevicesUI() #ifdef Q_OS_WIN if (deviceInfo.realm() == "wasapi") { #endif - qInfo(logGui()) << "Input:" << deviceInfo.deviceName() << "realm" << deviceInfo.realm(); ui->audioInputCombo->addItem(deviceInfo.deviceName(), QVariant::fromValue(deviceInfo)); ui->serverRXAudioInputCombo->addItem(deviceInfo.deviceName(), QVariant::fromValue(deviceInfo)); #ifdef Q_OS_WIN @@ -6204,7 +6203,6 @@ void wfmain::setAudioDevicesUI() #ifdef Q_OS_WIN if (deviceInfo.realm() == "wasapi") { #endif - qInfo(logGui()) << "Output:" << deviceInfo.deviceName() << "realm" << deviceInfo.realm(); ui->audioOutputCombo->addItem(deviceInfo.deviceName(), QVariant::fromValue(deviceInfo)); ui->serverTXAudioOutputCombo->addItem(deviceInfo.deviceName(), QVariant::fromValue(deviceInfo)); #ifdef Q_OS_WIN From b7af0d4eddd23ac6b77bfd0b264733cebdbd74ae Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sun, 25 Sep 2022 18:22:48 +0100 Subject: [PATCH 123/207] Remove obsolete code --- wfmain.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index b0f9122..1081ba9 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6172,15 +6172,13 @@ void wfmain::setAudioDevicesUI() QString defaultAudioInputName; QString defaultAudioOutputName; - int inCount = 0; - int outCount = 0; - switch (prefs.audioSystem) { case qtAudio: { Pa_Terminate(); + int inCount = 0; foreach(const QAudioDeviceInfo & deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioInput)) { if (inCount == 0) @@ -6196,6 +6194,7 @@ void wfmain::setAudioDevicesUI() inCount++; } + int outCount = 0; foreach(const QAudioDeviceInfo & deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) { if (outCount == 0) @@ -6240,9 +6239,7 @@ void wfmain::setAudioDevicesUI() ui->serverRXAudioInputCombo->addItem(info->name, i); if (i == Pa_GetDefaultInputDevice()) { defaultAudioInputName = info->name; - defaultAudioInputIndex = inCount; } - inCount++; } if (info->maxOutputChannels > 0) { qDebug(logAudio()) << (i == Pa_GetDefaultOutputDevice() ? "*" : " ") << "(" << i << ") Output Device : " << info->name; @@ -6250,9 +6247,7 @@ void wfmain::setAudioDevicesUI() ui->serverTXAudioOutputCombo->addItem(info->name, i); if (i == Pa_GetDefaultOutputDevice()) { defaultAudioOutputName = info->name; - defaultAudioOutputIndex = outCount; } - outCount++; } } break; @@ -6307,9 +6302,7 @@ void wfmain::setAudioDevicesUI() ui->serverRXAudioInputCombo->addItem(QString::fromStdString(info.name), i); if (info.isDefaultInput) { defaultAudioInputName = QString::fromStdString(info.name); - defaultAudioInputIndex = inCount; } - inCount++; } if (info.outputChannels > 0) { qInfo(logAudio()) << (info.isDefaultOutput ? "*" : " ") << "(" << i << ") Output Device : " << QString::fromStdString(info.name); @@ -6317,9 +6310,7 @@ void wfmain::setAudioDevicesUI() ui->serverTXAudioOutputCombo->addItem(QString::fromStdString(info.name), i); if (info.isDefaultOutput) { defaultAudioOutputName = QString::fromStdString(info.name); - defaultAudioOutputIndex = outCount; } - outCount++; } } @@ -6364,7 +6355,6 @@ void wfmain::setAudioDevicesUI() } } - //on_audioInputCombo_currentIndexChanged(ui->audioInputCombo->currentIndex()); int audioOutputIndex = ui->audioOutputCombo->findText(rxSetup.name); if (audioOutputIndex != -1) { @@ -6381,7 +6371,6 @@ void wfmain::setAudioDevicesUI() qWarning(logGui()) << "Unable to select default output device," << defaultAudioOutputName << " help....."; } } - //on_audioOutputCombo_currentIndexChanged(ui->audioOutputCombo->currentIndex()); if (!serverConfig.rigs.isEmpty()) From 51878e5a3dcb741072910fe504377efa7f9bcd8c Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Tue, 27 Sep 2022 08:30:17 +0100 Subject: [PATCH 124/207] Make multimedia-plugins message only for Linux --- audiohandler.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/audiohandler.cpp b/audiohandler.cpp index 2244960..5628f4c 100644 --- a/audiohandler.cpp +++ b/audiohandler.cpp @@ -46,7 +46,11 @@ audioHandler::~audioHandler() qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "audio handler starting:" << setup.name; if (setup.port.isNull()) { - qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "No audio device was found. You probably need to install libqt5multimedia-plugins."; +#ifdef Q_OS_LINUX + qCritical(logAudio()) << (setup.isinput ? "Input" : "Output") << "No audio device was found. You probably need to install libqt5multimedia-plugins."; +#else + qCritical(logAudio()) << (setup.isinput ? "Input" : "Output") << "Audio device is NULL, please check device selection in settings."; +#endif return false; } From 242d39ce39d2f0e0c00792066e41936aa47815cc Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Tue, 27 Sep 2022 08:44:55 +0100 Subject: [PATCH 125/207] Always use 8bit encoding for audio device names --- wfmain.cpp | 56 +++++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 1081ba9..8961a22 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6186,8 +6186,8 @@ void wfmain::setAudioDevicesUI() #ifdef Q_OS_WIN if (deviceInfo.realm() == "wasapi") { #endif - ui->audioInputCombo->addItem(deviceInfo.deviceName(), QVariant::fromValue(deviceInfo)); - ui->serverRXAudioInputCombo->addItem(deviceInfo.deviceName(), QVariant::fromValue(deviceInfo)); + ui->audioInputCombo->addItem(deviceInfo.deviceName().toLocal8Bit(), QVariant::fromValue(deviceInfo)); + ui->serverRXAudioInputCombo->addItem(deviceInfo.deviceName().toLocal8Bit(), QVariant::fromValue(deviceInfo)); #ifdef Q_OS_WIN } #endif @@ -6202,8 +6202,8 @@ void wfmain::setAudioDevicesUI() #ifdef Q_OS_WIN if (deviceInfo.realm() == "wasapi") { #endif - ui->audioOutputCombo->addItem(deviceInfo.deviceName(), QVariant::fromValue(deviceInfo)); - ui->serverTXAudioOutputCombo->addItem(deviceInfo.deviceName(), QVariant::fromValue(deviceInfo)); + ui->audioOutputCombo->addItem(deviceInfo.deviceName().toLocal8Bit(), QVariant::fromValue(deviceInfo)); + ui->serverTXAudioOutputCombo->addItem(deviceInfo.deviceName().toLocal8Bit(), QVariant::fromValue(deviceInfo)); #ifdef Q_OS_WIN } #endif @@ -6233,18 +6233,18 @@ void wfmain::setAudioDevicesUI() { info = Pa_GetDeviceInfo(i); if (info->maxInputChannels > 0) { - qDebug(logAudio()) << (i == Pa_GetDefaultInputDevice() ? "*" : " ") << "(" << i << ") Input Device : " << info->name; + qDebug(logAudio()) << (i == Pa_GetDefaultInputDevice() ? "*" : " ") << "(" << i << ") Input Device : " << QString(info->name).toLocal8Bit(); - ui->audioInputCombo->addItem(info->name, i); - ui->serverRXAudioInputCombo->addItem(info->name, i); + ui->audioInputCombo->addItem(QString(info->name).toLocal8Bit(), i); + ui->serverRXAudioInputCombo->addItem(QString(info->name).toLocal8Bit(), i); if (i == Pa_GetDefaultInputDevice()) { defaultAudioInputName = info->name; } } if (info->maxOutputChannels > 0) { - qDebug(logAudio()) << (i == Pa_GetDefaultOutputDevice() ? "*" : " ") << "(" << i << ") Output Device : " << info->name; - ui->audioOutputCombo->addItem(info->name, i); - ui->serverTXAudioOutputCombo->addItem(info->name, i); + qDebug(logAudio()) << (i == Pa_GetDefaultOutputDevice() ? "*" : " ") << "(" << i << ") Output Device : " << QString(info->name).toLocal8Bit(); + ui->audioOutputCombo->addItem(QString(info->name).toLocal8Bit(), i); + ui->serverTXAudioOutputCombo->addItem(QString(info->name).toLocal8Bit(), i); if (i == Pa_GetDefaultOutputDevice()) { defaultAudioOutputName = info->name; } @@ -6297,19 +6297,19 @@ void wfmain::setAudioDevicesUI() for (unsigned int i = 1; i < devices; i++) { info = audio->getDeviceInfo(i); if (info.inputChannels > 0) { - qInfo(logAudio()) << (info.isDefaultInput ? "*" : " ") << "(" << i << ") Input Device : " << QString::fromStdString(info.name); - ui->audioInputCombo->addItem(QString::fromStdString(info.name), i); - ui->serverRXAudioInputCombo->addItem(QString::fromStdString(info.name), i); + qInfo(logAudio()) << (info.isDefaultInput ? "*" : " ") << "(" << i << ") Input Device : " << QString::fromStdString(info.name).toLocal8Bit(); + ui->audioInputCombo->addItem(QString::fromStdString(info.name).toLocal8Bit(), i); + ui->serverRXAudioInputCombo->addItem(QString::fromStdString(info.name).toLocal8Bit(), i); if (info.isDefaultInput) { - defaultAudioInputName = QString::fromStdString(info.name); + defaultAudioInputName = QString::fromStdString(info.name).toLocal8Bit(); } } if (info.outputChannels > 0) { - qInfo(logAudio()) << (info.isDefaultOutput ? "*" : " ") << "(" << i << ") Output Device : " << QString::fromStdString(info.name); - ui->audioOutputCombo->addItem(QString::fromStdString(info.name), i); - ui->serverTXAudioOutputCombo->addItem(QString::fromStdString(info.name), i); + qInfo(logAudio()) << (info.isDefaultOutput ? "*" : " ") << "(" << i << ") Output Device : " << QString::fromStdString(info.name).toLocal8Bit(); + ui->audioOutputCombo->addItem(QString::fromStdString(info.name).toLocal8Bit(), i); + ui->serverTXAudioOutputCombo->addItem(QString::fromStdString(info.name).toLocal8Bit(), i); if (info.isDefaultOutput) { - defaultAudioOutputName = QString::fromStdString(info.name); + defaultAudioOutputName = QString::fromStdString(info.name).toLocal8Bit(); } } } @@ -6356,48 +6356,48 @@ void wfmain::setAudioDevicesUI() } - int audioOutputIndex = ui->audioOutputCombo->findText(rxSetup.name); + int audioOutputIndex = ui->audioOutputCombo->findText(rxSetup.name.toLocal8Bit()); if (audioOutputIndex != -1) { - qInfo(logGui()) << "Found Audio Output Device: " << rxSetup.name; + qInfo(logGui()) << "Found Audio Output Device: " << rxSetup.name.toLocal8Bit(); ui->audioOutputCombo->setCurrentIndex(audioOutputIndex); } else { qWarning(logGui()) << "Audio output Device: " << rxSetup.name << "Not Found, trying to select default"; - audioOutputIndex = ui->audioOutputCombo->findText(defaultAudioOutputName); + audioOutputIndex = ui->audioOutputCombo->findText(defaultAudioOutputName.toLocal8Bit()); if (audioOutputIndex != -1) { ui->audioOutputCombo->setCurrentIndex(audioOutputIndex); } else { - qWarning(logGui()) << "Unable to select default output device," << defaultAudioOutputName << " help....."; + qWarning(logGui()) << "Unable to select default output device," << defaultAudioOutputName.toLocal8Bit() << " help....."; } } if (!serverConfig.rigs.isEmpty()) { - qInfo(logGui()) << "Got Server Audio Input: " << serverConfig.rigs.first()->rxAudioSetup.name; + qInfo(logGui()) << "Got Server Audio Input: " << serverConfig.rigs.first()->rxAudioSetup.name.toLocal8Bit(); serverConfig.rigs.first()->rxAudioSetup.type = prefs.audioSystem; serverConfig.rigs.first()->txAudioSetup.type = prefs.audioSystem; ui->serverRXAudioInputCombo->setCurrentIndex(defaultAudioInputIndex); - int serverAudioInputIndex = ui->serverRXAudioInputCombo->findText(serverConfig.rigs.first()->rxAudioSetup.name); + int serverAudioInputIndex = ui->serverRXAudioInputCombo->findText(serverConfig.rigs.first()->rxAudioSetup.name.toLocal8Bit()); if (serverAudioInputIndex != -1) { ui->serverRXAudioInputCombo->setCurrentIndex(serverAudioInputIndex); } else { - qWarning(logGui()) << "Server audio input NOT FOUND " << serverConfig.rigs.first()->rxAudioSetup.name << "not selecting default"; + qWarning(logGui()) << "Server audio input NOT FOUND " << serverConfig.rigs.first()->rxAudioSetup.name.toLocal8Bit() << "not selecting default"; } - qInfo(logGui()) << "Got Server Audio Output: " << serverConfig.rigs.first()->txAudioSetup.name; + qInfo(logGui()) << "Got Server Audio Output: " << serverConfig.rigs.first()->txAudioSetup.name.toLocal8Bit(); ui->serverTXAudioOutputCombo->setCurrentIndex(defaultAudioOutputIndex); - int serverAudioOutputIndex = ui->serverTXAudioOutputCombo->findText(serverConfig.rigs.first()->txAudioSetup.name); + int serverAudioOutputIndex = ui->serverTXAudioOutputCombo->findText(serverConfig.rigs.first()->txAudioSetup.name.toLocal8Bit()); if (serverAudioOutputIndex != -1) { ui->serverTXAudioOutputCombo->setCurrentIndex(serverAudioOutputIndex); } else { - qWarning(logGui()) << "Server audio output NOT FOUND " << serverConfig.rigs.first()->txAudioSetup.name << "not selecting default"; + qWarning(logGui()) << "Server audio output NOT FOUND " << serverConfig.rigs.first()->txAudioSetup.name.toLocal8Bit() << "not selecting default"; } } From b3756391c13d9e4440b9fa5237dbb36910eaf722 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Tue, 27 Sep 2022 08:57:22 +0100 Subject: [PATCH 126/207] Silently ignore server audio issues if server is not enabled. --- wfmain.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 8961a22..ea97ea2 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6375,7 +6375,8 @@ void wfmain::setAudioDevicesUI() if (!serverConfig.rigs.isEmpty()) { - qInfo(logGui()) << "Got Server Audio Input: " << serverConfig.rigs.first()->rxAudioSetup.name.toLocal8Bit(); + if (serverConfig.enabled) + qInfo(logGui()) << "Got Server Audio Input: " << serverConfig.rigs.first()->rxAudioSetup.name.toLocal8Bit(); serverConfig.rigs.first()->rxAudioSetup.type = prefs.audioSystem; serverConfig.rigs.first()->txAudioSetup.type = prefs.audioSystem; @@ -6386,10 +6387,12 @@ void wfmain::setAudioDevicesUI() ui->serverRXAudioInputCombo->setCurrentIndex(serverAudioInputIndex); } else { - qWarning(logGui()) << "Server audio input NOT FOUND " << serverConfig.rigs.first()->rxAudioSetup.name.toLocal8Bit() << "not selecting default"; + if (serverConfig.enabled) + qWarning(logGui()) << "Server audio input NOT FOUND " << serverConfig.rigs.first()->rxAudioSetup.name.toLocal8Bit() << "not selecting default"; } - qInfo(logGui()) << "Got Server Audio Output: " << serverConfig.rigs.first()->txAudioSetup.name.toLocal8Bit(); + if (serverConfig.enabled) + qInfo(logGui()) << "Got Server Audio Output: " << serverConfig.rigs.first()->txAudioSetup.name.toLocal8Bit(); ui->serverTXAudioOutputCombo->setCurrentIndex(defaultAudioOutputIndex); int serverAudioOutputIndex = ui->serverTXAudioOutputCombo->findText(serverConfig.rigs.first()->txAudioSetup.name.toLocal8Bit()); @@ -6397,7 +6400,8 @@ void wfmain::setAudioDevicesUI() ui->serverTXAudioOutputCombo->setCurrentIndex(serverAudioOutputIndex); } else { - qWarning(logGui()) << "Server audio output NOT FOUND " << serverConfig.rigs.first()->txAudioSetup.name.toLocal8Bit() << "not selecting default"; + if (serverConfig.enabled) + qWarning(logGui()) << "Server audio output NOT FOUND " << serverConfig.rigs.first()->txAudioSetup.name.toLocal8Bit() << "not selecting default"; } } From 1193841103b54a1e1e1a21bcf0b4c79f2e268723 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Tue, 27 Sep 2022 09:37:24 +0100 Subject: [PATCH 127/207] Ignore second VFO scope data (for now) --- rigcommander.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rigcommander.cpp b/rigcommander.cpp index a85b847..1d2a30e 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -3783,9 +3783,16 @@ void rigCommander::parseSpectrum() freqt fStart; freqt fEnd; + unsigned char vfo = bcdHexToUChar(payloadIn[02]); unsigned char sequence = bcdHexToUChar(payloadIn[03]); + //unsigned char sequenceMax = bcdHexToDecimal(payloadIn[04]); + if (vfo == 1) + { + // This is for the second VFO! + return; + } // unsigned char waveInfo = payloadIn[06]; // really just one byte? //qInfo(logRig()) << "Spectrum Data received: " << sequence << "/" << sequenceMax << " mode: " << scopeMode << " waveInfo: " << waveInfo << " length: " << payloadIn.length(); From 0bb57a859da9ac94b9f72a76ba05b7f67c0dc996 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Tue, 27 Sep 2022 10:22:27 +0100 Subject: [PATCH 128/207] See if this works better for color pickers? --- wfmain.ui | 994 +++++++++++++++++++++++++++--------------------------- 1 file changed, 497 insertions(+), 497 deletions(-) diff --git a/wfmain.ui b/wfmain.ui index 9c70979..f935c2b 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -3369,151 +3369,11 @@ 6 - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Passband - - - - - - - Waterfall Axis - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - + + - 23 - 0 - - - - - - - - - 23 - 0 - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Plot Background - - - - - - - Meter Text - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 23 - 0 - - - - - - - - - 23 - 0 - - - - - - - - Meter High Scale - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 23 + 10 0 @@ -3533,48 +3393,75 @@ - - + + - Waterfall Text + Waterfall Axis - - - - - 90 - 16777215 - - + + - #AARRGGBB + Axis - - + + - 23 + 10 0 - - + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Plot Background + + + + + - 23 + 10 0 - - + + 90 @@ -3586,70 +3473,6 @@ - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 23 - 0 - - - - - - - - Meter Scale - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Underlay Line - - - - - - - Meter Peak Level - - - - - - - Meter Level - - - @@ -3657,203 +3480,37 @@ - + + + + + 10 + 0 + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + Waterfall Back - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Spectrum Fill - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 90 - 16777215 - - - - Color text format is #AARRGGBB, where AA is the "alpha" channel, and value "00" is totally transparent, and "ff" is totally opaque. - - - #AARRGGBB - - - - - - - Meter Average - - - - - - - - 23 - 0 - - - - - - - - - 23 - 0 - - - - - - - - - 23 - 0 - - - - - - - - - 23 - 0 - - - - - - - - - 23 - 0 - - - - - - - - Tuning Line - - - - - - - - 23 - 0 - - - - - - - - - 23 - 0 - - - - - - - - - 23 - 0 - - - - - - - - Waterfall Grid - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - + @@ -3866,6 +3523,42 @@ + + + + + 10 + 0 + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + @@ -3879,35 +3572,22 @@ - - - - - 23 - 0 - - - - - - - - - 23 - 0 - - - - - - + + - Axis + Spectrum Fill - - + + + + Waterfall Grid + + + + + 90 @@ -3919,61 +3599,8 @@ - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - - 23 - 0 - - - - - - - - - 23 - 0 - - - - - - - - - 90 - 16777215 - - - - #AARRGGBB - - - - - - - Underlay Fill - - - - + 90 @@ -3985,6 +3612,56 @@ + + + + Underlay Line + + + + + + + + 10 + 0 + + + + + + + + Waterfall Text + + + + + + + + 90 + 16777215 + + + + Color text format is #AARRGGBB, where AA is the "alpha" channel, and value "00" is totally transparent, and "ff" is totally opaque. + + + #AARRGGBB + + + + + + + + 10 + 0 + + + + @@ -3998,6 +3675,329 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 10 + 0 + + + + + + + + + 10 + 0 + + + + + + + + + 10 + 0 + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Meter Text + + + + + + + + 10 + 0 + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Meter Scale + + + + + + + + 10 + 0 + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Meter High Scale + + + + + + + Meter Peak Level + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 10 + 0 + + + + + + + + + 10 + 0 + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Meter Average + + + + + + + Meter Level + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 10 + 0 + + + + + + + + Passband + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 10 + 0 + + + + + + + + Tuning Line + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + + 10 + 0 + + + + + + + + + 10 + 0 + + + + + + + + + 90 + 16777215 + + + + #AARRGGBB + + + + + + + Underlay Fill + + + + + + + + 10 + 0 + + + + + + + + + 10 + 0 + + + +
From bbc2613942a330cbc6af34d0457b501ec0ec1cc6 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Wed, 28 Sep 2022 17:34:15 +0100 Subject: [PATCH 129/207] Fix passband colorswatch --- wfmain.cpp | 8 ++++---- wfmain.ui | 10 +++++----- wfview.vcxproj.user | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index ea97ea2..dc4cdd0 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -1455,7 +1455,7 @@ void wfmain::loadSettings() p->underlayFill.setNamedColor(settings->value("underlayFill", p->underlayFill.name(QColor::HexArgb)).toString()); p->plotBackground.setNamedColor(settings->value("plotBackground", p->plotBackground.name(QColor::HexArgb)).toString()); p->tuningLine.setNamedColor(settings->value("tuningLine", p->tuningLine.name(QColor::HexArgb)).toString()); - p->passband.setNamedColor(settings->value("passband", p->tuningLine.name(QColor::HexArgb)).toString()); + p->passband.setNamedColor(settings->value("passband", p->passband.name(QColor::HexArgb)).toString()); p->wfBackground.setNamedColor(settings->value("wfBackground", p->wfBackground.name(QColor::HexArgb)).toString()); p->wfGrid.setNamedColor(settings->value("wfGrid", p->wfGrid.name(QColor::HexArgb)).toString()); p->wfAxis.setNamedColor(settings->value("wfAxis", p->wfAxis.name(QColor::HexArgb)).toString()); @@ -2764,7 +2764,7 @@ void wfmain::setDefaultColors(int presetNumber) p->underlayLine = QColor("#9633ff55"); p->underlayFill = QColor(20+200/4.0*1,70*(1.6-1/4.0), 150, 150); p->tuningLine = QColor("#ff55ffff"); - p->passband = QColor("#ff55ffcc"); + p->passband = QColor("#2effffff"); p->meterLevel = QColor("#148CD2").darker(); p->meterAverage = QColor("#3FB7CD"); @@ -7063,13 +7063,13 @@ void wfmain::on_colorSetBtnPassband_clicked() { int pos = ui->colorPresetCombo->currentIndex(); QColor* c = &(colorPreset[pos].passband); - setColorButtonOperations(c, ui->colorEditPassband, ui->colorSwatchTuningLine); + setColorButtonOperations(c, ui->colorEditPassband, ui->colorSwatchPassband); } void wfmain::on_colorEditPassband_editingFinished() { int pos = ui->colorPresetCombo->currentIndex(); QColor* c = &(colorPreset[pos].passband); - setColorLineEditOperations(c, ui->colorEditPassband, ui->colorSwatchTuningLine); + setColorLineEditOperations(c, ui->colorEditPassband, ui->colorSwatchPassband); } // Meter Level: diff --git a/wfmain.ui b/wfmain.ui index f935c2b..62de972 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -6,8 +6,8 @@ 0 0 - 1119 - 896 + 1075 + 660 @@ -3343,8 +3343,8 @@ 0 0 - 897 - 547 + 853 + 311 @@ -5007,7 +5007,7 @@ 0 0 - 1119 + 1075 21 diff --git a/wfview.vcxproj.user b/wfview.vcxproj.user index b8cb75f..58abce7 100644 --- a/wfview.vcxproj.user +++ b/wfview.vcxproj.user @@ -7,9 +7,9 @@ PATH=$(QTDIR)\bin%3bC:\QT\5.15.2\MSVC2019\bin%3b$(QTDIR)\bin%3bC:\QT\5.15.2\MSVC2019\bin%3b$(PATH) - 2022-09-26T11:09:20.6823982Z + 2022-09-28T16:29:42.1921277Z - 2022-09-26T11:09:20.9493996Z + 2022-09-28T16:29:42.4500038Z \ No newline at end of file From f7bde0fe649ddd606fabd72d60f4e8ffd706f5fc Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Wed, 28 Sep 2022 17:42:12 +0100 Subject: [PATCH 130/207] Change default passband colors. --- wfmain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index dc4cdd0..5ec88bc 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -2764,7 +2764,7 @@ void wfmain::setDefaultColors(int presetNumber) p->underlayLine = QColor("#9633ff55"); p->underlayFill = QColor(20+200/4.0*1,70*(1.6-1/4.0), 150, 150); p->tuningLine = QColor("#ff55ffff"); - p->passband = QColor("#2effffff"); + p->passband = QColor("#32ffffff"); p->meterLevel = QColor("#148CD2").darker(); p->meterAverage = QColor("#3FB7CD"); @@ -2792,7 +2792,7 @@ void wfmain::setDefaultColors(int presetNumber) p->spectrumLine = QColor(Qt::black); p->underlayLine = QColor(Qt::blue); p->tuningLine = QColor(Qt::darkBlue); - p->passband = QColor(Qt::blue); + p->passband = QColor("#64000080"); p->meterAverage = QColor("#3FB7CD"); p->meterPeakLevel = QColor("#3CA0DB"); From cef827f7f82e28042e1cd9068aa865ec076b4721 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Wed, 28 Sep 2022 17:53:28 +0100 Subject: [PATCH 131/207] Only request passband when there is a scope available --- wfmain.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 5ec88bc..57ae12b 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -3599,8 +3599,10 @@ void wfmain::initPeriodicCommands() } insertSlowPeriodicCommand(cmdGetDuplexMode, 128); - // Get passband - insertPeriodicCommand(cmdGetPassband, 128); + if (rigCaps.hasSpectrum) { + // Get passband + insertPeriodicCommand(cmdGetPassband, 128); + } } void wfmain::insertPeriodicCommand(cmds cmd, unsigned char priority) @@ -5348,8 +5350,6 @@ void wfmain::receivePassband(quint8 pass) calc = 600 + ((pass - 10) * 100); } passBand = (double)(calc / 1000000.0); - - qDebug(logGui()) << "Got Passband" << passBand << "(" << pass << ")"; } void wfmain::receiveMeter(meterKind inMeter, unsigned char level) From dbc13a05335e7599285f4903da53020d3be3cb88 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 29 Sep 2022 17:17:51 +0100 Subject: [PATCH 132/207] Initial work on cluster spots. --- cluster.cpp | 88 ++++++++ cluster.h | 63 ++++++ logcategories.cpp | 1 + logcategories.h | 1 + rigidentities.h | 2 +- wfmain.cpp | 94 ++++++++- wfmain.h | 17 +- wfmain.ui | 147 ++++++++++++- wfview.pro | 4 +- wfview.vcxproj | 455 +++++++++-------------------------------- wfview.vcxproj.filters | 68 +----- wfview.vcxproj.user | 4 +- 12 files changed, 512 insertions(+), 432 deletions(-) create mode 100644 cluster.cpp create mode 100644 cluster.h diff --git a/cluster.cpp b/cluster.cpp new file mode 100644 index 0000000..1cd4a7b --- /dev/null +++ b/cluster.cpp @@ -0,0 +1,88 @@ +#include "cluster.h" +#include "logcategories.h" + + +dxClusterClient::dxClusterClient(QObject* parent): + QObject(parent) +{ + qInfo(logCluster()) << "starting dxClusterClient()"; +} + +dxClusterClient::~dxClusterClient() +{ + qInfo(logCluster()) << "closing dxClusterClient()"; + enableUdp(false); + enableTcp(false); +} + +void dxClusterClient::enableUdp(bool enable) +{ + udpEnable = enable; + if (enable) + { + if (udpSocket == Q_NULLPTR) + { + udpSocket = new QUdpSocket(this); + bool result = udpSocket->bind(QHostAddress::AnyIPv4, udpPort); + qInfo(logCluster()) << "Starting udpSocket() on:" << udpPort << "Result:" << result; + + //udpDataReceived(); + connect(udpSocket, SIGNAL(readyRead()), this, SLOT(udpDataReceived()), Qt::QueuedConnection); + + } + } + else { + if (udpSocket != Q_NULLPTR) + { + udpSocket->disconnect(); + delete udpSocket; + } + } +} + +void dxClusterClient::enableTcp(bool enable) +{ + tcpEnable = enable; +} + +void dxClusterClient::udpDataReceived() +{ + QMutexLocker locker(&udpMutex); // Not sure if this is needed? + + QHostAddress sender; + quint16 port; + QByteArray datagram; + datagram.resize(udpSocket->pendingDatagramSize()); + udpSocket->readDatagram(datagram.data(), datagram.size(), &sender, &port); + + if (udpSpotReader.setContent(datagram)) + { + QDomElement spot = udpSpotReader.firstChildElement("spot"); + if (spot.nodeName() == "spot") + { + // This is a spot? + QString action = spot.firstChildElement("action").text(); + if (action == "add") { + spotData data; + data.dxcall = spot.firstChildElement("dxcall").text(); + data.frequency = spot.firstChildElement("frequency").text().toDouble()/1000.0; + data.spottercall = spot.firstChildElement("spottercall").text(); + data.timestamp = QDateTime::fromString(spot.firstChildElement("timestamp").text()); + data.mode = spot.firstChildElement("mode").text(); + data.comment = spot.firstChildElement("comment").text(); + emit addSpot(data); + qInfo(logCluster()) << "ADD DX=" << data.dxcall << + "SPOTTER=" << data.spottercall << + "FREQ=" << data.frequency << + "MODE=" << data.mode; + } + else if (action == "delete") + { + QString dxcall = spot.firstChildElement("dxcall").text(); + emit deleteSpot(dxcall); + qInfo(logCluster()) << "DELETE DX=" << dxcall; + } + } + } +} + diff --git a/cluster.h b/cluster.h new file mode 100644 index 0000000..45b83ad --- /dev/null +++ b/cluster.h @@ -0,0 +1,63 @@ +#ifndef CLUSTER_H +#define CLUSTER_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct spotData { + QString dxcall; + double frequency; + QString spottercall; + QDateTime timestamp; + QString mode; + QString comment; + QCPItemText* text = Q_NULLPTR; +}; + + +class dxClusterClient : public QObject +{ + Q_OBJECT + +public: + explicit dxClusterClient(QObject* parent = nullptr); + virtual ~dxClusterClient(); + +signals: + void addSpot(spotData spot); + void deleteSpot(QString dxcall); + void deleteOldSpots(int minutes); + +public slots: + void udpDataReceived(); + void enableUdp(bool enable); + void enableTcp(bool enable); + void setUdpPort(int p) { udpPort = p; } + void setTcpServerName(QString s) { tcpServerName = s; } + void setTcpUserName(QString s) { tcpUserName = s; } + void setTcpPassword(QString s) { tcpPassword = s; } + +private: + bool udpEnable; + bool tcpEnable; + QUdpSocket* udpSocket=Q_NULLPTR; + QTcpSocket* tcpSocket=Q_NULLPTR; + int udpPort; + QString tcpServerName; + QString tcpUserName; + QString tcpPassword; + QDomDocument udpSpotReader; + QXmlInputSource udpXmlSource; + QMutex udpMutex; +}; + +#endif diff --git a/logcategories.cpp b/logcategories.cpp index c5a7bdc..88c854e 100644 --- a/logcategories.cpp +++ b/logcategories.cpp @@ -12,3 +12,4 @@ Q_LOGGING_CATEGORY(logUdpServer, "udp.server") Q_LOGGING_CATEGORY(logRigCtlD, "rigctld") Q_LOGGING_CATEGORY(logTcpServer, "tcpserver") Q_LOGGING_CATEGORY(logAudioConverter, "audioconverter") +Q_LOGGING_CATEGORY(logCluster, "cluster") diff --git a/logcategories.h b/logcategories.h index 3fbfae3..7265ef9 100644 --- a/logcategories.h +++ b/logcategories.h @@ -15,6 +15,7 @@ Q_DECLARE_LOGGING_CATEGORY(logUdpServer) Q_DECLARE_LOGGING_CATEGORY(logRigCtlD) Q_DECLARE_LOGGING_CATEGORY(logTcpServer) Q_DECLARE_LOGGING_CATEGORY(logAudioConverter) +Q_DECLARE_LOGGING_CATEGORY(logCluster) #if defined(Q_OS_WIN) && !defined(__PRETTY_FUNCTION__) diff --git a/rigidentities.h b/rigidentities.h index d238a08..d4c4209 100644 --- a/rigidentities.h +++ b/rigidentities.h @@ -106,7 +106,7 @@ struct rigCapabilities { QVector inputs; - bool hasSpectrum; + bool hasSpectrum=true; quint8 spectSeqMax; quint16 spectAmpMax; quint16 spectLenMax; diff --git a/wfmain.cpp b/wfmain.cpp index 57ae12b..9718809 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -71,6 +71,7 @@ wfmain::wfmain(const QString settingsFile, const QString logFile, bool debugMode qRegisterMetaType>(); qRegisterMetaType(); qRegisterMetaType(); + qRegisterMetaType(); haveRigCaps = false; @@ -109,6 +110,22 @@ wfmain::wfmain(const QString settingsFile, const QString logFile, bool debugMode rigConnections(); + cluster = new dxClusterClient(); + + clusterThread = new QThread(this); + + cluster->moveToThread(clusterThread); + + + connect(this, SIGNAL(setClusterEnableUdp(bool)), cluster, SLOT(enableUdp(bool))); + connect(this, SIGNAL(setClusterUdpPort(int)), cluster, SLOT(setUdpPort(int))); + connect(cluster, SIGNAL(addSpot(spotData)), this, SLOT(addClusterSpot(spotData))); + connect(cluster, SIGNAL(deleteSpot(QString)), this, SLOT(deleteClusterSpot(QString))); + connect(clusterThread, SIGNAL(finished()), cluster, SLOT(deleteLater())); + clusterThread->start(); + + emit setClusterUdpPort(12060); + emit setClusterEnableUdp(true); setServerToPrefs(); @@ -128,6 +145,10 @@ wfmain::~wfmain() serverThread->quit(); serverThread->wait(); } + if (clusterThread != Q_NULLPTR) { + clusterThread->quit(); + clusterThread->wait(); + } if (rigCtl != Q_NULLPTR) { delete rigCtl; } @@ -235,8 +256,9 @@ void wfmain::createSettingsListItems() ui->settingsList->addItem("Radio Settings"); // 2 ui->settingsList->addItem("Radio Server"); // 3 ui->settingsList->addItem("External Control"); // 4 - ui->settingsList->addItem("Experimental"); // 5 - //ui->settingsList->addItem("Audio Processing"); // 6 + ui->settingsList->addItem("DX Cluster"); // 5 + ui->settingsList->addItem("Experimental"); // 6 + //ui->settingsList->addItem("Audio Processing"); // 7 ui->settingsStack->setCurrentIndex(0); } @@ -688,6 +710,14 @@ void wfmain::setupPlots() freqIndicatorLine->setAntialiased(true); freqIndicatorLine->setPen(QPen(Qt::blue)); + /* + text = new QCPItemText(plot); + text->setAntialiased(true); + text->setColor(QColor(Qt::red)); + text->setText("TEST"); + text->position->setCoords(14.195, rigCaps.spectAmpMax); + text->setFont(QFont(font().family(), 12)); + */ ui->plot->addGraph(); // primary ui->plot->addGraph(0, 0); // secondary, peaks, same axis as first. @@ -3775,8 +3805,8 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e plot->graph(0)->setData(x,y, true); if((freq.MHzDouble < endFreq) && (freq.MHzDouble > startFreq)) { - freqIndicatorLine->start->setCoords(freq.MHzDouble,0); - freqIndicatorLine->end->setCoords(freq.MHzDouble,rigCaps.spectAmpMax); + freqIndicatorLine->start->setCoords(freq.MHzDouble, 0); + freqIndicatorLine->end->setCoords(freq.MHzDouble, rigCaps.spectAmpMax); if (currentModeInfo.mk == modeLSB || currentModeInfo.mk == modePSK_R) { passbandIndicator->topLeft->setCoords(freq.MHzDouble - passBand - 0.0001, 0); @@ -7353,3 +7383,59 @@ errMsg: } + + +void wfmain::clusterCheck() { + +} + +void wfmain::addClusterSpot(spotData spot) { + + spot.text = new QCPItemText(plot); + spot.text->setAntialiased(true); + spot.text->setColor(QColor(Qt::red)); + spot.text->setText(spot.dxcall); + spot.text->setFont(QFont(font().family(), 10)); + spot.text->setPositionAlignment(Qt::AlignTop | Qt::AlignHCenter); + spot.text->setClipAxisRect(false); + spot.text->position->setType(QCPItemPosition::ptPlotCoords); + bool conflict = true; + QCPAxisRect* rect = spot.text->position->axisRect(); + double left = spot.frequency; + double top = rigCaps.spectAmpMax - 50.0; + + /* + while (conflict) { + QCPItemText* textItem = plot->itemAt(QPointF(left,top)); + if (textItem != Q_NULLPTR) { + qInfo(logGui()) << "Found conflicting spot"; + if (top > 20.0) { + top = top - 20.0; + } + else { + top = rigCaps.spectAmpMax - 50.0; + left = left + 0.2; + } + } + else { + conflict = false; + } + } + */ + spot.text->position->setCoords(left, top); + + //QList col_it = spot.text->item(Qt::IntersectsItemBoundingRect); + clusterSpots.insert(spot.dxcall, &spot); + qInfo(logGui()) << "Number of cluster spots" << clusterSpots.size(); +} + +void wfmain::deleteClusterSpot(QString dxcall) { + QMap::iterator spot = clusterSpots.find(dxcall); + while (spot != clusterSpots.end() && spot.key() == dxcall) { + if (spot.value()->text != Q_NULLPTR) + { + plot->removeItem(spot.value()->text); + } + spot = clusterSpots.erase(spot); + } +} \ No newline at end of file diff --git a/wfmain.h b/wfmain.h index 5dd239b..134f9cc 100644 --- a/wfmain.h +++ b/wfmain.h @@ -39,6 +39,7 @@ #include "selectradio.h" #include "colorprefs.h" #include "loggingwindow.h" +#include "cluster.h" #include #include @@ -188,8 +189,13 @@ signals: void sendRigCaps(rigCapabilities caps); void requestRigState(); void stateUpdated(); + void setClusterUdpPort(int port); + void setClusterEnableUdp(bool udp); + void setClusterEnableTcp(bool tcp); private slots: + void addClusterSpot(spotData spot); + void deleteClusterSpot(QString dxcall); void updateSizes(int tabIndex); void shortcutF1(); void shortcutF2(); @@ -652,6 +658,8 @@ private slots: void on_customEdgeBtn_clicked(); + void clusterCheck(); + private: Ui::wfmain *ui; void closeEvent(QCloseEvent *event); @@ -1011,7 +1019,7 @@ private: udpServer* udp = Q_NULLPTR; rigCtlD* rigCtl = Q_NULLPTR; QThread* serverThread = Q_NULLPTR; - + void bandStackBtnClick(); bool waitingForBandStackRtn; char bandStkBand; @@ -1039,6 +1047,12 @@ private: SERVERCONFIG serverConfig; void serverAddUserLine(const QString& user, const QString& pass, const int& type); + dxClusterClient* cluster = Q_NULLPTR; + QThread* clusterThread = Q_NULLPTR; + QMap clusterSpots; + QTimer clusterTimer; + QCPItemText* text=Q_NULLPTR; + }; Q_DECLARE_METATYPE(struct rigCapabilities) @@ -1052,6 +1066,7 @@ Q_DECLARE_METATYPE(struct timekind) Q_DECLARE_METATYPE(struct datekind) Q_DECLARE_METATYPE(struct networkStatus) Q_DECLARE_METATYPE(struct networkAudioLevels) +Q_DECLARE_METATYPE(struct spotData) Q_DECLARE_METATYPE(enum rigInput) Q_DECLARE_METATYPE(enum meterKind) Q_DECLARE_METATYPE(enum spectrumMode) diff --git a/wfmain.ui b/wfmain.ui index 62de972..3effdd7 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -2223,7 +2223,7 @@ - 1 + 5 @@ -3343,8 +3343,8 @@ 0 0 - 853 - 311 + 542 + 217 @@ -4845,6 +4845,141 @@ + + + true + + + + + 0 + 10 + 831 + 21 + + + + + + + This page contains configuration for DX Cluster, either UDP style broadcast (from N1MM+/DXlog) or TCP connection to your favourite cluster + + + + + + + + + 10 + 50 + 201 + 181 + + + + UDP Broadcast Connection + + + + + 20 + 40 + 161 + 121 + + + + + + + UDP Port + + + + + + + 00000 + + + + + + + Enable + + + + + + + + + + 330 + 50 + 241 + 181 + + + + TCP Cluster Connection + + + + + 20 + 40 + 201 + 121 + + + + + + + Server Name + + + + + + + + + + Username + + + + + + + + + + Password + + + + + + + + + + Enable + + + + + + + groupBox_9 + horizontalLayoutWidget + groupBox_10 + @@ -4903,7 +5038,11 @@ - + + + true + + diff --git a/wfview.pro b/wfview.pro index fdf1b11..3f1247b 100644 --- a/wfview.pro +++ b/wfview.pro @@ -4,7 +4,7 @@ # #------------------------------------------------- -QT += core gui serialport network multimedia +QT += core gui serialport network multimedia xml greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport @@ -174,6 +174,7 @@ SOURCES += main.cpp\ transceiveradjustments.cpp \ selectradio.cpp \ tcpserver.cpp \ + cluster.cpp \ aboutbox.cpp HEADERS += wfmain.h \ @@ -210,6 +211,7 @@ HEADERS += wfmain.h \ audiotaper.h \ selectradio.h \ tcpserver.h \ + cluster.h \ aboutbox.h diff --git a/wfview.vcxproj b/wfview.vcxproj index 69b22ec..c1cebb0 100644 --- a/wfview.vcxproj +++ b/wfview.vcxproj @@ -16,7 +16,8 @@ QtVS_v304 10.0.19041.0 10.0.19041.0 - $(MSBuildProjectDirectory)\QtMsBuild + $(MSBuildProjectDirectory)\QtMsBuild + v142 @@ -36,7 +37,10 @@ debug\ wfview - + + + + @@ -44,8 +48,34 @@ - wfview-debug\debug\wfviewtruewfview-release\release\wfviewtruefalsemsvc2019core;network;gui;multimedia;widgets;serialport;printsupportmsvc2019core;network;gui;multimedia;widgets;serialport;printsupport - + + + + + + wfview-debug\ + debug\ + wfview + true + + + wfview-release\ + release\ + wfview + true + false + + + msvc2019 + core;xml;network;gui;multimedia;widgets;serialport;printsupport + + + msvc2019 + core;xml;network;gui;multimedia;widgets;serialport;printsupport;xml + + + + .;..\rtaudio;..\portaudio\include;..\qcustomplot;..\opus\include;..\eigen;..\r8brain-free-src;resampler;release;/include;%(AdditionalIncludeDirectories) @@ -57,14 +87,16 @@ Sync release\ MaxSpeed - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION="1.45";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX="/usr/local";GITSHORT="8638086";HOST="wfview.org";UNAME="build";NDEBUG;QT_NO_DEBUG;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION="1.50";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX="/usr/local";GITSHORT="cef827f";HOST="wfview.org";UNAME="build";NDEBUG;QT_NO_DEBUG;%(PreprocessorDefinitions) false - + + MultiThreadedDLL true true Level3 - true + true + ..\portaudio\msvc\Win32\Release\portaudio_x86.lib;ole32.lib;..\opus\win32\VS2015\Win32\Release\opus.lib;shell32.lib;%(AdditionalDependencies) ..\portaudio\msvc\Win32\Release;..\opus\win32\VS2015\Win32\Release;C:\opensslx86\lib;C:\Utils\my_sql\mysql-5.7.25-win32\lib;C:\Utils\postgresqlx86\pgsql\lib;%(AdditionalLibraryDirectories) @@ -85,9 +117,28 @@ 0 - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.45\";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX=\"/usr/local\";GITSHORT=\"8638086\";HOST=\"wfview.org\";UNAME=\"build\";NDEBUG;QT_NO_DEBUG;QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.50\";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX=\"/usr/local\";GITSHORT=\"cef827f\";HOST=\"wfview.org\";UNAME=\"build\";NDEBUG;QT_NO_DEBUG;QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_XML_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) - msvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cppdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cppUic'ing %(Identity)...$(ProjectDir)ui_%(Filename).h + + msvc + ./$(Configuration)/moc_predefs.h + Moc'ing %(Identity)... + output + $(Configuration) + moc_%(Filename).cpp + + + default + Rcc'ing %(Identity)... + $(Configuration) + qrc_%(Filename).cpp + + + Uic'ing %(Identity)... + $(ProjectDir) + ui_%(Filename).h + + .;..\rtaudio;..\portaudio\include;..\qcustomplot;..\opus\include;..\eigen;..\r8brain-free-src;resampler;debug;/include;%(AdditionalIncludeDirectories) @@ -99,13 +150,14 @@ Sync debug\ Disabled - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION="1.45";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX="/usr/local";GITSHORT="8638086";HOST="wfview.org";UNAME="build";%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION="1.50";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX="/usr/local";GITSHORT="cef827f";HOST="wfview.org";UNAME="build";%(PreprocessorDefinitions) false MultiThreadedDebugDLL true true Level3 - true + true + ..\portaudio\msvc\Win32\Debug\portaudio_x86.lib;ole32.lib;..\opus\win32\VS2015\Win32\Debug\opus.lib;shell32.lib;%(AdditionalDependencies) ..\portaudio\msvc\Win32\Debug;..\opus\win32\VS2015\Win32\Debug;C:\opensslx86\lib;C:\Utils\my_sql\mysql-5.7.25-win32\lib;C:\Utils\postgresqlx86\pgsql\lib;%(AdditionalLibraryDirectories) @@ -124,15 +176,35 @@ 0 - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.45\";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX=\"/usr/local\";GITSHORT=\"8638086\";HOST=\"wfview.org\";UNAME=\"build\";QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.50\";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX=\"/usr/local\";GITSHORT=\"cef827f\";HOST=\"wfview.org\";UNAME=\"build\";QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_XML_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) - msvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cppdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cppUic'ing %(Identity)...$(ProjectDir)ui_%(Filename).h + + msvc + ./$(Configuration)/moc_predefs.h + Moc'ing %(Identity)... + output + $(Configuration) + moc_%(Filename).cpp + + + default + Rcc'ing %(Identity)... + $(Configuration) + qrc_%(Filename).cpp + + + Uic'ing %(Identity)... + $(ProjectDir) + ui_%(Filename).h + + + @@ -163,275 +235,69 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Document true @@ -448,139 +314,23 @@ release\moc_predefs.h;%(Outputs) true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -614,30 +364,16 @@ - - - - - - - - - - resourcesresources + resources + resources + - - - - - - - - - - stylestyle + style + style + @@ -651,6 +387,9 @@ - + + + + \ No newline at end of file diff --git a/wfview.vcxproj.filters b/wfview.vcxproj.filters index 52a8284..e12f9bb 100644 --- a/wfview.vcxproj.filters +++ b/wfview.vcxproj.filters @@ -62,6 +62,9 @@ Source Files + + Source Files + Source Files @@ -163,6 +166,9 @@ Header Files + + Header Files + Header Files @@ -255,72 +261,12 @@ - - - - - - - - - - - - - - - - Generated Files Generated Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -480,6 +426,6 @@ - + \ No newline at end of file diff --git a/wfview.vcxproj.user b/wfview.vcxproj.user index 58abce7..c43779f 100644 --- a/wfview.vcxproj.user +++ b/wfview.vcxproj.user @@ -7,9 +7,9 @@ PATH=$(QTDIR)\bin%3bC:\QT\5.15.2\MSVC2019\bin%3b$(QTDIR)\bin%3bC:\QT\5.15.2\MSVC2019\bin%3b$(PATH) - 2022-09-28T16:29:42.1921277Z + 2022-09-28T20:42:59.6856379Z - 2022-09-28T16:29:42.4500038Z + 2022-09-28T20:43:18.7088049Z \ No newline at end of file From e7e7821f2b77cc59d6589f54eb42f661ea8ed6fe Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 29 Sep 2022 17:18:48 +0100 Subject: [PATCH 133/207] Comment out some unused variables --- wfmain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 9718809..d9e397a 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -7399,8 +7399,8 @@ void wfmain::addClusterSpot(spotData spot) { spot.text->setPositionAlignment(Qt::AlignTop | Qt::AlignHCenter); spot.text->setClipAxisRect(false); spot.text->position->setType(QCPItemPosition::ptPlotCoords); - bool conflict = true; - QCPAxisRect* rect = spot.text->position->axisRect(); + //bool conflict = true; + //QCPAxisRect* rect = spot.text->position->axisRect(); double left = spot.frequency; double top = rigCaps.spectAmpMax - 50.0; From f48e65d1476ae20c2a714cd93ea0e7beb0c17fc3 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 29 Sep 2022 17:22:14 +0100 Subject: [PATCH 134/207] Fix for squished screen and bump version to 1.51 --- rigidentities.h | 2 +- wfserver.pro | 2 +- wfview.pro | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rigidentities.h b/rigidentities.h index d238a08..d4c4209 100644 --- a/rigidentities.h +++ b/rigidentities.h @@ -106,7 +106,7 @@ struct rigCapabilities { QVector inputs; - bool hasSpectrum; + bool hasSpectrum=true; quint8 spectSeqMax; quint16 spectAmpMax; quint16 spectLenMax; diff --git a/wfserver.pro b/wfserver.pro index 695e502..3b5e4c6 100644 --- a/wfserver.pro +++ b/wfserver.pro @@ -13,7 +13,7 @@ TEMPLATE = app CONFIG += console -DEFINES += WFVIEW_VERSION=\\\"1.50\\\" +DEFINES += WFVIEW_VERSION=\\\"1.51\\\" DEFINES += BUILD_WFSERVER diff --git a/wfview.pro b/wfview.pro index fdf1b11..33bc2c2 100644 --- a/wfview.pro +++ b/wfview.pro @@ -11,7 +11,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport TARGET = wfview TEMPLATE = app -DEFINES += WFVIEW_VERSION=\\\"1.50\\\" +DEFINES += WFVIEW_VERSION=\\\"1.51\\\" DEFINES += BUILD_WFVIEW From d5aeec61baf6f871a2218d8670f9c8eb8b763c3d Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Thu, 29 Sep 2022 18:45:13 +0200 Subject: [PATCH 135/207] v1.51 with fixes,passband stuff --- CHANGELOG | 48 ++++++++++++++++++++++++++++++++++++++++ WHATSNEW | 66 ++++++++++++++++--------------------------------------- 2 files changed, 67 insertions(+), 47 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index d885b31..1c53008 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,53 @@ # CHANGELOG +- 20220929 + + Fix for squished screen + + bump version to 1.51 + + +- 20220928 + + Only request passband when there is a scope available + + Change default passband colors. + + Fix passband colorswatch + +- 20220927 + + See if this works better for color pickers? + + Ignore second VFO scope data (for now) + + Silently ignore server audio issues if server is not enabled. + + Always use 8bit encoding for audio device names + + Make multimedia-plugins message only for Linux + +- 20220926 + + Add PSK modes to IC-7610 and to passband. + + Add passband for FM mode + + Added click-drag tuning. Needs refinement but it's a start. + + colorpicker: Move to 3 columns + + First look at a passband indicator + +- 20220925 + + Remove obsolete code + + Remove logging of audio device realm + +- 20220923 + + ready for v1.50 - 20220923 diff --git a/WHATSNEW b/WHATSNEW index 44bd95f..f7f88e9 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -1,52 +1,24 @@ -The following highlights are in this 1.41-release: +The following highlights are in this 1.51-release ince v1.50: - New major change is the audio transport mechanism. Lower latencies. - About box updated to include Patreon site - added 500 Hz step for VFO - Added clock and UTC toggle. - Added forced manual RTS setting - Add RIT function and other rigctl fixes - Adjusted window size for radios without spectrum. Thanks K5TUX. - Allow dynamic restarting of server - New Settings tab - Enable High DPI Scaling - More multi-radio support (mostly working!) - Split LAN waterfall data for N1MM+ Spectrum Scope support: There is a combobox that allows you to select - split/combine (or default). Split only makes sense for LAN and Combine for USB. - added radio status display with meters for audio (speaker/mic) - selector for audio: QT, PortAudio, RealTime audio - version bumped to 1.4 -- rethinking of a new version schema that makes more sense - temporary squashed logs; may redo later - audio fixes at exit - introduction of peak decays at the scope - resizing of top and bottom scope/waterfall - various fixes on the spectrum display -+ 1.41 added color picker support for all kinds of vsual elements -+ 1.42 added three additional second meter choices. RxAudio, TxAdio, and TxRxAudio -+ 1.43 fixed resizing issues. -+ 1.44 added logging window. you can send the logs to termbin.com and share the link on the forum -+ 1.45 some more log enhancements - moved connect button and added cancel option - add enable/disable audioSystemServerCombo - Fixed bug where the frequency dial skipped extra when crossing zero. -+ 1.46 Added controls for custom scope edges, hide/show scope controls - depending upon the scope mode the radio reports. - Fixed clear peaks button to work with the plasma underlay. - both audio system button are disabled when connected to radio and enabled when not. - Remove password from log - Fix server user handling -+ 1.47 Added dialog box to the toFixed button where an edge can be selected. - Fix that was stopping users being created when none existed - compound fmv command (rigctl(d)) added -+ 1.48 Fixed glitch when tabs are changed prior to rigcaps. - Additional resize fixes for non-spectrum rigs. - Hide UI elements not needed for non-spectrum radios. - Fix that was stopping users being created when none existed - Use date/time for log name if none specified - Fix logfile/directory opening in Windows - Remove redundant CL args - Delete quit confirmation checkbox ++ 1.51 + + + + Fix for squished screen + Only request passband when there is a scope available + Change default passband colors. + Fix passband colorswatch + Ignore second VFO scope data (for now) + Silently ignore server audio issues if server is not enabled. + Always use 8bit encoding for audio device names + Make multimedia-plugins message only for Linux + Add PSK modes to IC-7610 and to passband. + Add passband for FM mode + Added click-drag tuning. Needs refinement but it's a start. + colorpicker: Move to 3 columns + passband indicator + Remove logging of audio device realm Notes: From 7d141608bf7b4603e489cbe33d9f17d20b72a363 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 30 Sep 2022 17:05:42 +0100 Subject: [PATCH 136/207] Add TCP spot client --- cluster.cpp | 112 ++++++++++++++++--- cluster.h | 29 ++++- wfmain.cpp | 305 +++++++++++++++++++++++++++++++++++++++++++++------- wfmain.h | 31 +++++- wfmain.ui | 93 +++++++++++++--- 5 files changed, 492 insertions(+), 78 deletions(-) diff --git a/cluster.cpp b/cluster.cpp index 1cd4a7b..01c2f07 100644 --- a/cluster.cpp +++ b/cluster.cpp @@ -26,7 +26,6 @@ void dxClusterClient::enableUdp(bool enable) bool result = udpSocket->bind(QHostAddress::AnyIPv4, udpPort); qInfo(logCluster()) << "Starting udpSocket() on:" << udpPort << "Result:" << result; - //udpDataReceived(); connect(udpSocket, SIGNAL(readyRead()), this, SLOT(udpDataReceived()), Qt::QueuedConnection); } @@ -34,8 +33,11 @@ void dxClusterClient::enableUdp(bool enable) else { if (udpSocket != Q_NULLPTR) { + qInfo(logCluster()) << "Stopping udpSocket() on:" << udpPort; + udpSocket->disconnect(); delete udpSocket; + udpSocket = Q_NULLPTR; } } } @@ -43,12 +45,43 @@ void dxClusterClient::enableUdp(bool enable) void dxClusterClient::enableTcp(bool enable) { tcpEnable = enable; + if (enable) + { + tcpRegex = QRegularExpression("^DX de ([a-z|A-Z|0-9|/]+):\\s+([0-9|.]+)\\s+([a-z|A-Z|0-9|/]+)+\\s+(.*)\\s+(\\d{4}Z)"); + + if (tcpSocket == Q_NULLPTR) + { + tcpSocket = new QTcpSocket(this); + tcpSocket->connectToHost(tcpServerName, tcpPort); + qInfo(logCluster()) << "Starting tcpSocket() on:" << tcpPort; + + connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(tcpDataReceived()), Qt::QueuedConnection); + + tcpCleanupTimer = new QTimer(this); + tcpCleanupTimer->setInterval(1000 * 10); // Run once a minute + connect(tcpCleanupTimer, SIGNAL(timeout()), this, SLOT(tcpCleanup())); + tcpCleanupTimer->start(); + } + } + else { + if (tcpSocket != Q_NULLPTR) + { + qInfo(logCluster()) << "Disconnecting tcpSocket() on:" << tcpPort; + if (tcpCleanupTimer != Q_NULLPTR) + { + tcpCleanupTimer->stop(); + delete tcpCleanupTimer; + tcpCleanupTimer = Q_NULLPTR; + } + tcpSocket->disconnect(); + delete tcpSocket; + tcpSocket = Q_NULLPTR; + } + } } void dxClusterClient::udpDataReceived() { - QMutexLocker locker(&udpMutex); // Not sure if this is needed? - QHostAddress sender; quint16 port; QByteArray datagram; @@ -63,18 +96,17 @@ void dxClusterClient::udpDataReceived() // This is a spot? QString action = spot.firstChildElement("action").text(); if (action == "add") { - spotData data; - data.dxcall = spot.firstChildElement("dxcall").text(); - data.frequency = spot.firstChildElement("frequency").text().toDouble()/1000.0; - data.spottercall = spot.firstChildElement("spottercall").text(); - data.timestamp = QDateTime::fromString(spot.firstChildElement("timestamp").text()); - data.mode = spot.firstChildElement("mode").text(); - data.comment = spot.firstChildElement("comment").text(); + spotData* data = new spotData(); + data->dxcall = spot.firstChildElement("dxcall").text(); + data->frequency = spot.firstChildElement("frequency").text().toDouble() / 1000.0; + data->spottercall = spot.firstChildElement("spottercall").text(); + data->timestamp = QDateTime::fromString(spot.firstChildElement("timestamp").text(),"yyyy-MM-dd hh:mm:ss"); + data->mode = spot.firstChildElement("mode").text(); + data->comment = spot.firstChildElement("comment").text(); emit addSpot(data); - qInfo(logCluster()) << "ADD DX=" << data.dxcall << - "SPOTTER=" << data.spottercall << - "FREQ=" << data.frequency << - "MODE=" << data.mode; + emit(sendOutput(QString("UDP: SPOT:%1 SPOTTER:%2 FREQ:%3 MODE:%4 DATE:%5 COMMENT:%6\n") + .arg(data->dxcall).arg(data->spottercall).arg(data->frequency).arg(data->mode) + .arg(data->timestamp.toString()).arg(data->comment))); } else if (action == "delete") { @@ -86,3 +118,55 @@ void dxClusterClient::udpDataReceived() } } + +void dxClusterClient::tcpDataReceived() +{ + QString data = QString(tcpSocket->readAll()); + emit(sendOutput(data)); + + if (data.contains("login:")) { + sendTcpData(QString("%1\n").arg(tcpUserName)); + return; + } + if (data.contains("password:")) { + sendTcpData(QString("%1\n").arg(tcpPassword)); + return; + } + + QRegularExpressionMatchIterator i = tcpRegex.globalMatch(data); + while (i.hasNext()) { + QRegularExpressionMatch match = i.next(); + if (match.hasMatch()) { + spotData* data = new spotData(); + data->spottercall = match.captured(1); + data->frequency = match.captured(2).toFloat() / 1000.0; + data->dxcall = match.captured(3); + data->comment = match.captured(4).trimmed(); + data->timestamp = QDateTime::currentDateTimeUtc(); + //data.timestamp = QDateTime::fromString(match.captured(5), "hhmmZ"); + emit addSpot(data); + emit(sendOutput(QString("TCP: SPOT:%1 SPOTTER:%2 FREQ:%3 MODE:%4 DATE:%5 COMMENT:%6\n") + .arg(data->dxcall).arg(data->spottercall).arg(data->frequency).arg(data->mode) + .arg(data->timestamp.toString()).arg(data->comment))); + } + } +} + + +void dxClusterClient::sendTcpData(QString data) +{ + qInfo(logCluster()) << "Sending:" << data; + if (tcpSocket != Q_NULLPTR && tcpSocket->isValid() && tcpSocket->isOpen()) + { + tcpSocket->write(data.toLatin1()); + } + else + { + qInfo(logCluster()) << "socket not open!"; + } +} + +void dxClusterClient::tcpCleanup() +{ + emit deleteOldSpots(tcpTimeout); +} \ No newline at end of file diff --git a/cluster.h b/cluster.h index 45b83ad..44e7ec8 100644 --- a/cluster.h +++ b/cluster.h @@ -5,12 +5,12 @@ #include #include #include -#include -#include #include #include #include #include +#include +#include #include struct spotData { @@ -23,6 +23,14 @@ struct spotData { QCPItemText* text = Q_NULLPTR; }; +struct clusterSettings { + QString server; + int port; + QString userName; + QString password; + int timeout=30; + bool default; +}; class dxClusterClient : public QObject { @@ -33,31 +41,42 @@ public: virtual ~dxClusterClient(); signals: - void addSpot(spotData spot); + void addSpot(spotData* spot); void deleteSpot(QString dxcall); void deleteOldSpots(int minutes); + void sendOutput(QString text); public slots: void udpDataReceived(); + void tcpDataReceived(); void enableUdp(bool enable); void enableTcp(bool enable); void setUdpPort(int p) { udpPort = p; } void setTcpServerName(QString s) { tcpServerName = s; } + void setTcpPort(int p) { tcpPort = p; } void setTcpUserName(QString s) { tcpUserName = s; } void setTcpPassword(QString s) { tcpPassword = s; } + void setTcpTimeout(int p) { tcpTimeout = p; } + void tcpCleanup(); private: + void sendTcpData(QString data); + bool udpEnable; bool tcpEnable; QUdpSocket* udpSocket=Q_NULLPTR; QTcpSocket* tcpSocket=Q_NULLPTR; int udpPort; QString tcpServerName; + int tcpPort; QString tcpUserName; QString tcpPassword; + int tcpTimeout; QDomDocument udpSpotReader; - QXmlInputSource udpXmlSource; - QMutex udpMutex; + QRegularExpression tcpRegex; + QMutex mutex; + bool authenticated=false; + QTimer* tcpCleanupTimer=Q_NULLPTR; }; #endif diff --git a/wfmain.cpp b/wfmain.cpp index d9e397a..4be0771 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -113,19 +113,43 @@ wfmain::wfmain(const QString settingsFile, const QString logFile, bool debugMode cluster = new dxClusterClient(); clusterThread = new QThread(this); + clusterThread->setObjectName("dxcluster()"); cluster->moveToThread(clusterThread); - connect(this, SIGNAL(setClusterEnableUdp(bool)), cluster, SLOT(enableUdp(bool))); + connect(this, SIGNAL(setClusterEnableTcp(bool)), cluster, SLOT(enableTcp(bool))); connect(this, SIGNAL(setClusterUdpPort(int)), cluster, SLOT(setUdpPort(int))); - connect(cluster, SIGNAL(addSpot(spotData)), this, SLOT(addClusterSpot(spotData))); + connect(this, SIGNAL(setClusterServerName(QString)), cluster, SLOT(setTcpServerName(QString))); + connect(this, SIGNAL(setClusterTcpPort(int)), cluster, SLOT(setTcpPort(int))); + connect(this, SIGNAL(setClusterUserName(QString)), cluster, SLOT(setTcpUserName(QString))); + connect(this, SIGNAL(setClusterPassword(QString)), cluster, SLOT(setTcpPassword(QString))); + connect(this, SIGNAL(setClusterTimeout(int)), cluster, SLOT(setTcpTimeout(int))); + + connect(cluster, SIGNAL(addSpot(spotData*)), this, SLOT(addClusterSpot(spotData*))); connect(cluster, SIGNAL(deleteSpot(QString)), this, SLOT(deleteClusterSpot(QString))); + connect(cluster, SIGNAL(deleteOldSpots(int)), this, SLOT(deleteOldClusterSpots(int))); + connect(cluster, SIGNAL(sendOutput(QString)), this, SLOT(receiveClusterOutput(QString))); + connect(clusterThread, SIGNAL(finished()), cluster, SLOT(deleteLater())); + clusterThread->start(); - emit setClusterUdpPort(12060); - emit setClusterEnableUdp(true); + emit setClusterUdpPort(prefs.clusterUdpPort); + emit setClusterEnableUdp(prefs.clusterUdpEnable); + + for (int f = 0; f < clusters.size(); f++) + { + if (clusters[f].default) + { + emit setClusterServerName(clusters[f].server); + emit setClusterTcpPort(clusters[f].port); + emit setClusterUserName(clusters[f].userName); + emit setClusterPassword(clusters[f].password); + emit setClusterTimeout(clusters[f].timeout); + } + } + emit setClusterEnableTcp(prefs.clusterTcpEnable); setServerToPrefs(); @@ -1821,6 +1845,66 @@ void wfmain::loadSettings() settings->endArray(); settings->endGroup(); + settings->beginGroup("Cluster"); + + prefs.clusterUdpEnable = settings->value("UdpEnabled", false).toBool(); + prefs.clusterTcpEnable = settings->value("TcpEnabled", false).toBool(); + prefs.clusterUdpPort = settings->value("UdpPort", 12060).toInt(); + ui->clusterUdpPortLineEdit->setText(QString::number(prefs.clusterUdpPort)); + ui->clusterUdpEnable->setChecked(prefs.clusterUdpEnable); + ui->clusterTcpEnable->setChecked(prefs.clusterTcpEnable); + + int numClusters = settings->beginReadArray("Servers"); + clusters.clear(); + if (numClusters > 0) { + { + for (int f = 0; f < numClusters; f++) + { + settings->setArrayIndex(f); + clusterSettings c; + c.server = settings->value("ServerName", "").toString(); + c.port = settings->value("Port", 7300).toInt(); + c.userName = settings->value("UserName", "").toString(); + c.password = settings->value("Password", "").toString(); + c.timeout = settings->value("Timeout", 0).toInt(); + c.default = settings->value("Default", false).toBool(); + if (!c.server.isEmpty()) { + clusters.append(c); + } + } + int defaultCluster = 0; + ui->clusterServerNameCombo->blockSignals(true); + + for (int f = 0; f < clusters.size(); f++) + { + ui->clusterServerNameCombo->addItem(clusters[f].server); + if (clusters[f].default) { + defaultCluster = f; + } + } + ui->clusterServerNameCombo->blockSignals(false); + + if (clusters.size() > defaultCluster) + { + ui->clusterServerNameCombo->setCurrentIndex(defaultCluster); + ui->clusterTcpPortLineEdit->blockSignals(true); + ui->clusterUsernameLineEdit->blockSignals(true); + ui->clusterPasswordLineEdit->blockSignals(true); + ui->clusterTimeoutLineEdit->blockSignals(true); + ui->clusterTcpPortLineEdit->setText(QString::number(clusters[defaultCluster].port)); + ui->clusterUsernameLineEdit->setText(clusters[defaultCluster].userName); + ui->clusterPasswordLineEdit->setText(clusters[defaultCluster].password); + ui->clusterTimeoutLineEdit->setText(QString::number(clusters[defaultCluster].timeout)); + ui->clusterTcpPortLineEdit->blockSignals(false); + ui->clusterUsernameLineEdit->blockSignals(false); + ui->clusterPasswordLineEdit->blockSignals(false); + ui->clusterTimeoutLineEdit->blockSignals(false); + } + } + } + settings->endArray(); + + settings->endGroup(); } void wfmain::serverAddUserLine(const QString& user, const QString& pass, const int& type) @@ -2153,11 +2237,29 @@ void wfmain::saveSettings() } settings->endArray(); - qInfo() << "Server config stored"; - settings->endGroup(); + settings->beginGroup("Cluster"); + settings->setValue("UdpEnabled", prefs.clusterUdpEnable); + settings->setValue("TcpEnabled", prefs.clusterTcpEnable); + settings->setValue("UdpPort", prefs.clusterUdpPort); + settings->beginWriteArray("Servers"); + + for (int f = 0; f < clusters.count(); f++) + { + settings->setArrayIndex(f); + settings->setValue("ServerName", clusters[f].server); + settings->setValue("UserName", clusters[f].userName); + settings->setValue("Port", clusters[f].port); + settings->setValue("Password", clusters[f].password); + settings->setValue("Timeout", clusters[f].timeout); + settings->setValue("Default", clusters[f].default); + } + + settings->endArray(); + + settings->endGroup(); settings->sync(); // Automatic, not needed (supposedly) } @@ -7385,57 +7487,182 @@ errMsg: } -void wfmain::clusterCheck() { - +void wfmain::receiveClusterOutput(QString text) { + ui->clusterOutputTextEdit->moveCursor(QTextCursor::End); + ui->clusterOutputTextEdit->insertPlainText(text); + ui->clusterOutputTextEdit->moveCursor(QTextCursor::End); } -void wfmain::addClusterSpot(spotData spot) { +void wfmain::addClusterSpot(spotData* s) { - spot.text = new QCPItemText(plot); - spot.text->setAntialiased(true); - spot.text->setColor(QColor(Qt::red)); - spot.text->setText(spot.dxcall); - spot.text->setFont(QFont(font().family(), 10)); - spot.text->setPositionAlignment(Qt::AlignTop | Qt::AlignHCenter); - spot.text->setClipAxisRect(false); - spot.text->position->setType(QCPItemPosition::ptPlotCoords); + s->text = new QCPItemText(plot); + s->text->setAntialiased(true); + s->text->setColor(QColor(Qt::red)); + s->text->setText(s->dxcall); + s->text->setFont(QFont(font().family(), 10)); + s->text->setPositionAlignment(Qt::AlignTop | Qt::AlignHCenter); + s->text->setClipAxisRect(false); + s->text->position->setType(QCPItemPosition::ptPlotCoords); //bool conflict = true; //QCPAxisRect* rect = spot.text->position->axisRect(); - double left = spot.frequency; + double left = s->frequency; double top = rigCaps.spectAmpMax - 50.0; - /* - while (conflict) { - QCPItemText* textItem = plot->itemAt(QPointF(left,top)); - if (textItem != Q_NULLPTR) { - qInfo(logGui()) << "Found conflicting spot"; - if (top > 20.0) { - top = top - 20.0; - } - else { - top = rigCaps.spectAmpMax - 50.0; - left = left + 0.2; - } - } - else { - conflict = false; - } - } - */ - spot.text->position->setCoords(left, top); + s->text->position->setCoords(left, top); //QList col_it = spot.text->item(Qt::IntersectsItemBoundingRect); - clusterSpots.insert(spot.dxcall, &spot); - qInfo(logGui()) << "Number of cluster spots" << clusterSpots.size(); + QMutexLocker locker(&clusterMutex); + clusterSpots.insert(s->dxcall, s); + //qInfo(logGui()) << "Number of cluster spots" << clusterSpots.size(); } void wfmain::deleteClusterSpot(QString dxcall) { + QMutexLocker locker(&clusterMutex); QMap::iterator spot = clusterSpots.find(dxcall); while (spot != clusterSpots.end() && spot.key() == dxcall) { if (spot.value()->text != Q_NULLPTR) { plot->removeItem(spot.value()->text); } + delete spot.value(); spot = clusterSpots.erase(spot); } +} + +void wfmain::on_clusterUdpEnable_clicked(bool enable) +{ + prefs.clusterUdpEnable = enable; + emit setClusterEnableUdp(enable); +} + +void wfmain::on_clusterTcpEnable_clicked(bool enable) +{ + prefs.clusterTcpEnable = enable; + emit setClusterEnableTcp(enable); +} + +void wfmain::on_clusterUdpPortLineEdit_editingFinished() +{ + prefs.clusterUdpPort = ui->clusterUdpPortLineEdit->text().toInt(); + emit setClusterUdpPort(prefs.clusterUdpPort); +} + +void wfmain::on_clusterServerNameCombo_currentIndexChanged(int index) +{ + if (index < 0) + return; + + QString text = ui->clusterServerNameCombo->currentText(); + + if (clusters.size() <= index) + { + qInfo(logGui) << "Adding Cluster server" << text; + clusterSettings c; + c.server = text; + clusters.append(c); + } + else { + qInfo(logGui) << "Editing Cluster server" << text; + clusters[index].server = text; + } + ui->clusterUsernameLineEdit->blockSignals(true); + ui->clusterPasswordLineEdit->blockSignals(true); + ui->clusterTimeoutLineEdit->blockSignals(true); + ui->clusterTcpPortLineEdit->setText(QString::number(clusters[index].port)); + ui->clusterUsernameLineEdit->setText(clusters[index].userName); + ui->clusterPasswordLineEdit->setText(clusters[index].password); + ui->clusterTimeoutLineEdit->setText(QString::number(clusters[index].timeout)); + ui->clusterUsernameLineEdit->blockSignals(false); + ui->clusterPasswordLineEdit->blockSignals(false); + ui->clusterTimeoutLineEdit->blockSignals(false); + + + for (int i = 0; i < clusters.size(); i++) { + if (i == index) + clusters[index].default = true; + else + clusters[index].default = false; + } + + emit setClusterServerName(clusters[index].server); + emit setClusterTcpPort(clusters[index].port); + emit setClusterUserName(clusters[index].userName); + emit setClusterPassword(clusters[index].password); + emit setClusterTimeout(clusters[index].timeout); + +} + +void wfmain::on_clusterServerNameCombo_currentTextChanged(QString text) +{ + if (text.isEmpty()) { + int index = ui->clusterServerNameCombo->currentIndex(); + ui->clusterServerNameCombo->removeItem(index); + clusters.removeAt(index); + } +} + +void wfmain::on_clusterTcpPortLineEdit_editingFinished() +{ + int index = ui->clusterServerNameCombo->currentIndex(); + if (index < clusters.size()) + { + clusters[index].port = ui->clusterTcpPortLineEdit->displayText().toInt(); + emit setClusterTcpPort(clusters[index].port); + } +} + +void wfmain::on_clusterUsernameLineEdit_editingFinished() +{ + int index = ui->clusterServerNameCombo->currentIndex(); + if (index < clusters.size()) + { + clusters[index].userName = ui->clusterUsernameLineEdit->text(); + emit setClusterUserName(clusters[index].userName); + } +} + +void wfmain::on_clusterPasswordLineEdit_editingFinished() +{ + int index = ui->clusterServerNameCombo->currentIndex(); + if (index < clusters.size()) + { + clusters[index].password = ui->clusterPasswordLineEdit->text(); + emit setClusterPassword(clusters[index].password); + } + +} + +void wfmain::on_clusterTimeoutLineEdit_editingFinished() +{ + int index = ui->clusterServerNameCombo->currentIndex(); + if (index < clusters.size()) + { + clusters[index].timeout = ui->clusterTimeoutLineEdit->displayText().toInt(); + emit setClusterTimeout(clusters[index].timeout); + } +} + + +void wfmain::deleteOldClusterSpots(int timeout) +{ + QMutexLocker locker(&clusterMutex); + QDateTime time=QDateTime::currentDateTimeUtc(); + //qDebug(logGui()) << "Deleting old Cluster spots"; + QMap::iterator spot = clusterSpots.begin(); + while (spot != clusterSpots.end()) { + if (spot.value()->timestamp.addSecs(timeout * 60) < time) { + if (spot.value()->text != Q_NULLPTR) + { + plot->removeItem(spot.value()->text); + } + //qDebug(logGui()) << "Deleting:" << spot.value()->dxcall << "Timestamp" << spot.value()->timestamp.addSecs(timeout * 60) << "is lower than" << time; + delete spot.value(); // Stop memory leak? + spot = clusterSpots.erase(spot); + } + else { + //qDebug(logGui()) << "Spot:" << spot.value()->dxcall << "Timestamp" << spot.value()->timestamp.addSecs(timeout * 60) << "not lower than" << time; + ++spot; + } + } + } \ No newline at end of file diff --git a/wfmain.h b/wfmain.h index 134f9cc..a1b6431 100644 --- a/wfmain.h +++ b/wfmain.h @@ -192,10 +192,16 @@ signals: void setClusterUdpPort(int port); void setClusterEnableUdp(bool udp); void setClusterEnableTcp(bool tcp); + void setClusterServerName(QString name); + void setClusterTcpPort(int port); + void setClusterUserName(QString name); + void setClusterPassword(QString pass); + void setClusterTimeout(int timeout); private slots: - void addClusterSpot(spotData spot); + void addClusterSpot(spotData* spot); void deleteClusterSpot(QString dxcall); + void deleteOldClusterSpots(int timeout); void updateSizes(int tabIndex); void shortcutF1(); void shortcutF2(); @@ -658,7 +664,18 @@ private slots: void on_customEdgeBtn_clicked(); - void clusterCheck(); + void on_clusterUdpEnable_clicked(bool enable); + void on_clusterTcpEnable_clicked(bool enable); + void on_clusterUdpPortLineEdit_editingFinished(); + void on_clusterServerNameCombo_currentTextChanged(QString text); + void on_clusterServerNameCombo_currentIndexChanged(int index); + void on_clusterTcpPortLineEdit_editingFinished(); + void on_clusterUsernameLineEdit_editingFinished(); + void on_clusterPasswordLineEdit_editingFinished(); + void on_clusterTimeoutLineEdit_editingFinished(); + + void receiveClusterOutput(QString text); + private: Ui::wfmain *ui; @@ -912,6 +929,13 @@ private: quint16 tcpPort; quint8 waterfallFormat; audioType audioSystem; + bool clusterUdpEnable; + bool clusterTcpEnable; + int clusterUdpPort; + QString clusterTcpServerName; + QString clusterTcpUserName; + QString clusterTcpPassword; + int clusterTimeout; } prefs; preferences defPrefs; @@ -1052,7 +1076,8 @@ private: QMap clusterSpots; QTimer clusterTimer; QCPItemText* text=Q_NULLPTR; - + QList clusters; + QMutex clusterMutex; }; Q_DECLARE_METATYPE(struct rigCapabilities) diff --git a/wfmain.ui b/wfmain.ui index 3effdd7..b127240 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -6,7 +6,7 @@ 0 0 - 1075 + 1125 660 @@ -4898,7 +4898,7 @@ - + 00000 @@ -4919,8 +4919,8 @@ 330 50 - 241 - 181 + 311 + 241 @@ -4931,8 +4931,8 @@ 20 40 - 201 - 121 + 271 + 181 @@ -4943,28 +4943,29 @@ - - - - + Username - - + + - + Password - - + + + + QLineEdit::PasswordEchoOnEdit + + @@ -4973,12 +4974,70 @@ + + + + true + + + true + + + + + + + Spot Timeout (minutes) + + + + + + + 0000 + + + + + + + + + + Server Port + + + + + + + 00000 + + + + + + + 10 + 320 + 811 + 141 + + + + QFrame::Raised + + + QAbstractScrollArea::AdjustIgnored + + groupBox_9 horizontalLayoutWidget groupBox_10 + clusterOutputTextEdit @@ -5146,7 +5205,7 @@ 0 0 - 1075 + 1125 21 @@ -5174,7 +5233,7 @@ - + From 3b1efbd69ee3794213f0d4019733eabdd7829b12 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 30 Sep 2022 17:26:21 +0100 Subject: [PATCH 137/207] Change default to isdefault! --- cluster.h | 2 +- wfmain.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cluster.h b/cluster.h index 44e7ec8..acd72b8 100644 --- a/cluster.h +++ b/cluster.h @@ -29,7 +29,7 @@ struct clusterSettings { QString userName; QString password; int timeout=30; - bool default; + bool isdefault; }; class dxClusterClient : public QObject diff --git a/wfmain.cpp b/wfmain.cpp index 4be0771..ad2a585 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -140,7 +140,7 @@ wfmain::wfmain(const QString settingsFile, const QString logFile, bool debugMode for (int f = 0; f < clusters.size(); f++) { - if (clusters[f].default) + if (clusters[f].isdefault) { emit setClusterServerName(clusters[f].server); emit setClusterTcpPort(clusters[f].port); @@ -1867,7 +1867,7 @@ void wfmain::loadSettings() c.userName = settings->value("UserName", "").toString(); c.password = settings->value("Password", "").toString(); c.timeout = settings->value("Timeout", 0).toInt(); - c.default = settings->value("Default", false).toBool(); + c.isdefault = settings->value("Default", false).toBool(); if (!c.server.isEmpty()) { clusters.append(c); } @@ -1878,7 +1878,7 @@ void wfmain::loadSettings() for (int f = 0; f < clusters.size(); f++) { ui->clusterServerNameCombo->addItem(clusters[f].server); - if (clusters[f].default) { + if (clusters[f].isdefault) { defaultCluster = f; } } @@ -2254,7 +2254,7 @@ void wfmain::saveSettings() settings->setValue("Port", clusters[f].port); settings->setValue("Password", clusters[f].password); settings->setValue("Timeout", clusters[f].timeout); - settings->setValue("Default", clusters[f].default); + settings->setValue("Default", clusters[f].isdefault); } settings->endArray(); @@ -7579,9 +7579,9 @@ void wfmain::on_clusterServerNameCombo_currentIndexChanged(int index) for (int i = 0; i < clusters.size(); i++) { if (i == index) - clusters[index].default = true; + clusters[index].isdefault = true; else - clusters[index].default = false; + clusters[index].isdefault = false; } emit setClusterServerName(clusters[index].server); From 4db451050130f4f07aa7b9626c40442d3a61742c Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 30 Sep 2022 17:29:10 +0100 Subject: [PATCH 138/207] Comment unused line --- wfmain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wfmain.cpp b/wfmain.cpp index ad2a585..717609b 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -7501,7 +7501,7 @@ void wfmain::addClusterSpot(spotData* s) { s->text->setText(s->dxcall); s->text->setFont(QFont(font().family(), 10)); s->text->setPositionAlignment(Qt::AlignTop | Qt::AlignHCenter); - s->text->setClipAxisRect(false); + //s->text->setClipAxisRect(false); s->text->position->setType(QCPItemPosition::ptPlotCoords); //bool conflict = true; //QCPAxisRect* rect = spot.text->position->axisRect(); From 2d58ea2afbb23635f82d3b81d1cb0d2928d4cb08 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 30 Sep 2022 18:41:57 +0100 Subject: [PATCH 139/207] Fix crash when adding cluster server --- cluster.h | 2 +- wfmain.cpp | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/cluster.h b/cluster.h index acd72b8..25cad70 100644 --- a/cluster.h +++ b/cluster.h @@ -25,7 +25,7 @@ struct spotData { struct clusterSettings { QString server; - int port; + int port=7300; QString userName; QString password; int timeout=30; diff --git a/wfmain.cpp b/wfmain.cpp index 717609b..669e362 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -1902,6 +1902,12 @@ void wfmain::loadSettings() } } } + else { + ui->clusterTcpPortLineEdit->setEnabled(false); + ui->clusterUsernameLineEdit->setEnabled(false); + ui->clusterPasswordLineEdit->setEnabled(false); + ui->clusterTimeoutLineEdit->setEnabled(false); + } settings->endArray(); settings->endGroup(); @@ -7560,6 +7566,11 @@ void wfmain::on_clusterServerNameCombo_currentIndexChanged(int index) clusterSettings c; c.server = text; clusters.append(c); + ui->clusterTcpPortLineEdit->setEnabled(true); + ui->clusterUsernameLineEdit->setEnabled(true); + ui->clusterPasswordLineEdit->setEnabled(true); + ui->clusterTimeoutLineEdit->setEnabled(true); + } else { qInfo(logGui) << "Editing Cluster server" << text; @@ -7598,6 +7609,13 @@ void wfmain::on_clusterServerNameCombo_currentTextChanged(QString text) int index = ui->clusterServerNameCombo->currentIndex(); ui->clusterServerNameCombo->removeItem(index); clusters.removeAt(index); + if (clusters.size() == 0) + { + ui->clusterTcpPortLineEdit->setEnabled(false); + ui->clusterUsernameLineEdit->setEnabled(false); + ui->clusterPasswordLineEdit->setEnabled(false); + ui->clusterTimeoutLineEdit->setEnabled(false); + } } } From 9db695cc6302eabdbb719426916d138f693509a5 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 30 Sep 2022 19:06:17 +0100 Subject: [PATCH 140/207] Delete all spots if cluster disabled --- cluster.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/cluster.cpp b/cluster.cpp index 01c2f07..04cbd71 100644 --- a/cluster.cpp +++ b/cluster.cpp @@ -76,6 +76,7 @@ void dxClusterClient::enableTcp(bool enable) tcpSocket->disconnect(); delete tcpSocket; tcpSocket = Q_NULLPTR; + emit deleteOldSpots(0); } } } From 711b86e91b25985ccdd3d487400b03019a33bd04 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Wed, 5 Oct 2022 11:03:15 +0100 Subject: [PATCH 141/207] Add memory sqlite db for cluster spots. --- cluster.cpp | 79 ++++++++++++++++++++++------ cluster.h | 12 +++++ database.cpp | 103 ++++++++++++++++++++++++++++++++++++ database.h | 34 ++++++++++++ wfmain.cpp | 144 ++++++++++++++++++++++++++++++--------------------- wfmain.h | 11 ++-- wfview | 0 wfview.pro | 4 +- 8 files changed, 308 insertions(+), 79 deletions(-) create mode 100644 database.cpp create mode 100644 database.h create mode 100644 wfview diff --git a/cluster.cpp b/cluster.cpp index 04cbd71..0069219 100644 --- a/cluster.cpp +++ b/cluster.cpp @@ -13,6 +13,8 @@ dxClusterClient::~dxClusterClient() qInfo(logCluster()) << "closing dxClusterClient()"; enableUdp(false); enableTcp(false); + database db; + db.close(); } void dxClusterClient::enableUdp(bool enable) @@ -27,7 +29,6 @@ void dxClusterClient::enableUdp(bool enable) qInfo(logCluster()) << "Starting udpSocket() on:" << udpPort << "Result:" << result; connect(udpSocket, SIGNAL(readyRead()), this, SLOT(udpDataReceived()), Qt::QueuedConnection); - } } else { @@ -56,6 +57,7 @@ void dxClusterClient::enableTcp(bool enable) qInfo(logCluster()) << "Starting tcpSocket() on:" << tcpPort; connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(tcpDataReceived()), Qt::QueuedConnection); + connect(tcpSocket, SIGNAL(disconnected()), this, SLOT(tcpDisconnected())); tcpCleanupTimer = new QTimer(this); tcpCleanupTimer->setInterval(1000 * 10); // Run once a minute @@ -76,7 +78,7 @@ void dxClusterClient::enableTcp(bool enable) tcpSocket->disconnect(); delete tcpSocket; tcpSocket = Q_NULLPTR; - emit deleteOldSpots(0); + //emit deleteOldSpots(0); } } } @@ -104,17 +106,26 @@ void dxClusterClient::udpDataReceived() data->timestamp = QDateTime::fromString(spot.firstChildElement("timestamp").text(),"yyyy-MM-dd hh:mm:ss"); data->mode = spot.firstChildElement("mode").text(); data->comment = spot.firstChildElement("comment").text(); - emit addSpot(data); - emit(sendOutput(QString("UDP: SPOT:%1 SPOTTER:%2 FREQ:%3 MODE:%4 DATE:%5 COMMENT:%6\n") - .arg(data->dxcall).arg(data->spottercall).arg(data->frequency).arg(data->mode) - .arg(data->timestamp.toString()).arg(data->comment))); + //emit addSpot(data); + + database db = database(); + db.query(QString("DELETE from spots where dxcall='%1'").arg(data->dxcall)); + QString query = QString("INSERT INTO spots(type,spottercall,frequency,dxcall,mode,comment,timestamp) VALUES('%1','%2',%3,'%4','%5','%6','%7')\n") + .arg("UDP").arg(data->spottercall).arg(data->frequency).arg(data->dxcall).arg(data->mode).arg(data->comment).arg(data->timestamp.toString("yyyy-MM-dd hh:mm:ss")); + db.query(query); + emit sendOutput(query); } else if (action == "delete") { QString dxcall = spot.firstChildElement("dxcall").text(); - emit deleteSpot(dxcall); - qInfo(logCluster()) << "DELETE DX=" << dxcall; + double frequency = spot.firstChildElement("frequency").text().toDouble() / 1000.0; + //emit deleteSpot(dxcall); + database db = database(); + QString query=QString("DELETE from spots where dxcall='%1' AND frequency=%2").arg(dxcall).arg(frequency); + db.query(query); + qInfo(logCluster()) << query; } + updateSpots(); } } } @@ -140,17 +151,21 @@ void dxClusterClient::tcpDataReceived() if (match.hasMatch()) { spotData* data = new spotData(); data->spottercall = match.captured(1); - data->frequency = match.captured(2).toFloat() / 1000.0; + data->frequency = match.captured(2).toDouble() / 1000.0; data->dxcall = match.captured(3); data->comment = match.captured(4).trimmed(); data->timestamp = QDateTime::currentDateTimeUtc(); //data.timestamp = QDateTime::fromString(match.captured(5), "hhmmZ"); - emit addSpot(data); - emit(sendOutput(QString("TCP: SPOT:%1 SPOTTER:%2 FREQ:%3 MODE:%4 DATE:%5 COMMENT:%6\n") - .arg(data->dxcall).arg(data->spottercall).arg(data->frequency).arg(data->mode) - .arg(data->timestamp.toString()).arg(data->comment))); + //emit addSpot(data); + database db = database(); + db.query(QString("DELETE from spots where dxcall='%1'").arg(data->dxcall)); + QString query = QString("INSERT INTO spots(type,spottercall,frequency,dxcall,comment,timestamp) VALUES('%1','%2',%3,'%4','%5','%6')\n") + .arg("TCP").arg(data->spottercall).arg(data->frequency).arg(data->dxcall).arg(data->comment).arg(data->timestamp.toString("yyyy-MM-dd hh:mm:ss")); + db.query(query); + emit sendOutput(query); } } + updateSpots(); } @@ -169,5 +184,39 @@ void dxClusterClient::sendTcpData(QString data) void dxClusterClient::tcpCleanup() { - emit deleteOldSpots(tcpTimeout); -} \ No newline at end of file + //emit deleteOldSpots(tcpTimeout); + database db = database(); + db.query(QString("DELETE FROM spots where timestamp < datetime('now', '-%1 minutes')").arg(tcpTimeout)); +} + +void dxClusterClient::tcpDisconnected() { + qWarning(logCluster()) << "TCP Cluster server disconnected..."; + // Need to start a timer and attempt reconnect. +} + +void dxClusterClient::freqRange(double low, double high) +{ + lowFreq = low; + highFreq = high; + //qInfo(logCluster) << "New range" << low << "-" << high; + updateSpots(); +} + +void dxClusterClient::updateSpots() +{ + // Set the required freqency range. + QString queryText = QString("SELECT * FROM spots WHERE frequency >= %1 AND frequency <= %2").arg(lowFreq).arg(highFreq); + //QString queryText = QString("SELECT * FROM spots"); + database db; + auto query = db.query(queryText); + + QList spots; + while (query.next()) { + // Step through all current spots within range + spotData s = spotData(); + s.dxcall = query.value(query.record().indexOf("dxcall")).toString(); + s.frequency = query.value(query.record().indexOf("frequency")).toDouble(); + spots.append(s); + } + emit sendSpots(spots); +} diff --git a/cluster.h b/cluster.h index 25cad70..0a54bed 100644 --- a/cluster.h +++ b/cluster.h @@ -11,7 +11,10 @@ #include #include #include +#include +#include #include +#include "database.h" struct spotData { QString dxcall; @@ -21,6 +24,7 @@ struct spotData { QString mode; QString comment; QCPItemText* text = Q_NULLPTR; + bool current = false; }; struct clusterSettings { @@ -45,10 +49,12 @@ signals: void deleteSpot(QString dxcall); void deleteOldSpots(int minutes); void sendOutput(QString text); + void sendSpots(QList spots); public slots: void udpDataReceived(); void tcpDataReceived(); + void tcpDisconnected(); void enableUdp(bool enable); void enableTcp(bool enable); void setUdpPort(int p) { udpPort = p; } @@ -58,9 +64,12 @@ public slots: void setTcpPassword(QString s) { tcpPassword = s; } void setTcpTimeout(int p) { tcpTimeout = p; } void tcpCleanup(); + void freqRange(double low, double high); private: void sendTcpData(QString data); + bool databaseOpen(); + void updateSpots(); bool udpEnable; bool tcpEnable; @@ -77,6 +86,9 @@ private: QMutex mutex; bool authenticated=false; QTimer* tcpCleanupTimer=Q_NULLPTR; + QSqlDatabase db; + double lowFreq; + double highFreq; }; #endif diff --git a/database.cpp b/database.cpp new file mode 100644 index 0000000..4ac2a6e --- /dev/null +++ b/database.cpp @@ -0,0 +1,103 @@ +#include "database.h" +#include "logcategories.h" + +database::database() +{ + open(); +} + +database::~database() +{ +} + +bool database::open() +{ + auto name = "my_db_" + QString::number((quint64)QThread::currentThread(), 16); + if (QSqlDatabase::contains(name)) + { + db = QSqlDatabase::database(name); + qu = QSqlQuery(db); + return true; + } + else { + qInfo(logCluster()) << "Creating new connection" << name; + db = QSqlDatabase::addDatabase("QSQLITE", name); + qu = QSqlQuery(db); + } + + //QString path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/" + "wfview.db"; + QString path = ":memory:"; + qInfo(logCluster()) << "DB Filename" << path; + db.setDatabaseName(path); + if (db.isValid()) + { + db.open(); + if (check()) { + return true; + } + } + qWarning(logCluster()) << "Database is not valid!"; + return false; +} + +void database::close() +{ + auto name = "my_db_" + QString::number((quint64)QThread::currentThread(), 16); + qInfo(logCluster()) << "Closing database connection:" << name; + db.close(); +} + + + +QSqlQuery database::query(QString query) +{ + if (!db.isOpen()) + { + qWarning(logCluster()) << "Query Database is not open!"; + db.open(); + } + qu.exec(query); + return qu; +} + + + +bool database::check() +{ + if (db.isOpen()) { + for (const auto& table : db.tables()) + { + if (table == "spots") + { + qInfo(logCluster()) << "DB Contains spots table"; + return true; + } + } + qInfo(logCluster()) << "Creating spots table"; + // Spots table does not exist, need to create it. + /* + QString dxcall; + double frequency; + QString spottercall; + QDateTime timestamp; + QString mode; + QString comment; + QCPItemText* text = Q_NULLPTR;*/ + qu.exec("CREATE TABLE spots " + "(id INTEGER PRIMARY KEY, " + "type VARCHAR(3)," + "dxcall VARCHAR(30)," + "spottercall VARCHAR(30)," + "frequency DOUBLE," + "timestamp DATETIME," + "mode VARCHAR(30)," + "comment VARCHAR(255) )"); + qu.exec("CREATE INDEX spots_index ON spots(type,dxcall,frequency,timestamp)"); + return true; + } + else { + qWarning(logCluster()) << "Database is not open"; + + } + return false; +} \ No newline at end of file diff --git a/database.h b/database.h new file mode 100644 index 0000000..7ddc9f2 --- /dev/null +++ b/database.h @@ -0,0 +1,34 @@ +#ifndef DATABASE_H +#define DATABASE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class database +{ +public: + explicit database(); + virtual ~database(); + bool open(); + void close(); + QSqlQuery query(QString query); + QSqlResult database::get(); + +signals: + +public slots: +private: + bool check(); + QSqlDatabase db; + QSqlQuery qu; + +}; + +#endif diff --git a/wfmain.cpp b/wfmain.cpp index 669e362..f1be150 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -69,9 +69,10 @@ wfmain::wfmain(const QString settingsFile, const QString logFile, bool debugMode qRegisterMetaType (); qRegisterMetaType(); qRegisterMetaType>(); + qRegisterMetaType>(); + qRegisterMetaType>(); qRegisterMetaType(); qRegisterMetaType(); - qRegisterMetaType(); haveRigCaps = false; @@ -125,10 +126,9 @@ wfmain::wfmain(const QString settingsFile, const QString logFile, bool debugMode connect(this, SIGNAL(setClusterUserName(QString)), cluster, SLOT(setTcpUserName(QString))); connect(this, SIGNAL(setClusterPassword(QString)), cluster, SLOT(setTcpPassword(QString))); connect(this, SIGNAL(setClusterTimeout(int)), cluster, SLOT(setTcpTimeout(int))); + connect(this, SIGNAL(setFrequencyRange(double, double)), cluster, SLOT(freqRange(double, double))); - connect(cluster, SIGNAL(addSpot(spotData*)), this, SLOT(addClusterSpot(spotData*))); - connect(cluster, SIGNAL(deleteSpot(QString)), this, SLOT(deleteClusterSpot(QString))); - connect(cluster, SIGNAL(deleteOldSpots(int)), this, SLOT(deleteOldClusterSpots(int))); + connect(cluster, SIGNAL(sendSpots(QList)), this, SLOT(receiveSpots(QList))); connect(cluster, SIGNAL(sendOutput(QString)), this, SLOT(receiveClusterOutput(QString))); connect(clusterThread, SIGNAL(finished()), cluster, SLOT(deleteLater())); @@ -3855,6 +3855,8 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e // This will break if the button is ever moved or renamed. on_clearPeakBtn_clicked(); } + // Inform other threads (cluster) that the frequency range has changed. + emit setFrequencyRange(startFreq, endFreq); // TODO: Add clear-out for the buffer } @@ -4117,7 +4119,7 @@ void wfmain::handleWFDoubleClick(QMouseEvent *me) } } -void wfmain::handlePlotClick(QMouseEvent *me) +void wfmain::handlePlotClick(QMouseEvent* me) { double x = plot->xAxis->pixelToCoord(me->pos().x()); showStatusBarText(QString("Selected %1 MHz").arg(x)); @@ -7499,42 +7501,6 @@ void wfmain::receiveClusterOutput(QString text) { ui->clusterOutputTextEdit->moveCursor(QTextCursor::End); } -void wfmain::addClusterSpot(spotData* s) { - - s->text = new QCPItemText(plot); - s->text->setAntialiased(true); - s->text->setColor(QColor(Qt::red)); - s->text->setText(s->dxcall); - s->text->setFont(QFont(font().family(), 10)); - s->text->setPositionAlignment(Qt::AlignTop | Qt::AlignHCenter); - //s->text->setClipAxisRect(false); - s->text->position->setType(QCPItemPosition::ptPlotCoords); - //bool conflict = true; - //QCPAxisRect* rect = spot.text->position->axisRect(); - double left = s->frequency; - double top = rigCaps.spectAmpMax - 50.0; - - s->text->position->setCoords(left, top); - - //QList col_it = spot.text->item(Qt::IntersectsItemBoundingRect); - QMutexLocker locker(&clusterMutex); - clusterSpots.insert(s->dxcall, s); - //qInfo(logGui()) << "Number of cluster spots" << clusterSpots.size(); -} - -void wfmain::deleteClusterSpot(QString dxcall) { - QMutexLocker locker(&clusterMutex); - QMap::iterator spot = clusterSpots.find(dxcall); - while (spot != clusterSpots.end() && spot.key() == dxcall) { - if (spot.value()->text != Q_NULLPTR) - { - plot->removeItem(spot.value()->text); - } - delete spot.value(); - spot = clusterSpots.erase(spot); - } -} - void wfmain::on_clusterUdpEnable_clicked(bool enable) { prefs.clusterUdpEnable = enable; @@ -7661,26 +7627,86 @@ void wfmain::on_clusterTimeoutLineEdit_editingFinished() } -void wfmain::deleteOldClusterSpots(int timeout) +void wfmain::receiveSpots(QList spots) { - QMutexLocker locker(&clusterMutex); - QDateTime time=QDateTime::currentDateTimeUtc(); - //qDebug(logGui()) << "Deleting old Cluster spots"; - QMap::iterator spot = clusterSpots.begin(); - while (spot != clusterSpots.end()) { - if (spot.value()->timestamp.addSecs(timeout * 60) < time) { - if (spot.value()->text != Q_NULLPTR) - { - plot->removeItem(spot.value()->text); - } - //qDebug(logGui()) << "Deleting:" << spot.value()->dxcall << "Timestamp" << spot.value()->timestamp.addSecs(timeout * 60) << "is lower than" << time; - delete spot.value(); // Stop memory leak? - spot = clusterSpots.erase(spot); - } - else { - //qDebug(logGui()) << "Spot:" << spot.value()->dxcall << "Timestamp" << spot.value()->timestamp.addSecs(timeout * 60) << "not lower than" << time; + QElapsedTimer timer; + timer.start(); + + QMap::iterator spot1 = clusterSpots.begin(); + while (spot1 != clusterSpots.end()) { + spot1.value()->current = false; + ++spot1; + } + + foreach(spotData s, spots) + { + bool found = false; + QMap::iterator spot = clusterSpots.find(s.dxcall); + + while (spot != clusterSpots.end() && spot.key() == s.dxcall && spot.value()->frequency == s.frequency) { + spot.value()->current = true; + found = true; ++spot; } + + if (!found) + { + spotData* sp = new spotData(); + sp->dxcall = s.dxcall; + sp->frequency = s.frequency; + + //qDebug(logCluster()) << "ADD:" << sp->dxcall; + sp->current = true; + bool conflict = true; + double left = sp->frequency; + double top = rigCaps.spectAmpMax - 10; + sp->text = new QCPItemText(plot); + sp->text->setAntialiased(true); + sp->text->setColor(QColor(Qt::red)); + sp->text->setText(sp->dxcall); + sp->text->setFont(QFont(font().family(), 10)); + sp->text->setPositionAlignment(Qt::AlignVCenter | Qt::AlignHCenter); + sp->text->position->setType(QCPItemPosition::ptPlotCoords); + sp->text->setSelectable(true); + QMargins margin; + int width = (sp->text->right - sp->text->left) / 2; + margin.setLeft(width); + margin.setRight(width); + sp->text->setPadding(margin); + sp->text->position->setCoords(left, top); + sp->text->setVisible(false); + while (conflict) { + QCPItemText* textItem = plot->itemAt(sp->text->position->pixelPosition(), true); + if (textItem != nullptr && sp->text != textItem) { + //qInfo(logGui()) << "CONFLICT:" << textItem->text() << "SAME POSITION AS" << sp->dxcall << sp->text->position->pixelPosition(); + top = top - 5.0; + } + else { + //qInfo(logGui()) << "OK:" << sp->dxcall << sp->text->position->pixelPosition(); + conflict = false; + } + sp->text->position->setCoords(left, top); + } + + sp->text->setVisible(true); + clusterSpots.insert(sp->dxcall, sp); + } } -} \ No newline at end of file + QMap::iterator spot2 = clusterSpots.begin(); + while (spot2 != clusterSpots.end()) { + if (spot2.value()->current == false) { + plot->removeItem(spot2.value()->text); + //qDebug(logCluster()) << "REMOVE:" << spot2.value()->dxcall; + delete spot2.value(); // Stop memory leak? + spot2 = clusterSpots.erase(spot2); + } + else { + ++spot2; + } + + } + + //qDebug(logCluster()) << "Processing took" << timer.nsecsElapsed() / 1000 << "us"; +} + diff --git a/wfmain.h b/wfmain.h index a1b6431..ceb0e72 100644 --- a/wfmain.h +++ b/wfmain.h @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include "logcategories.h" #include "commhandler.h" @@ -40,6 +42,7 @@ #include "colorprefs.h" #include "loggingwindow.h" #include "cluster.h" +#include "database.h" #include #include @@ -197,11 +200,9 @@ signals: void setClusterUserName(QString name); void setClusterPassword(QString pass); void setClusterTimeout(int timeout); + void setFrequencyRange(double low, double high); private slots: - void addClusterSpot(spotData* spot); - void deleteClusterSpot(QString dxcall); - void deleteOldClusterSpots(int timeout); void updateSizes(int tabIndex); void shortcutF1(); void shortcutF2(); @@ -675,7 +676,7 @@ private slots: void on_clusterTimeoutLineEdit_editingFinished(); void receiveClusterOutput(QString text); - + void receiveSpots(QList spots); private: Ui::wfmain *ui; @@ -1078,6 +1079,7 @@ private: QCPItemText* text=Q_NULLPTR; QList clusters; QMutex clusterMutex; + QSqlDatabase db; }; Q_DECLARE_METATYPE(struct rigCapabilities) @@ -1097,6 +1099,7 @@ Q_DECLARE_METATYPE(enum meterKind) Q_DECLARE_METATYPE(enum spectrumMode) Q_DECLARE_METATYPE(enum mode_kind) Q_DECLARE_METATYPE(QList) +Q_DECLARE_METATYPE(QList) Q_DECLARE_METATYPE(rigstate*) //void (*wfmain::logthistext)(QString text) = NULL; diff --git a/wfview b/wfview new file mode 100644 index 0000000..e69de29 diff --git a/wfview.pro b/wfview.pro index fc04e57..8353efe 100644 --- a/wfview.pro +++ b/wfview.pro @@ -4,7 +4,7 @@ # #------------------------------------------------- -QT += core gui serialport network multimedia xml +QT += core gui serialport network multimedia xml sql greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport @@ -175,6 +175,7 @@ SOURCES += main.cpp\ selectradio.cpp \ tcpserver.cpp \ cluster.cpp \ + database.cpp \ aboutbox.cpp HEADERS += wfmain.h \ @@ -212,6 +213,7 @@ HEADERS += wfmain.h \ selectradio.h \ tcpserver.h \ cluster.h \ + database.h \ aboutbox.h From 855438e8433988ce3b9f754b97e6698235c3cc39 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Wed, 5 Oct 2022 11:05:29 +0100 Subject: [PATCH 142/207] Update query --- cluster.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cluster.cpp b/cluster.cpp index 0069219..2e1267d 100644 --- a/cluster.cpp +++ b/cluster.cpp @@ -205,7 +205,7 @@ void dxClusterClient::freqRange(double low, double high) void dxClusterClient::updateSpots() { // Set the required freqency range. - QString queryText = QString("SELECT * FROM spots WHERE frequency >= %1 AND frequency <= %2").arg(lowFreq).arg(highFreq); + QString queryText = QString("SELECT * FROM spots WHERE frequency > %1 AND frequency < %2").arg(lowFreq).arg(highFreq); //QString queryText = QString("SELECT * FROM spots"); database db; auto query = db.query(queryText); From 9fdc09c5be818a7ec36f8f475fa80bc61cd622b6 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Wed, 5 Oct 2022 11:38:24 +0100 Subject: [PATCH 143/207] Remove old code --- database.h | 2 -- wfmain.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/database.h b/database.h index 7ddc9f2..be6a788 100644 --- a/database.h +++ b/database.h @@ -7,7 +7,6 @@ #include #include #include -#include #include #include @@ -19,7 +18,6 @@ public: bool open(); void close(); QSqlQuery query(QString query); - QSqlResult database::get(); signals: diff --git a/wfmain.h b/wfmain.h index ceb0e72..2ea7ae6 100644 --- a/wfmain.h +++ b/wfmain.h @@ -18,8 +18,6 @@ #include #include #include -#include -#include #include "logcategories.h" #include "commhandler.h" From b011165d5b08ec91f6932c78609297c412b514a8 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Wed, 5 Oct 2022 12:43:39 +0100 Subject: [PATCH 144/207] Make SQL db optional --- cluster.cpp | 85 ++++++++++++++++++++++++++++++++++++++++++++++++---- cluster.h | 4 +++ database.cpp | 6 +++- database.h | 4 +++ wfmain.h | 1 - 5 files changed, 92 insertions(+), 8 deletions(-) diff --git a/cluster.cpp b/cluster.cpp index 2e1267d..ede330b 100644 --- a/cluster.cpp +++ b/cluster.cpp @@ -13,8 +13,17 @@ dxClusterClient::~dxClusterClient() qInfo(logCluster()) << "closing dxClusterClient()"; enableUdp(false); enableTcp(false); +#ifdef USESQL database db; db.close(); +#else + QMap::iterator spot = allSpots.begin(); + while (spot != allSpots.end()) + { + delete spot.value(); // Stop memory leak? + spot = allSpots.erase(spot); + } +#endif } void dxClusterClient::enableUdp(bool enable) @@ -108,22 +117,44 @@ void dxClusterClient::udpDataReceived() data->comment = spot.firstChildElement("comment").text(); //emit addSpot(data); +#ifdef USESQL database db = database(); db.query(QString("DELETE from spots where dxcall='%1'").arg(data->dxcall)); QString query = QString("INSERT INTO spots(type,spottercall,frequency,dxcall,mode,comment,timestamp) VALUES('%1','%2',%3,'%4','%5','%6','%7')\n") .arg("UDP").arg(data->spottercall).arg(data->frequency).arg(data->dxcall).arg(data->mode).arg(data->comment).arg(data->timestamp.toString("yyyy-MM-dd hh:mm:ss")); db.query(query); emit sendOutput(query); +#else + bool found = false; + QMap::iterator spot = allSpots.find(data->dxcall); + while (spot != allSpots.end() && spot.key() == data->dxcall && spot.value()->frequency == data->frequency) { + found = true; + ++spot; + } + if (found == false) { + allSpots.insert(data->dxcall, data); + } +#endif + } else if (action == "delete") { QString dxcall = spot.firstChildElement("dxcall").text(); double frequency = spot.firstChildElement("frequency").text().toDouble() / 1000.0; - //emit deleteSpot(dxcall); + +#ifdef USESQL database db = database(); QString query=QString("DELETE from spots where dxcall='%1' AND frequency=%2").arg(dxcall).arg(frequency); db.query(query); qInfo(logCluster()) << query; +#else + QMap::iterator spot = allSpots.find(dxcall); + while (spot != allSpots.end() && spot.key() == dxcall && spot.value()->frequency == frequency) + { + delete spot.value(); // Stop memory leak? + spot = allSpots.erase(spot); + } +#endif } updateSpots(); } @@ -155,14 +186,26 @@ void dxClusterClient::tcpDataReceived() data->dxcall = match.captured(3); data->comment = match.captured(4).trimmed(); data->timestamp = QDateTime::currentDateTimeUtc(); - //data.timestamp = QDateTime::fromString(match.captured(5), "hhmmZ"); - //emit addSpot(data); + +#ifdef USESQL database db = database(); db.query(QString("DELETE from spots where dxcall='%1'").arg(data->dxcall)); QString query = QString("INSERT INTO spots(type,spottercall,frequency,dxcall,comment,timestamp) VALUES('%1','%2',%3,'%4','%5','%6')\n") .arg("TCP").arg(data->spottercall).arg(data->frequency).arg(data->dxcall).arg(data->comment).arg(data->timestamp.toString("yyyy-MM-dd hh:mm:ss")); db.query(query); emit sendOutput(query); +#else + bool found = false; + QMap::iterator spot = allSpots.find(data->dxcall); + while (spot != allSpots.end() && spot.key() == data->dxcall && spot.value()->frequency == data->frequency) { + found = true; + ++spot; + } + if (found == false) { + allSpots.insert(data->dxcall, data); + } + +#endif } } updateSpots(); @@ -184,9 +227,23 @@ void dxClusterClient::sendTcpData(QString data) void dxClusterClient::tcpCleanup() { - //emit deleteOldSpots(tcpTimeout); +#ifdef USESQL database db = database(); db.query(QString("DELETE FROM spots where timestamp < datetime('now', '-%1 minutes')").arg(tcpTimeout)); +#else + QMap::iterator spot = allSpots.begin();; + while (spot != allSpots.end()) { + if (spot.value()->timestamp.addSecs(tcpTimeout * 60) < QDateTime::currentDateTimeUtc()) + { + delete spot.value(); // Stop memory leak? + spot = allSpots.erase(spot); + } + else + { + ++spot; + } + } +#endif } void dxClusterClient::tcpDisconnected() { @@ -204,13 +261,14 @@ void dxClusterClient::freqRange(double low, double high) void dxClusterClient::updateSpots() { - // Set the required freqency range. + QList spots; +#ifdef USESQL + // Set the required frequency range. QString queryText = QString("SELECT * FROM spots WHERE frequency > %1 AND frequency < %2").arg(lowFreq).arg(highFreq); //QString queryText = QString("SELECT * FROM spots"); database db; auto query = db.query(queryText); - QList spots; while (query.next()) { // Step through all current spots within range spotData s = spotData(); @@ -218,5 +276,20 @@ void dxClusterClient::updateSpots() s.frequency = query.value(query.record().indexOf("frequency")).toDouble(); spots.append(s); } +#else + QMap::iterator spot = allSpots.begin();; + while (spot != allSpots.end()) { + if (spot.value()->frequency > lowFreq && spot.value()->frequency < highFreq) + { + spots.append(**spot); + ++spot; + } + else + { + ++spot; + } + } + +#endif emit sendSpots(spots); } diff --git a/cluster.h b/cluster.h index 0a54bed..f0a2def 100644 --- a/cluster.h +++ b/cluster.h @@ -14,7 +14,10 @@ #include #include #include + +#ifdef USESQL #include "database.h" +#endif struct spotData { QString dxcall; @@ -89,6 +92,7 @@ private: QSqlDatabase db; double lowFreq; double highFreq; + QMap allSpots; }; #endif diff --git a/database.cpp b/database.cpp index 4ac2a6e..178399b 100644 --- a/database.cpp +++ b/database.cpp @@ -1,3 +1,5 @@ +#ifdef USESQL + #include "database.h" #include "logcategories.h" @@ -100,4 +102,6 @@ bool database::check() } return false; -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/database.h b/database.h index be6a788..7e80e9e 100644 --- a/database.h +++ b/database.h @@ -1,3 +1,5 @@ +#ifdef USESQL + #ifndef DATABASE_H #define DATABASE_H @@ -30,3 +32,5 @@ private: }; #endif + +#endif diff --git a/wfmain.h b/wfmain.h index 2ea7ae6..ce42604 100644 --- a/wfmain.h +++ b/wfmain.h @@ -40,7 +40,6 @@ #include "colorprefs.h" #include "loggingwindow.h" #include "cluster.h" -#include "database.h" #include #include From f31aadd991aaa8cd918c465edcaadbdc848a8388 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Wed, 5 Oct 2022 12:45:25 +0100 Subject: [PATCH 145/207] Add optional SQL in wfview.pro --- wfview.pro | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wfview.pro b/wfview.pro index 8353efe..3286eb7 100644 --- a/wfview.pro +++ b/wfview.pro @@ -4,7 +4,10 @@ # #------------------------------------------------- -QT += core gui serialport network multimedia xml sql +QT += core gui serialport network multimedia xml + +#QT += sql +#DEFINES += USESQL greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport From 4d158f5078e34aac351bd0ec89467f0f4c18b465 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Wed, 5 Oct 2022 13:43:07 +0100 Subject: [PATCH 146/207] Remove calls for QSqlDatabase when USESQL is not configured --- cluster.h | 6 ++++++ wfmain.h | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cluster.h b/cluster.h index f0a2def..ba357ae 100644 --- a/cluster.h +++ b/cluster.h @@ -11,8 +11,12 @@ #include #include #include + +#ifdef USESQL #include #include +#endif + #include #ifdef USESQL @@ -89,7 +93,9 @@ private: QMutex mutex; bool authenticated=false; QTimer* tcpCleanupTimer=Q_NULLPTR; +#ifdef USESQL QSqlDatabase db; +#endif double lowFreq; double highFreq; QMap allSpots; diff --git a/wfmain.h b/wfmain.h index ce42604..e4c9879 100644 --- a/wfmain.h +++ b/wfmain.h @@ -1076,7 +1076,6 @@ private: QCPItemText* text=Q_NULLPTR; QList clusters; QMutex clusterMutex; - QSqlDatabase db; }; Q_DECLARE_METATYPE(struct rigCapabilities) From b110ce7fbbf050fd73b8525828cda679d47303f8 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Wed, 5 Oct 2022 14:26:42 +0100 Subject: [PATCH 147/207] Bit of tidying --- cluster.cpp | 7 +------ wfmain.cpp | 4 +--- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/cluster.cpp b/cluster.cpp index ede330b..a22965e 100644 --- a/cluster.cpp +++ b/cluster.cpp @@ -115,7 +115,6 @@ void dxClusterClient::udpDataReceived() data->timestamp = QDateTime::fromString(spot.firstChildElement("timestamp").text(),"yyyy-MM-dd hh:mm:ss"); data->mode = spot.firstChildElement("mode").text(); data->comment = spot.firstChildElement("comment").text(); - //emit addSpot(data); #ifdef USESQL database db = database(); @@ -282,12 +281,8 @@ void dxClusterClient::updateSpots() if (spot.value()->frequency > lowFreq && spot.value()->frequency < highFreq) { spots.append(**spot); - ++spot; - } - else - { - ++spot; } + ++spot; } #endif diff --git a/wfmain.cpp b/wfmain.cpp index f1be150..3e3e978 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -7651,9 +7651,7 @@ void wfmain::receiveSpots(QList spots) if (!found) { - spotData* sp = new spotData(); - sp->dxcall = s.dxcall; - sp->frequency = s.frequency; + spotData* sp = new spotData(s); //qDebug(logCluster()) << "ADD:" << sp->dxcall; sp->current = true; From 880a9c3da031a32f40d2ecf170f26bdc7d60c349 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 6 Oct 2022 11:02:22 +0100 Subject: [PATCH 148/207] Add right-click on spot to popup dialog --- wfmain.cpp | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 3e3e978..e5f247c 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -4121,16 +4121,46 @@ void wfmain::handleWFDoubleClick(QMouseEvent *me) void wfmain::handlePlotClick(QMouseEvent* me) { - double x = plot->xAxis->pixelToCoord(me->pos().x()); - showStatusBarText(QString("Selected %1 MHz").arg(x)); - this->mousePressFreq = x; + if (me->button() == Qt::RightButton) { + QCPItemText* textItem = plot->itemAt(me->pos(), true); + if (textItem != nullptr) { + qInfo(logGui()) << "Clicked on:" << textItem->text(); + QMap::iterator spot = clusterSpots.find(textItem->text()); + if (spot != clusterSpots.end() && spot.key() == textItem->text()) { + QDialog* spotDialog = new QDialog(); + QVBoxLayout* vlayout = new QVBoxLayout; + spotDialog->setFixedSize(240, 120); + QLabel* dxcall = new QLabel(QString("DX Call:%1").arg(spot.value()->dxcall)); + QLabel* spotter = new QLabel(QString("Spotter:%1").arg(spot.value()->spottercall)); + QLabel* frequency = new QLabel(QString("Frequency:%1 MHz").arg(spot.value()->frequency)); + QLabel* comment = new QLabel(QString("Comment:%1").arg(spot.value()->comment)); + QAbstractButton* bExit = new QPushButton("Close"); + vlayout->addWidget(dxcall); + vlayout->addWidget(spotter); + vlayout->addWidget(frequency); + vlayout->addWidget(comment); + vlayout->addWidget(bExit); + spotDialog->setLayout(vlayout); + spotDialog->show(); + spotDialog->connect(bExit, SIGNAL(clicked()), spotDialog, SLOT(close())); + } + } + } + else { + double x = plot->xAxis->pixelToCoord(me->pos().x()); + showStatusBarText(QString("Selected %1 MHz").arg(x)); + this->mousePressFreq = x; + } } -void wfmain::handlePlotMouseRelease(QMouseEvent *me) +void wfmain::handlePlotMouseRelease(QMouseEvent* me) { - this->mouseReleaseFreq = plot->xAxis->pixelToCoord(me->pos().x()); - double delta = mouseReleaseFreq - mousePressFreq; - qInfo(logGui()) << "Mouse release delta: " << delta; + if (me->button() != Qt::RightButton) { + this->mouseReleaseFreq = plot->xAxis->pixelToCoord(me->pos().x()); + double delta = mouseReleaseFreq - mousePressFreq; + qInfo(logGui()) << "Mouse release delta: " << delta; + + } } void wfmain::handlePlotMouseMove(QMouseEvent *me) @@ -7705,6 +7735,6 @@ void wfmain::receiveSpots(QList spots) } - //qDebug(logCluster()) << "Processing took" << timer.nsecsElapsed() / 1000 << "us"; + qDebug(logCluster()) << "Processing took" << timer.nsecsElapsed() / 1000 << "us"; } From fa9cab1374cb7a454ced27aea58c15a1e9b4dd76 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 6 Oct 2022 11:12:55 +0100 Subject: [PATCH 149/207] Make spot window size to fit content. --- wfmain.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index e5f247c..4e25081 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -4127,15 +4127,16 @@ void wfmain::handlePlotClick(QMouseEvent* me) qInfo(logGui()) << "Clicked on:" << textItem->text(); QMap::iterator spot = clusterSpots.find(textItem->text()); if (spot != clusterSpots.end() && spot.key() == textItem->text()) { + /* parent and children are destroyed on close */ QDialog* spotDialog = new QDialog(); QVBoxLayout* vlayout = new QVBoxLayout; - spotDialog->setFixedSize(240, 120); - QLabel* dxcall = new QLabel(QString("DX Call:%1").arg(spot.value()->dxcall)); + //spotDialog->setFixedSize(240, 100); + spotDialog->setBaseSize(1, 1); + spotDialog->setWindowTitle(QString("SPOT: %1").arg(spot.value()->dxcall)); QLabel* spotter = new QLabel(QString("Spotter:%1").arg(spot.value()->spottercall)); QLabel* frequency = new QLabel(QString("Frequency:%1 MHz").arg(spot.value()->frequency)); QLabel* comment = new QLabel(QString("Comment:%1").arg(spot.value()->comment)); QAbstractButton* bExit = new QPushButton("Close"); - vlayout->addWidget(dxcall); vlayout->addWidget(spotter); vlayout->addWidget(frequency); vlayout->addWidget(comment); From 62d9ec2442f3fbedbd7153fb5da3da3d8143b8d8 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 6 Oct 2022 11:17:46 +0100 Subject: [PATCH 150/207] Update wfmain.cpp --- wfmain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wfmain.cpp b/wfmain.cpp index 4e25081..90e8c75 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -4132,7 +4132,7 @@ void wfmain::handlePlotClick(QMouseEvent* me) QVBoxLayout* vlayout = new QVBoxLayout; //spotDialog->setFixedSize(240, 100); spotDialog->setBaseSize(1, 1); - spotDialog->setWindowTitle(QString("SPOT: %1").arg(spot.value()->dxcall)); + spotDialog->setWindowTitle(spot.value()->dxcall); QLabel* spotter = new QLabel(QString("Spotter:%1").arg(spot.value()->spottercall)); QLabel* frequency = new QLabel(QString("Frequency:%1 MHz").arg(spot.value()->frequency)); QLabel* comment = new QLabel(QString("Comment:%1").arg(spot.value()->comment)); From f7e2631ee3ef7f0514037854e34b7e874b92b4a0 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sat, 8 Oct 2022 00:55:07 +0100 Subject: [PATCH 151/207] Update wfmain.cpp --- wfmain.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wfmain.cpp b/wfmain.cpp index 90e8c75..5dc2871 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -4133,10 +4133,12 @@ void wfmain::handlePlotClick(QMouseEvent* me) //spotDialog->setFixedSize(240, 100); spotDialog->setBaseSize(1, 1); spotDialog->setWindowTitle(spot.value()->dxcall); + QLabel* dxcall = new QLabel(QString("DX:%1").arg(spot.value()->dxcall)); QLabel* spotter = new QLabel(QString("Spotter:%1").arg(spot.value()->spottercall)); QLabel* frequency = new QLabel(QString("Frequency:%1 MHz").arg(spot.value()->frequency)); QLabel* comment = new QLabel(QString("Comment:%1").arg(spot.value()->comment)); QAbstractButton* bExit = new QPushButton("Close"); + vlayout->addWidget(dxcall); vlayout->addWidget(spotter); vlayout->addWidget(frequency); vlayout->addWidget(comment); From cc6e4d042a42084a6418a8d9e3e0293f22fc3a70 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sat, 8 Oct 2022 01:09:41 +0100 Subject: [PATCH 152/207] Left click on spot to change freq --- wfmain.cpp | 66 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 5dc2871..00c6b7e 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -4121,35 +4121,44 @@ void wfmain::handleWFDoubleClick(QMouseEvent *me) void wfmain::handlePlotClick(QMouseEvent* me) { - if (me->button() == Qt::RightButton) { - QCPItemText* textItem = plot->itemAt(me->pos(), true); - if (textItem != nullptr) { - qInfo(logGui()) << "Clicked on:" << textItem->text(); - QMap::iterator spot = clusterSpots.find(textItem->text()); - if (spot != clusterSpots.end() && spot.key() == textItem->text()) { - /* parent and children are destroyed on close */ - QDialog* spotDialog = new QDialog(); - QVBoxLayout* vlayout = new QVBoxLayout; - //spotDialog->setFixedSize(240, 100); - spotDialog->setBaseSize(1, 1); - spotDialog->setWindowTitle(spot.value()->dxcall); - QLabel* dxcall = new QLabel(QString("DX:%1").arg(spot.value()->dxcall)); - QLabel* spotter = new QLabel(QString("Spotter:%1").arg(spot.value()->spottercall)); - QLabel* frequency = new QLabel(QString("Frequency:%1 MHz").arg(spot.value()->frequency)); - QLabel* comment = new QLabel(QString("Comment:%1").arg(spot.value()->comment)); - QAbstractButton* bExit = new QPushButton("Close"); - vlayout->addWidget(dxcall); - vlayout->addWidget(spotter); - vlayout->addWidget(frequency); - vlayout->addWidget(comment); - vlayout->addWidget(bExit); - spotDialog->setLayout(vlayout); - spotDialog->show(); - spotDialog->connect(bExit, SIGNAL(clicked()), spotDialog, SLOT(close())); - } + QCPItemText* textItem = plot->itemAt(me->pos(), true); + if (me->button() == Qt::RightButton && textItem != nullptr) { + QMap::iterator spot = clusterSpots.find(textItem->text()); + if (spot != clusterSpots.end() && spot.key() == textItem->text()) { + /* parent and children are destroyed on close */ + QDialog* spotDialog = new QDialog(); + QVBoxLayout* vlayout = new QVBoxLayout; + //spotDialog->setFixedSize(240, 100); + spotDialog->setBaseSize(1, 1); + spotDialog->setWindowTitle(spot.value()->dxcall); + QLabel* dxcall = new QLabel(QString("DX:%1").arg(spot.value()->dxcall)); + QLabel* spotter = new QLabel(QString("Spotter:%1").arg(spot.value()->spottercall)); + QLabel* frequency = new QLabel(QString("Frequency:%1 MHz").arg(spot.value()->frequency)); + QLabel* comment = new QLabel(QString("Comment:%1").arg(spot.value()->comment)); + QAbstractButton* bExit = new QPushButton("Close"); + vlayout->addWidget(dxcall); + vlayout->addWidget(spotter); + vlayout->addWidget(frequency); + vlayout->addWidget(comment); + vlayout->addWidget(bExit); + spotDialog->setLayout(vlayout); + spotDialog->show(); + spotDialog->connect(bExit, SIGNAL(clicked()), spotDialog, SLOT(close())); } } - else { + else if (me->button() == Qt::LeftButton && textItem != nullptr) + { + QMap::iterator spot = clusterSpots.find(textItem->text()); + if (spot != clusterSpots.end() && spot.key() == textItem->text()) + { + freqt freqGo; + freqGo.Hz = ( spot.value()->frequency)*1E6; + freqGo.MHzDouble = spot.value()->frequency; + issueCmdUniquePriority(cmdSetFreq, freqGo); + } + } + else + { double x = plot->xAxis->pixelToCoord(me->pos().x()); showStatusBarText(QString("Selected %1 MHz").arg(x)); this->mousePressFreq = x; @@ -4158,7 +4167,8 @@ void wfmain::handlePlotClick(QMouseEvent* me) void wfmain::handlePlotMouseRelease(QMouseEvent* me) { - if (me->button() != Qt::RightButton) { + QCPItemText* textItem = plot->itemAt(me->pos(), true); + if (textItem == nullptr) { this->mouseReleaseFreq = plot->xAxis->pixelToCoord(me->pos().x()); double delta = mouseReleaseFreq - mousePressFreq; qInfo(logGui()) << "Mouse release delta: " << delta; From 22abc65849cbd20efdb16842f98de3f67d65343e Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sun, 9 Oct 2022 14:23:07 +0100 Subject: [PATCH 153/207] Add cluster spot color picker --- cluster.cpp | 8 ++++---- colorprefs.h | 4 ++++ wfmain.cpp | 32 +++++++++++++++++++++++++++++--- wfmain.h | 5 +++++ wfmain.ui | 47 ++++++++++++++++++++++++++++++++++++++++------- 5 files changed, 82 insertions(+), 14 deletions(-) diff --git a/cluster.cpp b/cluster.cpp index a22965e..9112f51 100644 --- a/cluster.cpp +++ b/cluster.cpp @@ -122,7 +122,6 @@ void dxClusterClient::udpDataReceived() QString query = QString("INSERT INTO spots(type,spottercall,frequency,dxcall,mode,comment,timestamp) VALUES('%1','%2',%3,'%4','%5','%6','%7')\n") .arg("UDP").arg(data->spottercall).arg(data->frequency).arg(data->dxcall).arg(data->mode).arg(data->comment).arg(data->timestamp.toString("yyyy-MM-dd hh:mm:ss")); db.query(query); - emit sendOutput(query); #else bool found = false; QMap::iterator spot = allSpots.find(data->dxcall); @@ -134,6 +133,8 @@ void dxClusterClient::udpDataReceived() allSpots.insert(data->dxcall, data); } #endif + emit sendOutput(QString("add%1%2%3%4\n") + .arg(data->dxcall).arg(data->spottercall).arg(data->frequency).arg(data->comment)); } else if (action == "delete") @@ -154,6 +155,8 @@ void dxClusterClient::udpDataReceived() spot = allSpots.erase(spot); } #endif + emit sendOutput(QString("delete%1%3\n") + .arg(dxcall).arg(frequency)); } updateSpots(); } @@ -164,7 +167,6 @@ void dxClusterClient::udpDataReceived() void dxClusterClient::tcpDataReceived() { QString data = QString(tcpSocket->readAll()); - emit(sendOutput(data)); if (data.contains("login:")) { sendTcpData(QString("%1\n").arg(tcpUserName)); @@ -192,7 +194,6 @@ void dxClusterClient::tcpDataReceived() QString query = QString("INSERT INTO spots(type,spottercall,frequency,dxcall,comment,timestamp) VALUES('%1','%2',%3,'%4','%5','%6')\n") .arg("TCP").arg(data->spottercall).arg(data->frequency).arg(data->dxcall).arg(data->comment).arg(data->timestamp.toString("yyyy-MM-dd hh:mm:ss")); db.query(query); - emit sendOutput(query); #else bool found = false; QMap::iterator spot = allSpots.find(data->dxcall); @@ -203,7 +204,6 @@ void dxClusterClient::tcpDataReceived() if (found == false) { allSpots.insert(data->dxcall, data); } - #endif } } diff --git a/colorprefs.h b/colorprefs.h index 48a61d2..7e8ddd6 100644 --- a/colorprefs.h +++ b/colorprefs.h @@ -33,6 +33,10 @@ struct colorPrefsType{ QColor meterPeakScale; QColor meterLowerLine; QColor meterLowText; + + // Assorted + QColor clusterSpots; + }; diff --git a/wfmain.cpp b/wfmain.cpp index 00c6b7e..fadd945 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -1520,6 +1520,7 @@ void wfmain::loadSettings() p->meterPeakScale.setNamedColor(settings->value("meterPeakScale", p->meterPeakScale.name(QColor::HexArgb)).toString()); p->meterLowerLine.setNamedColor(settings->value("meterLowerLine", p->meterLowerLine.name(QColor::HexArgb)).toString()); p->meterLowText.setNamedColor(settings->value("meterLowText", p->meterLowText.name(QColor::HexArgb)).toString()); + p->clusterSpots.setNamedColor(settings->value("clusterSpots", p->clusterSpots.name(QColor::HexArgb)).toString()); } } settings->endArray(); @@ -2207,6 +2208,7 @@ void wfmain::saveSettings() settings->setValue("meterPeakLevel", p->meterPeakLevel.name(QColor::HexArgb)); settings->setValue("meterLowerLine", p->meterLowerLine.name(QColor::HexArgb)); settings->setValue("meterLowText", p->meterLowText.name(QColor::HexArgb)); + settings->setValue("clusterSpots", p->clusterSpots.name(QColor::HexArgb)); } settings->endArray(); settings->endGroup(); @@ -2884,6 +2886,8 @@ void wfmain::setDefaultColors(int presetNumber) p->wfGrid = QColor(Qt::white); p->wfText = QColor(Qt::white); + p->clusterSpots = QColor(Qt::red); + //qInfo(logSystem()) << "default color preset [" << pn << "] set to pn.presetNum index [" << p->presetNum << "]" << ", with name " << *(p->presetName); switch (presetNumber) @@ -2915,6 +2919,7 @@ void wfmain::setDefaultColors(int presetNumber) p->wfAxis = QColor(Qt::white); p->wfGrid = QColor("transparent"); p->wfText = QColor(Qt::white); + p->clusterSpots = QColor(Qt::red); break; } case 1: @@ -2942,6 +2947,7 @@ void wfmain::setDefaultColors(int presetNumber) p->wfAxis = QColor(200,200,200,255); p->wfGrid = QColor("transparent"); p->wfText = QColor(Qt::black); + p->clusterSpots = QColor(Qt::red); break; } @@ -6892,6 +6898,8 @@ void wfmain::useColorPreset(colorPrefsType *cp) ui->meterSPoWidget->setColors(cp->meterLevel, cp->meterPeakScale, cp->meterPeakLevel, cp->meterAverage, cp->meterLowerLine, cp->meterLowText); ui->meter2Widget->setColors(cp->meterLevel, cp->meterPeakScale, cp->meterPeakLevel, cp->meterAverage, cp->meterLowerLine, cp->meterLowText); + + clusterColor = cp->clusterSpots; } void wfmain::setColorButtonOperations(QColor *colorStore, @@ -7011,6 +7019,8 @@ void wfmain::loadColorPresetToUIandPlots(int presetNumber) setEditAndLedFromColor(p.wfAxis, ui->colorEditWfAxis, ui->colorSwatchWfAxis); setEditAndLedFromColor(p.wfText, ui->colorEditWfText, ui->colorSwatchWfText); + setEditAndLedFromColor(p.clusterSpots, ui->colorEditClusterSpots, ui->colorSwatchClusterSpots); + useColorPreset(&p); } @@ -7217,13 +7227,14 @@ void wfmain::on_colorEditWfAxis_editingFinished() void wfmain::on_colorSetBtnWfText_clicked() { int pos = ui->colorPresetCombo->currentIndex(); - QColor *c = &(colorPreset[pos].wfText); + QColor* c = &(colorPreset[pos].wfText); setColorButtonOperations(c, ui->colorEditWfText, ui->colorSwatchWfText); } + void wfmain::on_colorEditWfText_editingFinished() { int pos = ui->colorPresetCombo->currentIndex(); - QColor *c = &(colorPreset[pos].wfText); + QColor* c = &(colorPreset[pos].wfText); setColorLineEditOperations(c, ui->colorEditWfText, ui->colorSwatchWfText); } @@ -7339,6 +7350,20 @@ void wfmain::on_colorEditMeterText_editingFinished() setColorLineEditOperations(c, ui->colorEditMeterText, ui->colorSwatchMeterText); } +// Cluster Spots: +void wfmain::on_colorSetBtnClusterSpots_clicked() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor* c = &(colorPreset[pos].clusterSpots); + setColorButtonOperations(c, ui->colorEditClusterSpots, ui->colorSwatchClusterSpots); +} +void wfmain::on_colorEditClusterSpots_editingFinished() +{ + int pos = ui->colorPresetCombo->currentIndex(); + QColor* c = &(colorPreset[pos].clusterSpots); + setColorLineEditOperations(c, ui->colorEditClusterSpots, ui->colorSwatchClusterSpots); +} + // ---------- End color UI slots ----------// void wfmain::on_colorSavePresetBtn_clicked() @@ -7375,6 +7400,7 @@ void wfmain::on_colorSavePresetBtn_clicked() settings->setValue("meterPeakLevel", p->meterPeakLevel.name(QColor::HexArgb)); settings->setValue("meterLowerLine", p->meterLowerLine.name(QColor::HexArgb)); settings->setValue("meterLowText", p->meterLowText.name(QColor::HexArgb)); + settings->setValue("clusterSpots", p->clusterSpots.name(QColor::HexArgb)); settings->endArray(); settings->endGroup(); @@ -7703,7 +7729,7 @@ void wfmain::receiveSpots(QList spots) double top = rigCaps.spectAmpMax - 10; sp->text = new QCPItemText(plot); sp->text->setAntialiased(true); - sp->text->setColor(QColor(Qt::red)); + sp->text->setColor(clusterColor); sp->text->setText(sp->dxcall); sp->text->setFont(QFont(font().family(), 10)); sp->text->setPositionAlignment(Qt::AlignVCenter | Qt::AlignHCenter); diff --git a/wfmain.h b/wfmain.h index e4c9879..4adc43f 100644 --- a/wfmain.h +++ b/wfmain.h @@ -642,6 +642,10 @@ private slots: void on_colorEditMeterText_editingFinished(); + void on_colorSetBtnClusterSpots_clicked(); + + void on_colorEditClusterSpots_editingFinished(); + void on_colorRenamePresetBtn_clicked(); void on_colorRevertPresetBtn_clicked(); @@ -1076,6 +1080,7 @@ private: QCPItemText* text=Q_NULLPTR; QList clusters; QMutex clusterMutex; + QColor clusterColor; }; Q_DECLARE_METATYPE(struct rigCapabilities) diff --git a/wfmain.ui b/wfmain.ui index b127240..fdd0d9c 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -6,7 +6,7 @@ 0 0 - 1125 + 1023 660 @@ -2223,7 +2223,7 @@ - 5 + 1 @@ -3343,8 +3343,8 @@ 0 0 - 542 - 217 + 801 + 311 @@ -3998,6 +3998,39 @@ + + + + Cluster Spots + + + + + + + + 0 + 0 + + + + + 90 + 16777215 + + + + + + + + + 10 + 0 + + + + @@ -5205,7 +5238,7 @@ 0 0 - 1125 + 1023 21 @@ -5226,14 +5259,14 @@ QLedLabel QWidget -
qledlabel.h
+
qledlabel.h
1
- + From b7bcd58578715490fd97116e89ac7a8add8611ff Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sun, 9 Oct 2022 14:32:09 +0100 Subject: [PATCH 154/207] Add Pop-Out button for cluster screen --- wfmain.cpp | 34 ++++++++++++++++++++++++++++++++-- wfmain.h | 2 ++ wfmain.ui | 19 ++++++++++++++++++- 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index fadd945..adf7c1d 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6939,16 +6939,18 @@ void wfmain::setColorLineEditOperations(QColor *colorStore, void wfmain::on_colorPopOutBtn_clicked() { - if(settingsTabisAttached) + if (settingsTabisAttached) { settingsTab = ui->tabWidget->currentWidget(); ui->tabWidget->removeTab(ui->tabWidget->indexOf(settingsTab)); settingsWidgetTab->addTab(settingsTab, "Settings"); settingsWidgetWindow->show(); ui->colorPopOutBtn->setText("Re-attach"); + ui->clusterPopOutBtn->setText("Re-attach"); ui->tabWidget->setCurrentIndex(0); settingsTabisAttached = false; - } else { + } + else { settingsTab = settingsWidgetTab->currentWidget(); settingsWidgetTab->removeTab(settingsWidgetTab->indexOf(settingsTab)); @@ -6956,6 +6958,7 @@ void wfmain::on_colorPopOutBtn_clicked() settingsWidgetWindow->close(); ui->colorPopOutBtn->setText("Pop-Out"); + ui->clusterPopOutBtn->setText("Pop-Out"); ui->tabWidget->setCurrentIndex(3); settingsTabisAttached = true; } @@ -7777,3 +7780,30 @@ void wfmain::receiveSpots(QList spots) qDebug(logCluster()) << "Processing took" << timer.nsecsElapsed() / 1000 << "us"; } +void wfmain::on_clusterPopOutBtn_clicked() +{ + + if (settingsTabisAttached) + { + settingsTab = ui->tabWidget->currentWidget(); + ui->tabWidget->removeTab(ui->tabWidget->indexOf(settingsTab)); + settingsWidgetTab->addTab(settingsTab, "Settings"); + settingsWidgetWindow->show(); + ui->clusterPopOutBtn->setText("Re-attach"); + ui->colorPopOutBtn->setText("Re-attach"); + ui->tabWidget->setCurrentIndex(0); + settingsTabisAttached = false; + } + else { + settingsTab = settingsWidgetTab->currentWidget(); + + settingsWidgetTab->removeTab(settingsWidgetTab->indexOf(settingsTab)); + ui->tabWidget->addTab(settingsTab, "Settings"); + settingsWidgetWindow->close(); + + ui->clusterPopOutBtn->setText("Pop-Out"); + ui->colorPopOutBtn->setText("Pop-Out"); + ui->tabWidget->setCurrentIndex(3); + settingsTabisAttached = true; + } +} diff --git a/wfmain.h b/wfmain.h index 4adc43f..bf9097e 100644 --- a/wfmain.h +++ b/wfmain.h @@ -675,6 +675,8 @@ private slots: void on_clusterUsernameLineEdit_editingFinished(); void on_clusterPasswordLineEdit_editingFinished(); void on_clusterTimeoutLineEdit_editingFinished(); + void on_clusterPopOutBtn_clicked(); + void receiveClusterOutput(QString text); void receiveSpots(QList spots); diff --git a/wfmain.ui b/wfmain.ui index fdd0d9c..5c56f88 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -2223,7 +2223,7 @@ - 1 + 5 @@ -5067,10 +5067,27 @@ QAbstractScrollArea::AdjustIgnored + + + + 10 + 280 + 75 + 23 + + + + <html><head/><body><p>Pop out (or pop back in) the entire Settings tab. </p><p>NOTE: Press this button again to re-insert the tab when finished. </p></body></html> + + + Pop-Out + + groupBox_9 horizontalLayoutWidget groupBox_10 clusterOutputTextEdit + clusterPopOutBtn From 6862009e940e0580b47b734c4eadb87bf76a067d Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sun, 9 Oct 2022 14:35:24 +0100 Subject: [PATCH 155/207] Add sendOutput() back to tcp cluster --- cluster.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/cluster.cpp b/cluster.cpp index 9112f51..eaec4a2 100644 --- a/cluster.cpp +++ b/cluster.cpp @@ -168,6 +168,7 @@ void dxClusterClient::tcpDataReceived() { QString data = QString(tcpSocket->readAll()); + emit sendOutput(data); if (data.contains("login:")) { sendTcpData(QString("%1\n").arg(tcpUserName)); return; From 3ec54f1ebb2ad4e295d2e035f970a8fa3870f700 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sun, 9 Oct 2022 20:24:01 +0100 Subject: [PATCH 156/207] make spots appear at the actual top of wf --- wfmain.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index adf7c1d..2378476 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -4127,7 +4127,8 @@ void wfmain::handleWFDoubleClick(QMouseEvent *me) void wfmain::handlePlotClick(QMouseEvent* me) { - QCPItemText* textItem = plot->itemAt(me->pos(), true); + QCPAbstractItem* item = plot->itemAt(me->pos(), true); + QCPItemText* textItem = dynamic_cast (item); if (me->button() == Qt::RightButton && textItem != nullptr) { QMap::iterator spot = clusterSpots.find(textItem->text()); if (spot != clusterSpots.end() && spot.key() == textItem->text()) { @@ -4152,11 +4153,12 @@ void wfmain::handlePlotClick(QMouseEvent* me) spotDialog->connect(bExit, SIGNAL(clicked()), spotDialog, SLOT(close())); } } - else if (me->button() == Qt::LeftButton && textItem != nullptr) + else if (textItem != nullptr) { QMap::iterator spot = clusterSpots.find(textItem->text()); if (spot != clusterSpots.end() && spot.key() == textItem->text()) { + qInfo(logGui()) << "Clicked on spot:" << textItem->text(); freqt freqGo; freqGo.Hz = ( spot.value()->frequency)*1E6; freqGo.MHzDouble = spot.value()->frequency; @@ -4173,7 +4175,9 @@ void wfmain::handlePlotClick(QMouseEvent* me) void wfmain::handlePlotMouseRelease(QMouseEvent* me) { - QCPItemText* textItem = plot->itemAt(me->pos(), true); + QCPAbstractItem* item = plot->itemAt(me->pos(), true); + QCPItemText* textItem = dynamic_cast (item); + if (textItem == nullptr) { this->mouseReleaseFreq = plot->xAxis->pixelToCoord(me->pos().x()); double delta = mouseReleaseFreq - mousePressFreq; @@ -4184,7 +4188,9 @@ void wfmain::handlePlotMouseRelease(QMouseEvent* me) void wfmain::handlePlotMouseMove(QMouseEvent *me) { - if(me->buttons() == Qt::LeftButton) + QCPAbstractItem* item = plot->itemAt(me->pos(), true); + QCPItemText* textItem = dynamic_cast (item); + if(me->buttons() == Qt::LeftButton && textItem==nullptr) { double delta = plot->xAxis->pixelToCoord(me->pos().x()) - mousePressFreq; qInfo(logGui()) << "Mouse moving delta: " << delta; @@ -7729,7 +7735,8 @@ void wfmain::receiveSpots(QList spots) sp->current = true; bool conflict = true; double left = sp->frequency; - double top = rigCaps.spectAmpMax - 10; + QCPRange range=plot->yAxis->range(); + double top = range.upper-15.0; sp->text = new QCPItemText(plot); sp->text->setAntialiased(true); sp->text->setColor(clusterColor); @@ -7746,7 +7753,8 @@ void wfmain::receiveSpots(QList spots) sp->text->position->setCoords(left, top); sp->text->setVisible(false); while (conflict) { - QCPItemText* textItem = plot->itemAt(sp->text->position->pixelPosition(), true); + QCPAbstractItem* item = plot->itemAt(sp->text->position->pixelPosition(), true); + QCPItemText* textItem = dynamic_cast (item); if (textItem != nullptr && sp->text != textItem) { //qInfo(logGui()) << "CONFLICT:" << textItem->text() << "SAME POSITION AS" << sp->dxcall << sp->text->position->pixelPosition(); top = top - 5.0; From f4e25d22739a45e3d98f8cf9f2bdf15ff3ddef9a Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 10 Oct 2022 12:55:12 +0100 Subject: [PATCH 157/207] Bit more tidying of spotting code --- wfmain.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 2378476..eb08a58 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -7710,10 +7710,10 @@ void wfmain::receiveSpots(QList spots) QElapsedTimer timer; timer.start(); - QMap::iterator spot1 = clusterSpots.begin(); - while (spot1 != clusterSpots.end()) { - spot1.value()->current = false; - ++spot1; + bool current = false; + + if (clusterSpots.size() > 0) { + current=clusterSpots.begin().value()->current; } foreach(spotData s, spots) @@ -7722,7 +7722,7 @@ void wfmain::receiveSpots(QList spots) QMap::iterator spot = clusterSpots.find(s.dxcall); while (spot != clusterSpots.end() && spot.key() == s.dxcall && spot.value()->frequency == s.frequency) { - spot.value()->current = true; + spot.value()->current = !current; found = true; ++spot; } @@ -7732,7 +7732,7 @@ void wfmain::receiveSpots(QList spots) spotData* sp = new spotData(s); //qDebug(logCluster()) << "ADD:" << sp->dxcall; - sp->current = true; + sp->current = !current; bool conflict = true; double left = sp->frequency; QCPRange range=plot->yAxis->range(); @@ -7773,7 +7773,7 @@ void wfmain::receiveSpots(QList spots) QMap::iterator spot2 = clusterSpots.begin(); while (spot2 != clusterSpots.end()) { - if (spot2.value()->current == false) { + if (spot2.value()->current == current) { plot->removeItem(spot2.value()->text); //qDebug(logCluster()) << "REMOVE:" << spot2.value()->dxcall; delete spot2.value(); // Stop memory leak? From f8cef53a7dc1edcd658ab18128c9d893014eefc8 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Mon, 10 Oct 2022 17:11:05 +0200 Subject: [PATCH 158/207] added cluster support --- CHANGELOG | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ WHATSNEW | 5 ++--- wfserver.pro | 2 +- wfview.pro | 2 +- 4 files changed, 55 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1c53008..5152ccf 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,56 @@ # CHANGELOG + +- 20221010 + + bumped to version 1.52 + +- 20221011 + + make spots appear at the actual top of wf + + Add sendOutput() back to tcp cluster + + Add Pop-Out button for cluster screen + + Add cluster spot color picker + +- 20221008 + + Left click on spot to change freq + +- 20221006 + + Make spot window size to fit content. + + Add right-click on spot to popup dialog + +- 20221005 + + Bit of tidying + + Remove calls for QSqlDatabase when USESQL is not configured + + Add optional SQL in wfview.pro + + Make SQL db optional + + Remove old code + + Update query + + Add memory sqlite db for cluster spots. + +- 20220930 + + Delete all spots if cluster disabled + + Fix crash when adding cluster server + + Change default to isdefault! + + Add TCP spot client + - 20220929 Fix for squished screen diff --git a/WHATSNEW b/WHATSNEW index f7f88e9..627523a 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -2,9 +2,6 @@ The following highlights are in this 1.51-release ince v1.50: + 1.51 - - - Fix for squished screen Only request passband when there is a scope available Change default passband colors. @@ -19,6 +16,8 @@ The following highlights are in this 1.51-release ince v1.50: colorpicker: Move to 3 columns passband indicator Remove logging of audio device realm ++ 1.52 added cluster spotting including color picker suport + optional SQLITE in memory for spots (disabled) Notes: diff --git a/wfserver.pro b/wfserver.pro index 3b5e4c6..782379f 100644 --- a/wfserver.pro +++ b/wfserver.pro @@ -13,7 +13,7 @@ TEMPLATE = app CONFIG += console -DEFINES += WFVIEW_VERSION=\\\"1.51\\\" +DEFINES += WFVIEW_VERSION=\\\"1.52\\\" DEFINES += BUILD_WFSERVER diff --git a/wfview.pro b/wfview.pro index 3286eb7..ce40277 100644 --- a/wfview.pro +++ b/wfview.pro @@ -14,7 +14,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport TARGET = wfview TEMPLATE = app -DEFINES += WFVIEW_VERSION=\\\"1.51\\\" +DEFINES += WFVIEW_VERSION=\\\"1.52\\\" DEFINES += BUILD_WFVIEW From e15496e0b67093dde01e1b90083f28c9d15ccd8a Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Tue, 11 Oct 2022 13:17:23 +0100 Subject: [PATCH 159/207] Disable click/drag tuning by default --- wfmain.cpp | 17 ++++++++++++++--- wfmain.h | 2 ++ wfmain.ui | 11 +++++++++-- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index eb08a58..168dc1e 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -1473,6 +1473,8 @@ void wfmain::loadSettings() prefs.confirmExit = settings->value("ConfirmExit", defPrefs.confirmExit).toBool(); prefs.confirmPowerOff = settings->value("ConfirmPowerOff", defPrefs.confirmPowerOff).toBool(); prefs.meter2Type = static_cast(settings->value("Meter2Type", defPrefs.meter2Type).toInt()); + prefs.clickDragTuningEnable = settings->value("ClickDragTuning", false).toBool(); + ui->clickDragTuningEnableChk->setChecked(prefs.clickDragTuningEnable); settings->endGroup(); // Load in the color presets. The default values are already loaded. @@ -2112,6 +2114,8 @@ void wfmain::saveSettings() settings->setValue("ConfirmExit", prefs.confirmExit); settings->setValue("ConfirmPowerOff", prefs.confirmPowerOff); settings->setValue("Meter2Type", (int)prefs.meter2Type); + settings->setValue("ClickDragTuning", prefs.clickDragTuningEnable); + settings->endGroup(); // Radio and Comms: C-IV addr, port to use @@ -4165,7 +4169,7 @@ void wfmain::handlePlotClick(QMouseEvent* me) issueCmdUniquePriority(cmdSetFreq, freqGo); } } - else + else if (prefs.clickDragTuningEnable) { double x = plot->xAxis->pixelToCoord(me->pos().x()); showStatusBarText(QString("Selected %1 MHz").arg(x)); @@ -4178,7 +4182,7 @@ void wfmain::handlePlotMouseRelease(QMouseEvent* me) QCPAbstractItem* item = plot->itemAt(me->pos(), true); QCPItemText* textItem = dynamic_cast (item); - if (textItem == nullptr) { + if (textItem == nullptr && prefs.clickDragTuningEnable) { this->mouseReleaseFreq = plot->xAxis->pixelToCoord(me->pos().x()); double delta = mouseReleaseFreq - mousePressFreq; qInfo(logGui()) << "Mouse release delta: " << delta; @@ -4190,7 +4194,7 @@ void wfmain::handlePlotMouseMove(QMouseEvent *me) { QCPAbstractItem* item = plot->itemAt(me->pos(), true); QCPItemText* textItem = dynamic_cast (item); - if(me->buttons() == Qt::LeftButton && textItem==nullptr) + if(me->buttons() == Qt::LeftButton && textItem==nullptr && prefs.clickDragTuningEnable) { double delta = plot->xAxis->pixelToCoord(me->pos().x()) - mousePressFreq; qInfo(logGui()) << "Mouse moving delta: " << delta; @@ -7815,3 +7819,10 @@ void wfmain::on_clusterPopOutBtn_clicked() settingsTabisAttached = true; } } + +void wfmain::on_clickDragTuningEnableChk_clicked(bool checked) +{ + prefs.clickDragTuningEnable = checked; +} + + diff --git a/wfmain.h b/wfmain.h index bf9097e..826e902 100644 --- a/wfmain.h +++ b/wfmain.h @@ -677,6 +677,7 @@ private slots: void on_clusterTimeoutLineEdit_editingFinished(); void on_clusterPopOutBtn_clicked(); + void on_clickDragTuningEnableChk_clicked(bool checked); void receiveClusterOutput(QString text); void receiveSpots(QList spots); @@ -940,6 +941,7 @@ private: QString clusterTcpUserName; QString clusterTcpPassword; int clusterTimeout; + bool clickDragTuningEnable; } prefs; preferences defPrefs; diff --git a/wfmain.ui b/wfmain.ui index 5c56f88..f99aae4 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -2223,7 +2223,7 @@ - 5 + 1 @@ -2915,6 +2915,13 @@ + + + + Allow tuning via click and drag (experimental) + + + @@ -5283,7 +5290,7 @@ - + From ce12135c4a89fe347c5cc4b05fbb41b24d042726 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Fri, 14 Oct 2022 17:48:35 +0200 Subject: [PATCH 160/207] bands page reorganized --- wfmain.ui | 198 +++++++++++++++++++++++++++--------------------------- 1 file changed, 99 insertions(+), 99 deletions(-) diff --git a/wfmain.ui b/wfmain.ui index f99aae4..811e504 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -18,7 +18,7 @@ - 3 + 1 @@ -1231,7 +1231,7 @@ 0 - + 0 @@ -1245,15 +1245,12 @@ - 23cm - - - + 2200m - + 0 @@ -1267,15 +1264,12 @@ - 70cm - - - U + 630m - + 0 @@ -1289,15 +1283,15 @@ - 2m + 160m - V + L - + 0 @@ -1311,54 +1305,10 @@ - Air + 80m - A - - - - - - - - 0 - 0 - - - - - 16777215 - 128 - - - - WFM - - - W - - - - - - - - 0 - 0 - - - - - 16777215 - 128 - - - - 4m - - - $ + 8 @@ -1367,7 +1317,7 @@ - + 0 @@ -1381,15 +1331,15 @@ - 6m + 60m - 6 + S - + 0 @@ -1403,15 +1353,15 @@ - 10m + 40m - 1 + 4 - + 0 @@ -1425,15 +1375,15 @@ - 12m + 30m - T + 3 - + 0 @@ -1447,10 +1397,10 @@ - 15m + 20m - 5 + 2 @@ -1481,7 +1431,7 @@ - + 0 @@ -1495,15 +1445,15 @@ - 20m + 15m - 2 + 5 - + 0 @@ -1517,15 +1467,15 @@ - 30m + 12m - 3 + T - + 0 @@ -1539,10 +1489,10 @@ - 40m + 10m - 4 + 1 @@ -1551,7 +1501,7 @@ - + 0 @@ -1565,15 +1515,15 @@ - 60m + 6m - S + 6 - + 0 @@ -1587,15 +1537,15 @@ - 80m + 4m - 8 + $ - + 0 @@ -1609,15 +1559,15 @@ - 160m + 2m - L + V - + 0 @@ -1631,7 +1581,32 @@ - 630m + 70cm + + + U + + + + + + + + 0 + 0 + + + + + 16777215 + 128 + + + + 23cm + + + @@ -1640,7 +1615,7 @@ - + 0 @@ -1654,7 +1629,32 @@ - 2200m + WFM + + + W + + + + + + + + 0 + 0 + + + + + 16777215 + 128 + + + + Air + + + A @@ -3350,8 +3350,8 @@ 0 0 - 801 - 311 + 799 + 269 @@ -4972,7 +4972,7 @@ 20 40 271 - 181 + 186 @@ -5263,7 +5263,7 @@ 0 0 1023 - 21 + 23 From 6609aa58d9fadbc6d4b6df2689a1d509069a5d88 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Sat, 22 Oct 2022 14:48:44 +0200 Subject: [PATCH 161/207] added qt xml dev lib for suse --- INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index 70612cc..4a87066 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -78,7 +78,7 @@ install wfview on suse 15.3 & up, sles 15.x or tumbleweed; this was done on a cl we need to add packages to be able to build the stuff. - sudo zypper in --type pattern devel_basis -- sudo zypper in libQt5Widgets-devel libqt5-qtbase-common-devel libqt5-qtserialport-devel libQt5SerialPort5 qcustomplot-devel libqcustomplot2 libQt5PrintSupport-devel libqt5-qtmultimedia-devel lv2-devel libopus-devel eigen3-devel +- sudo zypper in libQt5Widgets-devel libqt5-qtbase-common-devel libqt5-qtserialport-devel libQt5SerialPort5 qcustomplot-devel libqcustomplot2 libQt5PrintSupport-devel libqt5-qtmultimedia-devel lv2-devel libopus-devel eigen3-devel libQt5Xml-devel optional (mainly for development specifics): get and install qt5: From 16dd595f52ef122e694b89d6822e2a2a6e6f8baa Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sun, 23 Oct 2022 22:45:11 +0100 Subject: [PATCH 162/207] Try new universal resize code --- wfmain.cpp | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 168dc1e..cbc65c0 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6363,6 +6363,8 @@ void wfmain::setAudioDevicesUI() int defaultAudioInputIndex = 0; int defaultAudioOutputIndex = 0; + int numCharsIn = 0; + int numCharsOut = 0; ui->audioInputCombo->setCurrentIndex(-1); ui->audioOutputCombo->setCurrentIndex(-1); @@ -6387,6 +6389,8 @@ void wfmain::setAudioDevicesUI() #endif ui->audioInputCombo->addItem(deviceInfo.deviceName().toLocal8Bit(), QVariant::fromValue(deviceInfo)); ui->serverRXAudioInputCombo->addItem(deviceInfo.deviceName().toLocal8Bit(), QVariant::fromValue(deviceInfo)); + if (deviceInfo.deviceName().size() > numCharsIn) + numCharsIn = deviceInfo.deviceName().size(); #ifdef Q_OS_WIN } #endif @@ -6403,6 +6407,9 @@ void wfmain::setAudioDevicesUI() #endif ui->audioOutputCombo->addItem(deviceInfo.deviceName().toLocal8Bit(), QVariant::fromValue(deviceInfo)); ui->serverTXAudioOutputCombo->addItem(deviceInfo.deviceName().toLocal8Bit(), QVariant::fromValue(deviceInfo)); + if (deviceInfo.deviceName().size() > numCharsOut) + numCharsOut = deviceInfo.deviceName().size(); + #ifdef Q_OS_WIN } #endif @@ -6436,6 +6443,9 @@ void wfmain::setAudioDevicesUI() ui->audioInputCombo->addItem(QString(info->name).toLocal8Bit(), i); ui->serverRXAudioInputCombo->addItem(QString(info->name).toLocal8Bit(), i); + if (QString(info->name).size() > numCharsIn) + numCharsIn = QString(info->name).size(); + if (i == Pa_GetDefaultInputDevice()) { defaultAudioInputName = info->name; } @@ -6444,6 +6454,8 @@ void wfmain::setAudioDevicesUI() qDebug(logAudio()) << (i == Pa_GetDefaultOutputDevice() ? "*" : " ") << "(" << i << ") Output Device : " << QString(info->name).toLocal8Bit(); ui->audioOutputCombo->addItem(QString(info->name).toLocal8Bit(), i); ui->serverTXAudioOutputCombo->addItem(QString(info->name).toLocal8Bit(), i); + if (QString(info->name).size() > numCharsOut) + numCharsOut = QString(info->name).size(); if (i == Pa_GetDefaultOutputDevice()) { defaultAudioOutputName = info->name; } @@ -6499,6 +6511,9 @@ void wfmain::setAudioDevicesUI() qInfo(logAudio()) << (info.isDefaultInput ? "*" : " ") << "(" << i << ") Input Device : " << QString::fromStdString(info.name).toLocal8Bit(); ui->audioInputCombo->addItem(QString::fromStdString(info.name).toLocal8Bit(), i); ui->serverRXAudioInputCombo->addItem(QString::fromStdString(info.name).toLocal8Bit(), i); + if (QString::fromStdString(info.name).size() > numCharsIn) + numCharsIn = QString::fromStdString(info.name).size(); + if (info.isDefaultInput) { defaultAudioInputName = QString::fromStdString(info.name).toLocal8Bit(); } @@ -6507,6 +6522,8 @@ void wfmain::setAudioDevicesUI() qInfo(logAudio()) << (info.isDefaultOutput ? "*" : " ") << "(" << i << ") Output Device : " << QString::fromStdString(info.name).toLocal8Bit(); ui->audioOutputCombo->addItem(QString::fromStdString(info.name).toLocal8Bit(), i); ui->serverTXAudioOutputCombo->addItem(QString::fromStdString(info.name).toLocal8Bit(), i); + if (QString::fromStdString(info.name).size() > numCharsOut) + numCharsOut = QString::fromStdString(info.name).size(); if (info.isDefaultOutput) { defaultAudioOutputName = QString::fromStdString(info.name).toLocal8Bit(); } @@ -6521,12 +6538,13 @@ void wfmain::setAudioDevicesUI() // Make the audio comboboxes expand when clicked (only needed for Windows) -#ifdef Q_OS_WIN - ui->audioInputCombo->setStyleSheet("QComboBox QAbstractItemView {min-width: 300px;}"); - ui->audioOutputCombo->setStyleSheet("QComboBox QAbstractItemView {min-width: 300px;}"); - ui->serverTXAudioOutputCombo->setStyleSheet("QComboBox QAbstractItemView {min-width: 300px;}"); - ui->serverRXAudioInputCombo->setStyleSheet("QComboBox QAbstractItemView {min-width: 300px;}"); -#endif +//#ifdef Q_OS_WIN + ui->audioInputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsIn*6)); + ui->audioOutputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsOut*6)); + ui->serverTXAudioOutputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsOut*6)); + ui->serverRXAudioInputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsIn*6)); +//#endif + // Stop blocking signals so we can set the current values ui->audioInputCombo->blockSignals(false); From e2338edde6ee75243d4cc8b64b4f624e50c51eba Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sun, 23 Oct 2022 22:58:23 +0100 Subject: [PATCH 163/207] Resize based on font size --- wfmain.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index cbc65c0..a75e84b 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6536,14 +6536,13 @@ void wfmain::setAudioDevicesUI() } + const QFont comboFont = ui->audioInputCombo->font(); // Make the audio comboboxes expand when clicked (only needed for Windows) -//#ifdef Q_OS_WIN - ui->audioInputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsIn*6)); - ui->audioOutputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsOut*6)); - ui->serverTXAudioOutputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsOut*6)); - ui->serverRXAudioInputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsIn*6)); -//#endif + ui->audioInputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsIn* (comboFont.pointSize() - 2))); + ui->audioOutputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsOut* (comboFont.pointSize() - 2))); + ui->serverTXAudioOutputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsOut* (comboFont.pointSize() - 2))); + ui->serverRXAudioInputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsIn* (comboFont.pointSize() - 2))); // Stop blocking signals so we can set the current values From ce9ab6d7ff4c5a5a1d052c9f3496cf5c56508268 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sun, 23 Oct 2022 23:45:53 +0100 Subject: [PATCH 164/207] Resize according to boundingrect --- wfmain.cpp | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index a75e84b..a729e27 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6365,6 +6365,7 @@ void wfmain::setAudioDevicesUI() int defaultAudioOutputIndex = 0; int numCharsIn = 0; int numCharsOut = 0; + QFontMetrics fm(ui->audioInputCombo->font()); ui->audioInputCombo->setCurrentIndex(-1); ui->audioOutputCombo->setCurrentIndex(-1); @@ -6389,8 +6390,8 @@ void wfmain::setAudioDevicesUI() #endif ui->audioInputCombo->addItem(deviceInfo.deviceName().toLocal8Bit(), QVariant::fromValue(deviceInfo)); ui->serverRXAudioInputCombo->addItem(deviceInfo.deviceName().toLocal8Bit(), QVariant::fromValue(deviceInfo)); - if (deviceInfo.deviceName().size() > numCharsIn) - numCharsIn = deviceInfo.deviceName().size(); + if (fm.boundingRect(deviceInfo.deviceName()).width() > numCharsIn) + numCharsIn = fm.boundingRect(deviceInfo.deviceName()).width(); #ifdef Q_OS_WIN } #endif @@ -6407,8 +6408,8 @@ void wfmain::setAudioDevicesUI() #endif ui->audioOutputCombo->addItem(deviceInfo.deviceName().toLocal8Bit(), QVariant::fromValue(deviceInfo)); ui->serverTXAudioOutputCombo->addItem(deviceInfo.deviceName().toLocal8Bit(), QVariant::fromValue(deviceInfo)); - if (deviceInfo.deviceName().size() > numCharsOut) - numCharsOut = deviceInfo.deviceName().size(); + if (fm.boundingRect(deviceInfo.deviceName()).width() > numCharsOut) + numCharsOut = fm.boundingRect(deviceInfo.deviceName()).width(); #ifdef Q_OS_WIN } @@ -6443,8 +6444,9 @@ void wfmain::setAudioDevicesUI() ui->audioInputCombo->addItem(QString(info->name).toLocal8Bit(), i); ui->serverRXAudioInputCombo->addItem(QString(info->name).toLocal8Bit(), i); - if (QString(info->name).size() > numCharsIn) - numCharsIn = QString(info->name).size(); + + if (fm.boundingRect(QString(info->name)).width() > numCharsIn) + numCharsIn = fm.boundingRect(QString(info->name)).width(); if (i == Pa_GetDefaultInputDevice()) { defaultAudioInputName = info->name; @@ -6454,8 +6456,10 @@ void wfmain::setAudioDevicesUI() qDebug(logAudio()) << (i == Pa_GetDefaultOutputDevice() ? "*" : " ") << "(" << i << ") Output Device : " << QString(info->name).toLocal8Bit(); ui->audioOutputCombo->addItem(QString(info->name).toLocal8Bit(), i); ui->serverTXAudioOutputCombo->addItem(QString(info->name).toLocal8Bit(), i); - if (QString(info->name).size() > numCharsOut) - numCharsOut = QString(info->name).size(); + + if (fm.boundingRect(QString(info->name)).width() > numCharsOut) + numCharsOut = fm.boundingRect(QString(info->name)).width(); + if (i == Pa_GetDefaultOutputDevice()) { defaultAudioOutputName = info->name; } @@ -6511,8 +6515,9 @@ void wfmain::setAudioDevicesUI() qInfo(logAudio()) << (info.isDefaultInput ? "*" : " ") << "(" << i << ") Input Device : " << QString::fromStdString(info.name).toLocal8Bit(); ui->audioInputCombo->addItem(QString::fromStdString(info.name).toLocal8Bit(), i); ui->serverRXAudioInputCombo->addItem(QString::fromStdString(info.name).toLocal8Bit(), i); - if (QString::fromStdString(info.name).size() > numCharsIn) - numCharsIn = QString::fromStdString(info.name).size(); + + if (fm.boundingRect(QString::fromStdString(info.name)).width() > numCharsIn) + numCharsIn = fm.boundingRect(QString::fromStdString(info.name)).width(); if (info.isDefaultInput) { defaultAudioInputName = QString::fromStdString(info.name).toLocal8Bit(); @@ -6522,8 +6527,10 @@ void wfmain::setAudioDevicesUI() qInfo(logAudio()) << (info.isDefaultOutput ? "*" : " ") << "(" << i << ") Output Device : " << QString::fromStdString(info.name).toLocal8Bit(); ui->audioOutputCombo->addItem(QString::fromStdString(info.name).toLocal8Bit(), i); ui->serverTXAudioOutputCombo->addItem(QString::fromStdString(info.name).toLocal8Bit(), i); - if (QString::fromStdString(info.name).size() > numCharsOut) - numCharsOut = QString::fromStdString(info.name).size(); + + if (fm.boundingRect(QString::fromStdString(info.name)).width() > numCharsOut) + numCharsOut = fm.boundingRect(QString::fromStdString(info.name)).width(); + if (info.isDefaultOutput) { defaultAudioOutputName = QString::fromStdString(info.name).toLocal8Bit(); } @@ -6535,14 +6542,13 @@ void wfmain::setAudioDevicesUI() } } - - const QFont comboFont = ui->audioInputCombo->font(); // Make the audio comboboxes expand when clicked (only needed for Windows) - ui->audioInputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsIn* (comboFont.pointSize() - 2))); - ui->audioOutputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsOut* (comboFont.pointSize() - 2))); - ui->serverTXAudioOutputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsOut* (comboFont.pointSize() - 2))); - ui->serverRXAudioInputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsIn* (comboFont.pointSize() - 2))); + qInfo() << "**** INPUT WIDTH" << numCharsIn << "OUTPUT WIDTH" << numCharsOut; + ui->audioInputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsIn+4)); + ui->audioOutputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsOut+4)); + ui->serverTXAudioOutputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsOut+4)); + ui->serverRXAudioInputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsIn+4)); // Stop blocking signals so we can set the current values From 034ec9066236c2fbd00df3ef0ba2704d51d853aa Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 24 Oct 2022 00:09:18 +0100 Subject: [PATCH 165/207] Stop it cutting off some devices --- wfmain.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index a729e27..e49497b 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6544,11 +6544,10 @@ void wfmain::setAudioDevicesUI() } // Make the audio comboboxes expand when clicked (only needed for Windows) - qInfo() << "**** INPUT WIDTH" << numCharsIn << "OUTPUT WIDTH" << numCharsOut; - ui->audioInputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsIn+4)); - ui->audioOutputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsOut+4)); - ui->serverTXAudioOutputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsOut+4)); - ui->serverRXAudioInputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsIn+4)); + ui->audioInputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsIn+30)); + ui->audioOutputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsOut+30)); + ui->serverTXAudioOutputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsOut+30)); + ui->serverRXAudioInputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsIn+30)); // Stop blocking signals so we can set the current values From 103dc9c86adff640722557f2bf770cab06ac1575 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Tue, 25 Oct 2022 08:25:02 +0200 Subject: [PATCH 166/207] combobox resizing fix --- CHANGELOG | 16 ++++++++++++++++ WHATSNEW | 5 +++++ 2 files changed, 21 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 5152ccf..31769ea 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,22 @@ # CHANGELOG +- 20221025 + + combobox: Stop it cutting off some devices + Resize according to boundingrect + Resize based on font size + Try new universal resize code + +- 20221022 + + added qt xml dev lib for suse + +- 20221014 + + bands page reorganized + + - 20221010 bumped to version 1.52 diff --git a/WHATSNEW b/WHATSNEW index 627523a..c40f907 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -19,6 +19,11 @@ The following highlights are in this 1.51-release ince v1.50: + 1.52 added cluster spotting including color picker suport optional SQLITE in memory for spots (disabled) ++ 1.xx modified band buttons to look more alike the layut on the rigs + audio selction combobox shows full devicenames + + + Notes: - We know about high CPU usage on RPi. From 3a07830d47b0b8d8a3b2035e0a54a936c17187d6 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 28 Oct 2022 20:04:14 +0100 Subject: [PATCH 167/207] Add passband to rigctld and allow setting --- rigcommander.cpp | 149 +++++++++++++++++++++++++++++++++++++++-- rigcommander.h | 3 +- rigctld.cpp | 112 +++++++++++++++++++------------ rigstate.h | 26 +++---- wfmain.cpp | 10 +-- wfmain.h | 2 +- wfview.pro | 1 + wfview.vcxproj | 13 ++-- wfview.vcxproj.filters | 9 +++ 9 files changed, 251 insertions(+), 74 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index 1d2a30e..d799ebe 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -760,11 +760,11 @@ void rigCommander::setMode(mode_info m) { QByteArray payload; - if(rigCaps.model==model706) + if (rigCaps.model == model706) { m.filter = '\x01'; } - if(m.mk == modeWFM) + if (m.mk == modeWFM) { m.filter = '\x01'; } @@ -872,6 +872,42 @@ void rigCommander::getDuplexMode() prepDataAndSend(payload); } +void rigCommander::setPassband(quint16 pass) +{ + QByteArray payload; + payload.setRawData("\x1A\x03", 2); + + unsigned char calc; + /* + Mode Data Steps + SSB/CW/RTTY/PSK 0 to 9 50 ~ 500 Hz (50 Hz) + SSB/CW/PSK 10 to 40 600 Hz ~ 3.6 kHz (100 Hz) + RTTY 10 to 31 600 ~ 2.7 kHz (100 Hz) + AM 0 to 49 200 Hz ~ 10.0 kHz (200 Hz) + */ + if (state.getChar(MODE) == modeAM) { // AM 0-49 + + calc = quint16((pass / 200) - 1); + } + else if (pass >= 600 || pass <=3600) // SSB/CW/PSK 10-40 (10-31 for RTTY) + { + calc = quint16((pass / 100) + 4); + } + else { // SSB etc 0-9 + calc = quint16((pass / 50) - 1); + } + + qDebug() << "Setting rig passband" << pass << "Sending" << calc; + + char tens = (calc / 10); + char units = (calc - (10 * tens)); + + char b1 = (units) | (tens << 4); + + payload.append(b1); + prepDataAndSend(payload); +} + void rigCommander::getPassband() { QByteArray payload; @@ -2512,19 +2548,41 @@ void rigCommander::parseRegisters1A() switch(payloadIn[01]) { case '\x00': + { // Memory contents break; + } case '\x01': + { // band stacking register parseBandStackReg(); break; + } case '\x03': - emit havePassband(bcdHexToUChar((quint8)payloadIn[2])); + { + quint16 calc; + quint8 pass = bcdHexToUChar((quint8)payloadIn[2]); + if (state.getChar(MODE) == modeAM) { + calc = 200 + (pass * 200); + } + else if (pass <= 10) + { + calc = 50 + (pass * 50); + } + else { + calc = 600 + ((pass - 10) * 100); + } + emit havePassband(calc); + state.set(PASSBAND, calc, false); break; + } case '\x04': + { state.set(AGC, (quint8)payloadIn[2], false); break; + } case '\x06': + { // data mode // emit havedataMode( (bool) payloadIn[somebit]) // index @@ -2536,13 +2594,20 @@ void rigCommander::parseRegisters1A() emit haveDataMode((bool)payloadIn[03]); state.set(DATAMODE, (quint8)payloadIn[3], false); break; + } case '\x07': + { // IP+ status break; + } case '\x09': + { state.set(MUTEFUNC, (quint8)payloadIn[2], false); + } default: + { break; + } } } @@ -4084,9 +4149,73 @@ void rigCommander::parseMode() } else { filter = 0; } - emit haveMode((unsigned char)payloadIn[01], filter); - state.set(MODE,(unsigned char)payloadIn[01],false); - state.set(FILTER,filter,false); + unsigned char mode = (unsigned char)payloadIn[01]; + emit haveMode(mode, filter); + state.set(MODE,mode,false); + state.set(FILTER, filter, false); + quint16 pass = 0; + + if (!state.isValid(PASSBAND)) { + + /* We haven't got a valid passband from the rig so we + need to create a 'fake' one from default values + This will be replaced with a valid one if we get it */ + + if (mode == 3 || mode == 7 || mode == 12 || mode == 17) { + switch (filter) { + case 1: + pass=1200; + case 2: + pass=500; + case 3: + pass=250; + } + } + else if (mode == 4 || mode == 8) + { + switch (filter) { + case 1: + pass=2400; + case 2: + pass=500; + case 3: + pass=250; + } + } + else if (mode == 2) + { + switch (filter) { + case 1: + pass=9000; + case 2: + pass=6000; + case 3: + pass=3000; + } + } + else if (mode == 5) + { + switch (filter) { + case 1: + pass=15000; + case 2: + pass=10000; + case 3: + pass=7000; + } + } + else { // SSB or unknown mode + switch (filter) { + case 1: + pass=3000; + case 2: + pass=2400; + case 3: + pass=1800; + } + } + } + state.set(PASSBAND, pass, false); } @@ -4433,11 +4562,17 @@ void rigCommander::stateUpdated() break; case MODE: case FILTER: - if (i.value()._valid) { + if (state.isValid(MODE) && state.isValid(FILTER)) { setMode(state.getChar(MODE), state.getChar(FILTER)); } getMode(); break; + case PASSBAND: + if (i.value()._valid && state.isValid(MODE)) { + setPassband(state.getUInt16(PASSBAND)); + } + getPassband(); + break; case DUPLEX: if (i.value()._valid) { setDuplexMode(state.getDuplex(DUPLEX)); diff --git a/rigcommander.h b/rigcommander.h index 3655e41..cbd475d 100644 --- a/rigcommander.h +++ b/rigcommander.h @@ -123,6 +123,7 @@ public slots: void getRitValue(); void setRitValue(int ritValue); void setRitEnable(bool ritEnabled); + void setPassband(quint16 pass); // PTT, ATU, ATT, Antenna, and Preamp: void getPTT(); @@ -323,7 +324,7 @@ signals: void haveBandStackReg(freqt f, char mode, char filter, bool dataOn); void haveRitEnabled(bool ritEnabled); void haveRitFrequency(int ritHz); - void havePassband(quint8 pass); + void havePassband(quint16 pass); // Repeater: void haveDuplexMode(duplexMode); diff --git a/rigctld.cpp b/rigctld.cpp index ce05783..d76c2fa 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -325,8 +325,8 @@ void rigCtlClient::socketReadyRead() response.append(resp); resp = ""; response.append(QString("%1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE)))); - response.append(QString("%1").arg(getFilter(rigState->getChar(MODE), rigState->getChar(FILTER)))); - + response.append(QString("%1").arg(rigState->getUInt16(PASSBAND))); + if (rigState->getChar(CURRENTVFO) == 0) { resp.append("VFOA"); } @@ -438,9 +438,12 @@ void rigCtlClient::socketReadyRead() if (rigState->getChar(CURRENTVFO) == 0) { resp.append("VFOA"); } - else { + else if (rigState->getChar(CURRENTVFO) == 1) { resp.append("VFOB"); } + else if (rigState->getChar(CURRENTVFO) == 2) { + resp.append("MEM"); + } response.append(resp); } @@ -455,11 +458,17 @@ void rigCtlClient::socketReadyRead() response.append("Main"); response.append("MEM"); } - else if (command[1] == "VFOB" || command[1] == "Sub") { + else if (command[1] == "VFOA" || command[1] == "Main") + { + rigState->set(CURRENTVFO, (quint8)0, true); + } + else if (command[1] == "VFOB" || command[1] == "Sub") + { rigState->set(CURRENTVFO, (quint8)1, true); } - else { - rigState->set(CURRENTVFO, (quint8)0, true); + else if (command[1] == "MEM") + { + rigState->set(CURRENTVFO, (quint8)2, true); } } else if (command[0] == "s" || command[0] == "get_split_vfo") @@ -519,7 +528,8 @@ void rigCtlClient::socketReadyRead() response.append(QString("Freq: %1").arg(rigState->getInt64(VFOAFREQ))); } response.append(QString("Mode: %1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE)))); - response.append(QString("Width: %1").arg(getFilter(rigState->getChar(MODE), rigState->getChar(FILTER)))); + response.append(QString("Width: %1").arg(rigState->getUInt16(PASSBAND))); + response.append(QString("Split: %1").arg(rigState->getDuplex(DUPLEX))); response.append(QString("SatMode: %1").arg(0)); // Need to get satmode } @@ -531,7 +541,8 @@ void rigCtlClient::socketReadyRead() response.append(QString("%1").arg(rigState->getInt64(VFOAFREQ))); } response.append(QString("%1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE)))); - response.append(QString("%1").arg(getFilter(rigState->getChar(MODE), rigState->getChar(FILTER)))); + response.append(QString("%1").arg(rigState->getUInt16(PASSBAND))); + } } else if (command[0] == "i" || command[0] == "get_split_freq") @@ -570,11 +581,11 @@ void rigCtlClient::socketReadyRead() { if (longReply) { response.append(QString("TX Mode: %1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE)))); - response.append(QString("TX Passband: %1").arg(getFilter(rigState->getChar(MODE), rigState->getChar(FILTER)))); + response.append(QString("TX Passband: %1").arg(rigState->getUInt16(PASSBAND))); } else { response.append(QString("%1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE)))); - response.append(QString("%1").arg(getFilter(rigState->getChar(MODE), rigState->getChar(FILTER)))); + response.append(QString("%1").arg(rigState->getUInt16(PASSBAND))); } } @@ -582,45 +593,60 @@ void rigCtlClient::socketReadyRead() { if (longReply) { response.append(QString("TX Mode: %1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE)))); - response.append(QString("TX Passband: %1").arg(getFilter(rigState->getChar(MODE), rigState->getChar(FILTER)))); + response.append(QString("TX Passband: %1").arg(rigState->getUInt16(PASSBAND))); } else { response.append(QString("%1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE)))); - response.append(QString("%1").arg(getFilter(rigState->getChar(MODE), rigState->getChar(FILTER)))); + response.append(QString("%1").arg(rigState->getUInt16(PASSBAND))); } + qDebug(logRigCtlD()) << QString("get_mode: %1 passband: %2").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE))).arg(rigState->getUInt16(PASSBAND)); } else if (command[0] == "M" || command[0] == "set_mode") { // Set mode setCommand = true; - int width = -1; + quint8 width = 0; + quint16 passband = 0; QString vfo = "VFOA"; QString mode = "USB"; if (command.length() == 3) { - width = command[2].toInt(); + passband = command[2].toInt(); mode = command[1]; } else if (command.length() == 4) { - width = command[3].toInt(); + passband = command[3].toInt(); mode = command[2]; vfo = command[1]; } - qDebug(logRigCtlD()) << "setting mode: VFO:" << vfo << getMode(mode) << mode << "width" << width; + qDebug(logRigCtlD()) << "setting mode: VFO:" << vfo << getMode(mode) << mode << "passband" << passband << "command:" << commands; - if (width != -1 && width <= 1800) - width = 2; - else - width = 1; - - rigState->set(MODE,getMode(mode),true); - rigState->set(FILTER,(quint8)width, true); - if (mode.mid(0, 3) == "PKT") { - rigState->set(DATAMODE, true, true); + if (!mode.isEmpty()) + { + rigState->set(MODE, getMode(mode), true); + if (mode.mid(0, 3) == "PKT") { + rigState->set(DATAMODE, true, true); + } + else { + rigState->set(DATAMODE, false, true); + } } - else { - rigState->set(DATAMODE, false, true); - } - + + if (passband > 0) + { + if (passband > 1800 && passband < 2700) { + width = 1; + } + else if (passband <= 1800) + { + width = 2; + } + else if (passband >= 2700) + { + width = 0; + } + rigState->set(FILTER, width, true); + rigState->set(PASSBAND, passband, true); + } } else if (command[0] == "s" || command[0] == "get_split_vfo") { @@ -631,7 +657,7 @@ void rigCtlClient::socketReadyRead() else { response.append("1"); - response.append("VFOb"); + response.append("VFOB"); } } @@ -1164,7 +1190,6 @@ void rigCtlClient::sendData(QString data) } } - QString rigCtlClient::getFilter(unsigned char mode, unsigned char filter) { if (mode == 3 || mode == 7 || mode == 12 || mode == 17) { @@ -1227,47 +1252,48 @@ QString rigCtlClient::getMode(unsigned char mode, bool datamode) { QString ret; + switch (mode) { - case 0: + case modeLSB: if (datamode) { ret = "PKT"; } ret.append("LSB"); break; - case 1: + case modeUSB: if (datamode) { ret = "PKT"; } ret.append("USB"); break; - case 2: + case modeAM: if (datamode) { ret = "PKT"; } ret.append("AM"); break; - case 3: + case modeCW: ret.append("CW"); break; - case 4: + case modeRTTY: ret.append("RTTY"); break; - case 5: + case modeFM: if (datamode) { ret = "PKT"; } ret.append("FM"); break; - case 6: + case modeWFM: ret.append("WFM"); break; - case 7: + case modeCW_R: ret.append("CWR"); break; - case 8: + case modeRTTY_R: ret.append("RTTYR"); break; - case 12: + case modePSK: if (datamode) { ret = "PKT"; } ret.append("USB"); break; - case 17: + case modeDV: if (datamode) { ret = "PKT"; } ret.append("LSB"); break; - case 22: + case 22: // We don't seem to have a mode for this? if (datamode) { ret = "PKT"; } ret.append("FM"); break; diff --git a/rigstate.h b/rigstate.h index 13c66cf..483a92d 100644 --- a/rigstate.h +++ b/rigstate.h @@ -12,7 +12,7 @@ #include "rigidentities.h" // Meters at the end as they are ALWAYS updated from the rig! -enum stateTypes { VFOAFREQ, VFOBFREQ, CURRENTVFO, PTT, MODE, FILTER, DUPLEX, DATAMODE, ANTENNA, RXANTENNA, CTCSS, TSQL, DTCS, CSQL, +enum stateTypes { VFOAFREQ, VFOBFREQ, CURRENTVFO, PTT, MODE, FILTER, PASSBAND, DUPLEX, DATAMODE, ANTENNA, RXANTENNA, CTCSS, TSQL, DTCS, CSQL, PREAMP, AGC, ATTENUATOR, MODINPUT, AFGAIN, RFGAIN, SQUELCH, RFPOWER, MICGAIN, COMPLEVEL, MONITORLEVEL, VOXGAIN, ANTIVOXGAIN, FAGCFUNC, NBFUNC, COMPFUNC, VOXFUNC, TONEFUNC, TSQLFUNC, SBKINFUNC, FBKINFUNC, ANFFUNC, NRFUNC, AIPFUNC, APFFUNC, MONFUNC, MNFUNC,RFFUNC, AROFUNC, MUTEFUNC, VSCFUNC, REVFUNC, SQLFUNC, ABMFUNC, BCFUNC, MBCFUNC, RITFUNC, AFCFUNC, SATMODEFUNC, SCOPEFUNC, @@ -48,7 +48,7 @@ public: } } void set(stateTypes s, qint32 x, bool u) { - if ((quint64)x != map[s]._value) { + if (static_cast(x) != map[s]._value) { _mutex.lock(); map[s]._value = (quint64)x; map[s]._valid = true; @@ -58,7 +58,7 @@ public: } } void set(stateTypes s, quint16 x, bool u) { - if ((quint64)x != map[s]._value) { + if (static_cast(x) != map[s]._value) { _mutex.lock(); map[s]._value = (quint64)x; map[s]._valid = true; @@ -68,7 +68,7 @@ public: } } void set(stateTypes s, quint8 x, bool u) { - if ((quint64)x != map[s]._value) { + if (static_cast(x) != map[s]._value) { _mutex.lock(); map[s]._value = (quint64)x; map[s]._valid = true; @@ -78,7 +78,7 @@ public: } } void set(stateTypes s, bool x, bool u) { - if ((quint64)x != map[s]._value) { + if (static_cast(x) != map[s]._value) { _mutex.lock(); map[s]._value = (quint64)x; map[s]._valid = true; @@ -88,7 +88,7 @@ public: } } void set(stateTypes s, duplexMode x, bool u) { - if ((quint64)x != map[s]._value) { + if (static_cast(x) != map[s]._value) { _mutex.lock(); map[s]._value = (quint64)x; map[s]._valid = true; @@ -99,7 +99,7 @@ public: } void set(stateTypes s, rigInput x, bool u) { - if ((quint64)x != map[s]._value) { + if (static_cast(x) != map[s]._value) { _mutex.lock(); map[s]._value = (quint64)x; map[s]._valid = true; @@ -110,12 +110,14 @@ public: } bool getBool(stateTypes s) { return map[s]._value != 0; } - quint8 getChar(stateTypes s) { return (quint8)map[s]._value; } - quint16 getInt16(stateTypes s) { return (qint16)map[s]._value; } - qint32 getInt32(stateTypes s) { return (qint32)map[s]._value; } + quint8 getChar(stateTypes s) { return static_cast(map[s]._value); } + quint16 getInt16(stateTypes s) { return static_cast(map[s]._value); } + quint16 getUInt16(stateTypes s) { return static_cast(map[s]._value); } + qint32 getInt32(stateTypes s) { return static_cast(map[s]._value); } + quint32 getUInt32(stateTypes s) { return static_cast(map[s]._value); } quint64 getInt64(stateTypes s) { return map[s]._value; } - duplexMode getDuplex(stateTypes s) { return(duplexMode)map[s]._value; } - rigInput getInput(stateTypes s) { return(rigInput)map[s]._value; } + duplexMode getDuplex(stateTypes s) { return static_cast(map[s]._value); } + rigInput getInput(stateTypes s) { return static_cast(map[s]._value); } QMap map; diff --git a/wfmain.cpp b/wfmain.cpp index e49497b..ad38688 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -330,7 +330,7 @@ void wfmain::rigConnections() connect(this, SIGNAL(scopeDisplayEnable()), rig, SLOT(enableSpectrumDisplay())); connect(rig, SIGNAL(haveMode(unsigned char, unsigned char)), this, SLOT(receiveMode(unsigned char, unsigned char))); connect(rig, SIGNAL(haveDataMode(bool)), this, SLOT(receiveDataModeStatus(bool))); - connect(rig, SIGNAL(havePassband(quint8)), this, SLOT(receivePassband(quint8))); + connect(rig, SIGNAL(havePassband(quint16)), this, SLOT(receivePassband(quint16))); connect(rpt, SIGNAL(getDuplexMode()), rig, SLOT(getDuplexMode())); connect(rpt, SIGNAL(setDuplexMode(duplexMode)), rig, SLOT(setDuplexMode(duplexMode))); @@ -5535,9 +5535,9 @@ void wfmain::receiveLANGain(unsigned char level) processModLevel(inputLAN, level); } -void wfmain::receivePassband(quint8 pass) +void wfmain::receivePassband(quint16 pass) { - int calc; +/* int calc; if (currentModeInfo.mk == modeAM) { calc = 200 + (pass * 200); } @@ -5547,8 +5547,8 @@ void wfmain::receivePassband(quint8 pass) } else { calc = 600 + ((pass - 10) * 100); - } - passBand = (double)(calc / 1000000.0); + } */ + passBand = (double)(pass / 1000000.0); } void wfmain::receiveMeter(meterKind inMeter, unsigned char level) diff --git a/wfmain.h b/wfmain.h index 826e902..30d1c77 100644 --- a/wfmain.h +++ b/wfmain.h @@ -250,7 +250,7 @@ private slots: void receiveRITValue(int ritValHz); void receiveModInput(rigInput input, bool dataOn); //void receiveDuplexMode(duplexMode dm); - void receivePassband(quint8 pass); + void receivePassband(quint16 pass); // Levels: diff --git a/wfview.pro b/wfview.pro index ce40277..290e517 100644 --- a/wfview.pro +++ b/wfview.pro @@ -210,6 +210,7 @@ HEADERS += wfmain.h \ repeatersetup.h \ repeaterattributes.h \ rigctld.h \ + rigstate.h \ ulaw.h \ transceiveradjustments.h \ audiotaper.h \ diff --git a/wfview.vcxproj b/wfview.vcxproj index c1cebb0..300b8ee 100644 --- a/wfview.vcxproj +++ b/wfview.vcxproj @@ -71,7 +71,7 @@
msvc2019 - core;xml;network;gui;multimedia;widgets;serialport;printsupport;xml + core;xml;network;gui;multimedia;widgets;serialport;printsupport @@ -87,7 +87,7 @@ Sync release\ MaxSpeed - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION="1.50";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX="/usr/local";GITSHORT="cef827f";HOST="wfview.org";UNAME="build";NDEBUG;QT_NO_DEBUG;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION="1.52";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX="/usr/local";GITSHORT="103dc9c";HOST="wfview.org";UNAME="build";NDEBUG;QT_NO_DEBUG;%(PreprocessorDefinitions) false @@ -117,7 +117,7 @@ 0 - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.50\";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX=\"/usr/local\";GITSHORT=\"cef827f\";HOST=\"wfview.org\";UNAME=\"build\";NDEBUG;QT_NO_DEBUG;QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_XML_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.52\";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX=\"/usr/local\";GITSHORT=\"103dc9c\";HOST=\"wfview.org\";UNAME=\"build\";NDEBUG;QT_NO_DEBUG;QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_XML_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) msvc @@ -150,7 +150,7 @@ Sync debug\ Disabled - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION="1.50";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX="/usr/local";GITSHORT="cef827f";HOST="wfview.org";UNAME="build";%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION="1.52";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX="/usr/local";GITSHORT="103dc9c";HOST="wfview.org";UNAME="build";%(PreprocessorDefinitions) false MultiThreadedDebugDLL true @@ -176,7 +176,7 @@ 0 - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.50\";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX=\"/usr/local\";GITSHORT=\"cef827f\";HOST=\"wfview.org\";UNAME=\"build\";QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_XML_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.52\";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX=\"/usr/local\";GITSHORT=\"103dc9c\";HOST=\"wfview.org\";UNAME=\"build\";QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_XML_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) msvc @@ -206,6 +206,7 @@ + @@ -249,6 +250,7 @@ + @@ -286,6 +288,7 @@ + diff --git a/wfview.vcxproj.filters b/wfview.vcxproj.filters index e12f9bb..74c1354 100644 --- a/wfview.vcxproj.filters +++ b/wfview.vcxproj.filters @@ -68,6 +68,9 @@ Source Files + + Source Files + Source Files @@ -175,6 +178,9 @@ Header Files + + Header Files + Header Files @@ -259,6 +265,9 @@ Header Files + + Header Files + From bf340e7790a7bebf481ee0696c14d081c97e64a2 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 28 Oct 2022 20:04:32 +0100 Subject: [PATCH 168/207] Send bye when disconnecting from cluster --- cluster.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cluster.cpp b/cluster.cpp index eaec4a2..dbae86b 100644 --- a/cluster.cpp +++ b/cluster.cpp @@ -77,6 +77,7 @@ void dxClusterClient::enableTcp(bool enable) else { if (tcpSocket != Q_NULLPTR) { + sendTcpData(QString("bye\n")); qInfo(logCluster()) << "Disconnecting tcpSocket() on:" << tcpPort; if (tcpCleanupTimer != Q_NULLPTR) { @@ -87,7 +88,6 @@ void dxClusterClient::enableTcp(bool enable) tcpSocket->disconnect(); delete tcpSocket; tcpSocket = Q_NULLPTR; - //emit deleteOldSpots(0); } } } From e49e00c3adf6b28ff518e48c529e503fa5fcbaeb Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sat, 29 Oct 2022 00:18:04 +0100 Subject: [PATCH 169/207] Silly error in setting default cluster --- wfmain.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index ad38688..74335be 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -729,6 +729,7 @@ void wfmain::setupPlots() passbandIndicator->setAntialiased(true); passbandIndicator->setPen(QPen(Qt::red)); passbandIndicator->setBrush(QBrush(Qt::red)); + passbandIndicator->setSelectable(true); freqIndicatorLine = new QCPItemLine(plot); freqIndicatorLine->setAntialiased(true); @@ -7660,9 +7661,9 @@ void wfmain::on_clusterServerNameCombo_currentIndexChanged(int index) for (int i = 0; i < clusters.size(); i++) { if (i == index) - clusters[index].isdefault = true; + clusters[i].isdefault = true; else - clusters[index].isdefault = false; + clusters[i].isdefault = false; } emit setClusterServerName(clusters[index].server); From 429aba7d68bee1fd8b02306f294b25e5e6284736 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sat, 29 Oct 2022 00:20:27 +0100 Subject: [PATCH 170/207] Remove spot display processing timer --- wfmain.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 74335be..eabf207 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -7734,8 +7734,8 @@ void wfmain::on_clusterTimeoutLineEdit_editingFinished() void wfmain::receiveSpots(QList spots) { - QElapsedTimer timer; - timer.start(); + //QElapsedTimer timer; + //timer.start(); bool current = false; @@ -7812,7 +7812,7 @@ void wfmain::receiveSpots(QList spots) } - qDebug(logCluster()) << "Processing took" << timer.nsecsElapsed() / 1000 << "us"; + //qDebug(logCluster()) << "Processing took" << timer.nsecsElapsed() / 1000 << "us"; } void wfmain::on_clusterPopOutBtn_clicked() From f7c532007ea3f4c1c19b434537fc82e961c3fa99 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sat, 29 Oct 2022 15:12:30 +0100 Subject: [PATCH 171/207] Make bandType a struct containing frequency and default SSB mode --- rigcommander.cpp | 97 +++++++++++++++++--------------- rigctld.cpp | 141 ++++++++++------------------------------------- rigctld.h | 1 - rigidentities.h | 14 ++++- wfmain.cpp | 2 +- 5 files changed, 95 insertions(+), 160 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index d799ebe..834db75 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -3088,12 +3088,35 @@ void rigCommander::determineRigCaps() std::vector standardHF; std::vector standardVU; - // Most commonly supported "HF" bands: - standardHF = {band6m, band10m, band10m, band12m, - band15m, band17m, band20m, band30m, - band40m, band60m, band80m, band160m}; + bandType bandDef6m = bandType(band6m, 50000000, 54000000, modeUSB); + bandType bandDef10m = bandType(band10m, 28000000, 29700000, modeUSB); + bandType bandDef12m = bandType(band12m, 24890000, 24990000, modeUSB); + bandType bandDef15m = bandType(band15m, 21000000, 21450000, modeUSB); + bandType bandDef17m = bandType(band17m, 18068000, 18168000, modeUSB); + bandType bandDef20m = bandType(band20m, 14000000, 14350000, modeUSB); + bandType bandDef30m = bandType(band30m, 10100000, 10150000, modeLSB); + bandType bandDef40m = bandType(band40m, 7000000, 7300000, modeLSB); + bandType bandDef60m = bandType(band60m, 5250000, 5450000, modeLSB); + bandType bandDef80m = bandType(band80m, 3500000, 4000000, modeLSB); + bandType bandDef160m = bandType(band160m, 1800000, 2000000, modeLSB); + bandType bandDef630m = bandType(band630m, 493000, 595000, modeLSB); + bandType bandDef2200m = bandType(band2200m, 135000, 138000, modeLSB); + bandType bandDef2m = bandType(band2m, 144000000, 148000000, modeUSB); + bandType bandDef4m = bandType(band4m, 70000000, 70500000, modeUSB); + bandType bandDef70cm = bandType(band70cm, 420000000, 450000000, modeUSB); + bandType bandDef23cm = bandType(band23cm, 1240000000, 1400000000, modeUSB); + + bandType bandDefAir(bandAir, 108000000, 137000000, modeAM); + bandType bandDefWFM(bandWFM, 88000000, 108000000, modeWFM); + bandType bandDefGen(bandGen, 10000, 30000000, modeAM); + + + standardHF = { bandDef6m, bandDef10m, bandDef12m, bandDef15m, bandDef17m, + bandDef20m, bandDef30m, bandDef40m, bandDef60m, bandDef80m, bandDef80m}; + + standardVU = { bandDef2m, bandDef70cm }; + - standardVU = {band70cm, band2m}; std::vector commonModes; commonModes = { createMode(modeLSB, 0x00, "LSB"), createMode(modeUSB, 0x01, "USB"), @@ -3194,10 +3217,7 @@ void rigCommander::determineRigCaps() rigCaps.preamps.push_back('\x01'); rigCaps.preamps.push_back('\x02'); rigCaps.bands = standardHF; - rigCaps.bands.push_back(band4m); - rigCaps.bands.push_back(bandGen); - rigCaps.bands.push_back(band630m); - rigCaps.bands.push_back(band2200m); + rigCaps.bands.insert(rigCaps.bands.end(), { bandDef4m, bandDef630m, bandDef2200m, bandDefGen }); rigCaps.modes = commonModes; rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x71"); @@ -3228,7 +3248,7 @@ void rigCommander::determineRigCaps() rigCaps.antennas = {0x00, 0x01, 0x02}; rigCaps.bands = standardHF; rigCaps.bands.insert(rigCaps.bands.end(), standardVU.begin(), standardVU.end()); - rigCaps.bands.insert(rigCaps.bands.end(), {band23cm, band4m, band630m, band2200m, bandGen}); + rigCaps.bands.insert(rigCaps.bands.end(), { bandDef23cm, bandDef4m, bandDef630m, bandDef2200m, bandDefGen }); rigCaps.modes = commonModes; rigCaps.modes.insert(rigCaps.modes.end(), { createMode(modeWFM, 0x06, "WFM"), createMode(modeS_AMD, 0x11, "S-AM (D)"), @@ -3260,7 +3280,7 @@ void rigCommander::determineRigCaps() rigCaps.attenuators.push_back('\x10'); rigCaps.preamps.push_back('\x01'); rigCaps.bands = standardVU; - rigCaps.bands.push_back(band23cm); + rigCaps.bands.push_back(bandDef23cm); rigCaps.bsr[band23cm] = 0x03; rigCaps.bsr[band70cm] = 0x02; rigCaps.bsr[band2m] = 0x01; @@ -3285,7 +3305,7 @@ void rigCommander::determineRigCaps() rigCaps.attenuators.insert(rigCaps.attenuators.end(),{ '\x10' , '\x20', '\x30'}); rigCaps.preamps.push_back('\x01'); rigCaps.bands = standardVU; - rigCaps.bands.push_back(band23cm); + rigCaps.bands.push_back(bandDef23cm); rigCaps.bsr[band23cm] = 0x03; rigCaps.bsr[band70cm] = 0x02; rigCaps.bsr[band2m] = 0x01; @@ -3311,7 +3331,7 @@ void rigCommander::determineRigCaps() rigCaps.preamps.push_back('\x02'); rigCaps.antennas = {0x00, 0x01}; rigCaps.bands = standardHF; - rigCaps.bands.push_back(bandGen); + rigCaps.bands.push_back(bandDefGen); rigCaps.bsr[bandGen] = 0x11; rigCaps.modes = commonModes; rigCaps.modes.insert(rigCaps.modes.end(), { createMode(modePSK, 0x12, "PSK"), @@ -3344,9 +3364,7 @@ void rigCommander::determineRigCaps() rigCaps.antennas = {0x00, 0x01}; rigCaps.hasATU = true; rigCaps.bands = standardHF; - rigCaps.bands.push_back(bandGen); - rigCaps.bands.push_back(band630m); - rigCaps.bands.push_back(band2200m); + rigCaps.bands.insert(rigCaps.bands.end(), { bandDef630m, bandDef2200m, bandDefGen }); rigCaps.modes = commonModes; rigCaps.modes.insert(rigCaps.modes.end(), { createMode(modePSK, 0x12, "PSK"), createMode(modePSK_R, 0x13, "PSK-R") }); @@ -3378,9 +3396,7 @@ void rigCommander::determineRigCaps() rigCaps.hasAntennaSel = true; rigCaps.antennas = {0x00, 0x01, 0x02, 0x03}; rigCaps.bands = standardHF; - rigCaps.bands.push_back(bandGen); - rigCaps.bands.push_back(band630m); - rigCaps.bands.push_back(band2200m); + rigCaps.bands.insert(rigCaps.bands.end(), { bandDef630m, bandDef2200m, bandDefGen }); rigCaps.modes = commonModes; rigCaps.modes.insert(rigCaps.modes.end(), {createMode(modePSK, 0x12, "PSK"), createMode(modePSK_R, 0x13, "PSK-R")}); @@ -3410,16 +3426,12 @@ void rigCommander::determineRigCaps() rigCaps.preamps.push_back('\x02'); rigCaps.bands = standardHF; rigCaps.bands.insert(rigCaps.bands.end(), standardVU.begin(), standardVU.end()); - rigCaps.bands.push_back(bandGen); - rigCaps.bands.push_back(bandAir); - rigCaps.bands.push_back(bandWFM); + rigCaps.bands.insert(rigCaps.bands.end(), { bandDefAir, bandDefGen, bandDefWFM, bandDef630m, bandDef2200m }); rigCaps.bsr[band70cm] = 0x14; rigCaps.bsr[band2m] = 0x13; rigCaps.bsr[bandAir] = 0x12; rigCaps.bsr[bandWFM] = 0x11; rigCaps.bsr[bandGen] = 0x15; - rigCaps.bands.push_back(band630m); - rigCaps.bands.push_back(band2200m); rigCaps.modes = commonModes; rigCaps.modes.insert(rigCaps.modes.end(), {createMode(modeWFM, 0x06, "WFM"), createMode(modeDV, 0x17, "DV")}); @@ -3442,7 +3454,7 @@ void rigCommander::determineRigCaps() rigCaps.preamps.push_back('\x01'); rigCaps.bands = standardHF; rigCaps.bands.insert(rigCaps.bands.end(), standardVU.begin(), standardVU.end()); - rigCaps.bands.push_back(bandGen); + rigCaps.bands.push_back(bandDefGen); rigCaps.bsr[band2m] = 0x11; rigCaps.bsr[band70cm] = 0x12; rigCaps.bsr[bandGen] = 0x13; @@ -3467,7 +3479,7 @@ void rigCommander::determineRigCaps() rigCaps.preamps.push_back('\x02'); rigCaps.antennas = {0x00, 0x01}; rigCaps.bands = standardHF; - rigCaps.bands.push_back(bandGen); + rigCaps.bands.push_back(bandDefGen); rigCaps.bsr[bandGen] = 0x11; rigCaps.modes = commonModes; rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x40"); @@ -3491,8 +3503,7 @@ void rigCommander::determineRigCaps() rigCaps.preamps.push_back('\x02'); rigCaps.bands = standardHF; rigCaps.bands.insert(rigCaps.bands.end(), standardVU.begin(), standardVU.end()); - rigCaps.bands.push_back(band4m); - rigCaps.bands.push_back(bandGen); + rigCaps.bands.insert(rigCaps.bands.end(), { bandDef4m, bandDefGen}); rigCaps.bsr[band2m] = 0x11; rigCaps.bsr[band70cm] = 0x12; rigCaps.bsr[bandGen] = 0x13; @@ -3518,7 +3529,7 @@ void rigCommander::determineRigCaps() rigCaps.attenuators.push_back('\x20'); rigCaps.preamps.push_back('\x01'); rigCaps.bands = standardHF; - rigCaps.bands.push_back(bandGen); + rigCaps.bands.push_back(bandDefGen); rigCaps.bsr[bandGen] = 0x11; rigCaps.modes = commonModes; rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x03\x48"); @@ -3543,9 +3554,7 @@ void rigCommander::determineRigCaps() rigCaps.antennas = {0x00, 0x01, 0x02, 0x03}; // not sure if 0x03 works rigCaps.hasATU = true; rigCaps.bands = standardHF; - rigCaps.bands.push_back(bandGen); - rigCaps.bands.push_back(band630m); - rigCaps.bands.push_back(band2200m); + rigCaps.bands.insert(rigCaps.bands.end(), { bandDefGen, bandDef630m, bandDef2200m }); rigCaps.modes = commonModes; rigCaps.modes.insert(rigCaps.modes.end(), {createMode(modePSK, 0x12, "PSK"), createMode(modePSK_R, 0x13, "PSK-R")}); @@ -3567,7 +3576,7 @@ void rigCommander::determineRigCaps() rigCaps.attenuators.push_back('\x20'); rigCaps.bands = standardHF; rigCaps.bands.insert(rigCaps.bands.end(), standardVU.begin(), standardVU.end()); - rigCaps.bands.push_back(bandGen); + rigCaps.bands.push_back(bandDefGen); rigCaps.modes = commonModes; rigCaps.modes.insert(rigCaps.modes.end(), createMode(modeWFM, 0x06, "WFM")); rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x00"); @@ -3588,9 +3597,9 @@ void rigCommander::determineRigCaps() rigCaps.hasDataModes = false; rigCaps.attenuators.push_back('\x20'); rigCaps.preamps.push_back('\x01'); - rigCaps.bands = {band10m, band10m, band12m, - band15m, band17m, band20m, band30m, - band40m, band60m, band80m, band160m, bandGen}; + rigCaps.bands = {bandDef10m, bandDef10m, bandDef12m, + bandDef15m, bandDef17m, bandDef20m, bandDef30m, + bandDef40m, bandDef60m, bandDef80m, bandDef160m, bandDefGen}; rigCaps.modes = { createMode(modeLSB, 0x00, "LSB"), createMode(modeUSB, 0x01, "USB"), createMode(modeAM, 0x02, "AM"), createMode(modeCW, 0x03, "CW"), createMode(modeCW_R, 0x07, "CW-R"), @@ -3642,8 +3651,8 @@ void rigCommander::determineRigCaps() // this incorrectly shows up as 2 and 3 in the drop down. rigCaps.antennas = {0x01, 0x02}; rigCaps.bands = standardHF; - rigCaps.bands.push_back(band2m); - rigCaps.bands.push_back(bandGen); + rigCaps.bands.push_back(bandDef2m); + rigCaps.bands.push_back(bandDefGen); rigCaps.modes = commonModes; rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x00"); break; @@ -3664,7 +3673,7 @@ void rigCommander::determineRigCaps() rigCaps.attenuators.insert(rigCaps.attenuators.end(),{ '\x06' , '\x12', '\x18'}); rigCaps.antennas = {0x00, 0x01}; rigCaps.bands = standardHF; - rigCaps.bands.push_back(bandGen); + rigCaps.bands.push_back(bandDefGen); rigCaps.bsr[bandGen] = 0x11; rigCaps.modes = commonModes; rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x00"); @@ -3685,7 +3694,7 @@ void rigCommander::determineRigCaps() rigCaps.attenuators.insert(rigCaps.attenuators.end(),{ '\x06' , '\x12', '\x18'}); rigCaps.antennas = {0x00, 0x01}; rigCaps.bands = standardHF; - rigCaps.bands.push_back(bandGen); + rigCaps.bands.push_back(bandDefGen); rigCaps.bsr[bandGen] = 0x11; rigCaps.modes = commonModes; rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x00"); @@ -3706,7 +3715,7 @@ void rigCommander::determineRigCaps() rigCaps.attenuators.insert(rigCaps.attenuators.end(),{ '\x06' , '\x12', '\x18'}); rigCaps.antennas = {0x00, 0x01}; rigCaps.bands = standardHF; - rigCaps.bands.push_back(bandGen); + rigCaps.bands.push_back(bandDefGen); rigCaps.bsr[bandGen] = 0x11; rigCaps.modes = commonModes; rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x00"); @@ -3730,8 +3739,8 @@ void rigCommander::determineRigCaps() rigCaps.antennas = {0x00, 0x01}; rigCaps.bands = standardHF; rigCaps.bands.insert(rigCaps.bands.end(), standardVU.begin(), standardVU.end()); - rigCaps.bands.push_back(band23cm); - rigCaps.bands.push_back(bandGen); + rigCaps.bands.push_back(bandDef23cm); + rigCaps.bands.push_back(bandDefGen); rigCaps.bsr[band2m] = 0x11; rigCaps.bsr[band70cm] = 0x12; rigCaps.bsr[band23cm] = 0x13; @@ -3757,7 +3766,7 @@ void rigCommander::determineRigCaps() rigCaps.attenuators.push_back('\x20'); rigCaps.bands = standardHF; rigCaps.bands.insert(rigCaps.bands.end(), standardVU.begin(), standardVU.end()); - rigCaps.bands.insert(rigCaps.bands.end(), {band23cm, band4m, band630m, band2200m, bandGen}); + rigCaps.bands.insert(rigCaps.bands.end(), {bandDef23cm, bandDef4m, bandDef630m, bandDef2200m, bandDefGen}); rigCaps.modes = commonModes; rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x00"); qInfo(logRig()) << "Found unknown rig: 0x" << QString("%1").arg(rigCaps.modelID, 2, 16); diff --git a/rigctld.cpp b/rigctld.cpp index d76c2fa..142fb3a 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -133,7 +133,7 @@ void rigCtlClient::socketReadyRead() char responseCode = 0; QStringList response; bool setCommand = false; - //commands.chop(1); // Remove \n character + //commands.chop(1); // Remove \n if (commands.endsWith('\r')) { commands.chop(1); // Remove \n character @@ -144,7 +144,7 @@ void rigCtlClient::socketReadyRead() continue; } - //qDebug(logRigCtlD()) << sessionId << "command received" << commands; + qDebug(logRigCtlD()) << sessionId << "RX:" << commands; // We have a full line so process command. @@ -195,24 +195,32 @@ void rigCtlClient::socketReadyRead() } else if (command[0] == "dump_state") { - // Currently send "fake" state information until I can work out what is required! - response.append("1"); // rigctld protocol version + // rigctld protocol version + response.append("1"); + // Radio model response.append(QString("%1").arg(rigCaps.rigctlModel)); - response.append("0"); // Print something - bandType lastBand=(bandType)-1; + // Print something (used to be ITU region) + response.append("0"); + // Supported RX bands (startf,endf,modes,low_power,high_power,vfo,ant) + quint32 lowFreq = 0; + quint32 highFreq = 0; for (bandType band : rigCaps.bands) { - if (band != lastBand) - response.append(generateFreqRange(band)); - lastBand = band; + if (lowFreq == 0 || band.lowFreq < lowFreq) + lowFreq = band.lowFreq; + if (band.highFreq > highFreq) + highFreq = band.highFreq; } + response.append(QString("%1.000000 %2.000000 0x%3 %4 %5 0x%6 0x%7").arg(lowFreq).arg(highFreq) + .arg(getRadioModes(), 0, 16).arg(-1).arg(-1).arg(0x16000000, 0, 16).arg(getAntennas(), 0, 16)); response.append("0 0 0 0 0 0 0"); + if (rigCaps.hasTransmit) { + // Supported TX bands (startf,endf,modes,low_power,high_power,vfo,ant) for (bandType band : rigCaps.bands) { - if (band != lastBand) - response.append(generateFreqRange(band)); - lastBand = band; + response.append(QString("%1.000000 %2.000000 0x%3 %4 %5 0x%6 0x%7").arg(band.lowFreq).arg(band.highFreq) + .arg(getRadioModes(), 0, 16).arg(2000).arg(100000).arg(0x16000000, 0, 16).arg(getAntennas(), 0, 16)); } } response.append("0 0 0 0 0 0 0"); @@ -1179,7 +1187,7 @@ void rigCtlClient::closeSocket() void rigCtlClient::sendData(QString data) { - //qDebug(logRigCtlD()) << "Sending:" << data; + qDebug(logRigCtlD()) << sessionId << "TX:" << data; if (socket != Q_NULLPTR && socket->isValid() && socket->isOpen()) { socket->write(data.toLatin1()); @@ -1345,99 +1353,6 @@ unsigned char rigCtlClient::getMode(QString modeString) { return 0; } -QString rigCtlClient::generateFreqRange(bandType band) -{ - unsigned int lowFreq = 0; - unsigned int highFreq = 0; - switch (band) { - case band2200m: - lowFreq = 135000; - highFreq = 138000; - break; - case band630m: - lowFreq = 493000; - highFreq = 595000; - break; - case band160m: - lowFreq = 1800000; - highFreq = 2000000; - break; - case band80m: - lowFreq = 3500000; - highFreq = 4000000; - break; - case band60m: - lowFreq = 5250000; - highFreq = 5450000; - break; - case band40m: - lowFreq = 7000000; - highFreq = 7300000; - break; - case band30m: - lowFreq = 10100000; - highFreq = 10150000; - break; - case band20m: - lowFreq = 14000000; - highFreq = 14350000; - break; - case band17m: - lowFreq = 18068000; - highFreq = 18168000; - break; - case band15m: - lowFreq = 21000000; - highFreq = 21450000; - break; - case band12m: - lowFreq = 24890000; - highFreq = 24990000; - break; - case band10m: - lowFreq = 28000000; - highFreq = 29700000; - break; - case band6m: - lowFreq = 50000000; - highFreq = 54000000; - break; - case band4m: - lowFreq = 70000000; - highFreq = 70500000; - break; - case band2m: - lowFreq = 144000000; - highFreq = 148000000; - break; - case band70cm: - lowFreq = 420000000; - highFreq = 450000000; - break; - case band23cm: - lowFreq = 1240000000; - highFreq = 1400000000; - break; - case bandAir: - lowFreq = 108000000; - highFreq = 137000000; - break; - case bandWFM: - lowFreq = 88000000; - highFreq = 108000000; - break; - case bandGen: - lowFreq = 10000; - highFreq = 30000000; - break; - } - QString ret = ""; - - if (lowFreq > 0 && highFreq > 0) { - ret = QString("%1.000000 %2.000000 0x%3 %4 %5 0x%6 0x%7").arg(lowFreq).arg(highFreq).arg(getRadioModes(),0,16).arg(-1).arg(-1).arg(0x16000003,0,16).arg(getAntennas(),0,16); - } - return ret; -} unsigned char rigCtlClient::getAntennas() { @@ -1498,19 +1413,19 @@ QString rigCtlClient::getAntName(unsigned char ant) unsigned char rigCtlClient::antFromName(QString name) { unsigned char ret; - if (name == "ANT1") + if (name.toUpper() == "ANT1") ret = 0; - else if (name == "ANT2") + else if (name.toUpper() == "ANT2") ret = 1; - else if (name == "ANT3") + else if (name.toUpper() == "ANT3") ret = 2; - else if (name == "ANT4") + else if (name.toUpper() == "ANT4") ret = 3; - else if (name == "ANT5") + else if (name.toUpper() == "ANT5") ret = 4; - else if (name == "ANT_UNKNOWN") + else if (name.toUpper() == "ANT_UNKNOWN") ret = 30; - else if (name == "ANT_CURR") + else if (name.toUpper() == "ANT_CURR") ret = 31; else ret = 99; diff --git a/rigctld.h b/rigctld.h index 2018576..f7ef0ac 100644 --- a/rigctld.h +++ b/rigctld.h @@ -406,7 +406,6 @@ private: QString getMode(unsigned char mode, bool datamode); unsigned char getMode(QString modeString); QString getFilter(unsigned char mode, unsigned char filter); - QString generateFreqRange(bandType band); unsigned char getAntennas(); quint64 getRadioModes(); QString getAntName(unsigned char ant); diff --git a/rigidentities.h b/rigidentities.h index d4c4209..93ea12d 100644 --- a/rigidentities.h +++ b/rigidentities.h @@ -50,7 +50,7 @@ enum rigInput{ inputMic=0, inputUnknown=0xff }; -enum bandType { band23cm=0, +enum availableBands { band23cm=0, band70cm, band2m, bandAir, @@ -90,6 +90,18 @@ struct centerSpanData { QString name; }; +struct bandType { + bandType(availableBands band, quint32 lowFreq, quint32 highFreq, mode_kind defaultMode) : + band(band), lowFreq(lowFreq), highFreq(highFreq), defaultMode(defaultMode) {} + + bandType() {} + + availableBands band; + quint32 lowFreq; + quint32 highFreq; + mode_kind defaultMode; +}; + model_kind determineRadioModel(unsigned char rigID); struct rigCapabilities { diff --git a/wfmain.cpp b/wfmain.cpp index eabf207..30b7762 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6031,7 +6031,7 @@ void wfmain::setBandButtons() for(unsigned int i=0; i < rigCaps.bands.size(); i++) { bandSel = rigCaps.bands.at(i); - switch(bandSel) + switch(bandSel.band) { case(band23cm): showButton(ui->band23cmbtn); From d47b9be7e1dfbd2e18fb7a0fc11344f2dae68331 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 31 Oct 2022 12:03:04 +0000 Subject: [PATCH 172/207] Add more commands to rigctld --- rigcommander.cpp | 60 +++++++++++- rigctld.cpp | 241 +++++++++++++++++++++++++++++++---------------- rigctld.h | 48 +++++----- rigstate.h | 56 ++++++----- 4 files changed, 272 insertions(+), 133 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index 834db75..4917ab3 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -1484,13 +1484,16 @@ void rigCommander::parseLevels() emit haveTPBFInner(level); else emit haveIFShift(level); + state.set(PBTIN, level, false); break; case '\x08': // Twin BPF Outer emit haveTPBFOuter(level); + state.set(PBTOUT, level, false); break; case '\x09': // CW Pitch - ignore for now + state.set(CWPITCH, level, false); break; case '\x0A': // TX RF level @@ -1507,6 +1510,7 @@ void rigCommander::parseLevels() break; case '\x0D': // Notch filder setting - ignore for now + state.set(NOTCHF, level, false); break; case '\x0E': // compressor level @@ -1515,6 +1519,7 @@ void rigCommander::parseLevels() break; case '\x12': // NB level - ignore for now + state.set(NB, level, false); break; case '\x15': // monitor level @@ -4840,13 +4845,62 @@ void rigCommander::stateUpdated() break; case SATMODEFUNC: break; - case NBLEVEL: - break; case NBDEPTH: break; case NBWIDTH: break; - case NRLEVEL: + case NB: + break; + case NR: { + if (i.value()._valid) { + QByteArray payload("\x14\x06"); + payload.append(bcdEncodeInt(state.getChar(NR))); + prepDataAndSend(payload); + } + break; + } + case CWPITCH: { + if (i.value()._valid) { + QByteArray payload("\x14\x09"); + payload.append(bcdEncodeInt(state.getChar(CWPITCH))); + prepDataAndSend(payload); + } + break; + } + case NOTCHF: { + if (i.value()._valid) { + QByteArray payload("\x14\x0d"); + payload.append(bcdEncodeInt(state.getChar(NOTCHF))); + prepDataAndSend(payload); + } + break; + } + case IF: { + if (i.value()._valid) { + setIFShift(state.getChar(IF)); + } + getIFShift(); + break; + } + case PBTIN: { + if (i.value()._valid) { + QByteArray payload("\x14\x07"); + payload.append(bcdEncodeInt(state.getChar(PBTIN))); + prepDataAndSend(payload); + } + break; + } + case PBTOUT: { + if (i.value()._valid) { + QByteArray payload("\x14\x08"); + payload.append(bcdEncodeInt(state.getChar(PBTOUT))); + prepDataAndSend(payload); + } + break; + } + case APF: + break; + case BAL: break; case RESUMEFUNC: break; diff --git a/rigctld.cpp b/rigctld.cpp index 142fb3a..aa2d427 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -144,7 +144,7 @@ void rigCtlClient::socketReadyRead() continue; } - qDebug(logRigCtlD()) << sessionId << "RX:" << commands; + //qDebug(logRigCtlD()) << sessionId << "RX:" << commands; // We have a full line so process command. @@ -195,6 +195,8 @@ void rigCtlClient::socketReadyRead() } else if (command[0] == "dump_state") { + quint64 modes = getRadioModes(); + // rigctld protocol version response.append("1"); // Radio model @@ -212,7 +214,7 @@ void rigCtlClient::socketReadyRead() highFreq = band.highFreq; } response.append(QString("%1.000000 %2.000000 0x%3 %4 %5 0x%6 0x%7").arg(lowFreq).arg(highFreq) - .arg(getRadioModes(), 0, 16).arg(-1).arg(-1).arg(0x16000000, 0, 16).arg(getAntennas(), 0, 16)); + .arg(modes, 0, 16).arg(-1).arg(-1).arg(0x16000000, 0, 16).arg(getAntennas(), 0, 16)); response.append("0 0 0 0 0 0 0"); if (rigCaps.hasTransmit) { @@ -220,29 +222,63 @@ void rigCtlClient::socketReadyRead() for (bandType band : rigCaps.bands) { response.append(QString("%1.000000 %2.000000 0x%3 %4 %5 0x%6 0x%7").arg(band.lowFreq).arg(band.highFreq) - .arg(getRadioModes(), 0, 16).arg(2000).arg(100000).arg(0x16000000, 0, 16).arg(getAntennas(), 0, 16)); + .arg(modes, 0, 16).arg(2000).arg(100000).arg(0x16000000, 0, 16).arg(getAntennas(), 0, 16)); } } response.append("0 0 0 0 0 0 0"); - response.append(QString("0x%1 1").arg(getRadioModes(), 0, 16)); - response.append(QString("0x%1 10").arg(getRadioModes(), 0, 16)); - response.append(QString("0x%1 100").arg(getRadioModes(), 0, 16)); - response.append(QString("0x%1 1000").arg(getRadioModes(), 0, 16)); - response.append(QString("0x%1 2500").arg(getRadioModes(), 0, 16)); - response.append(QString("0x%1 5000").arg(getRadioModes(), 0, 16)); - response.append(QString("0x%1 6125").arg(getRadioModes(), 0, 16)); - response.append(QString("0x%1 8333").arg(getRadioModes(), 0, 16)); - response.append(QString("0x%1 10000").arg(getRadioModes(), 0, 16)); - response.append(QString("0x%1 12500").arg(getRadioModes(), 0, 16)); - response.append(QString("0x%1 25000").arg(getRadioModes(), 0, 16)); - response.append(QString("0x%1 100000").arg(getRadioModes(), 0, 16)); - response.append(QString("0x%1 250000").arg(getRadioModes(), 0, 16)); - response.append(QString("0x%1 1000000").arg(getRadioModes(), 0, 16)); + response.append(QString("0x%1 1").arg(modes, 0, 16)); + response.append(QString("0x%1 10").arg(modes, 0, 16)); + response.append(QString("0x%1 100").arg(modes, 0, 16)); + response.append(QString("0x%1 1000").arg(modes, 0, 16)); + response.append(QString("0x%1 2500").arg(modes, 0, 16)); + response.append(QString("0x%1 5000").arg(modes, 0, 16)); + response.append(QString("0x%1 6125").arg(modes, 0, 16)); + response.append(QString("0x%1 8333").arg(modes, 0, 16)); + response.append(QString("0x%1 10000").arg(modes, 0, 16)); + response.append(QString("0x%1 12500").arg(modes, 0, 16)); + response.append(QString("0x%1 25000").arg(modes, 0, 16)); + response.append(QString("0x%1 100000").arg(modes, 0, 16)); + response.append(QString("0x%1 250000").arg(modes, 0, 16)); + response.append(QString("0x%1 1000000").arg(modes, 0, 16)); response.append("0 0"); - response.append(QString("0x%1 1200").arg(getRadioModes(), 0, 16)); - response.append(QString("0x%1 2400").arg(getRadioModes(), 0, 16)); - response.append(QString("0x%1 3000").arg(getRadioModes(), 0, 16)); + + modes = getRadioModes("SB"); + if (modes) { + response.append(QString("0x%1 3000").arg(modes, 0, 16)); + response.append(QString("0x%1 2400").arg(modes, 0, 16)); + response.append(QString("0x%1 1800").arg(modes, 0, 16)); + } + modes = getRadioModes("AM"); + if (modes) { + response.append(QString("0x%1 9000").arg(modes, 0, 16)); + response.append(QString("0x%1 6000").arg(modes, 0, 16)); + response.append(QString("0x%1 3000").arg(modes, 0, 16)); + } + modes = getRadioModes("CW"); + if (modes) { + response.append(QString("0x%1 1200").arg(modes, 0, 16)); + response.append(QString("0x%1 500").arg(modes, 0, 16)); + response.append(QString("0x%1 200").arg(modes, 0, 16)); + } + modes = getRadioModes("FM"); + if (modes) { + response.append(QString("0x%1 15000").arg(modes, 0, 16)); + response.append(QString("0x%1 10000").arg(modes, 0, 16)); + response.append(QString("0x%1 7000").arg(modes, 0, 16)); + } + modes = getRadioModes("RTTY"); + if (modes) { + response.append(QString("0x%1 2400").arg(modes, 0, 16)); + response.append(QString("0x%1 500").arg(modes, 0, 16)); + response.append(QString("0x%1 250").arg(modes, 0, 16)); + } + modes = getRadioModes("PSK"); + if (modes) { + response.append(QString("0x%1 1200").arg(modes, 0, 16)); + response.append(QString("0x%1 500").arg(modes, 0, 16)); + response.append(QString("0x%1 250").arg(modes, 0, 16)); + } response.append("0 0"); response.append("9900"); response.append("9900"); @@ -250,7 +286,7 @@ void rigCtlClient::socketReadyRead() response.append("0"); QString preamps=""; if (rigCaps.hasPreamp) { - for (unsigned char pre : rigCaps.preamps) + for (quint8 pre : rigCaps.preamps) { if (pre == 0) continue; @@ -266,7 +302,7 @@ void rigCtlClient::socketReadyRead() QString attens = ""; if (rigCaps.hasAttenuator) { - for (unsigned char att : rigCaps.attenuators) + for (quint8 att : rigCaps.attenuators) { if (att == 0) continue; @@ -280,7 +316,6 @@ void rigCtlClient::socketReadyRead() } response.append(attens); - response.append("0xffffffffffffffff"); response.append("0xffffffffffffffff"); response.append("0xffffffffffffffff"); @@ -288,23 +323,6 @@ void rigCtlClient::socketReadyRead() response.append("0xffffffffffffffff"); response.append("0xffffffffffffffff"); - /* - response.append("0xffffffffffffffff"); - response.append("0xffffffffffffffff"); - response.append("0xfffffffff7ffffff"); - response.append("0xfffffff083ffffff"); - response.append("0xffffffffffffffff"); - response.append("0xffffffffffffffbf"); - */ - - /* - response.append("0x3effffff"); - response.append("0x3effffff"); - response.append("0x7fffffff"); - response.append("0x7fffffff"); - response.append("0x7fffffff"); - response.append("0x7fffffff"); - */ if (chkVfoEecuted) { response.append(QString("vfo_ops=0x%1").arg(255, 0, 16)); response.append(QString("ptt_type=0x%1").arg(rigCaps.hasTransmit, 0, 16)); @@ -365,7 +383,7 @@ void rigCtlClient::socketReadyRead() freqt freq; bool ok=false; double newFreq=0.0f; - unsigned char vfo=0; + quint8 vfo=0; if (command.length() == 2) { newFreq = command[1].toDouble(&ok); @@ -383,10 +401,10 @@ void rigCtlClient::socketReadyRead() freq.Hz = static_cast(newFreq); qDebug(logRigCtlD()) << QString("Set frequency: %1 (%2)").arg(freq.Hz).arg(command[1]); if (vfo == 0) { - rigState->set(VFOAFREQ, freq.Hz,true); + rigState->set(VFOAFREQ, (quint64)freq.Hz,true); } else { - rigState->set(VFOBFREQ, freq.Hz,true); + rigState->set(VFOBFREQ, (quint64)freq.Hz,true); } } } @@ -689,13 +707,13 @@ void rigCtlClient::socketReadyRead() if (command.length() > 1) { if (longReply) { - response.append(QString("AntCurr: %1").arg(getAntName((unsigned char)command[1].toInt()))); + response.append(QString("AntCurr: %1").arg(getAntName((quint8)command[1].toInt()))); response.append(QString("Option: %1").arg(0)); response.append(QString("AntTx: %1").arg(getAntName(rigState->getChar(ANTENNA)))); response.append(QString("AntRx: %1").arg(getAntName(rigState->getChar(ANTENNA)))); } else { - response.append(QString("%1").arg(getAntName((unsigned char)command[1].toInt()))); + response.append(QString("%1").arg(getAntName((quint8)command[1].toInt()))); response.append(QString("%1").arg(0)); response.append(QString("%1").arg(getAntName(rigState->getChar(ANTENNA)))); response.append(QString("%1").arg(getAntName(rigState->getChar(ANTENNA)))); @@ -774,6 +792,30 @@ void rigCtlClient::socketReadyRead() else if (command[1] == "ATT") { resp.append(QString("%1").arg(rigState->getChar(ATTENUATOR))); } + else if (command[1] == "CWPITCH") { + resp.append(QString("%1").arg(rigState->getInt16(CWPITCH))); + } + else if (command[1] == "NOTCHF") { + resp.append(QString("%1").arg(rigState->getInt16(NOTCHF))); + } + else if (command[1] == "IF") { + resp.append(QString("%1").arg(rigState->getInt16(IF))); + } + else if (command[1] == "PBT_IN") { + resp.append(QString("%1").arg((float)rigState->getChar(PBTIN) / 255.0)); + } + else if (command[1] == "PBT_OUT") { + resp.append(QString("%1").arg((float)rigState->getChar(PBTOUT) / 255.0)); + } + else if (command[1] == "APF") { + resp.append(QString("%1").arg((float)rigState->getChar(APF) / 255.0)); + } + else if (command[1] == "NR") { + resp.append(QString("%1").arg((float)rigState->getChar(NR) / 255.0)); + } + else if (command[1] == "BAL") { + resp.append(QString("%1").arg((float)rigState->getChar(BAL) / 255.0)); + } else { resp.append(QString("%1").arg(value)); } @@ -782,55 +824,87 @@ void rigCtlClient::socketReadyRead() } else if (command.length() > 2 && (command[0] == "L" || command[0] == "set_level")) { - unsigned char value=0; + int value=0; setCommand = true; if (command[1] == "AF") { value = command[2].toFloat() * 255; - rigState->set(AFGAIN, value, true); + rigState->set(AFGAIN, quint8(value), true); } else if (command[1] == "RF") { value = command[2].toFloat() * 255; - rigState->set(RFGAIN, value, true); + rigState->set(RFGAIN, quint8(value), true); } else if (command[1] == "RFPOWER") { - value = command[2].toFloat() * 255; - rigState->set(RFPOWER, value, true); + value = command[2].toFloat() * 255; + rigState->set(RFPOWER, quint8(value), true); } else if (command[1] == "SQL") { value = command[2].toFloat() * 255; - rigState->set(SQUELCH, value, true); + rigState->set(SQUELCH, quint8(value), true); } else if (command[1] == "COMP") { value = command[2].toFloat() * 255; - rigState->set(COMPLEVEL, value, true); + rigState->set(COMPLEVEL, quint8(value), true); } else if (command[1] == "MICGAIN") { value = command[2].toFloat() * 255; - rigState->set(MICGAIN, value, true); + rigState->set(MICGAIN, quint8(value), true); } else if (command[1] == "MON") { value = command[2].toFloat() * 255; - rigState->set(MONITORLEVEL, value, true); + rigState->set(MONITORLEVEL, quint8(value), true); } else if (command[1] == "VOXGAIN") { value = command[2].toFloat() * 255; - rigState->set(VOXGAIN, value, true); + rigState->set(VOXGAIN, quint8(value), true); } else if (command[1] == "ANTIVOX") { value = command[2].toFloat() * 255; - rigState->set(ANTIVOXGAIN, value, true); + rigState->set(ANTIVOXGAIN, quint8(value), true); } else if (command[1] == "ATT") { value = command[2].toInt(); - rigState->set(ATTENUATOR, value, true); + rigState->set(ATTENUATOR, quint8(value), true); } else if (command[1] == "PREAMP") { value = command[2].toFloat() / 10; - rigState->set(PREAMP, value, true); + rigState->set(PREAMP, quint8(value), true); } else if (command[1] == "AGC") { - value = command[2].toInt();; - rigState->set(AGC, value, true); + value = command[2].toFloat() * 255; + rigState->set(AGC, quint8(value), true); + } + else if (command[1] == "CWPITCH") { + value = command[2].toInt(); + rigState->set(CWPITCH, value, true); + } + else if (command[1] == "NOTCHF") { + value = command[2].toInt(); + rigState->set(NOTCHF, value, true); + } + else if (command[1] == "IF") { + value = command[2].toInt(); + rigState->set(IF, qint16(value), true); + } + else if (command[1] == "PBT_IN") { + value = command[2].toFloat() * 255; + rigState->set(PBTIN, quint8(value), true); + } + else if (command[1] == "PBT_OUT") { + value = command[2].toFloat() * 255; + rigState->set(PBTOUT, quint8(value), true); + } + else if (command[1] == "APF") { + value = command[2].toFloat() * 255; + rigState->set(APF, quint8(value), true); + } + else if (command[1] == "NR") { + value = command[2].toFloat() * 255; + rigState->set(NR, quint8(value), true); + } + else if (command[1] == "BAL") { + value = command[2].toFloat() * 255; + rigState->set(BAL, quint8(value), true); } qInfo(logRigCtlD()) << "Setting:" << command[1] << command[2] << value; @@ -1187,7 +1261,7 @@ void rigCtlClient::closeSocket() void rigCtlClient::sendData(QString data) { - qDebug(logRigCtlD()) << sessionId << "TX:" << data; + //qDebug(logRigCtlD()) << sessionId << "TX:" << data; if (socket != Q_NULLPTR && socket->isValid() && socket->isOpen()) { socket->write(data.toLatin1()); @@ -1198,7 +1272,7 @@ void rigCtlClient::sendData(QString data) } } -QString rigCtlClient::getFilter(unsigned char mode, unsigned char filter) { +QString rigCtlClient::getFilter(quint8 mode, quint8 filter) { if (mode == 3 || mode == 7 || mode == 12 || mode == 17) { switch (filter) { @@ -1256,7 +1330,7 @@ QString rigCtlClient::getFilter(unsigned char mode, unsigned char filter) { return QString(""); } -QString rigCtlClient::getMode(unsigned char mode, bool datamode) { +QString rigCtlClient::getMode(quint8 mode, bool datamode) { QString ret; @@ -1309,7 +1383,7 @@ QString rigCtlClient::getMode(unsigned char mode, bool datamode) { return ret; } -unsigned char rigCtlClient::getMode(QString modeString) { +quint8 rigCtlClient::getMode(QString modeString) { if (modeString == QString("LSB")) { return 0; @@ -1354,46 +1428,47 @@ unsigned char rigCtlClient::getMode(QString modeString) { } -unsigned char rigCtlClient::getAntennas() +quint8 rigCtlClient::getAntennas() { - unsigned char ant=0; - for (unsigned char i : rigCaps.antennas) + quint8 ant=0; + for (quint8 i : rigCaps.antennas) { ant |= 1<(x) != map[s]._value) { + if (quint64(x) != map[s]._value) { _mutex.lock(); - map[s]._value = (quint64)x; + map[s]._value = quint64(x); + map[s]._valid = true; + map[s]._updated = u; + map[s]._dateUpdated = QDateTime::currentDateTime(); + _mutex.unlock(); + } + } + void set(stateTypes s, qint16 x, bool u) { + if (quint64(x) != map[s]._value) { + _mutex.lock(); + map[s]._value = quint64(x); map[s]._valid = true; map[s]._updated = u; map[s]._dateUpdated = QDateTime::currentDateTime(); @@ -58,9 +68,9 @@ public: } } void set(stateTypes s, quint16 x, bool u) { - if (static_cast(x) != map[s]._value) { + if (quint64(x) != map[s]._value) { _mutex.lock(); - map[s]._value = (quint64)x; + map[s]._value = quint64(x); map[s]._valid = true; map[s]._updated = u; map[s]._dateUpdated = QDateTime::currentDateTime(); @@ -68,9 +78,9 @@ public: } } void set(stateTypes s, quint8 x, bool u) { - if (static_cast(x) != map[s]._value) { + if (quint64(x) != map[s]._value) { _mutex.lock(); - map[s]._value = (quint64)x; + map[s]._value = quint64(x); map[s]._valid = true; map[s]._updated = u; map[s]._dateUpdated = QDateTime::currentDateTime(); @@ -78,9 +88,9 @@ public: } } void set(stateTypes s, bool x, bool u) { - if (static_cast(x) != map[s]._value) { + if (quint64(x) != map[s]._value) { _mutex.lock(); - map[s]._value = (quint64)x; + map[s]._value = quint64(x); map[s]._valid = true; map[s]._updated = u; map[s]._dateUpdated = QDateTime::currentDateTime(); @@ -88,9 +98,9 @@ public: } } void set(stateTypes s, duplexMode x, bool u) { - if (static_cast(x) != map[s]._value) { + if (quint64(x) != map[s]._value) { _mutex.lock(); - map[s]._value = (quint64)x; + map[s]._value = quint64(x); map[s]._valid = true; map[s]._updated = u; map[s]._dateUpdated = QDateTime::currentDateTime(); @@ -99,9 +109,9 @@ public: } void set(stateTypes s, rigInput x, bool u) { - if (static_cast(x) != map[s]._value) { + if (quint64(x) != map[s]._value) { _mutex.lock(); - map[s]._value = (quint64)x; + map[s]._value = quint64(x); map[s]._valid = true; map[s]._updated = u; map[s]._dateUpdated = QDateTime::currentDateTime(); @@ -110,14 +120,14 @@ public: } bool getBool(stateTypes s) { return map[s]._value != 0; } - quint8 getChar(stateTypes s) { return static_cast(map[s]._value); } - quint16 getInt16(stateTypes s) { return static_cast(map[s]._value); } - quint16 getUInt16(stateTypes s) { return static_cast(map[s]._value); } - qint32 getInt32(stateTypes s) { return static_cast(map[s]._value); } - quint32 getUInt32(stateTypes s) { return static_cast(map[s]._value); } + quint8 getChar(stateTypes s) { return quint8(map[s]._value); } + qint16 getInt16(stateTypes s) { return qint16(map[s]._value); } + quint16 getUInt16(stateTypes s) { return quint16(map[s]._value); } + qint32 getInt32(stateTypes s) { return qint32(map[s]._value); } + quint32 getUInt32(stateTypes s) { return quint32(map[s]._value); } quint64 getInt64(stateTypes s) { return map[s]._value; } - duplexMode getDuplex(stateTypes s) { return static_cast(map[s]._value); } - rigInput getInput(stateTypes s) { return static_cast(map[s]._value); } + duplexMode getDuplex(stateTypes s) { return duplexMode(map[s]._value); } + rigInput getInput(stateTypes s) { return rigInput(map[s]._value); } QMap map; From b46dfb8f3e8163682673a5320e141ddf83c88cd8 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 31 Oct 2022 12:15:42 +0000 Subject: [PATCH 173/207] Add AR Cluster support --- cluster.cpp | 83 +++++++++++++++++++++++++++++------------------------ rigctld.cpp | 7 +++++ 2 files changed, 52 insertions(+), 38 deletions(-) diff --git a/cluster.cpp b/cluster.cpp index dbae86b..b3cc76f 100644 --- a/cluster.cpp +++ b/cluster.cpp @@ -72,6 +72,7 @@ void dxClusterClient::enableTcp(bool enable) tcpCleanupTimer->setInterval(1000 * 10); // Run once a minute connect(tcpCleanupTimer, SIGNAL(timeout()), this, SLOT(tcpCleanup())); tcpCleanupTimer->start(); + authenticated = false; } } else { @@ -169,46 +170,52 @@ void dxClusterClient::tcpDataReceived() QString data = QString(tcpSocket->readAll()); emit sendOutput(data); - if (data.contains("login:")) { - sendTcpData(QString("%1\n").arg(tcpUserName)); - return; - } - if (data.contains("password:")) { - sendTcpData(QString("%1\n").arg(tcpPassword)); - return; - } - - QRegularExpressionMatchIterator i = tcpRegex.globalMatch(data); - while (i.hasNext()) { - QRegularExpressionMatch match = i.next(); - if (match.hasMatch()) { - spotData* data = new spotData(); - data->spottercall = match.captured(1); - data->frequency = match.captured(2).toDouble() / 1000.0; - data->dxcall = match.captured(3); - data->comment = match.captured(4).trimmed(); - data->timestamp = QDateTime::currentDateTimeUtc(); - -#ifdef USESQL - database db = database(); - db.query(QString("DELETE from spots where dxcall='%1'").arg(data->dxcall)); - QString query = QString("INSERT INTO spots(type,spottercall,frequency,dxcall,comment,timestamp) VALUES('%1','%2',%3,'%4','%5','%6')\n") - .arg("TCP").arg(data->spottercall).arg(data->frequency).arg(data->dxcall).arg(data->comment).arg(data->timestamp.toString("yyyy-MM-dd hh:mm:ss")); - db.query(query); -#else - bool found = false; - QMap::iterator spot = allSpots.find(data->dxcall); - while (spot != allSpots.end() && spot.key() == data->dxcall && spot.value()->frequency == data->frequency) { - found = true; - ++spot; - } - if (found == false) { - allSpots.insert(data->dxcall, data); - } -#endif + if (!authenticated) { + if (data.contains("login:") || data.contains("call:") || data.contains("callsign:")) { + sendTcpData(QString("%1\n").arg(tcpUserName)); + return; + } + if (data.contains("password:")) { + sendTcpData(QString("%1\n").arg(tcpPassword)); + return; + } + if (data.contains("Hello")) { + authenticated = true; } } - updateSpots(); + else { + QRegularExpressionMatchIterator i = tcpRegex.globalMatch(data); + while (i.hasNext()) { + QRegularExpressionMatch match = i.next(); + if (match.hasMatch()) { + spotData* data = new spotData(); + data->spottercall = match.captured(1); + data->frequency = match.captured(2).toDouble() / 1000.0; + data->dxcall = match.captured(3); + data->comment = match.captured(4).trimmed(); + data->timestamp = QDateTime::currentDateTimeUtc(); + +#ifdef USESQL + database db = database(); + db.query(QString("DELETE from spots where dxcall='%1'").arg(data->dxcall)); + QString query = QString("INSERT INTO spots(type,spottercall,frequency,dxcall,comment,timestamp) VALUES('%1','%2',%3,'%4','%5','%6')\n") + .arg("TCP").arg(data->spottercall).arg(data->frequency).arg(data->dxcall).arg(data->comment).arg(data->timestamp.toString("yyyy-MM-dd hh:mm:ss")); + db.query(query); +#else + bool found = false; + QMap::iterator spot = allSpots.find(data->dxcall); + while (spot != allSpots.end() && spot.key() == data->dxcall && spot.value()->frequency == data->frequency) { + found = true; + ++spot; + } + if (found == false) { + allSpots.insert(data->dxcall, data); + } +#endif + } + } + updateSpots(); + } } diff --git a/rigctld.cpp b/rigctld.cpp index aa2d427..29c3761 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -816,6 +816,9 @@ void rigCtlClient::socketReadyRead() else if (command[1] == "BAL") { resp.append(QString("%1").arg((float)rigState->getChar(BAL) / 255.0)); } + else if (command[1] == "KEYSPD") { + resp.append(QString("%1").arg(rigState->getChar(KEYSPD))); + } else { resp.append(QString("%1").arg(value)); } @@ -906,6 +909,10 @@ void rigCtlClient::socketReadyRead() value = command[2].toFloat() * 255; rigState->set(BAL, quint8(value), true); } + else if (command[1] == "KEYSPD") { + value = command[2].toInt(); + rigState->set(IF, quint8(value), true); + } qInfo(logRigCtlD()) << "Setting:" << command[1] << command[2] << value; From 209c5a9b0bd5bf29499517cfac37ac8c1c659db2 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 31 Oct 2022 12:15:56 +0000 Subject: [PATCH 174/207] Key KEYSPD --- rigstate.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rigstate.h b/rigstate.h index bc2f5ba..031a37c 100644 --- a/rigstate.h +++ b/rigstate.h @@ -17,7 +17,8 @@ enum stateTypes { VFOAFREQ, VFOBFREQ, CURRENTVFO, PTT, MODE, FILTER, PASSBAND, D VOXGAIN, ANTIVOXGAIN, CWPITCH, NOTCHF, IF, PBTIN, PBTOUT, APF, NR, NB, NBDEPTH, NBWIDTH, RIGINPUT, POWERONOFF, RITVALUE, FAGCFUNC, NBFUNC, COMPFUNC, VOXFUNC, TONEFUNC, TSQLFUNC, SBKINFUNC, FBKINFUNC, ANFFUNC, NRFUNC, AIPFUNC, APFFUNC, MONFUNC, MNFUNC,RFFUNC, AROFUNC, MUTEFUNC, VSCFUNC, REVFUNC, SQLFUNC, ABMFUNC, BCFUNC, MBCFUNC, RITFUNC, AFCFUNC, SATMODEFUNC, SCOPEFUNC, - RESUMEFUNC, TBURSTFUNC, TUNERFUNC, LOCKFUNC, SMETER, POWERMETER, SWRMETER, ALCMETER, COMPMETER, VOLTAGEMETER, CURRENTMETER + RESUMEFUNC, TBURSTFUNC, TUNERFUNC, LOCKFUNC, SMETER, POWERMETER, SWRMETER, ALCMETER, COMPMETER, VOLTAGEMETER, CURRENTMETER, + KEYSPD }; struct value { From 29060eb43e8ab0b962fc53c7832775e1a30dd02b Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 31 Oct 2022 12:39:27 +0000 Subject: [PATCH 175/207] Add skimmer support (setting not saved) --- cluster.cpp | 18 +++++++++++++++++- cluster.h | 2 ++ wfmain.cpp | 7 +++++++ wfmain.h | 3 +++ wfmain.ui | 45 +++++++++++++++++++++++++++++++++++++++------ 5 files changed, 68 insertions(+), 7 deletions(-) diff --git a/cluster.cpp b/cluster.cpp index b3cc76f..ee17415 100644 --- a/cluster.cpp +++ b/cluster.cpp @@ -57,7 +57,7 @@ void dxClusterClient::enableTcp(bool enable) tcpEnable = enable; if (enable) { - tcpRegex = QRegularExpression("^DX de ([a-z|A-Z|0-9|/]+):\\s+([0-9|.]+)\\s+([a-z|A-Z|0-9|/]+)+\\s+(.*)\\s+(\\d{4}Z)"); + tcpRegex = QRegularExpression("^DX de ([a-z-|A-Z|0-9|#|/]+):\\s+([0-9|.]+)\\s+([a-z|A-Z|0-9|/]+)+\\s+(.*)\\s+(\\d{4}Z)"); if (tcpSocket == Q_NULLPTR) { @@ -181,6 +181,7 @@ void dxClusterClient::tcpDataReceived() } if (data.contains("Hello")) { authenticated = true; + enableSkimmerSpots(skimmerSpots); } } else { @@ -296,3 +297,18 @@ void dxClusterClient::updateSpots() #endif emit sendSpots(spots); } + +void dxClusterClient::enableSkimmerSpots(bool enable) +{ + skimmerSpots = enable; + if (authenticated) { + if (skimmerSpots) { + sendTcpData(QString("Set Dx Filter Skimmer\n")); + } + else + { + sendTcpData(QString("Set Dx Filter Not Skimmer\n")); + } + + } +} diff --git a/cluster.h b/cluster.h index ba357ae..9577a44 100644 --- a/cluster.h +++ b/cluster.h @@ -72,6 +72,7 @@ public slots: void setTcpTimeout(int p) { tcpTimeout = p; } void tcpCleanup(); void freqRange(double low, double high); + void enableSkimmerSpots(bool enable); private: void sendTcpData(QString data); @@ -99,6 +100,7 @@ private: double lowFreq; double highFreq; QMap allSpots; + bool skimmerSpots = false; }; #endif diff --git a/wfmain.cpp b/wfmain.cpp index 30b7762..7b72dc2 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -127,6 +127,7 @@ wfmain::wfmain(const QString settingsFile, const QString logFile, bool debugMode connect(this, SIGNAL(setClusterPassword(QString)), cluster, SLOT(setTcpPassword(QString))); connect(this, SIGNAL(setClusterTimeout(int)), cluster, SLOT(setTcpTimeout(int))); connect(this, SIGNAL(setFrequencyRange(double, double)), cluster, SLOT(freqRange(double, double))); + connect(this, SIGNAL(setClusterSkimmerSpots(bool)), cluster, SLOT(enableSkimmerSpots(bool))); connect(cluster, SIGNAL(sendSpots(QList)), this, SLOT(receiveSpots(QList))); connect(cluster, SIGNAL(sendOutput(QString)), this, SLOT(receiveClusterOutput(QString))); @@ -7843,6 +7844,12 @@ void wfmain::on_clusterPopOutBtn_clicked() } } +void wfmain::on_clusterSkimmerSpotsEnable_clicked(bool enable) +{ + prefs.clusterSkimmerSpotsEnable = enable; + emit setClusterSkimmerSpots(enable); +} + void wfmain::on_clickDragTuningEnableChk_clicked(bool checked) { prefs.clickDragTuningEnable = checked; diff --git a/wfmain.h b/wfmain.h index 30d1c77..0c37db8 100644 --- a/wfmain.h +++ b/wfmain.h @@ -197,6 +197,7 @@ signals: void setClusterUserName(QString name); void setClusterPassword(QString pass); void setClusterTimeout(int timeout); + void setClusterSkimmerSpots(bool enable); void setFrequencyRange(double low, double high); private slots: @@ -676,6 +677,7 @@ private slots: void on_clusterPasswordLineEdit_editingFinished(); void on_clusterTimeoutLineEdit_editingFinished(); void on_clusterPopOutBtn_clicked(); + void on_clusterSkimmerSpotsEnable_clicked(bool enable); void on_clickDragTuningEnableChk_clicked(bool checked); @@ -941,6 +943,7 @@ private: QString clusterTcpUserName; QString clusterTcpPassword; int clusterTimeout; + bool clusterSkimmerSpotsEnable; bool clickDragTuningEnable; } prefs; diff --git a/wfmain.ui b/wfmain.ui index 811e504..08414bc 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -18,7 +18,7 @@ - 1 + 3 @@ -2223,7 +2223,7 @@ - 1 + 5 @@ -3350,8 +3350,8 @@ 0 0 - 799 - 269 + 801 + 311 @@ -5090,11 +5090,44 @@ Pop-Out + + + + 10 + 470 + 801 + 22 + + + + + + + Show Skimmer Spots + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + groupBox_9 horizontalLayoutWidget groupBox_10 clusterOutputTextEdit clusterPopOutBtn + horizontalLayoutWidget_2 @@ -5263,7 +5296,7 @@ 0 0 1023 - 23 + 21 @@ -5290,7 +5323,7 @@ - + From a1252eec1ed1be0df10379fe37ecb30443249bba Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 31 Oct 2022 13:33:47 +0000 Subject: [PATCH 176/207] Fix passband warnings --- rigcommander.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/rigcommander.cpp b/rigcommander.cpp index 4917ab3..e2c23d7 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -4179,10 +4179,13 @@ void rigCommander::parseMode() switch (filter) { case 1: pass=1200; + break; case 2: pass=500; + break; case 3: pass=250; + break; } } else if (mode == 4 || mode == 8) @@ -4190,10 +4193,13 @@ void rigCommander::parseMode() switch (filter) { case 1: pass=2400; + break; case 2: pass=500; + break; case 3: pass=250; + break; } } else if (mode == 2) @@ -4201,10 +4207,13 @@ void rigCommander::parseMode() switch (filter) { case 1: pass=9000; + break; case 2: pass=6000; + break; case 3: pass=3000; + break; } } else if (mode == 5) @@ -4212,20 +4221,26 @@ void rigCommander::parseMode() switch (filter) { case 1: pass=15000; + break; case 2: pass=10000; + break; case 3: pass=7000; + break; } } else { // SSB or unknown mode switch (filter) { case 1: pass=3000; + break; case 2: pass=2400; + break; case 3: pass=1800; + break; } } } From b57e4ebd769bf551372e0432da02ea8bcbb13a82 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Tue, 1 Nov 2022 12:16:55 +0100 Subject: [PATCH 177/207] added libs for suse builds; it also builds on leap 15.5 --- INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index 4a87066..fd304f8 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -78,7 +78,7 @@ install wfview on suse 15.3 & up, sles 15.x or tumbleweed; this was done on a cl we need to add packages to be able to build the stuff. - sudo zypper in --type pattern devel_basis -- sudo zypper in libQt5Widgets-devel libqt5-qtbase-common-devel libqt5-qtserialport-devel libQt5SerialPort5 qcustomplot-devel libqcustomplot2 libQt5PrintSupport-devel libqt5-qtmultimedia-devel lv2-devel libopus-devel eigen3-devel libQt5Xml-devel +- sudo zypper in libQt5Widgets-devel libqt5-qtbase-common-devel libqt5-qtserialport-devel libQt5SerialPort5 qcustomplot-devel libqcustomplot2 libQt5PrintSupport-devel libqt5-qtmultimedia-devel lv2-devel libopus-devel eigen3-devel libQt5Xml-devel portaudio-devel rtaudio-devel optional (mainly for development specifics): get and install qt5: From 9da6f770780d578c3f742990e00e53e3ec817ac3 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Wed, 23 Nov 2022 13:36:13 -0800 Subject: [PATCH 178/207] Fixed issue causing the current color preset to not be load (previously preset zero was always used). --- wfmain.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index e49497b..9a3860b 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -99,8 +99,6 @@ wfmain::wfmain(const QString settingsFile, const QString logFile, bool debugMode qDebug(logSystem()) << "Running setUIToPrefs()"; setUIToPrefs(); - loadColorPresetToUIandPlots(0); - qDebug(logSystem()) << "Running setInititalTiming()"; setInitialTiming(); @@ -1215,6 +1213,8 @@ void wfmain::setUIToPrefs() ui->colorPresetCombo->setItemText(pn, *p.presetName); } + ui->colorPresetCombo->setCurrentIndex(prefs.currentColorPresetNumber); + ui->wfthemeCombo->setCurrentIndex(ui->wfthemeCombo->findData(prefs.wftheme)); colorMap->setGradient(static_cast(prefs.wftheme)); @@ -1480,7 +1480,7 @@ void wfmain::loadSettings() // Load in the color presets. The default values are already loaded. settings->beginGroup("ColorPresets"); - settings->value("currentColorPresetNumber", prefs.currentColorPresetNumber).toInt(); + prefs.currentColorPresetNumber = settings->value("currentColorPresetNumber", defPrefs.currentColorPresetNumber).toInt(); if(prefs.currentColorPresetNumber > numColorPresetsTotal-1) prefs.currentColorPresetNumber = 0; From a5ac42fe57bc1860614ffa5d655fc2b02425de5b Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Wed, 23 Nov 2022 16:59:10 -0800 Subject: [PATCH 179/207] Fixed broken RTS preference. Added preliminary (and untested) support for the IC-703, 737, 738, and 756. --- rigcommander.cpp | 87 ++++++++++++++++++++++++++++++++++++++++++++++- rigidentities.cpp | 5 +++ rigidentities.h | 4 +++ wfmain.cpp | 5 +-- 4 files changed, 96 insertions(+), 5 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index 1d2a30e..80c3e53 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -3486,6 +3486,27 @@ void rigCommander::determineRigCaps() createMode(modePSK_R, 0x13, "PSK-R")}); rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x95"); break; + case model703: + rigCaps.modelName = QString("IC-703"); + rigCaps.rigctlModel = 3055; + rigCaps.hasSpectrum = false; + rigCaps.inputs.clear(); + rigCaps.hasLan = false; + rigCaps.hasEthernet = false; + rigCaps.hasWiFi = false; + rigCaps.hasFDcomms = false; + rigCaps.hasATU = true; + rigCaps.hasPTTCommand = false; + rigCaps.useRTSforPTT = true; + rigCaps.hasDataModes = false; + rigCaps.attenuators.push_back('\x20'); + rigCaps.bands = standardHF; + rigCaps.bands.insert(rigCaps.bands.end(), standardVU.begin(), standardVU.end()); + rigCaps.bands.push_back(bandGen); + rigCaps.modes = commonModes; + rigCaps.modes.insert(rigCaps.modes.end(), createMode(modeWFM, 0x06, "WFM")); + rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x00"); + break; case model706: rigCaps.modelName = QString("IC-706"); rigCaps.rigctlModel = 3009; @@ -3555,6 +3576,50 @@ void rigCommander::determineRigCaps() createMode(modeCW, 0x03, "CW"), createMode(modeCW_R, 0x07, "CW-R"), }; break; + case model737: + rigCaps.modelName = QString("IC-737"); + rigCaps.rigctlModel = 3021; + rigCaps.hasSpectrum = false; + rigCaps.inputs.clear(); + rigCaps.hasLan = false; + rigCaps.hasEthernet = false; + rigCaps.hasWiFi = false; + rigCaps.hasFDcomms = false; + rigCaps.hasATU = false; + rigCaps.hasPTTCommand = false; + rigCaps.useRTSforPTT = true; + rigCaps.hasDataModes = false; + rigCaps.hasIFShift = true; // untested + rigCaps.attenuators.push_back('\x20'); + rigCaps.preamps.push_back('\x01'); + rigCaps.bands = standardHF; + rigCaps.modes = { createMode(modeLSB, 0x00, "LSB"), createMode(modeUSB, 0x01, "USB"), + createMode(modeAM, 0x02, "AM"), createMode(modeFM, 0x05, "FM"), + createMode(modeCW, 0x03, "CW"), createMode(modeCW_R, 0x07, "CW-R"), + }; + break; + case model738: + rigCaps.modelName = QString("IC-738"); + rigCaps.rigctlModel = 3022; + rigCaps.hasSpectrum = false; + rigCaps.inputs.clear(); + rigCaps.hasLan = false; + rigCaps.hasEthernet = false; + rigCaps.hasWiFi = false; + rigCaps.hasFDcomms = false; + rigCaps.hasATU = false; + rigCaps.hasPTTCommand = false; + rigCaps.useRTSforPTT = true; + rigCaps.hasDataModes = false; + rigCaps.hasIFShift = true; // untested + rigCaps.attenuators.push_back('\x20'); + rigCaps.preamps.push_back('\x01'); + rigCaps.bands = standardHF; + rigCaps.modes = { createMode(modeLSB, 0x00, "LSB"), createMode(modeUSB, 0x01, "USB"), + createMode(modeAM, 0x02, "AM"), createMode(modeFM, 0x05, "FM"), + createMode(modeCW, 0x03, "CW"), createMode(modeCW_R, 0x07, "CW-R"), + }; + break; case model746: rigCaps.modelName = QString("IC-746"); rigCaps.rigctlModel = 3023; @@ -3582,7 +3647,27 @@ void rigCommander::determineRigCaps() rigCaps.modes = commonModes; rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x00"); break; - + case model756: + rigCaps.modelName = QString("IC-756"); + rigCaps.rigctlModel = 3026; + rigCaps.hasSpectrum = false; + rigCaps.inputs.clear(); + rigCaps.hasLan = false; + rigCaps.hasEthernet = false; + rigCaps.hasWiFi = false; + rigCaps.hasFDcomms = false; + rigCaps.hasATU = true; + rigCaps.hasTBPF = true; + rigCaps.preamps.push_back('\x01'); + rigCaps.preamps.push_back('\x02'); + rigCaps.attenuators.insert(rigCaps.attenuators.end(),{ '\x06' , '\x12', '\x18'}); + rigCaps.antennas = {0x00, 0x01}; + rigCaps.bands = standardHF; + rigCaps.bands.push_back(bandGen); + rigCaps.bsr[bandGen] = 0x11; + rigCaps.modes = commonModes; + rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x00"); + break; case model756pro: rigCaps.modelName = QString("IC-756 Pro"); rigCaps.rigctlModel = 3027; diff --git a/rigidentities.cpp b/rigidentities.cpp index 62ea5aa..ab79ccc 100644 --- a/rigidentities.cpp +++ b/rigidentities.cpp @@ -8,6 +8,9 @@ model_kind determineRadioModel(unsigned char rigID) model_kind rig; + rig = (model_kind)rigID; + + /* switch(rigID) { case model7100: @@ -81,6 +84,8 @@ model_kind determineRadioModel(unsigned char rigID) break; } + */ + return rig; } diff --git a/rigidentities.h b/rigidentities.h index d4c4209..5a8b53a 100644 --- a/rigidentities.h +++ b/rigidentities.h @@ -27,11 +27,15 @@ enum model_kind { model7410 = 0x80, model7850 = 0x8E, model9700 = 0xA2, + model703 = 0x68, model705 = 0xA4, model706 = 0x58, model718 = 0x5E, model736 = 0x40, + model737 = 0x3C, + model738 = 0x44, model746 = 0x56, + model756 = 0x50, model756pro = 0x5C, model756proii = 0x64, model756proiii = 0x6E, diff --git a/wfmain.cpp b/wfmain.cpp index 9a3860b..2288c48 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -3680,13 +3680,10 @@ void wfmain::receiveRigID(rigCapabilities rigCaps) setBandButtons(); - ui->tuneEnableChk->setEnabled(rigCaps.hasATU); ui->tuneNowBtn->setEnabled(rigCaps.hasATU); - ui->useRTSforPTTchk->blockSignals(true); - ui->useRTSforPTTchk->setChecked(rigCaps.useRTSforPTT); - ui->useRTSforPTTchk->blockSignals(false); + ui->useRTSforPTTchk->setChecked(prefs.forceRTSasPTT); ui->audioSystemCombo->setEnabled(false); ui->audioSystemServerCombo->setEnabled(false); From 45244c7c640b50d7e03055107df442f8fb12172d Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Wed, 23 Nov 2022 20:44:32 -0800 Subject: [PATCH 180/207] Fixed annoying indentation issue. --- rigcommander.cpp | 87 +++++++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 45 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index 80c3e53..84f8e1e 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -3486,27 +3486,27 @@ void rigCommander::determineRigCaps() createMode(modePSK_R, 0x13, "PSK-R")}); rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x95"); break; - case model703: - rigCaps.modelName = QString("IC-703"); - rigCaps.rigctlModel = 3055; - rigCaps.hasSpectrum = false; - rigCaps.inputs.clear(); - rigCaps.hasLan = false; - rigCaps.hasEthernet = false; - rigCaps.hasWiFi = false; - rigCaps.hasFDcomms = false; - rigCaps.hasATU = true; - rigCaps.hasPTTCommand = false; - rigCaps.useRTSforPTT = true; - rigCaps.hasDataModes = false; - rigCaps.attenuators.push_back('\x20'); - rigCaps.bands = standardHF; - rigCaps.bands.insert(rigCaps.bands.end(), standardVU.begin(), standardVU.end()); - rigCaps.bands.push_back(bandGen); - rigCaps.modes = commonModes; - rigCaps.modes.insert(rigCaps.modes.end(), createMode(modeWFM, 0x06, "WFM")); - rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x00"); - break; + case model703: + rigCaps.modelName = QString("IC-703"); + rigCaps.rigctlModel = 3055; + rigCaps.hasSpectrum = false; + rigCaps.inputs.clear(); + rigCaps.hasLan = false; + rigCaps.hasEthernet = false; + rigCaps.hasWiFi = false; + rigCaps.hasFDcomms = false; + rigCaps.hasATU = true; + rigCaps.hasPTTCommand = false; + rigCaps.useRTSforPTT = true; + rigCaps.hasDataModes = false; + rigCaps.attenuators.push_back('\x20'); + rigCaps.bands = standardHF; + rigCaps.bands.insert(rigCaps.bands.end(), standardVU.begin(), standardVU.end()); + rigCaps.bands.push_back(bandGen); + rigCaps.modes = commonModes; + rigCaps.modes.insert(rigCaps.modes.end(), createMode(modeWFM, 0x06, "WFM")); + rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x00"); + break; case model706: rigCaps.modelName = QString("IC-706"); rigCaps.rigctlModel = 3009; @@ -3567,7 +3567,6 @@ void rigCommander::determineRigCaps() rigCaps.hasPTTCommand = false; rigCaps.useRTSforPTT = true; rigCaps.hasDataModes = false; - rigCaps.hasIFShift = true; // untested rigCaps.attenuators.push_back('\x20'); rigCaps.preamps.push_back('\x01'); rigCaps.bands = standardHF; @@ -3576,28 +3575,27 @@ void rigCommander::determineRigCaps() createMode(modeCW, 0x03, "CW"), createMode(modeCW_R, 0x07, "CW-R"), }; break; - case model737: - rigCaps.modelName = QString("IC-737"); - rigCaps.rigctlModel = 3021; - rigCaps.hasSpectrum = false; - rigCaps.inputs.clear(); - rigCaps.hasLan = false; - rigCaps.hasEthernet = false; - rigCaps.hasWiFi = false; - rigCaps.hasFDcomms = false; - rigCaps.hasATU = false; - rigCaps.hasPTTCommand = false; - rigCaps.useRTSforPTT = true; - rigCaps.hasDataModes = false; - rigCaps.hasIFShift = true; // untested - rigCaps.attenuators.push_back('\x20'); - rigCaps.preamps.push_back('\x01'); - rigCaps.bands = standardHF; - rigCaps.modes = { createMode(modeLSB, 0x00, "LSB"), createMode(modeUSB, 0x01, "USB"), - createMode(modeAM, 0x02, "AM"), createMode(modeFM, 0x05, "FM"), - createMode(modeCW, 0x03, "CW"), createMode(modeCW_R, 0x07, "CW-R"), - }; - break; + case model737: + rigCaps.modelName = QString("IC-737"); + rigCaps.rigctlModel = 3021; + rigCaps.hasSpectrum = false; + rigCaps.inputs.clear(); + rigCaps.hasLan = false; + rigCaps.hasEthernet = false; + rigCaps.hasWiFi = false; + rigCaps.hasFDcomms = false; + rigCaps.hasATU = false; + rigCaps.hasPTTCommand = false; + rigCaps.useRTSforPTT = true; + rigCaps.hasDataModes = false; + rigCaps.attenuators.push_back('\x20'); + rigCaps.preamps.push_back('\x01'); + rigCaps.bands = standardHF; + rigCaps.modes = { createMode(modeLSB, 0x00, "LSB"), createMode(modeUSB, 0x01, "USB"), + createMode(modeAM, 0x02, "AM"), createMode(modeFM, 0x05, "FM"), + createMode(modeCW, 0x03, "CW"), createMode(modeCW_R, 0x07, "CW-R"), + }; + break; case model738: rigCaps.modelName = QString("IC-738"); rigCaps.rigctlModel = 3022; @@ -3611,7 +3609,6 @@ void rigCommander::determineRigCaps() rigCaps.hasPTTCommand = false; rigCaps.useRTSforPTT = true; rigCaps.hasDataModes = false; - rigCaps.hasIFShift = true; // untested rigCaps.attenuators.push_back('\x20'); rigCaps.preamps.push_back('\x01'); rigCaps.bands = standardHF; From bb5ae0323527e7d5f398d95b4113b78e1101d16e Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Wed, 23 Nov 2022 21:56:36 -0800 Subject: [PATCH 181/207] Cleaned up rigidentities --- rigidentities.cpp | 82 ----------------------------------------------- 1 file changed, 82 deletions(-) diff --git a/rigidentities.cpp b/rigidentities.cpp index ab79ccc..1950ab1 100644 --- a/rigidentities.cpp +++ b/rigidentities.cpp @@ -7,89 +7,7 @@ model_kind determineRadioModel(unsigned char rigID) { model_kind rig; - rig = (model_kind)rigID; - /* - switch(rigID) - { - case model7100: - rig = model7100; - break; - case model7200: - rig = model7200; - break; - case model7300: - rig = model7300; - break; - case modelR8600: - rig = modelR8600; - break; - case model7000: - rig = model7000; - break; - case model7410: - rig = model7410; - break; - case model7600: - rig = model7600; - break; - case model7610: - rig = model7610; - break; - case model7700: - rig = model7700; - break; - case model7800: - rig = model7800; - break; - case model7850: - rig = model7850; - break; - case model9700: - rig = model9700; - break; - case model706: - rig = model706; - break; - case model705: - rig = model705; - break; - case model718: - rig = model718; - break; - case model736: - rig = model736; - break; - case model746: - rig = model746; - break; - case model756pro: - rig = model756pro; - break; - case model756proii: - rig = model756proii; - break; - case model756proiii: - rig = model756proiii; - break; - case model910h: - rig = model910h; - break; - case model9100: - rig = model9100; - break; - default: - rig = modelUnknown; - break; - } - - */ - return rig; } - - - - - From 9a63a6c4c439d46d089e8ddc74caa0bb64f28e22 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Wed, 23 Nov 2022 22:45:29 -0800 Subject: [PATCH 182/207] Fixed minor typo in debug text. --- rigcommander.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index 84f8e1e..6d537e9 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -4394,7 +4394,7 @@ void rigCommander::setRigID(unsigned char rigID) // It can be used for radios without Rig ID commands, // or to force a specific radio model - qInfo(logRig()) << "Sending rig ID to: (int)" << (int)rigID; + qInfo(logRig()) << "Setting rig ID to: (int)" << (int)rigID; lookingForRig = true; From e1e9167622d98b78224f82f19cc4eb9e90b5973a Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Wed, 23 Nov 2022 23:26:11 -0800 Subject: [PATCH 183/207] Fixed unusual set of conditions in which manual CI-V address would fail to identify the connected radio. The fix is to continually poll the RigID until one is received. Radios that don't support RigID will need to check both boxes in wfview (use rig as model number) to manually ID the radio. --- wfmain.cpp | 36 +++++++++++------------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 2288c48..29cf272 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -632,10 +632,13 @@ void wfmain::receiveCommReady() if(prefs.CIVisRadioModel) { qInfo(logSystem()) << "Skipping Rig ID query, using user-supplied model from CI-V address: " << prefs.radioCIVAddr; + emit setCIVAddr(prefs.radioCIVAddr); emit setRigID(prefs.radioCIVAddr); } else { + emit setCIVAddr(prefs.radioCIVAddr); emit getRigID(); - getInitialRigState(); + issueDelayedCommand(cmdGetRigID); + delayedCommand->start(); } } } @@ -3100,8 +3103,12 @@ void wfmain::doCmd(cmds cmd) //qInfo(logSystem()) << "NOOP"; break; case cmdGetRigID: - emit getRigID(); - break; + if(!haveRigCaps) + { + emit getRigID(); + issueDelayedCommand(cmdGetRigID); + } + break; case cmdGetRigCIV: // if(!know rig civ already) if(!haveRigCaps) @@ -6753,28 +6760,7 @@ void wfmain::on_underlayAverageBuffer_toggled(bool checked) void wfmain::on_debugBtn_clicked() { qInfo(logSystem()) << "Debug button pressed."; - // issueDelayedCommand(cmdGetRigID); - //emit getRigCIV(); - //trxadj->show(); - //setRadioTimeDatePrep(); - //wf->setInteraction(QCP::iRangeZoom, true); - //wf->setInteraction(QCP::iRangeDrag, true); - plot->yAxis->setRange(QCPRange(plotFloor, plotCeiling)); - colorMap->setDataRange(QCPRange(wfFloor, wfCeiling)); - -// bool ok; -// int height = QInputDialog::getInt(this, "wfview window fixed height", "number: ", 350, 1, 500, 1, &ok ); - -// this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); -// this->setMaximumSize(QSize(1025,height)); -// this->setMinimumSize(QSize(1025,height)); -// //this->setMaximumSize(QSize(929, 270)); -// //this->setMinimumSize(QSize(929, 270)); - -// resize(minimumSize()); -// adjustSize(); // main window -// adjustSize(); - + emit getRigID(); } // ---------- color helper functions: ---------- // From afcf087a70ea2fa224294b0bc170271bc109e1d6 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Thu, 24 Nov 2022 11:43:27 -0800 Subject: [PATCH 184/207] Fixed color preset zero issue. --- wfmain.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/wfmain.cpp b/wfmain.cpp index 29cf272..8a894a9 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -1217,6 +1217,7 @@ void wfmain::setUIToPrefs() } ui->colorPresetCombo->setCurrentIndex(prefs.currentColorPresetNumber); + loadColorPresetToUIandPlots(prefs.currentColorPresetNumber); ui->wfthemeCombo->setCurrentIndex(ui->wfthemeCombo->findData(prefs.wftheme)); colorMap->setGradient(static_cast(prefs.wftheme)); From 1fe19166f34c29c51fc51050570a1ae2b3204e38 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sat, 26 Nov 2022 19:01:16 +0000 Subject: [PATCH 185/207] Add some more commands --- rigcommander.cpp | 41 +++++++++++++++++++++++++---------------- rigctld.cpp | 29 ++++++++--------------------- rigstate.h | 3 +-- 3 files changed, 34 insertions(+), 39 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index e2c23d7..965674b 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -1507,6 +1507,7 @@ void rigCommander::parseLevels() break; case '\x0C': // CW Keying Speed - ignore for now + state.set(KEYSPD, level, false); break; case '\x0D': // Notch filder setting - ignore for now @@ -4874,6 +4875,22 @@ void rigCommander::stateUpdated() } break; } + case PBTIN: { + if (i.value()._valid) { + QByteArray payload("\x14\x07"); + payload.append(bcdEncodeInt(state.getChar(PBTIN))); + prepDataAndSend(payload); + } + break; + } + case PBTOUT: { + if (i.value()._valid) { + QByteArray payload("\x14\x08"); + payload.append(bcdEncodeInt(state.getChar(PBTOUT))); + prepDataAndSend(payload); + } + break; + } case CWPITCH: { if (i.value()._valid) { QByteArray payload("\x14\x09"); @@ -4882,6 +4899,14 @@ void rigCommander::stateUpdated() } break; } + case KEYSPD: { + if (i.value()._valid) { + QByteArray payload("\x14\x0c"); + payload.append(bcdEncodeInt(state.getChar(KEYSPD))); + prepDataAndSend(payload); + } + break; + } case NOTCHF: { if (i.value()._valid) { QByteArray payload("\x14\x0d"); @@ -4897,22 +4922,6 @@ void rigCommander::stateUpdated() getIFShift(); break; } - case PBTIN: { - if (i.value()._valid) { - QByteArray payload("\x14\x07"); - payload.append(bcdEncodeInt(state.getChar(PBTIN))); - prepDataAndSend(payload); - } - break; - } - case PBTOUT: { - if (i.value()._valid) { - QByteArray payload("\x14\x08"); - payload.append(bcdEncodeInt(state.getChar(PBTOUT))); - prepDataAndSend(payload); - } - break; - } case APF: break; case BAL: diff --git a/rigctld.cpp b/rigctld.cpp index 29c3761..416aac6 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -144,7 +144,7 @@ void rigCtlClient::socketReadyRead() continue; } - //qDebug(logRigCtlD()) << sessionId << "RX:" << commands; + qDebug(logRigCtlD()) << sessionId << "RX:" << commands; // We have a full line so process command. @@ -456,7 +456,7 @@ void rigCtlClient::socketReadyRead() } else if (command[0] == "v" || command[0] == "v\nv" || command[0] == "get_vfo") { - QString resp; + QString resp; if (longReply) { resp.append("VFO: "); } @@ -475,7 +475,7 @@ void rigCtlClient::socketReadyRead() } else if (command.length() > 1 && (command[0] == "V" || command[0] == "set_vfo")) { - setCommand = true; + setCommand = true; if (command[1] == "?") { response.append("set_vfo: ?"); response.append("VFOA"); @@ -499,7 +499,7 @@ void rigCtlClient::socketReadyRead() } else if (command[0] == "s" || command[0] == "get_split_vfo") { - + if (longReply) { response.append(QString("Split: %1").arg(rigState->getChar(DUPLEX))); } @@ -625,7 +625,7 @@ void rigCtlClient::socketReadyRead() response.append(QString("%1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE)))); response.append(QString("%1").arg(rigState->getUInt16(PASSBAND))); } - qDebug(logRigCtlD()) << QString("get_mode: %1 passband: %2").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE))).arg(rigState->getUInt16(PASSBAND)); + //qDebug(logRigCtlD()) << QString("get_mode: %1 passband: %2").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE))).arg(rigState->getUInt16(PASSBAND)); } else if (command[0] == "M" || command[0] == "set_mode") { @@ -674,19 +674,6 @@ void rigCtlClient::socketReadyRead() rigState->set(PASSBAND, passband, true); } } - else if (command[0] == "s" || command[0] == "get_split_vfo") - { - if (longReply) { - response.append(QString("Split: 1")); - response.append(QString("TX VFO: VFOB")); - } - else - { - response.append("1"); - response.append("VFOB"); - } - - } else if (command[0] == "j" || command[0] == "get_rit") { QString resp; @@ -817,7 +804,7 @@ void rigCtlClient::socketReadyRead() resp.append(QString("%1").arg((float)rigState->getChar(BAL) / 255.0)); } else if (command[1] == "KEYSPD") { - resp.append(QString("%1").arg(rigState->getChar(KEYSPD))); + resp.append(QString("%1").arg(rigState->getChar(KEYSPD)/5.1)); } else { resp.append(QString("%1").arg(value)); @@ -910,8 +897,8 @@ void rigCtlClient::socketReadyRead() rigState->set(BAL, quint8(value), true); } else if (command[1] == "KEYSPD") { - value = command[2].toInt(); - rigState->set(IF, quint8(value), true); + value = command[2].toInt() * 5.1; + rigState->set(KEYSPD, quint8(value), true); } qInfo(logRigCtlD()) << "Setting:" << command[1] << command[2] << value; diff --git a/rigstate.h b/rigstate.h index 031a37c..478f471 100644 --- a/rigstate.h +++ b/rigstate.h @@ -13,12 +13,11 @@ // Meters at the end as they are ALWAYS updated from the rig! enum stateTypes { VFOAFREQ, VFOBFREQ, CURRENTVFO, PTT, MODE, FILTER, PASSBAND, DUPLEX, DATAMODE, ANTENNA, RXANTENNA, CTCSS, TSQL, DTCS, CSQL, - PREAMP, AGC, ATTENUATOR, MODINPUT, AFGAIN, RFGAIN, SQUELCH, RFPOWER, MICGAIN, COMPLEVEL, MONITORLEVEL, BAL, + PREAMP, AGC, ATTENUATOR, MODINPUT, AFGAIN, RFGAIN, SQUELCH, RFPOWER, MICGAIN, COMPLEVEL, MONITORLEVEL, BAL, KEYSPD, VOXGAIN, ANTIVOXGAIN, CWPITCH, NOTCHF, IF, PBTIN, PBTOUT, APF, NR, NB, NBDEPTH, NBWIDTH, RIGINPUT, POWERONOFF, RITVALUE, FAGCFUNC, NBFUNC, COMPFUNC, VOXFUNC, TONEFUNC, TSQLFUNC, SBKINFUNC, FBKINFUNC, ANFFUNC, NRFUNC, AIPFUNC, APFFUNC, MONFUNC, MNFUNC,RFFUNC, AROFUNC, MUTEFUNC, VSCFUNC, REVFUNC, SQLFUNC, ABMFUNC, BCFUNC, MBCFUNC, RITFUNC, AFCFUNC, SATMODEFUNC, SCOPEFUNC, RESUMEFUNC, TBURSTFUNC, TUNERFUNC, LOCKFUNC, SMETER, POWERMETER, SWRMETER, ALCMETER, COMPMETER, VOLTAGEMETER, CURRENTMETER, - KEYSPD }; struct value { From 81f9e9bfcf6dbc56a86aeb6d729b0957638f05e9 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sat, 26 Nov 2022 19:10:59 +0000 Subject: [PATCH 186/207] Update some rig definitions to work with new band struct. --- rigcommander.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index 7d03d07..444d08b 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -3582,7 +3582,7 @@ void rigCommander::determineRigCaps() rigCaps.attenuators.push_back('\x20'); rigCaps.bands = standardHF; rigCaps.bands.insert(rigCaps.bands.end(), standardVU.begin(), standardVU.end()); - rigCaps.bands.push_back(bandGen); + rigCaps.bands.push_back(bandDefGen); rigCaps.modes = commonModes; rigCaps.modes.insert(rigCaps.modes.end(), createMode(modeWFM, 0x06, "WFM")); rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x00"); @@ -3740,7 +3740,7 @@ void rigCommander::determineRigCaps() rigCaps.attenuators.insert(rigCaps.attenuators.end(),{ '\x06' , '\x12', '\x18'}); rigCaps.antennas = {0x00, 0x01}; rigCaps.bands = standardHF; - rigCaps.bands.push_back(bandGen); + rigCaps.bands.push_back(bandDefGen); rigCaps.bsr[bandGen] = 0x11; rigCaps.modes = commonModes; rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x00"); From b25c8a93f3f0c7fbb860ed645bf62e0f159bc2f3 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sat, 26 Nov 2022 20:45:32 -0800 Subject: [PATCH 187/207] Moved preferences to prefs.h, which should make it easier to add new preferences. Moved custom types (as it seemed useful here and there) to wfviewtypes.h. Let's use the wfviewtypes.h file for any kind of datatype which more than one module can make use of. --- audioconverter.h | 2 +- prefs.h | 50 +++++++++++++++++++++++++++++++++++++++++++++++ rigcommander.h | 44 +---------------------------------------- wfmain.h | 47 +++----------------------------------------- wfview.pro | 4 +++- wfviewtypes.h | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 109 insertions(+), 89 deletions(-) create mode 100644 prefs.h create mode 100644 wfviewtypes.h diff --git a/audioconverter.h b/audioconverter.h index b3a1492..b0eb1ad 100644 --- a/audioconverter.h +++ b/audioconverter.h @@ -17,7 +17,7 @@ #include #endif -enum audioType {qtAudio,portAudio,rtAudio}; +#include "wfviewtypes.h" #include "resampler/speex_resampler.h" diff --git a/prefs.h b/prefs.h new file mode 100644 index 0000000..5afbe6c --- /dev/null +++ b/prefs.h @@ -0,0 +1,50 @@ +#ifndef PREFS_H +#define PREFS_H + +#include + +#include "wfviewtypes.h" + +struct preferences { + bool useFullScreen; + bool useSystemTheme; + bool drawPeaks; + underlay_t underlayMode = underlayNone; + int underlayBufferSize = 64; + bool wfAntiAlias; + bool wfInterpolate; + QString stylesheetPath; + unsigned char radioCIVAddr; + bool CIVisRadioModel; + bool forceRTSasPTT; + QString serialPortRadio; + quint32 serialPortBaud; + bool enablePTT; + bool niceTS; + bool enableLAN; + bool enableRigCtlD; + quint16 rigCtlPort; + int currentColorPresetNumber = 0; + QString virtualSerialPort; + unsigned char localAFgain; + unsigned int wflength; + int wftheme; + int plotFloor; + int plotCeiling; + bool confirmExit; + bool confirmPowerOff; + meterKind meter2Type; + quint16 tcpPort; + quint8 waterfallFormat; + audioType audioSystem; + bool clusterUdpEnable; + bool clusterTcpEnable; + int clusterUdpPort; + QString clusterTcpServerName; + QString clusterTcpUserName; + QString clusterTcpPassword; + int clusterTimeout; + bool clickDragTuningEnable; +}; + +#endif // PREFS_H diff --git a/rigcommander.h b/rigcommander.h index 3655e41..9f51f5c 100644 --- a/rigcommander.h +++ b/rigcommander.h @@ -5,7 +5,7 @@ #include #include - +#include "wfviewtypes.h" #include "commhandler.h" #include "pttyhandler.h" #include "udphandler.h" @@ -23,48 +23,6 @@ // note: using a define because switch case doesn't even work with const unsigned char. Surprised me. #define compCivAddr 0xE1 -enum meterKind { - meterNone=0, - meterS, - meterCenter, - meterSWR, - meterPower, - meterALC, - meterComp, - meterVoltage, - meterCurrent, - meterRxdB, - meterTxMod, - meterRxAudio, - meterAudio, - meterLatency -}; - -enum spectrumMode { - spectModeCenter=0x00, - spectModeFixed=0x01, - spectModeScrollC=0x02, - spectModeScrollF=0x03, - spectModeUnknown=0xff -}; - -struct freqt { - quint64 Hz; - double MHzDouble; -}; - -struct datekind { - uint16_t year; - unsigned char month; - unsigned char day; -}; - -struct timekind { - unsigned char hours; - unsigned char minutes; - bool isMinus; -}; - class rigCommander : public QObject { Q_OBJECT diff --git a/wfmain.h b/wfmain.h index 826e902..b27f16f 100644 --- a/wfmain.h +++ b/wfmain.h @@ -20,6 +20,8 @@ #include #include "logcategories.h" +#include "wfviewtypes.h" +#include "prefs.h" #include "commhandler.h" #include "rigcommander.h" #include "rigstate.h" @@ -799,9 +801,6 @@ private: quint16 wfLength; bool spectrumDrawLock; - enum underlay_t { underlayNone, underlayPeakHold, underlayPeakBuffer, underlayAverageBuffer }; - - QByteArray spectrumPeaks; QVector spectrumPlasmaLine; QVector spectrumPlasma; @@ -902,47 +901,7 @@ private: colorPrefsType colorPreset[numColorPresetsTotal]; - struct preferences { - bool useFullScreen; - bool useSystemTheme; - bool drawPeaks; - underlay_t underlayMode = underlayNone; - int underlayBufferSize = 64; - bool wfAntiAlias; - bool wfInterpolate; - QString stylesheetPath; - unsigned char radioCIVAddr; - bool CIVisRadioModel; - bool forceRTSasPTT; - QString serialPortRadio; - quint32 serialPortBaud; - bool enablePTT; - bool niceTS; - bool enableLAN; - bool enableRigCtlD; - quint16 rigCtlPort; - int currentColorPresetNumber = 0; - QString virtualSerialPort; - unsigned char localAFgain; - unsigned int wflength; - int wftheme; - int plotFloor; - int plotCeiling; - bool confirmExit; - bool confirmPowerOff; - meterKind meter2Type; - quint16 tcpPort; - quint8 waterfallFormat; - audioType audioSystem; - bool clusterUdpEnable; - bool clusterTcpEnable; - int clusterUdpPort; - QString clusterTcpServerName; - QString clusterTcpUserName; - QString clusterTcpPassword; - int clusterTimeout; - bool clickDragTuningEnable; - } prefs; + preferences prefs; preferences defPrefs; udpPreferences udpPrefs; diff --git a/wfview.pro b/wfview.pro index ce40277..72163a8 100644 --- a/wfview.pro +++ b/wfview.pro @@ -185,6 +185,7 @@ HEADERS += wfmain.h \ colorprefs.h \ commhandler.h \ loggingwindow.h \ + prefs.h \ rigcommander.h \ freqmemory.h \ rigidentities.h \ @@ -217,7 +218,8 @@ HEADERS += wfmain.h \ tcpserver.h \ cluster.h \ database.h \ - aboutbox.h + aboutbox.h \ + wfviewtypes.h FORMS += wfmain.ui \ diff --git a/wfviewtypes.h b/wfviewtypes.h new file mode 100644 index 0000000..46876b8 --- /dev/null +++ b/wfviewtypes.h @@ -0,0 +1,51 @@ +#ifndef WFVIEWTYPES_H +#define WFVIEWTYPES_H + +enum underlay_t { underlayNone, underlayPeakHold, underlayPeakBuffer, underlayAverageBuffer }; + +enum meterKind { + meterNone=0, + meterS, + meterCenter, + meterSWR, + meterPower, + meterALC, + meterComp, + meterVoltage, + meterCurrent, + meterRxdB, + meterTxMod, + meterRxAudio, + meterAudio, + meterLatency +}; + +enum spectrumMode { + spectModeCenter=0x00, + spectModeFixed=0x01, + spectModeScrollC=0x02, + spectModeScrollF=0x03, + spectModeUnknown=0xff +}; + +struct freqt { + quint64 Hz; + double MHzDouble; +}; + +struct datekind { + uint16_t year; + unsigned char month; + unsigned char day; +}; + +struct timekind { + unsigned char hours; + unsigned char minutes; + bool isMinus; +}; + +enum audioType {qtAudio,portAudio,rtAudio}; + + +#endif // WFVIEWTYPES_H From 39caf4190543abb737798492515e825158feae2c Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sat, 26 Nov 2022 20:53:12 -0800 Subject: [PATCH 188/207] Added program version number to the settings file. Currently it is merely written to and not used. --- prefs.h | 1 + wfmain.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/prefs.h b/prefs.h index 5afbe6c..f41ab9f 100644 --- a/prefs.h +++ b/prefs.h @@ -6,6 +6,7 @@ #include "wfviewtypes.h" struct preferences { + QString version; bool useFullScreen; bool useSystemTheme; bool drawPeaks; diff --git a/wfmain.cpp b/wfmain.cpp index 8a894a9..7d1cb9e 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -2098,6 +2098,10 @@ void wfmain::saveSettings() qInfo(logSystem()) << "Saving settings to " << settings->fileName(); // Basic things to load: + settings->beginGroup("Program"); + settings->setValue("version", QString(WFVIEW_VERSION)); + settings->endGroup(); + // UI: (full screen, dark theme, draw peaks, colors, etc) settings->beginGroup("Interface"); settings->setValue("UseFullScreen", prefs.useFullScreen); From 4f6da002064970928305efc86a90f68424599bd0 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sat, 26 Nov 2022 21:43:47 -0800 Subject: [PATCH 189/207] Added polling preferences and changed UI elements to radio buttons with spin box. --- prefs.h | 1 + wfmain.cpp | 91 +++++++++++++++++++++++++++++++++++++++++++++--------- wfmain.h | 9 ++++-- wfmain.ui | 62 +++++++++++++++++++++++++++---------- 4 files changed, 129 insertions(+), 34 deletions(-) diff --git a/prefs.h b/prefs.h index f41ab9f..96f13e2 100644 --- a/prefs.h +++ b/prefs.h @@ -20,6 +20,7 @@ struct preferences { bool forceRTSasPTT; QString serialPortRadio; quint32 serialPortBaud; + int polling_ms; bool enablePTT; bool niceTS; bool enableLAN; diff --git a/wfmain.cpp b/wfmain.cpp index 7d1cb9e..f6606fb 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -1420,6 +1420,7 @@ void wfmain::setDefPrefs() defPrefs.forceRTSasPTT = false; defPrefs.serialPortRadio = QString("auto"); defPrefs.serialPortBaud = 115200; + defPrefs.polling_ms = 0; // 0 = Automatic defPrefs.enablePTT = false; defPrefs.niceTS = true; defPrefs.enableRigCtlD = false; @@ -1568,6 +1569,27 @@ void wfmain::loadSettings() serverConfig.baudRate = prefs.serialPortBaud; } + prefs.polling_ms = settings->value("polling_ms", defPrefs.polling_ms).toInt(); + if(prefs.polling_ms == 0) + { + // Automatic + ui->pollingButtonGroup->blockSignals(true); + ui->autoPollBtn->setChecked(true); + ui->manualPollBtn->setChecked(false); + ui->pollingButtonGroup->blockSignals(false); + ui->pollTimeMsSpin->setEnabled(false); + } else { + // Manual + ui->pollingButtonGroup->blockSignals(true); + ui->autoPollBtn->setChecked(false); + ui->manualPollBtn->setChecked(true); + ui->pollingButtonGroup->blockSignals(false); + ui->pollTimeMsSpin->blockSignals(true); + ui->pollTimeMsSpin->setValue(prefs.polling_ms); + ui->pollTimeMsSpin->blockSignals(false); + ui->pollTimeMsSpin->setEnabled(true); + } + prefs.virtualSerialPort = settings->value("VirtualSerialPort", defPrefs.virtualSerialPort).toString(); int vspIndex = ui->vspCombo->findText(prefs.virtualSerialPort); if (vspIndex != -1) { @@ -2131,6 +2153,7 @@ void wfmain::saveSettings() settings->setValue("RigCIVuInt", prefs.radioCIVAddr); settings->setValue("CIVisRadioModel", prefs.CIVisRadioModel); settings->setValue("ForceRTSasPTT", prefs.forceRTSasPTT); + settings->setValue("polling_ms", prefs.polling_ms); // 0 = automatic settings->setValue("SerialPortRadio", prefs.serialPortRadio); settings->setValue("SerialPortBaud", prefs.serialPortBaud); settings->setValue("VirtualSerialPort", prefs.virtualSerialPort); @@ -3713,7 +3736,12 @@ void wfmain::receiveRigID(rigCapabilities rigCaps) issueDelayedCommand(cmdGetFreq); issueDelayedCommand(cmdGetMode); // recalculate command timing now that we know the rig better: - calculateTimingParameters(); + if(prefs.polling_ms != 0) + { + changePollTiming(prefs.polling_ms, true); + } else { + calculateTimingParameters(); + } initPeriodicCommands(); // Set the second meter here as I suspect we need to be connected for it to work? @@ -5885,6 +5913,10 @@ void wfmain::calculateTimingParameters() qInfo(logSystem()) << "Delay command interval timing: " << delayedCommand->interval() << "ms"; + ui->pollTimeMsSpin->blockSignals(true); + ui->pollTimeMsSpin->setValue(delayedCommand->interval()); + ui->pollTimeMsSpin->blockSignals(false); + // Normal: delayedCmdIntervalLAN_ms = delayedCommand->interval(); delayedCmdIntervalSerial_ms = delayedCommand->interval(); @@ -6166,20 +6198,6 @@ void wfmain::on_wfLengthSlider_valueChanged(int value) prepareWf(value); } -void wfmain::on_pollingBtn_clicked() -{ - bool ok; - int timing = 0; - timing = QInputDialog::getInt(this, "wfview Radio Polling Setup", "Poll Timing Interval (ms)", delayedCommand->interval(), 1, 200, 1, &ok ); - - if(ok && timing) - { - delayedCommand->setInterval( timing ); - qInfo(logSystem()) << "User changed radio polling interval to " << timing << "ms."; - showStatusBarText("User changed radio polling interval to " + QString("%1").arg(timing) + "ms."); - } -} - void wfmain::on_wfAntiAliasChk_clicked(bool checked) { colorMap->setAntialiased(checked); @@ -7836,3 +7854,46 @@ void wfmain::on_clickDragTuningEnableChk_clicked(bool checked) } + +void wfmain::on_autoPollBtn_clicked(bool checked) +{ + ui->pollTimeMsSpin->setEnabled(!checked); + if(checked) + { + prefs.polling_ms = 0; + qInfo(logSystem()) << "User set radio polling interval to automatic."; + calculateTimingParameters(); + } +} + +void wfmain::on_manualPollBtn_clicked(bool checked) +{ + ui->pollTimeMsSpin->setEnabled(checked); + if(checked) + { + prefs.polling_ms = ui->pollTimeMsSpin->value(); + changePollTiming(prefs.polling_ms); + } +} + +void wfmain::on_pollTimeMsSpin_valueChanged(int timing_ms) +{ + if(ui->manualPollBtn->isChecked()) + { + changePollTiming(timing_ms); + } +} + +void wfmain::changePollTiming(int timing_ms, bool setUI) +{ + delayedCommand->setInterval(timing_ms); + qInfo(logSystem()) << "User changed radio polling interval to " << timing_ms << "ms."; + showStatusBarText("User changed radio polling interval to " + QString("%1").arg(timing_ms) + "ms."); + prefs.polling_ms = timing_ms; + if(setUI) + { + ui->pollTimeMsSpin->blockSignals(true); + ui->pollTimeMsSpin->setValue(timing_ms); + ui->pollTimeMsSpin->blockSignals(false); + } +} diff --git a/wfmain.h b/wfmain.h index b27f16f..f3780e4 100644 --- a/wfmain.h +++ b/wfmain.h @@ -512,8 +512,6 @@ private slots: void on_wfLengthSlider_valueChanged(int value); - void on_pollingBtn_clicked(); - void on_wfAntiAliasChk_clicked(bool checked); void on_wfInterpolateChk_clicked(bool checked); @@ -684,6 +682,12 @@ private slots: void receiveClusterOutput(QString text); void receiveSpots(QList spots); + void on_autoPollBtn_clicked(bool checked); + + void on_manualPollBtn_clicked(bool checked); + + void on_pollTimeMsSpin_valueChanged(int arg1); + private: Ui::wfmain *ui; void closeEvent(QCloseEvent *event); @@ -972,6 +976,7 @@ private: void insertSlowPeriodicCommand(cmds cmd, unsigned char priority); void calculateTimingParameters(); + void changePollTiming(int timing_ms, bool setUI=false); void changeMode(mode_kind mode); void changeMode(mode_kind mode, bool dataOn); diff --git a/wfmain.ui b/wfmain.ui index 811e504..389c0be 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -6,7 +6,7 @@ 0 0 - 1023 + 1082 660 @@ -18,7 +18,7 @@ - 1 + 3 @@ -3147,18 +3147,45 @@ - - - Set up radio polling. The radio's meter is polled every-other interval. - - - Polling - - - - + - Polling + AutoPolling + + + true + + + pollingButtonGroup + + + + + + + Manual Polling Inteval: + + + pollingButtonGroup + + + + + + + Sets the polling interval, in ms. + + + 1 + + + 250 + + + + + + + ms @@ -3350,8 +3377,8 @@ 0 0 - 799 - 269 + 858 + 287 @@ -5262,8 +5289,8 @@ 0 0 - 1023 - 23 + 1082 + 21 @@ -5291,6 +5318,7 @@ + From 8a1347f17c69f1665a0fffb4c21ec1becfaad0be Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sat, 26 Nov 2022 21:45:27 -0800 Subject: [PATCH 190/207] Added some tooltips that nobody will notice. --- wfmain.ui | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wfmain.ui b/wfmain.ui index 389c0be..c6bab92 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -3148,6 +3148,9 @@ + + wfview will automatically calculate command polling. Recommended. + AutoPolling @@ -3161,6 +3164,9 @@ + + Manual (user-defined) command polling + Manual Polling Inteval: @@ -3172,7 +3178,7 @@ - Sets the polling interval, in ms. + Sets the polling interval, in ms. Automatic polling is recommended. Serial port and USB port radios should not poll quicker than about 75ms. 1 From 4c76cf6320750095ce34feb17bd7633a65972556 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 28 Nov 2022 09:44:42 +0000 Subject: [PATCH 191/207] Add missing prefs --- prefs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/prefs.h b/prefs.h index 96f13e2..4309e33 100644 --- a/prefs.h +++ b/prefs.h @@ -47,6 +47,7 @@ struct preferences { QString clusterTcpPassword; int clusterTimeout; bool clickDragTuningEnable; + bool clusterSkimmerSpotsEnable; }; #endif // PREFS_H From 06e4567b124964d56e2b8310f56cd490e378eff6 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Tue, 29 Nov 2022 09:40:07 +0100 Subject: [PATCH 192/207] bumped 1.53 --- WHATSNEW | 2 +- wfserver.pro | 2 +- wfview.pro | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index c40f907..9d1799b 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -19,7 +19,7 @@ The following highlights are in this 1.51-release ince v1.50: + 1.52 added cluster spotting including color picker suport optional SQLITE in memory for spots (disabled) -+ 1.xx modified band buttons to look more alike the layut on the rigs ++ 1.53 modified band buttons to look more alike the layout on the rigs audio selction combobox shows full devicenames diff --git a/wfserver.pro b/wfserver.pro index 782379f..43b906e 100644 --- a/wfserver.pro +++ b/wfserver.pro @@ -13,7 +13,7 @@ TEMPLATE = app CONFIG += console -DEFINES += WFVIEW_VERSION=\\\"1.52\\\" +DEFINES += WFVIEW_VERSION=\\\"1.53\\\" DEFINES += BUILD_WFSERVER diff --git a/wfview.pro b/wfview.pro index a7c39aa..5654e7d 100644 --- a/wfview.pro +++ b/wfview.pro @@ -14,7 +14,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport TARGET = wfview TEMPLATE = app -DEFINES += WFVIEW_VERSION=\\\"1.52\\\" +DEFINES += WFVIEW_VERSION=\\\"1.53\\\" DEFINES += BUILD_WFVIEW From 508f8700623661d42d8febc76bf8c2872e8cd08b Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Tue, 29 Nov 2022 10:29:10 +0100 Subject: [PATCH 193/207] CHANGELOG and WHATSNEW updated for 1.53 --- CHANGELOG | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ WHATSNEW | 9 ++++++- 2 files changed, 89 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 31769ea..a90975f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,86 @@ # CHANGELOG +- 20221129 + + bumped 1.53 + +- 20221128 + + Add missing prefs + Merge remote-tracking branch 'origin/pollprefs' into various-fixes + Added some tooltips that nobody will notice. + Added polling preferences and changed UI elements to radio buttons with + spin box. + Added program version number to the settings file. Currently it is merely + written to and not used. + Moved preferences to prefs.h, which should make it easier to add new + preferences. Moved custom types (as it seemed useful here and there) to + wfviewtypes.h. Let's use the wfviewtypes.h file for any kind of datatype + which more than one module can make use of. + Update some rig definitions to work with new band struct. + +- 20221126 + + Merge branch 'master' into various-fixes + Add some more commands + +- 20221124 + + Fixed color preset zero issue. + Fixed unusual set of conditions in which manual CI-V address would fail + to identify the connected radio. The fix is to continually poll the RigID + until one is received. Radios that don't support RigID will need to + check both boxes in wfview (use rig as model number) to manually ID the + radio. + Fixed minor typo in debug text. + Cleaned up rigidentities + Fixed annoying indentation issue. + Fixed broken RTS preference. Added preliminary (and untested) support + for the IC-703, 737, 738, and 756. + Fixed issue causing the current color preset to not be load (previously + preset zero was always used). + +- 20221101 + + added libs for suse builds; it also builds on leap 15.5 + +- 20221031 + + Fix passband warnings + Add skimmer support (setting not saved) + Key KEYSPD + Add AR Cluster support + Add more commands to rigctld + +- 20221029 + + Make bandType a struct containing frequency and default SSB mode + Remove spot display processing timer + Silly error in setting default cluster + +- 20221028 + + Send bye when disconnecting from cluster + Add passband to rigctld and allow setting + +- 20221025 + + combobox resizing fix + +- 20221024 + + Stop it cutting off some devices + +- 20221023 + + Resize according to boundingrect + Resize based on font size + Try new universal resize code + +- 20221022 + + added qt xml dev lib for suse + - 20221025 diff --git a/WHATSNEW b/WHATSNEW index 9d1799b..dad2f21 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -22,7 +22,14 @@ The following highlights are in this 1.51-release ince v1.50: + 1.53 modified band buttons to look more alike the layout on the rigs audio selction combobox shows full devicenames - + Fixed color preset zero issue. + Fixed unusual set of conditions in which manual CI-V address would fail + to identify the connected radio. + Fixed broken RTS preference. Added preliminary (and untested) support + for the IC-703, 737, 738, and 756. + added libs for suse builds; it also builds on leap 15.5 + Add skimmer support (setting not saved) + Add AR Cluster support Notes: From 9367d605f4ba0fa07ab2e9eced0f10271634c893 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Tue, 29 Nov 2022 10:30:53 +0100 Subject: [PATCH 194/207] fixed WHATSNEW formatting --- WHATSNEW | 2 -- 1 file changed, 2 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index dad2f21..b69fb82 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -18,10 +18,8 @@ The following highlights are in this 1.51-release ince v1.50: Remove logging of audio device realm + 1.52 added cluster spotting including color picker suport optional SQLITE in memory for spots (disabled) - + 1.53 modified band buttons to look more alike the layout on the rigs audio selction combobox shows full devicenames - Fixed color preset zero issue. Fixed unusual set of conditions in which manual CI-V address would fail to identify the connected radio. From f91dea47b518462deafac02991fbc8e2b3375e20 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 1 Dec 2022 12:32:10 +0000 Subject: [PATCH 195/207] Stop log warning on wfserver --- main.cpp | 4 ---- wfserver.pro | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index 90c3eb5..5d7c804 100644 --- a/main.cpp +++ b/main.cpp @@ -203,11 +203,7 @@ void messageHandler(QtMsgType type, const QMessageLogContext& context, const QSt } // Write to the output category of the message and the message itself out << context.category << ": " << msg << "\n"; -#ifdef BUILD_WFSERVER std::cout << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz ").toLocal8Bit().toStdString() << msg.toLocal8Bit().toStdString() << "\n"; -#endif - text = out.readAll(); out.flush(); // Clear the buffered data - //mainwindow.handleLogText(test); } #endif diff --git a/wfserver.pro b/wfserver.pro index 43b906e..80bd214 100644 --- a/wfserver.pro +++ b/wfserver.pro @@ -169,4 +169,5 @@ HEADERS += servermain.h \ ulaw.h \ tcpserver.h \ audiotaper.h \ - keyboard.h + keyboard.h \ + wfviewtypes.h \ No newline at end of file From 65ba69822a3d548b000d7729e14d2ef9b3ba3362 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 1 Dec 2022 13:08:29 +0000 Subject: [PATCH 196/207] Attempt to fix PortAudio issue --- pahandler.cpp | 14 +++++++++++--- pahandler.h | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pahandler.cpp b/pahandler.cpp index a3c4860..6963bc7 100644 --- a/pahandler.cpp +++ b/pahandler.cpp @@ -266,10 +266,16 @@ void paHandler::convertedOutput(audioPacket packet) { if (packet.data.size() > 0) { if (Pa_IsStreamActive(audio) == 1) { - PaError err = Pa_WriteStream(audio, (char*)packet.data.data(), packet.data.size() / sizeof(float) / outFormat.channelCount()); + if (currentLatency < (setup.latency)) { + PaError err = Pa_WriteStream(audio, (char*)packet.data.data(), packet.data.size() / sizeof(float) / outFormat.channelCount()); - if (err != paNoError) { - qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Error writing audio!"; + if (err != paNoError) { + qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Error writing audio!"; + } + } + else { + qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Disgarding audio data as current latency" << currentLatency << "exceeds setup latency" << setup.latency; + setup.latency++; } const PaStreamInfo* info = Pa_GetStreamInfo(audio); currentLatency = packet.time.msecsTo(QTime::currentTime()) + (info->outputLatency * 1000); @@ -298,6 +304,8 @@ void paHandler::convertedInput(audioPacket packet) void paHandler::changeLatency(const quint16 newSize) { qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "Changing latency to: " << newSize << " from " << setup.latency; + setup.latency = newSize; + latencyAllowance = 0; } int paHandler::getLatency() diff --git a/pahandler.h b/pahandler.h index c9bd474..77e322d 100644 --- a/pahandler.h +++ b/pahandler.h @@ -91,6 +91,7 @@ private: QThread* converterThread = Q_NULLPTR; bool isUnderrun = false; bool isOverrun = false; + int latencyAllowance = 0; }; #endif // PAHANDLER_H From 0b39b91665edea66105f937b2ccc3263e2e8f33b Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 1 Dec 2022 13:16:05 +0000 Subject: [PATCH 197/207] PA stop stream if latency exceeded and start again when data is received. --- pahandler.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pahandler.cpp b/pahandler.cpp index 6963bc7..c01431e 100644 --- a/pahandler.cpp +++ b/pahandler.cpp @@ -224,7 +224,13 @@ void paHandler::setVolume(unsigned char volume) void paHandler::incomingAudio(audioPacket packet) { packet.volume = volume; - emit sendToConverter(packet); + if (Pa_IsStreamActive(audio) == 1) { + emit sendToConverter(packet); + } + else + { + Pa_StartStream(audio); + } return; } @@ -266,7 +272,7 @@ void paHandler::convertedOutput(audioPacket packet) { if (packet.data.size() > 0) { if (Pa_IsStreamActive(audio) == 1) { - if (currentLatency < (setup.latency)) { + if (currentLatency < (setup.latency+latencyAllowance)) { PaError err = Pa_WriteStream(audio, (char*)packet.data.data(), packet.data.size() / sizeof(float) / outFormat.channelCount()); if (err != paNoError) { @@ -275,7 +281,8 @@ void paHandler::convertedOutput(audioPacket packet) { } else { qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Disgarding audio data as current latency" << currentLatency << "exceeds setup latency" << setup.latency; - setup.latency++; + Pa_StopStream(audio); + latencyAllowance++; } const PaStreamInfo* info = Pa_GetStreamInfo(audio); currentLatency = packet.time.msecsTo(QTime::currentTime()) + (info->outputLatency * 1000); From 8cfb3f70e5d6008024332f4c5804f60da7f45e70 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Fri, 2 Dec 2022 12:38:08 -0800 Subject: [PATCH 198/207] Added clearing to the plasma underlay display. --- wfmain.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index f79cd4b..c497b5e 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -3903,10 +3903,12 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e // TODO: create non-button function to do this // This will break if the button is ever moved or renamed. on_clearPeakBtn_clicked(); + } else { + plasmaPrepared = false; + preparePlasma(); } // Inform other threads (cluster) that the frequency range has changed. emit setFrequencyRange(startFreq, endFreq); - // TODO: Add clear-out for the buffer } oldLowerFreq = startFreq; @@ -3949,8 +3951,10 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e } plasmaMutex.lock(); spectrumPlasma.push_front(spectrum); - spectrumPlasma.pop_back(); - //spectrumPlasma.resize(spectrumPlasmaSize); + if(spectrumPlasma.size() > (int)spectrumPlasmaSize) + { + spectrumPlasma.pop_back(); + } plasmaMutex.unlock(); @@ -4065,10 +4069,13 @@ void wfmain::preparePlasma() plasmaMutex.lock(); spectrumPlasma.clear(); - for(unsigned int p=0; p < spectrumPlasmaSize; p++) - { - spectrumPlasma.append(empty); - } +// spectrumPlasma.append(empty); + +// It may be possible to skip this. +// for(unsigned int p=0; p < spectrumPlasmaSize; p++) +// { +// spectrumPlasma.append(empty); +// } spectrumPlasma.squeeze(); plasmaMutex.unlock(); From 82dfb9982239c8762b8e9475cb4b88dca0d4d7e6 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Fri, 2 Dec 2022 12:50:05 -0800 Subject: [PATCH 199/207] A little cleaner on the plasma mod. --- wfmain.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index c497b5e..24c6a1d 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -4061,7 +4061,6 @@ void wfmain::preparePlasma() { if(plasmaPrepared) return; - QByteArray empty((int)spectWidth, '\x01'); if(spectrumPlasmaSize == 0) spectrumPlasmaSize = 128; @@ -4069,13 +4068,6 @@ void wfmain::preparePlasma() plasmaMutex.lock(); spectrumPlasma.clear(); -// spectrumPlasma.append(empty); - -// It may be possible to skip this. -// for(unsigned int p=0; p < spectrumPlasmaSize; p++) -// { -// spectrumPlasma.append(empty); -// } spectrumPlasma.squeeze(); plasmaMutex.unlock(); From f6b1428267ce8da15e9c42ff6e205e6038e7f3a2 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Fri, 2 Dec 2022 13:32:02 -0800 Subject: [PATCH 200/207] Now tracking the plasma buffer user-desired size properly. --- wfmain.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/wfmain.cpp b/wfmain.cpp index 24c6a1d..c113a40 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -6698,6 +6698,7 @@ void wfmain::on_underlayBufferSlider_valueChanged(int value) { resizePlasmaBuffer(value); prefs.underlayBufferSize = value; + spectrumPlasmaSize = value; } void wfmain::resizePlasmaBuffer(int newSize) From e56294406a55ccf86413a6006f7e38ff4b141822 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 19 Dec 2022 19:26:51 +0000 Subject: [PATCH 201/207] Swap logfile/settings file on servermain --- main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 5d7c804..f0dcf72 100644 --- a/main.cpp +++ b/main.cpp @@ -155,7 +155,7 @@ int main(int argc, char *argv[]) signal(SIGTERM, cleanup); signal(SIGKILL, cleanup); #endif - w = new servermain(logFilename, settingsFile); + w = new servermain(settingsFile, logFilename); #else a.setWheelScrollLines(1); // one line per wheel click wfmain w(settingsFile, logFilename, debugMode); From 3bf095020c31f9a3ce96d58386b8ccbe0e0ab921 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 19 Dec 2022 19:41:23 +0000 Subject: [PATCH 202/207] Fix serial port detection. --- servermain.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/servermain.cpp b/servermain.cpp index 3257bfa..0a0c285 100644 --- a/servermain.cpp +++ b/servermain.cpp @@ -500,23 +500,16 @@ void servermain::loadSettings() tempPrefs->rxAudioSetup.type = prefs.audioSystem; tempPrefs->txAudioSetup.type = prefs.audioSystem; - QString tempPort = "auto"; - if (tempPrefs->rigName=="") - { + if (tempPrefs->serialPort == "auto") { foreach(const QSerialPortInfo & serialPortInfo, QSerialPortInfo::availablePorts()) { qDebug(logSystem()) << "Serial Port found: " << serialPortInfo.portName() << "Manufacturer:" << serialPortInfo.manufacturer() << "Product ID" << serialPortInfo.description() << "S/N" << serialPortInfo.serialNumber(); - if ((serialPortInfo.portName() == tempPrefs->serialPort || tempPrefs->serialPort == "auto") && !serialPortInfo.serialNumber().isEmpty()) - { - if (serialPortInfo.serialNumber().startsWith("IC-")) { - tempPrefs->rigName = serialPortInfo.serialNumber(); - tempPort = serialPortInfo.portName(); - } + if (serialPortInfo.serialNumber().startsWith("IC-") && tempPrefs->serialPort == "auto") { + tempPrefs->rigName = serialPortInfo.serialNumber(); + tempPrefs->serialPort = serialPortInfo.portName(); } } } - tempPrefs->serialPort = tempPort; - QString guid = settings->value("GUID", "").toString(); if (guid.isEmpty()) { guid = QUuid::createUuid().toString(); From e8142a11bab43197039abc0b38f7d454064e4577 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 19 Dec 2022 20:04:07 +0000 Subject: [PATCH 203/207] DIsable tcpserver on wfserver --- servermain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/servermain.cpp b/servermain.cpp index 0a0c285..791d8fd 100644 --- a/servermain.cpp +++ b/servermain.cpp @@ -87,7 +87,7 @@ void servermain::openRig() { //qInfo(logSystem()) << "Got rig"; QMetaObject::invokeMethod(radio->rig, [=]() { - radio->rig->commSetup(radio->civAddr, radio->serialPort, radio->baudRate, QString("none"),prefs.tcpPort,radio->waterfallFormat); + radio->rig->commSetup(radio->civAddr, radio->serialPort, radio->baudRate, QString("none"),0 ,radio->waterfallFormat); }, Qt::QueuedConnection); } } @@ -485,7 +485,7 @@ void servermain::loadSettings() numRadios = settings->beginReadArray("Radios"); int tempNum = numRadios; - + for (int i = 0; i < numRadios; i++) { settings->setArrayIndex(i); RIGCONFIG* tempPrefs = new RIGCONFIG(); From 093e6e799cbf5d6a6c85e02fef9a691af769619a Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Tue, 27 Dec 2022 19:37:12 -0800 Subject: [PATCH 204/207] Fixed termbin button issue when connection fails. Cleaned up some logging. --- loggingwindow.cpp | 4 +++- qledlabel.cpp | 2 +- wfmain.cpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/loggingwindow.cpp b/loggingwindow.cpp index 709db1b..e3667df 100644 --- a/loggingwindow.cpp +++ b/loggingwindow.cpp @@ -84,10 +84,11 @@ void loggingWindow::handleDataFromLoggingHost() { clipboard->setText(URL); qInfo(logLogger()) << "Sent log to URL: " << URL; + qInfo(logLogger()) << "This address already copied to the clipboard. Please paste this URL in to your support questions."; URLmsgBox.setText("Your log has been posted, and the URL has been copied to the clipboard."); URLmsgBox.setInformativeText("" + URL + ""); URLmsgBox.exec(); - // For whatever reason, showing the message box hides this window. + // For whatever reason, showing the message box hides https://termbin.com/ypxbthis window. this->show(); this->raise(); this->activateWindow(); @@ -124,6 +125,7 @@ void loggingWindow::handleLoggingHostError(QAbstractSocket::SocketError error) default: qWarning(logLogger()) << "Error connecting to logging host. Check internet connection. Error code: " << error; + ui->sendToPasteBtn->setDisabled(false); break; } } diff --git a/qledlabel.cpp b/qledlabel.cpp index d85ca8a..4911dde 100644 --- a/qledlabel.cpp +++ b/qledlabel.cpp @@ -19,7 +19,7 @@ QLedLabel::QLedLabel(QWidget* parent) : void QLedLabel::setState(State state) { - qInfo() << "setState" << state; + qDebug() << "LED: setState" << state; switch (state) { case StateOk: setStyleSheet(greenSS); diff --git a/wfmain.cpp b/wfmain.cpp index c113a40..d2270f3 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -31,7 +31,7 @@ wfmain::wfmain(const QString settingsFile, const QString logFile, bool debugMode setWindowIcon(QIcon( QString(":resources/wfview.png"))); this->debugMode = debugMode; debugModeLogging = debugMode; - version = QString("wfview version: %1 (Git:%2 on %3 at %4 by %5@%6)\nOperating System: %7 (%8)\nBuild Qt Version %9. Current Qt Version: %10\n") + version = QString("wfview version: %1 (Git:%2 on %3 at %4 by %5@%6). Operating System: %7 (%8). Build Qt Version %9. Current Qt Version: %10") .arg(QString(WFVIEW_VERSION)) .arg(GITSHORT).arg(__DATE__).arg(__TIME__).arg(UNAME).arg(HOST) .arg(QSysInfo::prettyProductName()).arg(QSysInfo::buildCpuArchitecture()) From 0d2d9ba23ee002e44b778a22c17b6965bad91221 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Wed, 28 Dec 2022 09:57:09 +0100 Subject: [PATCH 205/207] bumped to v1.54, see WHATSNEW --- WHATSNEW | 4 +++- wfserver.pro | 4 ++-- wfview.pro | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index b69fb82..527f43d 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -28,7 +28,9 @@ The following highlights are in this 1.51-release ince v1.50: added libs for suse builds; it also builds on leap 15.5 Add skimmer support (setting not saved) Add AR Cluster support - ++1.54 Various wfserver fixes + logging using termbin edge case fix + Notes: - We know about high CPU usage on RPi. diff --git a/wfserver.pro b/wfserver.pro index 80bd214..d50ffa2 100644 --- a/wfserver.pro +++ b/wfserver.pro @@ -13,7 +13,7 @@ TEMPLATE = app CONFIG += console -DEFINES += WFVIEW_VERSION=\\\"1.53\\\" +DEFINES += WFVIEW_VERSION=\\\"1.54\\\" DEFINES += BUILD_WFSERVER @@ -170,4 +170,4 @@ HEADERS += servermain.h \ tcpserver.h \ audiotaper.h \ keyboard.h \ - wfviewtypes.h \ No newline at end of file + wfviewtypes.h diff --git a/wfview.pro b/wfview.pro index 5654e7d..c476d1f 100644 --- a/wfview.pro +++ b/wfview.pro @@ -14,7 +14,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport TARGET = wfview TEMPLATE = app -DEFINES += WFVIEW_VERSION=\\\"1.53\\\" +DEFINES += WFVIEW_VERSION=\\\"1.54\\\" DEFINES += BUILD_WFVIEW From 7dfdc5e3e2434766a787214cba273a35be42bc62 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Wed, 28 Dec 2022 16:57:05 +0000 Subject: [PATCH 206/207] Move audio device selection to dedicated class --- audiodevices.cpp | 322 +++++++++++++++++++++++++++ audiodevices.h | 73 +++++++ wfmain.cpp | 327 ++++------------------------ wfmain.h | 2 + wfview.pro | 6 +- wfview.vcxproj | 479 +++++++++++++++++++++++++++++++++-------- wfview.vcxproj.filters | 80 ++++++- 7 files changed, 909 insertions(+), 380 deletions(-) create mode 100644 audiodevices.cpp create mode 100644 audiodevices.h diff --git a/audiodevices.cpp b/audiodevices.cpp new file mode 100644 index 0000000..6a05d3b --- /dev/null +++ b/audiodevices.cpp @@ -0,0 +1,322 @@ +/* + wfview class to enumerate audio devices and assist with matching saved devices + + Written by Phil Taylor M0VSE Nov 2022. + +*/ + +#include "audiodevices.h" +#include "logcategories.h" + +audioDevices::audioDevices(audioType type, QFontMetrics fm, QObject* parent) : + system(type), + fm(fm), + QObject(parent) +{ + +} + + +void audioDevices::enumerate() +{ + numInputDevices = 0; + numOutputDevices = 0; + numCharsIn = 0; + numCharsOut = 0; + inputs.clear(); + outputs.clear(); + switch (system) + { + case qtAudio: + { + Pa_Terminate(); + + foreach(const QAudioDeviceInfo & deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioInput)) + { + bool isDefault = false; + if (numInputDevices == 0) { + defaultInputDeviceName = QString(deviceInfo.deviceName()); + } +#ifdef Q_OS_WIN + if (deviceInfo.realm() == "wasapi") { +#endif + /* Append Input Device Here */ + if (deviceInfo.deviceName() == defaultInputDeviceName) { + isDefault = true; + } + inputs.append(audioDevice(deviceInfo.deviceName(), deviceInfo, deviceInfo.realm(),isDefault )); + + if (fm.boundingRect(deviceInfo.deviceName()).width() > numCharsIn) + numCharsIn = fm.boundingRect(deviceInfo.deviceName()).width(); + +#ifdef Q_OS_WIN + } +#endif + numInputDevices++; + } + + foreach(const QAudioDeviceInfo & deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) + { + bool isDefault = false; + if (numOutputDevices == 0) + { + defaultOutputDeviceName = QString(deviceInfo.deviceName()); + } +#ifdef Q_OS_WIN + if (deviceInfo.realm() == "wasapi") { +#endif + /* Append Output Device Here */ + if (deviceInfo.deviceName() == defaultOutputDeviceName) { + isDefault = true; + } + outputs.append(audioDevice(deviceInfo.deviceName(), deviceInfo, deviceInfo.realm(),isDefault)); + if (fm.boundingRect(deviceInfo.deviceName()).width() > numCharsOut) + numCharsOut = fm.boundingRect(deviceInfo.deviceName()).width(); + +#ifdef Q_OS_WIN + } +#endif + numOutputDevices++; + } + break; + } + case portAudio: + { + PaError err; + + err = Pa_Initialize(); + + if (err != paNoError) + { + qInfo(logAudio()) << "ERROR: Cannot initialize Portaudio"; + return; + } + + qInfo(logAudio()) << "PortAudio version: " << Pa_GetVersionInfo()->versionText; + + int numDevices = Pa_GetDeviceCount(); + qInfo(logAudio()) << "Pa_CountDevices returned" << numDevices; + + const PaDeviceInfo* info; + for (int i = 0; i < numDevices; i++) + { + info = Pa_GetDeviceInfo(i); + if (info->maxInputChannels > 0) { + bool isDefault = false; + numInputDevices++; + qDebug(logAudio()) << (i == Pa_GetDefaultInputDevice() ? "*" : " ") << "(" << i << ") Input Device : " << QString(info->name); + if (i == Pa_GetDefaultInputDevice()) { + defaultInputDeviceName = info->name; + isDefault = true; + } + inputs.append(audioDevice(QString(info->name), i,isDefault)); + if (fm.boundingRect(QString(info->name)).width() > numCharsIn) + numCharsIn = fm.boundingRect(QString(info->name)).width(); + + } + if (info->maxOutputChannels > 0) { + bool isDefault = false; + numOutputDevices++; + qDebug(logAudio()) << (i == Pa_GetDefaultOutputDevice() ? "*" : " ") << "(" << i << ") Output Device : " << QString(info->name); + if (i == Pa_GetDefaultOutputDevice()) { + defaultOutputDeviceName = info->name; + isDefault = true; + } + outputs.append(audioDevice(QString(info->name), i,isDefault)); + if (fm.boundingRect(QString(info->name)).width() > numCharsOut) + numCharsOut = fm.boundingRect(QString(info->name)).width(); + } + } + break; + } + case rtAudio: + { + Pa_Terminate(); + +#if defined(Q_OS_LINUX) + RtAudio* audio = new RtAudio(RtAudio::Api::LINUX_ALSA); +#elif defined(Q_OS_WIN) + RtAudio* audio = new RtAudio(RtAudio::Api::WINDOWS_WASAPI); +#elif defined(Q_OS_MACX) + RtAudio* audio = new RtAudio(RtAudio::Api::MACOSX_CORE); +#endif + + + // Enumerate audio devices, need to do before settings are loaded. + std::map apiMap; + apiMap[RtAudio::MACOSX_CORE] = "OS-X Core Audio"; + apiMap[RtAudio::WINDOWS_ASIO] = "Windows ASIO"; + apiMap[RtAudio::WINDOWS_DS] = "Windows DirectSound"; + apiMap[RtAudio::WINDOWS_WASAPI] = "Windows WASAPI"; + apiMap[RtAudio::UNIX_JACK] = "Jack Client"; + apiMap[RtAudio::LINUX_ALSA] = "Linux ALSA"; + apiMap[RtAudio::LINUX_PULSE] = "Linux PulseAudio"; + apiMap[RtAudio::LINUX_OSS] = "Linux OSS"; + apiMap[RtAudio::RTAUDIO_DUMMY] = "RtAudio Dummy"; + + std::vector< RtAudio::Api > apis; + RtAudio::getCompiledApi(apis); + + qInfo(logAudio()) << "RtAudio Version " << QString::fromStdString(RtAudio::getVersion()); + + qInfo(logAudio()) << "Compiled APIs:"; + for (unsigned int i = 0; i < apis.size(); i++) { + qInfo(logAudio()) << " " << QString::fromStdString(apiMap[apis[i]]); + } + + RtAudio::DeviceInfo info; + + qInfo(logAudio()) << "Current API: " << QString::fromStdString(apiMap[audio->getCurrentApi()]); + + unsigned int devices = audio->getDeviceCount(); + qInfo(logAudio()) << "Found " << devices << " audio device(s) *=default"; + + for (unsigned int i = 1; i < devices; i++) { + info = audio->getDeviceInfo(i); + if (info.inputChannels > 0) { + bool isDefault = false; + qInfo(logAudio()) << (info.isDefaultInput ? "*" : " ") << "(" << i << ") Input Device : " << QString::fromStdString(info.name); + numInputDevices++; + + if (info.isDefaultInput) { + defaultInputDeviceName = QString::fromStdString(info.name); + isDefault = true; + } + + inputs.append(audioDevice(QString::fromStdString(info.name), i, isDefault)); + + if (fm.boundingRect(QString::fromStdString(info.name)).width() > numCharsIn) + numCharsIn = fm.boundingRect(QString::fromStdString(info.name)).width(); + + } + if (info.outputChannels > 0) { + bool isDefault = false; + qInfo(logAudio()) << (info.isDefaultOutput ? "*" : " ") << "(" << i << ") Output Device : " << QString::fromStdString(info.name); + numOutputDevices++; + + if (info.isDefaultOutput) { + defaultOutputDeviceName = QString::fromStdString(info.name); + isDefault = true; + } + + outputs.append(audioDevice(QString::fromStdString(info.name), i, isDefault)); + + if (fm.boundingRect(QString::fromStdString(info.name)).width() > numCharsOut) + numCharsOut = fm.boundingRect(QString::fromStdString(info.name)).width(); + } + } + + delete audio; + break; + } + + } + emit updated(); + +} + +audioDevices::~audioDevices() +{ + +} + +QStringList audioDevices::getInputs() +{ + QStringList list; + foreach(const audioDevice input, inputs) { + list.append(input.name); + } + + return list; +} + +QStringList audioDevices::getOutputs() +{ + QStringList list; + foreach(const audioDevice output, outputs) { + list.append(output.name); + } + + return list; +} + +int audioDevices::findInput(QString type, QString name) +{ + int ret = -1; + int def = -1; + QString msg; + QTextStream s(&msg); + for (int f = 0; f < inputs.size(); f++) + { + //qInfo(logAudio()) << "Found device" << inputs[f].name; + if (inputs[f].name.startsWith(name)) { + s << type << " Audio input device " << name << " found! "; + ret = f; + } + if (inputs[f].isDefault == true) + { + def = f; + } + } + + if (ret == -1) + { + s << type << " Audio input device " << name << " Not found: "; + + if (inputs.size() == 1) { + s << "Selecting first device " << inputs[0].name; + ret = 0; + } + else if (def > -1) + { + s << " Selecting default device " << inputs[def].name; + ret = def; + } + else { + s << " and no default device found, aborting!"; + } + } + + qInfo(logAudio()) << msg; + return ret; +} + +int audioDevices::findOutput(QString type, QString name) +{ + int ret = -1; + int def = -1; + QString msg; + QTextStream s(&msg); + for (int f = 0; f < outputs.size(); f++) + { + //qInfo(logAudio()) << "Found device" << outputs[f].name; + if (outputs[f].name.startsWith(name)) { + ret = f; + s << type << " Audio output device " << name << " found! "; + } + if (outputs[f].isDefault == true) + { + def = f; + } + } + + if (ret == -1) + { + s << type << " Audio output device " << name << " Not found: "; + + if (outputs.size() == 1) { + s << " Selecting first device " << outputs[0].name; + ret = 0; + } + else if (def > -1) + { + s << " Selecting default device " << outputs[def].name; + ret = def; + } + else { + s << " and no default device found, aborting!"; + } + } + qInfo(logAudio()) << msg; + return ret; +} \ No newline at end of file diff --git a/audiodevices.h b/audiodevices.h new file mode 100644 index 0000000..e885dc9 --- /dev/null +++ b/audiodevices.h @@ -0,0 +1,73 @@ +#ifndef AUDIODEVICES_H +#define AUDIODEVICES_H +#include +#include +#include + +#include +#ifndef Q_OS_LINUX +#include "RtAudio.h" +#else +#include "rtaudio/RtAudio.h" +#endif + +#include "wfviewtypes.h" + +struct audioDevice { + audioDevice(QString name, int deviceInt, bool isDefault) : name(name), deviceInt(deviceInt), isDefault(isDefault) {}; + audioDevice(QString name, const QAudioDeviceInfo deviceInfo, QString realm, bool isDefault) : name(name), deviceInfo(deviceInfo), realm(realm), isDefault(isDefault) {}; + + QString name; + int deviceInt; + const QAudioDeviceInfo deviceInfo; + QString realm; + bool isDefault; +}; + +class audioDevices : public QObject +{ + Q_OBJECT + +public: + explicit audioDevices(audioType type, QFontMetrics fm, QObject* parent = nullptr); + ~audioDevices(); + void setAudioType(audioType type) { system = type; }; + audioType getAudioType() { return system; }; + int getNumCharsIn() { return numCharsIn; }; + int getNumCharsOut() { return numCharsOut; }; + + QString getInputName(int num) { return inputs[num].name; }; + QString getOutputName(int num) { return outputs[num].name; }; + + int getInputDeviceInt(int num) { return inputs[num].deviceInt; }; + int getOutputDeviceInt(int num) { return outputs[num].deviceInt; }; + const QAudioDeviceInfo getInputDeviceInfo(int num) { return inputs[num].deviceInfo; }; + const QAudioDeviceInfo getOutputDeviceInfo(int num) { return outputs[num].deviceInfo; }; + + void enumerate(); + + QStringList getInputs(); + QStringList getOutputs(); + + int findInput(QString type, QString name); + int findOutput(QString type, QString name); + +public slots: + +signals: + void updated(); +protected: +private: + QString defaultInputDeviceName; + QString defaultOutputDeviceName; + int numInputDevices; + int numOutputDevices; + audioType system; + QList inputs; + QList outputs; + QFontMetrics fm; + int numCharsIn = 0; + int numCharsOut = 0; +}; + +#endif \ No newline at end of file diff --git a/wfmain.cpp b/wfmain.cpp index d2270f3..44cb191 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -2083,17 +2083,15 @@ void wfmain::on_serverRXAudioInputCombo_currentIndexChanged(int value) if (!serverConfig.rigs.isEmpty()) { if (prefs.audioSystem == qtAudio) { - QVariant v = ui->serverRXAudioInputCombo->itemData(value); - serverConfig.rigs.first()->rxAudioSetup.port = v.value(); + serverConfig.rigs.first()->rxAudioSetup.port = audioDev->getInputDeviceInfo(value); } else { - serverConfig.rigs.first()->rxAudioSetup.portInt = ui->serverRXAudioInputCombo->itemData(value).toInt(); + serverConfig.rigs.first()->rxAudioSetup.portInt = audioDev->getInputDeviceInt(value); } - serverConfig.rigs.first()->rxAudioSetup.name = ui->serverRXAudioInputCombo->itemText(value); + serverConfig.rigs.first()->rxAudioSetup.name = audioDev->getInputName(value); } - } void wfmain::on_serverTXAudioOutputCombo_currentIndexChanged(int value) @@ -2102,14 +2100,13 @@ void wfmain::on_serverTXAudioOutputCombo_currentIndexChanged(int value) if (!serverConfig.rigs.isEmpty()) { if (prefs.audioSystem == qtAudio) { - QVariant v = ui->serverTXAudioOutputCombo->itemData(value); - serverConfig.rigs.first()->txAudioSetup.port = v.value(); + serverConfig.rigs.first()->txAudioSetup.port = audioDev->getOutputDeviceInfo(value); } else { - serverConfig.rigs.first()->txAudioSetup.portInt = ui->serverTXAudioOutputCombo->itemData(value).toInt(); + serverConfig.rigs.first()->txAudioSetup.portInt = audioDev->getOutputDeviceInt(value); } - serverConfig.rigs.first()->txAudioSetup.name = ui->serverTXAudioOutputCombo->itemText(value); + serverConfig.rigs.first()->txAudioSetup.name = audioDev->getOutputName(value); } @@ -5166,14 +5163,13 @@ void wfmain::on_audioOutputCombo_currentIndexChanged(int value) { if (prefs.audioSystem == qtAudio) { - QVariant v = ui->audioOutputCombo->itemData(value); - rxSetup.port = v.value(); + rxSetup.port = audioDev->getOutputDeviceInfo(value); } else { - rxSetup.portInt = ui->audioOutputCombo->itemData(value).toInt(); + rxSetup.portInt = audioDev->getOutputDeviceInt(value); } - rxSetup.name = ui->audioOutputCombo->itemText(value); + rxSetup.name = audioDev->getOutputName(value); qDebug(logGui()) << "Changed audio output to:" << rxSetup.name; } @@ -5181,14 +5177,13 @@ void wfmain::on_audioInputCombo_currentIndexChanged(int value) { if (prefs.audioSystem == qtAudio) { - QVariant v = ui->audioInputCombo->itemData(value); - txSetup.port = v.value(); + txSetup.port = audioDev->getInputDeviceInfo(value); } else { - txSetup.portInt = ui->audioInputCombo->itemData(value).toInt(); + txSetup.portInt = audioDev->getInputDeviceInt(value); } - txSetup.name = ui->audioInputCombo->itemText(value); + txSetup.name = audioDev->getInputName(value); qDebug(logGui()) << "Changed audio input to:" << txSetup.name; } @@ -6375,286 +6370,56 @@ void wfmain::on_radioStatusBtn_clicked() void wfmain::setAudioDevicesUI() { - // Enumerate audio devices, need to do before settings are loaded, - // First clear all existing entries - ui->audioInputCombo->blockSignals(true); - ui->audioOutputCombo->blockSignals(true); - ui->serverTXAudioOutputCombo->blockSignals(true); - ui->serverRXAudioInputCombo->blockSignals(true); - - ui->audioInputCombo->clear(); - ui->audioOutputCombo->clear(); - ui->serverTXAudioOutputCombo->clear(); - ui->serverRXAudioInputCombo->clear(); - - qDebug(logSystem()) << "Finding audio devices, output=" << rxSetup.name << "input=" << txSetup.name; - - int defaultAudioInputIndex = 0; - int defaultAudioOutputIndex = 0; - int numCharsIn = 0; - int numCharsOut = 0; - QFontMetrics fm(ui->audioInputCombo->font()); - - ui->audioInputCombo->setCurrentIndex(-1); - ui->audioOutputCombo->setCurrentIndex(-1); - ui->serverRXAudioInputCombo->setCurrentIndex(-1); - ui->serverTXAudioOutputCombo->setCurrentIndex(-1); - QString defaultAudioInputName; - QString defaultAudioOutputName; - - switch (prefs.audioSystem) - { - case qtAudio: - { - Pa_Terminate(); - - int inCount = 0; - foreach(const QAudioDeviceInfo & deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioInput)) - { - if (inCount == 0) - defaultAudioInputName = QString(deviceInfo.deviceName().toLocal8Bit()); -#ifdef Q_OS_WIN - if (deviceInfo.realm() == "wasapi") { -#endif - ui->audioInputCombo->addItem(deviceInfo.deviceName().toLocal8Bit(), QVariant::fromValue(deviceInfo)); - ui->serverRXAudioInputCombo->addItem(deviceInfo.deviceName().toLocal8Bit(), QVariant::fromValue(deviceInfo)); - if (fm.boundingRect(deviceInfo.deviceName()).width() > numCharsIn) - numCharsIn = fm.boundingRect(deviceInfo.deviceName()).width(); -#ifdef Q_OS_WIN - } -#endif - inCount++; - } - - int outCount = 0; - foreach(const QAudioDeviceInfo & deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) - { - if (outCount == 0) - defaultAudioOutputName = QString(deviceInfo.deviceName().toLocal8Bit()); -#ifdef Q_OS_WIN - if (deviceInfo.realm() == "wasapi") { -#endif - ui->audioOutputCombo->addItem(deviceInfo.deviceName().toLocal8Bit(), QVariant::fromValue(deviceInfo)); - ui->serverTXAudioOutputCombo->addItem(deviceInfo.deviceName().toLocal8Bit(), QVariant::fromValue(deviceInfo)); - if (fm.boundingRect(deviceInfo.deviceName()).width() > numCharsOut) - numCharsOut = fm.boundingRect(deviceInfo.deviceName()).width(); - -#ifdef Q_OS_WIN - } -#endif - outCount++; - } - break; - } - case portAudio: - { - PaError err; - - err = Pa_Initialize(); - - if (err != paNoError) - { - qInfo(logAudio()) << "ERROR: Cannot initialize Portaudio"; - return; - } - - qInfo(logAudio()) << "PortAudio version: " << Pa_GetVersionInfo()->versionText; - - int numDevices = Pa_GetDeviceCount(); - qInfo(logAudio()) << "Pa_CountDevices returned" << numDevices; - - const PaDeviceInfo* info; - for (int i = 0; i < numDevices; i++) - { - info = Pa_GetDeviceInfo(i); - if (info->maxInputChannels > 0) { - qDebug(logAudio()) << (i == Pa_GetDefaultInputDevice() ? "*" : " ") << "(" << i << ") Input Device : " << QString(info->name).toLocal8Bit(); - - ui->audioInputCombo->addItem(QString(info->name).toLocal8Bit(), i); - ui->serverRXAudioInputCombo->addItem(QString(info->name).toLocal8Bit(), i); - - if (fm.boundingRect(QString(info->name)).width() > numCharsIn) - numCharsIn = fm.boundingRect(QString(info->name)).width(); - - if (i == Pa_GetDefaultInputDevice()) { - defaultAudioInputName = info->name; - } - } - if (info->maxOutputChannels > 0) { - qDebug(logAudio()) << (i == Pa_GetDefaultOutputDevice() ? "*" : " ") << "(" << i << ") Output Device : " << QString(info->name).toLocal8Bit(); - ui->audioOutputCombo->addItem(QString(info->name).toLocal8Bit(), i); - ui->serverTXAudioOutputCombo->addItem(QString(info->name).toLocal8Bit(), i); - - if (fm.boundingRect(QString(info->name)).width() > numCharsOut) - numCharsOut = fm.boundingRect(QString(info->name)).width(); - - if (i == Pa_GetDefaultOutputDevice()) { - defaultAudioOutputName = info->name; - } - } - } - break; - } - case rtAudio: - { - Pa_Terminate(); - -#if defined(Q_OS_LINUX) - RtAudio* audio = new RtAudio(RtAudio::Api::LINUX_ALSA); -#elif defined(Q_OS_WIN) - RtAudio* audio = new RtAudio(RtAudio::Api::WINDOWS_WASAPI); -#elif defined(Q_OS_MACX) - RtAudio* audio = new RtAudio(RtAudio::Api::MACOSX_CORE); -#endif - - - // Enumerate audio devices, need to do before settings are loaded. - std::map apiMap; - apiMap[RtAudio::MACOSX_CORE] = "OS-X Core Audio"; - apiMap[RtAudio::WINDOWS_ASIO] = "Windows ASIO"; - apiMap[RtAudio::WINDOWS_DS] = "Windows DirectSound"; - apiMap[RtAudio::WINDOWS_WASAPI] = "Windows WASAPI"; - apiMap[RtAudio::UNIX_JACK] = "Jack Client"; - apiMap[RtAudio::LINUX_ALSA] = "Linux ALSA"; - apiMap[RtAudio::LINUX_PULSE] = "Linux PulseAudio"; - apiMap[RtAudio::LINUX_OSS] = "Linux OSS"; - apiMap[RtAudio::RTAUDIO_DUMMY] = "RtAudio Dummy"; - - std::vector< RtAudio::Api > apis; - RtAudio::getCompiledApi(apis); - - qInfo(logAudio()) << "RtAudio Version " << QString::fromStdString(RtAudio::getVersion()); - - qInfo(logAudio()) << "Compiled APIs:"; - for (unsigned int i = 0; i < apis.size(); i++) { - qInfo(logAudio()) << " " << QString::fromStdString(apiMap[apis[i]]); - } - - RtAudio::DeviceInfo info; - - qInfo(logAudio()) << "Current API: " << QString::fromStdString(apiMap[audio->getCurrentApi()]); - - unsigned int devices = audio->getDeviceCount(); - qInfo(logAudio()) << "Found " << devices << " audio device(s) *=default"; - - for (unsigned int i = 1; i < devices; i++) { - info = audio->getDeviceInfo(i); - if (info.inputChannels > 0) { - qInfo(logAudio()) << (info.isDefaultInput ? "*" : " ") << "(" << i << ") Input Device : " << QString::fromStdString(info.name).toLocal8Bit(); - ui->audioInputCombo->addItem(QString::fromStdString(info.name).toLocal8Bit(), i); - ui->serverRXAudioInputCombo->addItem(QString::fromStdString(info.name).toLocal8Bit(), i); - - if (fm.boundingRect(QString::fromStdString(info.name)).width() > numCharsIn) - numCharsIn = fm.boundingRect(QString::fromStdString(info.name)).width(); - - if (info.isDefaultInput) { - defaultAudioInputName = QString::fromStdString(info.name).toLocal8Bit(); - } - } - if (info.outputChannels > 0) { - qInfo(logAudio()) << (info.isDefaultOutput ? "*" : " ") << "(" << i << ") Output Device : " << QString::fromStdString(info.name).toLocal8Bit(); - ui->audioOutputCombo->addItem(QString::fromStdString(info.name).toLocal8Bit(), i); - ui->serverTXAudioOutputCombo->addItem(QString::fromStdString(info.name).toLocal8Bit(), i); - - if (fm.boundingRect(QString::fromStdString(info.name)).width() > numCharsOut) - numCharsOut = fm.boundingRect(QString::fromStdString(info.name)).width(); - - if (info.isDefaultOutput) { - defaultAudioOutputName = QString::fromStdString(info.name).toLocal8Bit(); - } - } - } - - delete audio; - break; - } - + if (audioDev == Q_NULLPTR) { + audioDev = new audioDevices(prefs.audioSystem, QFontMetrics(ui->audioInputCombo->font())); } - // Make the audio comboboxes expand when clicked (only needed for Windows) - ui->audioInputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsIn+30)); - ui->audioOutputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsOut+30)); - ui->serverTXAudioOutputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsOut+30)); - ui->serverRXAudioInputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(numCharsIn+30)); + audioDev->setAudioType(prefs.audioSystem); + audioDev->enumerate(); - - // Stop blocking signals so we can set the current values + ui->audioInputCombo->blockSignals(true); + ui->audioInputCombo->clear(); + ui->audioInputCombo->addItems(audioDev->getInputs()); + ui->audioInputCombo->setCurrentIndex(-1); + ui->audioInputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(audioDev->getNumCharsIn() + 30)); ui->audioInputCombo->blockSignals(false); - ui->audioOutputCombo->blockSignals(false); - ui->serverTXAudioOutputCombo->blockSignals(false); - ui->serverRXAudioInputCombo->blockSignals(false); + ui->audioInputCombo->setCurrentIndex(audioDev->findInput("Client", txSetup.name)); + ui->audioOutputCombo->blockSignals(true); + ui->audioOutputCombo->clear(); + ui->audioOutputCombo->addItems(audioDev->getOutputs()); + ui->audioOutputCombo->setCurrentIndex(-1); + ui->audioOutputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(audioDev->getNumCharsOut() + 30)); + ui->audioOutputCombo->blockSignals(false); + ui->audioOutputCombo->setCurrentIndex(audioDev->findOutput("Client", rxSetup.name)); + + ui->serverTXAudioOutputCombo->blockSignals(true); + ui->serverTXAudioOutputCombo->clear(); + ui->serverTXAudioOutputCombo->addItems(audioDev->getOutputs()); + ui->serverTXAudioOutputCombo->setCurrentIndex(-1); + ui->serverTXAudioOutputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(audioDev->getNumCharsOut() + 30)); + ui->serverTXAudioOutputCombo->blockSignals(false); + + ui->serverRXAudioInputCombo->blockSignals(true); + ui->serverRXAudioInputCombo->clear(); + ui->serverRXAudioInputCombo->addItems(audioDev->getInputs()); + ui->serverRXAudioInputCombo->setCurrentIndex(-1); + ui->serverRXAudioInputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(audioDev->getNumCharsIn()+30)); + ui->serverRXAudioInputCombo->blockSignals(false); rxSetup.type = prefs.audioSystem; txSetup.type = prefs.audioSystem; - int audioInputIndex = ui->audioInputCombo->findText(txSetup.name); - if (audioInputIndex != -1) { - qInfo(logGui()) << "Found Audio Input Device: " << txSetup.name; - ui->audioInputCombo->setCurrentIndex(audioInputIndex); - } - else { - qWarning(logGui()) << "Audio Input Device: " << txSetup.name << "Not Found, trying to select default"; - audioInputIndex = ui->audioInputCombo->findText(defaultAudioInputName); - if (audioInputIndex != -1) { - ui->audioInputCombo->setCurrentIndex(audioInputIndex); - } - else { - qWarning(logGui()) << "Unable to select default input device,"<< defaultAudioInputName << " help....."; - } - - } - - int audioOutputIndex = ui->audioOutputCombo->findText(rxSetup.name.toLocal8Bit()); - if (audioOutputIndex != -1) { - qInfo(logGui()) << "Found Audio Output Device: " << rxSetup.name.toLocal8Bit(); - ui->audioOutputCombo->setCurrentIndex(audioOutputIndex); - } - else { - qWarning(logGui()) << "Audio output Device: " << rxSetup.name << "Not Found, trying to select default"; - audioOutputIndex = ui->audioOutputCombo->findText(defaultAudioOutputName.toLocal8Bit()); - if (audioOutputIndex != -1) { - ui->audioOutputCombo->setCurrentIndex(audioOutputIndex); - } - else { - qWarning(logGui()) << "Unable to select default output device," << defaultAudioOutputName.toLocal8Bit() << " help....."; - } - } - if (!serverConfig.rigs.isEmpty()) - { - if (serverConfig.enabled) - qInfo(logGui()) << "Got Server Audio Input: " << serverConfig.rigs.first()->rxAudioSetup.name.toLocal8Bit(); - serverConfig.rigs.first()->rxAudioSetup.type = prefs.audioSystem; serverConfig.rigs.first()->txAudioSetup.type = prefs.audioSystem; - ui->serverRXAudioInputCombo->setCurrentIndex(defaultAudioInputIndex); - int serverAudioInputIndex = ui->serverRXAudioInputCombo->findText(serverConfig.rigs.first()->rxAudioSetup.name.toLocal8Bit()); - if (serverAudioInputIndex != -1) { - ui->serverRXAudioInputCombo->setCurrentIndex(serverAudioInputIndex); - } - else { - if (serverConfig.enabled) - qWarning(logGui()) << "Server audio input NOT FOUND " << serverConfig.rigs.first()->rxAudioSetup.name.toLocal8Bit() << "not selecting default"; - } - - if (serverConfig.enabled) - qInfo(logGui()) << "Got Server Audio Output: " << serverConfig.rigs.first()->txAudioSetup.name.toLocal8Bit(); - - ui->serverTXAudioOutputCombo->setCurrentIndex(defaultAudioOutputIndex); - int serverAudioOutputIndex = ui->serverTXAudioOutputCombo->findText(serverConfig.rigs.first()->txAudioSetup.name.toLocal8Bit()); - if (serverAudioOutputIndex != -1) { - ui->serverTXAudioOutputCombo->setCurrentIndex(serverAudioOutputIndex); - } - else { - if (serverConfig.enabled) - qWarning(logGui()) << "Server audio output NOT FOUND " << serverConfig.rigs.first()->txAudioSetup.name.toLocal8Bit() << "not selecting default"; - } - + ui->serverRXAudioInputCombo->setCurrentIndex(audioDev->findInput("Server", serverConfig.rigs.first()->rxAudioSetup.name)); + ui->serverTXAudioOutputCombo->setCurrentIndex(audioDev->findOutput("Server", serverConfig.rigs.first()->txAudioSetup.name)); } + qDebug(logSystem()) << "Audio devices done."; } diff --git a/wfmain.h b/wfmain.h index 7f318b2..2ae5fd6 100644 --- a/wfmain.h +++ b/wfmain.h @@ -42,6 +42,7 @@ #include "colorprefs.h" #include "loggingwindow.h" #include "cluster.h" +#include "audiodevices.h" #include #include @@ -1050,6 +1051,7 @@ private: QList clusters; QMutex clusterMutex; QColor clusterColor; + audioDevices* audioDev = Q_NULLPTR; }; Q_DECLARE_METATYPE(struct rigCapabilities) diff --git a/wfview.pro b/wfview.pro index c476d1f..f9c4390 100644 --- a/wfview.pro +++ b/wfview.pro @@ -179,7 +179,8 @@ SOURCES += main.cpp\ tcpserver.cpp \ cluster.cpp \ database.cpp \ - aboutbox.cpp + aboutbox.cpp \ + audiodevices.cpp HEADERS += wfmain.h \ colorprefs.h \ @@ -220,7 +221,8 @@ HEADERS += wfmain.h \ cluster.h \ database.h \ aboutbox.h \ - wfviewtypes.h + wfviewtypes.h \ + audiodevices.h FORMS += wfmain.ui \ diff --git a/wfview.vcxproj b/wfview.vcxproj index 300b8ee..269332f 100644 --- a/wfview.vcxproj +++ b/wfview.vcxproj @@ -16,8 +16,7 @@ QtVS_v304 10.0.19041.0 10.0.19041.0 - $(MSBuildProjectDirectory)\QtMsBuild - + $(MSBuildProjectDirectory)\QtMsBuild v142 @@ -37,10 +36,7 @@ debug\ wfview - - - - + @@ -48,34 +44,8 @@ - - - - - - wfview-debug\ - debug\ - wfview - true - - - wfview-release\ - release\ - wfview - true - false - - - msvc2019 - core;xml;network;gui;multimedia;widgets;serialport;printsupport - - - msvc2019 - core;xml;network;gui;multimedia;widgets;serialport;printsupport - - - - + wfview-debug\debug\wfviewtruewfview-release\release\wfviewtruefalsemsvc2019core;xml;network;gui;multimedia;widgets;serialport;printsupportmsvc2019core;xml;network;gui;multimedia;widgets;serialport;printsupport + .;..\rtaudio;..\portaudio\include;..\qcustomplot;..\opus\include;..\eigen;..\r8brain-free-src;resampler;release;/include;%(AdditionalIncludeDirectories) @@ -87,16 +57,14 @@ Sync release\ MaxSpeed - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION="1.52";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX="/usr/local";GITSHORT="103dc9c";HOST="wfview.org";UNAME="build";NDEBUG;QT_NO_DEBUG;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION="1.54";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX="/usr/local";GITSHORT="0d2d9ba";HOST="wfview.org";UNAME="build";NDEBUG;QT_NO_DEBUG;%(PreprocessorDefinitions) false - - + MultiThreadedDLL true true Level3 - true - + true ..\portaudio\msvc\Win32\Release\portaudio_x86.lib;ole32.lib;..\opus\win32\VS2015\Win32\Release\opus.lib;shell32.lib;%(AdditionalDependencies) ..\portaudio\msvc\Win32\Release;..\opus\win32\VS2015\Win32\Release;C:\opensslx86\lib;C:\Utils\my_sql\mysql-5.7.25-win32\lib;C:\Utils\postgresqlx86\pgsql\lib;%(AdditionalLibraryDirectories) @@ -117,28 +85,9 @@ 0 - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.52\";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX=\"/usr/local\";GITSHORT=\"103dc9c\";HOST=\"wfview.org\";UNAME=\"build\";NDEBUG;QT_NO_DEBUG;QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_XML_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.54\";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX=\"/usr/local\";GITSHORT=\"0d2d9ba\";HOST=\"wfview.org\";UNAME=\"build\";NDEBUG;QT_NO_DEBUG;QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_XML_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) - - msvc - ./$(Configuration)/moc_predefs.h - Moc'ing %(Identity)... - output - $(Configuration) - moc_%(Filename).cpp - - - default - Rcc'ing %(Identity)... - $(Configuration) - qrc_%(Filename).cpp - - - Uic'ing %(Identity)... - $(ProjectDir) - ui_%(Filename).h - - + msvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cppdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cppUic'ing %(Identity)...$(ProjectDir)ui_%(Filename).h .;..\rtaudio;..\portaudio\include;..\qcustomplot;..\opus\include;..\eigen;..\r8brain-free-src;resampler;debug;/include;%(AdditionalIncludeDirectories) @@ -150,14 +99,13 @@ Sync debug\ Disabled - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION="1.52";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX="/usr/local";GITSHORT="103dc9c";HOST="wfview.org";UNAME="build";%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION="1.54";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX="/usr/local";GITSHORT="0d2d9ba";HOST="wfview.org";UNAME="build";%(PreprocessorDefinitions) false MultiThreadedDebugDLL true true Level3 - true - + true ..\portaudio\msvc\Win32\Debug\portaudio_x86.lib;ole32.lib;..\opus\win32\VS2015\Win32\Debug\opus.lib;shell32.lib;%(AdditionalDependencies) ..\portaudio\msvc\Win32\Debug;..\opus\win32\VS2015\Win32\Debug;C:\opensslx86\lib;C:\Utils\my_sql\mysql-5.7.25-win32\lib;C:\Utils\postgresqlx86\pgsql\lib;%(AdditionalLibraryDirectories) @@ -176,32 +124,14 @@ 0 - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.52\";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX=\"/usr/local\";GITSHORT=\"103dc9c\";HOST=\"wfview.org\";UNAME=\"build\";QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_XML_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.54\";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX=\"/usr/local\";GITSHORT=\"0d2d9ba\";HOST=\"wfview.org\";UNAME=\"build\";QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_XML_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) - - msvc - ./$(Configuration)/moc_predefs.h - Moc'ing %(Identity)... - output - $(Configuration) - moc_%(Filename).cpp - - - default - Rcc'ing %(Identity)... - $(Configuration) - qrc_%(Filename).cpp - - - Uic'ing %(Identity)... - $(ProjectDir) - ui_%(Filename).h - - + msvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cppdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cppUic'ing %(Identity)...$(ProjectDir)ui_%(Filename).h + @@ -236,71 +166,303 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Document true @@ -317,23 +479,139 @@ release\moc_predefs.h;%(Outputs) true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -367,16 +645,30 @@ - resources - resources - + + + + + + + + + + resourcesresources - style - style - + + + + + + + + + + stylestyle @@ -390,9 +682,6 @@ - - - - + \ No newline at end of file diff --git a/wfview.vcxproj.filters b/wfview.vcxproj.filters index 74c1354..bfbad15 100644 --- a/wfview.vcxproj.filters +++ b/wfview.vcxproj.filters @@ -56,6 +56,9 @@ Source Files + + Source Files + Source Files @@ -160,6 +163,9 @@ Header Files + + Header Files + Header Files @@ -199,6 +205,9 @@ Header Files + + Header Files + Header Files @@ -226,6 +235,9 @@ Header Files + + Header Files + Header Files @@ -265,17 +277,81 @@ Header Files - + Header Files + + + + + + + + + + + + + + + + + + + + Generated Files Generated Files + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -435,6 +511,6 @@ - + \ No newline at end of file From aabe690bae6aa8f9e1f7e0f427aea674a15c08a8 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 29 Dec 2022 09:21:25 +0000 Subject: [PATCH 207/207] Fix compile errors/warnings in Linux --- audiodevices.cpp | 16 ++++++++++++---- audiodevices.h | 4 ++-- wfview.vcxproj | 8 ++++---- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/audiodevices.cpp b/audiodevices.cpp index 6a05d3b..12be2fe 100644 --- a/audiodevices.cpp +++ b/audiodevices.cpp @@ -9,9 +9,9 @@ #include "logcategories.h" audioDevices::audioDevices(audioType type, QFontMetrics fm, QObject* parent) : + QObject(parent), system(type), - fm(fm), - QObject(parent) + fm(fm) { } @@ -44,7 +44,11 @@ void audioDevices::enumerate() if (deviceInfo.deviceName() == defaultInputDeviceName) { isDefault = true; } - inputs.append(audioDevice(deviceInfo.deviceName(), deviceInfo, deviceInfo.realm(),isDefault )); +#if (QT_VERSION >= QT_VERSION_CHECK(5,15,0)) + inputs.append(audioDevice(deviceInfo.deviceName(), deviceInfo, deviceInfo.realm(), isDefault)); +#else + inputs.append(audioDevice(deviceInfo.deviceName(), deviceInfo, "", isDefault)); +#endif if (fm.boundingRect(deviceInfo.deviceName()).width() > numCharsIn) numCharsIn = fm.boundingRect(deviceInfo.deviceName()).width(); @@ -69,7 +73,11 @@ void audioDevices::enumerate() if (deviceInfo.deviceName() == defaultOutputDeviceName) { isDefault = true; } - outputs.append(audioDevice(deviceInfo.deviceName(), deviceInfo, deviceInfo.realm(),isDefault)); +#if (QT_VERSION >= QT_VERSION_CHECK(5,15,0)) + outputs.append(audioDevice(deviceInfo.deviceName(), deviceInfo, deviceInfo.realm(), isDefault)); +#else + outputs.append(audioDevice(deviceInfo.deviceName(), deviceInfo, "", isDefault)); +#endif if (fm.boundingRect(deviceInfo.deviceName()).width() > numCharsOut) numCharsOut = fm.boundingRect(deviceInfo.deviceName()).width(); diff --git a/audiodevices.h b/audiodevices.h index e885dc9..ac60624 100644 --- a/audiodevices.h +++ b/audiodevices.h @@ -58,14 +58,14 @@ signals: void updated(); protected: private: + audioType system; + QFontMetrics fm; QString defaultInputDeviceName; QString defaultOutputDeviceName; int numInputDevices; int numOutputDevices; - audioType system; QList inputs; QList outputs; - QFontMetrics fm; int numCharsIn = 0; int numCharsOut = 0; }; diff --git a/wfview.vcxproj b/wfview.vcxproj index 269332f..533753e 100644 --- a/wfview.vcxproj +++ b/wfview.vcxproj @@ -57,7 +57,7 @@ Sync release\ MaxSpeed - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION="1.54";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX="/usr/local";GITSHORT="0d2d9ba";HOST="wfview.org";UNAME="build";NDEBUG;QT_NO_DEBUG;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION="1.54";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX="/usr/local";GITSHORT="7dfdc5e";HOST="wfview.org";UNAME="build";NDEBUG;QT_NO_DEBUG;%(PreprocessorDefinitions) false MultiThreadedDLL @@ -85,7 +85,7 @@ 0 - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.54\";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX=\"/usr/local\";GITSHORT=\"0d2d9ba\";HOST=\"wfview.org\";UNAME=\"build\";NDEBUG;QT_NO_DEBUG;QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_XML_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.54\";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX=\"/usr/local\";GITSHORT=\"7dfdc5e\";HOST=\"wfview.org\";UNAME=\"build\";NDEBUG;QT_NO_DEBUG;QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_XML_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) msvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cppdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cppUic'ing %(Identity)...$(ProjectDir)ui_%(Filename).h @@ -99,7 +99,7 @@ Sync debug\ Disabled - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION="1.54";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX="/usr/local";GITSHORT="0d2d9ba";HOST="wfview.org";UNAME="build";%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION="1.54";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX="/usr/local";GITSHORT="7dfdc5e";HOST="wfview.org";UNAME="build";%(PreprocessorDefinitions) false MultiThreadedDebugDLL true @@ -124,7 +124,7 @@ 0 - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.54\";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX=\"/usr/local\";GITSHORT=\"0d2d9ba\";HOST=\"wfview.org\";UNAME=\"build\";QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_XML_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.54\";BUILD_WFVIEW;__WINDOWS_WASAPI__;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;EIGEN_MPL2_ONLY;EIGEN_DONT_VECTORIZE;EIGEN_VECTORIZE_SSE3;PREFIX=\"/usr/local\";GITSHORT=\"7dfdc5e\";HOST=\"wfview.org\";UNAME=\"build\";QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_XML_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) msvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cppdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cppUic'ing %(Identity)...$(ProjectDir)ui_%(Filename).h