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 <QSettings>
#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()

View File

@ -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;
};

View File

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