From a569d25ddbdb8601e26cffa903279321ad55e3a1 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 1 Sep 2022 11:20:00 -0400 Subject: [PATCH] Add an optional baseline to plots in Echo Graph. --- widgets/echograph.cpp | 13 +++++++++++++ widgets/echograph.h | 2 ++ widgets/echograph.ui | 23 +++++++++++++++++++++++ widgets/echoplot.cpp | 17 +++++++++++++++-- widgets/echoplot.h | 2 ++ widgets/mainwindow.cpp | 2 -- 6 files changed, 55 insertions(+), 4 deletions(-) diff --git a/widgets/echograph.cpp b/widgets/echograph.cpp index 4bcaa7173..fb2623646 100644 --- a/widgets/echograph.cpp +++ b/widgets/echograph.cpp @@ -2,6 +2,7 @@ #include "commons.h" #include #include +#include #include "echoplot.h" #include "ui_echograph.h" #include "moc_echograph.cpp" @@ -36,6 +37,7 @@ EchoGraph::EchoGraph(QSettings * settings, QWidget *parent) : ui->binsPerPixelSpinBox->setValue(n); ui->echoPlot->m_blue=m_settings->value("BlueCurve",false).toBool(); m_nColor=m_settings->value("EchoColors",0).toInt(); + ui->cbBaseline->setChecked(m_settings->value("Baseline",false).toBool()); m_settings->endGroup(); ui->echoPlot->setColors(m_nColor); } @@ -62,6 +64,7 @@ void EchoGraph::saveSettings() m_settings->setValue("EchoBPP",ui->echoPlot->m_binsPerPixel); m_settings->setValue("BlueCurve",ui->echoPlot->m_blue); m_settings->setValue("EchoColors",m_nColor); + m_settings->setValue("Baseline",ui->cbBaseline->isChecked()); m_settings->endGroup(); } @@ -101,3 +104,13 @@ void EchoGraph::on_pbColors_clicked() m_nColor = (m_nColor+1) % 6; ui->echoPlot->setColors(m_nColor); } + +void EchoGraph::on_cbBaseline_toggled(bool b) +{ + ui->echoPlot->setBaseline(b); +} + +bool EchoGraph::baseline() +{ + return ui->cbBaseline->isChecked(); +} diff --git a/widgets/echograph.h b/widgets/echograph.h index 6e91782f1..1cd6e7506 100644 --- a/widgets/echograph.h +++ b/widgets/echograph.h @@ -23,6 +23,7 @@ public: void plotSpec(); void saveSettings(); + bool baseline(); private slots: void on_smoothSpinBox_valueChanged(int n); @@ -30,6 +31,7 @@ private slots: void on_zeroSlider_valueChanged(int value); void on_binsPerPixelSpinBox_valueChanged(int n); void on_pbColors_clicked(); + void on_cbBaseline_toggled(bool b); private: QSettings * m_settings; diff --git a/widgets/echograph.ui b/widgets/echograph.ui index 470a2cc8c..0990db563 100644 --- a/widgets/echograph.ui +++ b/widgets/echograph.ui @@ -189,6 +189,29 @@ + + + + Baseline + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 20 + 20 + + + + diff --git a/widgets/echoplot.cpp b/widgets/echoplot.cpp index 34fc33865..65feb7a8e 100644 --- a/widgets/echoplot.cpp +++ b/widgets/echoplot.cpp @@ -127,7 +127,7 @@ void EPlotter::draw() //draw() painter2D.setPen(penBlue); j=0; for(i=0; idecodedTextBrowser->toPlainText(); - static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("WSJT-X.txt")}; if(!f.open(QIODevice::Text | QIODevice::WriteOnly)) { MessageBox::warning_message (this, tr ("WSJT-X.txt file error"),