summaryrefslogtreecommitdiff
path: root/bootstrap.cxx
blob: 7a03b8fdaa3c313fe1ccf66d32fd67eaa6200c6b (plain)
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
#include "bootstrap.hxx"

Bootstrap::Bootstrap(QObject *parent):
	QObject(parent),
	bs_mode(LightMode),
	bs_theme(None),
	bs_lightBodyBg("#fff"),
	bs_darkBodyBg("#212529")
{
}

Bootstrap *Bootstrap::qmlAttachedProperties(QObject *object)
{
	return new Bootstrap(object);
}

Bootstrap::Mode Bootstrap::mode() const
{
	return bs_mode;
}

void Bootstrap::setMode(Mode mode)
{
	if (mode == bs_mode) return;
	bs_mode = mode;
	emit modeChanged();
	emit bodyBgChanged();
}

Bootstrap::Theme Bootstrap::theme() const
{
	return bs_theme;
}

void Bootstrap::setTheme(Theme theme)
{
	if (theme == bs_theme) return;
	bs_theme = theme;
	emit themeChanged();
}

QColor Bootstrap::bodyBg() const
{
	return bs_mode ? bs_darkBodyBg : bs_lightBodyBg;
}

void Bootstrap::setLightBodyBg(QColor lightBodyBg)
{
	if (lightBodyBg == bs_lightBodyBg) return;
	bs_lightBodyBg = lightBodyBg;
	emit bodyBgChanged();
}

void Bootstrap::setDarkBodyBg(QColor darkBodyBg)
{
	if (darkBodyBg == bs_darkBodyBg) return;
	bs_darkBodyBg = darkBodyBg;
	emit bodyBgChanged();
}