summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--mobile-widgets/qml/main.qml4
-rw-r--r--mobile-widgets/qmlprefs.cpp21
-rw-r--r--mobile-widgets/qmlprefs.h25
-rw-r--r--packaging/ios/Subsurface-mobile.pro2
-rw-r--r--subsurface-mobile-helper.cpp2
6 files changed, 55 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7b90f8318..75e2b0b9f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -285,6 +285,7 @@ endif()
if(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "MobileExecutable")
set(MOBILE_SRC
mobile-widgets/qmlmanager.cpp
+ mobile-widgets/qmlprefs.cpp
mobile-widgets/qml/kirigami/src/kirigamiplugin.cpp
mobile-widgets/qml/kirigami/src/settings.cpp
mobile-widgets/qml/kirigami/src/enums.cpp
diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml
index bd567894e..28f16a9b8 100644
--- a/mobile-widgets/qml/main.qml
+++ b/mobile-widgets/qml/main.qml
@@ -492,6 +492,10 @@ if you have network connectivity and want to sync your data to cloud storage."),
}
}
+ QMLPrefs {
+ id: prefs
+ }
+
QMLManager {
id: manager
}
diff --git a/mobile-widgets/qmlprefs.cpp b/mobile-widgets/qmlprefs.cpp
new file mode 100644
index 000000000..49a788708
--- /dev/null
+++ b/mobile-widgets/qmlprefs.cpp
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "qmlprefs.h"
+
+QMLPrefs *QMLPrefs::m_instance = NULL;
+
+
+QMLPrefs::QMLPrefs()
+{
+ if (!m_instance)
+ m_instance = this;
+}
+
+QMLPrefs::~QMLPrefs()
+{
+ m_instance = NULL;
+}
+
+QMLPrefs *QMLPrefs::instance()
+{
+ return m_instance;
+}
diff --git a/mobile-widgets/qmlprefs.h b/mobile-widgets/qmlprefs.h
new file mode 100644
index 000000000..2755014e8
--- /dev/null
+++ b/mobile-widgets/qmlprefs.h
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0
+#ifndef QMLPREFS_H
+#define QMLPREFS_H
+
+#include <QObject>
+
+
+class QMLPrefs : public QObject {
+ Q_OBJECT
+
+public:
+ QMLPrefs();
+ ~QMLPrefs();
+
+ static QMLPrefs *instance();
+
+public slots:
+
+private:
+ static QMLPrefs *m_instance;
+
+signals:
+};
+
+#endif
diff --git a/packaging/ios/Subsurface-mobile.pro b/packaging/ios/Subsurface-mobile.pro
index 911557399..45f1501e4 100644
--- a/packaging/ios/Subsurface-mobile.pro
+++ b/packaging/ios/Subsurface-mobile.pro
@@ -81,6 +81,7 @@ SOURCES += ../../subsurface-mobile-main.cpp \
../../core/subsurface-qt/DiveObjectHelper.cpp \
../../core/subsurface-qt/SettingsObjectWrapper.cpp \
../../mobile-widgets/qmlmanager.cpp \
+ ../../mobile-widgets/qmlprefs.cpp \
../../qt-models/divelistmodel.cpp \
../../qt-models/diveplotdatamodel.cpp \
../../qt-models/gpslistmodel.cpp \
@@ -183,6 +184,7 @@ HEADERS += \
../../core/subsurface-qt/DiveObjectHelper.h \
../../core/subsurface-qt/SettingsObjectWrapper.h \
../../mobile-widgets/qmlmanager.h \
+ ../../mobile-widgets/qmlprefs.h \
../../map-widget/qmlmapwidgethelper.h \
../../qt-models/divelistmodel.h \
../../qt-models/diveplotdatamodel.h \
diff --git a/subsurface-mobile-helper.cpp b/subsurface-mobile-helper.cpp
index a36b75c60..6fcdb1191 100644
--- a/subsurface-mobile-helper.cpp
+++ b/subsurface-mobile-helper.cpp
@@ -17,6 +17,7 @@
#include <QQmlContext>
#include <QSortFilterProxyModel>
#include "mobile-widgets/qmlmanager.h"
+#include "mobile-widgets/qmlprefs.h"
#include "qt-models/divelistmodel.h"
#include "qt-models/gpslistmodel.h"
#include "profile-widget/qmlprofile.h"
@@ -55,6 +56,7 @@ void run_ui()
{
LOG_STP("run_ui starting");
qmlRegisterType<QMLManager>("org.subsurfacedivelog.mobile", 1, 0, "QMLManager");
+ qmlRegisterType<QMLPrefs>("org.subsurfacedivelog.mobile", 1, 0, "QMLPrefs");
qmlRegisterType<QMLProfile>("org.subsurfacedivelog.mobile", 1, 0, "QMLProfile");
qmlRegisterType<DownloadThread>("org.subsurfacedivelog.mobile", 1, 0, "DCDownloadThread");