From bd31fb19c18671405c30e7541e8d1de31460d33e Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 17 Oct 2024 22:46:12 +0100 Subject: [PATCH] Various fixes (color presets and disable some controls if not used) --- settingswidget.cpp | 4 ++-- spectrumscope.cpp | 40 ++++++++++++++++++++++++++++++---------- spectrumscope.h | 5 ++++- wfmain.cpp | 10 ++++------ wfmain.h | 3 --- 5 files changed, 40 insertions(+), 22 deletions(-) diff --git a/settingswidget.cpp b/settingswidget.cpp index e4910d9..229ac75 100644 --- a/settingswidget.cpp +++ b/settingswidget.cpp @@ -2204,7 +2204,7 @@ void settingswidget::setColorButtonOperations(QColor *colorStore, getSetColor(d, e); QColor t = d->getColor(); #if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) - colorStore->fromString(t.name(QColor::HexArgb)); + *(colorStore) = colorStore->fromString(t.name(QColor::HexArgb)); #else colorStore->setNamedColor(t.name(QColor::HexArgb)); #endif @@ -2225,7 +2225,7 @@ void settingswidget::setColorLineEditOperations(QColor *colorStore, QString colorStrValidated = setColorFromString(e->text(), d); e->setText(colorStrValidated); #if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) - colorStore->fromString(colorStrValidated); + *(colorStore) = colorStore->fromString(colorStrValidated); #else colorStore->setNamedColor(colorStrValidated); #endif diff --git a/spectrumscope.cpp b/spectrumscope.cpp index d351712..974f250 100644 --- a/spectrumscope.cpp +++ b/spectrumscope.cpp @@ -305,6 +305,7 @@ spectrumScope::spectrumScope(bool scope, uchar receiver, uchar vfo, QWidget *par configIfShift = new QSlider(Qt::Orientation::Horizontal); configIfShift->setRange(0,255); + configIfShift->setEnabled(false); configLayout->addRow(tr("IF Shift"),configIfShift); configFilterWidth = new QSlider(Qt::Orientation::Horizontal); @@ -1486,13 +1487,13 @@ void spectrumScope::receiveMode(modeInfo m, uchar vfo) if (vfo > 0) return; - if (mode.reg != m.reg || m.filter != mode.filter || m.data != mode.data) + if (m.reg != this->mode.reg || m.filter != this->mode.filter || m.data != this->mode.data) { qDebug(logSystem()) << __func__ << QString("Received new mode for %0: %1 (%2) filter:%3 data:%4") .arg((receiver?"Sub":"Main")).arg(QString::number(m.mk,16)).arg(m.name).arg(m.filter).arg(m.data) ; - if (mode.mk != m.mk) { + if (this->mode.mk != m.mk) { for (int i=0;icount();i++) { modeInfo mi = modeCombo->itemData(i).value(); @@ -1506,14 +1507,14 @@ void spectrumScope::receiveMode(modeInfo m, uchar vfo) } } - if (m.filter && mode.filter != m.filter) + if (m.filter && this->mode.filter != m.filter) { filterCombo->blockSignals(true); filterCombo->setCurrentIndex(filterCombo->findData(m.filter)); filterCombo->blockSignals(false); } - if (mode.data != m.data) + if (this->mode.data != m.data) { emit dataChanged(m); // Signal wfmain that the data mode has been changed. dataCombo->blockSignals(true); @@ -1533,21 +1534,28 @@ void spectrumScope::receiveMode(modeInfo m, uchar vfo) passbandCenterFrequency = 0.0; - // Set config specific options) - configFilterWidth->blockSignals(true); - configFilterWidth->setMinimum(m.bwMin); - configFilterWidth->setMaximum(m.bwMax); - configFilterWidth->blockSignals(false); // If new mode doesn't allow bandwidth control, disable filterwidth and pbt. if (m.bwMin > 0 && m.bwMax > 0) { + // Set config specific options) + configFilterWidth->blockSignals(true); + configFilterWidth->setMinimum(m.bwMin); + configFilterWidth->setMaximum(m.bwMax); + configFilterWidth->blockSignals(false); + configFilterWidth->setEnabled(true); + configPbtInner->setEnabled(true); + configPbtOuter->setEnabled(true); queue->addUnique(priorityHigh,funcPBTInner,true,receiver); queue->addUnique(priorityHigh,funcPBTOuter,true,receiver); queue->addUnique(priorityHigh,funcFilterWidth,true,receiver); + } else{ queue->del(funcPBTInner,receiver); queue->del(funcPBTOuter,receiver); queue->del(funcFilterWidth,receiver); + configFilterWidth->setEnabled(false); + configPbtInner->setEnabled(false); + configPbtOuter->setEnabled(false); } if (m.mk == modeDD || m.mk == modeDV) @@ -1605,7 +1613,7 @@ void spectrumScope::receiveMode(modeInfo m, uchar vfo) #endif } - mode = m; + this->mode = m; } } @@ -1846,6 +1854,18 @@ void spectrumScope::setPBTOuter (uchar val) { } } +void spectrumScope::setIFShift(uchar val) +{ + configIfShift->setEnabled(true); + if (val != this->ifShift) + { + configIfShift->blockSignals(true); + configIfShift->setValue(val); + configIfShift->blockSignals(false); + this->ifShift = val; + } +} + void spectrumScope::setFrequency(freqt f, uchar vfo) { //qInfo() << "Setting Frequency vfo=" << vfo << "Freq:" << f.Hz; diff --git a/spectrumscope.h b/spectrumscope.h index c695cf1..0975de5 100644 --- a/spectrumscope.h +++ b/spectrumscope.h @@ -76,6 +76,8 @@ public: double getPBTOuter () { return PBTOuter;} void setPBTOuter (uchar val); + void setIFShift (uchar val); + quint16 getStepSize () { return stepSize;} void setStepSize (quint16 hz) { stepSize = hz;} @@ -227,7 +229,7 @@ private: uchar currentSpeed = 0; colorPrefsType colors; freqt freq; - modeInfo mode = modeInfo(modeUnknown,0,"",0,0); + modeInfo mode = modeInfo(modeUnknown,0,"Unk",0,0); bool lock = false; bool scopePrepared=false; quint16 spectWidth=689; @@ -274,6 +276,7 @@ private: double pbtDefault = 0.0; quint16 cwPitch = 600; quint16 stepSize = 100; + uchar ifShift = 0; int refLower=0; int refUpper=0; diff --git a/wfmain.cpp b/wfmain.cpp index 2d7325b..9054c5c 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -2419,6 +2419,7 @@ void wfmain::extChangedColPref(prefColItem i) // These are all updated by the widget itself switch(i) { + // Any updated scope colors will cause the scope colorPreset to be changed. case col_grid: case col_axis: case col_text: @@ -2446,6 +2447,7 @@ void wfmain::extChangedColPref(prefColItem i) receiver->colorPreset(cp); } break; + // Any updated meter colors, will cause the meter to be updated. case col_meterLevel: case col_meterAverage: case col_meterPeakLevel: @@ -4037,10 +4039,6 @@ void wfmain::on_monitorLabel_linkActivated(const QString&) queue->add(priorityImmediate,queueItem(funcMonitor,QVariant::fromValue(!mon))); } -void wfmain::receiveIFShift(quint8 level) -{ - emit sendLevel(funcIFShift,level); -} void wfmain::on_tuneNowBtn_clicked() { @@ -4903,7 +4901,7 @@ void wfmain::useColorPreset(colorPrefsType *cp) if (this->colorPrefs != Q_NULLPTR) delete this->colorPrefs; this->colorPrefs = new colorPrefsType(*cp); - qInfo() << "Setting color Preset" << cp->presetNum << "name" << cp->presetName; + qInfo() << "Setting color Preset" << cp->presetNum << "name" << *(cp->presetName); } @@ -5268,7 +5266,7 @@ void wfmain::receiveValue(cacheItem val){ break; } case funcIFShift: - receiveIFShift(val.value.value()); + receivers[val.receiver]->setIFShift(val.value.value()); break; /* connect(this->rig, &rigCommander::haveDashRatio, diff --git a/wfmain.h b/wfmain.h index a0c2462..788752b 100644 --- a/wfmain.h +++ b/wfmain.h @@ -390,9 +390,6 @@ private slots: void receiveMonitor(bool en); void receiveTuningStep(quint8 step); - // Levels: - void receiveIFShift(quint8 level); - // Meters: void receiveMeter(meter_t meter, quint8 level, quint8 receiver=0); // void receiveSMeter(quint8 level);