From d3d59b2a94880c582c5532ac1cf4a143232bb37d Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Tue, 15 Jun 2021 11:27:45 -0700 Subject: [PATCH] Dynamic show/hide spectrum for rigs without this feature. --- wfmain.cpp | 43 +++++++++++++++++++++++++++++++++++++++++-- wfmain.h | 1 + wfmain.ui | 14 +++++++------- 3 files changed, 49 insertions(+), 9 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index f8fec6e..ccf89b5 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -1494,6 +1494,40 @@ void wfmain::saveSettings() } +void wfmain::showHideSpectrum(bool show) +{ + + if(show) + { + wf->show(); + plot->show(); + } else { + wf->hide(); + plot->hide(); + } + + // Controls: + ui->spectrumGroupBox->setVisible(show); + ui->spectrumModeCombo->setVisible(show); + ui->scopeBWCombo->setVisible(show); + ui->scopeEdgeCombo->setVisible(show); + ui->scopeEnableWFBtn->setVisible(show); + ui->scopeRefLevelSlider->setEnabled(show); + ui->wfLengthSlider->setEnabled(show); + ui->wfthemeCombo->setVisible(show); + ui->toFixedBtn->setVisible(show); + ui->clearPeakBtn->setVisible(show); + + // And the labels: + ui->specEdgeLabel->setVisible(show); + ui->specModeLabel->setVisible(show); + ui->specSpanLabel->setVisible(show); + ui->specThemeLabel->setVisible(show); + + ui->specControlsHorizLayout->setEnabled(show); + +} + void wfmain::prepareWf() { prepareWf(160); @@ -1505,6 +1539,11 @@ void wfmain::prepareWf(unsigned int wfLength) if(haveRigCaps) { + showHideSpectrum(rigCaps.hasSpectrum); + if(!rigCaps.hasSpectrum) + { + return; + } // TODO: Lock the function that draws on the spectrum while we are updating. spectrumDrawLock = true; @@ -4357,7 +4396,7 @@ void wfmain::calculateTimingParameters() msMinTiming = 35; delayedCommand->setInterval( msMinTiming * 2); // 20 byte message - periodicPollingTimer->setInterval( msMinTiming ); // slower for s-meter poll + periodicPollingTimer->setInterval( msMinTiming *5); // slower for s-meter poll qInfo(logSystem()) << "Delay command interval timing: " << msMinTiming * 2 << "ms"; qInfo(logSystem()) << "Periodic polling timer: " << msMinTiming << "ms"; @@ -4612,6 +4651,6 @@ void wfmain::on_wfLengthSlider_valueChanged(int value) void wfmain::on_debugBtn_clicked() { qInfo(logSystem()) << "Debug button pressed."; - emit getTxPower(); + emit getFrequency(); } diff --git a/wfmain.h b/wfmain.h index 9439ba7..0f4317e 100644 --- a/wfmain.h +++ b/wfmain.h @@ -462,6 +462,7 @@ private: void setPlotTheme(QCustomPlot *plot, bool isDark); void prepareWf(); void prepareWf(unsigned int wfLength); + void showHideSpectrum(bool show); void getInitialRigState(); void setBandButtons(); void showButton(QPushButton *btn); diff --git a/wfmain.ui b/wfmain.ui index d2a6ade..e9b4a27 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -26,7 +26,7 @@ - + Spectrum @@ -44,12 +44,12 @@ - + 0 - + Spectrum Mode: @@ -66,7 +66,7 @@ - + Span: @@ -86,7 +86,7 @@ - + Edge @@ -133,7 +133,7 @@ - + Theme: @@ -150,7 +150,7 @@ - + Qt::Horizontal