summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanjiban Bairagya <[email protected]>2017-09-14 14:50:20 +0200
committerSanjiban [email protected] <[email protected]>2017-09-14 14:52:53 +0200
commitdbdb53bca0b6f6b29f70df755debf2c80fc493d6 (patch)
treef8933b711a6a3f71315e8060c3a5a2ec63765fb6
parent57dfebeade19e4648365a6f9907af0b4ea300b93 (diff)
Clean code + fix indentation in MainScreen
-rw-r--r--src/apps/marble-maps/MainScreen.qml171
1 files changed, 85 insertions, 86 deletions
diff --git a/src/apps/marble-maps/MainScreen.qml b/src/apps/marble-maps/MainScreen.qml
index 02b736e..4964747 100644
--- a/src/apps/marble-maps/MainScreen.qml
+++ b/src/apps/marble-maps/MainScreen.qml
@@ -72,7 +72,7 @@ Kirigami.ApplicationWindow {
property bool aboutToQuit: false
onClosing: {
- if (app.aboutToQuit === true) {
+ if (app.aboutToQuit) {
close.accepted = true // we will quit
return
} else if (sidePanel.drawerOpen) {
@@ -83,12 +83,11 @@ Kirigami.ApplicationWindow {
navigationManager.visible = false
} else if (app.state !== "none") {
app.state = "none"
- }
- else if(search.searchResultsVisible.visible === true && !sidePanel.drawerOpen){
+ } else if(search.searchResultsVisible.visible){
search.searchResultsVisible = false
}
else {
- if(search.searchResultsVisible === true){
+ if(search.searchResultsVisible){
search.searchResultsVisible = false
}
app.aboutToQuit = true
@@ -449,99 +448,99 @@ Kirigami.ApplicationWindow {
}
- Row {
- id: bottomMenu
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: dialogLoader.top
- width: parent.width
- height: bottomMenu.visible ? routeEditorButton.height + Screen.pixelDensity * 2 : 0
- anchors.topMargin: app.animatedMargin
- visible: app.state === "place" || app.state === "route"
-
- onVisibleChanged: bottomMenuAnimation.start()
-
- NumberAnimation {
- id: bottomMenuAnimation
- target: bottomMenu
- property: "y"
- from: app.height - bottomMenu.height
- to: 0
- duration: 500
- easing.type: Easing.InExpo
- }
+ Row {
+ id: bottomMenu
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: dialogLoader.top
+ width: parent.width
+ height: bottomMenu.visible ? routeEditorButton.height + Screen.pixelDensity * 2 : 0
+ anchors.topMargin: app.animatedMargin
+ visible: app.state === "place" || app.state === "route"
- Item {
- id: bottomMenuBackground
- anchors.fill: parent
- Rectangle {
- color: Material.accent
- anchors.fill : parent
- }
- }
+ onVisibleChanged: bottomMenuAnimation.start()
- Row {
- anchors.centerIn: parent
- spacing: Kirigami.Units.gridUnit * 2
+ NumberAnimation {
+ id: bottomMenuAnimation
+ target: bottomMenu
+ property: "y"
+ from: app.height - bottomMenu.height
+ to: 0
+ duration: 500
+ easing.type: Easing.InExpo
+ }
- FlatButton {
- id: routeEditorButton
- property string currentProfileIcon: "qrc:///material/directions-car.svg"
- height: Screen.pixelDensity * 6
- width: height
- enabled: app.state !== "route" || routingManager.hasRoute
- imageSource: "qrc:///material/directions.svg"
+ Item {
+ id: bottomMenuBackground
+ anchors.fill: parent
+ Rectangle {
+ color: Material.accent
+ anchors.fill : parent
+ }
+ }
- onClicked: {
- if (app.state === "route") {
- app.state = "none"
- navigationManager.visible = true
- } else if (app.state === "place") {
- app.state = "route"
- routingManager.addToRoute()
- } else {
- app.state = "route"
- navigationManager.visible = false
- }
+ Row {
+ anchors.centerIn: parent
+ spacing: Kirigami.Units.gridUnit * 2
+
+ FlatButton {
+ id: routeEditorButton
+ property string currentProfileIcon: "qrc:///material/directions-car.svg"
+ height: Screen.pixelDensity * 6
+ width: height
+ enabled: app.state !== "route" || routingManager.hasRoute
+ imageSource: "qrc:///material/directions.svg"
+
+ onClicked: {
+ if (app.state === "route") {
+ app.state = "none"
+ navigationManager.visible = true
+ } else if (app.state === "place") {
+ app.state = "route"
+ routingManager.addToRoute()
+ } else {
+ app.state = "route"
+ navigationManager.visible = false
}
- states: [
- State {
- name: ""
- PropertyChanges { target: routeEditorButton; imageSource: "qrc:///material/directions.svg"; }
- },
- State {
- name: "routingAction"
- when: app.state === "route"
- PropertyChanges { target: routeEditorButton; imageSource: "qrc:///material/navigation.svg"; }
- },
- State {
- name: "placeAction"
- when: app.state === "place"
- PropertyChanges { target: routeEditorButton; imageSource: "qrc:///material/directions.svg" }
- }
- ]
}
+ states: [
+ State {
+ name: ""
+ PropertyChanges { target: routeEditorButton; imageSource: "qrc:///material/directions.svg"; }
+ },
+ State {
+ name: "routingAction"
+ when: app.state === "route"
+ PropertyChanges { target: routeEditorButton; imageSource: "qrc:///material/navigation.svg"; }
+ },
+ State {
+ name: "placeAction"
+ when: app.state === "place"
+ PropertyChanges { target: routeEditorButton; imageSource: "qrc:///material/directions.svg" }
+ }
+ ]
+ }
- FlatButton {
- id: bookmarkButton
- anchors.verticalCenter: parent.verticalCenter
- height: Screen.pixelDensity * 6
- width: height
- property bool bookmark: bookmarks.isBookmark(app.selectedPlacemark.longitude, app.selectedPlacemark.latitude)
- enabled: app.state === "place"
- visible: app.state === "place"
- imageSource: bookmark ? "qrc:///material/star.svg" : "qrc:///material/star_border.svg"
- onClicked: {
- if (bookmarkButton.bookmark) {
- bookmarks.removeBookmark(app.selectedPlacemark.longitude, app.selectedPlacemark.latitude)
- } else {
- bookmarks.addBookmark(app.selectedPlacemark, "Default")
- }
- bookmarkButton.bookmark = !bookmarkButton.bookmark
+ FlatButton {
+ id: bookmarkButton
+ anchors.verticalCenter: parent.verticalCenter
+ height: Screen.pixelDensity * 6
+ width: height
+ property bool bookmark: bookmarks.isBookmark(app.selectedPlacemark.longitude, app.selectedPlacemark.latitude)
+ enabled: app.state === "place"
+ visible: app.state === "place"
+ imageSource: bookmark ? "qrc:///material/star.svg" : "qrc:///material/star_border.svg"
+ onClicked: {
+ if (bookmarkButton.bookmark) {
+ bookmarks.removeBookmark(app.selectedPlacemark.longitude, app.selectedPlacemark.latitude)
+ } else {
+ bookmarks.addBookmark(app.selectedPlacemark, "Default")
}
+ bookmarkButton.bookmark = !bookmarkButton.bookmark
}
}
}
+ }
BorderImage {