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
This commit is contained in:
Joe Taylor 2015-06-04 18:17:13 +00:00
parent 3fe0290240
commit 64f44e5e2c
3 changed files with 28 additions and 19 deletions

View File

@ -1,13 +1,15 @@
//#include "commons.h" //#include "commons.h"
#include <QSettings>
#include "echoplot.h" #include "echoplot.h"
#include "echograph.h" #include "echograph.h"
#include "ui_echograph.h" #include "ui_echograph.h"
#define NSMAX2 1366 #define NSMAX2 1366
EchoGraph::EchoGraph(QWidget *parent) : EchoGraph::EchoGraph(QSettings * settings, QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::EchoGraph) ui(new Ui::EchoGraph),
m_settings (settings)
{ {
ui->setupUi(this); ui->setupUi(this);
this->setWindowFlags(Qt::Dialog); this->setWindowFlags(Qt::Dialog);
@ -18,19 +20,21 @@ EchoGraph::EchoGraph(QWidget *parent) :
ui->echoPlot->setMaximumHeight(800); ui->echoPlot->setMaximumHeight(800);
//Restore user's settings //Restore user's settings
/*
QString inifile(QApplication::applicationDirPath()); QString inifile(QApplication::applicationDirPath());
inifile += "/emecho.ini"; inifile += "/emecho.ini";
QSettings settings(inifile, QSettings::IniFormat); QSettings settings(inifile, QSettings::IniFormat);
*/
settings.beginGroup("EchoGraph"); m_settings->beginGroup("EchoGraph");
ui->echoPlot->setPlotZero(settings.value("PlotZero", 0).toInt()); restoreGeometry (m_settings->value ("geometry", saveGeometry ()).toByteArray ());
ui->echoPlot->setPlotGain(settings.value("PlotGain", 0).toInt()); 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->zeroSlider->setValue(ui->echoPlot->getPlotZero());
ui->gainSlider->setValue(ui->echoPlot->getPlotGain()); ui->gainSlider->setValue(ui->echoPlot->getPlotGain());
ui->smoothSpinBox->setValue(settings.value("Smooth",0).toInt()); ui->smoothSpinBox->setValue(m_settings->value("Smooth",0).toInt());
ui->echoPlot->m_blue=settings.value("BlueCurve",false).toBool(); ui->echoPlot->m_blue=m_settings->value("BlueCurve",false).toBool();
ui->cbBlue->setChecked(ui->echoPlot->m_blue); ui->cbBlue->setChecked(ui->echoPlot->m_blue);
settings.endGroup(); m_settings->endGroup();
} }
EchoGraph::~EchoGraph() EchoGraph::~EchoGraph()
@ -48,16 +52,18 @@ void EchoGraph::closeEvent (QCloseEvent * e)
void EchoGraph::saveSettings() void EchoGraph::saveSettings()
{ {
//Save user's settings //Save user's settings
/*
QString inifile(QApplication::applicationDirPath()); QString inifile(QApplication::applicationDirPath());
inifile += "/emecho.ini"; inifile += "/emecho.ini";
QSettings settings(inifile, QSettings::IniFormat); QSettings settings(inifile, QSettings::IniFormat);
*/
settings.beginGroup("EchoGraph"); m_settings->beginGroup("EchoGraph");
settings.setValue("PlotZero",ui->echoPlot->m_plotZero); m_settings->setValue ("geometry", saveGeometry ());
settings.setValue("PlotGain",ui->echoPlot->m_plotGain); m_settings->setValue("PlotZero",ui->echoPlot->m_plotZero);
settings.setValue("Smooth",ui->echoPlot->m_smooth); m_settings->setValue("PlotGain",ui->echoPlot->m_plotGain);
settings.setValue("BlueCurve",ui->echoPlot->m_blue); m_settings->setValue("Smooth",ui->echoPlot->m_smooth);
settings.endGroup(); m_settings->setValue("BlueCurve",ui->echoPlot->m_blue);
m_settings->endGroup();
} }
void EchoGraph::plotSpec() void EchoGraph::plotSpec()

View File

@ -6,6 +6,8 @@ namespace Ui {
class EchoGraph; class EchoGraph;
} }
class QSettings;
class EchoGraph : public QDialog class EchoGraph : public QDialog
{ {
Q_OBJECT Q_OBJECT
@ -14,7 +16,7 @@ protected:
void closeEvent (QCloseEvent *) override; void closeEvent (QCloseEvent *) override;
public: public:
explicit EchoGraph(QWidget *parent = 0); explicit EchoGraph(QSettings *, QWidget *parent = 0);
~EchoGraph(); ~EchoGraph();
void plotSpec(); void plotSpec();
@ -27,6 +29,7 @@ private slots:
void on_zeroSlider_valueChanged(int value); void on_zeroSlider_valueChanged(int value);
private: private:
QSettings * m_settings;
Ui::EchoGraph *ui; Ui::EchoGraph *ui;
}; };

View File

@ -73,8 +73,8 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme
ui(new Ui::MainWindow), ui(new Ui::MainWindow),
m_config {settings, this}, m_config {settings, this},
m_WSPR_band_hopping {settings, &m_config, this}, m_WSPR_band_hopping {settings, &m_config, this},
m_wideGraph (new WideGraph (settings)), m_wideGraph (new WideGraph(settings)),
m_echoGraph (new EchoGraph), m_echoGraph (new EchoGraph(settings)),
m_logDlg (new LogQSO (program_title (), settings, this)), m_logDlg (new LogQSO (program_title (), settings, this)),
m_dialFreq {std::numeric_limits<Radio::Frequency>::max ()}, m_dialFreq {std::numeric_limits<Radio::Frequency>::max ()},
m_detector (RX_SAMPLE_RATE, NTMAX, 6912 / 2, downSampleFactor), m_detector (RX_SAMPLE_RATE, NTMAX, 6912 / 2, downSampleFactor),