-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathqmysettings.h
72 lines (64 loc) · 2.05 KB
/
qmysettings.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
*
* MashBerry Homebrewing-controller
*
* Copyright (C) 2013 Sebastian Duell
*
* This file is licensed under the terms of the GNU General Public
* License version 3. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#ifndef QMYSETTINGS_H
#define QMYSETTINGS_H
#include <QObject>
#include <QList>
#include <QString>
#include "qpidparameters.h"
#ifndef Q_OS_WIN
#define WEBUI_ROOT_DIR QString("/home/pi/.mashberry/templates/")
#define WEBUI_TEMPLATE_DIR QString("/home/pi/.mashberry/templates/html/")
#define SETTINGS_DIR "/home/pi/.mashberry/"
#define SETTINGS_FILE "/home/pi/.mashberry/settings.xml"
#define RECIPE_FILE "/home/pi/.mashberry/recipe.xml"
#define CSV_FILE "/home/pi/.mashberry/templog.csv"
#else
#define WEBUI_ROOT_DIR QString("templates/")
#define WEBUI_TEMPLATE_DIR QString("templates/html/")
#define SETTINGS_DIR ""
#define SETTINGS_FILE "settings.xml"
#define RECIPE_FILE "recipe.xml"
#define CSV_FILE "templog.csv"
#endif
class QMySettings : public QObject
{
Q_OBJECT
public:
explicit QMySettings(QObject *parent = 0);
int GetPIDParamCount();
QPIDParameters *GetPIDParam(int idx);
QPIDParameters *GetNearestPIDParam(int temp);
bool PIDTempExists(int temp);
QString GetLanguage();
QString GetSensorName();
bool IsSinglePIDparam();
signals:
public slots:
void AddPIDParam(int temp, double kp, double ki, double kd, bool saveSettings);
void SetPIDParam(int idx, int temp, double kp, double ki, double kd, bool saveSettings);
void RemovePIDParam(int idx, bool saveSettings);
void SetSensorName(QString name, bool saveSettings);
void SetLanguage(QString lang, bool saveSettings);
void SetSinglePIDparam(bool single, bool saveSettings);
void SaveSettings();
protected:
void LoadSettings();
QPIDParameters *GetPidParams(XMLElement *parent);
int diff(int a, int b);
private:
QList<QPIDParameters*> m_PIDParams;
QString m_Sensor;
QString m_lang;
bool m_singlePIDparam;
};
#endif // QMYSETTINGS_H