-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.cpp
More file actions
64 lines (53 loc) · 1.86 KB
/
settings.cpp
File metadata and controls
64 lines (53 loc) · 1.86 KB
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
#include "settings.h"
#include <QDebug>
Settings::Settings(QObject* parent) :
QSettings(parent)
{
// qDebug() << "Config loaded: " << QSettings::fileName();
}
Settings::~Settings()
{}
QVariant Settings::get(const QString &key, const QVariant &def = QVariant())
{
return QSettings::value(key, def);
}
qreal Settings::getNumber(const QString &key, const QVariant &def)
{
return get(key, def).toReal();
}
bool Settings::getBool(const QString &key, const QVariant &def)
{
return get(key, def).toBool();
}
void Settings::initDefaults()
{
checkAndSet("base/ignored_applications_regex", "(compton|picom|x11vnc|electron|openjdk|lstop|mpv|stoken-gui|cmake-gui|qvidcap|qv4l2|avahi-discover|bssh|bvnc)");
checkAndSet("base/terminal", "i3-sensible-terminal");
checkAndSet("base/show_terminal_apps", false);
checkAndSet("base/default_icon", "application-x-executable");
checkAndSet("base/binary_icon", "application-x-executable");
checkAndSet("background/bgcolor", "#000000");
checkAndSet("background/topmargin", 32);
checkAndSet("icons/selectcolor", "#2d75af");
checkAndSet("icons/textcolor", "#ffffff");
checkAndSet("icons/padding", 32);
checkAndSet("icons/cols", 8);
checkAndSet("icons/rows", 8);
checkAndSet("icons/width", 64);
checkAndSet("icons/height", 64);
checkAndSet("icons/topmargin", 8);
checkAndSet("icons/bottommargin", 8);
checkAndSet("input/height", 32);
checkAndSet("input/bgcolor", "#ffffff");
checkAndSet("input/textcolor", "#000000");
checkAndSet("input/fontsize", 24);
checkAndSet("input/fontbold", true);
checkAndSet("input/bordercolor", "#6795cc");
checkAndSet("input/borderwidth", 2);
checkAndSet("input/borderradius", 8);
}
void Settings::checkAndSet(const QString &key, const QVariant &val)
{
if (!QSettings::contains(key))
QSettings::setValue(key, val);
}