Skip to content

Commit

Permalink
Insure digitizing is cancelled or finished prior to going to home scr…
Browse files Browse the repository at this point in the history
…een (#5310)
  • Loading branch information
mohsenD98 committed Jun 19, 2024
1 parent dca9277 commit ad16405
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/qml/DigitizingToolbar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ VisibilityFadingRow {
property VectorLayer geometryRequestedLayer

property alias digitizingLogger: digitizingLogger
property alias cancelDialog: cancelDialog

readonly property bool isDigitizing: rubberbandModel ? rubberbandModel.vertexCount > 1 : false //!< Readonly

Expand Down Expand Up @@ -92,6 +93,7 @@ VisibilityFadingRow {
bgcolor: Theme.darkRed

onClicked: {
homeButton.waitingForDigitizingFinish = false
if (stateMachine.state !== "measure") {
cancelDialog.open();
} else {
Expand Down Expand Up @@ -121,6 +123,7 @@ VisibilityFadingRow {
bgcolor: Theme.mainColor

onClicked: {
homeButton.waitingForDigitizingFinish = false
confirm()
}
}
Expand Down
27 changes: 22 additions & 5 deletions src/qml/qgismobileapp.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2006,6 +2006,10 @@ ApplicationWindow {
geometryRequested = false
}
}

if (homeButton.waitingForDigitizingFinish) {
openWelcomeScreen()
}
}

onConfirmed: {
Expand Down Expand Up @@ -2196,6 +2200,14 @@ ApplicationWindow {
id: bookmarkProperties
}

function openWelcomeScreen(){
mainMenu.close()
dashBoard.close()
welcomeScreen.visible = true
welcomeScreen.focus = true
homeButton.waitingForDigitizingFinish = false
}

Menu {
id: mainMenu
title: qsTr( "Main Menu" )
Expand Down Expand Up @@ -2228,6 +2240,7 @@ ApplicationWindow {
property color hoveredColor: Qt.hsla(Theme.mainTextColor.hslHue, Theme.mainTextColor.hslSaturation, Theme.mainTextColor.hslLightness, 0.2)

QfToolButton {
id: homeButton
anchors.verticalCenter: parent.verticalCenter
height: 48
width: 48
Expand All @@ -2236,12 +2249,16 @@ ApplicationWindow {
iconColor: Theme.mainTextColor
bgcolor: hovered ? parent.hoveredColor : "#00ffffff"

property bool waitingForDigitizingFinish: false

onClicked: {
mainMenu.close()
dashBoard.close()
welcomeScreen.visible = true
welcomeScreen.focus = true
highlighted = false
if (currentRubberband && currentRubberband.model.vertexCount > 1) {
digitizingToolbar.cancelDialog.open();
waitingForDigitizingFinish = true
} else if (!waitingForDigitizingFinish) {
openWelcomeScreen()
highlighted = false
}
}
}

Expand Down

1 comment on commit ad16405

@qfield-fairy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.