Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main menu tweaks (variable -> settings, undo / redo tweaks to support translation, etc.) #5947

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/qml/About.qml
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,22 @@ 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
Expand All @@ -70,12 +72,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 = '<a href="https://github.com/opengisch/QField/commit/' + gitRev + '">' + gitRev.substr(0, 6) + '</a>';
if (appVersion && appVersion !== '1.0.0') {
Expand All @@ -87,22 +90,25 @@ Item {
const dependenciesStr = dependencies.map(pair => pair.join(" ")).join(" | ");
return "QField<br>" + appVersionStr + " (" + links + ")<br>" + 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
Expand All @@ -112,7 +118,6 @@ Item {

Label {
Layout.fillWidth: true
Layout.maximumWidth: parent.width
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
font: Theme.strongFont
Expand All @@ -135,6 +140,7 @@ Item {
font: Theme.tinyFont
color: Theme.secondaryTextColor
textFormat: Text.RichText
wrapMode: Text.WordWrap

text: {
let label = '';
Expand Down
27 changes: 14 additions & 13 deletions src/qml/DashBoard.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -120,7 +117,7 @@ Drawer {
iconColor: Theme.mainOverlayColor
bgcolor: "transparent"
onClicked: {
measurementClicked();
toggleMeasurementTool();
highlighted = false;
}
}
Expand All @@ -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;
}
}
Expand Down Expand Up @@ -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 ? '+' : ''

Expand Down Expand Up @@ -217,7 +215,7 @@ Drawer {
iconColor: Theme.mainOverlayColor
round: true
onClicked: {
projectFolderClicked();
showProjectFolder();
}
}
}
Expand All @@ -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);
}
}
}

Expand Down
54 changes: 36 additions & 18 deletions src/qml/qgismobileapp.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -2323,18 +2323,27 @@ 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 {
activateMeasurementMode();
}
}

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);
Expand All @@ -2347,7 +2356,7 @@ ApplicationWindow {
}
}

onProjectFolderClicked: {
onShowProjectFolder: {
dashBoard.close();
qfieldLocalDataPickerScreen.projectFolderView = true;
qfieldLocalDataPickerScreen.model.resetToPath(projectInfo.filePath);
Expand Down Expand Up @@ -2412,7 +2421,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) {
Expand All @@ -2423,6 +2432,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
Expand Down Expand Up @@ -2453,7 +2468,7 @@ ApplicationWindow {
MenuSeparator {
width: 1
height: parent.height
anchors.left: undoButton.right
anchors.right: redoButton.left
}

MenuItem {
Expand All @@ -2466,15 +2481,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: {
Expand Down Expand Up @@ -2534,19 +2548,22 @@ 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

onTriggered: {
dashBoard.close();
qfieldSettings.reset();
qfieldSettings.visible = true;
qfieldSettings.currentPanel = 2;
highlighted = false;
}
}
Expand All @@ -2566,10 +2583,6 @@ ApplicationWindow {
}
}

MenuSeparator {
width: parent.width
}

MenuItem {
text: qsTr("Lock Screen")

Expand All @@ -2585,6 +2598,10 @@ ApplicationWindow {
}
}

MenuSeparator {
width: parent.width
}

MenuItem {
text: qsTr("About QField")

Expand Down Expand Up @@ -4116,6 +4133,7 @@ ApplicationWindow {

ScreenLocker {
id: screenLocker
objectName: "screenLocker"
enabled: false
}

Expand Down
Loading