summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-04-04 19:38:06 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-04-04 19:38:06 +0800
commit77a4d6f3ca3a506f24a64262f09456058247b1bb (patch)
tree1ab1c10f1eb739712fb12845e99df645999f5c46
Initial commit, draft that compiles
-rw-r--r--.gitignore5
-rw-r--r--bootstrap.cxx37
-rw-r--r--bootstrap.hxx54
-rw-r--r--bootstrap.pro13
-rw-r--r--qmldir4
-rw-r--r--qtquickcontrols2bootstrapstyleplugin_metatypes.json1
6 files changed, 114 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1076a67
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*~
+*.swp
+*.user*
+.DS_Store
+build
diff --git a/bootstrap.cxx b/bootstrap.cxx
new file mode 100644
index 0000000..22ba9cd
--- /dev/null
+++ b/bootstrap.cxx
@@ -0,0 +1,37 @@
+#include "bootstrap.hxx"
+
+Bootstrap::Bootstrap(QObject *parent):
+ QObject(parent),
+ m_theme(Theme::Light),
+ m_purpose(Purpose::None)
+{
+}
+
+Bootstrap *Bootstrap::qmlAttachedProperties(QObject *object)
+{
+ return new Bootstrap(object);
+}
+
+Bootstrap::Theme Bootstrap::theme() const
+{
+ return m_theme;
+}
+
+void Bootstrap::setTheme(Bootstrap::Theme theme)
+{
+ if (theme == m_theme) return;
+ m_theme = theme;
+ emit themeChanged();
+}
+
+Bootstrap::Purpose Bootstrap::purpose() const
+{
+ return m_purpose;
+}
+
+void Bootstrap::setPurpose(Bootstrap::Purpose purpose)
+{
+ if (purpose == m_purpose) return;
+ m_purpose = purpose;
+ emit purposeChanged();
+}
diff --git a/bootstrap.hxx b/bootstrap.hxx
new file mode 100644
index 0000000..a0eccc3
--- /dev/null
+++ b/bootstrap.hxx
@@ -0,0 +1,54 @@
+#ifndef BOOTSTRAP_HXX
+#define BOOTSTRAP_HXX
+
+#include <QObject>
+#include <QtQml>
+
+class Bootstrap : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(Theme theme READ theme WRITE setTheme NOTIFY themeChanged)
+ Q_PROPERTY(Purpose purpose READ purpose WRITE setPurpose NOTIFY purposeChanged)
+
+ public:
+ explicit Bootstrap(QObject *parent = nullptr);
+ static Bootstrap *qmlAttachedProperties(QObject *object);
+
+ enum class Theme {
+ Light,
+ Dark
+ };
+
+ enum class Purpose {
+ None,
+ Primary,
+ Secondary,
+ Success,
+ Danger,
+ Warning,
+ Info,
+ Light,
+ Dark,
+ Link
+ };
+
+ Q_ENUM(Theme)
+ Q_ENUM(Purpose)
+
+ Theme theme() const;
+ void setTheme(Theme theme);
+ Purpose purpose() const;
+ void setPurpose(Purpose purpose);
+
+ signals:
+ void themeChanged();
+ void purposeChanged();
+
+ private:
+ Theme m_theme;
+ Purpose m_purpose;
+};
+
+QML_DECLARE_TYPEINFO(Bootstrap, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif
diff --git a/bootstrap.pro b/bootstrap.pro
new file mode 100644
index 0000000..cdf6b18
--- /dev/null
+++ b/bootstrap.pro
@@ -0,0 +1,13 @@
+TEMPLATE = lib
+CONFIG += qt plugin qmltypes
+QT += qml
+
+QML_IMPORT_NAME = Bootstrap
+QML_IMPORT_MAJOR_VERSION = 5
+QML_IMPORT_MINOR_VERSION = 3
+
+DESTDIR = imports/$$QML_IMPORT_NAME
+TARGET = qtquickcontrols2bootstrapstyleplugin
+
+HEADERS += bootstrap.hxx
+SOURCES += bootstrap.cxx
diff --git a/qmldir b/qmldir
new file mode 100644
index 0000000..4cea71c
--- /dev/null
+++ b/qmldir
@@ -0,0 +1,4 @@
+module QtQuick.Controls.Bootstrap
+plugin qtquickcontrols2bootstrapstyleplugin
+classname QtQuickControls2BootstrapStylePlugin
+depends QtQuick.Controls 2.5
diff --git a/qtquickcontrols2bootstrapstyleplugin_metatypes.json b/qtquickcontrols2bootstrapstyleplugin_metatypes.json
new file mode 100644
index 0000000..61840ed
--- /dev/null
+++ b/qtquickcontrols2bootstrapstyleplugin_metatypes.json
@@ -0,0 +1 @@
+{ "Keys" : [ "bootstrapstyleplugin" ] }