diff --git a/src/apps/marble-maps/MainScreen.qml b/src/apps/marble-maps/MainScreen.qml index 3b260896c..f2a1e28b6 100644 --- a/src/apps/marble-maps/MainScreen.qml +++ b/src/apps/marble-maps/MainScreen.qml @@ -1,478 +1,491 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2015 Gábor Péterffy // Copyright 2015 Dennis Nienhüser // Copyright 2015 Mikhail Ivchenko // import QtQuick 2.3 -import QtQuick.Controls 1.3 +import QtQuick.Controls 2.0 import QtQuick.Window 2.2 import org.kde.marble 0.20 ApplicationWindow { id: app title: qsTr("Marble Maps") visible: true width: 600 height: 400 color: "#f9f9f9" // Keep the background white while no dialog is loaded property alias state: stateTracker.state property var selectedPlacemark property bool showOsmTags: false property int currentWaypointIndex: 0 property real animatedMargin: app.state === "none" ? 0 : -dialogLoader.height property bool dialogExpanded: animatedMargin === -dialogLoader.height property real mapOffset: !dialogExpanded ? animatedMargin / 2 : 0 Behavior on animatedMargin { NumberAnimation { id: dialogAnimation duration: 200 easing.type: Easing.OutQuart } } onSelectedPlacemarkChanged: { if (!selectedPlacemark) { app.state = "none" } } SystemPalette{ id: palette colorGroup: SystemPalette.Active } Settings { id: settings } Item { id: mapItem anchors { top: parent.top topMargin: mapOffset left: parent.left right: parent.right } height: !dialogExpanded ? parent.height : parent.height + animatedMargin PinchArea { anchors.fill: parent enabled: true onPinchStarted: marbleMaps.handlePinchStarted(pinch.center) onPinchFinished: marbleMaps.handlePinchFinished(pinch.center) onPinchUpdated: marbleMaps.handlePinchUpdated(pinch.center, pinch.scale); MarbleMaps { id: marbleMaps property string currentPositionProvider: "QtPositioning" property bool wlanOnly: false property bool smallZoom : radius < 2 * Math.max(app.width, app.height) anchors.fill: parent visible: true // Theme settings. projection: smallZoom ? MarbleItem.Spherical : MarbleItem.Mercator mapThemeId: settings.value("MarbleMaps", "mapThemeId", "earth/vectorosm/vectorosm.dgml") // Visibility of layers/plugins. showFrameRate: false showAtmosphere: smallZoom showCompass: false showClouds: false showCrosshairs: false showGrid: smallZoom showOverviewMap: false showOtherPlaces: false showScaleBar: false showBackground: smallZoom positionProvider: suspended ? "" : currentPositionProvider keepScreenOn: !suspended && navigationManager.guidanceModeEnabled showPositionMarker: false animationViewContext: dialogAnimation.running placemarkDelegate: Image { id: balloon property int xPos: 0 property int yPos: 0 property real animationOffset: 0 property var placemark: null x: xPos - 0.5 * width y: yPos - height - 30 * Screen.pixelDensity * animationOffset opacity: 1.0 - animationOffset Connections { target: app onSelectedPlacemarkChanged: balloonAnimation.restart() } NumberAnimation { id: balloonAnimation target: balloon property: "animationOffset" from: 1 to: 0 duration: 1000 easing.type: Easing.OutBounce } width: Screen.pixelDensity*6 height: width source: "qrc:///ic_place.png" onPlacemarkChanged: { app.selectedPlacemark = placemark if (placemark) { app.state = "place" } else { app.state = "none" } } } onPositionAvailableChanged: { updateIndicator(); } onPositionVisibleChanged: { updateIndicator(); } onVisibleLatLonAltBoxChanged: { !panningDetectionTimer.restart(); updateIndicator(); } onCurrentPositionChanged: { updateIndicator(); } onZoomChanged: { zoomDetectionTimer.restart() } Component.onCompleted: { setPluginSetting("coordinate-grid", "gridColor", "#999999"); setPluginSetting("coordinate-grid", "tropicsColor", "#888888"); setPluginSetting("coordinate-grid", "equatorColor", "#777777"); setPluginSetting("coordinate-grid", "primaryLabels", "false"); setPluginSetting("coordinate-grid", "secondaryLabels", "false"); marbleMaps.loadSettings() } Component.onDestruction: marbleMaps.writeSettings() function updateIndicator() { if ( !positionVisible && positionAvailable ) { zoomToPositionButton.updateIndicator(); } } RoutingManager { id: routingManager anchors.fill: parent marbleItem: marbleMaps visible: hasRoute function addToRoute() { ensureRouteHasDeparture() routingManager.addViaByPlacemarkAtIndex(routingManager.waypointCount(), selectedPlacemark) routingManager.clearSearchResultPlacemarks() selectedPlacemark = null app.state = "route" } function ensureRouteHasDeparture() { if (routingManager.routeRequestModel.count === 0) { if (marbleMaps.positionAvailable) { routingManager.addViaByPlacemark(marbleMaps.currentPosition) } } } } Timer { id: zoomDetectionTimer interval: 1000 } Timer { id: panningDetectionTimer interval: 1000 } PositionMarker { id: positionMarker x: navigationManager.snappedPositionMarkerScreenPosition.x - positionMarker.width / 2 y: navigationManager.snappedPositionMarkerScreenPosition.y - positionMarker.height / 2 angle: marbleMaps.angle visible: marbleMaps.positionAvailable && marbleMaps.positionVisible radius: navigationManager.screenAccuracy / 2 showAccuracy: navigationManager.deviated allowRadiusAnimation: !zoomDetectionTimer.running allowPositionAnimation: !panningDetectionTimer.running speed: marbleMaps.speed MouseArea { anchors.fill: parent onPressed: app.state = "position" } } MouseArea { anchors.fill: parent propagateComposedEvents: true onPressed: { marbleMaps.focus = true; mouse.accepted = false; } } } NavigationManager { id: navigationManager width: parent.width height: parent.height visible: false marbleItem: marbleMaps hasRoute: routingManager.hasRoute } } BoxedText { id: distanceIndicator text: qsTr("%1 km").arg(zoomToPositionButton.distance < 10 ? zoomToPositionButton.distance.toFixed(1) : zoomToPositionButton.distance.toFixed(0)) anchors { bottom: zoomToPositionButton.top horizontalCenter: zoomToPositionButton.horizontalCenter } visible: marbleMaps.positionAvailable && !marbleMaps.positionVisible } PositionButton { id: zoomToPositionButton anchors { right: parent.right rightMargin: Screen.pixelDensity * 1 bottom: routeEditorButton.top bottomMargin: 10 } enabled: marbleMaps.positionAvailable iconSource: marbleMaps.positionAvailable ? "qrc:///gps_fixed.png" : "qrc:///gps_not_fixed.png" onClicked: marbleMaps.centerOnCurrentPosition() property real distance: 0 function updateIndicator() { var point = marbleMaps.mapFromItem(zoomToPositionButton, diameter * 0.5, diameter * 0.5); distance = 0.001 * marbleMaps.distanceFromPointToCurrentLocation(point); angle = marbleMaps.angleFromPointToCurrentLocation(point); } showDirection: marbleMaps.positionAvailable && !marbleMaps.positionVisible } CircularButton { id: routeEditorButton property string currentProfileIcon: "qrc:///material/directions-car.svg" anchors { bottom: parent.bottom bottomMargin: Screen.pixelDensity * 4 - mapOffset horizontalCenter: zoomToPositionButton.horizontalCenter } enabled: app.state !== "route" || routingManager.hasRoute 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 } } iconSource: "qrc:///material/directions.svg"; states: [ State { name: "" PropertyChanges { target: routeEditorButton; iconSource: "qrc:///material/directions.svg"; } }, State { name: "routingAction" when: app.state === "route" PropertyChanges { target: routeEditorButton; iconSource: "qrc:///material/navigation.svg"; } }, State { name: "placeAction" when: app.state === "place" PropertyChanges { target: routeEditorButton; iconSource: currentProfileIcon } } ] } } Search { id: search anchors.fill: parent marbleQuickItem: marbleMaps visible: !navigationManager.visible onItemSelected: { if (routingManager) { routingManager.addSearchResultAsPlacemark(suggestedPlacemark); } app.selectedPlacemark = suggestedPlacemark; app.state = "place" } } Loader { id: dialogLoader focus: true anchors { left: parent.left right: parent.right top: parent.bottom topMargin: app.animatedMargin } onLoaded: { if (app.state === "place") { dialogLoader.item.map = marbleMaps dialogLoader.item.placemark = app.selectedPlacemark dialogLoader.item.showOsmTags = app.showOsmTags + dialogLoader.item.showAccessibility = accessibilityMenu.checked } else if (app.state === "route") { item.routingManager = routingManager item.routingProfile = routingManager.routingProfile item.currentIndex = Qt.binding(function() { return app.currentWaypointIndex }) } else if (app.state == "position") { dialogLoader.item.map = marbleMaps dialogLoader.item.navigationManager = navigationManager } } Connections { target: dialogLoader.item onCurrentProfileIconChanged: routeEditorButton.currentProfileIcon = dialogLoader.item.currentProfileIcon ignoreUnknownSignals: true } } BorderImage { visible: app.state != "none" anchors.fill: dialogLoader anchors.margins: -14 border { top: 14; left: 14; right: 14; bottom: 14 } source: "qrc:///border_shadow.png" } + SidePanel { + id: drawer + width: 0.65 * app.width + height: app.height + marbleMaps: marbleMaps + + onAboutActionTriggered: { + app.state = "about" + dialogLoader.focus = true + } + } + BoxedText { id: quitHelper visible: false text: qsTr("Press again to close.") anchors.bottom: parent.bottom anchors.bottomMargin: Screen.pixelDensity * 5 anchors.horizontalCenter: parent.horizontalCenter onVisibleChanged: { if (visible) { quitTimer.restart() } } Timer { id: quitTimer interval: 3000; running: false; repeat: false onTriggered: { app.aboutToQuit = false quitHelper.visible = false } } } property bool aboutToQuit: false onClosing: { if (app.aboutToQuit === true) { close.accepted = true // we will quit return } else if (navigationManager.visible) { navigationManager.visible = false } else if (app.state !== "none") { app.state = "none" } else { app.aboutToQuit = true quitHelper.visible = true } close.accepted = false } Item { id: stateTracker state: "none" states: [ State { name: "none" PropertyChanges { target: dialogLoader; source: "" } }, State { name: "position" PropertyChanges { target: dialogLoader; source: "CurrentPosition.qml" } }, State { name: "route" PropertyChanges { target: dialogLoader; source: "RouteEditor.qml" } }, State { name: "place" PropertyChanges { target: dialogLoader; source: "PlacemarkDialog.qml" } }, State { name: "about" PropertyChanges { target: dialogLoader; source: "AboutDialog.qml" } }, State { name: "settings" PropertyChanges { target: dialogLoader; source: "SettingsDialog.qml" } }, State { name: "developer" PropertyChanges { target: dialogLoader; source: "DeveloperDialog.qml" } } ] } } diff --git a/src/apps/marble-maps/MarbleMaps.qrc b/src/apps/marble-maps/MarbleMaps.qrc index 935483df6..345429692 100644 --- a/src/apps/marble-maps/MarbleMaps.qrc +++ b/src/apps/marble-maps/MarbleMaps.qrc @@ -1,75 +1,79 @@ AboutDialog.qml FlatButton.qml Completion.qml MainScreen.qml SearchResults.qml SearchField.qml Search.qml CircularButton.qml IconText.qml PositionButton.qml BoxedText.qml ImageButton.qml WaypointImage.qml RoutingManager.qml PlacemarkDialog.qml SettingsDialog.qml DeveloperDialog.qml ProfileSelectorMenu.qml FloatingMenuButton.qml RouteEditor.qml RoutesItem.qml + MenuIcon.qml NavigationInfoBar.qml NavigationManager.qml PositionMarker.qml Waypoint.qml CurrentPosition.qml + SidePanel.qml + drawer.svg ../../../data/android/drawable-xxxhdpi/search.png ../../../data/android/drawable-xxxhdpi/gps_fixed.png ../../../data/android/drawable-xxxhdpi/gps_not_fixed.png ../../../data/android/drawable-xxxhdpi/backdrop.png ../../../data/android/drawable-xxxhdpi/border_shadow.png ../../../data/android/drawable-xxxhdpi/map.png ../../../data/android/drawable-xxxhdpi/waypoint.png ../../../data/android/drawable-xxxhdpi/up.png ../../../data/android/drawable-xxxhdpi/down.png ../../../data/android/drawable-xxxhdpi/delete.png ../../../data/android/drawable-xxxhdpi/delete_white.png ../../../data/android/drawable-xxxhdpi/ic_close_black_18dp.png ../../../data/android/drawable-xxxhdpi/busy_indicator.png ../../../data/android/drawable-xxxhdpi/navigation_blue.png ../../../data/svg/navigation_blue.svg ../../../data/android/drawable-xxxhdpi/circular_menu_backdrop.png ../../../data/android/drawable-xxxhdpi/ic_place.png ../../../data/android/drawable-xxxhdpi/ic_place_arrival.png ../../../data/android/drawable-xxxhdpi/ic_place_departure.png ../../../data/android/drawable-xxxhdpi/ic_place_unknown.png ../../../data/android/drawable-xxxhdpi/ic_place_via.png ../../../data/android/drawable-xxxhdpi/ic_add_black_48dp.png material-icons/ic_local_gas_station_48px.svg material-icons/ic_open_in_browser_48px.svg material-icons/ic_volume_off_48px.svg material-icons/ic_volume_up_48px.svg material-icons/ic_directions_48px.svg material-icons/ic_directions_bike_48px.svg material-icons/ic_directions_car_48px.svg material-icons/ic_directions_walk_48px.svg material-icons/ic_navigation_48px.svg material-icons/ic_access_time_48px.svg material-icons/ic_accessible_black_48px.svg material-icons/ic_network_wifi_black_48px.svg material-icons/ic_place_black_48px.svg material-icons/ic_star_24px.svg material-icons/ic_star_border_24px.svg material-icons/ic_label_48px.svg + material-icons/ic_directions_bus_48px.svg konqi/konqi-app-dev.png konqi/konqi-dev-qt.png konqi/konqi-group.png konqi/konqi-globe.png konqi/konqi-books.png RouteProfileRadioButton.qml MarbleScrollBar.qml diff --git a/src/apps/marble-maps/MenuIcon.qml b/src/apps/marble-maps/MenuIcon.qml new file mode 100644 index 000000000..84ac4aa92 --- /dev/null +++ b/src/apps/marble-maps/MenuIcon.qml @@ -0,0 +1,72 @@ +// +// This file is part of the Marble Virtual Globe. +// +// This program is free software licensed under the GNU LGPL. You can +// find a copy of this license in LICENSE.txt in the top directory of +// the source code. +// +// Copyright 2017 Dennis Nienhüser +// + +import QtQuick 2.3 +import QtQuick.Window 2.2 + +Item { + id: root + anchors.left: parent.left + anchors.right: parent.right + height: childrenRect.height + + property bool checkable: false + property bool checked: false + property alias text: text.text + property alias icon: image.source + + signal triggered() + + Rectangle { + anchors.fill: parent + visible: root.checkable && root.checked + color: palette.highlight + radius: 3 + } + + Item { + id: container + property real padding: Screen.pixelDensity * 1 + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + height: childrenRect.height + padding + anchors.margins: padding + + Row { + anchors.leftMargin: Screen.pixelDensity * 4 + spacing: Screen.pixelDensity * 2 + id: row + + Image { + id: image + sourceSize.height: text.height + fillMode: Image.PreserveAspectFit + anchors.verticalCenter: text.verticalCenter + } + + Text { + id: text + font.pointSize: 18 + color: root.checkable && root.checked ? palette.highlightedText : palette.text + } + } + } + + MouseArea { + anchors.fill: parent + onClicked: { + if (root.checkable) { + root.checked = !root.checked + } + root.triggered() + } + } +} diff --git a/src/apps/marble-maps/PlacemarkDialog.qml b/src/apps/marble-maps/PlacemarkDialog.qml index 816ad20fd..04e4cb7b7 100644 --- a/src/apps/marble-maps/PlacemarkDialog.qml +++ b/src/apps/marble-maps/PlacemarkDialog.qml @@ -1,198 +1,199 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2015 Dennis Nienhüser // import QtQuick 2.3 import QtQuick.Window 2.2 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.3 import QtQuick.Dialogs 1.2 import org.kde.marble 0.20 Item { id: root property var placemark: null property variant map property alias showOsmTags: tagsView.visible + property bool showAccessibility: false height: placemark === null ? 0 : Screen.pixelDensity * 4 + (infoLayout.height > bookmarkButton.height ? infoLayout.height : bookmarkButton.height) onPlacemarkChanged: { if (placemark) { bookmarkButton.bookmark = bookmarks.isBookmark(placemark.longitude, placemark.latitude) } } SystemPalette { id: palette colorGroup: SystemPalette.Active } Rectangle { anchors.fill: parent color: palette.base } Bookmarks { id: bookmarks } onMapChanged: bookmarks.map = root.map Column { id: infoLayout anchors { top: parent.top left: parent.left right: bookmarkButton.left margins: Screen.pixelDensity * 2 } IconText { id: name width: parent.width visible: text.length > 0 text: placemark === null ? "" : placemark.name maximumLineCount: 2 font.pointSize: 20 } IconText { width: parent.width visible: text.length > 0 text: placemark === null ? "" : placemark.description } IconText { width: parent.width visible: text.length > 0 text: placemark === null ? "" : placemark.address maximumLineCount: 4 } IconText { width: parent.width visible: routesItem.count > 0 text: "Part of " + routesItem.count + " routes" maximumLineCount: 4 linkColor: palette.text onLinkActivated: routesDialog.open() } IconText { width: parent.width visible: url.length > 0 property string url: placemark === null ? "" : placemark.website text: "" + url + "" icon: "qrc:/material/browser.svg" maximumLineCount: 4 onLinkActivated: Qt.openUrlExternally(link) } IconText { width: parent.width visible: url.length > 0 property string url: placemark === null ? "" : placemark.wikipedia text: "Wikipedia" icon: "qrc:/material/browser.svg" maximumLineCount: 4 onLinkActivated: Qt.openUrlExternally(link) } IconText { width: parent.width visible: text.length > 0 text: placemark === null ? "" : placemark.openingHours icon: "qrc:/material/access_time.svg" } IconText { width: parent.width - visible: text.length > 0 + visible: root.showAccessibility && text.length > 0 text: placemark === null ? "" : placemark.wheelchairInfo icon: "qrc:/material/wheelchair.svg" } IconText { width: parent.width visible: text.length > 0 text: placemark === null ? "" : placemark.wifiAvailable icon: "qrc:/material/wlan-available.svg" } IconText { width: parent.width visible: text.length > 0 text: placemark === null ? "" : "" + placemark.coordinates + "" icon: "qrc:/material/place.svg" linkColor: palette.text onLinkActivated: marbleMaps.centerOnCoordinates(placemark.longitude, placemark.latitude) } ListView { id: tagsView visible: false width: parent.width height: Math.min(contentHeight, Screen.pixelDensity * 24) clip: true model: placemark ? placemark.tags : undefined delegate: IconText { width: tagsView.width; icon: "qrc:/material/label.svg" text: modelData } ScrollBar.vertical: ScrollBar {} } } Image { id: bookmarkButton anchors.right: parent.right anchors.top: parent.top anchors.margins: Screen.pixelDensity * 2 visible: root.height > 0 property bool bookmark: false width: Screen.pixelDensity * 6 height: width sourceSize.height: height sourceSize.width: width source: bookmark ? "qrc:/material/star.svg" : "qrc:/material/star_border.svg" MouseArea { id: touchArea anchors.fill: parent onClicked: { if (bookmarkButton.bookmark) { bookmarks.removeBookmark(root.placemark.longitude, root.placemark.latitude) } else { bookmarks.addBookmark(root.placemark, "Default") } bookmarkButton.bookmark = !bookmarkButton.bookmark } } } Dialog { id: routesDialog title: qsTr("Routes") RoutesItem { id: routesItem implicitWidth: parent.width model: placemark === null ? undefined : placemark.routeRelationModel onHighlightChanged: map.highlightRouteRelation(oid, enabled) } } } diff --git a/src/apps/marble-maps/Search.qml b/src/apps/marble-maps/Search.qml index 9ad1b522a..4c8dca13f 100644 --- a/src/apps/marble-maps/Search.qml +++ b/src/apps/marble-maps/Search.qml @@ -1,210 +1,189 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2015 Gábor Péterffy // import QtQuick 2.3 import QtQuick.Controls 2.0 import QtQuick.Window 2.2 import org.kde.marble 0.20 Item { id: root property var marbleQuickItem: null signal itemSelected(var suggestedPlacemark) readonly property alias searchResultPlacemark: backend.selectedPlacemark readonly property alias searchResultsVisible: searchResults.visible onVisibleChanged: { if( !visible ) { searchResults.visible = false; searchField.query = ""; } } SystemPalette { id: palette colorGroup: SystemPalette.Active } SystemPalette { id: paletteDisabled colorGroup: SystemPalette.Disabled } SearchResults { id: searchResults anchors { top: searchField.bottom left: searchField.left } width: searchField.width height: delegateHeight * Math.min(10,count) visible: false onItemSelected: { backend.setSelectedPlacemark(index); root.itemSelected(backend.selectedPlacemark); searchResults.visible = false; } } Rectangle { id: background visible: searchField.hasFocus && searchField.query === "" anchors.top: searchField.bottom anchors.left: searchField.left width: searchField.width height: childrenRect.height + 2 * itemSpacing color: palette.base property int delegateHeight: 0 property double itemSpacing: Screen.pixelDensity * 1 Column { anchors.top: parent.top anchors.topMargin: background.itemSpacing anchors.left: parent.left anchors.right: parent.right anchors.margins: background.itemSpacing spacing: background.itemSpacing ListView { id: bookmarksView anchors.left: parent.left anchors.right: parent.right height: background.delegateHeight * Math.min(6, model.count) clip: true ScrollIndicator.vertical: ScrollIndicator { } model: bookmarks.model delegate: Row { width: bookmarksView.width height: background.itemSpacing + Math.max(bookmarkIcon.height, bookmarkText.height) spacing: background.itemSpacing Image { id: bookmarkIcon anchors.verticalCenter: parent.verticalCenter source: iconPath.substr(0,1) === '/' ? "file://" + iconPath : iconPath width: Screen.pixelDensity * 4 height: width sourceSize.width: width sourceSize.height: height } Text { id: bookmarkText anchors.verticalCenter: parent.verticalCenter anchors.leftMargin: Screen.pixelDensity * 2 width: bookmarksView.width - bookmarksView.spacing - bookmarkIcon.width text: display font.pointSize: 18 color: palette.text elide: Text.ElideMiddle MouseArea { anchors.fill: parent onClicked: { bookmarksView.currentIndex = index app.selectedPlacemark = bookmarks.placemark(index); itemSelected(bookmarks.placemark(index)) marbleMaps.centerOn(selectedPlacemark.longitude, selectedPlacemark.latitude) dialogLoader.focus = true } } } onHeightChanged: { if( background.delegateHeight !== height ) { background.delegateHeight = height; } } } } Row { visible: bookmarksView.model.count === 0 width: parent.width Text { anchors.bottom: parent.bottom width: 0.8 * parent.width font.pointSize: 18 color: paletteDisabled.text text: qsTr("Your bookmarks will appear here.") wrapMode: Text.WrapAtWordBoundaryOrAnywhere elide: Text.ElideRight } Image { anchors.bottom: parent.bottom width: 0.2 * parent.width fillMode: Image.PreserveAspectFit source: "qrc:/konqi/books.png" } } - - Rectangle { - height: 1 - width: parent.width - color: "gray" - } - - Text { - font.pointSize: 18 - color: palette.text - width: parent.width - text: qsTr("About Marble Maps…") - elide: Text.ElideRight - MouseArea { - anchors.fill: parent - onClicked: { - app.state = "about" - dialogLoader.focus = true - } - } - } } } SearchBackend { id: backend marbleQuickItem: root.marbleQuickItem onSearchResultChanged: { searchResults.model = model; searchResults.visible = true; } onSearchFinished: searchField.busy = false } SearchField { id: searchField width: parent.width - 2 * anchors.margins <= Screen.pixelDensity * 70 ? parent.width - 2 * anchors.margins : Screen.pixelDensity * 50 anchors { top: parent.top left: parent.left margins: Screen.pixelDensity * 3 } completionModel: backend.completionModel onSearchRequested: backend.search(query) onCompletionRequested: backend.setCompletionPrefix(query) onCleared: searchResults.visible = false } Bookmarks { id: bookmarks map: root.marbleQuickItem } } diff --git a/src/apps/marble-maps/SidePanel.qml b/src/apps/marble-maps/SidePanel.qml new file mode 100644 index 000000000..e8c8668b2 --- /dev/null +++ b/src/apps/marble-maps/SidePanel.qml @@ -0,0 +1,89 @@ +// +// This file is part of the Marble Virtual Globe. +// +// This program is free software licensed under the GNU LGPL. You can +// find a copy of this license in LICENSE.txt in the top directory of +// the source code. +// +// Copyright 2017 Dennis Nienhüser +// + +import QtQuick 2.3 +import QtQuick.Controls 2.0 +import QtQuick.Window 2.2 +import org.kde.marble 0.20 + +Drawer { + id: root + + property var marbleMaps + signal aboutActionTriggered() + + + Settings { + id: settings + + property bool showUpdateInfo: Number(value("MarbleMaps", "updateInfoVersion", "0")) < 1 + + Component.onDestruction: { + settings.setValue("MarbleMaps", "showAccessibility", accessibilityAction.checked ? "true" : "false") + settings.setValue("MarbleMaps", "showPublicTransport", publicTransportAction.checked ? "true" : "false") + } + } + + Column { + id: drawerContent + anchors.fill: parent + spacing: Screen.pixelDensity * 2 + + Image { + source: "drawer.svg" + width: parent.width + sourceSize.width: width + fillMode: Image.PreserveAspectFit + } + + MenuIcon { + id: publicTransportAction + anchors.leftMargin: Screen.pixelDensity * 2 + anchors.rightMargin: anchors.leftMargin + + checkable: true + checked: settings.value("MarbleMaps", "showPublicTransport", "false") === "true" + text: qsTr("Public Transport") + icon: "qrc:/material/bus.svg" + onTriggered: { + root.marbleMaps.showPublicTransport = checked + root.close() + } + } + + MenuIcon { + id: accessibilityAction + anchors.leftMargin: Screen.pixelDensity * 2 + anchors.rightMargin: anchors.leftMargin + checkable: true + checked: settings.value("MarbleMaps", "showAccessibility", "false") === "true" + text: qsTr("Accessibility") + icon: "qrc:/material/wheelchair.svg" + onTriggered: root.close() + } + + Rectangle { + width: parent.width + height: 1 + color: "gray" + } + + MenuIcon { + text: qsTr("About Marble Maps…") + anchors.leftMargin: Screen.pixelDensity * 2 + anchors.rightMargin: anchors.leftMargin + onTriggered: { + root.close() + root.aboutActionTriggered() + } + } + } + +} diff --git a/src/apps/marble-maps/drawer.svg b/src/apps/marble-maps/drawer.svg new file mode 100644 index 000000000..55d98c267 --- /dev/null +++ b/src/apps/marble-maps/drawer.svg @@ -0,0 +1 @@ + diff --git a/src/apps/marble-maps/material-icons/ic_directions_bus_48px.svg b/src/apps/marble-maps/material-icons/ic_directions_bus_48px.svg new file mode 100644 index 000000000..31d876057 --- /dev/null +++ b/src/apps/marble-maps/material-icons/ic_directions_bus_48px.svg @@ -0,0 +1 @@ + \ No newline at end of file