-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppSettings.cpp
More file actions
33 lines (29 loc) · 892 Bytes
/
Copy pathAppSettings.cpp
File metadata and controls
33 lines (29 loc) · 892 Bytes
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
#include "AppSettings.h"
#include <QSettings>
AppSettings::AppSettings(QObject* parent) : QObject(parent) {
QSettings s;
m_showSolarRadiation = s.value("showSolarRadiation", true).toBool();
m_darkMode = s.value("darkMode", true).toBool();
m_maxCards = s.value("maxCards", 4).toInt();
}
void AppSettings::setShowSolarRadiation(bool show) {
if (m_showSolarRadiation == show) return;
m_showSolarRadiation = show;
QSettings s;
s.setValue("showSolarRadiation", show);
emit showSolarRadiationChanged();
}
void AppSettings::setDarkMode(bool dark) {
if (m_darkMode == dark) return;
m_darkMode = dark;
QSettings s;
s.setValue("darkMode", dark);
emit darkModeChanged();
}
void AppSettings::setMaxCards(int n) {
if (m_maxCards == n) return;
m_maxCards = n;
QSettings s;
s.setValue("maxCards", n);
emit maxCardsChanged();
}