From 47b8c445213995b159493caf5eb5dfdcd2515ba6 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 11 Oct 2012 00:51:16 +0000 Subject: [PATCH] Offer cumulative as well as current 2-d plot. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@2656 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- mainwindow.cpp | 2 +- plotter.cpp | 1 + plotter.h | 1 + widegraph.cpp | 16 ++++++++++++++++ widegraph.h | 4 ++++ widegraph.ui | 33 +++++++++++++++++++++++++++++++++ 6 files changed, 56 insertions(+), 1 deletion(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 9b139331c..db3bd7c10 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,4 +1,4 @@ -//---------------------------------------------------------------- MainWindow +//----------------------------------------------------------------- MainWindow #include "mainwindow.h" #include "ui_mainwindow.h" #include "devsetup.h" diff --git a/plotter.cpp b/plotter.cpp index 693997b57..0c4a3f204 100644 --- a/plotter.cpp +++ b/plotter.cpp @@ -125,6 +125,7 @@ void CPlotter::draw(float swide[], int i0) //draw() painter1.setPen(m_ColorTbl[y1]); painter1.drawPoint(i,0); int y2 = 0.7*gain*(y + 54 - m_plotZero); + if(!m_bCurrent) y2=10.0*jt9com_.savg[i]; if (y2<0) y2=0; if (y2>254) y2=254; if (swide[i]>1.e29) y2=255; diff --git a/plotter.h b/plotter.h index 68d1fc5fc..f1ebfa494 100644 --- a/plotter.h +++ b/plotter.h @@ -26,6 +26,7 @@ public: QSize minimumSizeHint() const; QSize sizeHint() const; QColor m_ColorTbl[256]; + bool m_bCurrent; int m_plotZero; int m_plotGain; float m_fSpan; diff --git a/widegraph.cpp b/widegraph.cpp index 74c71529f..6925480cf 100644 --- a/widegraph.cpp +++ b/widegraph.cpp @@ -1,5 +1,6 @@ #include "widegraph.h" #include "ui_widegraph.h" +#include "commons.h" #define NSMAX 22000 @@ -14,6 +15,7 @@ WideGraph::WideGraph(QWidget *parent) : this->setMaximumWidth(2048); this->setMaximumHeight(880); ui->widePlot->setMaximumHeight(800); + ui->widePlot->m_bCurrent=false; connect(ui->widePlot, SIGNAL(freezeDecode1(int)),this, SLOT(wideFreezeDecode(int))); @@ -38,6 +40,9 @@ WideGraph::WideGraph(QWidget *parent) : ui->waterfallAvgSpinBox->setValue(m_waterfallAvg); m_dialFreq=settings.value("DialFreqMHz",473.000).toDouble(); ui->fDialLineEdit->setText(QString::number(m_dialFreq)); + ui->widePlot->m_bCurrent=settings.value("Current",true).toBool(); + ui->rbCurrent->setChecked(ui->widePlot->m_bCurrent); + ui->rbCumulative->setChecked(!ui->widePlot->m_bCurrent); settings.endGroup(); } @@ -62,6 +67,7 @@ void WideGraph::saveSettings() settings.setValue("FreqSpan",ui->freqSpanSpinBox->value()); settings.setValue("WaterfallAvg",ui->waterfallAvgSpinBox->value()); settings.setValue("DialFreqMHz",m_dialFreq); + settings.setValue("Current",ui->widePlot->m_bCurrent); settings.endGroup(); } @@ -256,3 +262,13 @@ void WideGraph::setPeriod(int ntrperiod, int nsps) m_nsps=nsps; ui->widePlot->setNsps(nsps); } + +void WideGraph::on_rbCurrent_toggled(bool checked) +{ + ui->widePlot->m_bCurrent=checked; +} + +void WideGraph::on_rbCumulative_toggled(bool checked) +{ + ui->widePlot->m_bCurrent=!checked; +} diff --git a/widegraph.h b/widegraph.h index 56363b9f2..e3a5c2b15 100644 --- a/widegraph.h +++ b/widegraph.h @@ -54,6 +54,10 @@ private slots: void on_autoZeroPushButton_clicked(); void on_fDialLineEdit_editingFinished(); + void on_rbCurrent_toggled(bool checked); + + void on_rbCumulative_toggled(bool checked); + private: qint32 m_waterfallAvg; qint32 m_fCal; diff --git a/widegraph.ui b/widegraph.ui index fb19cd180..4cfb7d9cc 100644 --- a/widegraph.ui +++ b/widegraph.ui @@ -258,6 +258,39 @@ + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 20 + 20 + + + + + + + + Current + + + true + + + + + + + Cumulative + + +