diff options
-rw-r--r-- | bootstrap.cxx | 12 | ||||
-rw-r--r-- | bootstrap.pro | 1 |
2 files changed, 11 insertions, 2 deletions
diff --git a/bootstrap.cxx b/bootstrap.cxx index 6f01ab1..433ccfd 100644 --- a/bootstrap.cxx +++ b/bootstrap.cxx @@ -1,15 +1,23 @@ +#include <toml.h> #include "bootstrap.hxx" Bootstrap::Bootstrap(QObject *parent): QObject(parent), + bs_mode(LightMode), bs_theme(None), bs_lightBodyBg("#fff"), bs_darkBodyBg("#212529") { QFile conf{QStringLiteral(":/qtquickcontrols2.conf")}; - conf.open(QFile::ReadOnly | QFile::Text); - qDebug() << conf.readAll(); + if (!conf.open(QIODevice::ReadOnly | QIODevice::Text)) return; + auto toml = toml_parse(conf.readAll().data(), nullptr, 0); conf.close(); + auto bootstrap = toml_table_in(toml, "Bootstrap"); + if (bootstrap) { + auto mode = toml_int_in(bootstrap, "Mode"); + if (mode.ok) bs_mode = static_cast<Mode>(mode.u.i); + } + toml_free(toml); } Bootstrap *Bootstrap::qmlAttachedProperties(QObject *object) diff --git a/bootstrap.pro b/bootstrap.pro index d5cf36e..e9fa9f7 100644 --- a/bootstrap.pro +++ b/bootstrap.pro @@ -17,6 +17,7 @@ style.path = $$[QT_INSTALL_QML]/QtQuick/Controls.2/$$QML_IMPORT_NAME HEADERS += $${TARGET}.hxx SOURCES += $${TARGET}.cxx +LIBS += -ltoml TARGET = qqc2$$TARGET target.path = $$[QT_INSTALL_QML]/$$QML_IMPORT_NAME |