diff --git a/src/apps/marble-maps/Bookmarks.qml b/src/apps/marble-maps/Bookmarks.qml new file mode 100644 --- /dev/null +++ b/src/apps/marble-maps/Bookmarks.qml @@ -0,0 +1,135 @@ +// +// 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 2016 Dennis Nienhüser +// + +import QtQuick 2.4 +import QtQuick.Controls 1.4 +import QtQuick.Window 2.2 +import QtQuick.Layouts 1.3 +import QtGraphicalEffects 1.0 + +import org.kde.kirigami 2.0 as Kirigami + +import org.kde.marble 0.20 +Kirigami.ScrollablePage { + id: root + property int currentIndex: 0 + property var marbleQuickItem: null + + SystemPalette{ + id: palette + colorGroup: SystemPalette.Active + } + + Rectangle { + anchors.fill: parent + color: palette.base + } + + Column { + id: column + anchors { + fill: parent + margins: Screen.pixelDensity * 2 + } + + Text { + text: "

Bookmarks

" + } + + ListView { + id: bookmarksView + width: parent.width + interactive: false + spacing: 5 + height: contentHeight + model: bookmarks.model + + delegate: + Rectangle { + width: parent.width + height: Screen.pixelDensity * 2 + Math.max(text.height, imageButton.height) + color: palette.base + + Image { + id: imageButton + anchors { + left: parent.left + verticalCenter: parent.verticalCenter + } + source: "qrc:///material/place.svg" + width: Screen.pixelDensity * 6 + height: width + smooth: true + } + + ColorOverlay{ + anchors.fill: imageButton + source: imageButton + color: palette.highlight + } + + Text { + id: text + anchors { + left: imageButton.right + leftMargin: parent.width * 0.05 + verticalCenter: parent.verticalCenter + } + elide: Text.ElideMiddle + text: model.display + font.pointSize: 12 + color: palette.text + } + + + Image { + id: upButton + anchors{ + verticalCenter: parent.verticalCenter + right: parent.right + } + width: Screen.pixelDensity * 6 + height: width + source: "qrc:///material/drag.png" + smooth: true + } + } + } + + Column { + visible: bookmarksView.model.count === 0 + width: parent.width + + Text { + 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.right: parent.right + anchors.bottom: root.bottom + width: 0.3 * parent.width + fillMode: Image.PreserveAspectFit + source: "qrc:/konqi/books.png" + } + } + } + + Bookmarks { + id: bookmarks + map: root.marbleQuickItem + } +} + + diff --git a/src/apps/marble-maps/MainScreen.qml b/src/apps/marble-maps/MainScreen.qml --- a/src/apps/marble-maps/MainScreen.qml +++ b/src/apps/marble-maps/MainScreen.qml @@ -127,6 +127,15 @@ } }, Kirigami.Action { + text: "Bookmarks" + iconName: "qrc:///material/star.svg" + onTriggered: { + app.state = "bookmarks" + sidePanel.close() + app.pageStack.push("qrc:///Bookmarks.qml") + } + }, + Kirigami.Action { text: "Layer Options" iconName: "qrc:///settings.png" onTriggered: { @@ -136,6 +145,13 @@ } } ] + + Binding { + target: pageStack.currentItem + property: "marbleQuickItem" + value: marbleMaps + when: app.state === "bookmarks" + } } pageStack.initialPage: page @@ -458,8 +474,9 @@ Loader { id: dialogLoader - focus: true + width: childrenRect.width + height : childrenRect.height anchors { left: parent.left @@ -561,6 +578,10 @@ State { name: "options" PropertyChanges { target: dialogLoader; source: "" } + }, + State { + name: "bookmarks" + PropertyChanges { target: dialogLoader; source: "" } } ] } diff --git a/src/apps/marble-maps/MarbleMaps.qrc b/src/apps/marble-maps/MarbleMaps.qrc --- a/src/apps/marble-maps/MarbleMaps.qrc +++ b/src/apps/marble-maps/MarbleMaps.qrc @@ -31,6 +31,7 @@ PublicTransport.qml OutdoorActivities.qml Options.qml + Bookmarks.qml drawer.svg ../../../data/android/drawable-xxxhdpi/search.png ../../../data/android/drawable-xxxhdpi/ic_menu_black_48dp.png @@ -91,5 +92,6 @@ RouteProfileRadioButton.qml MarbleScrollBar.qml material-icons/ic_phone_black_48px.svg + material-icons/ic_drag_handle_black_48dp.png diff --git a/src/apps/marble-maps/material-icons/ic_drag_handle_black_48dp.png b/src/apps/marble-maps/material-icons/ic_drag_handle_black_48dp.png new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@