From 2d1773720dc1fdd838a0fb9b335ebd3487c1ce73 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sun, 29 Jan 2023 10:39:24 -0800 Subject: [PATCH] Added split state LED for split. --- qledlabel.cpp | 4 + qledlabel.h | 1 + repeatersetup.cpp | 20 ++--- repeatersetup.h | 4 + repeatersetup.ui | 201 +++++++++++++++++++++++++++++++--------------- wfmain.cpp | 23 +++++- wfmain.h | 3 +- wfmain.ui | 12 +-- 8 files changed, 185 insertions(+), 83 deletions(-) diff --git a/qledlabel.cpp b/qledlabel.cpp index d4fb314..e12e444 100644 --- a/qledlabel.cpp +++ b/qledlabel.cpp @@ -4,6 +4,7 @@ static const int SIZE = 16; static const QString greenSS = QString("color: white;border-radius: %1;background-color: qlineargradient(spread:pad, x1:0.145, y1:0.16, x2:1, y2:1, stop:0 rgba(20, 252, 7, 255), stop:1 rgba(25, 134, 5, 255));").arg(SIZE / 2); 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 rgSplitSS = QString("color: white;border-radius: %1;background-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(255, 0, 0, 255), stop:1.0 rgba(0, 255, 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); @@ -36,6 +37,9 @@ void QLedLabel::setState(State state) case StateBlank: setStyleSheet(blankSS); break; + case StateSplitErrorOk: + setStyleSheet(rgSplitSS); + break; default: setStyleSheet(blueSS); break; diff --git a/qledlabel.h b/qledlabel.h index d4117c9..ab041bd 100644 --- a/qledlabel.h +++ b/qledlabel.h @@ -14,6 +14,7 @@ public: StateOkBlue, StateWarning, StateError, + StateSplitErrorOk, StateBlank }; diff --git a/repeatersetup.cpp b/repeatersetup.cpp index 9a36185..00123d0 100644 --- a/repeatersetup.cpp +++ b/repeatersetup.cpp @@ -12,15 +12,6 @@ repeaterSetup::repeaterSetup(QWidget *parent) : // populate the DCS combo box: populateDTCS(); - -#ifdef QT_DEBUG - ui->debugBtn->setVisible(true); - ui->rptReadRigBtn->setVisible(true); -#else - ui->debugBtn->setVisible(false); - ui->rptReadRigBtn->setVisible(false); -#endif - } repeaterSetup::~repeaterSetup() @@ -684,7 +675,6 @@ void repeaterSetup::on_splitPlusButton_clicked() } } - void repeaterSetup::on_splitMinusBtn_clicked() { quint64 hzOffset = getFreqHzFromKHzString(ui->splitOffsetEdit->text()); @@ -717,6 +707,11 @@ void repeaterSetup::on_splitTxFreqSetBtn_clicked() } } +void repeaterSetup::on_splitTransmitFreqEdit_returnPressed() +{ + this->on_splitTxFreqSetBtn_clicked(); +} + void repeaterSetup::on_selABtn_clicked() { vfo_t v = vfoA; @@ -800,3 +795,8 @@ void repeaterSetup::on_rptrOffsetSetBtn_clicked() emit setRptDuplexOffset(f); } } + +void repeaterSetup::on_rptrOffsetEdit_returnPressed() +{ + this->on_rptrOffsetSetBtn_clicked(); +} diff --git a/repeatersetup.h b/repeatersetup.h index 76431a9..47f3ec1 100644 --- a/repeatersetup.h +++ b/repeatersetup.h @@ -104,6 +104,10 @@ private slots: void on_splitEnableChk_clicked(); + void on_rptrOffsetEdit_returnPressed(); + + void on_splitTransmitFreqEdit_returnPressed(); + private: Ui::repeaterSetup *ui; freqt currentMainFrequency; diff --git a/repeatersetup.ui b/repeatersetup.ui index 1222dd4..da02a26 100644 --- a/repeatersetup.ui +++ b/repeatersetup.ui @@ -6,62 +6,27 @@ 0 0 - 1230 - 267 + 1071 + 231 + + + 1071 + 230 + + + + + 1071 + 231 + + Repeater Setup - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - 0 - - - - - Read Current Settings - - - - - - - Debug - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - @@ -72,6 +37,12 @@ + + + 180 + 16777215 + + Repeater Duplex @@ -118,30 +89,36 @@ - - - - Offset (MHz): - - - - - - + + <html><head/><body><p>Set the repeater offset for radios using Repeater modes. Only available on radios that have repeater modes. Radios using Split should instead use the provided Split Mode section with a custom Offset. </p></body></html> + - Set + Set Offset (MHz): + + + + Rpt Offset (MHz) + + + + + + 400 + 16777215 + + Split Mode @@ -150,6 +127,9 @@ + + Turn on Split + Split On @@ -160,6 +140,9 @@ + + Turn off Split + Split Off @@ -168,17 +151,27 @@ + + + + - + + + <html><head/><body><p>Click here to automatically set the sub VFO (transmit VFO) tone. Only available on some radios. Other radios may take care of this for you.</p></body></html> + - AutoTrack + Set Rpt Tone - + + + <html><head/><body><p>Click here to continually set the transmit VFO to match the receive VFO with the offset accounted for. </p></body></html> + - Set Rpt Tone + AutoTrack @@ -207,10 +200,22 @@ 16777215 + + Enter the desired split offset in KHz. + + + + 55 + 16777215 + + + + <html><head/><body><p>Set the transmit frequency to the receive frequency PLUS the offset. Sets the radio sub VFO and also populates the wfview text box (as a convenience). </p></body></html> + Split+ @@ -218,6 +223,15 @@ + + + 55 + 16777215 + + + + <html><head/><body><p>Set the transmit frequency to the receive frequency PLUS the offset. Sets the radio sub VFO and also populates the wfview text box (as a convenience). </p></body></html> + Split- @@ -252,6 +266,15 @@ + + + 116 + 16777215 + + + + <html><head/><body><p>Set the transmit frequency manually. Not needed if the Split+ or Split- button was used. </p></body></html> + Set @@ -264,12 +287,21 @@ + + + 220 + 16777215 + + VFO + + Swap VFO A with VFO B. Some radios do not support this. + Swap AB @@ -277,6 +309,9 @@ + + Select the Sub VFO + Sel Sub @@ -284,6 +319,9 @@ + + Select the Main VFO + Sel Main @@ -291,6 +329,9 @@ + + Select VFO B + Sel B @@ -298,6 +339,9 @@ + + Select VFO A + Sel A @@ -305,6 +349,9 @@ + + Set VFO B to VFO A + A=B @@ -312,6 +359,9 @@ + + Set the SUB VFO to match the Main VFO + M=>S @@ -319,6 +369,9 @@ + + Swap the Main VFO and Sub VFO + Swap MS @@ -329,6 +382,12 @@ + + + 200 + 16777215 + + Repeater Tone Type @@ -375,6 +434,9 @@ + + Set the Tone Mode for the Sub VFO. Not available on all radios. + Set Sub VFO @@ -385,6 +447,12 @@ + + + 200 + 16777215 + + Tone Selection @@ -437,6 +505,9 @@ + + Set the Sub VFO to the selected Tone. Not available on all radios and not available for DTCS. + Set Sub VFO @@ -453,7 +524,7 @@ - + diff --git a/wfmain.cpp b/wfmain.cpp index 1b869e2..33bd46a 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -414,6 +414,15 @@ void wfmain::rigConnections() connect(rig, SIGNAL(haveTSQL(quint16)), rpt, SLOT(handleTSQL(quint16))); connect(rig, SIGNAL(haveDTCS(quint16,bool,bool)), rpt, SLOT(handleDTCS(quint16,bool,bool))); connect(rig, SIGNAL(haveRptAccessMode(rptAccessTxRx)), rpt, SLOT(handleRptAccessMode(rptAccessTxRx))); + + connect(this->rig, &rigCommander::haveDuplexMode, + [=](const duplexMode &dm) { + if(dm==dmSplitOn) + this->splitModeEnabled = true; + else + this->splitModeEnabled = false; + }); + connect(this->rpt, &repeaterSetup::setTransmitFrequency, [=](const freqt &transmitFreq) { issueCmd(cmdSetFreq, transmitFreq);}); connect(this->rpt, &repeaterSetup::setTransmitMode, @@ -1044,6 +1053,7 @@ void wfmain::setupMainUI() pttLed = new QLedLabel(this); ui->statusBar->addPermanentWidget(pttLed); pttLed->setState(QLedLabel::State::StateOk); + pttLed->setToolTip("Receiving"); connectedLed = new QLedLabel(this); ui->statusBar->addPermanentWidget(connectedLed); @@ -4746,15 +4756,24 @@ void wfmain::receiveFreq(freqt freqStruct) void wfmain::receivePTTstatus(bool pttOn) { // This is the only place where amTransmitting and the transmit button text should be changed: - //qInfo(logSystem()) << "PTT status: " << pttOn; if (pttOn && !amTransmitting) { - pttLed->setState(QLedLabel::State::StateError); + pttLed->setState(QLedLabel::State::StateError); + pttLed->setToolTip("Transmitting"); + if(splitModeEnabled) + { + pttLed->setState(QLedLabel::State::StateSplitErrorOk); + pttLed->setToolTip("TX Split"); + } else { + pttLed->setState(QLedLabel::State::StateError); + pttLed->setToolTip("Transmitting"); + } } else if (!pttOn && amTransmitting) { pttLed->setState(QLedLabel::State::StateOk); + pttLed->setToolTip("Receiving"); } amTransmitting = pttOn; rpt->handleTransmitStatus(pttOn); diff --git a/wfmain.h b/wfmain.h index cba2340..5596dae 100644 --- a/wfmain.h +++ b/wfmain.h @@ -1059,7 +1059,8 @@ private: mode_info currentModeInfo; bool haveRigCaps; - bool amTransmitting; + bool amTransmitting = false; + bool splitModeEnabled = false; bool usingDataMode = false; unsigned char micGain=0; diff --git a/wfmain.ui b/wfmain.ui index 21ff7aa..972a55b 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -18,7 +18,7 @@ - 3 + 0 @@ -1057,7 +1057,7 @@ Show the repeater tone and offset window - Repeater + Rpt/Split @@ -1808,6 +1808,7 @@ DejaVu Sans Mono 14 + 75 true @@ -3430,7 +3431,7 @@ 0 0 - 579 + 570 224 @@ -5380,6 +5381,7 @@ + 50 false @@ -5399,7 +5401,7 @@ 0 0 1063 - 22 + 21 @@ -5426,8 +5428,8 @@ - +