From 52f156ee4731c8f230fa31f96610dd2bf03530e1 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 30 Aug 2024 21:19:27 -0700 Subject: [PATCH] WIP-dont-use Signed-off-by: Dirk Hohndel --- Subsurface-mobile.pro | 2 +- mobile-widgets/CMakeLists.txt | 6 +++--- mobile-widgets/qml/DiveList.qml | 8 ++++---- mobile-widgets/qml/Export.qml | 6 +++--- mobile-widgets/qml/Settings.qml | 4 ++-- mobile-widgets/qml/StatisticsPage.qml | 2 +- mobile-widgets/qml/main.qml | 6 +++--- mobile-widgets/qmlmanager.h | 2 ++ subsurface-helper.cpp | 7 +++++-- 9 files changed, 24 insertions(+), 19 deletions(-) diff --git a/Subsurface-mobile.pro b/Subsurface-mobile.pro index 88e1d3ae2..4c26b694c 100644 --- a/Subsurface-mobile.pro +++ b/Subsurface-mobile.pro @@ -375,7 +375,7 @@ android { ../install-root-$${QT_ARCH}/lib/libzip.a \ ../install-root-$${QT_ARCH}/lib/libxslt.a \ ../install-root-$${QT_ARCH}/lib/libxml2.a \ - ../install-root-$${QT_ARCH}/lib/libsqlite3.a \ + ../install-root-$${QT_ARCH}/lib/libsqliteX.so \ ../install-root-$${QT_ARCH}/lib/libssl_1_1.so \ ../install-root-$${QT_ARCH}/lib/libcrypto_1_1.so \ ../googlemaps-build/libplugins_geoservices_qtgeoservices_googlemaps_$${QT_ARCH}.so diff --git a/mobile-widgets/CMakeLists.txt b/mobile-widgets/CMakeLists.txt index b02929bcb..bc4e9ded3 100644 --- a/mobile-widgets/CMakeLists.txt +++ b/mobile-widgets/CMakeLists.txt @@ -2,12 +2,12 @@ set(SUBSURFACE_MOBILE_SRCS qmlinterface.cpp - qmlmanager.cpp + qmlmanager.cpp statsmanager.cpp themeinterface.cpp ) if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable") - add_library(subsurface_mobile STATIC ${SUBSURFACE_MOBILE_SRCS}) - target_link_libraries(subsurface_mobile ${QT_LIBRARIES}) + add_library(subsurface_mobile STATIC ${SUBSURFACE_MOBILE_SRCS}) + target_link_libraries(subsurface_mobile ${QT_LIBRARIES}) endif() diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml index ada27d064..b2ec7486e 100644 --- a/mobile-widgets/qml/DiveList.qml +++ b/mobile-widgets/qml/DiveList.qml @@ -38,7 +38,7 @@ Kirigami.ScrollablePage { Component { id: diveOrTripDelegate - Kirigami.AbstractListItem { + Controls.ItemDelegate { // this allows us to access properties of the currentItem from outside property variant myData: model property var view: ListView.view @@ -46,7 +46,7 @@ Kirigami.ScrollablePage { property bool invalid: isInvalid === true id: diveOrTripDelegateItem padding: 0 - supportsMouseEvents: true + //supportsMouseEvents: true anchors { left: parent ? parent.left : undefined right: parent ? parent.right : undefined @@ -458,7 +458,7 @@ Kirigami.ScrollablePage { icon { name: ":/icons/list-add" } - color: subsurfaceTheme.textColor + //color: subsurfaceTheme.textColor text: qsTr("Add dive") onTriggered: { startAddDive() @@ -469,7 +469,7 @@ Kirigami.ScrollablePage { icon { name: ":icons/ic_filter_list" } - color: subsurfaceTheme.textColor + //color: subsurfaceTheme.textColor text: qsTr("Filter dives") onTriggered: { rootItem.filterToggle = !rootItem.filterToggle diff --git a/mobile-widgets/qml/Export.qml b/mobile-widgets/qml/Export.qml index a42c45da7..66b9243a4 100644 --- a/mobile-widgets/qml/Export.qml +++ b/mobile-widgets/qml/Export.qml @@ -12,10 +12,10 @@ TemplatePage { property int selectedExport: ExportType.EX_DIVES_XML - FileDialog { + FolderDialog { id: saveAsDialog - folder: shortcuts.documents - selectFolder: true + currentFolder: shortcuts.documents + //selectFolder: true onAccepted: { manager.exportToFile(selectedExport, fileUrls, anonymize.checked) pageStack.pop() diff --git a/mobile-widgets/qml/Settings.qml b/mobile-widgets/qml/Settings.qml index 230402930..ac0076536 100644 --- a/mobile-widgets/qml/Settings.qml +++ b/mobile-widgets/qml/Settings.qml @@ -645,7 +645,7 @@ TemplatePage { to: 150 stepSize: 1 value: PrefTechnicalDetails.gflow - validator: RegExpValidator { regExp: /1?\d{0,2}%?/ } + validator: RegularExpressionValidator { regularExpression: /1?\d{0,2}%?/ } textFromValue: function (value, locale) { return value + "%" } @@ -679,7 +679,7 @@ TemplatePage { to: 150 stepSize: 1 value: PrefTechnicalDetails.gfhigh - validator: RegExpValidator { regExp: /1?\d{0,2}%?/ } + validator: RegularExpressionValidator { regularExpression: /1?\d{0,2}%?/ } textFromValue: function (value, locale) { return value + "%" } diff --git a/mobile-widgets/qml/StatisticsPage.qml b/mobile-widgets/qml/StatisticsPage.qml index ae6b34373..6588e6353 100644 --- a/mobile-widgets/qml/StatisticsPage.qml +++ b/mobile-widgets/qml/StatisticsPage.qml @@ -47,7 +47,7 @@ Kirigami.Page { Component { id: chartListDelegate - Kirigami.AbstractListItem { + Controls.ItemDelegate { id: chartListDelegateItem height: isHeader ? 1 + 8 * Kirigami.Units.smallSpacing : 11 * Kirigami.Units.smallSpacing // delegateInnerItem.height onClicked: { diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index 52a532db6..de81e8b70 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -735,9 +735,9 @@ if you have network connectivity and want to sync your data to cloud storage."), } } - QMLManager { - id: manager - } +// QMLManager { +// id: manager +// } property bool initialized: manager.initialized diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h index 9a24b5399..bbd65fdd1 100644 --- a/mobile-widgets/qmlmanager.h +++ b/mobile-widgets/qmlmanager.h @@ -10,6 +10,7 @@ #include #include #include +#include #include "core/btdiscovery.h" #include "core/downloadfromdcthread.h" @@ -29,6 +30,7 @@ struct DiveSiteChange; // An obscure implementation artifact - remove in due cou class QMLManager : public QObject { Q_OBJECT + QML_ELEMENT Q_PROPERTY(bool loadFromCloud MEMBER m_loadFromCloud WRITE setLoadFromCloud NOTIFY loadFromCloudChanged) Q_PROPERTY(QString startPageText MEMBER m_startPageText WRITE setStartPageText NOTIFY startPageTextChanged) Q_PROPERTY(bool verboseEnabled MEMBER m_verboseEnabled WRITE setVerboseEnabled NOTIFY verboseEnabledChanged) diff --git a/subsurface-helper.cpp b/subsurface-helper.cpp index b881cab37..857377400 100644 --- a/subsurface-helper.cpp +++ b/subsurface-helper.cpp @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include #include +#include #ifdef MAP_SUPPORT #include "map-widget/qmlmapwidgethelper.h" @@ -97,6 +98,9 @@ void run_mobile_ui(double initial_font_size) #endif QScreen *appScreen = QApplication::screens().at(0); int availableScreenWidth = appScreen->availableSize().width(); + + QScopedPointer qmlmanager(new QMLManager); + QQmlApplicationEngine engine; QQmlContext *ctxt = engine.rootContext(); @@ -121,6 +125,7 @@ void run_mobile_ui(double initial_font_size) ctxt->setContextProperty("vendorList", vendorList); ctxt->setContextProperty("swipeModel", MobileModels::instance()->swipeModel()); ctxt->setContextProperty("diveModel", MobileModels::instance()->listModel()); + ctxt->setContextProperty("manager", qmlmanager->instance()); set_non_bt_addresses(); // we need to setup the initial font size before the QML UI is instantiated @@ -131,8 +136,6 @@ void run_mobile_ui(double initial_font_size) ctxt->setContextProperty("logModel", MessageHandlerModel::self()); ctxt->setContextProperty("subsurfaceTheme", themeInterface); - qmlRegisterUncreatableType("org.subsurfacedivelog.mobile",1,0,"ExportType","Enum is not a type"); - #ifdef SUBSURFACE_MOBILE_DESKTOP if (!testqml.empty()) { QString fileLoad(testqml.c_str());