forked from BastianGschrey/PowerTune
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appsettings.cpp
103 lines (80 loc) · 1.79 KB
/
appsettings.cpp
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include "appsettings.h"
#include <QSettings>
#include <QDebug>
AppSettings::AppSettings(QObject *parent) : QObject(parent)
{
}
int AppSettings::getBaudRate()
{
return getValue("serial/baudrate").toInt();
}
void AppSettings::setBaudRate(const int &arg)
{
setValue("serial/baudrate", arg);
}
int AppSettings::getParity()
{
return getValue("serial/parity").toInt();
}
void AppSettings::setParity(const int &arg)
{
setValue("serial/parity", arg);
}
int AppSettings::getDataBits()
{
return getValue("serial/databits").toInt();
}
void AppSettings::setDataBits(const int &arg)
{
setValue("serial/databits", arg);
}
int AppSettings::getStopBits()
{
return getValue("serial/stopbits").toInt();
}
void AppSettings::setStopBits(const int &arg)
{
setValue("serial/stopbits", arg);
}
int AppSettings::getFlowControl()
{
return getValue("serial/flowcontrol").toInt();
}
void AppSettings::setFlowControl(const int &arg)
{
setValue("serial/flowcontrol", arg);
}
int AppSettings::getECU()
{
return getValue("serial/ECU").toInt();
}
void AppSettings::setECU(const int &arg)
{
setValue("serial/ECU", arg);
}
int AppSettings::getInterface()
{
return getValue("serial/Interface").toInt();
}
void AppSettings::setInterface(const int &arg)
{
setValue("serial/Interface", arg);
}
int AppSettings::getLogging()
{
return getValue("serial/Logging").toInt();
}
void AppSettings::setLogging(const int &arg)
{
setValue("serial/Logging", arg);
}
void AppSettings::setValue(const QString &key, const QVariant &value)
{
QSettings settings("PowerTuneQML", "PowerTuneQMLGUI", this);
settings.setValue(key, value);
}
QVariant AppSettings::getValue(const QString &key)
{
QSettings settings("PowerTuneQML", "PowerTuneQMLGUI", this);
return settings.value(key);
}