mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
mobile: add qmlprefs class
add class to cmake and pro register class Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
parent
54db1309a0
commit
d0e9f62624
6 changed files with 55 additions and 0 deletions
|
@ -285,6 +285,7 @@ endif()
|
||||||
if(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "MobileExecutable")
|
if(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "MobileExecutable")
|
||||||
set(MOBILE_SRC
|
set(MOBILE_SRC
|
||||||
mobile-widgets/qmlmanager.cpp
|
mobile-widgets/qmlmanager.cpp
|
||||||
|
mobile-widgets/qmlprefs.cpp
|
||||||
mobile-widgets/qml/kirigami/src/kirigamiplugin.cpp
|
mobile-widgets/qml/kirigami/src/kirigamiplugin.cpp
|
||||||
mobile-widgets/qml/kirigami/src/settings.cpp
|
mobile-widgets/qml/kirigami/src/settings.cpp
|
||||||
mobile-widgets/qml/kirigami/src/enums.cpp
|
mobile-widgets/qml/kirigami/src/enums.cpp
|
||||||
|
|
|
@ -492,6 +492,10 @@ if you have network connectivity and want to sync your data to cloud storage."),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QMLPrefs {
|
||||||
|
id: prefs
|
||||||
|
}
|
||||||
|
|
||||||
QMLManager {
|
QMLManager {
|
||||||
id: manager
|
id: manager
|
||||||
}
|
}
|
||||||
|
|
21
mobile-widgets/qmlprefs.cpp
Normal file
21
mobile-widgets/qmlprefs.cpp
Normal file
|
@ -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;
|
||||||
|
}
|
25
mobile-widgets/qmlprefs.h
Normal file
25
mobile-widgets/qmlprefs.h
Normal file
|
@ -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
|
|
@ -81,6 +81,7 @@ SOURCES += ../../subsurface-mobile-main.cpp \
|
||||||
../../core/subsurface-qt/DiveObjectHelper.cpp \
|
../../core/subsurface-qt/DiveObjectHelper.cpp \
|
||||||
../../core/subsurface-qt/SettingsObjectWrapper.cpp \
|
../../core/subsurface-qt/SettingsObjectWrapper.cpp \
|
||||||
../../mobile-widgets/qmlmanager.cpp \
|
../../mobile-widgets/qmlmanager.cpp \
|
||||||
|
../../mobile-widgets/qmlprefs.cpp \
|
||||||
../../qt-models/divelistmodel.cpp \
|
../../qt-models/divelistmodel.cpp \
|
||||||
../../qt-models/diveplotdatamodel.cpp \
|
../../qt-models/diveplotdatamodel.cpp \
|
||||||
../../qt-models/gpslistmodel.cpp \
|
../../qt-models/gpslistmodel.cpp \
|
||||||
|
@ -183,6 +184,7 @@ HEADERS += \
|
||||||
../../core/subsurface-qt/DiveObjectHelper.h \
|
../../core/subsurface-qt/DiveObjectHelper.h \
|
||||||
../../core/subsurface-qt/SettingsObjectWrapper.h \
|
../../core/subsurface-qt/SettingsObjectWrapper.h \
|
||||||
../../mobile-widgets/qmlmanager.h \
|
../../mobile-widgets/qmlmanager.h \
|
||||||
|
../../mobile-widgets/qmlprefs.h \
|
||||||
../../map-widget/qmlmapwidgethelper.h \
|
../../map-widget/qmlmapwidgethelper.h \
|
||||||
../../qt-models/divelistmodel.h \
|
../../qt-models/divelistmodel.h \
|
||||||
../../qt-models/diveplotdatamodel.h \
|
../../qt-models/diveplotdatamodel.h \
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
#include "mobile-widgets/qmlmanager.h"
|
#include "mobile-widgets/qmlmanager.h"
|
||||||
|
#include "mobile-widgets/qmlprefs.h"
|
||||||
#include "qt-models/divelistmodel.h"
|
#include "qt-models/divelistmodel.h"
|
||||||
#include "qt-models/gpslistmodel.h"
|
#include "qt-models/gpslistmodel.h"
|
||||||
#include "profile-widget/qmlprofile.h"
|
#include "profile-widget/qmlprofile.h"
|
||||||
|
@ -55,6 +56,7 @@ void run_ui()
|
||||||
{
|
{
|
||||||
LOG_STP("run_ui starting");
|
LOG_STP("run_ui starting");
|
||||||
qmlRegisterType<QMLManager>("org.subsurfacedivelog.mobile", 1, 0, "QMLManager");
|
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<QMLProfile>("org.subsurfacedivelog.mobile", 1, 0, "QMLProfile");
|
||||||
|
|
||||||
qmlRegisterType<DownloadThread>("org.subsurfacedivelog.mobile", 1, 0, "DCDownloadThread");
|
qmlRegisterType<DownloadThread>("org.subsurfacedivelog.mobile", 1, 0, "DCDownloadThread");
|
||||||
|
|
Loading…
Reference in a new issue