summaryrefslogtreecommitdiff
path: root/bootstrap.cxx
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-04-06 08:24:59 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-04-06 08:24:59 +0800
commit76a00c3d08d582422b5b0b9b38880218054f6e93 (patch)
tree90586eb1b5160eef930b43b83311e10721df17f0 /bootstrap.cxx
parenta0096545d2bffc622167d3164c328af8308cc93b (diff)
Bootstrap is an attached property
Diffstat (limited to 'bootstrap.cxx')
-rw-r--r--bootstrap.cxx51
1 files changed, 43 insertions, 8 deletions
diff --git a/bootstrap.cxx b/bootstrap.cxx
index bf9a499..7a03b8f 100644
--- a/bootstrap.cxx
+++ b/bootstrap.cxx
@@ -1,8 +1,11 @@
#include "bootstrap.hxx"
Bootstrap::Bootstrap(QObject *parent):
- QQmlEngineExtensionPlugin(parent),
- m_purpose(None)
+ QObject(parent),
+ bs_mode(LightMode),
+ bs_theme(None),
+ bs_lightBodyBg("#fff"),
+ bs_darkBodyBg("#212529")
{
}
@@ -11,14 +14,46 @@ Bootstrap *Bootstrap::qmlAttachedProperties(QObject *object)
return new Bootstrap(object);
}
-Bootstrap::Purpose Bootstrap::purpose() const
+Bootstrap::Mode Bootstrap::mode() const
{
- return m_purpose;
+ return bs_mode;
}
-void Bootstrap::setPurpose(Purpose purpose)
+void Bootstrap::setMode(Mode mode)
{
- if (purpose == m_purpose) return;
- m_purpose = purpose;
- emit purposeChanged();
+ 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();
}