From 96d7da1ecde70d2fe45cada956f674906b9a3f10 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Sat, 18 Jan 2025 10:08:23 +0700 Subject: [PATCH 1/6] Re-add settings in the main menu by popular demand --- src/qml/qgismobileapp.qml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/qml/qgismobileapp.qml b/src/qml/qgismobileapp.qml index 69fd659c51..def7fd062d 100644 --- a/src/qml/qgismobileapp.qml +++ b/src/qml/qgismobileapp.qml @@ -2534,11 +2534,15 @@ ApplicationWindow { } } + MenuSeparator { + width: parent.width + } + MenuItem { - text: qsTr("Variables") + text: qsTr("Settings") font: Theme.defaultFont - icon.source: Theme.getThemeVectorIcon("ic_expression_black_24dp") + icon.source: Theme.getThemeVectorIcon("ic_tune_white_24dp") height: 48 leftPadding: Theme.menuItemLeftPadding @@ -2546,7 +2550,6 @@ ApplicationWindow { dashBoard.close(); qfieldSettings.reset(); qfieldSettings.visible = true; - qfieldSettings.currentPanel = 2; highlighted = false; } } @@ -2566,10 +2569,6 @@ ApplicationWindow { } } - MenuSeparator { - width: parent.width - } - MenuItem { text: qsTr("Lock Screen") @@ -2585,6 +2584,10 @@ ApplicationWindow { } } + MenuSeparator { + width: parent.width + } + MenuItem { text: qsTr("About QField") From 5a0d9597b1688052c27bb8510faa7be48e1136f7 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Sat, 18 Jan 2025 10:28:10 +0700 Subject: [PATCH 2/6] Insure that the main menu's undo / redo buttons never have their labels cropped when space is available --- src/qml/qgismobileapp.qml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/qml/qgismobileapp.qml b/src/qml/qgismobileapp.qml index def7fd062d..d995c8ca64 100644 --- a/src/qml/qgismobileapp.qml +++ b/src/qml/qgismobileapp.qml @@ -2412,7 +2412,7 @@ ApplicationWindow { bottomMargin: sceneBottomMargin width: { - let result = 50; + let result = Math.max(50, undoRedoMetrics.width + undoButton.leftPadding * 2 + undoButton.rightPadding * 2 + 42 * 2); let padding = 0; // Skip first Row item for (let i = 1; i < count; ++i) { @@ -2423,6 +2423,12 @@ ApplicationWindow { return mainWindow.width > 0 ? Math.min(result + padding, mainWindow.width - 20) : result + padding; } + TextMetrics { + id: undoRedoMetrics + font: undoButton.font + text: undoButton.text + redoButton.text + } + Item { width: mainMenu.width height: 48 @@ -2453,7 +2459,7 @@ ApplicationWindow { MenuSeparator { width: 1 height: parent.height - anchors.left: undoButton.right + anchors.right: redoButton.left } MenuItem { @@ -2466,15 +2472,14 @@ ApplicationWindow { icon.source: Theme.getThemeVectorIcon("ic_redo_black_24dp") contentItem: IconLabel { - leftPadding: 22 + leftPadding: undoButton.leftPadding spacing: redoButton.spacing mirrored: true display: redoButton.display icon: redoButton.icon text: redoButton.text font: redoButton.font - color: Theme.mainTextColor - opacity: redoButton.enabled ? 1 : .35 + color: redoButton.enabled ? redoButton.Material.foreground : redoButton.Material.hintTextColor } onClicked: { From 09208677160416ca541f82aec05e3951dc838db4 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Sat, 18 Jan 2025 10:30:08 +0700 Subject: [PATCH 3/6] Add an object name for the screen locker --- src/qml/qgismobileapp.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qml/qgismobileapp.qml b/src/qml/qgismobileapp.qml index d995c8ca64..1e6302079f 100644 --- a/src/qml/qgismobileapp.qml +++ b/src/qml/qgismobileapp.qml @@ -4124,6 +4124,7 @@ ApplicationWindow { ScreenLocker { id: screenLocker + objectName: "screenLocker" enabled: false } From a66c285b47fd25bf7e07c598c34c44b825947ceb Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Sun, 19 Jan 2025 12:44:51 +0700 Subject: [PATCH 4/6] Close dashboard when opening cloud popup, cleanup dashboard signals --- src/qml/DashBoard.qml | 27 ++++++++++++++------------- src/qml/qgismobileapp.qml | 19 ++++++++++++++----- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/qml/DashBoard.qml b/src/qml/DashBoard.qml index fc70d48439..33b4701b20 100644 --- a/src/qml/DashBoard.qml +++ b/src/qml/DashBoard.qml @@ -13,12 +13,12 @@ Drawer { id: dashBoard objectName: "dashBoard" - signal showMenu - signal showCloudMenu + signal showMainMenu(point p) + signal showPrintLayouts(point p) + signal showCloudPopup + signal showProjectFolder + signal toggleMeasurementTool signal returnHome - signal measurementClicked - signal printClicked(Item item) - signal projectFolderClicked property bool allowInteractive: true property alias allowActiveLayerChange: legend.allowActiveLayerChange @@ -47,9 +47,6 @@ Drawer { focus: visible clip: true - onShowMenu: mainMenu.popup(menuButton.x + menuButton.width - mainMenu.width - 2, menuButton.y - 2) - onShowCloudMenu: qfieldCloudPopup.show() - onActiveLayerChanged: { if (activeLayer && activeLayer.readOnly && stateMachine.state == "digitize") displayToast(qsTr("The layer %1 is read only.").arg(activeLayer.name)); @@ -120,7 +117,7 @@ Drawer { iconColor: Theme.mainOverlayColor bgcolor: "transparent" onClicked: { - measurementClicked(); + toggleMeasurementTool(); highlighted = false; } } @@ -132,7 +129,8 @@ Drawer { iconSource: Theme.getThemeVectorIcon("ic_print_black_24dp") iconColor: Theme.mainOverlayColor onClicked: { - printClicked(printItem); + const p = mapToItem(mainWindow.contentItem, 0, 0); + showPrintLayouts(p); highlighted = false; } } @@ -183,7 +181,7 @@ Drawer { if (featureForm.visible) { featureForm.hide(); } - showCloudMenu(); + showCloudPopup(); } bottomRightIndicatorText: cloudProjectsModel.layerObserver.deltaFileWrapper.count > 0 ? cloudProjectsModel.layerObserver.deltaFileWrapper.count : cloudProjectsModel.layerObserver.deltaFileWrapper.count >= 10 ? '+' : '' @@ -217,7 +215,7 @@ Drawer { iconColor: Theme.mainOverlayColor round: true onClicked: { - projectFolderClicked(); + showProjectFolder(); } } } @@ -230,7 +228,10 @@ Drawer { iconSource: Theme.getThemeVectorIcon('ic_dot_menu_black_24dp') iconColor: Theme.mainOverlayColor bgcolor: "transparent" - onClicked: showMenu() + onClicked: { + let p = mapToItem(mainWindow.contentItem, width, 0); + showMainMenu(p) + } } } diff --git a/src/qml/qgismobileapp.qml b/src/qml/qgismobileapp.qml index 1e6302079f..386d7dc8db 100644 --- a/src/qml/qgismobileapp.qml +++ b/src/qml/qgismobileapp.qml @@ -2323,7 +2323,16 @@ ApplicationWindow { } } - onMeasurementClicked: { + onShowMainMenu: p => { + mainMenu.popup(p.x- mainMenu.width - 2, p.y - 2) + } + + onShowCloudPopup: { + dashBoard.close(); + qfieldCloudPopup.show() + } + + onToggleMeasurementTool: { if (featureForm.state === "ProcessingAlgorithmForm") { cancelAlgorithmDialog.visible = true; } else { @@ -2331,10 +2340,10 @@ ApplicationWindow { } } - onPrintClicked: printItem => { + onShowPrintLayouts: p => { if (layoutListInstantiator.count > 1) { - printMenu.popup(mainMenu.x, mainMenu.y + printItem.y); - } else if (layoutListInstantiator.count == 1) { + printMenu.popup(p.x, p.y); + } else if (layoutListInstantiator.count === 1) { mainMenu.close(); displayToast(qsTr('Printing...')); printMenu.printName = layoutListInstantiator.model.titleAt(0); @@ -2347,7 +2356,7 @@ ApplicationWindow { } } - onProjectFolderClicked: { + onShowProjectFolder: { dashBoard.close(); qfieldLocalDataPickerScreen.projectFolderView = true; qfieldLocalDataPickerScreen.model.resetToPath(projectInfo.filePath); From 2305a64f6570924e7187d38451dde73e9013c79a Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Sun, 19 Jan 2025 13:01:20 +0700 Subject: [PATCH 5/6] Fix UI/UX shortcomings in the about QField popup, avoid map canvas interactions --- src/qml/About.qml | 17 ++++++++++++----- src/qml/qgismobileapp.qml | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/qml/About.qml b/src/qml/About.qml index 0df44021a6..c876c36838 100644 --- a/src/qml/About.qml +++ b/src/qml/About.qml @@ -47,20 +47,23 @@ Item { id: information spacing: 6 width: aboutPanel.width - 40 - height: Math.max(mainWindow.height - linksButton.height * 2 - qfieldAppDirectoryLabel.height - aboutContainer.spacing * 3 - aboutContainer.anchors.topMargin - aboutContainer.anchors.bottomMargin, qfieldPart.height + opengisPart.height + spacing) + height: Math.max(mainWindow.height - sponsorshipButton.height - linksButton.height - qfieldAppDirectoryLabel.height - aboutContainer.spacing * 3 - aboutContainer.anchors.topMargin - aboutContainer.anchors.bottomMargin - 10, + qfieldPart.height + opengisPart.height + spacing) ColumnLayout { id: qfieldPart + Layout.fillWidth: true Layout.fillHeight: true - Layout.alignment: Qt.AlignHCenter MouseArea { Layout.preferredWidth: 138 Layout.preferredHeight: 138 + Layout.alignment: Qt.AlignHCenter Image { id: qfieldLogo width: parent.width height: parent.height + fillMode: Image.PreserveAspectFit source: "qrc:/images/qfield_logo.svg" sourceSize.width: width * screen.devicePixelRatio sourceSize.height: height * screen.devicePixelRatio @@ -70,12 +73,13 @@ Item { Label { Layout.fillWidth: true - Layout.maximumWidth: parent.width Layout.alignment: Qt.AlignCenter horizontalAlignment: Text.AlignHCenter font: Theme.strongFont color: Theme.light textFormat: Text.RichText + wrapMode: Text.WordWrap + text: { let links = '' + gitRev.substr(0, 6) + ''; if (appVersion && appVersion !== '1.0.0') { @@ -87,22 +91,25 @@ Item { const dependenciesStr = dependencies.map(pair => pair.join(" ")).join(" | "); return "QField
" + appVersionStr + " (" + links + ")
" + dependenciesStr; } + onLinkActivated: link => Qt.openUrlExternally(link) } } ColumnLayout { id: opengisPart + Layout.fillWidth: true Layout.fillHeight: true - Layout.alignment: Qt.AlignHCenter MouseArea { Layout.preferredWidth: 91 Layout.preferredHeight: 113 + Layout.alignment: Qt.AlignHCenter Image { id: opengisLogo width: parent.width height: parent.height + fillMode: Image.PreserveAspectFit source: "qrc:/images/opengis-logo.svg" sourceSize.width: width * screen.devicePixelRatio sourceSize.height: height * screen.devicePixelRatio @@ -112,7 +119,6 @@ Item { Label { Layout.fillWidth: true - Layout.maximumWidth: parent.width Layout.alignment: Qt.AlignCenter horizontalAlignment: Text.AlignHCenter font: Theme.strongFont @@ -135,6 +141,7 @@ Item { font: Theme.tinyFont color: Theme.secondaryTextColor textFormat: Text.RichText + wrapMode: Text.WordWrap text: { let label = ''; diff --git a/src/qml/qgismobileapp.qml b/src/qml/qgismobileapp.qml index 386d7dc8db..470bec1ca7 100644 --- a/src/qml/qgismobileapp.qml +++ b/src/qml/qgismobileapp.qml @@ -591,7 +591,7 @@ ApplicationWindow { MapCanvas { id: mapCanvasMap - property bool isEnabled: !dashBoard.opened && !welcomeScreen.visible && !qfieldSettings.visible && !qfieldLocalDataPickerScreen.visible && !qfieldCloudScreen.visible && !qfieldCloudPopup.visible && !codeReader.visible && !sketcher.visible && !overlayFeatureFormDrawer.visible && !rotateFeaturesToolbar.rotateFeaturesRequested + property bool isEnabled: !dashBoard.opened && !aboutDialog.visible && !welcomeScreen.visible && !qfieldSettings.visible && !qfieldLocalDataPickerScreen.visible && !qfieldCloudScreen.visible && !qfieldCloudPopup.visible && !codeReader.visible && !sketcher.visible && !overlayFeatureFormDrawer.visible && !rotateFeaturesToolbar.rotateFeaturesRequested interactive: isEnabled && !screenLocker.enabled isMapRotationEnabled: qfieldSettings.enableMapRotation incrementalRendering: true From 1007fb6f68e93cf7cac2ff016541a1f0fed4688f Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Sun, 19 Jan 2025 13:08:51 +0700 Subject: [PATCH 6/6] Oups, re-add pre-commit hook --- src/qml/About.qml | 3 +-- src/qml/DashBoard.qml | 4 ++-- src/qml/qgismobileapp.qml | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/qml/About.qml b/src/qml/About.qml index c876c36838..7c8e5c84c2 100644 --- a/src/qml/About.qml +++ b/src/qml/About.qml @@ -47,8 +47,7 @@ Item { id: information spacing: 6 width: aboutPanel.width - 40 - height: Math.max(mainWindow.height - sponsorshipButton.height - linksButton.height - qfieldAppDirectoryLabel.height - aboutContainer.spacing * 3 - aboutContainer.anchors.topMargin - aboutContainer.anchors.bottomMargin - 10, - qfieldPart.height + opengisPart.height + spacing) + height: Math.max(mainWindow.height - sponsorshipButton.height - linksButton.height - qfieldAppDirectoryLabel.height - aboutContainer.spacing * 3 - aboutContainer.anchors.topMargin - aboutContainer.anchors.bottomMargin - 10, qfieldPart.height + opengisPart.height + spacing) ColumnLayout { id: qfieldPart diff --git a/src/qml/DashBoard.qml b/src/qml/DashBoard.qml index 33b4701b20..6ff9eb52ce 100644 --- a/src/qml/DashBoard.qml +++ b/src/qml/DashBoard.qml @@ -229,8 +229,8 @@ Drawer { iconColor: Theme.mainOverlayColor bgcolor: "transparent" onClicked: { - let p = mapToItem(mainWindow.contentItem, width, 0); - showMainMenu(p) + let p = mapToItem(mainWindow.contentItem, width, 0); + showMainMenu(p); } } } diff --git a/src/qml/qgismobileapp.qml b/src/qml/qgismobileapp.qml index 470bec1ca7..eaa974d012 100644 --- a/src/qml/qgismobileapp.qml +++ b/src/qml/qgismobileapp.qml @@ -2324,12 +2324,12 @@ ApplicationWindow { } onShowMainMenu: p => { - mainMenu.popup(p.x- mainMenu.width - 2, p.y - 2) + mainMenu.popup(p.x - mainMenu.width - 2, p.y - 2); } onShowCloudPopup: { - dashBoard.close(); - qfieldCloudPopup.show() + dashBoard.close(); + qfieldCloudPopup.show(); } onToggleMeasurementTool: {