From 64f44e5e2ccc1bfe3920ef4c13f79bb0752b7724 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 4 Jun 2015 18:17:13 +0000 Subject: [PATCH] Save/restore Echo Graph configuration in wsjtx.ini rather than emecho.ini. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5525 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- echograph.cpp | 38 ++++++++++++++++++++++---------------- echograph.h | 5 ++++- mainwindow.cpp | 4 ++-- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/echograph.cpp b/echograph.cpp index 8134389c6..33eff08bb 100644 --- a/echograph.cpp +++ b/echograph.cpp @@ -1,13 +1,15 @@ //#include "commons.h" +#include #include "echoplot.h" #include "echograph.h" #include "ui_echograph.h" #define NSMAX2 1366 -EchoGraph::EchoGraph(QWidget *parent) : +EchoGraph::EchoGraph(QSettings * settings, QWidget *parent) : QDialog(parent), - ui(new Ui::EchoGraph) + ui(new Ui::EchoGraph), + m_settings (settings) { ui->setupUi(this); this->setWindowFlags(Qt::Dialog); @@ -18,19 +20,21 @@ EchoGraph::EchoGraph(QWidget *parent) : ui->echoPlot->setMaximumHeight(800); //Restore user's settings +/* QString inifile(QApplication::applicationDirPath()); inifile += "/emecho.ini"; QSettings settings(inifile, QSettings::IniFormat); - - settings.beginGroup("EchoGraph"); - ui->echoPlot->setPlotZero(settings.value("PlotZero", 0).toInt()); - ui->echoPlot->setPlotGain(settings.value("PlotGain", 0).toInt()); +*/ + m_settings->beginGroup("EchoGraph"); + restoreGeometry (m_settings->value ("geometry", saveGeometry ()).toByteArray ()); + ui->echoPlot->setPlotZero(m_settings->value("PlotZero", 0).toInt()); + ui->echoPlot->setPlotGain(m_settings->value("PlotGain", 0).toInt()); ui->zeroSlider->setValue(ui->echoPlot->getPlotZero()); ui->gainSlider->setValue(ui->echoPlot->getPlotGain()); - ui->smoothSpinBox->setValue(settings.value("Smooth",0).toInt()); - ui->echoPlot->m_blue=settings.value("BlueCurve",false).toBool(); + ui->smoothSpinBox->setValue(m_settings->value("Smooth",0).toInt()); + ui->echoPlot->m_blue=m_settings->value("BlueCurve",false).toBool(); ui->cbBlue->setChecked(ui->echoPlot->m_blue); - settings.endGroup(); + m_settings->endGroup(); } EchoGraph::~EchoGraph() @@ -48,16 +52,18 @@ void EchoGraph::closeEvent (QCloseEvent * e) void EchoGraph::saveSettings() { //Save user's settings +/* QString inifile(QApplication::applicationDirPath()); inifile += "/emecho.ini"; QSettings settings(inifile, QSettings::IniFormat); - - settings.beginGroup("EchoGraph"); - settings.setValue("PlotZero",ui->echoPlot->m_plotZero); - settings.setValue("PlotGain",ui->echoPlot->m_plotGain); - settings.setValue("Smooth",ui->echoPlot->m_smooth); - settings.setValue("BlueCurve",ui->echoPlot->m_blue); - settings.endGroup(); +*/ + m_settings->beginGroup("EchoGraph"); + m_settings->setValue ("geometry", saveGeometry ()); + m_settings->setValue("PlotZero",ui->echoPlot->m_plotZero); + m_settings->setValue("PlotGain",ui->echoPlot->m_plotGain); + m_settings->setValue("Smooth",ui->echoPlot->m_smooth); + m_settings->setValue("BlueCurve",ui->echoPlot->m_blue); + m_settings->endGroup(); } void EchoGraph::plotSpec() diff --git a/echograph.h b/echograph.h index 72153e49c..d2f61bf93 100644 --- a/echograph.h +++ b/echograph.h @@ -6,6 +6,8 @@ namespace Ui { class EchoGraph; } +class QSettings; + class EchoGraph : public QDialog { Q_OBJECT @@ -14,7 +16,7 @@ protected: void closeEvent (QCloseEvent *) override; public: - explicit EchoGraph(QWidget *parent = 0); + explicit EchoGraph(QSettings *, QWidget *parent = 0); ~EchoGraph(); void plotSpec(); @@ -27,6 +29,7 @@ private slots: void on_zeroSlider_valueChanged(int value); private: + QSettings * m_settings; Ui::EchoGraph *ui; }; diff --git a/mainwindow.cpp b/mainwindow.cpp index 9477ed3bf..d1de7812e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -73,8 +73,8 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme ui(new Ui::MainWindow), m_config {settings, this}, m_WSPR_band_hopping {settings, &m_config, this}, - m_wideGraph (new WideGraph (settings)), - m_echoGraph (new EchoGraph), + m_wideGraph (new WideGraph(settings)), + m_echoGraph (new EchoGraph(settings)), m_logDlg (new LogQSO (program_title (), settings, this)), m_dialFreq {std::numeric_limits::max ()}, m_detector (RX_SAMPLE_RATE, NTMAX, 6912 / 2, downSampleFactor),