aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mobile-widgets/themeinterface.cpp9
-rw-r--r--mobile-widgets/themeinterface.h3
-rw-r--r--subsurface-helper.cpp6
3 files changed, 10 insertions, 8 deletions
diff --git a/mobile-widgets/themeinterface.cpp b/mobile-widgets/themeinterface.cpp
index 9f2e842ee..2d87a9d29 100644
--- a/mobile-widgets/themeinterface.cpp
+++ b/mobile-widgets/themeinterface.cpp
@@ -8,11 +8,14 @@ themeInterface *themeInterface::instance()
return self;
}
-void themeInterface::setup()
+void themeInterface::setup(QQmlContext *ct)
{
+ // Register interface class
+ ct->setContextProperty("ThemeNew", instance());
+
// get current theme
- m_currentTheme = qPrefDisplay::theme();
- update_theme();
+ instance()->m_currentTheme = qPrefDisplay::theme();
+ instance()->update_theme();
}
void themeInterface::set_currentTheme(const QString &theme)
diff --git a/mobile-widgets/themeinterface.h b/mobile-widgets/themeinterface.h
index 9e135538c..cb89c40fd 100644
--- a/mobile-widgets/themeinterface.h
+++ b/mobile-widgets/themeinterface.h
@@ -4,6 +4,7 @@
#include <QObject>
#include <QColor>
#include <QSettings>
+#include <QQmlContext>
class themeInterface : public QObject {
Q_OBJECT
@@ -69,7 +70,7 @@ class themeInterface : public QObject {
public:
static themeInterface *instance();
- void setup();
+ static void setup(QQmlContext *ct);
public slots:
void set_currentTheme(const QString &theme);
diff --git a/subsurface-helper.cpp b/subsurface-helper.cpp
index 5d1a84fae..9ae89561f 100644
--- a/subsurface-helper.cpp
+++ b/subsurface-helper.cpp
@@ -187,11 +187,9 @@ void register_qml_types(QQmlEngine *engine)
if (engine != NULL) {
QQmlContext *ct = engine->rootContext();
- // Register qml interface class
+ // Register qml interface classes
QMLInterface::setup(ct);
-
- themeInterface::instance()->setup();
- ct->setContextProperty("ThemeNew", themeInterface::instance());
+ themeInterface::setup(ct);
}
REGISTER_TYPE(QMLManager, "QMLManager");