Changeset - 4658d6da8b06
[Not reviewed]
settings
0 4 0
Hasan Yavuz Ă–ZDERYA - 9 years ago 2016-09-08 03:07:23
hy@ozderya.net
save/load plot view settings
4 files changed with 46 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/mainwindow.cpp
Show inline comments
 
@@ -440,6 +440,7 @@ void MainWindow::saveAllSettings(QSettin
 
    dataFormatPanel.saveSettings(settings);
 
    channelMan.saveSettings(settings);
 
    plotControlPanel.saveSettings(settings);
 
    plotMan->saveSettings(settings);
 
    commandPanel.saveSettings(settings);
 
}
 

	
 
@@ -450,6 +451,7 @@ void MainWindow::loadAllSettings(QSettin
 
    dataFormatPanel.loadSettings(settings);
 
    channelMan.loadSettings(settings);
 
    plotControlPanel.loadSettings(settings);
 
    plotMan->loadSettings(settings);
 
    commandPanel.loadSettings(settings);
 
}
 

	
src/plotmanager.cpp
Show inline comments
 
@@ -22,7 +22,7 @@
 
#include "plot.h"
 
#include "plotmanager.h"
 
#include "utils.h"
 

	
 
#include "setting_defines.h"
 

	
 
PlotManager::PlotManager(QWidget* plotArea, QObject *parent) :
 
    QObject(parent),
 
@@ -372,3 +372,36 @@ void PlotManager::onNumOfSamplesChanged(
 
        plot->onNumOfSamplesChanged(value);
 
    }
 
}
 

	
 
void PlotManager::saveSettings(QSettings* settings)
 
{
 
    settings->beginGroup(SettingGroup_Plot);
 
    settings->setValue(SG_Plot_DarkBackground, darkBackgroundAction.isChecked());
 
    settings->setValue(SG_Plot_Grid, showGridAction.isChecked());
 
    settings->setValue(SG_Plot_MinorGrid, showMinorGridAction.isChecked());
 
    settings->setValue(SG_Plot_Legend, showLegendAction.isChecked());
 
    settings->setValue(SG_Plot_MultiPlot, showMultiAction.isChecked());
 
    settings->endGroup();
 
}
 

	
 
void PlotManager::loadSettings(QSettings* settings)
 
{
 
    settings->beginGroup(SettingGroup_Plot);
 
    darkBackgroundAction.setChecked(
 
        settings->value(SG_Plot_DarkBackground, darkBackgroundAction.isChecked()).toBool());
 
    darkBackground(darkBackgroundAction.isChecked());
 
    showGridAction.setChecked(
 
        settings->value(SG_Plot_Grid, showGridAction.isChecked()).toBool());
 
    showGrid(showGridAction.isChecked());
 
    showMinorGridAction.setChecked(
 
        settings->value(SG_Plot_MinorGrid, showMinorGridAction.isChecked()).toBool());
 
    showMinorGridAction.setEnabled(showGridAction.isChecked());
 
    showMinorGrid(showMinorGridAction.isChecked());
 
    showLegendAction.setChecked(
 
        settings->value(SG_Plot_Legend, showLegendAction.isChecked()).toBool());
 
    showLegend(showLegendAction.isChecked());
 
    showMultiAction.setChecked(
 
        settings->value(SG_Plot_MultiPlot, showMultiAction.isChecked()).toBool());
 
    setMulti(showMultiAction.isChecked());
 
    settings->endGroup();
 
}
src/plotmanager.h
Show inline comments
 
@@ -25,6 +25,7 @@
 
#include <QScrollArea>
 
#include <QVBoxLayout>
 
#include <QList>
 
#include <QSettings>
 

	
 
#include <qwt_plot_curve.h>
 
#include "plot.h"
 
@@ -50,6 +51,10 @@ public:
 
    unsigned numOfCurves();
 
    /// Returns the list of actions to be inserted into the `View` menu
 
    QList<QAction*> menuActions();
 
    /// Stores plot settings into a `QSettings`.
 
    void saveSettings(QSettings* settings);
 
    /// Loads plot settings from a `QSettings`.
 
    void loadSettings(QSettings* settings);
 

	
 
public slots:
 
    /// Enable/Disable multiple plot display
src/setting_defines.h
Show inline comments
 
@@ -75,6 +75,11 @@ const char SG_Plot_NumOfSamples[] = "num
 
const char SG_Plot_AutoScale[] = "autoScale";
 
const char SG_Plot_YMax[] = "yMax";
 
const char SG_Plot_YMin[] = "yMin";
 
const char SG_Plot_DarkBackground[] = "darkBackground";
 
const char SG_Plot_Grid[] = "grid";
 
const char SG_Plot_MinorGrid[] = "minorGrid";
 
const char SG_Plot_Legend[] = "legend";
 
const char SG_Plot_MultiPlot[] = "multiPlot";
 

	
 
// command setting keys
 
const char SG_Commands_Command[] = "command";
0 comments (0 inline, 0 general)