-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.cpp
45 lines (36 loc) · 882 Bytes
/
settings.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
#include "settings.h"
Settings *Settings::instance = 0;
Settings::Settings(QObject *parent) : QObject(parent), settings()
{
}
Settings *Settings::getInstance()
{
if (Settings::instance == NULL) {
Settings::instance = new Settings();
}
return Settings::instance;
}
void Settings::setHostname(QString value)
{
if(getHostname() != value) {
settings.setValue("hostname", value);
emit hostnameChanged();
//qDebug() << "setHostname: " << value;
}
}
QString Settings::getHostname()
{
//qDebug() << "getHostname";
return settings.value("hostname", "http://mete").toString();
}
void Settings::setUserId(QString value)
{
if(getUserId() != value) {
settings.setValue("userId", value);
emit userIdChanged();
}
}
QString Settings::getUserId()
{
return settings.value("userId", "-99").toString();
}