From af7cff422cbfb861ffd5965c1fa6541bf2fef49a Mon Sep 17 00:00:00 2001 From: Allan Bazinet Date: Sat, 19 Oct 2024 11:30:52 -0700 Subject: [PATCH] Dead code removal, graph cbRef Widget that would drive this is always hidden and always false; can never happen. --- plotter.cpp | 15 ++++++--------- plotter.h | 9 +++++---- widegraph.cpp | 26 ++------------------------ widegraph.h | 3 --- widegraph.ui | 15 +-------------- 5 files changed, 14 insertions(+), 54 deletions(-) diff --git a/plotter.cpp b/plotter.cpp index 95967cd5..4214f8dd 100644 --- a/plotter.cpp +++ b/plotter.cpp @@ -68,9 +68,9 @@ CPlotter::CPlotter(QWidget *parent) : //CPlotter Constructor m_plot2dZero {0}, m_nSubMode {0}, m_filterEnabled{false}, + m_paintEventBusy{false}, m_filterCenter {0}, m_filterWidth {0}, - m_paintEventBusy {false}, m_fftBinWidth {1500.0/2048.0}, m_dialFreq {0.}, m_line {0}, @@ -209,7 +209,7 @@ CPlotter::draw(float swide[], if (bScroll && swide[0] < 1.e29) { - flat4_(swide, &iz, &m_Flatten); + flat4_(swide, &iz, &m_flatten); } if(swide[0] > 1.e29 && swide[0] < 1.5e30) painter1.setPen(Qt::green); // horizontal line @@ -275,10 +275,10 @@ CPlotter::draw(float swide[], switch (m_spectrum) { case Spectrum::Current: - y = gain2d * (swide[i] - ymin) + m_plot2dZero + (m_Flatten == 0 ? 15 : 0); + y = gain2d * (swide[i] - ymin) + m_plot2dZero + (m_flatten == 0 ? 15 : 0); break; case Spectrum::Cumulative: - y = gain2d * (m_sum[i] / m_binsPerPixel + m_plot2dZero) + (m_Flatten == 0 ? 15 : 0); + y = gain2d * (m_sum[i] / m_binsPerPixel + m_plot2dZero) + (m_flatten == 0 ? 15 : 0); break; case Spectrum::LinearAvg: y = 2.0 * gain2d * sum(spectra_.syellow, i) / m_binsPerPixel + m_plot2dZero; @@ -806,12 +806,9 @@ CPlotter::setSubMode(int const nSubMode) } void -CPlotter::setFlatten(bool const b1, - bool const b2) +CPlotter::setFlatten(bool const flatten) { - m_Flatten = 0; - if (b1) m_Flatten = 1; - if (b2) m_Flatten = 2; + m_flatten = flatten ? 1 : 0; } void diff --git a/plotter.h b/plotter.h index 49debee0..a9185689 100644 --- a/plotter.h +++ b/plotter.h @@ -89,7 +89,7 @@ public: void setFilterWidth(int width); void setFilterEnabled(bool enabled); void setFilterOpacity(int alpha); - void setFlatten(bool b1, bool b2); + void setFlatten(bool); void setMode (QString const & mode); void setPercent2DScreen(int percent); void setRxRange(int fMin); @@ -141,7 +141,6 @@ private: qint32 m_binsPerPixel; qint32 m_waterfallAvg; qint32 m_w; - qint32 m_Flatten; qint32 m_nSubMode; QPixmap m_FilterOverlayPixmap; @@ -157,12 +156,14 @@ private: QString m_band; bool m_filterEnabled; - int m_filterCenter; - int m_filterWidth; bool m_paintEventBusy; bool m_dataFromDisk; bool m_bReplot; + int m_filterCenter; + int m_filterWidth; + int m_flatten; + double m_fftBinWidth; double m_dialFreq; diff --git a/widegraph.cpp b/widegraph.cpp index 299206ad..7f7ab4d3 100644 --- a/widegraph.cpp +++ b/widegraph.cpp @@ -136,10 +136,8 @@ WideGraph::WideGraph(QSettings * settings, QWidget *parent) : ui->zero2dSlider->setValue(ui->widePlot->plot2dZero()); int n = m_settings->value("BinsPerPixel",2).toInt(); m_bFlatten=m_settings->value("Flatten",true).toBool(); - m_bRef=m_settings->value("UseRef",false).toBool(); ui->cbFlatten->setChecked(m_bFlatten); - ui->widePlot->setFlatten(m_bFlatten,m_bRef); - ui->cbRef->setChecked(m_bRef); + ui->widePlot->setFlatten(m_bFlatten); ui->widePlot->setPlotWidth(m_settings->value("PlotWidth",1000).toInt()); ui->bppSpinBox->setValue(n); m_nsmo=m_settings->value("SmoothYellow",1).toInt(); @@ -229,7 +227,6 @@ void WideGraph::saveSettings() //saveS m_settings->setValue ("WaterfallPalette", m_waterfallPalette); m_settings->setValue ("UserPalette", QVariant::fromValue (m_userPalette.colours ())); m_settings->setValue ("Flatten",m_bFlatten); - m_settings->setValue ("UseRef",m_bRef); m_settings->setValue ("HideControls", ui->controls_widget->isHidden ()); m_settings->setValue ("FminPerBand", m_fMinPerBand); m_settings->setValue ("CenterOffset", ui->centerSpinBox->value()); @@ -778,21 +775,7 @@ void WideGraph::on_paletteComboBox_activated (const int palette_index) //pale void WideGraph::on_cbFlatten_toggled(bool b) //Flatten On/Off { m_bFlatten=b; - if(m_bRef and m_bFlatten) { - m_bRef=false; - ui->cbRef->setChecked(false); - } - ui->widePlot->setFlatten(m_bFlatten,m_bRef); -} - -void WideGraph::on_cbRef_toggled(bool b) -{ - m_bRef=b; - if(m_bRef and m_bFlatten) { - m_bFlatten=false; - ui->cbFlatten->setChecked(false); - } - ui->widePlot->setFlatten(m_bFlatten,m_bRef); + ui->widePlot->setFlatten(m_bFlatten); } void WideGraph::on_cbControls_toggled(bool b) @@ -831,11 +814,6 @@ bool WideGraph::flatten() //Flatten return m_bFlatten; } -bool WideGraph::useRef() //Flatten -{ - return m_bRef; -} - void WideGraph::replot() { if(ui->widePlot->scaleOK()) ui->widePlot->replot(); diff --git a/widegraph.h b/widegraph.h index 116ddaa6..fff0d25b 100644 --- a/widegraph.h +++ b/widegraph.h @@ -80,7 +80,6 @@ public: void setMode(QString mode); void setSubMode(int n); bool flatten(); - bool useRef(); int smoothYellow(); void setBand (QString const& band); void drawDecodeLine(const QColor &color, int ia, int ib); @@ -126,7 +125,6 @@ private slots: void on_fStartSpinBox_valueChanged(int n); void on_paletteComboBox_activated(int); void on_cbFlatten_toggled(bool b); - void on_cbRef_toggled(bool b); void on_cbControls_toggled(bool b); void on_adjust_palette_push_button_clicked (bool); void on_gainSlider_valueChanged(int value); @@ -190,7 +188,6 @@ private: bool m_paused; bool m_bFlatten; - bool m_bRef; bool m_autoSyncConnected = false; QTimer m_autoSyncTimer; diff --git a/widegraph.ui b/widegraph.ui index dcbf38a6..4a0b030e 100644 --- a/widegraph.ui +++ b/widegraph.ui @@ -153,7 +153,7 @@ QTabWidget::TabShape::Rounded - 2 + 1 false @@ -623,19 +623,6 @@ - - - - false - - - <html><head/><body><p>Compute and save a reference spectrum. (Not yet fully implemented.)</p></body></html> - - - Ref Spec - - -