diff --git a/src/apps/CMakeLists.txt b/src/apps/CMakeLists.txt index ca4d58135..66a738f83 100644 --- a/src/apps/CMakeLists.txt +++ b/src/apps/CMakeLists.txt @@ -1,14 +1,11 @@ option(BUILD_MARBLE_APPS "Build the main Marble applications" ON) if(BUILD_MARBLE_APPS) if (NOT CMAKE_SYSTEM_NAME STREQUAL Android) add_subdirectory(marble-ui) add_subdirectory(marble-qt) add_subdirectory(marble-kde) - if( Qt5Quick_FOUND ) - add_subdirectory(marble-touch) - endif( Qt5Quick_FOUND ) endif() add_subdirectory(behaim) add_subdirectory(marble-maps) endif() diff --git a/src/apps/marble-touch/AboutMarblePage.qml b/src/apps/marble-touch/AboutMarblePage.qml deleted file mode 100644 index 5543088f7..000000000 --- a/src/apps/marble-touch/AboutMarblePage.qml +++ /dev/null @@ -1,232 +0,0 @@ -// 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 2011 Dennis Nienhüser - -import QtQuick 2.3 -import org.kde.edu.marble 0.20 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.2 - -/* - * Page for geocaching activity. - */ -Item { - id: geocachingActivityPage - anchors.fill: parent - - RowLayout { - id: toolBar - anchors.fill: parent - ToolButton { - text: "Home" - onClicked: activitySelection.showActivities() - } - } - - MarbleTouch { id: project } - - Rectangle { - anchors.fill: parent - color: "white" - } - - Flickable { - id: pageContent - anchors.fill: parent - contentHeight: contentColumn.height - clip: true - - Column { - id: contentColumn - anchors.left: parent.left - anchors.right: parent.right - anchors.leftMargin: 10 - anchors.rightMargin: 20 - spacing: 12 - - Image { - source: "qrc:/../../../data/svg/marble-logo.svg" - anchors.horizontalCenter: parent.horizontalCenter - } - - Label { - text: "Find your way and explore the world with Marble" - font.pixelSize: 20 - width: parent.width - horizontalAlignment: Text.AlignHCenter - } - - Label { - text: "

This is Marble Touch version " + project.version + " (" + project.status + "). Marble is a Virtual Globe and World Atlas. It is part of the KDE Software Compilation and distributed under the terms of the LGPL, Version 2. Marble is Open Source; we create free source code and endorse free maps and free data. Please visit the Marble website for further information.

" - font.pixelSize: 16 - width: parent.width - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - horizontalAlignment: Text.AlignJustify - onLinkActivated: Qt.openUrlExternally(link) - } - - Label { - text: "

© 2007-2011 by the authors of Marble Virtual Globe. Please report bugs and file feature requests at bugs.kde.org. We're looking forward to your feedback! You can reach the developers of the Marble project at marble-devel@kde.org.

" - font.pixelSize: 16 - width: parent.width - horizontalAlignment: Text.AlignJustify - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - onLinkActivated: Qt.openUrlExternally(link) - } - - Label { - text: "Changelog" - font.pixelSize: 20 - width: parent.width - horizontalAlignment: Text.AlignHCenter - } - - Column { - spacing: 5 - Repeater { - model: project.changelog - Row { - id: changelogRow - spacing: 10 - Label { - id: versionLabel - font.pixelSize: 16 - text: "Version " + version - } - Label { - font.pixelSize: 16 - text: summary; - width: contentColumn.width - versionLabel.width - changelogRow.spacing - } - } - } - } - - Label { - text: "Authors" - font.pixelSize: 20 - width: parent.width - horizontalAlignment: Text.AlignHCenter - } - - Label { - text: "

Active Development Team of Marble: Torsten Rahn (Developer and Original Author), Bernhard Beschow (WMS Support, Mobile, Performance), Thibaut Gridel (Geodata), Jens-Michael Hoffmann (OpenStreetMap Support, Download Management), Florian Eßer (Elevation Profile), Wes Hardaker (Amateur Radio Support), Bastian Holst (Online Services Support), Guillaume Martres (Satellites), Friedrich W. H. Kossebau (Plasma Integration, Bugfixes), Dennis Nienhüser (Routing, Navigation, Mobile), Niko Sams (Routing, Elevation Profile), Patrick Spendrin (KML and Windows Support), Eckhart Wörner (Bugfixes).

" - font.pixelSize: 16 - width: parent.width - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - horizontalAlignment: Text.AlignJustify - } - - Label { - text: "

Developers: Médéric Boquien (Astronomical Observatories), Harshit Jain (Planet Filter, Bugfixes), Andrew Manson (Proxy Support), Pino Toscano (Network plugins), Henry de Valence (Marble Runners, World-Clock Plasmoid), Magnus Valle (Historical Maps), Inge Wallin (Original Co-Maintainer).

" - font.pixelSize: 16 - width: parent.width - horizontalAlignment: Text.AlignJustify - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - } - - Label { - text: "

Development and Patches:: Simon Schmeisser, Claudiu Covaci, David Roberts, Nikolas Zimmermann, Jan Becker, Stefan Asserhäll, Laurent Montel, Prashanth Udupa, Anne-Marie Mahfouf, Josef Spillner, Frerich Raabe, Frederik Gladhorn, Fredrik Höglund, Albert Astals Cid, Thomas Zander, Joseph Wenninger, Kris Thomsen, Daniel Molkentin.

" - font.pixelSize: 16 - width: parent.width - horizontalAlignment: Text.AlignJustify - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - } - - Label { - text: "

Platforms and Distributions: Tim Sutton, Christian Ehrlicher, Ralf Habacker, Steffen Joeris, Marcus Czeslinski, Marcus D. Hanwell, Chitlesh Goorah, Sebastian Wiedenroth, Christophe Leske.

" - font.pixelSize: 16 - width: parent.width - horizontalAlignment: Text.AlignJustify - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - } - - Label { - text: "

Artwork: Nuno Pinheiro, Torsten Rahn.

" - font.pixelSize: 16 - width: parent.width - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - } - - Label { - text: "

Various Suggestions and Testing: Stefan Jordan, Robert Scott, Lubos Petrovic, Benoit Sigoure, Martin Konold, Matthias Welwarsky, Rainer Endres, Luis Silva, Ralf Gesellensetter, Tim Alder.

" - font.pixelSize: 16 - width: parent.width - horizontalAlignment: Text.AlignJustify - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - } - - Label { - text: "

Student programs (GSOC, GCI, SOCIS): Guillaume Martres, Utku Aydın, Daniel Marth, Cezar Mocan, Furkan Üzümcü, Konstantin Oblaukhov, Daniel Marth, Gaurav Gupta, Harshit Jain, Siddharth Srivastava, Andrew Manson, Bastian Holst. Patrick Spendrin, Shashank Singh, Carlos Licea, Andrew Manson, Murad Tagirov. And of course we'd like to thank the people at Google and ESA for making these projects possible.

" - font.pixelSize: 16 - width: parent.width - horizontalAlignment: Text.AlignJustify - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - } - - Label { - text: "

We'd especially like to thank John Layt who provided an important source of inspiration by creating Marble's predecessor \"Kartographer\".

" - font.pixelSize: 16 - width: parent.width - horizontalAlignment: Text.AlignJustify - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - } - - Label { - text: "Data" - font.pixelSize: 20 - width: parent.width - horizontalAlignment: Text.AlignHCenter - } - - Label { - text: "

Maps: Blue Marble Next Generation (500 m / pixel). NASA Goddard Space Flight Center Earth Observatory http://earthobservatory.nasa.gov/Newsroom/BlueMarble/. Earth's City Lights. Data courtesy Marc Imhoff of NASA GSFC and Christopher Elvidge of NOAA NGDC. Image by Craig Mayhew and Robert Simmon, NASA GSFC. Shuttle Radar Topography Mission (SRTM30, 1 km / pixel ). NASA Jet Propulsion Laboratory http://www2.jpl.nasa.gov/srtm/. Micro World Data Bank in Polygons (\"MWDB-POLY / MWDBII\"). CIA ; Global Associates, Ltd.; Fred Pospeschil and Antonio Rivera. Temperature and Precipitation Maps (July and December). A combination of two datasets: Legates, D.R. and Willmott, C.J. 1989. Average Monthly Surface Air Temperature and Precipitation. Digital Raster Data on a .5 degree Geographic (lat/long) 361x721 grid (centroid-registered on .5 degree meridians). Boulder CO: National Center for Atmospheric Research. http://www.ngdc.noaa.gov/ecosys/cdroms/ged_iia/datasets/a04/lw.htm. CRU CL 2.0: New, M., Lister, D., Hulme, M. and Makin, I., 2002: A high-resolution data set of surface climate over global land areas. Climate Research 21.http://www.cru.uea.ac.uk/cru/data/hrg.

" - font.pixelSize: 16 - width: parent.width - horizontalAlignment: Text.AlignJustify - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - } - - Label { - text: "

Street Maps. OpenStreetMap. The street maps used in Marble via download are provided by the OpenStreetMap Project (\"OSM\"). OSM is an open community which creates free editable maps. License: OpenStreetMap data can be used freely under the terms of the Creative Commons Attribution-ShareAlike 2.0 license. Icons. Some icons are taken from SJJB Management and NounProject. These icons can be used freely under the terms of the CC0 1.0 Universal license. OpenRouteService. Some of the routes used in Marble via download are provided by the OpenRouteService Project (\"ORS\"). License: OpenRouteService data can be used freely under the terms of the Creative Commons Attribution-ShareAlike 2.0 license. Open Source Routing Machine. Some of the routes used in Marble via download are provided by the Open Source Routing Machine Project (\"OSRM\"). License: Open Source Routing Machine data can be used freely under the terms of the Creative Commons Attribution-ShareAlike 2.0 license. MapQuest. Some of the routes used in Marble via download are provided by MapQuest (www.mapquest.com) and their Open Data Map APIs and Web Services. Directions courtesy of MapQuest working on OpenStreetMap data that can be used freely under the terms of the Creative Commons Attribution-ShareAlike 2.0 license. Usage of the MapQuest routing service is subject to the MapQuest terms of use (http://info.mapquest.com/terms-of-use/).

" - font.pixelSize: 16 - width: parent.width - horizontalAlignment: Text.AlignJustify - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - } - - Label { - text: "

Cities and Locations. World Gazetteer. Stefan Helders http://www.world-gazetteer.com. Geonames.org. http://www.geonames.org/License: Geonames.org data can be used freely under the terms of the Creative Commons Attribution 3.0 license. Czech Statistical Office. Public database http://www.czso.cz.

" - font.pixelSize: 16 - width: parent.width - horizontalAlignment: Text.AlignJustify - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - } - - Label { - text: "

Flags. Flags of the World. The flags were taken from Wikipedia (http://www.wikipedia.org) which in turn took a subset from http://www.openclipart.org and reworked them. All flags are under the public domain (see comments inside the svg files).

" - font.pixelSize: 16 - width: parent.width - horizontalAlignment: Text.AlignJustify - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - } - - Label { - text: "

Stars. The Bright Star Catalogue. 5th Revised Ed. (Preliminary Version) Hoffleit D., Warren Jr W.H., Astronomical Data Center, NSSDC/ADC (1991) http://adc.gsfc.nasa.gov.

" - font.pixelSize: 16 - width: parent.width - horizontalAlignment: Text.AlignJustify - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - } - } - } - - Component.onCompleted: { - settings.changelogShown = project.version - mainWindow.toolBar.replaceWith(toolBar) - } -} diff --git a/src/apps/marble-touch/ActivitySelectionView.qml b/src/apps/marble-touch/ActivitySelectionView.qml deleted file mode 100644 index 9db13eb28..000000000 --- a/src/apps/marble-touch/ActivitySelectionView.qml +++ /dev/null @@ -1,267 +0,0 @@ -// 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 2011 Dennis Nienhüser -// Copyright 2011 Daniel Marth - -import QtQuick 2.3 -import org.kde.edu.marble 0.20 - -/* - * Page to select activity. This component also contains the model for - * the activities, which stores all relevant information. - */ -Item { - id: activityPage - - Item { - id: pageContainer - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: changelog.visible ? changelog.top : parent.bottom - visible: true - - Rectangle { - anchors.fill: parent - color: "black" - } - - Loader { - id: pageLoader - anchors.fill: parent - } - } - - property alias model: activityView.model - property bool shown: false - - signal itemSelected - - Loader { - id: lazyLoader - } - - Image { - anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.margins: 20 - source: "qrc:/marble/globe.svg" - smooth: true - width: 360 - height: 360 - opacity: 0.1 - } - - // Grid view to display images and names of activities. - ListView { - id: activityView - currentIndex: -1 - anchors.top: parent.top - anchors.topMargin: 4 - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: changelog.visible ? changelog.top : parent.bottom - //anchors.margins: 9 - //anchors.leftMargin: 2 - model: activityModel - focus: true - clip: true - spacing: 3 - width: parent.width - height: parent.height - - delegate: - Item { - - id: delegateItem - property bool mouseOver: mouseTracker.containsMouse - - width: activityView.width - height: 47 - - Rectangle { - color: delegateItem.mouseOver ? "#dddddd" : "white" - radius: 10 - anchors.fill: parent - - Row { - anchors.verticalCenter: parent.verticalCenter - spacing: 5 - width: 140 - height: parent.height - smooth: true - - Item { - width: 2 - height: parent.height - } - - Image { - id: activityImage - anchors.verticalCenter: parent.verticalCenter - height: 36 - width: height - source: imagePath - smooth: true - } - - Text { - anchors.verticalCenter: parent.verticalCenter - color: delegateItem.mouseOver ? "#111111" : "black" - text: name - width: 180 - font.bold: true - } - } - - MouseArea { - id: mouseTracker - anchors.fill: parent - hoverEnabled: true - } - } - - MouseArea { - anchors.fill: parent - onClicked: { - activityPage.itemSelected() - activityPage.openActivity( name, path ) - } - } - } - } - - Text { - id: changelog - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: 10 - font.pixelSize: 16 - visible: settings.changelogShown !== project.version - color: "white" - text: "New in version " + project.changelog.get(0).version + ": " + project.changelog.get(0).summary - MarbleTouch { id: project } - MouseArea { - anchors.fill: parent - onClicked: openActivity( "qrc:/AboutMarblePage.qml" ) - } - } - - // Model that stores information about activities. - ListModel { - id: activityModel - property string configureIcon: main.icon( "actions/configure", 48 ); - - ListElement { - name: "Virtual Globe" - imagePath: "qrc:/icons/activity-virtualglobe.png" - path: "qrc:/activities/VirtualGlobe.qml" - } - - ListElement { - name: "Search" - imagePath: "qrc:/icons/activity-search.png" - path: "qrc:/activities/Search.qml" - } - ListElement { - name: "Routing" - imagePath: "qrc:/icons/activity-routing.png" - path: "qrc:/activities/Routing.qml" - } - ListElement { - name: "Tracking" - imagePath: "qrc:/icons/activity-tracking.png" - path: "qrc:/activities/Tracking.qml" - } - ListElement { - name: "Navigation" - imagePath: "qrc:/icons/activity-navigation.png" - path: "qrc:/activities/Navigation.qml" - } - ListElement { - name: "Weather" - imagePath: "qrc:/icons/activity-weather.png" - path: "qrc:/activities/Weather.qml" - } - ListElement { - name: "Community" - imagePath: "qrc:/icons/activity-friends.png" - path: "qrc:/activities/Friends.qml" - } - ListElement { - name: "Space View" - imagePath: "qrc:/icons/activity-spaceview.png" - path: "qrc:/activities/SpaceView.qml" - } - ListElement { - name: "Explore" - imagePath: "qrc:/icons/activity-explore.png" - path: "qrc:/activities/Explore.qml" - } - ListElement { - name: "Info" - imagePath: "qrc:/icons/information.png" - path: "qrc:/AboutMarblePage.qml" - } - ListElement { - name: "Preferences" - imagePath: "qrc:/icons/preferences.png" - path: "qrc:/PreferencesPage.qml" - } - } - - function openActivity( name ) { - for ( var i=0; i - -import QtQuick 2.3 -import QtMultimediaKit 1.1 -import com.nokia.meego 1.0 -import org.kde.edu.marble 0.20 - -Page { - id: cloudSyncPage - - tools: ToolBarLayout { - MarbleToolIcon { - iconSource: main.icon( "actions/go-previous-view", 48 ); - onClicked: pageStack.pop() - } - } - - Row { - id: syncSetting - anchors.top: parent.top - anchors.left: parent.left - anchors.margins: 10 - - Label { - id: syncLabel - width: 142 - text: "Sync:" - anchors.verticalCenter: parent.verticalCenter - } - Switch { - id: syncSwitch - checked: settings.owncloudSync - anchors.verticalCenter: parent.verticalCenter - onCheckedChanged: settings.owncloudSync = checked - } - } - Rectangle { - width: parent.width - anchors.left: parent.left - anchors.top: syncSetting.bottom - anchors.right: parent.right - anchors.margins: 10 - - Column { - id: labelsColumn - width: 140 - spacing: 35 - anchors.top: parent.top - anchors.topMargin: 12 - Label { - text: "Server:" - } - Label { - text: "Username:" - } - Label { - text: "Password:" - } - } - Column { - anchors.left: labelsColumn.right - anchors.right: parent.right - spacing: 10 - TextField { - text: settings.owncloudServer - width: parent.width - readOnly: !syncSwitch.checked - onAccepted: settings.owncloudServer = text - } - TextField { - text: settings.owncloudUsername - width: parent.width - readOnly: !syncSwitch.checked - onAccepted: settings.owncloudUsername = text - } - TextField { - text: settings.owncloudPassword - echoMode: TextInput.Password - width: parent.width - readOnly: !syncSwitch.checked - onAccepted: settings.owncloudPassword = text - } - } - } -} diff --git a/src/apps/marble-touch/MainWidget.qml b/src/apps/marble-touch/MainWidget.qml deleted file mode 100644 index 74204c29b..000000000 --- a/src/apps/marble-touch/MainWidget.qml +++ /dev/null @@ -1,311 +0,0 @@ -// 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 2011 Dennis Nienhüser -// Copyright 2011 Daniel Marth -// Copyright 2013 Bernhard Beschow - -import QtQuick 2.3 -import org.kde.edu.marble 0.20 - -/* - * Main widget containing the map, models for routing, search, etc. - * - * @todo: Rename MarbleWidget or similar - */ -Item { - id: screen - anchors.fill: parent - visible: false - - signal mouseClickGeoPosition(real longitude, real latitude) - signal placemarkSelected(variant placemark) - - property alias mapThemeModel: map.mapThemeModel - property alias radius: map.radius - - property alias bookmarks: map.bookmarks - property alias routing: map.routing - property alias search: map.search - property alias tracking: map.tracking - property alias navigation: map.navigation - property alias cloudSync: map.cloudSync - - // The widget representing the map. - MarbleWidget { - id: map - anchors.fill: parent - - /** @todo: This property looks cumbersome... get rid of it */ - property bool initialized: false - - workOffline: settings.workOffline - mapThemeId: settings.mapTheme - radius: settings.quitRadius - projection: settings.projection - activeFloatItems: [ "compass", "scalebar", "progress" ] - activeRenderPlugins: settings.activeRenderPlugins - - property Bookmarks bookmarks: Bookmarks { - map: map - } - - property Routing routing: Routing { - marbleMap: map.marbleMap - } - - // The grouped property "tracking" provides access to tracking related - // properties. - property Tracking tracking: Tracking { - // Connect the position source from below with the map. - map: map - positionSource: positionProvider - showTrack: settings.showTrack - positionMarker: marker - - onLastKnownPositionChanged: { - settings.lastKnownLongitude = map.tracking.lastKnownPosition.longitude - settings.lastKnownLatitude = map.tracking.lastKnownPosition.latitude - map.updatePositionIndicator() - } - } - - property Navigation navigation: Navigation { - map: map - muted: settings.voiceNavigationMuted - speaker: settings.voiceNavigationSpeaker - soundEnabled: settings.voiceNavigationSoundEnabled - } - - property CloudSync cloudSync: CloudSync { - id: cloudSync - map: map - owncloudServer: settings.owncloudServer - owncloudUsername: settings.owncloudUsername - owncloudPassword: settings.owncloudPassword - } - - Component.onCompleted: { - mouseClickGeoPosition.connect( screen.mouseClickGeoPosition ) - - // Load last center of the map. - center.longitude = settings.quitLongitude - center.latitude = settings.quitLatitude - tracking.lastKnownPosition.longitude = settings.lastKnownLongitude - tracking.lastKnownPosition.latitude = settings.lastKnownLatitude - initialized = true - } - - Component.onDestruction: { - settings.quitRadius = radius - settings.quitLongitude = center.longitude - settings.quitLatitude = center.latitude - } - - property Find search: Find { - map: map - // Delegate of a search result. - /** @todo: Simplify this beast */ - placemarkDelegate: - Image { - id: searchDelegate - source: "qrc:/icons/placemark.svg" - transformOrigin: Item.Bottom - width: 32 - fillMode: Image.PreserveAspectFit - smooth: true - - Text { - text: (index+1) - width: 32 - height: 32 - anchors.top: parent.top - anchors.left: parent.left - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - color: "white" - font.bold: true - font.pixelSize: 20 - } - - Rectangle { - id: routingOptions - visible: false - color: "white" - width: 250 - height: nameLabel.height + routingButtons.height + 30 - border.width: 1 - border.color: "gray" - radius: 10 - // Name of the search result. - Text { - id: nameLabel - text: name - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: 10 - font.pixelSize: 18 - - MouseArea { - anchors.fill: parent - onClicked: routingOptions.visible = false - } - } - // Route button - Column { - id: routingButtons - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - anchors.bottomMargin: 10 - spacing: 5 - Rectangle { - color: "white" - width: 230 - height: 35 - border.width: 1 - border.color: "gray" - radius: 10 - Text { - text: "Route" - anchors.centerIn: parent - font.pixelSize: 18 - } - MouseArea { - anchors.fill: parent - onClicked: { - routingOptions.visible = false - settings.gpsTracking = true - map.routing.clearRoute() - map.routing.setVia( 0, map.tracking.lastKnownPosition.longitude, map.tracking.lastKnownPosition.latitude ) - map.routing.setVia( 1, longitude, latitude ) - openActivity( "Routing" ) - } - } - } - } - } - // Show search result info if the placemark is clicked. - MouseArea { - anchors.fill: parent - onClicked: { - routingOptions.visible = !routingOptions.visible - } - } - - Connections { - target: map - onMouseClickGeoPosition: routingOptions.visible = false - } - } - } - - onPlacemarkSelected: { - pageStack.find(function(page) { - // Open the Placemark activity unless it's already the top most page - // id is not a QML Item property, hence the uid workaround - if (page.uid !== "edu.kde.org.marble.placemarkActivityPage") { - openPage("qrc:/activities/Placemark.qml"); - } - return true; - }) - screen.placemarkSelected(placemark) - } - } - - // Delivers the current (gps) position. - PositionSource { - id: positionProvider - - map: map - - // Can optionally be used to select a specific position provider - // plugin of marble. Per default the first one is used. - // The value is the nameId() of an installed Marble PositionProviderPlugin, - // e.g. Gpsd - source: "QtMobilityPositionProviderPlugin" - - // This starts/stops gps tracking. - active: settings.gpsTracking - - // Start a small grow/shrink animation of the marker to indicate position updates. - onPositionChanged: { - growAnimation.running = true - } - } - - // A marker that indicates the current position. - Image { - id: marker - width: 60 - fillMode: Image.PreserveAspectFit - smooth: true - source: positionProvider.hasPosition ? "qrc:/icons/marker.svg" : "qrc:/icons/marker-yellow.svg" - visible: false - - // Animation that grows/shrinks the marker. - PropertyAnimation on x { duration: 300; easing.type: Easing.OutBounce } - PropertyAnimation on y { duration: 300; easing.type: Easing.OutBounce } - SequentialAnimation { - id: growAnimation - PropertyAnimation { - target: marker - properties: "scale" - to: 1.2 - duration: 150 - } - PropertyAnimation { - target: marker - properties: "scale" - to: 1.0 - duration: 150 - } - } - } - - PositionIndicator { - anchors.fill: parent - visible: settings.showPositionIndicator - - map: map - tracking: tracking - } - - // Starts a search for the passed term. - function find( term ) { - map.search.find( term ) - } - - // Centers map on passed coordinates. - function centerOn( lon, lat ) { - map.center.longitude = lon - map.center.latitude = lat - } - - function setGeoSceneProperty( key, value ) { - map.setGeoSceneProperty( key, value ) - } - - function downloadRoute( offset, from, to ) { - map.downloadRoute( offset, from, to ) - } - - function downloadArea( from, to ) { - map.downloadArea( from, to ) - } - - function getCenter() { - return map.center - } - - function setDataPluginDelegate( id, delegate ) { - map.setDataPluginDelegate( id, delegate ) - } - - function renderPlugin( name ) { - return map.renderPlugin( name ) - } -} diff --git a/src/apps/marble-touch/MapThemePage.qml b/src/apps/marble-touch/MapThemePage.qml deleted file mode 100644 index a3e26da5d..000000000 --- a/src/apps/marble-touch/MapThemePage.qml +++ /dev/null @@ -1,231 +0,0 @@ -// 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 2012 Dennis Nienhüser - -import QtQuick 2.3 -import org.kde.edu.marble 0.20 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.2 - -Item { - id: preferencesPage - - RowLayout { - id: toolBar - anchors.fill: parent - ToolButton { - text: "Home" - onClicked: activitySelection.showActivities() - } - } - - NewstuffModel { - id: themeInstallModel - provider: "http://edu.kde.org/marble/newstuff/maps-4.5.xml" - registryFile: "~/.kde/share/apps/knewstuff3/marble.knsregistry" - } - - ListView { - id: themeView - anchors.fill: parent - anchors.margins: 5 - model: themeInstallModel - delegate: themeDelegate - highlight: Rectangle { radius: 5; color: "lightsteelblue" } - highlightMoveDuration: 200 - spacing: 10 - currentIndex: -1 - } - - Component { - id: themeDelegate - - Item { - id: delegateRoot - width: parent.width - height: row.height - property bool installing: transitioning - property bool selected: ListView.view.currentIndex === idx - property bool showDetails: selected || installing - property int idx: index - - Row { - id: row - spacing: 10 - - Item { - width: previewIcon.width - height: Math.max(previewIcon.height + (delegateRoot.showDetails ? versionLabel.height + 5 : 0), textItem.height) - - Image { - id: previewIcon - anchors.top: parent.top - source: settings.workOffline ? "" : preview - width: 136 - height: 136 - - Image { - id: fallbackIcon - anchors.centerIn: parent - source: "qrc:/icons/activity-virtualglobe.png" - width: 128 - height: 128 - opacity: (previewIcon.status == Image.Loading || settings.workOffline) ? 1.0 : 0.0 - Behavior on opacity { NumberAnimation {} } - } - } - - Label { - id: versionLabel - width: parent.width - anchors.top: previewIcon.bottom - anchors.topMargin: 5 - visible: delegateRoot.showDetails - text: delegateRoot.showDetails ? "

Version: " + version + "
" + releasedate + "
" + formatSize() + "

" : "" - - function formatSize() { - if (settings.workOffline) { - return "" - } - - var length = size - - if (length<0) { - return "" - } - - var unit = 0 - for (var i=0; i<9 && length >= 1000; ++i) { - length /= 1000.0 - ++unit - } - - switch (unit) { - case 0: return length.toFixed(1) + " byte" - case 1: return length.toFixed(1) + " kB" - case 2: return length.toFixed(1) + " MB" - case 3: return length.toFixed(1) + " GB" - case 4: return length.toFixed(1) + " TB" - case 5: return length.toFixed(1) + " PB" - case 6: return length.toFixed(1) + " EB" - case 7: return length.toFixed(1) + " ZB" - case 8: return length.toFixed(1) + " YB" - } - } - } - } - - Item { - id: textItem - width: delegateRoot.width - row.spacing - previewIcon.width - 10 - height: nameLabel.height + summaryLabel.height + (delegateRoot.showDetails ? installButton.height + 10 : 0) - - Label { - id: nameLabel - width: parent.width - text: display - font.bold: upgradable - } - - Label { - id: summaryLabel - width: parent.width - anchors.top: nameLabel.bottom - property string details: "

Author: " + author + "

License: " + license + "

" - text: "

" + summary + (delegateRoot.showDetails ? details : "") + "

" - } - - ProgressBar { - id: progressBar - visible: delegateRoot.installing - anchors.top: summaryLabel.bottom - width: parent.width - 50 - anchors.margins: 20 - minimumValue: 0.0 - maximumValue: 1.0 - indeterminate: true - - Connections { - target: themeInstallModel - onInstallationProgressed: { - if (newstuffindex === delegateRoot.idx) { - progressBar.indeterminate = false - progressBar.value = progress - } - } - onInstallationFinished: { - if (newstuffindex === delegateRoot.idx) { - delegateRoot.installing = false - } - } - onInstallationFailed: { - if (newstuffindex === delegateRoot.idx) { - delegateRoot.installing = false - } - } - onUninstallationFinished: { - if (newstuffindex === delegateRoot.idx) { - delegateRoot.installing = false - } - } - } - } - - MouseArea { - anchors.fill: parent - onClicked: delegateRoot.ListView.view.currentIndex = delegateRoot.idx - } - - ToolButton { - anchors.left: progressBar.right - anchors.leftMargin: 5 - anchors.verticalCenter: progressBar.verticalCenter - visible: delegateRoot.installing - width: 40 - iconSource: main.icon( "actions/dialog-cancel", 32 ); - onClicked: { - progressBar.indeterminate = true - themeInstallModel.cancel(delegateRoot.idx) - } - } - - Button { - id: installButton - text: installed && upgradable ? "Upgrade" : "Install" - enabled: !installed || upgradable - anchors.top: summaryLabel.bottom - anchors.left: parent.left - anchors.margins: 5 - width: parent.width / 2 - 5 - visible: delegateRoot.selected && !delegateRoot.installing - onClicked: { - progressBar.indeterminate = true - delegateRoot.installing = true - themeInstallModel.install(delegateRoot.idx) - } - } - - Button { - text: "Remove" - anchors.top: summaryLabel.bottom - anchors.right: parent.right - anchors.left: installButton.right - anchors.margins: 5 - width: parent.width / 2 - 5 - visible: delegateRoot.selected && !delegateRoot.installing - enabled: installed - onClicked: { - progressBar.indeterminate = true - delegateRoot.installing = true - themeInstallModel.uninstall(delegateRoot.idx) - } - } - } - } - } - } -} diff --git a/src/apps/marble-touch/MapThemeSelectionPage.qml b/src/apps/marble-touch/MapThemeSelectionPage.qml deleted file mode 100644 index bc4cac724..000000000 --- a/src/apps/marble-touch/MapThemeSelectionPage.qml +++ /dev/null @@ -1,66 +0,0 @@ -// 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 2011 Dennis Nienhüser -// Copyright 2011 Daniel Marth - -import QtQuick 2.3 -import com.nokia.meego 1.0 -import org.kde.edu.marble 0.20 - -/* - * Page to select map theme from a list. - */ -Page { - tools: ToolBarLayout { - MarbleToolIcon { - iconSource: main.icon( "actions/go-previous-view", 48 ); - onClicked: pageStack.pop() - } - } - - ListView { - id: mapListView - anchors.fill: parent - anchors.margins: UiConstants.DefaultMargin - highlightFollowsCurrentItem: true - model: marbleWidget.mapThemeModel - - // Delegate that displays a preview image and the name of the map theme. - delegate: - Rectangle { - id: themeItem - width: mapListView.width - height: mapImage.height + 5 - // Highlight current map theme with a blue background. - color: mapThemeId === settings.mapTheme ? "lightsteelblue" : "white" - Row { - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 15 - // Preview image of the map theme. - Image { - id: mapImage - source: "image://maptheme/" + mapThemeId - } - // Label with the name of the map theme. - Label { - id: themeLabel - text: display - anchors.verticalCenter: parent.verticalCenter - } - } - // If the user clicks on a theme, use it for the map. - MouseArea { - anchors.fill: parent - onClicked: { - mapListView.currentIndex = index - settings.mapTheme = mapThemeId - } - } - } - } -} diff --git a/src/apps/marble-touch/MarbleSettings.qml b/src/apps/marble-touch/MarbleSettings.qml deleted file mode 100644 index 8ce4927b6..000000000 --- a/src/apps/marble-touch/MarbleSettings.qml +++ /dev/null @@ -1,91 +0,0 @@ -// 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 2011 Dennis Nienhüser -// Copyright 2011 Daniel Marth - -import QtQuick 2.3 -import org.kde.edu.marble 0.20 - -/* - * Settings of the application. - */ -Item { - id: root - - // Instance of the C++ class that manages the settings. - Settings { - id: settings - } - - // Load settings from file. - property string mapTheme: settings.value( "MarbleWidget", "mapTheme", "earth/openstreetmap/openstreetmap.dgml" ) - property string streetMapTheme: settings.value( "MarbleTouch", "streetMapTheme", "earth/openstreetmap/openstreetmap.dgml" ) - property bool workOffline: settings.value( "MainWindow", "workOffline", false ) - property real quitLongitude: settings.value( "MarbleWidget", "quitLongitude", 0.0 ) - property real quitLatitude: settings.value( "MarbleWidget", "quitLatitude", 0.0 ) - property real lastKnownLongitude: settings.value( "MarbleWidget", "lastKnownLongitude", 0.0 ) - property real lastKnownLatitude: settings.value( "MarbleWidget", "lastKnownLatitude", 0.0 ) - property real quitRadius: settings.value( "MarbleWidget", "quitRadius", 148.0 ) - property bool gpsTracking: settings.value( "MarbleWidget", "gpsTracking", false ) - property bool showPositionIndicator: settings.value( "MarbleWidget", "showPositionIndicator", false ) - property bool showTrack: settings.value( "MarbleWidget", "showTrack", false ) - property string projection: settings.value( "MarbleWidget", "projection", "Spherical" ) - property variant defaultRenderPlugins: ["compass", "coordinate-grid", "progress", - "crosshairs", "stars", "scalebar", "license"] - property variant activeRenderPlugins: settings.value( "MarbleWidget", "activeRenderPlugins", defaultRenderPlugins ) - property string lastActivity: settings.value( "MarbleTouch", "lastActivity", "" ) - property bool inhibitScreensaver: settings.value( "MarbleTouch", "inhibitScreensaver", true ) - property bool voiceNavigationMuted: settings.value( "MarbleTouch", "voiceNavigationMuted", false) - property bool voiceNavigationSoundEnabled: settings.value( "MarbleTouch", "voiceNavigationSoundEnabled", false) - property string voiceNavigationSpeaker: settings.value( "MarbleTouch", "voiceNavigationSpeaker", "English - Bugsbane") - property bool navigationStartupWarning: settings.value( "MarbleTouch", "navigationStartupWarning", false) - property bool navigationStartupWarningEverShown: settings.value( "MarbleTouch", "navigationStartupWarningEverShown", false) - property string changelogShown: settings.value( "MarbleTouch", "changelogShown", "" ) - property string owncloudSync: settings.value( "MarbleTouch", "owncloudSync", false ) - property string owncloudServer: settings.value( "MarbleTouch", "owncloudServer", "" ) - property string owncloudUsername: settings.value( "MarbleTouch", "owncloudUsername", "" ) - property string owncloudPassword: settings.value( "MarbleTouch", "owncloudPassword", "" ) - - // Save settings to file. - Component.onDestruction: { - settings.setValue( "MarbleWidget", "mapTheme", root.mapTheme ) - settings.setValue( "MainWindow", "workOffline", root.workOffline ) - settings.setValue( "MarbleWidget", "quitLongitude", root.quitLongitude ) - settings.setValue( "MarbleWidget", "quitLatitude", root.quitLatitude ) - settings.setValue( "MarbleWidget", "lastKnownLongitude", root.lastKnownLongitude ) - settings.setValue( "MarbleWidget", "lastKnownLatitude", root.lastKnownLatitude ) - settings.setValue( "MarbleWidget", "quitRadius", root.quitRadius ) - settings.setValue( "MarbleWidget", "gpsTracking", root.gpsTracking ) - settings.setValue( "MarbleWidget", "showPositionIndicator", root.showPositionIndicator ) - settings.setValue( "MarbleWidget", "showTrack", root.showTrack ) - settings.setValue( "MarbleWidget", "projection", root.projection ) - settings.setValue( "MarbleWidget", "activeRenderPlugins", root.activeRenderPlugins ) - settings.setValue( "MarbleTouch", "lastActivity", root.lastActivity ) - settings.setValue( "MarbleTouch", "streetMapTheme", root.streetMapTheme ) - settings.setValue( "MarbleTouch", "inhibitScreensaver", root.inhibitScreensaver ) - settings.setValue( "MarbleTouch", "voiceNavigationMuted", root.voiceNavigationMuted ) - settings.setValue( "MarbleTouch", "voiceNavigationSoundEnabled", root.voiceNavigationSoundEnabled ) - settings.setValue( "MarbleTouch", "voiceNavigationSpeaker", root.voiceNavigationSpeaker ) - settings.setValue( "MarbleTouch", "navigationStartupWarning", root.navigationStartupWarning ) - settings.setValue( "MarbleTouch", "navigationStartupWarningEverShown", root.navigationStartupWarningEverShown ) - settings.setValue( "MarbleTouch", "changelogShown", root.changelogShown ) - settings.setValue( "MarbleTouch", "owncloudSync", root.owncloudSync ) - settings.setValue( "MarbleTouch", "owncloudServer", root.owncloudServer ) - settings.setValue( "MarbleTouch", "owncloudUsername", root.owncloudUsername ) - settings.setValue( "MarbleTouch", "owncloudPassword", root.owncloudPassword ) - } - - function removeElementsFromArray(array, elements) { - for( var j=0; j - -import QtQuick 2.3 - -Item { - property string version: changelogModel.get(0).version - property string status: "experimental release" - property alias changelog: changelogModel - - ListModel { - id: changelogModel - - ListElement { - version: "1.3.3" - summary: "Bookmark support, OSRM routing backend, download tiles in the visible area." - } - ListElement { - version: "1.3.2" - summary: "Pinch zoom, MapQuest routing backend, download tiles along the route, more voice navigation announcements." - } - ListElement { - version: "1.3.1" - summary: "First public release." - } - } -} diff --git a/src/apps/marble-touch/MarbleWindow.qml b/src/apps/marble-touch/MarbleWindow.qml deleted file mode 100644 index 70ee915f4..000000000 --- a/src/apps/marble-touch/MarbleWindow.qml +++ /dev/null @@ -1,102 +0,0 @@ -import org.kde.edu.marble 0.20 -import QtQuick 2.3 -import QtQuick.Controls 1.0 -import QtQuick.Layouts 1.2 - -ApplicationWindow { - id: mainWindow - - width: 800 - height: 600 - - property Item marbleWidget: MainWidget {} - property bool inPortrait: width < height - - toolBar: RowLayout { - anchors.fill: parent - ToolButton { - text: "Home" - onClicked: activitySelection.showActivities() - } - - function replaceWith( item ) { - for(var i = toolBar.children.length; i > 0 ; i--) { - toolBar.children[i-1].destroy() - } - item.parent = toolBar - } - } - - // Stores the settings of the application. - MarbleSettings { - id: settings - } - - ActivitySelectionView { - id: activitySelection - anchors.fill: parent - } - - function openActivity( activity ) { - activitySelection.openActivity( activity ) - } - - function openPage( path ) { - pageStack.push( path ) - } - - Component.onCompleted: { - if ( settings.lastActivity === "" ) { - activitySelection.initializeDelayed() - } else { - activitySelection.openActivity( settings.lastActivity ) - } - } - - function icon( name, size ) { - if ( name === "actions/go-previous-view" ) { - return "image://theme/icon-m-toolbar-back" - } else if ( name === "actions/edit-find" ) { - return "image://theme/icon-m-toolbar-search" - } else if ( name === "actions/configure" ) { - return "image://theme/icon-m-toolbar-settings" - } else if ( name === "actions/go-up" ) { - return "image://theme/icon-m-toolbar-up" - } else if ( name === "places/user-identity" ) { - return "image://theme/icon-s-common-location" - } else if ( name === "devices/network-wireless" ) { - return "qrc:/marble/wireless.svg" - } else if ( name === "actions/show-menu" ) { - return "image://theme/icon-m-toolbar-view-menu" - } else if ( name === "actions/document-edit" ) { - return "image://theme/icon-m-toolbar-edit" - } else if ( name === "actions/edit-clear-locationbar-rtl" ) { - return "image://theme/icon-m-input-clear" - } else if ( name === "actions/text-speak" ) { - return "image://theme/icon-m-toolbar-volume" - } else if ( name === "status/task-attention" ) { - return "image://theme/icon-l-error" - } else if ( name === "actions/media-playback-start" ) { - return "image://theme/icon-m-toolbar-mediacontrol-play" - } else if ( name === "actions/dialog-cancel" ) { - return "image://theme/icon-s-cancel" - } else if ( name === "actions/dialog-close" ) { - return "image://theme/icon-s-cancel" - } else if ( name === "places/folder" ) { - return "image://theme/icon-m-common-directory" - } else if ( name === "mimetypes/unknown" ) { - return "image://theme/icon-m-content-document" - } else if ( name === "places/favorites" ) { - return "image://theme/icon-m-toolbar-favorite-mark" - } else if ( name === "actions/go-home" ) { - return "image://theme/icon-m-toolbar-home" - } else if ( name === "actions/download" ) { - return "image://theme/icon-s-transfer-download" - } else if ( name === "actions/upload" ) { - return "image://theme/icon-s-transfer-upload" - } - - return name - } -} - diff --git a/src/apps/marble-touch/OfflineDataPage.qml b/src/apps/marble-touch/OfflineDataPage.qml deleted file mode 100644 index 090ca8201..000000000 --- a/src/apps/marble-touch/OfflineDataPage.qml +++ /dev/null @@ -1,317 +0,0 @@ -// 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 2012 Dennis Nienhüser - -import QtQuick 2.3 -import org.kde.edu.marble 0.20 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.2 - -Item { - id: offlineDataPage - - RowLayout { - id: toolBar - anchors.fill: parent - ToolButton { - text: "Home" - onClicked: activitySelection.showActivities() - } - } - - OfflineDataModel { - id: offlineDataModel - } - - Row { - id: monavStatus - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - anchors.topMargin: 10 - - visible: !Marble.canExecute("monav-daemon") && !Marble.canExecute("MoNavD") - - ToolButton { - id: statusIcon - anchors.verticalCenter: parent.verticalCenter - iconSource: main.icon( "status/task-attention", 48 ); - } - - Label { - anchors.verticalCenter: parent.verticalCenter - /*readonly*/ property string monavStoreUrl: "http://store.ovi.mobi/content/250322" - width: parent.width - statusIcon.width - text: "Please install Monav Routing Daemon (free) to enable offline routing. Install now." - wrapMode: Text.Wrap - - onLinkActivated: Qt.openUrlExternally(link) - } - } - - SearchField { - id: search - anchors.top: monavStatus.visible ? monavStatus.bottom : parent.top - anchors.topMargin: 5 - width: parent.width - onSearch: { - offlineDataModel.setFilterFixedString(term) - } - } - - RowLayout { - id: filterRow - ExclusiveGroup { id: filterGroup } - anchors.left: parent.left - anchors.right: parent.right - anchors.top: search.bottom - anchors.topMargin: 10 - anchors.margins: 5 - - RadioButton { - id: noFilter - exclusiveGroup: filterGroup - checked: true - text: "All" - onClicked: filterRow.update() - } - - Button { - id: motorcarFilter - exclusiveGroup: filterGroup - iconSource: "qrc:/icons/routing-motorcar.svg"; - width: 120 - onClicked: filterRow.update() - } - - Button { - id: bikeFilter - exclusiveGroup: filterGroup - iconSource: "qrc:/icons/routing-bike.svg"; - width: 80 - onClicked: filterRow.update() - } - - Button { - id: pedestrianFilter - exclusiveGroup: filterGroup - iconSource: "qrc:/icons/routing-pedestrian.svg"; - width: 60 - onClicked: filterRow.update() - } - - function update() { - offlineDataModel.setVehicleTypeFilter( - (filterRow.checkedButton === noFilter ? OfflineDataModel.Any : OfflineDataModel.None) | - (filterRow.checkedButton === motorcarFilter ? OfflineDataModel.Motorcar : OfflineDataModel.None) | - (filterRow.checkedButton === bikeFilter ? OfflineDataModel.Bicycle : OfflineDataModel.None) | - (filterRow.checkedButton === pedestrianFilter ? OfflineDataModel.Pedestrian : OfflineDataModel.None) ) - } - } - - - ListView { - id: dataView - model: offlineDataModel - anchors.left: parent.left - anchors.right: parent.right - anchors.top: filterRow.bottom - anchors.bottom: parent.bottom - anchors.topMargin: 10 - anchors.margins: 5 - delegate: dataDelegate - highlight: Rectangle { radius: 5; color: "lightsteelblue" } - highlightMoveDuration: 200 - spacing: 10 - section.property: "continent" - section.delegate: sectionDelegate - currentIndex: -1 - clip: true - } - - Component { - id: sectionDelegate - - Rectangle { - color: Qt.rgba(0/255, 102/255, 255/255, 1) - width: dataView.width - height: childrenRect.height - radius: 5 - - Label { - x: 5 - width: parent.width - text: section - color: Qt.rgba(238/255, 238/255, 236/255, 1) - } - } - } - - Component { - id: dataDelegate - - Item { - id: delegateRoot - width: parent.width - height: row.height - property bool installing: transitioning - property bool selected: ListView.view.currentIndex === idx - property bool showDetails: selected || installing - property int idx: index - - Row { - id: row - spacing: 10 - - Image { - id: previewIcon - anchors.verticalCenter: parent.verticalCenter - width: 45 - smooth: true - fillMode: Image.PreserveAspectFit - source: name.search(/Bicycle/) !== -1 ? "qrc:/icons/routing-bike.svg" : (name.search(/Pedestrian/) !== -1 ? "qrc:/icons/routing-pedestrian.svg" : "qrc:/icons/routing-motorcar.svg") - } - - Item { - id: textItem - width: delegateRoot.width - row.spacing - previewIcon.width - 10 - height: nameLabel.height + (delegateRoot.showDetails ? versionLabel.height + installButton.height + 15 : 0) - - Label { - id: nameLabel - width: parent.width - text: display - font.bold: upgradable - } - - Label { - id: versionLabel - width: parent.width - anchors.top: nameLabel.bottom - anchors.topMargin: 5 - visible: delegateRoot.showDetails - property string localVersion: "Version installed: " + installedreleasedate + "" - property string displaySize: delegateRoot.showDetails && !settings.workOffline ? " (" + formatSize() + ")" : "" - text: "Version available: " + releasedate + displaySize + "" + (installed ? "
" + localVersion : "") - - function formatSize() { - var length = size - - if (length<0) { - return "" - } - - var unit = 0 - for (var i=0; i<9 && length >= 1000; ++i) { - length /= 1000.0 - ++unit - } - - switch (unit) { - case 0: return length.toFixed(1) + " byte" - case 1: return length.toFixed(1) + " kB" - case 2: return length.toFixed(1) + " MB" - case 3: return length.toFixed(1) + " GB" - case 4: return length.toFixed(1) + " TB" - case 5: return length.toFixed(1) + " PB" - case 6: return length.toFixed(1) + " EB" - case 7: return length.toFixed(1) + " ZB" - case 8: return length.toFixed(1) + " YB" - } - } - } - - ProgressBar { - id: progressBar - visible: delegateRoot.installing - anchors.top: versionLabel.bottom - width: parent.width - 50 - anchors.margins: 20 - minimumValue: 0.0 - maximumValue: 1.0 - indeterminate: true - - Connections { - target: offlineDataModel - onInstallationProgressed: { - if (newstuffindex === delegateRoot.idx) { - progressBar.indeterminate = false - progressBar.value = progress - } - } - onInstallationFinished: { - if (newstuffindex === delegateRoot.idx) { - delegateRoot.installing = false - } - } - onInstallationFailed: { - if (newstuffindex === delegateRoot.idx) { - delegateRoot.installing = false - } - } - onUninstallationFinished: { - if (newstuffindex === delegateRoot.idx) { - delegateRoot.installing = false - } - } - } - } - - MouseArea { - anchors.fill: parent - onClicked: delegateRoot.ListView.view.currentIndex = delegateRoot.idx - } - - ToolButton { - anchors.left: progressBar.right - anchors.leftMargin: 5 - anchors.verticalCenter: progressBar.verticalCenter - visible: delegateRoot.installing - width: 40 - iconSource: main.icon( "actions/dialog-cancel", 32 ); - onClicked: { - progressBar.indeterminate = true - offlineDataModel.cancel(delegateRoot.idx) - } - } - - Button { - id: installButton - text: installed && upgradable ? "Upgrade" : "Install" - enabled: !installed || upgradable - anchors.top: versionLabel.bottom - anchors.left: parent.left - anchors.margins: 5 - width: parent.width / 2 - 5 - visible: delegateRoot.selected && !delegateRoot.installing - onClicked: { - progressBar.indeterminate = true - delegateRoot.installing = true - offlineDataModel.install(delegateRoot.idx) - } - } - - Button { - text: "Remove" - anchors.top: versionLabel.bottom - anchors.right: parent.right - anchors.left: installButton.right - anchors.margins: 5 - width: parent.width / 2 - 5 - visible: delegateRoot.selected && !delegateRoot.installing - enabled: installed - onClicked: { - progressBar.indeterminate = true - delegateRoot.installing = true - offlineDataModel.uninstall(delegateRoot.idx) - } - } - } - } - } - } -} diff --git a/src/apps/marble-touch/PlacemarkEditor.qml b/src/apps/marble-touch/PlacemarkEditor.qml deleted file mode 100644 index 4e7f4f511..000000000 --- a/src/apps/marble-touch/PlacemarkEditor.qml +++ /dev/null @@ -1,295 +0,0 @@ -// 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 2012 Dennis Nienhüser - -import QtQuick 2.3 -import com.nokia.meego 1.0 -import org.kde.edu.marble 0.20 - -Item { - id: root - z: 10 - - property Placemark placemark - - function editPlacemark(placemark) - { - root.placemark = placemark - placemarkLabel.text = placemark.name - distanceLabel.text = (marbleWidget.tracking.lastKnownPosition.distance(placemark.coordinate.longitude, placemark.coordinate.latitude) / 1000).toFixed(1) + " km" - flickrPhotosModel.update() - } - - function startRouting() - { - settings.gpsTracking = true - marbleWidget.routing.clearRoute() - marbleWidget.routing.setVia( 0, marbleWidget.tracking.lastKnownPosition.longitude, marbleWidget.tracking.lastKnownPosition.latitude ) - marbleWidget.routing.setVia( 1, root.placemark.coordinate.longitude, root.placemark.coordinate.latitude ) - openActivity( "Routing" ) - } - - Item { - id: wrapper - anchors.fill: parent - width: parent.width - anchors.margins: 5 - - Column { - id: content - width: parent.width - spacing: 10 - - Item { - id: headerItem - width: parent.width - height: Math.max(placemarkLabel.height, bookmarkButton.height) - - Label { - id: placemarkLabel - anchors.left: parent.left - anchors.right: bookmarkButton.left - anchors.verticalCenter: parent.verticalCenter - } - - ToolButton { - id: bookmarkButton - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - - property bool isBookmark: root.placemark != undefined && marbleWidget.bookmarks.isBookmark(root.placemark.coordinate.longitude,root.placemark.coordinate.latitude) - iconSource: isBookmark ? "qrc:/icons/bookmark.png" : "qrc:/icons/bookmark-disabled.png" - - width: 32 - height: 32 - flat: true - - onClicked: { - if ( isBookmark ) { - marbleWidget.bookmarks.removeBookmark(root.placemark.coordinate.longitude, root.placemark.coordinate.latitude) - } else { - marbleWidget.bookmarks.addBookmark(root.placemark.coordinate.longitude, root.placemark.coordinate.latitude, root.placemark.name, "Default") - } - isBookmark = marbleWidget.bookmarks.isBookmark(root.placemark.coordinate.longitude, root.placemark.coordinate.latitude) - } - } - } - - Rectangle { - id: horizontalLine - anchors.left: parent.left - anchors.right: parent.right - color: "darkgray" - height: 1 - } - - Row { - id: routingItem - width: parent.width - height: carButton.height - spacing: 10 - - Button { - id: carButton - width: 120 - iconSource: "qrc:/icons/routing-motorcar.svg" - onClicked: { - marbleWidget.routing.routingProfile = "Motorcar" - root.startRouting() - } - } - - Button { - id: bikeButton - width: 80 - iconSource: "qrc:/icons/routing-bike.svg" - onClicked: { - marbleWidget.routing.routingProfile = "Bicycle" - root.startRouting() - } - } - - Button { - id: pedButton - width: 60 - iconSource: "qrc:/icons/routing-pedestrian.svg" - onClicked: { - marbleWidget.routing.routingProfile = "Pedestrian" - root.startRouting() - } - } - - Label { - id: distanceLabel - anchors.bottom: parent.bottom - anchors.right: parent.right - text: "0 km" - } - } - - Item { - id: photoItem - anchors.left: parent.left - anchors.right: parent.right - height: 64 - - Item { - id: weatherItem - anchors.left: parent.left - width: 234 - Repeater { - model: weatherModel - - Item { - Image { - id: weatherConditionImage - visible: weatherConditionImage.source !== "" - - width: 64 - height: width - fillMode: Image.PreserveAspectFit - smooth: true - property string condition: weatherCondition - property string icon: "" - onConditionChanged: icon = parseCondition(weatherCondition, clouds) - source: icon === "" ? "" : Marble.resolvePath("weather/weather-" + icon + ".png") - } - - Flickable { - anchors.left: weatherConditionImage.right - anchors.margins: 5 - width: 160 - height: 64 - contentWidth: 160 - contentHeight: temperatureLabel.height - clip: true - - Label { - id: temperatureLabel - width: 160 - property string cloudsText: clouds === "n/a" ? "" : clouds - property string weatherConditionText: weatherCondition === "n/a" ? "" : (cloudsText === "" ? "" : ", ") + weatherCondition - text: "" + temperature + " °C
" + cloudsText + weatherConditionText + "
" - } - } - - function parseCondition(condition, clouds) { - if (condition === "light rain") return "showers-scattered" - if (condition.match("rain")) return "showers" - if (condition.match("drizzle")) return "showers" - if (condition === "light snow") return "snow-scattered" - if (condition.match("hail")) return "hail" - if (condition.match("snow")) return "snow" - if (condition.match("ice")) return "freezing-rain" - if (condition === "mist") return "mist" - if (condition === "fog") return "mist" - if (condition === "smoke") return "mist" - if (condition === "volcanic ash") return "mist" - if (condition === "sand") return "mist" - if (condition === "haze") return "mist" - if (condition === "spray") return "mist" - if (condition === "widespread dust") return "mist" - if (condition === "squall") return "storm" - if (condition === "sandstorm") return "storm" - if (condition === "duststorm") return "storm" - if (condition === "well developed dust/sand whirls") return "storm" - //console.debug("unknown condition " + condition) - - if (clouds === "clear sky") return "clear"; - if (clouds === "few clouds") return "few-clouds"; - if (clouds === "scattered clouds") return "few-clouds"; - if (clouds === "broken clouds") return "clouds"; - if (clouds === "overcast") return "many-clouds"; - //console.debug("unknown clouds " + clouds) - - return "" - } - } - } - } - - ListView { - id: photoView - anchors.right: parent.right - visible: flickrPhotosModel.count > 0 - height: parent.height - width: 162 - spacing: 4 - orientation: ListView.Horizontal - snapMode: ListView.SnapToItem - clip: true - - model: flickrPhotosModel - delegate: Rectangle { - anchors.verticalCenter: parent.verticalCenter - color: photoView.currentIndex === index ? "lightblue" : "darkgray" - smooth: true - width: 79 - height: 79 - scale: photoImage.status === Image.Ready ? 1.0 : 0.0 - - Image { - id: photoImage - anchors.centerIn: parent - width: 75 - height: 75 - fillMode: Image.PreserveAspectCrop - source: "http://farm" + farm + ".static.flickr.com/" + server + "/" + photoId + "_" + secret + "_s.jpg" - smooth: true - clip: true - } - - Behavior on scale { - NumberAnimation { - easing.type: Easing.InOutQuad - duration: 500 - } - } - } - } - } - } - } - - XmlListModel { - id: flickrPhotosModel - - property double longitude: root.placemark != undefined ? root.placemark.coordinate.longitude : 0.0 - property double latitude: root.placemark != undefined ? root.placemark.coordinate.latitude : 0.0 - - property string url: "" - - source: settings.workOffline ? "" : url - query: "/rsp/photos/photo" - - XmlRole { name: "photoId"; query: "@id/string()" } - XmlRole { name: "secret"; query: "@secret/string()" } - XmlRole { name: "server"; query: "@server/string()" } - XmlRole { name: "farm"; query: "@farm/string()" } - - function update() - { - url = "http://www.flickr.com/services/rest/?method=flickr.photos.search&format=rest&api_key=620131a1b82b000c9582b94effcdc636&lon=" + longitude + "&lat=" + latitude + "&radius=0.1&license=1,2,3,4,5,6,7" - } - } - - XmlListModel { - id: weatherModel - - property double longitude: root.placemark != undefined ? root.placemark.coordinate.longitude : 0.0 - property double latitude: root.placemark != undefined ? root.placemark.coordinate.latitude : 0.0 - - source: settings.workOffline ? "" : "http://ws.geonames.org/findNearByWeatherXML?lat=" + latitude + "&lng=" + longitude - query: "/geonames/observation" - - XmlRole { name: "temperature"; query: "temperature/string()" } - XmlRole { name: "weatherCondition"; query: "weatherCondition/string()" } - XmlRole { name: "clouds"; query: "clouds/string()" } - } - - Connections { target: marbleWidget; onPlacemarkSelected: root.editPlacemark(placemark) } -} diff --git a/src/apps/marble-touch/PositionIndicator.qml b/src/apps/marble-touch/PositionIndicator.qml deleted file mode 100644 index e3a03c3d9..000000000 --- a/src/apps/marble-touch/PositionIndicator.qml +++ /dev/null @@ -1,83 +0,0 @@ -// 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 2011 Dennis Nienhüser -// Copyright 2011 Daniel Marth -// Copyright 2013 Bernhard Beschow - -import QtQuick 2.3 -import org.kde.edu.marble 0.20 - -Item { - property MarbleWidget map - property Tracking tracking - - Image { - id: positionFinderDirection - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.margins: 10 - z: 10 - visible: tracking !== null - smooth: true - - source: "qrc:/icons/marker-direction.svg" - //rotation: 180 + tracking.lastKnownPosition.bearing( map.center.longitude, map.center.latitude ) - } - - Image { - id: positionFinder - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.margins: 10 - z: 10 - visible: tracking !== null - - source: ( tracking !== null && tracking.positionSource.hasPosition ) ? "qrc:/icons/marker.svg" : "qrc:/icons/marker-yellow.svg" - - MouseArea { - anchors.fill: parent - onClicked: centerOn( tracking.lastKnownPosition.longitude, tracking.lastKnownPosition.latitude ) - } - } - - Rectangle { - anchors.bottom: positionFinder.top - width: positionDistanceText.width + 6 - height: positionDistanceText.height + 4 - anchors.right: parent.right - anchors.margins: 4 - visible: tracking !== null - radius: 5 - color: Qt.rgba(192/255, 192/255, 192/255, 192/255) - - Text { - id: positionDistanceText - anchors.centerIn: parent - } - } - - function updatePositionIndicator() { - if (visible && map !== null && tracking !== null) { - var pos = map.pixel( tracking.lastKnownPosition.longitude, tracking.lastKnownPosition.latitude ) - positionFinderDirection.rotation = 270 + 180.0 / Math.PI * Math.atan2 ( positionFinderDirection.y - pos.y, positionFinderDirection.x - pos.x ) - var indicatorPosition = map.coordinate( positionFinderDirection.x, positionFinderDirection.y ) - positionDistanceText.text = (tracking.lastKnownPosition.distance( indicatorPosition.longitude, indicatorPosition.latitude ) / 1000).toFixed(1) + " km" - } - } - - onMapChanged: { - map.visibleLatLonAltBoxChanged.connect( updatePositionIndicator ) - updatePositionIndicator() - } - - onTrackingChanged: { - tracking.lastKnownPositionChanged.connect( updatePositionIndicator ) - updatePositionIndicator() - } - - onVisibleChanged: updatePositionIndicator() -} diff --git a/src/apps/marble-touch/PreferencesPage.qml b/src/apps/marble-touch/PreferencesPage.qml deleted file mode 100644 index 825166a7f..000000000 --- a/src/apps/marble-touch/PreferencesPage.qml +++ /dev/null @@ -1,432 +0,0 @@ -// 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 2011 Dennis Nienhüser -// Copyright 2011 Daniel Marth - -import QtQuick 2.3 -import org.kde.edu.marble 0.20 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.2 -import QtMultimedia 5.4 - -/* - * General preferences - */ -Item { - id: preferencesPage - - RowLayout { - id: toolBar - anchors.fill: parent - ToolButton { - text: "Home" - onClicked: activitySelection.showActivities() - } - } - - Rectangle { - anchors.fill: parent - color: "white" - } - - Flickable { - id: pageFlickable - anchors.fill: parent - anchors.margins: 5 - - contentHeight: pageGrid.height - - Grid { - id: pageGrid - width: parent.width - 20 - - columns: main.inPortrait ? 1 : 2 - rows: 10 / columns - spacing: main.inPortrait ? 10 : 5 - - property int leftRowWidth: main.inPortrait ? width : 250 - property int rightRowWidth: main.inPortrait ? width : width - leftRowWidth - spacing - - Label { - id: offlineLabel - width: pageGrid.leftRowWidth - text: "Connection" - } - - Item { - id: onlineSettings - width: pageGrid.rightRowWidth - height: onlineHelp.height + onlineSwitch.height - - Switch { - id: onlineSwitch - height: 40 - checked: !settings.workOffline - onCheckedChanged: settings.workOffline = !checked - } - - Label { - id: onlineLabel - anchors.left: onlineSwitch.right - anchors.right: parent.right - anchors.leftMargin: 5 - anchors.verticalCenter: onlineSwitch.verticalCenter - text: "Online" - } - - Label { - id: onlineHelp - anchors.top: onlineSwitch.bottom - anchors.topMargin: 5 - anchors.left: onlineSwitch.left - anchors.right: parent.right - - property string activatedText: "Map data is downloaded as needed. Search and route calculation use online services." - property string deactivatedText: "Only data available offline is used to display maps, search and calculate routes." - - color: "gray" - text: onlineSwitch.checked ? activatedText : deactivatedText - - font.pixelSize: 16 - verticalAlignment: Text.AlignVCenter - } - } - - Label { - width: pageGrid.leftRowWidth - text: "Screensaver" - } - - Item { - id: screensaverSettings - width: pageGrid.rightRowWidth - height: screensaverHelp.height + Math.max(screensaverSwitch.height, screensaverLabel.height) - - Switch { - id: screensaverSwitch - height: 40 - checked: settings.inhibitScreensaver - onCheckedChanged: settings.inhibitScreensaver = checked - } - - Label { - id: screensaverLabel - anchors.left: screensaverSwitch.right - anchors.leftMargin: 5 - anchors.right: parent.right - anchors.verticalCenter: screensaverSwitch.verticalCenter - text: "Navigation disables screensaver" - } - - Label { - id: screensaverHelp - anchors.top: screensaverSwitch.bottom - anchors.left: screensaverSwitch.left - anchors.right: parent.right - anchors.topMargin: 5 - - property string activatedText: "The automatic start of the screensaver is inhibited in the Tracking activity. You can still enable it manually." - property string deactivatedText: "The screensaver is starting according to your device settings." - - color: "gray" - text: screensaverSwitch.checked ? activatedText : deactivatedText - font.pixelSize: 16 - } - } - - Label { - width: pageGrid.leftRowWidth - text: "Voice Navigation" - } - - Item { - id: speakerSettings - width: pageGrid.rightRowWidth - height: speakersSwitch.height + speakersItem.height - - RowLayout { - id: speakersSwitch - ExclusiveGroup { id: voiceGroup } - width: parent.width - - RadioButton { - id: b1 - text: "Disabled" - checked: true - exclusiveGroup: voiceGroup - onCheckedChanged: { - if (checked) { - settings.voiceNavigationMuted = true - speakerHelp.text = "Turn instructions are not announced by sound/voice." - } - } - } - - RadioButton { - id: b2 - text: "Sound" - exclusiveGroup: voiceGroup - onCheckedChanged: { - if (checked) { - settings.voiceNavigationMuted = false - settings.voiceNavigationSoundEnabled = true - speakerHelp.text = "A sound is played when approaching turn points during Navigation." - } - } - } - - RadioButton { - id: b3 - text: "Speaker" - exclusiveGroup: voiceGroup - onCheckedChanged: { - if (checked) { - settings.voiceNavigationMuted = false - settings.voiceNavigationSoundEnabled = false - speakerHelp.text = "Turn instructions are spoken when approaching them." - } - } - property SelectionDialog dialog - onClicked: { - if (dialog === null) { - dialog = speakerComponent.createObject(b3) - } - dialog.open() - } - - Component { - id: speakerComponent - SelectionDialog { - id: speakerDialog - titleText: "Voice Navigation Speaker" - currentIndex: speakers.indexOf(settings.voiceNavigationSpeaker) - - model: SpeakersModel { - id: speakers - onCountChanged: speakerDialog.currentIndex = speakers.indexOf(settings.voiceNavigationSpeaker) - onInstallationProgressed: { - progressBar.indeterminate = false - progressBar.value = progress - } - onInstallationFinished: { - progressBar.visible = false - settings.voiceNavigationSpeaker = speakers.path(speakersDialog.currentIndex) - voiceNavigationPreviewButton.enabled = true - } - } - - delegate: Item { - height: 20 - width: speakerDialog.width - Text { - text: name - } - } - - onAccepted: { - if ( speakers.isLocal(currentIndex) ) { - settings.voiceNavigationSpeaker = speakers.path(currentIndex) - } else { - voiceNavigationPreviewButton.enabled = false - progressBar.visible = true - speakers.install(currentIndex) - } - } - } - } - } - - Component.onCompleted: { - if (settings.voiceNavigationMuted) { - b1.checked = true - } else { - if (settings.voiceNavigationSoundEnabled) { - b2.checked = true - } else { - b3.checked = true - } - } - } - } - - Item { - id: speakersItem - anchors.right: parent.right - anchors.left: parent.left - anchors.top: speakersSwitch.bottom - anchors.topMargin: 5 - height: Math.max(speakerHelp.height, voiceNavigationPreviewButton.height) - - Label { - id: speakerHelp - visible: !progressBar.visible - anchors.left: parent.left - anchors.right: voiceNavigationPreviewButton.left - color: "gray" - font.pixelSize: 16 - } - - ProgressBar { - id: progressBar - visible: false - anchors.left: parent.left - anchors.right: voiceNavigationPreviewButton.left - minimumValue: 0.0 - maximumValue: 1.0 - indeterminate: true - } - - ToolButton { - id: voiceNavigationPreviewButton - anchors.right: parent.right - anchors.margins: 5 - visible: !settings.voiceNavigationMuted - text: "Test" - iconSource: main.icon( "actions/media-playback-start", 48 ); - checkable: true - checked: false - onCheckedChanged: { - if (checked) { - voiceNavigationPreviewPlayer.play() - } else { - voiceNavigationPreviewPlayer.pause() - } - } - width: 60 - - VoiceNavigation { - id: voiceNavigationPreview - speaker: settings.voiceNavigationSpeaker - isSpeakerEnabled: !settings.voiceNavigationSoundEnabled - } - - Audio { - id: voiceNavigationPreviewPlayer - source: "file://" + voiceNavigationPreview.preview - onPlaybackStateChanged: { - if ( playbackState == Audio.StoppedState ) { - voiceNavigationPreviewButton.checked = false - } - } - } - } - } - } - - Label { - width: pageGrid.leftRowWidth - text: "Street Map Theme" - } - - Item { - width: pageGrid.rightRowWidth - height: themeSelectionButton.height + mapThemeLabel.height - - Button { - id: themeSelectionButton - text: mapThemeModel.name(settings.streetMapTheme) - onClicked: themeDialog.open() - - MapThemeModel { - id: mapThemeModel - mapThemeFilter: MapThemeModel.Extraterrestrial | MapThemeModel.LowZoom - } - - SelectionDialog { - id: themeDialog - titleText: "Street Map Theme" - currentIndex: mapThemeModel.indexOf(settings.streetMapTheme) - - model: mapThemeModel - - delegate: - Rectangle { - id: delegate - width: row.width - height: row.height - - color: index === themeDialog.currentIndex ? "lightsteelblue" : "white" - - Row { - id: row - Image { - id: mapImage - source: "image://maptheme/" + mapThemeId - smooth: true - width: 68 - height: 68 - } - Label { - id: themeLabel - text: display - color: index === themeDialog.currentIndex ? "black" : "gray" - anchors.verticalCenter: parent.verticalCenter - } - } - - MouseArea { - anchors.fill: parent - onClicked: { - themeDialog.currentIndex = index - themeDialog.accept() - settings.streetMapTheme = mapThemeId - } - } - } - } - } - - Label { - id: mapThemeLabel - anchors.top: themeSelectionButton.bottom - width: pageGrid.rightRowWidth - color: "gray" - text: "Select the map to use in the Search, Routing, Navigation, Tracking and Friends activities." - font.pixelSize: 16 - } - } - - Label { - width: pageGrid.leftRowWidth - text: "Data Management" - } - - Item { - width: pageGrid.rightRowWidth - height: manageThemeButton.height - - Button { - id: manageThemeButton - width: pageGrid.rightRowWidth / 2 - 5 - text: "Map Themes" - onClicked: pageStack.push(themePage) - Component { - id: themePage - MapThemePage { } - } - } - - Button { - id: manageOfflineDataButton - anchors.left: manageThemeButton.right - anchors.leftMargin: 5 - anchors.right: parent.right - text: "Offline Data" - onClicked: pageStack.push(offlineDataPage) - Component { - id: offlineDataPage - OfflineDataPage { } - } - } - } - } - } - - Component.onCompleted: { - mainWindow.toolBar.replaceWith(toolBar) - } -} diff --git a/src/apps/marble-touch/RouteEditor.qml b/src/apps/marble-touch/RouteEditor.qml deleted file mode 100644 index 717d1a5eb..000000000 --- a/src/apps/marble-touch/RouteEditor.qml +++ /dev/null @@ -1,112 +0,0 @@ -// 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 2011 Dennis Nienhüser - -import QtQuick 2.3 -import org.kde.edu.marble 0.20 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.2 - -Item { - id: root - z: 10 - height: content.height - property string searchTerm: "" - - function calculateRoute() { - marbleWidget.routing.routingProfile = routingTypeOptions.routingType - marbleWidget.routing.updateRoute() - } - - RouteRequestModel { - id: routeRequestModel - routing: marbleWidget.routing; - } - - Column { - id: content - width: parent.width - anchors.margins: 5 - spacing: 5 - - Repeater { - id: listView - width: parent.width - model: routeRequestModel - - ViaPointEditor { - id: sourcePoint - width: content.width - - Component.onCompleted: marbleWidget.mouseClickGeoPosition.connect(retrieveInput) - onPositionChanged: { - routeRequestModel.setPosition(index, lon, lat) - root.calculateRoute() - } - } - } - - Row { - id: routeActions - width: parent.width - Button { - text: "Add" - width: parent.width / 3 - 5 - /** @todo: Ask user instead to click on a point? */ - onClicked: marbleWidget.routing.addVia(marbleWidget.getCenter().longitude, marbleWidget.getCenter().latitude) - } - - Button { - text: "Reverse" - width: parent.width / 3 - 5 - onClicked: marbleWidget.routing.reverseRoute() - } - - Button { - text: "Clear" - width: parent.width / 3 - 5 - onClicked: marbleWidget.routing.clearRoute() - } - } - - RowLayout { - id: routingTypeOptions - width: parent.width - 20 - ExclusiveGroup { id: routingGroup } - property string routingType: "Motorcar" - RadioButton { - exclusiveGroup: routingGroup - checked: true - //iconSource: "qrc:/icons/routing-motorcar.svg" - text: "Car" - onCheckedChanged: { if(checked) { routingTypeOptions.routingType = "Motorcar" } } - } - - RadioButton { - exclusiveGroup: routingGroup - //iconSource: "qrc:/icons/routing-bike.svg" - text: "Bike" - onCheckedChanged: { if(checked) { routingTypeOptions.routingType = "Bicycle" } } - } - - RadioButton { - exclusiveGroup: routingGroup - //iconSource: "qrc:/icons/routing-pedestrian.svg" - text: "Foot" - onCheckedChanged: { if(checked) { routingTypeOptions.routingType = "Pedestrian" } } - } - } - } - - Connections { target: routingTypeOptions; onRoutingTypeChanged: root.calculateRoute() } - - Component.onCompleted: { - if (routeRequestModel.count === 0) { - marbleWidget.routing.addVia(marbleWidget.tracking.lastKnownPosition.longitude, marbleWidget.tracking.lastKnownPosition.latitude) - } - } -} diff --git a/src/apps/marble-touch/SearchField.qml b/src/apps/marble-touch/SearchField.qml deleted file mode 100644 index 6ee68d519..000000000 --- a/src/apps/marble-touch/SearchField.qml +++ /dev/null @@ -1,52 +0,0 @@ -// 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 2011 Dennis Nienhüser -// Copyright 2011 Daniel Marth - -import QtQuick 2.3 -import QtQuick.Controls 1.4 - -/* - * A textfield for searching locations. - */ -TextField { - id: searchField - signal search( string term ) - property bool busy: false - - placeholderText: "Search..." - // Icon to clear text in the textfield. - ToolButton { - id: clearButton - iconSource: main.icon( "actions/edit-clear-locationbar-rtl", 22 ); - anchors.top: searchField.top - anchors.right: searchField.right - anchors.rightMargin: 5 - height: parent.height - 2 - width: parent.height - 2 - visible: !parent.busy - // Reset text and clear search. - onClicked: { - searchField.text = "" - searchField.search( text ) - } - } - - BusyIndicator { - anchors.verticalCenter: searchField.verticalCenter - anchors.right: searchField.right - anchors.rightMargin: 15 - visible: searchField.busy - running: searchField.busy - } - - Keys.onPressed: { - if( event.key === Qt.Key_Return || event.key === Qt.Key_Enter ) { - searchField.search( text ) - } - } -} diff --git a/src/apps/marble-touch/SelectionDialog.qml b/src/apps/marble-touch/SelectionDialog.qml deleted file mode 100644 index 8c545f460..000000000 --- a/src/apps/marble-touch/SelectionDialog.qml +++ /dev/null @@ -1,59 +0,0 @@ -import QtQuick 2.3 -import org.kde.edu.marble 0.20 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.2 - -Item { - id: root - anchors.fill: parent - visible: false - - property alias titleText: title.text - property alias model: listView.model - property alias currentIndex: listView.currentIndex - property alias delegate: listView.delegate - - signal accepted() - - function open() { - root.visible = true - } - - Rectangle { - anchors.fill: parent - color: "white" - } - - Label { - id: title - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: 5 - font.pointSize: 22 - } - - ListView { - id: listView - anchors.top: title.bottom - anchors.topMargin: 10 - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: button.top - - clip: true - } - - Button { - id: button - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - - text: "OK" - onClicked: { - root.visible = false - root.accepted() - } - } -} diff --git a/src/apps/marble-touch/ViaPointEditor.qml b/src/apps/marble-touch/ViaPointEditor.qml deleted file mode 100644 index 59e25604c..000000000 --- a/src/apps/marble-touch/ViaPointEditor.qml +++ /dev/null @@ -1,122 +0,0 @@ -// 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 2011 Dennis Nienhüser - -import QtQuick 2.3 -import org.kde.edu.marble 0.20 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.2 - -Item { - id: root - height: row.height - - property string text: "Point in map" /** @todo: Reverse geocoding */ - property bool isCurrentPosition: false - - signal positionChanged(int index, real lon, real lat) - - property bool _editing: false - - function retrieveInput( lon, lat ) { - if ( _editing ) { - _editing = false - positionChanged(index, lon, lat) - } - } - - Item { - id: row - width: parent.width - height: Math.max(waypointIcon.height, destinationInputLabel.height) - - Rectangle { - id: waypointIcon - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 5 - width: 32 - height: 32 - radius: 16 - color: "#37A42C" - border.width: 1 - border.color: "black" - - Text { - anchors.centerIn: parent - text: String.fromCharCode(65+index) - font.pixelSize: 24 - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - } - } - - Label { - id: destinationInputLabel - anchors.left: waypointIcon.right - anchors.right: editIcon.left - anchors.verticalCenter: parent.verticalCenter - anchors.margins: 10 - text: root._editing ? "Select a point" : ( root.isCurrentPosition ? "Current position" : root.text ) - } - - MouseArea { - anchors.fill: parent - onClicked: marbleWidget.centerOn(longitude, latitude) - } - - ToolButton { - id: editIcon - iconSource: main.icon( "actions/document-edit", 32 ); - width: 32 - height: width - anchors.right: parent.right - anchors.margins: 5 - anchors.verticalCenter: parent.verticalCenter - onClicked: { - inputSelectionDialog.open() - } - } - } - - SelectionDialog { - id: inputSelectionDialog - titleText: "Select via point" - currentIndex: -1 - model: ListModel { - ListElement { name: "Current Position" } - ListElement { name: "Choose Bookmark" } - ListElement { name: "Select from map" } - } - - onAccepted: { - if ( selectedIndex === 0 ) { - root.isCurrentPosition = true - root.positionChanged(index, marbleWidget.tracking.lastKnownPosition.longitude, marbleWidget.tracking.lastKnownPosition.latitude) - } else if ( selectedIndex === 1 ) { - bookmarkSelectionDialog.open() - } else { - root.isCurrentPosition = false - root._editing = true - } - } - } - - SelectionDialog { - id: bookmarkSelectionDialog - titleText: "Select Bookmark" - model: marbleWidget.bookmarks.model - onAccepted: { - root.text = marbleWidget.bookmarks.model.name(selectedIndex) - root.positionChanged(index, marbleWidget.bookmarks.model.longitude(selectedIndex), marbleWidget.bookmarks.model.latitude(selectedIndex)) - } - } - - onIsCurrentPositionChanged: { - inputSelectionDialog.selectedIndex = isCurrentPosition ? 0 : 1 - } -} diff --git a/src/apps/marble-touch/activities/Explore.qml b/src/apps/marble-touch/activities/Explore.qml deleted file mode 100644 index 4b560be70..000000000 --- a/src/apps/marble-touch/activities/Explore.qml +++ /dev/null @@ -1,324 +0,0 @@ -// 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 2012 Utku Aydın - -import QtQuick 2.3 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.2 -import org.kde.edu.marble 0.20 -import ".." - -Item { - id: exploreActivityPage - anchors.fill: parent - - property bool horizontal: width / height > 1.20 - - RowLayout { - id: toolBar - anchors.fill: parent - ToolButton { - text: "Home" - onClicked: activitySelection.showActivities() - } - } - - Item { - id: mapContainer - anchors.fill: parent - clip: true - - function embedMarbleWidget() { - marbleWidget.parent = mapContainer - settings.projection = "Mercator" - var plugins = settings.defaultRenderPlugins - plugins.push( "foursquare" ) - - settings.activeRenderPlugins = plugins - settings.mapTheme = settings.streetMapTheme - settings.gpsTracking = true - settings.showPositionIndicator = true - settings.showTrack = false - - marbleWidget.tracking.positionMarkerType = Tracking.Circle - marbleWidget.visible = true - marbleWidget.setDataPluginDelegate( "foursquare", foursquareDelegate ) - } - - Component.onDestruction: { - marbleWidget.setDataPluginDelegate( "foursquare", 0 ) - if ( marbleWidget.parent === mapContainer ) { - marbleWidget.parent = null - marbleWidget.visible = false - } - } - } - - Component.onCompleted: { - mapContainer.embedMarbleWidget() - mainWindow.toolBar.replaceWith(toolBar) - } - - Component { - id: foursquareDelegate - - Rectangle { - id: venueRectangle - property int padding: 7 - width: container.width + padding - height: container.height + padding - scale: 0.0 - color: "#88D788" - border.color: "#39AC39" - border.width: 2 - radius: 3 - - SequentialAnimation { - id: venueAppearAnimation - PauseAnimation { duration: Math.random() * 100 } - NumberAnimation { - target: venueRectangle - property: "scale" - to: 1.0 - duration: 150 - } - } - - Component.onCompleted: { - venueAppearAnimation.running = true - } - - Item { - id: container - width: 32 + ( focus ? venueName.width + venueName.anchors.leftMargin : 0 ) - height: Math.max( 32, venueName.height ) - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - - Rectangle { - id: iconFallBack - width: 30 - height: width - radius: 5 - color: "white" - border.width: 2 - border.color: "darkgray" - } - - Image { - id: categoryIcon - source: categoryIconUrl - anchors.verticalCenter: parent.verticalCenter - } - - Text { - id: venueName - scale: container.focus ? 1.0 : 0.0 - text: name - anchors.left: iconFallBack.right - anchors.leftMargin: 5 - anchors.verticalCenter: parent.verticalCenter - visible: parent.focus ? true : false - - Behavior on scale { NumberAnimation { duration: 150 } } - } - - Behavior on width { NumberAnimation { duration: 150 } } - onFocusChanged: sticky = focus - } - - function updateDetails() { - venueDetails.venueId = identifier - venueDetails.name = name - venueDetails.category = category - venueDetails.address = address - venueDetails.city = city - venueDetails.country = country - venueDetails.usersCount = usersCount - venueDetails.largeIcon = categoryLargeIconUrl - } - - MouseArea { - anchors.fill: parent - onClicked: { - if( container.focus == true ) { - updateDetails() - listModel.retrieve() - venueDetails.visible = true - } else { - container.focus = true - } - } - } - } - } - - Rectangle { - id: venueDetails - - anchors.bottom: exploreActivityPage.bottom - width: exploreActivityPage.horizontal ? - Math.max( exploreActivityPage.width / 4, minWidth() + 14 ) : exploreActivityPage.width - height: exploreActivityPage.horizontal ? exploreActivityPage.height : exploreActivityPage.height / 3 - visible: false - radius: 10 - color: "#f7f7f7" - border.width: 2 - border.color: "darkgray" - - property string venueId - property string name - property string category - property string address - property string city - property string country - property string usersCount - property string largeIcon - - function minWidth() { - return Math.max(detailName.width, - detailCategory.width, - detailAddress.width, - detailCity.width, - detailCountry.width) - } - - Image { - id: detailIcon - source: venueDetails.largeIcon - anchors.top: venueDetails.top - anchors.left: detailName.left - anchors.topMargin: 10 - } - - Text { - id: detailName - text: venueDetails.name - anchors.top: detailIcon.bottom - anchors.left: venueDetails.left - anchors.topMargin: 5 - anchors.leftMargin: 7 - } - - Text { - id: detailCategory - text: venueDetails.category - anchors.top: detailName.bottom - anchors.left: detailName.left - } - - Text { - id: detailAddressTitle - text: qsTr( "Address" ) - anchors.top: detailCategory.bottom - anchors.left: detailName.left - anchors.topMargin: 5 - font.bold: true - } - - Text { - id: detailAddress - text: venueDetails.address - anchors.top: detailAddressTitle.bottom - anchors.left: detailName.left - } - - Text { - id: detailCity - text: venueDetails.city - anchors.top: detailAddress.bottom - anchors.left: detailName.left - } - - Text { - id: detailCountry - text: venueDetails.country - anchors.top: detailCity.bottom - anchors.left: detailName.left - } - - ListView { - id: photoView - width: exploreActivityPage.horizontal ? venueDetails.width - anchors.margins : 64 - - anchors.top: exploreActivityPage.horizontal ? detailCountry.bottom : venueDetails.top - anchors.left: exploreActivityPage.horizontal ? venueDetails.left : venueDetails.horizontalCenter - anchors.bottom: venueDetails.bottom - anchors.right:venueDetails.right - anchors.margins: 5 - spacing: 2 - - model: listModel - orientation: ListView.Vertical - clip: true - - delegate: Image { - id: venuePhoto - width: photoView.width - scale: 0.0 - fillMode: Image.PreserveAspectFit - source: url - smooth: true - - SequentialAnimation { - id: photoAppearAnimation - PauseAnimation { duration: Math.random() * 100 } - NumberAnimation { - target: venuePhoto - property: "scale" - to: 1.0 - duration: 150 - } - } - - Component.onCompleted: { - photoAppearAnimation.running = true - } - } - } - - Item { - id: modelData - property string clientId: "YPRWSYFW1RVL4PJQ2XS5G14RTOGTHOKZVHC1EP5KCCCYQPZF" - property string clientSecret: "5L2JDCAYQCEJWY5FNDU4A1RWATE4E5FIIXXRM41YBTFSERUH" - property string source: "https://api.foursquare.com/v2/venues/" + venueDetails.venueId + "/photos?v=20120617&group=venue&limit=5&client_id=" + clientId + "&client_secret=" + clientSecret - - ListModel { - id: listModel - property string oldId - - function retrieve() { - if( oldId == venueDetails.venueId ) { - return - } - - var xhr = new XMLHttpRequest; - xhr.open( "GET", modelData.source ); - xhr.onreadystatechange = function() { - if( xhr.readyState === XMLHttpRequest.DONE ) { - listModel.oldId = venueDetails.venueId - listModel.clear() - var data = JSON.parse( xhr.responseText ); - for( var item in data.response.photos.items ) { - var photo = data.response.photos.items[ item ]; - listModel.append({ - url: photo.prefix + "original" + photo.suffix, - width: photo.width, - height: photo.height - }); - } - } - } - - xhr.send(); - } - } - } - - Behavior on width { NumberAnimation { duration: 150 } } - } -} diff --git a/src/apps/marble-touch/activities/Friends.qml b/src/apps/marble-touch/activities/Friends.qml deleted file mode 100644 index 417ce35c6..000000000 --- a/src/apps/marble-touch/activities/Friends.qml +++ /dev/null @@ -1,68 +0,0 @@ -// 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 2011 Dennis Nienhüser -// Copyright 2011 Daniel Marth - -import QtQuick 2.3 -import QtQuick.Controls 1.0 -import QtQuick.Layouts 1.2 -import QtQuick.Window 2.2 -import org.kde.edu.marble 0.20 -import ".." - -/* - * Page for friends (social, opendesktop) activity. - */ -Item { - id: friendsActivityPage - - width: 600 - height: 800 - - RowLayout { - id: toolBar - anchors.fill: parent - ToolButton { - text: "Home" - onClicked: activitySelection.showActivities() - } - } - - Item { - clip: true - id: mapContainer - anchors.fill: parent - - function embedMarbleWidget() { - marbleWidget.parent = mapContainer - settings.projection = "Mercator" - var plugins = settings.defaultRenderPlugins - settings.removeElementsFromArray(plugins, ["coordinate-grid", "sun", "stars", "compass"]) - plugins.push( "opendesktop" ) - - settings.activeRenderPlugins = plugins - settings.mapTheme = settings.streetMapTheme - settings.gpsTracking = true - settings.showPositionIndicator = true - marbleWidget.tracking.positionMarkerType = Tracking.Circle - settings.showTrack = false - marbleWidget.visible = true - } - - Component.onDestruction: { - if ( marbleWidget.parent === mapContainer ) { - marbleWidget.parent = null - marbleWidget.visible = false - } - } - } - - Component.onCompleted: { - mapContainer.embedMarbleWidget() - mainWindow.toolBar.replaceWith(toolBar) - } -} diff --git a/src/apps/marble-touch/activities/Geocaching.qml b/src/apps/marble-touch/activities/Geocaching.qml deleted file mode 100644 index b8173da91..000000000 --- a/src/apps/marble-touch/activities/Geocaching.qml +++ /dev/null @@ -1,94 +0,0 @@ -// 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 2011 Dennis Nienhüser -// Copyright 2011 Daniel Marth - -import QtQuick 2.3 -import org.kde.edu.marble 0.20 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.2 -import ".." - -/* - * Page for geocaching activity. - */ -Item { - id: geocachingActivityPage - anchors.fill: parent - - RowLayout { - id: toolBar - anchors.fill: parent - ToolButton { - text: "Home" - onClicked: activitySelection.showActivities() - } - ToolButton { - id: searchButton - checkable: true - width: 60 - iconSource: main.icon( "actions/edit-find", 48 ); - } - } - - Column { - width: parent.width - height: parent.height - - SearchField { - id: searchField - visible: searchButton.checked - width: parent.width - onSearch: { - searchField.busy = true - marbleWidget.find( term ) - } - - Component.onCompleted: { - marbleWidget.search.searchFinished.connect( searchFinished ) - } - - function searchFinished() { - searchField.busy = false - } - } - - Item { - clip: true - id: mapContainer - width: parent.width - height: parent.height - searchField.height - - function embedMarbleWidget() { - marbleWidget.parent = mapContainer - settings.projection = "Mercator" - var plugins = settings.defaultRenderPlugins - settings.removeElementsFromArray(plugins, ["coordinate-grid", "sun", "stars", "compass"]) - plugins.push( "opencaching" ) - settings.activeRenderPlugins = plugins - settings.mapTheme = settings.streetMapTheme - settings.gpsTracking = true - settings.showPositionIndicator = true - marbleWidget.tracking.positionMarkerType = Tracking.Arrow - settings.showTrack = true - marbleWidget.visible = true - } - - Component.onDestruction: { - if ( marbleWidget.parent === mapContainer ) { - marbleWidget.parent = null - marbleWidget.visible = false - } - } - } - } - - Component.onCompleted: { - mapContainer.embedMarbleWidget() - mainWindow.toolBar.replaceWith(toolBar) - } -} diff --git a/src/apps/marble-touch/activities/Navigation.qml b/src/apps/marble-touch/activities/Navigation.qml deleted file mode 100644 index 6744afe8c..000000000 --- a/src/apps/marble-touch/activities/Navigation.qml +++ /dev/null @@ -1,273 +0,0 @@ -// 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 2011 Dennis Nienhüser - -import QtQuick 2.3 -import org.kde.edu.marble 0.20 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.2 -import QtMultimedia 5.4 -import ".." - -/* - * Page for navigation activity. - */ -Item { - id: navigationActivityPage - anchors.fill: parent - - RowLayout { - id: toolBar - anchors.fill: parent - ToolButton { - text: "Home" - onClicked: activitySelection.showActivities() - } - ToolButton { - iconSource: main.icon( "actions/text-speak", 48 ); - checkable: true - checked: !settings.voiceNavigationMuted - onCheckedChanged: settings.voiceNavigationMuted = !checked - width: 60 - } - ToolButton { - iconSource: main.icon( "devices/network-wireless", 48 ); - checkable: true - checked: !settings.workOffline - onCheckedChanged: settings.workOffline = !checked - width: 60 - } - - ToolButton { - text: "Elevation Profile" - checked: false - checkable: true - onCheckedChanged: { - var plugins = settings.activeRenderPlugins - if ( checked ) { - plugins.push("elevationprofile") - } else { - settings.removeElementsFromArray(plugins, ["elevationprofile"]) - } - settings.activeRenderPlugins = plugins - marbleWidget.setGeoSceneProperty( "hillshading", checked ) - } - } - - Item { Layout.fillWidth: true } - } - - Rectangle { - id: instructionItem - color: marbleWidget.navigation.deviated ? Qt.rgba(156/255, 15/255, 15/255, 1) : Qt.rgba(0/255, 67/255, 138/255, 1) - - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - height: Math.max(instructionImage.height, instructionDistance.height) - - Image { - id: instructionImage - anchors.verticalCenter: parent.verticalCenter - width: 64 - height: 64 - smooth: true - source: marbleWidget.navigation.nextInstructionImage - onSourceChanged: { - fadeAnimation.running = true - } - } - - Label { - id: instructionDistance - anchors.left: instructionImage.right - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - - property bool isMeter: marbleWidget.navigation.nextInstructionDistance < 1000 - property real distance: isMeter ? Math.round( marbleWidget.navigation.nextInstructionDistance / 10 ) * 10 : Math.round( marbleWidget.navigation.nextInstructionDistance / 100 ) / 10 - property string distanceUnit: isMeter ? "m" : "km" - - color: Qt.rgba(238/255, 238/255, 236/255, 1) - text: "" + distance + "" + " " + distanceUnit + "" + " " + marbleWidget.navigation.nextRoad + "" - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - } - - PropertyAnimation { - id: fadeAnimation; - target: instructionItem; - property: "opacity"; - from: 0.2; - to: 1.0; - duration: 200 - } - } - - Rectangle { - id: searchResultView - anchors.left: navigationActivityPage.left - anchors.bottom: navigationActivityPage.bottom - anchors.right: navigationActivityPage.right - - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.rgba(46/255, 52/255, 54/255, 1) } - GradientStop { position: 0.8; color: Qt.rgba(36/255, 42/255, 44/255, 1) } - GradientStop { position: 1.0; color: Qt.rgba(26/255, 32/255, 34/255, 1) } - } - - Grid { - anchors.fill: parent - anchors.margins: 5 - spacing: 20 - property bool portrait: main.inPortrait - - columns: portrait ? 4 : 1 - rows: portrait ? 1 : 4 - - Label { - id: currentSpeed - width: parent.portrait ? parent.width / 2 : parent.width - 10 - color: Qt.rgba(238/255, 238/255, 236/255, 1) - text: "" + Math.round( marbleWidget.tracking.positionSource.speed ) + " km/h" - horizontalAlignment: parent.portrait ? Text.AlignHCenter : Text.AlignRight - - MouseArea { - anchors.fill: parent - onClicked: marbleWidget.centerOn( marbleWidget.tracking.lastKnownPosition.longitude, marbleWidget.tracking.lastKnownPosition.latitude ) - } - } - - Rectangle { - id: distanceSeparator - visible: !parent.portrait - width: parent.portrait ? 1 : parent.width - height: parent.portrait ? parent.height - 20 : 1 - anchors.verticalCenter: parent.portrait ? parent.verticalCenter : undefined - color: currentSpeed.color - } - - Label { - id: destinationDistance - width: parent.portrait ? parent.width / 2 : parent.width - 10 - color: currentSpeed.color - property bool isMeter: marbleWidget.navigation.destinationDistance < 1000 - property real distance: isMeter ? Math.round( marbleWidget.navigation.destinationDistance / 10 ) * 10 : Math.round( marbleWidget.navigation.destinationDistance / 100 ) / 10 - property string distanceUnit: isMeter ? "m" : "km" - text: " " + distance + " " + distanceUnit + "" - horizontalAlignment: parent.portrait ? Text.AlignHCenter : Text.AlignRight - } - } - } - - Item { - id: mapContainer - clip: true - anchors.top: instructionItem.bottom - anchors.right: navigationActivityPage.right - anchors.left: navigationActivityPage.left - anchors.bottom: searchResultView.top - - function embedMarbleWidget() { - marbleWidget.parent = mapContainer - settings.projection = "Mercator" - var plugins = settings.defaultRenderPlugins - settings.removeElementsFromArray(plugins, ["coordinate-grid", "sun", "stars", "compass", "crosshairs"]) - settings.activeRenderPlugins = plugins - settings.mapTheme = settings.streetMapTheme - settings.gpsTracking = true - settings.showPositionIndicator = true - settings.showTrack = true - marbleWidget.tracking.positionMarkerType = Tracking.Arrow - marbleWidget.navigation.guidanceModeEnabled = true - marbleWidget.visible = true - } - - Component.onDestruction: { - if ( marbleWidget.parent === mapContainer ) { - marbleWidget.parent = null - marbleWidget.visible = false - } - } - } - - StateGroup { - // Here be dragons. Order is crucial in the changes below - states: [ - State { // Horizontal - when: (navigationActivityPage.width / navigationActivityPage.height) > 1.20 - AnchorChanges { target: searchResultView; anchors.top: instructionItem.bottom; anchors.right: undefined } - AnchorChanges { target: mapContainer; anchors.left: searchResultView.right; anchors.bottom: navigationActivityPage.bottom; } - PropertyChanges { target: searchResultView; height: navigationActivityPage.height-instructionItem.height; width: navigationActivityPage.width * 0.2; } - }, - State { // Vertical - when: (true) - AnchorChanges { target: searchResultView; anchors.top: undefined; anchors.right: navigationActivityPage.right } - AnchorChanges { target: mapContainer; anchors.left: navigationActivityPage.left; anchors.bottom: searchResultView.top; } - PropertyChanges { target: searchResultView; height: destinationDistance.height+7; width: navigationActivityPage.width } - } - ] - } - - Component.onCompleted: { - mapContainer.embedMarbleWidget() - mainWindow.toolBar.replaceWith(toolBar) - } - - Audio { - id: playback - } - - /* - Dialog { - id: safetyWarningDialog - - content: Column { - width: parent.width - spacing: 10 - - Label { - id: textLabel - width: parent.width - color: main.components === "harmattan" ? "white" : "black" - text: "

Caution: Driving instructions may be incomplete or wrong. Road construction, weather and other unforeseen variables can result in the suggested route not to be the most expedient or safest route to your destination. Please use common sense while navigating.

The Marble development team wishes you a pleasant and safe journey.

" - wrapMode: Text.Wrap - } - - Row { - CheckBox { - id: startupCheckbox - checked: settings.navigationStartupWarning - onCheckedChanged: settings.navigationStartupWarning = checked - } - Label { - text: "Show again"; - color: textLabel.color - anchors.verticalCenter: startupCheckbox.verticalCenter - } - } - - Item { - height: 5; width: 1 - } - } - - buttons: ButtonRow { - anchors.horizontalCenter: parent.horizontalCenter - Button { text: "OK"; onClicked: safetyWarningDialog.accept() } - } - - onAccepted: settings.navigationStartupWarningEverShown = true - } - */ - - Connections { target: marbleWidget.navigation; onVoiceNavigationAnnouncementChanged: voiceAnnouncement() } - - function voiceAnnouncement() { - playback.source = "file://" + marbleWidget.navigation.voiceNavigationAnnouncement - playback.play() - } -} diff --git a/src/apps/marble-touch/activities/Placemark.qml b/src/apps/marble-touch/activities/Placemark.qml deleted file mode 100644 index d04800ade..000000000 --- a/src/apps/marble-touch/activities/Placemark.qml +++ /dev/null @@ -1,79 +0,0 @@ -// 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 2012 Dennis Nienhüser - -import QtQuick 2.3 -import com.nokia.meego 1.0 -import org.kde.edu.marble 0.20 -import ".." - -Page { - id: placemarkActivityPage - anchors.fill: parent - - property string uid: "edu.kde.org.marble.placemarkActivityPage" - property bool horizontal: width / height > 1.20 - - tools: ToolBarLayout { - MarbleToolIcon { - iconSource: main.icon( "actions/go-home", 48 ); - onClicked: main.showNavigation() - } - } - - Rectangle { - id: placemarkView - - anchors.bottom: placemarkActivityPage.bottom - anchors.left: placemarkActivityPage.left - width: placemarkActivityPage.horizontal ? placemarkActivityPage.width / 2 : placemarkActivityPage.width - height: placemarkActivityPage.horizontal ? placemarkActivityPage.height : 205 - - color: "#e7e7e7" - border.width: 2 - border.color: "darkgray" - - radius: 10 - z: 10 - opacity: 0.9 - property string searchTerm: "" - - PlacemarkEditor { - id: placemarkEditor - anchors.fill: parent - anchors.margins: 10 - } - } - - Item { - id: mapContainer - clip: true - - anchors.left: placemarkActivityPage.horizontal ? placemarkView.right : placemarkActivityPage.left - anchors.bottom: placemarkActivityPage.horizontal ? placemarkActivityPage.bottom : placemarkView.top - anchors.right: placemarkActivityPage.right - anchors.top: placemarkActivityPage.top - - function embedMarbleWidget() { - marbleWidget.parent = mapContainer - marbleWidget.visible = true - } - - Component.onDestruction: { - if ( marbleWidget.parent === mapContainer ) { - marbleWidget.parent = null - marbleWidget.visible = false - } - } - } - - onStatusChanged: { - if ( status === PageStatus.Activating ) { - mapContainer.embedMarbleWidget() - } - } -} diff --git a/src/apps/marble-touch/activities/Routing.qml b/src/apps/marble-touch/activities/Routing.qml deleted file mode 100644 index 76453c8d3..000000000 --- a/src/apps/marble-touch/activities/Routing.qml +++ /dev/null @@ -1,404 +0,0 @@ -// 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 2011 Dennis Nienhüser -// Copyright 2013 Andrei Duma - -import QtQuick 2.3 -import org.kde.edu.marble 0.20 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.2 -import QtQuick.Dialogs 1.2 -import ".." - -/* - * Page for routing activity. - */ -Item { - id: routingActivityPage - anchors.fill: parent - - property bool horizontal: width / height > 1.20 - - RowLayout { - id: toolBar - anchors.fill: parent - ToolButton { - text: "Home" - onClicked: activitySelection.showActivities() - } - ToolButton { - id: minimizeButton - text: "Routing" - iconSource: main.icon( "actions/go-up", 48 ); - checkable: true - checked: true - width: 60 - } - ToolButton { - text: "My Position" - iconSource: main.icon( "places/user-identity", 48 ); - onClicked: { - marbleWidget.centerOn( marbleWidget.tracking.lastKnownPosition.longitude, marbleWidget.tracking.lastKnownPosition.latitude ) - if (marbleWidget.zoom < 22026 ) { - marbleWidget.zoom = 86250 - } - } - } - ToolButton { - iconSource: main.icon( "devices/network-wireless", 48 ); - checkable: true - checked: !settings.workOffline - onCheckedChanged: settings.workOffline = !checked - width: 60 - } - - ToolButton { - text: "Start Navigation" - onClicked: openActivity( "Navigation" ) - } - - // @TODO FIXME Port to QtQuick 2 - /* - ToolButton { - text: "Prepare Offline Usage" - onClicked: downloadSheet.open() - } - */ - - ToolButton { - text: "Save Route" - onClicked: { - saveRouteDialog.filename = "route-" + Qt.formatDateTime(new Date(), "yyyy-MM-dd_hh.mm.ss") + ".kml" - saveRouteDialog.open() - } - } - - ToolButton { - text: "Open Route" - onClicked: openRouteDialog.open() - } - - ToolButton { - text: "Elevation Profile" - checkable: true - checked: false - onCheckedChanged: { - var plugins = settings.activeRenderPlugins - if ( checked ) { - plugins.push("elevationprofile") - } else { - settings.removeElementsFromArray(plugins, ["elevationprofile"]) - } - settings.activeRenderPlugins = plugins - marbleWidget.setGeoSceneProperty( "hillshading", checked ) - } - } - - Item { Layout.fillWidth: true } - } - - Rectangle { - anchors.fill: parent - color: "white" - } - - Flickable { - id: searchResultView - contentWidth: width - contentHeight: routeEditor.height + waypointListView.height - - property bool minimized: !minimizeButton.checked - visible: !minimized - - anchors.bottom: routingActivityPage.bottom - anchors.left: routingActivityPage.left - width: routingActivityPage.horizontal ? (minimized ? 0 : routingActivityPage.width / 2) : routingActivityPage.width - height: routingActivityPage.horizontal ? routingActivityPage.height : (minimized ? 0 : routingActivityPage.height / 2) - - Behavior on height { - enabled: !routingActivityPage.horizontal; - NumberAnimation { - easing.type: Easing.InOutQuad; - duration: 250 - } - } - - RouteEditor { - id: routeEditor - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: 5 - } - - ListView { - id: waypointListView - anchors.top: routeEditor.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: 5 - height: 74 * count - - model: marbleWidget.routing.waypointModel() - delegate: turnTypeDelegate - highlight: Rectangle { color: "lightsteelblue"; radius: 5 } - highlightMoveDuration: 200 - focus: true - interactive: false - spacing: 4 - clip: true - } - } - - Item { - id: mapContainer - clip: true - - anchors.left: routingActivityPage.horizontal ? searchResultView.right : routingActivityPage.left - anchors.bottom: routingActivityPage.horizontal ? routingActivityPage.bottom : searchResultView.top - anchors.right: routingActivityPage.right - anchors.top: routingActivityPage.top - - function embedMarbleWidget() { - marbleWidget.parent = mapContainer - settings.projection = "Mercator" - var plugins = settings.defaultRenderPlugins - settings.removeElementsFromArray(plugins, ["coordinate-grid", "sun", "stars", "compass"]) - settings.activeRenderPlugins = plugins - settings.mapTheme = settings.streetMapTheme - settings.gpsTracking = true - settings.showPositionIndicator = true - marbleWidget.tracking.positionMarkerType = Tracking.Circle - settings.showTrack = false - marbleWidget.visible = true - } - - Component.onDestruction: { - if ( marbleWidget.parent === mapContainer ) { - marbleWidget.parent = null - marbleWidget.visible = false - } - } - } - - FileDialog { - id: saveRouteDialog - folder: "/home/user/MyDocs" - nameFilters: [ "*.kml" ] - - onAccepted: { marbleWidget.routing.saveRoute( folder + "/" + filename ); } - } - - FileDialog { - id: openRouteDialog - folder: "/home/user/MyDocs" - nameFilters: [ "*.kml", "*.gpx" ] - - onAccepted: { marbleWidget.routing.openRoute( folder + "/" + filename ); } - } - - Component { - id: turnTypeDelegate - - Column { - width: parent.width - spacing: 4 - - Row { - id: row - width: parent.width - Image { - id: turnIcon - width: 64; height: 64 - source: "qrc" + turnTypeIcon - } - - Label { - anchors.verticalCenter: parent.verticalCenter - font.pixelSize: 18 - text: display; - width: parent.width - turnIcon.width - 20 - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - - MouseArea { - anchors.fill: parent - onClicked: { - waypointListView.currentIndex = index - marbleWidget.centerOn(longitude, latitude) - } - } - } - } - - Rectangle { - x: 5 - width: parent.width - 20 - height: 1 - color: "white" - } - } - } - - Component.onCompleted: { - mapContainer.embedMarbleWidget() - mainWindow.toolBar.replaceWith(toolBar) - - } - - Component { - id: routeViewDelegate - - Item { - property bool selected: routeView.currentIndex === index - - MouseArea { - anchors.fill: parent - onClicked: routeView.currentIndex = index - } - - width: routeView.width - height: routeTopBox.height + (selected ? routeControlBox.height + 15 : 10) - - Item { - id: routeTopBox - anchors.margins: 5 - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - height: previewImage.height - - Image { - id: previewImage - source: previewUrl - width: 128; height: 128 - } - - Item { - id: routeInfo - - anchors.left: previewImage.right - anchors.leftMargin: 5 - anchors.right: parent.right - anchors.top: parent.top - anchors.bottom: parent.bottom - - Text { - id: nameText - text: name - anchors.centerIn: parent - width: parent.width - 20 - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - font.pixelSize: 18 - } - } - } - } - } - - /* - Item { - id: downloadSheet - anchors.fill: parent - - //acceptButtonText: "Download" - //rejectButtonText: "Cancel" - - Column { - anchors.fill: parent - anchors.margins: 10 - spacing: 10 - - Label { - text: "Select the map images to download for offline usage. Note that routing data and voice navigation speakers must be downloaded in the Preferences." - color: "gray" - width: parent.width - } - - Label { text: "Download Mode" } - - ButtonRow { - id: downloadTypeSwitch - checkedButton: routeButton - property bool routeMode: checkedButton === routeButton - - Button { - id: routeButton - text: "Route" - } - - Button { - id: areaButton - text: "Visible Area" - } - } - - Label { - width: parent.width - text: downloadTypeSwitch.routeMode ? "The current route area is downloaded" : "The currently visible map area is downloaded" - color: "gray" - wrapMode: Text.WordWrap - } - - Label { text: "Level of detail" } - - Slider { - id: tileSlider - stepSize: 1 - valueIndicatorVisible: true - minimumValue: 11 - maximumValue: 16 - value: 14 - valueIndicatorText: "tile level " + value - width: parent.width - } - - Label { - anchors.left: tileSlider.left - anchors.right: tileSlider.right - anchors.margins: 30 - color: "gray" - text: humanValue() - function humanValue() { - switch (tileSlider.value) { - case 11: return "Very coarse" - case 12: return "Cities with names" - case 13: return "Villages and suburbs with names" - case 14: return "Important streets with names" - case 15: return "Many streets with names" - case 16: return "Most streets with names" - } - } - } - - Label { - text: "Side margin" - visible: downloadTypeSwitch.routeMode - } - - Slider { - id: offsetSlider - visible: downloadTypeSwitch.routeMode - stepSize: 50 - valueIndicatorVisible: true - valueIndicatorText: value + " meter" - minimumValue: 100 - value: 500 - maximumValue: 2500 - width: parent.width - } - } - - onAccepted: { - if (downloadTypeSwitch.routeMode) { - marbleWidget.downloadRoute( offsetSlider.value, 0, tileSlider.value ) - } else { - marbleWidget.downloadArea( 0, tileSlider.value ) - } - } - } - */ -} diff --git a/src/apps/marble-touch/activities/Search.qml b/src/apps/marble-touch/activities/Search.qml deleted file mode 100644 index fbdfc3e2d..000000000 --- a/src/apps/marble-touch/activities/Search.qml +++ /dev/null @@ -1,261 +0,0 @@ -// 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 2011 Dennis Nienhüser -// Copyright 2011 Daniel Marth - -import QtQuick 2.3 -import org.kde.edu.marble 0.20 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.2 -import ".." - -/* - * Page for geocaching activity. - */ -Item { - id: searchActivityPage - anchors.fill: parent - - property bool horizontal: width / height > 1.20 - - RowLayout { - id: toolBar - anchors.fill: parent - ToolButton { - text: "Home" - onClicked: activitySelection.showActivities() - } - - ToolButton { - id: minimizeButton - text: "Search" - checkable: true - checked: true - width: 60 - iconSource: main.icon( "actions/go-up", 48 ); - } - - Item { Layout.fillWidth: true } - } - - Rectangle { - id: searchResultView - - property bool minimized: !minimizeButton.checked - visible: !minimized - - anchors.bottom: searchActivityPage.bottom - anchors.left: searchActivityPage.left - width: searchActivityPage.horizontal ? (minimized ? 0 : searchActivityPage.width / 2) : searchActivityPage.width - height: searchActivityPage.horizontal ? searchActivityPage.height : (minimized ? 0 : searchActivityPage.height / 2) - - Behavior on height { - enabled: !searchActivityPage.horizontal; - NumberAnimation { - easing.type: Easing.InOutQuad; - duration: 250 - } - } - - radius: 10 - color: "#f7f7f7" - border.width: 2 - border.color: "darkgray" - z: 10 - opacity: 0.9 - property string searchTerm: "" - - SearchField { - id: searchField - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: 10 - onSearch: { - searchResultView.searchTerm = term - searchField.busy = true - marbleWidget.find( term ) - searchResultListView.model = marbleWidget.search.searchResultModel() - } - - Component.onCompleted: { - marbleWidget.search.searchFinished.connect( searchFinished ) - } - - function searchFinished() { - busy = false - } - } - - Label { - id: searchResultDescription - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - anchors.top: searchField.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: 10 - - font.pointSize: 16 - text: "

Example search terms

  • London
  • Baker Street, London
  • Baker Street 221b, London
  • Restaurant, London

" - visible: searchResultView.searchTerm === "" && searchResultListView.count === 0 - } - - ListView { - id: searchResultListView - property int count: model === null ? 0 : model.count - - anchors.top: searchField.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.margins: 10 - model: marbleWidget.search.searchResultModel() - delegate: searchResultDelegate - highlight: Rectangle { color: "lightgray"; radius: 5 } - focus: true - clip: true - } - } - - - Item { - id: mapContainer - clip: true - - anchors.left: searchActivityPage.horizontal ? searchResultView.right : searchActivityPage.left - anchors.bottom: searchActivityPage.horizontal ? searchActivityPage.bottom : searchResultView.top - anchors.right: searchActivityPage.right - anchors.top: searchActivityPage.top - - function embedMarbleWidget() { - marbleWidget.parent = mapContainer - settings.projection = "Mercator" - var plugins = settings.defaultRenderPlugins - settings.removeElementsFromArray(plugins, ["coordinate-grid", "sun", "stars", "compass"]) - settings.activeRenderPlugins = plugins - settings.mapTheme = settings.streetMapTheme - settings.gpsTracking = false - settings.showPositionIndicator = true - marbleWidget.tracking.positionMarkerType = Tracking.Circle - settings.showTrack = false - marbleWidget.visible = true - } - - Component.onDestruction: { - if ( marbleWidget.parent === mapContainer ) { - marbleWidget.parent = null - marbleWidget.visible = false - } - } - } - - Component { - id: searchResultDelegate - - Item { - id: searchResultItem - width: parent.width - 20 - height: column.height + 10 - x: 10 - y: 5 - property bool detailed: ListView.isCurrentItem - - Column { - id: column - - Row { - spacing: 5 - - Label { - id: searchResultText - anchors.verticalCenter: parent.verticalCenter - font.pointSize: 16 - text: (index+1) + ". " + name - width: searchResultItem.width - bookmarkButton.width - parent.spacing - 10 - wrapMode: searchResultItem.detailed ? Text.WrapAtWordBoundaryOrAnywhere : Text.NoWrap - clip: true - - MouseArea { - anchors.fill: parent - onClicked: { - searchResultListView.currentIndex = index - marbleWidget.centerOn( longitude, latitude ) - } - } - } - - ToolButton { - id: bookmarkButton - anchors.verticalCenter: parent.verticalCenter - height: 38 - width: 38 - property bool isBookmark: marbleWidget.bookmarks.isBookmark(longitude,latitude) - iconSource: isBookmark ? "qrc:/icons/bookmark.png" : "qrc:/icons/bookmark-disabled.png" - visible: searchResultItem.detailed - onClicked: { - if ( isBookmark ) { - marbleWidget.bookmarks.removeBookmark(longitude,latitude) - } else { - marbleWidget.bookmarks.addBookmark(longitude,latitude, name, "Default") - } - isBookmark = marbleWidget.bookmarks.isBookmark(longitude,latitude) - } - } - } - - Row { - spacing: 5 - visible: searchResultItem.detailed - - Button { - id: carButton - width: 120 - iconSource: "qrc:/icons/routing-motorcar.svg" - onClicked: { - marbleWidget.routing.routingProfile = "Motorcar" - searchActivityPage.startRouting(longitude, latitude) - } - } - - Button { - id: bikeButton - width: 80 - iconSource: "qrc:/icons/routing-bike.svg" - onClicked: { - marbleWidget.routing.routingProfile = "Bicycle" - searchActivityPage.startRouting(longitude, latitude) - } - } - - Button { - id: pedButton - width: 60 - iconSource: "qrc:/icons/routing-pedestrian.svg" - onClicked: { - marbleWidget.routing.routingProfile = "Pedestrian" - searchActivityPage.startRouting(longitude, latitude) - } - } - } - } - } - } - - Component.onCompleted: { - mapContainer.embedMarbleWidget() - mainWindow.toolBar.replaceWith(toolBar) - } - - function startRouting(longitude, latitude) - { - settings.gpsTracking = true - marbleWidget.routing.clearRoute() - marbleWidget.routing.setVia( 0, marbleWidget.tracking.lastKnownPosition.longitude, marbleWidget.tracking.lastKnownPosition.latitude ) - marbleWidget.routing.setVia( 1, longitude, latitude ) - openActivity( "Routing" ) - } -} diff --git a/src/apps/marble-touch/activities/SpaceView.qml b/src/apps/marble-touch/activities/SpaceView.qml deleted file mode 100644 index 0e8400b89..000000000 --- a/src/apps/marble-touch/activities/SpaceView.qml +++ /dev/null @@ -1,209 +0,0 @@ -// 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 2011 Dennis Nienhüser - -import QtQuick 2.3 -import org.kde.edu.marble 0.20 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.2 -import ".." - -/* - * Page for the space view activity. - */ -Item { - id: spaceViewActivityPage - anchors.fill: parent - - RowLayout { - id: toolBar - anchors.fill: parent - ToolButton { - text: "Home" - onClicked: activitySelection.showActivities() - } - - RowLayout { - ExclusiveGroup { id: planetGroup } - - RadioButton { - id: earthButton - exclusiveGroup: planetGroup - text: "Earth" - checked: true - onCheckedChanged: { if ( checked ) spaceViewActivityPage.setEarthSettings() } - } - RadioButton { - exclusiveGroup: planetGroup - text: "Moon" - onCheckedChanged: { if ( checked ) settings.mapTheme = "moon/clementine/clementine.dgml" } - } - RadioButton { - exclusiveGroup: planetGroup - text: "Other..." - onCheckedChanged: { if ( checked ) themeDialog.open() } - } - } - - ToolButton { - id: satellitesSwitch - text: "Satellites" - checkable: true - checked: false - onCheckedChanged: spaceViewActivityPage.setEarthSettings() - } - - ToolButton { - id: cloudsSwitch - text: "Clouds" - checkable: true - checked: false - onCheckedChanged: spaceViewActivityPage.setEarthSettings() - } - - RowLayout { - ExclusiveGroup { id: lightingGroup } - - RadioButton { - id: dayView - text: "Day" - checked: true - exclusiveGroup: lightingGroup - onCheckedChanged: spaceViewActivityPage.setEarthSettings() - } - - RadioButton { - id: nightView - text: "Night" - checked: false - exclusiveGroup: lightingGroup - onCheckedChanged: spaceViewActivityPage.setEarthSettings() - } - - RadioButton { - id: realtimeView - text: "Realtime" - checked: false - exclusiveGroup: lightingGroup - onCheckedChanged: spaceViewActivityPage.setEarthSettings() - } - } - Item { Layout.fillWidth: true } - } - - MapThemeModel { - id: mapThemeModel - mapThemeFilter: MapThemeModel.Terrestrial - } - - Item { - id: mapContainer - anchors.fill: parent - - function embedMarbleWidget() { - marbleWidget.parent = mapContainer - settings.projection = "Spherical" - settings.activeRenderPlugins = settings.defaultRenderPlugins - spaceViewActivityPage.setEarthSettings() - if (marbleWidget.radius > 655 ) { - marbleWidget.radius = 170 - } - settings.gpsTracking = false - settings.showPositionIndicator = false - marbleWidget.tracking.positionMarkerType = Tracking.Circle - settings.showTrack = false - marbleWidget.visible = true - } - - Component.onDestruction: { - if ( marbleWidget.parent === mapContainer ) { - marbleWidget.parent = null - marbleWidget.visible = false - } - } - } - - SelectionDialog { - id: themeDialog - titleText: "Select Map Theme" - currentIndex: mapThemeModel.indexOf(settings.mapTheme) - model: mapThemeModel - delegate: - Rectangle { - id: delegate - width: row.width - height: row.height - - color: index === themeDialog.currentIndex ? "lightsteelblue" : "#00ffffff" - - Row { - id: row - spacing: 5 - Image { - id: mapImage - source: "image://maptheme/" + mapThemeId - smooth: true - width: 68 - height: 68 - } - Label { - id: themeLabel - text: display - font.pointSize: 18 - color: "black" - anchors.verticalCenter: parent.verticalCenter - } - } - - MouseArea { - anchors.fill: parent - onClicked: { - themeDialog.currentIndex = index - themeDialog.visible = false - delayedMapThemeSwitch.theme = mapThemeId - delayedMapThemeSwitch.start() - } - } - } - } - - Timer { - id: delayedMapThemeSwitch - property string theme: "earth/bluemarble/bluemarble.dgml" - interval: 10; running: false; repeat: false - onTriggered: settings.mapTheme = theme - } - - Component.onCompleted: { - mapContainer.embedMarbleWidget() - mainWindow.toolBar.replaceWith(toolBar) - } - - function setEarthSettings() { - if (dayView.checked) { - settings.mapTheme = "earth/bluemarble/bluemarble.dgml" - marbleWidget.setGeoSceneProperty( "citylights", false ) - marbleWidget.setGeoSceneProperty( "clouds_data", cloudsSwitch.checked ) - } else if (nightView.checked) { - settings.mapTheme = "earth/citylights/citylights.dgml" - marbleWidget.setGeoSceneProperty( "citylights", false ) - marbleWidget.setGeoSceneProperty( "clouds_data", cloudsSwitch.checked ) - } else { - settings.mapTheme = "earth/bluemarble/bluemarble.dgml" - marbleWidget.setGeoSceneProperty( "citylights", true ) - marbleWidget.setGeoSceneProperty( "clouds_data", cloudsSwitch.checked ) - } - - var plugins = settings.activeRenderPlugins - if ( satellitesSwitch.checked ) { - plugins.push( "satellites" ) - } else { - settings.removeElementsFromArray( plugins, ["satellites"] ) - } - settings.activeRenderPlugins = plugins - } -} diff --git a/src/apps/marble-touch/activities/Tracking.qml b/src/apps/marble-touch/activities/Tracking.qml deleted file mode 100644 index 25012e561..000000000 --- a/src/apps/marble-touch/activities/Tracking.qml +++ /dev/null @@ -1,151 +0,0 @@ -// 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 2011 Dennis Nienhüser -// Copyright 2011 Daniel Marth - -import QtQuick 2.3 -import org.kde.edu.marble 0.20 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.2 -import QtQuick.Dialogs 1.2 -import ".." - -/* - * Page for geocaching activity. - */ -Item { - id: trackingActivityPage - anchors.fill: parent - - RowLayout { - id: toolBar - anchors.fill: parent - ToolButton { - text: "Home" - onClicked: activitySelection.showActivities() - } - ToolButton { - text: "My Position" - iconSource: main.icon( "places/user-identity", 48 ); - onClicked: { - marbleWidget.centerOn( marbleWidget.tracking.lastKnownPosition.longitude, marbleWidget.tracking.lastKnownPosition.latitude ) - if (marbleWidget.zoom < 22026 ) { - marbleWidget.zoom = 4197500 - } - } - } - ToolButton { - id: searchButton - text: "Search" - checkable: true - width: 60 - iconSource: main.icon( "actions/edit-find", 48 ); - } - ToolButton { - text: "Save Track" - onClicked: { - //saveTrackDialog.fileUrl = Qt.formatDateTime(new Date(), "yyyy-MM-dd_hh.mm.ss") + ".kml" - saveTrackDialog.open() - } - } - ToolButton { - text: "Open Track" - onClicked: openTrackDialog.open() - } - ToolButton { - text: "Auto Center" - checkable: true - checked: false - onCheckedChanged: { - marbleWidget.tracking.autoCenter = checked - } - } - ToolButton { - text: "Auto Zoom" - checked: false - checkable: true - onCheckedChanged: { - marbleWidget.tracking.autoZoom = checked - } - } - Item { Layout.fillWidth: true } - } - - - SearchField { - id: searchField - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - visible: searchButton.checked - width: parent.width - onSearch: { - searchField.busy = true - marbleWidget.find( term ) - } - - Component.onCompleted: { - marbleWidget.search.searchFinished.connect( searchFinished ) - } - - function searchFinished() { - searchField.busy = false - } - } - - Item { - id: mapContainer - anchors.left: parent.left - anchors.right: parent.right - anchors.top: searchButton.checked ? searchField.bottom : parent.top - anchors.bottom: parent.bottom - clip: true - - function embedMarbleWidget() { - marbleWidget.parent = mapContainer - settings.projection = "Mercator" - var plugins = settings.defaultRenderPlugins - settings.removeElementsFromArray(plugins, ["coordinate-grid", "sun", "stars", "compass"]) - plugins.push( "speedometer" ) - settings.activeRenderPlugins = plugins - settings.mapTheme = settings.streetMapTheme - settings.gpsTracking = true - settings.showPositionIndicator = true - marbleWidget.tracking.positionMarkerType = Tracking.Arrow - settings.showTrack = true - marbleWidget.visible = true - } - - Component.onDestruction: { - if ( marbleWidget.parent === mapContainer ) { - marbleWidget.parent = null - marbleWidget.visible = false - } - } - } - - FileDialog { - id: saveTrackDialog - folder: "/home/user/MyDocs" - nameFilters: [ "*.kml" ] - - onAccepted: { marbleWidget.tracking.saveTrack( folder + "/" + filename ); } - } - - FileDialog { - id: openTrackDialog - folder: "/home/user/MyDocs" - nameFilters: [ "*.kml", "*.gpx" ] - - onAccepted: { marbleWidget.tracking.openTrack( folder + "/" + filename ); } - } - - Component.onCompleted: { - mapContainer.embedMarbleWidget() - mainWindow.toolBar.replaceWith(toolBar) - } -} diff --git a/src/apps/marble-touch/activities/VirtualGlobe.qml b/src/apps/marble-touch/activities/VirtualGlobe.qml deleted file mode 100644 index 1133ddb97..000000000 --- a/src/apps/marble-touch/activities/VirtualGlobe.qml +++ /dev/null @@ -1,156 +0,0 @@ -// 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 2011 Dennis Nienhüser -// Copyright 2011 Daniel Marth - -import QtQuick 2.3 -import org.kde.edu.marble 0.20 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.2 -import ".." - -/* - * Page for the virtual globe activity. - */ -Item { - id: virtualGlobeActivityPage - anchors.fill: parent - - RowLayout { - id: toolBar - anchors.fill: parent - ToolButton { - text: "Home" - onClicked: activitySelection.showActivities() - } - ToolButton { - id: searchButton - text: "Search" - checkable: true - width: 60 - iconSource: main.icon( "actions/edit-find", 48 ); - } - ToolButton { - id: themeButton - width: 60 - text: "Map Theme" - iconSource: main.icon( "actions/configure", 48 ); - onClicked: themeDialog.visible = true - - MapThemeModel { - id: mapThemeModel - mapThemeFilter: MapThemeModel.Extraterrestrial - } - } - Item { Layout.fillWidth: true } - } - - SearchField { - id: searchField - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - visible: searchButton.checked - onSearch: { - searchField.busy = true - marbleWidget.find( term ) - } - - Component.onCompleted: { - marbleWidget.search.searchFinished.connect( searchFinished ) - } - - function searchFinished() { - searchField.busy = false - } - } - - Item { - id: mapContainer - anchors.left: parent.left - anchors.right: parent.right - anchors.top: searchButton.checked ? searchField.bottom : parent.top - anchors.bottom: parent.bottom - - function embedMarbleWidget() { - marbleWidget.parent = mapContainer - settings.projection = "Spherical" - settings.activeRenderPlugins = settings.defaultRenderPlugins - settings.mapTheme = "earth/srtm/srtm.dgml" - settings.gpsTracking = false - settings.showPositionIndicator = false - marbleWidget.tracking.positionMarkerType = Tracking.Circle - settings.showTrack = false - marbleWidget.visible = true - } - - Component.onDestruction: { - if ( marbleWidget.parent === mapContainer ) { - marbleWidget.parent = null - marbleWidget.visible = false - } - } - } - - Timer { - id: delayedMapThemeSwitch - property string theme: "earth/srtm/srtm.dgml" - interval: 10; running: false; repeat: false - onTriggered: settings.mapTheme = theme - } - - SelectionDialog { - id: themeDialog - anchors.fill: parent - titleText: "Select Map Theme" - currentIndex: mapThemeModel.indexOf(settings.mapTheme) - model: mapThemeModel - delegate: - Rectangle { - id: delegate - width: row.width - height: row.height - - color: index === themeDialog.currentIndex ? "lightsteelblue" : "white" - - Row { - id: row - Image { - id: mapImage - source: "image://maptheme/" + mapThemeId - smooth: true - width: 68 - height: 68 - } - Label { - id: themeLabel - width: 400 - text: display - font.pointSize: 18 - color: "black" - anchors.verticalCenter: parent.verticalCenter - } - } - - MouseArea { - anchors.fill: parent - onClicked: { - themeDialog.currentIndex = index - themeDialog.visible = false - delayedMapThemeSwitch.theme = mapThemeId - delayedMapThemeSwitch.start() - } - } - } - } - - - Component.onCompleted: { - mapContainer.embedMarbleWidget() - mainWindow.toolBar.replaceWith(toolBar) - } -} diff --git a/src/apps/marble-touch/activities/Weather.qml b/src/apps/marble-touch/activities/Weather.qml deleted file mode 100644 index cfb79ede3..000000000 --- a/src/apps/marble-touch/activities/Weather.qml +++ /dev/null @@ -1,323 +0,0 @@ -// 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 2011 Dennis Nienhüser -// Copyright 2011 Daniel Marth - -import QtQuick 2.3 -import org.kde.edu.marble 0.20 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.2 -import ".." - -/* - * Page for the weather activity. - */ -Item { - id: weatherActivityPage - anchors.fill: parent - - property bool horizontal: width / height > 1.20 - - RowLayout { - id: toolBar - anchors.fill: parent - ToolButton { - text: "Home" - onClicked: activitySelection.showActivities() - } - ToolButton { - text: "My Position" - iconSource: main.icon( "places/user-identity", 48 ); - onClicked: { - marbleWidget.centerOn( marbleWidget.tracking.lastKnownPosition.longitude, marbleWidget.tracking.lastKnownPosition.latitude ) - if (marbleWidget.zoom < 403 ) { - marbleWidget.zoom = 22026 - } - } - } - - ToolButton { - id: favoriteButton - text: "Favorites" - checkable: true - checked: marbleWidget.renderPlugin("weather").favoriteItemsOnly - width: 60 - iconSource: main.icon( "places/favorites", 48 ); - onCheckedChanged: marbleWidget.renderPlugin("weather").favoriteItemsOnly = checked - } - - ToolButton { - id: searchButton - text: "Search" - checkable: true - checked: false - width: 60 - iconSource: main.icon( "actions/edit-find", 48 ); - } - Item { Layout.fillWidth: true } - } - - SearchField { - id: searchField - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - visible: searchButton.checked - onSearch: { - busy = true - marbleWidget.find( term ) - } - - Component.onCompleted: { - marbleWidget.search.searchFinished.connect( searchFinished ) - } - - function searchFinished() { - busy = false - } - } - - Rectangle { - id: stationDetails - property bool minimized: station === "" - visible: !minimized - - property string identifier - property string station - property double temperature - property string image - property string description - property bool favorite: false - - anchors.bottom: weatherActivityPage.bottom - anchors.left: weatherActivityPage.left - width: weatherActivityPage.horizontal ? (minimized ? 0 : weatherActivityPage.width / 2) : weatherActivityPage.width - height: weatherActivityPage.horizontal ? weatherActivityPage.height : (minimized ? 0 : 20 + label.height + Math.max(descriptionLabel.height, icon.height)) - - radius: 5 - border.color: "darkgray" - border.width: 2 - - Item { - anchors.fill: parent - anchors.margins: 10 - - ToolButton { - id: bookmarkButton - anchors.right: parent.right - - iconSource: stationDetails.favorite ? "qrc:/icons/bookmark.png" : "qrc:/icons/bookmark-disabled.png" - - width: 32 - height: 32 - - onClicked: stationDetails.favorite = !stationDetails.favorite - } - - Label { - id: label - text: stationDetails.temperature + " °C " + stationDetails.station - anchors.left: parent.left - anchors.right: bookmarkButton.left - wrapMode: Text.Wrap - } - - Text { - id: descriptionLabel - anchors.margins: 10 - anchors.top: label.bottom - anchors.left: icon.right - text: stationDetails.description - } - - Image { - id: icon - anchors.top: label.bottom - source: stationDetails.image !== "" ? ("file://" + stationDetails.image) : "" - } - } - - Behavior on height { - enabled: !weatherActivityPage.horizontal; - NumberAnimation { - easing.type: Easing.InOutQuad; - duration: 250 - } - } - } - - Item { - id: mapContainer - anchors.left: weatherActivityPage.horizontal ? stationDetails.right : weatherActivityPage.left - anchors.bottom: weatherActivityPage.horizontal ? weatherActivityPage.bottom : stationDetails.top - anchors.right: weatherActivityPage.right - anchors.top: searchButton.checked ? searchField.bottom : weatherActivityPage.top - clip: true - - function embedMarbleWidget() { - marbleWidget.parent = mapContainer - settings.projection = "Spherical" - var plugins = settings.defaultRenderPlugins - plugins.push( "weather" ) - settings.activeRenderPlugins = plugins - settings.mapTheme = settings.streetMapTheme - settings.gpsTracking = true - settings.showPositionIndicator = false - settings.showTrack = false - marbleWidget.tracking.positionMarkerType = Tracking.Circle - marbleWidget.visible = true - marbleWidget.setDataPluginDelegate( "weather", weatherDelegate ) - } - - Component.onDestruction: { - marbleWidget.setDataPluginDelegate( "weather", 0 ) - if ( marbleWidget.parent === mapContainer ) { - marbleWidget.parent = null - marbleWidget.visible = false - } - } - } - - Component.onCompleted: { - mapContainer.embedMarbleWidget() - mainWindow.toolBar.replaceWith(toolBar) - } - - Rectangle { - anchors.top: parent.top - anchors.left: parent.left - anchors.topMargin: 30 - anchors.leftMargin: 15 - width: legend.width - height: legend.height - radius: 5 - color: Qt.rgba(192/255, 192/255, 192/255, 192/255) - border.width: 1 - border.color: "black" - smooth: true - - Column { - id: legend - x: 6 - y: 6 - width: 60 - height: items*(10+spacing)+2*x - property int items: 22 - spacing: 2 - - Repeater { - id: repeater - model: parent.items - - Row { - spacing: 4 - height: 10 - property int temperature: -3*index+36 - - Rectangle { - anchors.verticalCenter: parent.verticalCenter - width: 10 - height: 10 - radius: 3 - smooth: true - color: Qt.hsla( weatherActivityPage.temperatureToHue(parent.temperature)/255.0, 1.0, 0.5, 1.0 ) - } - - Text { - text: parent.temperature + " °C" - width: 34 - horizontalAlignment: Text.AlignRight - anchors.verticalCenter: parent.verticalCenter - } - } - } - } - } - - Component { - id: weatherDelegate - Item { - id: containerItem - width: Math.max(icon.width, label.width) - height: Math.max(icon.height, label.height) - clip: true - property bool showDetails: false - - Image { - id: icon - z: 0 - width: 64 - scale: 0.0 - smooth: true - fillMode: Image.PreserveAspectFit - source: image !== "" ? ("file://" + image) : "" - - MouseArea { - anchors.fill: parent - onClicked: containerItem.updateDetails() - } - } - - Text { - id: label - z: 0 - visible: !icon.visible - anchors.centerIn: parent - font.pixelSize: 24 - style: Text.Outline; - font.bold: true - color: Qt.hsla( weatherActivityPage.temperatureToHue(temperature)/255.0, 1.0, 0.5, 1.0 ) - styleColor: "black" - text: temperature.toFixed(0) + " °C" - - MouseArea { - anchors.fill: parent - onClicked: containerItem.updateDetails() - } - } - - SequentialAnimation { - id: appearAnimation - PauseAnimation { duration: Math.random() * 100 } - NumberAnimation { - target: icon - property: "scale" - to: 1.0 - duration: 150 - } - } - - function updateDetails() { - stationDetails.identifier = identifier - stationDetails.favorite = favorite - stationDetails.station = station - stationDetails.description = description - stationDetails.image = image - stationDetails.temperature = temperature - } - - Connections { - target: stationDetails - onFavoriteChanged: { - if (stationDetails.identifier === identifier) { - favorite = stationDetails.favorite - } - } - } - - Component.onCompleted: { - icon.visible = image !== "" && Math.random() >= 0.3 - appearAnimation.running = true - } - } - } - - function temperatureToHue(temperature) { - var factor = temperature > 20 ? 1.8 : ( temperature > 5 ? 2.1 : 2.7 ) - return -factor*(Math.max(-40, Math.min(40, temperature))-40) - } -} diff --git a/src/apps/marble-touch/icons/activity-bookmarks.png b/src/apps/marble-touch/icons/activity-bookmarks.png deleted file mode 100644 index c219e8e30..000000000 Binary files a/src/apps/marble-touch/icons/activity-bookmarks.png and /dev/null differ diff --git a/src/apps/marble-touch/icons/activity-configure.png b/src/apps/marble-touch/icons/activity-configure.png deleted file mode 100644 index ecbb741d5..000000000 Binary files a/src/apps/marble-touch/icons/activity-configure.png and /dev/null differ diff --git a/src/apps/marble-touch/icons/activity-default.png b/src/apps/marble-touch/icons/activity-default.png deleted file mode 100644 index c692623a3..000000000 Binary files a/src/apps/marble-touch/icons/activity-default.png and /dev/null differ diff --git a/src/apps/marble-touch/icons/activity-download.png b/src/apps/marble-touch/icons/activity-download.png deleted file mode 100644 index bd82c1d6d..000000000 Binary files a/src/apps/marble-touch/icons/activity-download.png and /dev/null differ diff --git a/src/apps/marble-touch/icons/activity-empty.png b/src/apps/marble-touch/icons/activity-empty.png deleted file mode 100644 index bbdd29c4b..000000000 Binary files a/src/apps/marble-touch/icons/activity-empty.png and /dev/null differ diff --git a/src/apps/marble-touch/icons/activity-explore.png b/src/apps/marble-touch/icons/activity-explore.png deleted file mode 100644 index f0b776020..000000000 Binary files a/src/apps/marble-touch/icons/activity-explore.png and /dev/null differ diff --git a/src/apps/marble-touch/icons/activity-explore.svg b/src/apps/marble-touch/icons/activity-explore.svg deleted file mode 100644 index 20fdf7559..000000000 --- a/src/apps/marble-touch/icons/activity-explore.svg +++ /dev/null @@ -1,63 +0,0 @@ - - - -image/svg+xml - - - - \ No newline at end of file diff --git a/src/apps/marble-touch/icons/activity-friends.png b/src/apps/marble-touch/icons/activity-friends.png deleted file mode 100644 index 9b37831c7..000000000 Binary files a/src/apps/marble-touch/icons/activity-friends.png and /dev/null differ diff --git a/src/apps/marble-touch/icons/activity-friends.svg b/src/apps/marble-touch/icons/activity-friends.svg deleted file mode 100644 index 6aecf494a..000000000 --- a/src/apps/marble-touch/icons/activity-friends.svg +++ /dev/null @@ -1,116 +0,0 @@ - - - -image/svg+xml - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/apps/marble-touch/icons/activity-navigation.png b/src/apps/marble-touch/icons/activity-navigation.png deleted file mode 100644 index da075c44a..000000000 Binary files a/src/apps/marble-touch/icons/activity-navigation.png and /dev/null differ diff --git a/src/apps/marble-touch/icons/activity-navigation.svg b/src/apps/marble-touch/icons/activity-navigation.svg deleted file mode 100755 index d84554a8f..000000000 --- a/src/apps/marble-touch/icons/activity-navigation.svg +++ /dev/null @@ -1,89 +0,0 @@ - - - -image/svg+xml - - - \ No newline at end of file diff --git a/src/apps/marble-touch/icons/activity-routing.png b/src/apps/marble-touch/icons/activity-routing.png deleted file mode 100644 index acd0ce38d..000000000 Binary files a/src/apps/marble-touch/icons/activity-routing.png and /dev/null differ diff --git a/src/apps/marble-touch/icons/activity-routing.svg b/src/apps/marble-touch/icons/activity-routing.svg deleted file mode 100755 index 39aea7d5a..000000000 --- a/src/apps/marble-touch/icons/activity-routing.svg +++ /dev/null @@ -1,66 +0,0 @@ - - - -image/svg+xml - - - - \ No newline at end of file diff --git a/src/apps/marble-touch/icons/activity-search.png b/src/apps/marble-touch/icons/activity-search.png deleted file mode 100644 index 497ed5284..000000000 Binary files a/src/apps/marble-touch/icons/activity-search.png and /dev/null differ diff --git a/src/apps/marble-touch/icons/activity-search.svg b/src/apps/marble-touch/icons/activity-search.svg deleted file mode 100755 index 95dd9b3fc..000000000 --- a/src/apps/marble-touch/icons/activity-search.svg +++ /dev/null @@ -1,641 +0,0 @@ - - - - - - - - - - Web - - - - - Philipp_Suess - - - - - lupe - - - - - Philipp_Suess - - - - - - - - - - - - - - - - - - Cyan - Magenta - Yellow - Black - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - \ No newline at end of file diff --git a/src/apps/marble-touch/icons/activity-spaceview.png b/src/apps/marble-touch/icons/activity-spaceview.png deleted file mode 100644 index a4071629f..000000000 Binary files a/src/apps/marble-touch/icons/activity-spaceview.png and /dev/null differ diff --git a/src/apps/marble-touch/icons/activity-spaceview.svg b/src/apps/marble-touch/icons/activity-spaceview.svg deleted file mode 100755 index 0948b87bb..000000000 --- a/src/apps/marble-touch/icons/activity-spaceview.svg +++ /dev/null @@ -1,215 +0,0 @@ - -image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/apps/marble-touch/icons/activity-tracking.png b/src/apps/marble-touch/icons/activity-tracking.png deleted file mode 100644 index 5c3037101..000000000 Binary files a/src/apps/marble-touch/icons/activity-tracking.png and /dev/null differ diff --git a/src/apps/marble-touch/icons/activity-tracking.svg b/src/apps/marble-touch/icons/activity-tracking.svg deleted file mode 100755 index a7d8ff158..000000000 --- a/src/apps/marble-touch/icons/activity-tracking.svg +++ /dev/null @@ -1,132 +0,0 @@ - - - -image/svg+xml - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/apps/marble-touch/icons/activity-virtualglobe.png b/src/apps/marble-touch/icons/activity-virtualglobe.png deleted file mode 100644 index b534352fd..000000000 Binary files a/src/apps/marble-touch/icons/activity-virtualglobe.png and /dev/null differ diff --git a/src/apps/marble-touch/icons/activity-virtualglobe.svg b/src/apps/marble-touch/icons/activity-virtualglobe.svg deleted file mode 100755 index 76baee7f2..000000000 --- a/src/apps/marble-touch/icons/activity-virtualglobe.svg +++ /dev/null @@ -1,50 +0,0 @@ - -image/svg+xml - - \ No newline at end of file diff --git a/src/apps/marble-touch/icons/activity-weather.png b/src/apps/marble-touch/icons/activity-weather.png deleted file mode 100644 index 27419158c..000000000 Binary files a/src/apps/marble-touch/icons/activity-weather.png and /dev/null differ diff --git a/src/apps/marble-touch/icons/activity-weather.svg b/src/apps/marble-touch/icons/activity-weather.svg deleted file mode 100755 index cfcce869c..000000000 --- a/src/apps/marble-touch/icons/activity-weather.svg +++ /dev/null @@ -1,153 +0,0 @@ - -image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/apps/marble-touch/icons/bookmark-disabled.png b/src/apps/marble-touch/icons/bookmark-disabled.png deleted file mode 100644 index 064c021f7..000000000 Binary files a/src/apps/marble-touch/icons/bookmark-disabled.png and /dev/null differ diff --git a/src/apps/marble-touch/icons/bookmark.png b/src/apps/marble-touch/icons/bookmark.png deleted file mode 100644 index c3101da74..000000000 Binary files a/src/apps/marble-touch/icons/bookmark.png and /dev/null differ diff --git a/src/apps/marble-touch/icons/globe.svg b/src/apps/marble-touch/icons/globe.svg deleted file mode 100644 index a91ea319d..000000000 --- a/src/apps/marble-touch/icons/globe.svg +++ /dev/null @@ -1,1393 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/apps/marble-touch/icons/information.png b/src/apps/marble-touch/icons/information.png deleted file mode 100644 index 1a52429e5..000000000 Binary files a/src/apps/marble-touch/icons/information.png and /dev/null differ diff --git a/src/apps/marble-touch/icons/information.svg b/src/apps/marble-touch/icons/information.svg deleted file mode 100755 index 8203dddcb..000000000 --- a/src/apps/marble-touch/icons/information.svg +++ /dev/null @@ -1,63 +0,0 @@ - - - -image/svg+xml - - - - \ No newline at end of file diff --git a/src/apps/marble-touch/icons/marker-direction.svg b/src/apps/marble-touch/icons/marker-direction.svg deleted file mode 100644 index c709304f3..000000000 --- a/src/apps/marble-touch/icons/marker-direction.svg +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - diff --git a/src/apps/marble-touch/icons/marker-yellow.svg b/src/apps/marble-touch/icons/marker-yellow.svg deleted file mode 100644 index 65a00fd8b..000000000 --- a/src/apps/marble-touch/icons/marker-yellow.svg +++ /dev/null @@ -1,215 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - diff --git a/src/apps/marble-touch/icons/marker.svg b/src/apps/marble-touch/icons/marker.svg deleted file mode 100644 index df20f1063..000000000 --- a/src/apps/marble-touch/icons/marker.svg +++ /dev/null @@ -1,215 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - diff --git a/src/apps/marble-touch/icons/placemark.svg b/src/apps/marble-touch/icons/placemark.svg deleted file mode 100644 index 97516d61a..000000000 --- a/src/apps/marble-touch/icons/placemark.svg +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - diff --git a/src/apps/marble-touch/icons/preferences.png b/src/apps/marble-touch/icons/preferences.png deleted file mode 100644 index 66005633b..000000000 Binary files a/src/apps/marble-touch/icons/preferences.png and /dev/null differ diff --git a/src/apps/marble-touch/icons/preferences.svg b/src/apps/marble-touch/icons/preferences.svg deleted file mode 100755 index 24b407631..000000000 --- a/src/apps/marble-touch/icons/preferences.svg +++ /dev/null @@ -1,78 +0,0 @@ - - - -image/svg+xml - - - - \ No newline at end of file diff --git a/src/apps/marble-touch/icons/routing-bike.svg b/src/apps/marble-touch/icons/routing-bike.svg deleted file mode 100644 index 751b47426..000000000 --- a/src/apps/marble-touch/icons/routing-bike.svg +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - diff --git a/src/apps/marble-touch/icons/routing-motorcar.svg b/src/apps/marble-touch/icons/routing-motorcar.svg deleted file mode 100755 index f6f832daa..000000000 --- a/src/apps/marble-touch/icons/routing-motorcar.svg +++ /dev/null @@ -1,76 +0,0 @@ - -image/svg+xml - - - - - - - \ No newline at end of file diff --git a/src/apps/marble-touch/icons/routing-pedestrian.svg b/src/apps/marble-touch/icons/routing-pedestrian.svg deleted file mode 100644 index a32990b32..000000000 --- a/src/apps/marble-touch/icons/routing-pedestrian.svg +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - diff --git a/src/apps/marble-touch/icons/wireless.svg b/src/apps/marble-touch/icons/wireless.svg deleted file mode 100644 index b51ec9972..000000000 --- a/src/apps/marble-touch/icons/wireless.svg +++ /dev/null @@ -1,65 +0,0 @@ - -image/svg+xml - - \ No newline at end of file diff --git a/src/apps/marble-touch/main.cpp b/src/apps/marble-touch/main.cpp deleted file mode 100644 index 3cef2f395..000000000 --- a/src/apps/marble-touch/main.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// 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 2011 Daniel Marth - -// A QML-interface of Marble for the Meego operating system. - -#include -#include -#include -#include "MarbleDebug.h" -#include "MarbleGlobal.h" -#include "declarative/MarbleDeclarativePlugin.h" - -using namespace Marble; - -int main( int argc, char *argv[] ) -{ - QApplication app( argc, argv ); - app.setApplicationName( "Marble Touch" ); - app.setOrganizationName( "KDE" ); - app.setOrganizationDomain( "kde.org" ); - - app.setProperty( "NoMStyle", true ); - const char* pluginUri = "org.kde.edu.marble"; - MarbleDeclarativePlugin plugin; - plugin.registerTypes(pluginUri); - - - //MarbleGlobal::Profiles profiles = MarbleGlobal::detectProfiles(); - MarbleGlobal::Profiles profiles = MarbleGlobal::SmallScreen | MarbleGlobal::HighResolution; - - QStringList args = QApplication::arguments(); - if ( args.contains( "-h" ) || args.contains( "--help" ) ) { - qWarning() << "Usage: marble-touch [options]"; - qWarning(); - qWarning() << "general options:"; - qWarning() << " --portrait ................. Force a rotation by 90 degree"; - qWarning() << " --debug-info ............... write (more) debugging information to the console"; - qWarning(); - qWarning() << "profile options (note that marble should automatically detect which profile to use. Override that with the options below):"; - qWarning() << " --smallscreen .............. Enforce the profile for devices with small screens (e.g. smartphones)"; - qWarning() << " --highresolution ........... Enforce the profile for devices with high resolution (e.g. desktop computers)"; - qWarning() << " --nosmallscreen ............ Deactivate the profile for devices with small screens (e.g. smartphones)"; - qWarning() << " --nohighresolution ......... Deactivate the profile for devices with high resolution (e.g. desktop computers)"; - - return 0; - } - - for ( int i = 1; i < args.count(); ++i ) { - QString const arg = args.at( i ); - - if ( arg == "--debug-info" ) { - MarbleDebug::setEnabled( true ); - } - else if ( arg == "--smallscreen" ) { - profiles |= MarbleGlobal::SmallScreen; - } - else if ( arg == "--nosmallscreen" ) { - profiles &= ~MarbleGlobal::SmallScreen; - } - else if ( arg == "--highresolution" ) { - profiles |= MarbleGlobal::HighResolution; - } - else if ( arg == "--nohighresolution" ) { - profiles &= ~MarbleGlobal::HighResolution; - } - } - - MarbleGlobal::getInstance()->setProfiles( profiles ); - - // Create main window based on QML. - QQmlApplicationEngine engine; - plugin.initializeEngine( &engine, pluginUri ); - engine.load(QUrl("qrc:/main.qml")); - - return app.exec(); -} diff --git a/src/apps/marble-touch/main.qml b/src/apps/marble-touch/main.qml deleted file mode 100644 index 32eb330f9..000000000 --- a/src/apps/marble-touch/main.qml +++ /dev/null @@ -1,19 +0,0 @@ -// 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 2011 Daniel Marth - -/* - * Main window of the application. Also contains activity properties, - * settings and manages plugin states on activity changes. - */ -MarbleWindow { - id: main - - visible: true - width: 600 - height: 800 -} diff --git a/src/apps/marble-touch/meego.qrc b/src/apps/marble-touch/meego.qrc deleted file mode 100644 index b3e1b4578..000000000 --- a/src/apps/marble-touch/meego.qrc +++ /dev/null @@ -1,61 +0,0 @@ - - - ../../../data/svg/marble-logo.svg - main.qml - MainWidget.qml - AboutMarblePage.qml - ActivitySelectionView.qml - activities/Explore.qml - activities/Friends.qml - activities/Geocaching.qml - activities/Navigation.qml - activities/Routing.qml - activities/Placemark.qml - activities/Search.qml - activities/SpaceView.qml - activities/Tracking.qml - activities/VirtualGlobe.qml - activities/Weather.qml - icons/activity-bookmarks.png - icons/activity-configure.png - icons/activity-default.png - icons/activity-download.png - icons/activity-empty.png - icons/activity-explore.png - icons/activity-friends.png - icons/activity-routing.png - icons/activity-navigation.png - icons/activity-search.png - icons/activity-spaceview.png - icons/activity-tracking.png - icons/activity-virtualglobe.png - icons/activity-weather.png - icons/information.png - icons/preferences.png - icons/bookmark.png - icons/bookmark-disabled.png - icons/routing-bike.svg - icons/routing-pedestrian.svg - icons/routing-motorcar.svg - icons/wireless.svg - icons/globe.svg - icons/marker-direction.svg - icons/marker-yellow.svg - icons/marker.svg - icons/placemark.svg - MapThemeSelectionPage.qml - MapThemePage.qml - MarbleWindow.qml - PreferencesPage.qml - OfflineDataPage.qml - CloudSyncPage.qml - MarbleTouch.qml - PositionIndicator.qml - PlacemarkEditor.qml - RouteEditor.qml - SearchField.qml - SelectionDialog.qml - ViaPointEditor.qml - MarbleSettings.qml - - diff --git a/src/lib/marble/declarative/Bookmarks.cpp b/src/lib/marble/declarative/Bookmarks.cpp index 1e2391014..19b2970cb 100644 --- a/src/lib/marble/declarative/Bookmarks.cpp +++ b/src/lib/marble/declarative/Bookmarks.cpp @@ -1,186 +1,190 @@ // // 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 2012 Dennis Nienhüser // #include "Bookmarks.h" #include "Planet.h" -#include "MarbleDeclarativeWidget.h" +#include "MarbleQuickItem.h" #include "MarbleModel.h" #include "MarbleMath.h" #include "MarblePlacemarkModel.h" #include "BookmarkManager.h" #include "GeoDataDocument.h" #include "GeoDataPlacemark.h" #include "GeoDataFolder.h" #include "GeoDataTypes.h" #include "GeoDataExtendedData.h" #include "GeoDataTreeModel.h" #include "kdescendantsproxymodel.h" #include +namespace Marble { + Bookmarks::Bookmarks( QObject* parent ) : QObject( parent ), - m_marbleWidget( 0 ), m_proxyModel( 0 ) + m_marbleQuickItem( 0 ), m_proxyModel( 0 ) { // nothing to do } -MarbleWidget *Bookmarks::map() +MarbleQuickItem *Bookmarks::map() { - return m_marbleWidget; + return m_marbleQuickItem; } -void Bookmarks::setMap( ::MarbleWidget* widget ) +void Bookmarks::setMap( MarbleQuickItem* item ) { - m_marbleWidget = widget; + m_marbleQuickItem = item; } bool Bookmarks::isBookmark( qreal longitude, qreal latitude ) const { - if ( !m_marbleWidget || !m_marbleWidget->model()->bookmarkManager() ) { + if ( !m_marbleQuickItem || !m_marbleQuickItem->model()->bookmarkManager() ) { return false; } - Marble::BookmarkManager* manager = m_marbleWidget->model()->bookmarkManager(); + Marble::BookmarkManager* manager = m_marbleQuickItem->model()->bookmarkManager(); Marble::GeoDataDocument *bookmarks = manager->document(); Marble::GeoDataCoordinates const compareTo( longitude, latitude, 0.0, Marble::GeoDataCoordinates::Degree ); - qreal planetRadius = m_marbleWidget->model()->planet()->radius(); + qreal planetRadius = m_marbleQuickItem->model()->planet()->radius(); foreach( const Marble::GeoDataFolder* folder, bookmarks->folderList() ) { foreach( const Marble::GeoDataPlacemark * const placemark, folder->placemarkList() ) { if ( distanceSphere( placemark->coordinate(), compareTo ) * planetRadius < 5 ) { return true; } } } return false; } void Bookmarks::addBookmark( qreal longitude, qreal latitude, const QString &name, const QString &folderName ) { - if ( !m_marbleWidget || !m_marbleWidget->model()->bookmarkManager() ) { + if ( !m_marbleQuickItem || !m_marbleQuickItem->model()->bookmarkManager() ) { return; } - Marble::BookmarkManager* manager = m_marbleWidget->model()->bookmarkManager(); + Marble::BookmarkManager* manager = m_marbleQuickItem->model()->bookmarkManager(); Marble::GeoDataDocument *bookmarks = manager->document(); Marble::GeoDataContainer *target = 0; foreach( Marble::GeoDataFolder* const folder, bookmarks->folderList() ) { if ( folder->name() == folderName ) { target = folder; break; } } if ( !target ) { manager->addNewBookmarkFolder( bookmarks, folderName ); foreach( Marble::GeoDataFolder* const folder, bookmarks->folderList() ) { if ( folder->name() == folderName ) { target = folder; break; } } Q_ASSERT( target ); } Marble::GeoDataPlacemark placemark; Marble::GeoDataCoordinates coordinate( longitude, latitude, 0.0, Marble::GeoDataCoordinates::Degree ); placemark.setCoordinate( coordinate ); placemark.setName( name ); placemark.extendedData().addValue( Marble::GeoDataData( "isBookmark", true ) ); manager->addBookmark( target, placemark ); } void Bookmarks::removeBookmark( qreal longitude, qreal latitude ) { - if ( !m_marbleWidget || !m_marbleWidget->model()->bookmarkManager() ) { + if ( !m_marbleQuickItem || !m_marbleQuickItem->model()->bookmarkManager() ) { return; } - Marble::BookmarkManager* manager = m_marbleWidget->model()->bookmarkManager(); + Marble::BookmarkManager* manager = m_marbleQuickItem->model()->bookmarkManager(); Marble::GeoDataDocument *bookmarks = manager->document(); Marble::GeoDataCoordinates const compareTo( longitude, latitude, 0.0, Marble::GeoDataCoordinates::Degree ); - qreal planetRadius = m_marbleWidget->model()->planet()->radius(); + qreal planetRadius = m_marbleQuickItem->model()->planet()->radius(); foreach( const Marble::GeoDataFolder* folder, bookmarks->folderList() ) { foreach( Marble::GeoDataPlacemark * placemark, folder->placemarkList() ) { if ( distanceSphere( placemark->coordinate(), compareTo ) * planetRadius < 5 ) { manager->removeBookmark( placemark ); return; } } } } BookmarksModel *Bookmarks::model() { - if ( !m_proxyModel && m_marbleWidget && m_marbleWidget->model()->bookmarkManager() ) { - Marble::BookmarkManager* manager = m_marbleWidget->model()->bookmarkManager(); + if ( !m_proxyModel && m_marbleQuickItem && m_marbleQuickItem->model()->bookmarkManager() ) { + Marble::BookmarkManager* manager = m_marbleQuickItem->model()->bookmarkManager(); Marble::GeoDataTreeModel* model = new Marble::GeoDataTreeModel( this ); model->setRootDocument( manager->document() ); KDescendantsProxyModel* flattener = new KDescendantsProxyModel( this ); flattener->setSourceModel( model ); m_proxyModel = new BookmarksModel( this ); m_proxyModel->setFilterFixedString( Marble::GeoDataTypes::GeoDataPlacemarkType ); m_proxyModel->setFilterKeyColumn( 1 ); m_proxyModel->setSourceModel( flattener ); } return m_proxyModel; } BookmarksModel::BookmarksModel( QObject *parent ) : QSortFilterProxyModel( parent ) { connect( this, SIGNAL(layoutChanged()), this, SIGNAL(countChanged()) ); connect( this, SIGNAL(modelReset()), this, SIGNAL(countChanged()) ); connect( this, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SIGNAL(countChanged()) ); connect( this, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SIGNAL(countChanged()) ); } int BookmarksModel::count() const { return rowCount(); } qreal BookmarksModel::longitude( int idx ) const { if ( idx >= 0 && idx < rowCount() ) { QVariant const value = data( index( idx, 0 ), Marble::MarblePlacemarkModel::CoordinateRole ); Marble::GeoDataCoordinates const coordinates = value.value(); return coordinates.longitude( Marble::GeoDataCoordinates::Degree ); } return 0.0; } qreal BookmarksModel::latitude( int idx ) const { if ( idx >= 0 && idx < rowCount() ) { QVariant const value = data( index( idx, 0 ), Marble::MarblePlacemarkModel::CoordinateRole ); Marble::GeoDataCoordinates const coordinates = value.value(); return coordinates.latitude( Marble::GeoDataCoordinates::Degree ); } return 0.0; } QString BookmarksModel::name( int idx ) const { if ( idx >= 0 && idx < rowCount() ) { return data( index( idx, 0 ) ).toString(); } return QString(); } +} + #include "moc_Bookmarks.cpp" diff --git a/src/lib/marble/declarative/Bookmarks.h b/src/lib/marble/declarative/Bookmarks.h index 4a6dcaa09..a31bcb962 100644 --- a/src/lib/marble/declarative/Bookmarks.h +++ b/src/lib/marble/declarative/Bookmarks.h @@ -1,74 +1,78 @@ // // 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 2012 Dennis Nienhüser // #ifndef MARBLE_DECLARATIVE_BOOKMARKS_H #define MARBLE_DECLARATIVE_BOOKMARKS_H #include #include -class MarbleWidget; +namespace Marble { + +class MarbleQuickItem; class BookmarksModel: public QSortFilterProxyModel { Q_OBJECT Q_PROPERTY( int count READ count NOTIFY countChanged ) public: explicit BookmarksModel( QObject *parent = 0 ); int count() const; public Q_SLOTS: qreal longitude( int index ) const; qreal latitude( int index ) const; QString name( int index ) const; Q_SIGNALS: void countChanged(); }; class Bookmarks : public QObject { Q_OBJECT - Q_PROPERTY( MarbleWidget* map READ map WRITE setMap NOTIFY mapChanged) + Q_PROPERTY( MarbleQuickItem* map READ map WRITE setMap NOTIFY mapChanged) Q_PROPERTY( BookmarksModel* model READ model NOTIFY modelChanged ) public: explicit Bookmarks( QObject* parent = 0 ); - MarbleWidget* map(); + MarbleQuickItem* map(); - void setMap( MarbleWidget* widget ); + void setMap(Marble::MarbleQuickItem *widget ); BookmarksModel* model(); Q_INVOKABLE bool isBookmark( qreal longitude, qreal latitude ) const; public Q_SLOTS: void addBookmark( qreal longitude, qreal latitude, const QString &name, const QString &folder ); void removeBookmark( qreal longitude, qreal latitude ); Q_SIGNALS: void mapChanged(); void modelChanged(); private: - MarbleWidget* m_marbleWidget; + MarbleQuickItem* m_marbleQuickItem; BookmarksModel* m_proxyModel; }; +} + #endif diff --git a/src/lib/marble/declarative/CMakeLists.txt b/src/lib/marble/declarative/CMakeLists.txt index b6b734eae..867821c13 100644 --- a/src/lib/marble/declarative/CMakeLists.txt +++ b/src/lib/marble/declarative/CMakeLists.txt @@ -1,72 +1,69 @@ PROJECT( MarbleDeclarativePlugin ) macro_optional_find_package(Qt5Positioning) if(Qt5Positioning_FOUND) add_definitions(-DHAVE_QT5_POSITIONING) endif(Qt5Positioning_FOUND) INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) add_library( marbledeclarative SHARED Bookmarks.cpp - CloudSync.cpp Coordinate.cpp DeclarativeDataPluginModel.cpp DeclarativeDataPlugin.cpp DeclarativeDataPluginItem.cpp DeclarativeMapThemeManager.cpp MapThemeModel.cpp MarbleDeclarativeObject.cpp MarbleDeclarativePlugin.cpp - MarbleDeclarativeWidget.cpp MarbleQuickItem.cpp Placemark.cpp PositionSource.cpp - Search.cpp SearchBackend.cpp Tracking.cpp Routing.cpp Navigation.cpp OfflineDataModel.cpp RouteRequestModel.cpp Settings.cpp ) # needed for marble_declarative_export.h set_target_properties(marbledeclarative PROPERTIES DEFINE_SYMBOL MAKE_MARBLE_DECLARATIVE_LIB ) marble_add_project_resources(qmldir) # TODO: use PUBLIC/PRIVATE everywhere instead of LINK_PUBLIC/LINK_PRIVATE # once SailfishOS has cmake >= 2.8.12 target_link_libraries( marbledeclarative LINK_PUBLIC Qt5::Quick ${MARBLEWIDGET} LINK_PRIVATE Qt5::Script ) if(Qt5Positioning_FOUND) target_link_libraries( marbledeclarative LINK_PRIVATE Qt5::Positioning ) endif() set_target_properties( marbledeclarative PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE SKIP_BUILD_RPATH TRUE BUILD_WITH_INSTALL_RPATH TRUE ) if(WIN32) install(TARGETS marbledeclarative RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX} ARCHIVE DESTINATION lib) else() install(TARGETS marbledeclarative LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() diff --git a/src/lib/marble/declarative/CloudSync.cpp b/src/lib/marble/declarative/CloudSync.cpp deleted file mode 100644 index 4957b6b7d..000000000 --- a/src/lib/marble/declarative/CloudSync.cpp +++ /dev/null @@ -1,148 +0,0 @@ -// -// 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 2013 Utku Aydın -// - -#include "CloudSync.h" - -#include "MarbleModel.h" -#include "MarbleDeclarativeWidget.h" -#include "cloudsync/CloudRouteModel.h" -#include "cloudsync/CloudSyncManager.h" -#include "cloudsync/RouteSyncManager.h" -#include "cloudsync/BookmarkSyncManager.h" - -class CloudSync::Private -{ -public: - Private(); - - MarbleWidget *m_map; - Marble::CloudRouteModel *m_routeModel; - Marble::CloudSyncManager m_cloudSyncManager; -}; - -CloudSync::Private::Private() : - m_map( 0 ), - m_routeModel( 0 ), - m_cloudSyncManager() -{ -} - -CloudSync::CloudSync( QObject *parent ) : - QObject( parent ), - d( new Private() ) -{ - connect( &d->m_cloudSyncManager, SIGNAL(owncloudServerChanged(QString)), - this, SIGNAL(owncloudServerChanged()) ); - connect( &d->m_cloudSyncManager, SIGNAL(owncloudUsernameChanged(QString)), - this, SIGNAL(owncloudUsernameChanged()) ); - connect( &d->m_cloudSyncManager, SIGNAL(owncloudPasswordChanged(QString)), - this, SIGNAL(owncloudPasswordChanged()) ); - connect( d->m_cloudSyncManager.bookmarkSyncManager(), SIGNAL(mergeConflict(Marble::MergeItem*)), - this, SIGNAL(mergeConflict(Marble::MergeItem*))); -} - -CloudSync::~CloudSync() -{ - delete d; -} - -QObject* CloudSync::routeModel() -{ - return qobject_cast( d->m_cloudSyncManager.routeSyncManager()->model() ); -} - -MarbleWidget* CloudSync::map() -{ - return d->m_map; -} - -void CloudSync::setMap( MarbleWidget *map ) -{ - if( d->m_map != map ) { - d->m_map = map; - - d->m_cloudSyncManager.routeSyncManager()->setRoutingManager( map->model()->routingManager() ); - d->m_cloudSyncManager.bookmarkSyncManager()->setBookmarkManager( map->model()->bookmarkManager() ); - d->m_cloudSyncManager.routeSyncManager()->prepareRouteList(); - emit mapChanged(); - } -} - -QString CloudSync::owncloudServer() const -{ - return d->m_cloudSyncManager.owncloudServer(); -} - -void CloudSync::setOwncloudServer( const QString &server ) -{ - d->m_cloudSyncManager.setOwncloudServer( server ); -} - -QString CloudSync::owncloudUsername() const -{ - return d->m_cloudSyncManager.owncloudUsername(); -} - -void CloudSync::setOwncloudUsername( const QString &username ) -{ - d->m_cloudSyncManager.setOwncloudUsername( username ); -} - -QString CloudSync::owncloudPassword() const -{ - return d->m_cloudSyncManager.owncloudPassword(); -} - -void CloudSync::setOwncloudPassword( const QString &password ) -{ - d->m_cloudSyncManager.setOwncloudPassword( password ); -} - -void CloudSync::uploadRoute() -{ - d->m_cloudSyncManager.routeSyncManager()->uploadRoute(); -} - -void CloudSync::uploadRoute( const QString &identifier ) -{ - d->m_cloudSyncManager.routeSyncManager()->uploadRoute( identifier ); -} - -void CloudSync::openRoute( const QString &identifier ) -{ - d->m_cloudSyncManager.routeSyncManager()->openRoute( identifier ); -} - -void CloudSync::downloadRoute( const QString &identifier ) -{ - d->m_cloudSyncManager.routeSyncManager()->downloadRoute( identifier ); -} - -void CloudSync::removeRouteFromDevice( const QString &identifier ) -{ - d->m_cloudSyncManager.routeSyncManager()->removeRouteFromCache( identifier ); -} - -void CloudSync::deleteRouteFromCloud( const QString &identifier ) -{ - d->m_cloudSyncManager.routeSyncManager()->deleteRoute( identifier ); -} - -void CloudSync::syncBookmarks() -{ - d->m_cloudSyncManager.bookmarkSyncManager()->startBookmarkSync(); -} - -void CloudSync::resolveConflict( Marble::MergeItem *item ) -{ - d->m_cloudSyncManager.bookmarkSyncManager()->resolveConflict( item ); -} - -#include "moc_CloudSync.cpp" diff --git a/src/lib/marble/declarative/CloudSync.h b/src/lib/marble/declarative/CloudSync.h deleted file mode 100644 index b348b2c6e..000000000 --- a/src/lib/marble/declarative/CloudSync.h +++ /dev/null @@ -1,74 +0,0 @@ -// -// 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 2013 Utku Aydın -// - -#ifndef CLOUDSYNC_H -#define CLOUDSYNC_H - -#include "cloudsync/CloudSyncManager.h" -#include "cloudsync/MergeItem.h" - -#include -#include - -class MarbleWidget; - -class CloudSync : public QObject -{ - - Q_OBJECT - Q_PROPERTY( QObject* routeModel READ routeModel NOTIFY routeModelChanged ) - Q_PROPERTY( MarbleWidget* map READ map WRITE setMap NOTIFY mapChanged ) - Q_PROPERTY( QString owncloudServer READ owncloudServer WRITE setOwncloudServer NOTIFY owncloudServerChanged ) - Q_PROPERTY( QString owncloudUsername READ owncloudUsername WRITE setOwncloudUsername NOTIFY owncloudUsernameChanged ) - Q_PROPERTY( QString owncloudPassword READ owncloudPassword WRITE setOwncloudPassword NOTIFY owncloudPasswordChanged ) - -public: - explicit CloudSync( QObject *parent = 0 ); - ~CloudSync(); - - QObject* routeModel(); - - MarbleWidget* map(); - void setMap( MarbleWidget *map ); - - QString owncloudServer() const; - void setOwncloudServer( const QString &server ); - - QString owncloudUsername() const; - void setOwncloudUsername( const QString &username ); - - QString owncloudPassword() const; - void setOwncloudPassword( const QString &password ); - -public Q_SLOTS: - void uploadRoute(); - void uploadRoute( const QString &identifier ); - void openRoute( const QString &identifier ); - void downloadRoute( const QString &identifier ); - void removeRouteFromDevice( const QString &identifier ); - void deleteRouteFromCloud( const QString &identifier ); - void syncBookmarks(); - void resolveConflict( Marble::MergeItem *item ); - -Q_SIGNALS: - void mapChanged(); - void routeModelChanged(); - void cloudSyncManagerChanged(); - void owncloudServerChanged(); - void owncloudUsernameChanged(); - void owncloudPasswordChanged(); - void mergeConflict( Marble::MergeItem *item ); - -private: - class Private; - Private *d; -}; - -#endif // CLOUDSYNC_H diff --git a/src/lib/marble/declarative/MarbleDeclarativePlugin.cpp b/src/lib/marble/declarative/MarbleDeclarativePlugin.cpp index 95951f9a9..f5691bbca 100644 --- a/src/lib/marble/declarative/MarbleDeclarativePlugin.cpp +++ b/src/lib/marble/declarative/MarbleDeclarativePlugin.cpp @@ -1,95 +1,87 @@ // // 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 2010 Dennis Nienhüser // #include "MarbleDeclarativePlugin.h" #include "Coordinate.h" #include "DeclarativeMapThemeManager.h" #include "MarbleDeclarativeObject.h" -#include "MarbleDeclarativeWidget.h" #include "PositionSource.h" #include "Bookmarks.h" -#include "CloudSync.h" -#include "cloudsync/MergeItem.h" #include "Tracking.h" #include "Routing.h" #include "Navigation.h" -#include "Search.h" #include "RouteRequestModel.h" #include "Settings.h" #include "MapThemeModel.h" #include "NewstuffModel.h" #include "OfflineDataModel.h" #include "Placemark.h" #include "routing/SpeakersModel.h" #include "routing/VoiceNavigationModel.h" #include "routing/RoutingModel.h" #include "AbstractFloatItem.h" #include "RenderPlugin.h" #include "MarblePlacemarkModel.h" #include "DeclarativeDataPlugin.h" #include "SearchBackend.h" #include "MarbleQuickItem.h" #include #include #include void MarbleDeclarativePlugin::registerTypes( const char *uri ) { qRegisterMetaType("MarbleMap*"); //@uri org.kde.edu.marble qmlRegisterType( uri, 0, 20, "Coordinate" ); qmlRegisterType( uri, 0, 20, "Placemark" ); - qmlRegisterType( uri, 0, 20, "PositionSource" ); - qmlRegisterType( uri, 0, 20, "Bookmarks" ); - qmlRegisterType( uri, 0, 20, "Tracking" ); + qmlRegisterType( uri, 0, 20, "PositionSource" ); + qmlRegisterType( uri, 0, 20, "Bookmarks" ); + qmlRegisterType( uri, 0, 20, "Tracking" ); qmlRegisterType( uri, 0, 20, "Routing" ); qmlRegisterType( uri, 0, 20, "Navigation" ); - qmlRegisterType( uri, 0, 20, "Find" ); - qmlRegisterType( uri, 0, 20, "CloudSync" ); - qmlRegisterType( uri, 0, 20, "MergeItem" ); qmlRegisterType( uri, 0, 20, "RouteRequestModel" ); qmlRegisterType( uri, 0, 20, "Settings" ); - qmlRegisterType( uri, 0, 20, "MarbleWidget" ); qmlRegisterType( uri, 0, 20, "MapThemeManager" ); qmlRegisterType( uri, 0, 20, "SpeakersModel" ); qmlRegisterType( uri, 0, 20, "VoiceNavigation" ); qmlRegisterType( uri, 0, 20, "NewstuffModel" ); qmlRegisterType( uri, 0, 20, "OfflineDataModel" ); qmlRegisterType( uri, 0, 20, "MapThemeModel" ); qmlRegisterType( uri, 0, 20, "DataLayer" ); qmlRegisterType(uri, 0, 20, "SearchBackend"); qRegisterMetaType("MarblePlacemarkModel*"); qmlRegisterType(uri, 0, 20, "MarbleItem"); qmlRegisterUncreatableType(uri, 1, 0, "MarblePlacemarkModel", "MarblePlacemarkModel is not instantiable"); qmlRegisterUncreatableType(uri, 0, 20, "RoutingModel", "RoutingModel is not instantiable"); - qmlRegisterUncreatableType( uri, 0, 20, "BookmarksModel", "Do not create" ); + qmlRegisterUncreatableType( uri, 0, 20, "BookmarksModel", "Do not create" ); qmlRegisterUncreatableType( uri, 0, 20, "FloatItem", "Do not create" ); qmlRegisterUncreatableType( uri, 0, 20, "RenderPlugin", "Do not create" ); qmlRegisterUncreatableType( uri, 0, 20, "MarbleMap", "Do not create" ); } void MarbleDeclarativePlugin::initializeEngine( QQmlEngine *engine, const char *) { engine->addImageProvider( "maptheme", new MapThemeImageProvider ); // Register the global Marble object. Can be used in .qml files for requests like Marble.resolvePath("some/icon.png") if ( !engine->rootContext()->contextProperty( "Marble").isValid() ) { engine->rootContext()->setContextProperty( "Marble", new MarbleDeclarativeObject( this ) ); } } #include "moc_MarbleDeclarativePlugin.cpp" Q_EXPORT_PLUGIN2( MarbleDeclarativePlugin, MarbleDeclarativePlugin ) diff --git a/src/lib/marble/declarative/MarbleDeclarativePlugin.h b/src/lib/marble/declarative/MarbleDeclarativePlugin.h index d003cd430..de30d41bc 100644 --- a/src/lib/marble/declarative/MarbleDeclarativePlugin.h +++ b/src/lib/marble/declarative/MarbleDeclarativePlugin.h @@ -1,34 +1,34 @@ // // 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 2010 Dennis Nienhüser // #ifndef MARBLE_DECLARATIVE_PLUGIN_H #define MARBLE_DECLARATIVE_PLUGIN_H #include "marble_declarative_export.h" #include "qglobal.h" #include /** - * Registers MarbleWidget, MarbleRunnerManager and MarbleThemeManager + * Registers MarbleQuickItem, MarbleRunnerManager and MarbleThemeManager * as QQml extensions for use in QML. */ class MARBLE_DECLARATIVE_EXPORT MarbleDeclarativePlugin : public QQmlExtensionPlugin { Q_PLUGIN_METADATA( IID "org.kde.edu.marble.MarbleDeclarativePlugin" ) Q_OBJECT public: /** Overriding QQmlExtensionPlugin to register types */ virtual void registerTypes( const char *uri ); void initializeEngine( QQmlEngine *engine, const char *); }; #endif diff --git a/src/lib/marble/declarative/MarbleDeclarativeWidget.cpp b/src/lib/marble/declarative/MarbleDeclarativeWidget.cpp deleted file mode 100644 index f6d5df446..000000000 --- a/src/lib/marble/declarative/MarbleDeclarativeWidget.cpp +++ /dev/null @@ -1,328 +0,0 @@ -// -// 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 2010 Dennis Nienhüser -// - -#include "MarbleDeclarativeWidget.h" - -#include "Coordinate.h" - -#include "GeoDataCoordinates.h" -#include "MarbleMap.h" -#include "MarbleModel.h" -#include "MarbleWidgetInputHandler.h" -#include "MarbleMath.h" -#include "MapThemeManager.h" -#include "AbstractFloatItem.h" -#include "AbstractDataPlugin.h" -#include "RenderPlugin.h" -#include "MarbleDirs.h" -#include "ViewParams.h" -#include "ViewportParams.h" -#include "DownloadRegion.h" -#include "BookmarkManager.h" -#include "routing/Route.h" -#include "routing/RoutingManager.h" -#include "routing/RoutingModel.h" -#include "routing/RoutingProfilesModel.h" -#include "DeclarativeDataPlugin.h" -#include "PluginManager.h" - -#include -#include - -MarbleWidget::MarbleWidget( QQuickItem *parent ) : - Marble::MarbleQuickItem( parent ), - m_inputEnabled( true ) -{ - setMapThemeId( "earth/openstreetmap/openstreetmap.dgml" ); - model()->routingManager()->profilesModel()->loadDefaultProfiles(); - model()->routingManager()->readSettings(); - model()->bookmarkManager()->loadFile( "bookmarks/bookmarks.kml" ); - - connect( map(), SIGNAL(visibleLatLonAltBoxChanged(GeoDataLatLonAltBox)), - this, SIGNAL(visibleLatLonAltBoxChanged()) ); - connect( model(), SIGNAL(workOfflineChanged()), - this, SIGNAL(workOfflineChanged()) ); - // @TODO FIXME Port to QtQuick 2 - //connect( map(), SIGNAL(zoomChanged(int)), - // this, SIGNAL(radiusChanged()) ); - connect( map(), SIGNAL(themeChanged(QString)), - this, SIGNAL(mapThemeChanged()) ); - // @TODO FIXME Port to QtQuick 2 - //connect( map(), SIGNAL(projectionChanged(Projection)), - // this, SIGNAL(projectionChanged()) ); - connect( map(), SIGNAL(mouseClickGeoPosition(qreal,qreal,GeoDataCoordinates::Unit)), - this, SLOT(forwardMouseClick(qreal,qreal,GeoDataCoordinates::Unit)) ); - connect( &m_center, SIGNAL(latitudeChanged()), this, SLOT(updateCenterPosition())); - connect( &m_center, SIGNAL(longitudeChanged()), this, SLOT(updateCenterPosition())); -} - -MarbleWidget::~MarbleWidget() -{ - model()->routingManager()->writeSettings(); -} - -const Marble::ViewportParams *MarbleWidget::viewport() const -{ - return map()->viewport(); -} - -QList MarbleWidget::renderPlugins() const -{ - QList result; - foreach ( Marble::RenderPlugin* plugin, map()->renderPlugins() ) { - result << plugin; - } - - return result; -} - -QStringList MarbleWidget::activeFloatItems() const -{ - QStringList result; - foreach( Marble::AbstractFloatItem * floatItem, map()->floatItems() ) { - if ( floatItem->enabled() && floatItem->visible() ) { - result << floatItem->nameId(); - } - } - return result; -} - -void MarbleWidget::setActiveFloatItems( const QStringList &items ) -{ - foreach( Marble::AbstractFloatItem * floatItem, map()->floatItems() ) { - floatItem->setEnabled( items.contains( floatItem->nameId() ) ); - floatItem->setVisible( items.contains( floatItem->nameId() ) ); - } -} - -QStringList MarbleWidget::activeRenderPlugins() const -{ - QStringList result; - foreach( Marble::RenderPlugin * plugin, map()->renderPlugins() ) { - if ( plugin->enabled() && plugin->visible() ) { - result << plugin->nameId(); - } - } - return result; -} - -QQmlListProperty MarbleWidget::childList() -{ - return QQmlListProperty( this, m_children ); -} - -QQmlListProperty MarbleWidget::dataLayers() -{ - return QQmlListProperty( this, m_dataLayers ); -} - -void MarbleWidget::setActiveRenderPlugins( const QStringList &items ) -{ - foreach( Marble::RenderPlugin * plugin, map()->renderPlugins() ) { - plugin->setEnabled( items.contains( plugin->nameId() ) ); - plugin->setVisible( items.contains( plugin->nameId() ) ); - } -} - -QPoint MarbleWidget::pixel( qreal lon, qreal lat ) const -{ - Marble::GeoDataCoordinates position( lon, lat, 0, Marble::GeoDataCoordinates::Degree ); - qreal x( 0.0 ); - qreal y( 0.0 ); - const Marble::ViewportParams *viewport = map()->viewport(); - viewport->screenCoordinates( position, x, y ); - return QPoint( x, y ); -} - -Coordinate *MarbleWidget::coordinate( int x, int y ) -{ - qreal lat( 0.0 ), lon( 0.0 ); - map()->geoCoordinates( x, y, lon, lat ); - return new Coordinate( lon, lat, 0.0, this ); -} - -Coordinate* MarbleWidget::center() -{ - m_center.blockSignals( true ); - m_center.setLongitude( map()->centerLongitude() ); - m_center.setLatitude( map()->centerLatitude() ); - m_center.blockSignals( false ); - return &m_center; -} - -void MarbleWidget::setCenter( Coordinate* center ) -{ - if ( center ) { - m_center.blockSignals( true ); - m_center.setLongitude( center->longitude() ); - m_center.setLatitude( center->latitude() ); - m_center.setAltitude( center->altitude() ); - m_center.blockSignals( false ); - updateCenterPosition(); - } -} - -void MarbleWidget::updateCenterPosition() -{ - map()->centerOn( m_center.longitude(), m_center.latitude() ); -} - -void MarbleWidget::forwardMouseClick(qreal lon, qreal lat, Marble::GeoDataCoordinates::Unit unit ) -{ - Marble::GeoDataCoordinates position( lon, lat, unit ); - Marble::GeoDataCoordinates::Unit degree = Marble::GeoDataCoordinates::Degree; - QPoint const point = pixel( position.longitude( degree ), position.latitude( degree ) ); - QVector const features = map()->whichFeatureAt( point ); - if ( !features.isEmpty() ) { - if ( features.size() == 1 ) { - Placemark* placemark = new Placemark; - const Marble::GeoDataPlacemark * geoDataPlacemark = dynamic_cast( features.first() ); - if ( geoDataPlacemark ) { - placemark->setGeoDataPlacemark( *geoDataPlacemark ); - emit placemarkSelected( placemark ); - } - } - } else { - emit mouseClickGeoPosition( position.longitude( degree ), - position.latitude( degree ) ); - } -} - -void MarbleWidget::addLayer( QQmlListProperty *list, DeclarativeDataPlugin *layer ) -{ - MarbleWidget *object = qobject_cast( list->object ); - if ( object ) { - model()->pluginManager()->addRenderPlugin( layer ); - object->setDataPluginDelegate( layer->nameId(), layer->delegate() ); - object->m_dataLayers << layer; - } -} - -QStandardItemModel *MarbleWidget::mapThemeModel() -{ - return m_mapThemeManager.mapThemeModel(); -} - -void MarbleWidget::setGeoSceneProperty(const QString &key, bool value) -{ - map()->setPropertyValue( key, value ); -} - -void MarbleWidget::downloadRoute( qreal offset, int topTileLevel, int bottomTileLevel ) -{ - Marble::DownloadRegion region; - region.setMarbleModel( model() ); - region.setVisibleTileLevel( map()->tileZoomLevel() ); - region.setTileLevelRange( topTileLevel, bottomTileLevel ); - const Marble::GeoDataLineString waypoints = model()->routingManager()->routingModel()->route().path(); - QVector const pyramid = region.fromPath( map()->textureLayer(), offset, waypoints ); - if ( !pyramid.isEmpty() ) { - map()->downloadRegion( pyramid ); - } -} - -void MarbleWidget::downloadArea(int topTileLevel, int bottomTileLevel) -{ - Marble::DownloadRegion region; - region.setMarbleModel( model() ); - region.setVisibleTileLevel( map()->tileZoomLevel() ); - region.setTileLevelRange( topTileLevel, bottomTileLevel ); - QVector const pyramid = region.region( map()->textureLayer(), map()->viewport()->viewLatLonAltBox() ); - if ( !pyramid.isEmpty() ) { - map()->downloadRegion( pyramid ); - } -} - -void MarbleWidget::setDataPluginDelegate( const QString &plugin, QQmlComponent *delegate ) -{ - QList renderPlugins = map()->renderPlugins(); - foreach( Marble::RenderPlugin* renderPlugin, renderPlugins ) { - Marble::AbstractDataPlugin* dataPlugin = qobject_cast( renderPlugin ); - if ( dataPlugin && dataPlugin->nameId() == plugin ) { - dataPlugin->setDelegate( delegate, this ); - } - } -} - -bool MarbleWidget::workOffline() const -{ - return model()->workOffline(); -} - -void MarbleWidget::setWorkOffline( bool workOffline ) -{ - model()->setWorkOffline( workOffline ); -} - -int MarbleWidget::radius() const -{ - return map()->radius(); -} - -void MarbleWidget::setRadius( int radius ) -{ - map()->setRadius( radius ); -} - -Marble::RenderPlugin *MarbleWidget::renderPlugin( const QString & name ) -{ - foreach( Marble::RenderPlugin * plugin, map()->renderPlugins() ) - { - if( plugin->nameId() == name ) { - return plugin; - } - } - return 0; -} - -bool MarbleWidget::containsRenderPlugin( const QString & name ) -{ - foreach( Marble::RenderPlugin * plugin, map()->renderPlugins() ) - { - if( plugin->nameId() == name ) { - return true; - } - } - return false; -} - -QList MarbleWidget::floatItems() const -{ - QList result; - foreach ( Marble::AbstractFloatItem* plugin, map()->floatItems() ) { - result << plugin; - } - - return result; -} - -Marble::AbstractFloatItem* MarbleWidget::floatItem( const QString & name ) -{ - foreach( Marble::AbstractFloatItem * plugin, map()->floatItems() ) - { - if( plugin->nameId() == name ) { - return plugin ; - } - } - return 0; -} - -bool MarbleWidget::containsFloatItem( const QString & name ) -{ - foreach( Marble::AbstractFloatItem * plugin, map()->floatItems() ) - { - if( plugin->nameId() == name ) { - return true; - } - } - return false; -} - -#include "moc_MarbleDeclarativeWidget.cpp" diff --git a/src/lib/marble/declarative/MarbleDeclarativeWidget.h b/src/lib/marble/declarative/MarbleDeclarativeWidget.h deleted file mode 100644 index eb5136ba2..000000000 --- a/src/lib/marble/declarative/MarbleDeclarativeWidget.h +++ /dev/null @@ -1,165 +0,0 @@ -// -// 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 2010 Dennis Nienhüser -// - -#ifndef DECLARATIVE_MARBLE_WIDGET_H -#define DECLARATIVE_MARBLE_WIDGET_H - -#include "Coordinate.h" -#include "Placemark.h" - -#include "MapThemeManager.h" - -#include -#include -#include -#include -#include "MarbleQuickItem.h" - -using Marble::GeoDataCoordinates; // Ouch. For signal/slot connection across different namespaces - -namespace Marble -{ -// Forward declarations -class AbstractFloatItem; -class MarbleModel; -class RenderPlugin; -class ViewportParams; -} - -class DeclarativeDataPlugin; -/** - * Wraps a Marble::MarbleWidget, providing access to important properties and methods - * - * @note: This is not meant to be used anymore, please use MarbleQuickItem instead - * - */ -class MarbleWidget : public Marble::MarbleQuickItem -{ - Q_OBJECT - - Q_PROPERTY( Coordinate* center READ center WRITE setCenter NOTIFY visibleLatLonAltBoxChanged ) - Q_PROPERTY( int radius READ radius WRITE setRadius NOTIFY radiusChanged ) - Q_PROPERTY( QString mapThemeId READ mapThemeId WRITE setMapThemeId NOTIFY mapThemeChanged ) - Q_PROPERTY( bool workOffline READ workOffline WRITE setWorkOffline NOTIFY workOfflineChanged ) - Q_PROPERTY( QStringList activeFloatItems READ activeFloatItems WRITE setActiveFloatItems ) - Q_PROPERTY( QStringList activeRenderPlugins READ activeRenderPlugins WRITE setActiveRenderPlugins ) - Q_PROPERTY( QStandardItemModel* mapThemeModel READ mapThemeModel NOTIFY mapThemeModelChanged ) - Q_PROPERTY( QList renderPlugins READ renderPlugins CONSTANT ) - Q_PROPERTY( QList floatItems READ floatItems CONSTANT ) - - Q_PROPERTY( QQmlListProperty dataLayers READ dataLayers ) - Q_PROPERTY( QQmlListProperty children READ childList ) - - Q_CLASSINFO("DefaultProperty", "children") - -public: - /** Constructor */ - explicit MarbleWidget( QQuickItem *parent = 0 ); - - ~MarbleWidget(); - - const Marble::ViewportParams *viewport() const; - - bool workOffline() const; - - void setWorkOffline( bool workOffline ); - - int radius() const; - - void setRadius( int radius ); - - void setActiveRenderPlugins( const QStringList &items ); - - QStringList activeRenderPlugins() const; - - QQmlListProperty childList(); - - QQmlListProperty dataLayers(); - -Q_SIGNALS: - /** Forwarded from MarbleWidget. Zoom value and/or center position have changed */ - void visibleLatLonAltBoxChanged(); - - void workOfflineChanged(); - - void radiusChanged(); - - void mouseClickGeoPosition( qreal longitude, qreal latitude ); - - void mapThemeModelChanged(); - - void mapThemeChanged(); - - void placemarkSelected( Placemark* placemark ); - -public Q_SLOTS: - Coordinate* center(); - - void setCenter( Coordinate* center ); - - QList renderPlugins() const; - - Marble::RenderPlugin* renderPlugin( const QString & name ); - - bool containsRenderPlugin( const QString & name ); - - QList floatItems() const; - - Marble::AbstractFloatItem* floatItem( const QString & name ); - - bool containsFloatItem( const QString & name ); - - /** Returns a list of active (!) float items */ - QStringList activeFloatItems() const; - - /** Activates all of the given float items and deactivates any others */ - void setActiveFloatItems( const QStringList &items ); - - /** - * Returns the screen position of the given coordinate - * (can be out of the screen borders) - */ - QPoint pixel( qreal longitude, qreal latitude ) const; - - /** - * Returns the coordinate at the given screen position - */ - Coordinate *coordinate( int x, int y ); - - QStandardItemModel* mapThemeModel(); - - void setGeoSceneProperty( const QString &key, bool value ); - - void downloadRoute( qreal offset, int topTileLevel, int bottomTileLevel ); - - void downloadArea( int topTileLevel, int bottomTileLevel ); - - void setDataPluginDelegate(const QString &plugin, QQmlComponent *delegate ); - -private Q_SLOTS: - void updateCenterPosition(); - - void forwardMouseClick( qreal lon, qreal lat, GeoDataCoordinates::Unit ); - -private: - void addLayer( QQmlListProperty *list, DeclarativeDataPlugin *layer ); - - Marble::MapThemeManager m_mapThemeManager; - - bool m_inputEnabled; - - Coordinate m_center; - - QList m_dataLayers; - - QList m_children; -}; - -#endif diff --git a/src/lib/marble/declarative/Navigation.cpp b/src/lib/marble/declarative/Navigation.cpp index 93e7b5a0f..f535b9fb7 100644 --- a/src/lib/marble/declarative/Navigation.cpp +++ b/src/lib/marble/declarative/Navigation.cpp @@ -1,369 +1,368 @@ // // 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 2011 Dennis Nienhüser // #include "Navigation.h" #include "Planet.h" -#include "MarbleDeclarativeWidget.h" #include "MarbleModel.h" #include "MarbleQuickItem.h" #include "routing/RoutingManager.h" #include "routing/RoutingModel.h" #include "PositionTracking.h" #include "MarbleMath.h" #include "AutoNavigation.h" #include "routing/VoiceNavigationModel.h" #include "ViewportParams.h" namespace Marble { class NavigationPrivate { public: NavigationPrivate(); MarbleQuickItem * m_marbleQuickItem; bool m_muted; RouteSegment m_currentSegment; AutoNavigation* m_autoNavigation; VoiceNavigationModel m_voiceNavigation; qreal m_nextInstructionDistance; qreal m_destinationDistance; double m_screenAccuracy; QPointF m_screenPosition; RouteSegment nextRouteSegment(); void updateNextInstructionDistance( const Route &route ); MarbleModel * model() const; QPointF positionOnRoute() const; QPointF currentPosition() const; RouteSegment m_secondLastSegment; RouteSegment m_lastSegment; }; NavigationPrivate::NavigationPrivate() : m_marbleQuickItem( nullptr ), m_muted( false ), m_autoNavigation( 0 ), m_nextInstructionDistance( 0.0 ), m_destinationDistance( 0.0 ), m_screenAccuracy(0) { // nothing to do } void NavigationPrivate::updateNextInstructionDistance( const Route &route ) { const GeoDataCoordinates position = route.position(); const GeoDataCoordinates interpolated = route.positionOnRoute(); const GeoDataCoordinates onRoute = route.currentWaypoint(); qreal planetRadius = 0; if (model()){ planetRadius = model()->planet()->radius(); } qreal distance = planetRadius * ( distanceSphere( position, interpolated ) + distanceSphere( interpolated, onRoute ) ); qreal remaining = 0.0; const RouteSegment &segment = route.currentSegment(); for ( int i=0; imodel() : nullptr; } RouteSegment NavigationPrivate::nextRouteSegment() { // Not using m_currentSegment on purpose return m_marbleQuickItem ? model()->routingManager()->routingModel()->route().currentSegment().nextRouteSegment() : RouteSegment(); } Navigation::Navigation( QObject* parent) : QObject( parent ), d( new NavigationPrivate ) { connect( &d->m_voiceNavigation, SIGNAL(instructionChanged()), this, SIGNAL(voiceNavigationAnnouncementChanged()) ); } Navigation::~Navigation() { delete d; } bool Navigation::guidanceModeEnabled() const { return d->m_marbleQuickItem ? d->model()->routingManager()->guidanceModeEnabled() : false; } void Navigation::setGuidanceModeEnabled( bool enabled ) { if ( d->m_marbleQuickItem ) { d->model()->routingManager()->setGuidanceModeEnabled( enabled ); d->m_autoNavigation->setAutoZoom( enabled ); d->m_autoNavigation->setRecenter( enabled ? AutoNavigation::RecenterOnBorder : AutoNavigation::DontRecenter ); if ( enabled && !d->m_muted ) { //d->m_audio.announceStart(); } } } bool Navigation::muted() const { return d->m_muted; } void Navigation::setMuted(bool enabled) { d->m_muted = enabled; } QString Navigation::nextInstructionText() const { return d->nextRouteSegment().maneuver().instructionText(); } QString Navigation::nextRoad() const { return d->nextRouteSegment().maneuver().roadName(); } QString Navigation::nextInstructionImage() const { switch ( d->nextRouteSegment().maneuver().direction() ) { case Maneuver::Unknown: return ""; case Maneuver::Continue: return "qrc:/marble/turn-continue.svg"; case Maneuver::Merge: return "qrc:/marble/turn-merge.svg"; case Maneuver::Straight: return "qrc:/marble/turn-continue.svg"; case Maneuver::SlightRight: return "qrc:/marble/turn-slight-right.svg"; case Maneuver::Right: return "qrc:/marble/turn-right.svg"; case Maneuver::SharpRight: return "qrc:/marble/turn-sharp-right.svg"; case Maneuver::TurnAround: return "qrc:/marble/turn-around.svg"; case Maneuver::SharpLeft: return "qrc:/marble/turn-sharp-left.svg"; case Maneuver::Left: return "qrc:/marble/turn-left.svg"; case Maneuver::SlightLeft: return "qrc:/marble/turn-slight-left.svg"; case Maneuver::RoundaboutFirstExit: return "qrc:/marble/turn-roundabout-first.svg"; case Maneuver::RoundaboutSecondExit: return "qrc:/marble/turn-roundabout-second.svg"; case Maneuver::RoundaboutThirdExit: return "qrc:/marble/turn-roundabout-third.svg"; case Maneuver::RoundaboutExit: return "qrc:/marble/turn-roundabout-far.svg"; case Maneuver::ExitLeft: return "qrc:/marble/turn-exit-left.svg"; case Maneuver::ExitRight: return "qrc:/marble/turn-exit-right.svg"; } return ""; } qreal Navigation::nextInstructionDistance() const { return d->m_nextInstructionDistance; } qreal Navigation::destinationDistance() const { return d->m_destinationDistance; } QString Navigation::voiceNavigationAnnouncement() const { return d->m_voiceNavigation.instruction(); } QString Navigation::speaker() const { return d->m_voiceNavigation.speaker(); } void Navigation::setSpeaker( const QString &speaker ) { d->m_voiceNavigation.setSpeaker( speaker ); } bool Navigation::soundEnabled() const { return !d->m_voiceNavigation.isSpeakerEnabled(); } void Navigation::setSoundEnabled( bool soundEnabled ) { d->m_voiceNavigation.setSpeakerEnabled( !soundEnabled ); } bool Navigation::deviated() const { if ( d->m_marbleQuickItem ) { RoutingModel const * routingModel = d->model()->routingManager()->routingModel(); return routingModel->deviatedFromRoute(); } return true; } MarbleQuickItem *Navigation::marbleQuickItem() const { return d->m_marbleQuickItem; } QPointF NavigationPrivate::positionOnRoute() const { RoutingModel const * routingModel = model()->routingManager()->routingModel(); GeoDataCoordinates coordinates = routingModel->route().positionOnRoute(); qreal x = 0; qreal y = 0; m_marbleQuickItem->map()->viewport()->screenCoordinates(coordinates, x, y); return QPointF(x,y); } QPointF NavigationPrivate::currentPosition() const { GeoDataCoordinates coordinates = model()->positionTracking()->currentLocation(); qreal x = 0; qreal y = 0; m_marbleQuickItem->map()->viewport()->screenCoordinates(coordinates, x, y); return QPointF(x,y); } QPointF Navigation::screenPosition() const { return d->m_screenPosition; } double Navigation::screenAccuracy() const { return d->m_screenAccuracy; } void Navigation::setMarbleQuickItem(MarbleQuickItem *marbleQuickItem) { if ( d->m_marbleQuickItem == marbleQuickItem) { return; } if (d->m_marbleQuickItem) { disconnect( d->model()->routingManager()->routingModel(), SIGNAL(positionChanged()), this, SLOT(update()) ); disconnect( d->m_autoNavigation, SIGNAL(zoomIn(FlyToMode)), d->m_marbleQuickItem, SLOT(zoomIn()) ); disconnect( d->m_autoNavigation, SIGNAL(zoomOut(FlyToMode)), d->m_marbleQuickItem, SLOT(zoomOut()) ); disconnect( d->m_autoNavigation, SIGNAL(centerOn(GeoDataCoordinates,bool)), d->m_marbleQuickItem, SLOT(centerOn(GeoDataCoordinates)) ); disconnect( d->m_marbleQuickItem, SIGNAL(visibleLatLonAltBoxChanged()), d->m_autoNavigation, SLOT(inhibitAutoAdjustments()) ); disconnect( d->model()->positionTracking(), SIGNAL(statusChanged(PositionProviderStatus)), &d->m_voiceNavigation, SLOT(handleTrackingStatusChange(PositionProviderStatus)) ); } d->m_marbleQuickItem = marbleQuickItem; if ( d->m_marbleQuickItem ) { d->model()->routingManager()->setShowGuidanceModeStartupWarning( false ); connect( d->model()->routingManager()->routingModel(), SIGNAL(positionChanged()), this, SLOT(update()) ); connect( d->model()->routingManager()->routingModel(), SIGNAL(deviatedFromRoute(bool)), this, SIGNAL(deviationChanged()) ); delete d->m_autoNavigation; d->m_autoNavigation = new AutoNavigation( d->model(), d->m_marbleQuickItem->map()->viewport(), this ); connect( d->m_autoNavigation, SIGNAL(zoomIn(FlyToMode)), d->m_marbleQuickItem, SLOT(zoomIn()) ); connect( d->m_autoNavigation, SIGNAL(zoomOut(FlyToMode)), d->m_marbleQuickItem, SLOT(zoomOut()) ); connect( d->m_autoNavigation, SIGNAL(centerOn(GeoDataCoordinates,bool)), d->m_marbleQuickItem, SLOT(centerOn(GeoDataCoordinates)) ); connect( d->m_marbleQuickItem, SIGNAL(visibleLatLonAltBoxChanged()), d->m_autoNavigation, SLOT(inhibitAutoAdjustments()) ); connect( d->model()->positionTracking(), SIGNAL(statusChanged(PositionProviderStatus)), &d->m_voiceNavigation, SLOT(handleTrackingStatusChange(PositionProviderStatus)) ); connect( d->m_marbleQuickItem, SIGNAL(visibleLatLonAltBoxChanged()), this, SLOT(updateScreenPosition()) ); connect( d->model()->positionTracking(), SIGNAL(gpsLocation(GeoDataCoordinates,qreal)), this, SLOT(updateScreenPosition()) ); connect( d->model()->positionTracking(), SIGNAL(statusChanged(PositionProviderStatus)), this, SLOT(updateScreenPosition()) ); } emit marbleQuickItemChanged(marbleQuickItem); } void Navigation::update() { if (!d->model()) { return; } RoutingModel const * routingModel = d->model()->routingManager()->routingModel(); d->updateNextInstructionDistance( routingModel->route() ); emit nextInstructionDistanceChanged(); emit destinationDistanceChanged(); RouteSegment segment = routingModel->route().currentSegment(); if ( !d->m_muted && segment.maneuver().instructionText() != d->m_lastSegment.maneuver().instructionText() && segment.maneuver().instructionText() != d->m_secondLastSegment.maneuver().instructionText() ) { d->m_voiceNavigation.update( routingModel->route(), d->m_nextInstructionDistance, d->m_destinationDistance, routingModel->deviatedFromRoute() ); d->m_secondLastSegment = d->m_lastSegment; d->m_lastSegment = segment; } if ( segment != d->m_currentSegment ) { d->m_currentSegment = segment; emit nextInstructionTextChanged(); emit nextInstructionImageChanged(); emit nextRoadChanged(); } updateScreenPosition(); } void Navigation::updateScreenPosition() { if(d->m_marbleQuickItem) { double distanceMeter = d->model()->positionTracking()->accuracy().horizontal; d->m_screenAccuracy = distanceMeter * d->m_marbleQuickItem->map()->radius() / d->model()->planetRadius(); emit screenAccuracyChanged(); d->m_screenPosition = deviated() ? d->currentPosition() : d->positionOnRoute(); emit screenPositionChanged(); } } } #include "moc_Navigation.cpp" diff --git a/src/lib/marble/declarative/PositionSource.cpp b/src/lib/marble/declarative/PositionSource.cpp index f8e9e6bd3..e9aa7b500 100644 --- a/src/lib/marble/declarative/PositionSource.cpp +++ b/src/lib/marble/declarative/PositionSource.cpp @@ -1,159 +1,163 @@ // // 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 2011 Dennis Nienhüser // Copyright 2011 Bernhard Beschow // #include "PositionSource.h" -#include "MarbleDeclarativeWidget.h" +#include "MarbleQuickItem.h" #include "MarbleModel.h" #include "PluginManager.h" #include "PositionTracking.h" #include "PositionProviderPlugin.h" +namespace Marble { + PositionSource::PositionSource( QObject* parent) : QObject( parent ), m_active( false ), m_hasPosition( false ), m_position( 0 ), - m_marbleWidget( 0 ), + m_marbleQuickItem( 0 ), m_speed( 0.0 ) { // nothing to do } bool PositionSource::active() const { return m_active; } void PositionSource::setActive( bool active ) { if ( active != m_active ) { if ( active ) { start(); - } else if ( m_marbleWidget ) { - Marble::PositionTracking *tracking = m_marbleWidget->model()->positionTracking(); + } else if ( m_marbleQuickItem ) { + PositionTracking *tracking = m_marbleQuickItem->model()->positionTracking(); tracking->setPositionProviderPlugin( 0 ); } if ( m_hasPosition ) { m_hasPosition = false; emit hasPositionChanged(); } m_active = active; emit activeChanged(); } } QString PositionSource::source() const { return m_source; } void PositionSource::setSource( const QString &source ) { if ( source != m_source ) { m_source = source; if ( m_hasPosition ) { m_hasPosition = false; emit hasPositionChanged(); } if ( active() ) { start(); } emit sourceChanged(); } } bool PositionSource::hasPosition() const { return m_hasPosition; } Coordinate* PositionSource::position() { return &m_position; } void PositionSource::start() { - if ( !m_marbleWidget ) { + if ( !m_marbleQuickItem ) { return; } - const Marble::PluginManager* pluginManager = m_marbleWidget->model()->pluginManager(); + const PluginManager* pluginManager = m_marbleQuickItem->model()->pluginManager(); foreach( const Marble::PositionProviderPlugin *plugin, pluginManager->positionProviderPlugins() ) { if ( m_source.isEmpty() || plugin->nameId() == m_source ) { - Marble::PositionProviderPlugin* instance = plugin->newInstance(); - Marble::PositionTracking *tracking = m_marbleWidget->model()->positionTracking(); + PositionProviderPlugin* instance = plugin->newInstance(); + PositionTracking *tracking = m_marbleQuickItem->model()->positionTracking(); tracking->setPositionProviderPlugin( instance ); break; } } } -MarbleWidget *PositionSource::map() +MarbleQuickItem *PositionSource::map() { - return m_marbleWidget; + return m_marbleQuickItem; } -void PositionSource::setMap( MarbleWidget *map ) +void PositionSource::setMap( MarbleQuickItem *map ) { - if ( map != m_marbleWidget ) { - m_marbleWidget = map; + if ( map != m_marbleQuickItem ) { + m_marbleQuickItem = map; - if ( m_marbleWidget ) { - connect( m_marbleWidget->model()->positionTracking(), SIGNAL(gpsLocation(GeoDataCoordinates,qreal)), + if ( m_marbleQuickItem ) { + connect( m_marbleQuickItem->model()->positionTracking(), SIGNAL(gpsLocation(GeoDataCoordinates,qreal)), this, SLOT(updatePosition()) ); - connect( m_marbleWidget->model()->positionTracking(), SIGNAL(statusChanged(PositionProviderStatus)), + connect( m_marbleQuickItem->model()->positionTracking(), SIGNAL(statusChanged(PositionProviderStatus)), this, SLOT(updatePosition()) ); emit mapChanged(); } if ( active() ) { start(); } } } qreal PositionSource::speed() const { return m_speed; } void PositionSource::updatePosition() { - if ( m_marbleWidget ) { - bool const hasPosition = m_marbleWidget->model()->positionTracking()->status() == Marble::PositionProviderStatusAvailable; + if ( m_marbleQuickItem ) { + bool const hasPosition = m_marbleQuickItem->model()->positionTracking()->status() == Marble::PositionProviderStatusAvailable; if ( hasPosition ) { - Marble::GeoDataCoordinates position = m_marbleWidget->model()->positionTracking()->currentLocation(); + Marble::GeoDataCoordinates position = m_marbleQuickItem->model()->positionTracking()->currentLocation(); m_position.setLongitude( position.longitude( Marble::GeoDataCoordinates::Degree ) ); m_position.setLatitude( position.latitude( Marble::GeoDataCoordinates::Degree ) ); m_position.setAltitude( position.altitude() ); } - m_speed = m_marbleWidget->model()->positionTracking()->speed() * Marble::METER2KM / Marble::SEC2HOUR; + m_speed = m_marbleQuickItem->model()->positionTracking()->speed() * Marble::METER2KM / Marble::SEC2HOUR; emit speedChanged(); if ( hasPosition != m_hasPosition ) { m_hasPosition = hasPosition; emit hasPositionChanged(); } if ( hasPosition ) { emit positionChanged(); } } } +} + #include "moc_PositionSource.cpp" diff --git a/src/lib/marble/declarative/PositionSource.h b/src/lib/marble/declarative/PositionSource.h index 2d3c43173..ca870807b 100644 --- a/src/lib/marble/declarative/PositionSource.h +++ b/src/lib/marble/declarative/PositionSource.h @@ -1,85 +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 2011 Dennis Nienhüser // #ifndef MARBLE_DECLARATIVE_POSITIONSOURCE_H #define MARBLE_DECLARATIVE_POSITIONSOURCE_H #include "Coordinate.h" #include #include -class MarbleWidget; +namespace Marble { + +class MarbleQuickItem; class PositionSource : public QObject { Q_OBJECT - Q_PROPERTY( MarbleWidget* map READ map WRITE setMap NOTIFY mapChanged ) + Q_PROPERTY( MarbleQuickItem* map READ map WRITE setMap NOTIFY mapChanged ) Q_PROPERTY( bool active READ active WRITE setActive NOTIFY activeChanged ) Q_PROPERTY( QString source READ source WRITE setSource NOTIFY sourceChanged ) Q_PROPERTY( bool hasPosition READ hasPosition NOTIFY hasPositionChanged ) Q_PROPERTY( Coordinate* position READ position NOTIFY positionChanged ) Q_PROPERTY( qreal speed READ speed NOTIFY speedChanged ) public: explicit PositionSource( QObject* parent = 0); bool active() const; void setActive( bool active ); QString source() const; void setSource( const QString &source ); bool hasPosition() const; Coordinate* position(); - MarbleWidget *map(); + MarbleQuickItem *map(); - void setMap( MarbleWidget *map ); + void setMap( MarbleQuickItem *map ); qreal speed() const; Q_SIGNALS: void mapChanged(); void activeChanged(); void sourceChanged(); void hasPositionChanged(); void positionChanged(); void speedChanged(); private Q_SLOTS: void updatePosition(); private: void start(); bool m_active; QString m_source; bool m_hasPosition; Coordinate m_position; - QPointer m_marbleWidget; + QPointer m_marbleQuickItem; qreal m_speed; }; +} + #endif diff --git a/src/lib/marble/declarative/RouteRequestModel.cpp b/src/lib/marble/declarative/RouteRequestModel.cpp index 664d257cf..d85690da8 100644 --- a/src/lib/marble/declarative/RouteRequestModel.cpp +++ b/src/lib/marble/declarative/RouteRequestModel.cpp @@ -1,145 +1,144 @@ // // 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 2011 Dennis Nienhüser // #include "RouteRequestModel.h" #include "routing/RoutingManager.h" #include "routing/RouteRequest.h" -#include "MarbleDeclarativeWidget.h" #include "MarbleMap.h" #include "MarbleModel.h" #include "Routing.h" #include RouteRequestModel::RouteRequestModel( QObject *parent ) : QAbstractListModel( parent ), m_request( 0 ), m_routing( 0 ) { QHash roles; roles[Qt::DisplayRole] = "name"; roles[LongitudeRole] = "longitude"; roles[LatitudeRole] = "latitude"; m_roleNames = roles; } RouteRequestModel::~RouteRequestModel() { // nothing to do } int RouteRequestModel::rowCount ( const QModelIndex &parent ) const { if ( !parent.isValid() && m_request ) { return m_request->size(); } return 0; } QHash RouteRequestModel::roleNames() const { return m_roleNames; } QVariant RouteRequestModel::headerData ( int section, Qt::Orientation orientation, int role ) const { if ( orientation == Qt::Horizontal && role == Qt::DisplayRole && section == 0 ) { return QString( "Waypoint" ); } return QVariant(); } QVariant RouteRequestModel::data ( const QModelIndex &index, int role ) const { if ( index.isValid() && m_request && index.row() >= 0 && index.row() < m_request->size() ) { switch ( role ) { case Qt::DisplayRole: { Marble::GeoDataPlacemark const & placemark = (*m_request)[index.row()]; if (!placemark.name().isEmpty()) { return placemark.name(); } if (!placemark.address().isEmpty()) { return placemark.address(); } return placemark.coordinate().toString(Marble::GeoDataCoordinates::Decimal).trimmed(); } case LongitudeRole: return m_request->at( index.row() ).longitude( Marble::GeoDataCoordinates::Degree ); case LatitudeRole: return m_request->at( index.row() ).latitude( Marble::GeoDataCoordinates::Degree ); } } return QVariant(); } Marble::Routing *RouteRequestModel::routing() { return m_routing; } void RouteRequestModel::setRouting( Marble::Routing *routing ) { if ( routing != m_routing ) { m_routing = routing; updateMap(); connect( m_routing, SIGNAL(marbleMapChanged()), this, SLOT(updateMap()) ); emit routingChanged(); } } void RouteRequestModel::updateMap() { if ( m_routing && m_routing->marbleMap() ) { m_request = m_routing->marbleMap()->model()->routingManager()->routeRequest(); connect( m_request, SIGNAL(positionChanged(int,GeoDataCoordinates)), this, SLOT(updateData(int)), Qt::UniqueConnection ); connect( m_request, SIGNAL(positionAdded(int)), this, SLOT(updateAfterAddition(int)), Qt::UniqueConnection ); connect( m_request, SIGNAL(positionRemoved(int)), this, SLOT(updateAfterRemoval(int)), Qt::UniqueConnection ); emit layoutChanged(); } } void RouteRequestModel::updateData( int idx ) { QModelIndex affected = index( idx ); emit dataChanged( affected, affected ); } void RouteRequestModel::updateAfterRemoval( int idx ) { beginRemoveRows( QModelIndex(), idx, idx ); removeRow( idx ); endRemoveRows(); emit rowCountChanged(); } void RouteRequestModel::updateAfterAddition( int idx ) { beginInsertRows( QModelIndex(), idx, idx ); insertRow( idx ); endInsertRows(); emit rowCountChanged(); } void RouteRequestModel::setPosition ( int index, qreal longitude, qreal latitude ) { if ( index >= 0 && index < m_request->size() ) { m_request->setPosition( index, Marble::GeoDataCoordinates( longitude, latitude, 0.0, Marble::GeoDataCoordinates::Degree ) ); } } #include "moc_RouteRequestModel.cpp" diff --git a/src/lib/marble/declarative/Routing.cpp b/src/lib/marble/declarative/Routing.cpp index 38475cac3..163d23eea 100644 --- a/src/lib/marble/declarative/Routing.cpp +++ b/src/lib/marble/declarative/Routing.cpp @@ -1,473 +1,472 @@ // // 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 2011 Dennis Nienhüser // #include "Routing.h" -#include "MarbleDeclarativeWidget.h" #include #include #include "MarbleDirs.h" #include "routing/AlternativeRoutesModel.h" #include "routing/RoutingManager.h" #include "routing/RouteRequest.h" #include "routing/RoutingProfilesModel.h" #include #include #include #include #include #include #include #include namespace Marble { class RoutingPrivate { public: explicit RoutingPrivate(QObject * parent = nullptr); MarbleMap* m_marbleMap; QMap m_profiles; QString m_routingProfile; QQmlComponent * m_waypointDelegate; QMap m_waypointItems; RouteRequestModel* m_routeRequestModel; QObject * m_parent; QVector m_searchResultPlacemarks; QMap m_searchResultItems; }; RoutingPrivate::RoutingPrivate(QObject *parent) : m_marbleMap( nullptr ), m_waypointDelegate( nullptr ), m_routeRequestModel( new RouteRequestModel(parent) ), m_parent( parent ) { // nothing to do } Routing::Routing( QQuickItem *parent) : QQuickPaintedItem( parent ), d( new RoutingPrivate(this) ) { d->m_routeRequestModel->setRouting(this); connect(d->m_routeRequestModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(updateWaypointItems())); connect(d->m_routeRequestModel, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), this, SLOT(updateWaypointItems())); connect(d->m_routeRequestModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(updateWaypointItems())); emit routeRequestModelChanged(d->m_routeRequestModel); } Routing::~Routing() { delete d; } void Routing::paint(QPainter *painter) { if (!d->m_marbleMap) { return; } QPaintDevice *paintDevice = painter->device(); painter->end(); { Marble::GeoPainter geoPainter(paintDevice, d->m_marbleMap->viewport(), d->m_marbleMap->mapQuality()); RoutingManager const * const routingManager = d->m_marbleMap->model()->routingManager(); GeoDataLineString const waypoints = routingManager->routingModel()->route().path(); int const dpi = qMax(paintDevice->logicalDpiX(), paintDevice->logicalDpiY()); QPen standardRoutePen( routingManager->routeColorStandard().darker( 200 ) ); qreal const width = 2.5 * MM2M * M2IN * dpi; standardRoutePen.setWidthF( width ); geoPainter.setPen( standardRoutePen ); geoPainter.drawPolyline( waypoints ); standardRoutePen.setColor( routingManager->routeColorStandard() ); standardRoutePen.setWidthF( width - 4.0 ); if ( routingManager->state() == RoutingManager::Downloading ) { standardRoutePen.setStyle( Qt::DotLine ); } geoPainter.setPen( standardRoutePen ); geoPainter.drawPolyline( waypoints ); } painter->begin(paintDevice); } QObject* Routing::waypointModel() { return d->m_marbleMap ? d->m_marbleMap->model()->routingManager()->routingModel() : 0; } void Routing::setWaypointDelegate(QQmlComponent *waypointDelegate) { if (d->m_waypointDelegate == waypointDelegate) { return; } d->m_waypointDelegate = waypointDelegate; emit waypointDelegateChanged(waypointDelegate); } void Routing::updateWaypointItems() { if ( d->m_marbleMap && d->m_routeRequestModel ) { for (int i = d->m_waypointItems.keys().size(); i < d->m_routeRequestModel->rowCount(); i++ ) { QQmlContext * context = new QQmlContext( qmlContext( d->m_waypointDelegate ) ); QObject * component = d->m_waypointDelegate->create(context); QQuickItem* item = qobject_cast( component ); if ( item ) { item->setParentItem( this ); item->setProperty("index", i); d->m_waypointItems[i] = item; } else { delete component; } } for (int i = d->m_waypointItems.keys().size()-1; i >= d->m_routeRequestModel->rowCount(); i--) { QQuickItem* item = d->m_waypointItems[i]; item->setProperty("visible", QVariant::fromValue(false) ); d->m_waypointItems.erase(d->m_waypointItems.find(i)); item->deleteLater(); } QMap::iterator iter = d->m_waypointItems.begin(); while ( iter != d->m_waypointItems.end() ) { qreal x = 0; qreal y = 0; const qreal lon = d->m_routeRequestModel->data(d->m_routeRequestModel->index( iter.key() ), RouteRequestModel::LongitudeRole).toFloat(); const qreal lat = d->m_routeRequestModel->data(d->m_routeRequestModel->index( iter.key() ), RouteRequestModel::LatitudeRole).toFloat(); const bool visible = d->m_marbleMap->viewport()->screenCoordinates(lon * DEG2RAD, lat * DEG2RAD, x, y); QQuickItem * item = iter.value(); if ( item ) { item->setVisible( visible ); if ( visible ) { item->setProperty("xPos", QVariant::fromValue(x)); item->setProperty("yPos", QVariant::fromValue(y)); if (iter.key() == 0 && waypointCount() == 1) { item->setProperty("type", QVariant::fromValue(QString("departure"))); } else if (iter.key() == d->m_waypointItems.keys().size()-1) { item->setProperty("type", QVariant::fromValue(QString("destination"))); } else if (iter.key() > 0) { item->setProperty("type", QVariant::fromValue(QString("waypoint"))); } else { item->setProperty("type", QVariant::fromValue(QString("departure"))); } } } ++iter; } } } int Routing::addSearchResultPlacemark(Placemark *placemark) { if ( d->m_marbleMap ) { for (int i = 0; i < d->m_searchResultItems.size(); i++) { if (d->m_searchResultPlacemarks[i]->coordinate()->coordinates() == placemark->coordinate()->coordinates()) { return i; } } Placemark * newPlacemark = new Placemark(this); newPlacemark->setGeoDataPlacemark(placemark->placemark()); d->m_searchResultPlacemarks.push_back(newPlacemark); } updateSearchResultPlacemarks(); return d->m_searchResultPlacemarks.size()-1; } void Routing::clearSearchResultPlacemarks() { foreach(Placemark* placemark, d->m_searchResultPlacemarks) { placemark->deleteLater(); } d->m_searchResultPlacemarks.clear(); foreach(QQuickItem* item, d->m_searchResultItems) { item->deleteLater(); } d->m_searchResultItems.clear(); } void Routing::updateSearchResultPlacemarks() { for (int i = d->m_searchResultItems.keys().size(); i < d->m_searchResultPlacemarks.size(); i++ ) { QQmlContext * context = new QQmlContext( qmlContext( d->m_waypointDelegate ) ); QObject * component = d->m_waypointDelegate->create(context); QQuickItem* item = qobject_cast( component ); if ( item ) { item->setParentItem( this ); item->setProperty("index", i); item->setProperty("type", QVariant::fromValue(QString("searchResult"))); item->setProperty("placemark", QVariant::fromValue(d->m_searchResultPlacemarks[i])); d->m_searchResultItems[i] = item; } else { delete component; } } for (int i = d->m_searchResultItems.keys().size()-1; i >= d->m_searchResultPlacemarks.size(); i--) { QQuickItem* item = d->m_searchResultItems[i]; item->setProperty("visible", QVariant::fromValue(false) ); d->m_searchResultItems.erase(d->m_searchResultItems.find(i)); item->deleteLater(); } for (int i = 0; i < d->m_searchResultItems.keys().size() && i < d->m_searchResultPlacemarks.size(); i++) { qreal x = 0; qreal y = 0; const qreal lon = d->m_searchResultPlacemarks[i]->coordinate()->longitude(); const qreal lat = d->m_searchResultPlacemarks[i]->coordinate()->latitude(); const bool visible = d->m_marbleMap->viewport()->screenCoordinates(lon * DEG2RAD, lat * DEG2RAD, x, y); QQuickItem * item = d->m_searchResultItems[i]; if ( item ) { item->setVisible( visible ); if ( visible ) { item->setProperty("xPos", QVariant::fromValue(x)); item->setProperty("yPos", QVariant::fromValue(y)); } } } } void Routing::setMarbleMap( MarbleMap* marbleMap ) { d->m_marbleMap = marbleMap; if ( d->m_marbleMap ) { connect(d->m_marbleMap, SIGNAL(repaintNeeded(QRegion)), this, SLOT(update())); RoutingManager* routingManager = d->m_marbleMap->model()->routingManager(); if (routingManager->profilesModel()->rowCount() == 0) { routingManager->profilesModel()->loadDefaultProfiles(); routingManager->readSettings(); } connect( routingManager, SIGNAL(stateChanged(RoutingManager::State)), this, SLOT(update())); connect( routingManager, SIGNAL(routeRetrieved(GeoDataDocument*)), this, SLOT(update())); connect( routingManager, SIGNAL(stateChanged(RoutingManager::State)), this, SIGNAL(hasRouteChanged()) ); connect( routingModel(), SIGNAL(currentRouteChanged()), this, SIGNAL(hasRouteChanged()) ); connect( routingModel(), SIGNAL(currentRouteChanged()), this, SLOT(update()) ); connect( d->m_marbleMap, SIGNAL(visibleLatLonAltBoxChanged(GeoDataLatLonAltBox)), this, SLOT(updateWaypointItems()) ); connect( d->m_marbleMap, SIGNAL(visibleLatLonAltBoxChanged(GeoDataLatLonAltBox)), this, SLOT(updateSearchResultPlacemarks()) ); emit routingModelChanged(); QList profiles = routingManager->profilesModel()->profiles(); if ( profiles.size() == 4 ) { /** @todo FIXME: Restrictive assumptions on available plugins and certain profile loading implementation */ d->m_profiles["Motorcar"] = profiles.at( 0 ); d->m_profiles["Bicycle"] = profiles.at( 2 ); d->m_profiles["Pedestrian"] = profiles.at( 3 ); } else { qDebug() << "Unexpected size of default routing profiles: " << profiles.size(); } } emit marbleMapChanged(); emit routingProfileChanged(); emit hasRouteChanged(); } MarbleMap *Routing::marbleMap() { return d->m_marbleMap; } QString Routing::routingProfile() const { return d->m_routingProfile; } void Routing::setRoutingProfile( const QString & profile ) { if ( d->m_routingProfile != profile ) { d->m_routingProfile = profile; if ( d->m_marbleMap ) { d->m_marbleMap->model()->routingManager()->routeRequest()->setRoutingProfile( d->m_profiles[profile] ); } emit routingProfileChanged(); } } bool Routing::hasRoute() const { return d->m_marbleMap && d->m_marbleMap->model()->routingManager()->routingModel()->rowCount() > 0; } RoutingModel *Routing::routingModel() { return d->m_marbleMap == 0 ? 0 : d->m_marbleMap->model()->routingManager()->routingModel(); } QQmlComponent *Routing::waypointDelegate() const { return d->m_waypointDelegate; } int Routing::waypointCount() const { return d->m_routeRequestModel ? d->m_routeRequestModel->rowCount() : 0; } RouteRequestModel *Routing::routeRequestModel() { return d->m_routeRequestModel; } void Routing::addVia( qreal lon, qreal lat ) { if ( d->m_marbleMap ) { Marble::RouteRequest* request = d->m_marbleMap->model()->routingManager()->routeRequest(); request->addVia( Marble::GeoDataCoordinates( lon, lat, 0.0, Marble::GeoDataCoordinates::Degree ) ); updateRoute(); } } void Routing::addViaAtIndex(int index, qreal lon, qreal lat) { if ( d->m_marbleMap ) { Marble::RouteRequest * request = d->m_marbleMap->model()->routingManager()->routeRequest(); request->insert(index, Marble::GeoDataCoordinates( lon, lat, 0.0, Marble::GeoDataCoordinates::Degree) ); updateRoute(); } } void Routing::addViaByPlacemark(Placemark *placemark) { if ( d->m_marbleMap ) { Marble::RouteRequest * request = d->m_marbleMap->model()->routingManager()->routeRequest(); request->addVia(placemark->placemark()); updateRoute(); } } void Routing::addViaByPlacemarkAtIndex(int index, Placemark *placemark) { if ( d->m_marbleMap ) { Marble::RouteRequest * request = d->m_marbleMap->model()->routingManager()->routeRequest(); request->insert(index, placemark->placemark()); updateRoute(); } } void Routing::setVia( int index, qreal lon, qreal lat ) { if ( index < 0 || index > 200 || !d->m_marbleMap ) { return; } Marble::RouteRequest* request = d->m_marbleMap->model()->routingManager()->routeRequest(); Q_ASSERT( request ); if ( index < request->size() ) { request->setPosition( index, Marble::GeoDataCoordinates( lon, lat, 0.0, Marble::GeoDataCoordinates::Degree ) ); } else { for ( int i=request->size(); iappend( Marble::GeoDataCoordinates( 0.0, 0.0 ) ); } request->append( Marble::GeoDataCoordinates( lon, lat, 0.0, Marble::GeoDataCoordinates::Degree ) ); } updateRoute(); } void Routing::removeVia( int index ) { if ( index < 0 || !d->m_marbleMap ) { return; } Marble::RouteRequest* request = d->m_marbleMap->model()->routingManager()->routeRequest(); if ( index < request->size() ) { d->m_marbleMap->model()->routingManager()->routeRequest()->remove( index ); } updateRoute(); } void Routing::swapVias(int index1, int index2) { if ( !d->m_marbleMap || !d->m_routeRequestModel ) { return; } Marble::RouteRequest* request = d->m_marbleMap->model()->routingManager()->routeRequest(); request->swap(index1, index2); updateRoute(); updateWaypointItems(); } void Routing::reverseRoute() { if ( d->m_marbleMap ) { d->m_marbleMap->model()->routingManager()->reverseRoute(); } } void Routing::clearRoute() { if ( d->m_marbleMap ) { d->m_marbleMap->model()->routingManager()->clearRoute(); } } void Routing::updateRoute() { if ( d->m_marbleMap ) { d->m_marbleMap->model()->routingManager()->retrieveRoute(); } } void Routing::openRoute( const QString &fileName ) { if ( d->m_marbleMap ) { Marble::RoutingManager * const routingManager = d->m_marbleMap->model()->routingManager(); /** @todo FIXME: replace the file:// prefix on QML side */ routingManager->clearRoute(); QString target = fileName.startsWith( QLatin1String( "file://" ) ) ? fileName.mid( 7 ) : fileName; routingManager->loadRoute( target ); Marble::GeoDataDocument* route = routingManager->alternativeRoutesModel()->currentRoute(); if ( route ) { const Marble::GeoDataLineString* waypoints = Marble::AlternativeRoutesModel::waypoints( route ); if ( waypoints ) { GeoDataCoordinates const center = waypoints->latLonAltBox().center(); GeoDataCoordinates::Unit const inDegree = GeoDataCoordinates::Degree; d->m_marbleMap->centerOn( center.longitude(inDegree), center.latitude(inDegree) ); } } } } void Routing::saveRoute( const QString &fileName ) { if ( d->m_marbleMap ) { /** @todo FIXME: replace the file:// prefix on QML side */ QString target = fileName.startsWith( QLatin1String( "file://" ) ) ? fileName.mid( 7 ) : fileName; d->m_marbleMap->model()->routingManager()->saveRoute( target ); } } } #include "moc_Routing.cpp" diff --git a/src/lib/marble/declarative/Search.cpp b/src/lib/marble/declarative/Search.cpp deleted file mode 100644 index 7808d6890..000000000 --- a/src/lib/marble/declarative/Search.cpp +++ /dev/null @@ -1,185 +0,0 @@ -// -// 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 2011 Dennis Nienhüser -// - -#include "Search.h" - -#include "MarbleDeclarativeWidget.h" -#include "MarbleModel.h" -#include "MarblePlacemarkModel.h" -#include "SearchRunnerManager.h" -#include "ViewportParams.h" - -#include - -Search::Search( QObject* parent ) : QObject( parent ), - m_marbleWidget( 0 ), m_runnerManager( 0 ), - m_searchResult( 0 ), m_placemarkDelegate( 0 ) -{ - // nothing to do -} - -MarbleWidget *Search::map() -{ - return m_marbleWidget; -} - -void Search::setMap( MarbleWidget* widget ) -{ - m_marbleWidget = widget; - connect( m_marbleWidget, SIGNAL(visibleLatLonAltBoxChanged()), - this, SLOT(updatePlacemarks()) ); - connect( m_marbleWidget, SIGNAL(mapThemeChanged()), - this, SLOT(updatePlacemarks()) ); - emit mapChanged(); -} - -QQmlComponent* Search::placemarkDelegate() -{ - return m_placemarkDelegate; -} - -void Search::setPlacemarkDelegate( QQmlComponent* delegate ) -{ - m_placemarkDelegate = delegate; - emit placemarkDelegateChanged(); -} - -void Search::find( const QString &searchTerm ) -{ - if ( !m_runnerManager && m_marbleWidget ) { - m_runnerManager = new Marble::SearchRunnerManager( m_marbleWidget->model(), this ); - connect( m_runnerManager, SIGNAL(searchFinished(QString)), - this, SLOT(handleSearchResult()) ); - connect( m_runnerManager, SIGNAL(searchResultChanged(QAbstractItemModel*)), - this, SLOT(updateSearchModel(QAbstractItemModel*)) ); - } - - if ( m_runnerManager ) { - m_runnerManager->findPlacemarks( searchTerm ); - } -} - -QObject* Search::searchResultModel() -{ - return m_searchResult; -} - -void Search::updateSearchModel( QAbstractItemModel *model ) -{ - m_searchResult = static_cast( model ); - qDeleteAll( m_placemarks.values() ); - m_placemarks.clear(); - - if ( !m_placemarkDelegate ) { - return; - } - - QHash const roles = model->roleNames(); - for ( int i=0; irowCount(); ++i ) { - - QQmlContext *context = new QQmlContext( qmlContext( m_placemarkDelegate ) ); - QModelIndex const index = m_searchResult->index( i ); - QHash::const_iterator iter = roles.constBegin(); - context->setContextProperty( "index", i ); - for ( ; iter != roles.constEnd(); ++iter ) { - context->setContextProperty( iter.value(), m_searchResult->data( index, iter.key() ) ); - } - QObject* component = m_placemarkDelegate->create( context ); - QQuickItem* item = qobject_cast( component ); - if ( item ) { - item->setParentItem( m_marbleWidget ); - m_placemarks[i] = item; - } else { - delete component; - } - } - updatePlacemarks(); -} - -void Search::updatePlacemarks() -{ - if ( m_marbleWidget ) { - bool const onEarth = m_marbleWidget->model()->planetId() == "earth"; - QMap::const_iterator iter = m_placemarks.constBegin(); - while ( iter != m_placemarks.constEnd() ) { - qreal x(0), y(0); - QVariant position = m_searchResult->data( m_searchResult->index( iter.key() ), Marble::MarblePlacemarkModel::CoordinateRole ); - Marble::GeoDataCoordinates const coordinates = position.value(); - bool const visible = onEarth && m_marbleWidget->viewport()->screenCoordinates( coordinates.longitude( Marble::GeoDataCoordinates::Radian ), - coordinates.latitude( Marble::GeoDataCoordinates::Radian), x, y ); - QQuickItem* item = iter.value(); - if ( item ) { - item->setVisible( visible ); - if ( visible ) { - int shiftX( 0 ), shiftY( 0 ); - switch( item->transformOrigin() ) { - case QQuickItem::TopLeft: - case QQuickItem::Top: - case QQuickItem::TopRight: - break; - case QQuickItem::Left: - case QQuickItem::Center: - case QQuickItem::Right: - shiftY = item->height() / 2; - break; - case QQuickItem::BottomLeft: - case QQuickItem::Bottom: - case QQuickItem::BottomRight: - shiftY = item->height(); - break; - } - - switch( item->transformOrigin() ) { - case QQuickItem::TopLeft: - case QQuickItem::Left: - case QQuickItem::BottomLeft: - break; - case QQuickItem::Top: - case QQuickItem::Center: - case QQuickItem::Bottom: - shiftX = item->width() / 2; - break; - case QQuickItem::TopRight: - case QQuickItem::Right: - case QQuickItem::BottomRight: - shiftX = item->width(); - break; - } - - item->setX( x - shiftX ); - item->setY( y - shiftY ); - } - } - ++iter; - } - } -} - -void Search::handleSearchResult() -{ - Q_ASSERT( m_marbleWidget ); // search wouldn't be started without - Q_ASSERT( m_searchResult ); // search wouldn't be finished without - - Marble::GeoDataLineString placemarks; - for ( int i = 0; i < m_searchResult->rowCount(); ++i ) { - QVariant data = m_searchResult->index( i, 0 ).data( Marble::MarblePlacemarkModel::CoordinateRole ); - if ( !data.isNull() ) { - placemarks << data.value(); - } - } - - if ( placemarks.size() > 1 ) { - m_marbleWidget->centerOn( Marble::GeoDataLatLonBox::fromLineString( placemarks ) ); - } - - emit searchFinished(); -} - -#include "moc_Search.cpp" diff --git a/src/lib/marble/declarative/Search.h b/src/lib/marble/declarative/Search.h deleted file mode 100644 index 7f909ca0e..000000000 --- a/src/lib/marble/declarative/Search.h +++ /dev/null @@ -1,83 +0,0 @@ -// -// 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 2011 Dennis Nienhüser -// - -#ifndef MARBLE_DECLARATIVE_SEARCH_H -#define MARBLE_DECLARATIVE_SEARCH_H - -#include -#include -#include - -class QAbstractItemModel; - -namespace Marble { - class MarblePlacemarkModel; - class SearchRunnerManager; -} - -class MarbleWidget; - -class Search : public QObject -{ - Q_OBJECT - - Q_PROPERTY( MarbleWidget* map READ map WRITE setMap NOTIFY mapChanged ) - Q_PROPERTY( QQmlComponent* placemarkDelegate READ placemarkDelegate WRITE setPlacemarkDelegate NOTIFY placemarkDelegateChanged ) - -public: - explicit Search( QObject* parent = 0 ); - - MarbleWidget *map(); - - void setMap( MarbleWidget* widget ); - - QQmlComponent* placemarkDelegate(); - - void setPlacemarkDelegate( QQmlComponent* delegate ); - -Q_SIGNALS: - void mapChanged(); - - /** - * The last search triggered by search() is finished and can be - * retrieved using @see searchResult - */ - void searchFinished(); - - void placemarkDelegateChanged(); - -public Q_SLOTS: - void find( const QString &searchTerm ); - - QObject* searchResultModel(); - -private Q_SLOTS: - /** Search progress update */ - void updateSearchModel( QAbstractItemModel *model ); - - void updatePlacemarks(); - - void handleSearchResult(); - -private: - MarbleWidget* m_marbleWidget; - - /** Wrapped Marble runner manager */ - Marble::SearchRunnerManager *m_runnerManager; - - /** Search result */ - Marble::MarblePlacemarkModel *m_searchResult; - - QQmlComponent* m_placemarkDelegate; - - QMap m_placemarks; -}; - -#endif diff --git a/src/lib/marble/declarative/Tracking.cpp b/src/lib/marble/declarative/Tracking.cpp index 7e7a2750e..18dfdabe9 100644 --- a/src/lib/marble/declarative/Tracking.cpp +++ b/src/lib/marble/declarative/Tracking.cpp @@ -1,303 +1,306 @@ // // 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 2011 Dennis Nienhüser // #include "Tracking.h" -#include "MarbleDeclarativeWidget.h" +#include "MarbleQuickItem.h" #include "MarbleModel.h" #include "PositionTracking.h" #include "RenderPlugin.h" #include "ViewportParams.h" #include "AutoNavigation.h" #include +namespace Marble { + Tracking::Tracking( QObject* parent) : QObject( parent ), m_showTrack( true ), m_positionSource( 0 ), m_positionMarker( 0 ), - m_marbleWidget( 0 ), + m_marbleQuickItem( 0 ), m_hasLastKnownPosition( false ), m_autoNavigation( 0 ), m_positionMarkerType( None ) { connect( &m_lastKnownPosition, SIGNAL(longitudeChanged()), this, SLOT(setHasLastKnownPosition()) ); connect( &m_lastKnownPosition, SIGNAL(latitudeChanged()), this, SLOT(setHasLastKnownPosition()) ); } bool Tracking::showTrack() const { return m_showTrack; } void Tracking::setShowTrack( bool show ) { if ( show != m_showTrack ) { - if ( m_marbleWidget ) { - m_marbleWidget->model()->positionTracking()->setTrackVisible( show ); - m_marbleWidget->update(); + if ( m_marbleQuickItem ) { + m_marbleQuickItem->model()->positionTracking()->setTrackVisible( show ); + m_marbleQuickItem->update(); } m_showTrack = show; emit showTrackChanged(); } } PositionSource* Tracking::positionSource() { return m_positionSource; } void Tracking::setPositionSource( PositionSource* source ) { if ( source != m_positionSource ) { m_positionSource = source; if ( source ) { connect( source, SIGNAL(positionChanged()), this, SLOT(updatePositionMarker()) ); connect( source, SIGNAL(positionChanged()), this, SLOT(updateLastKnownPosition()) ); connect( source, SIGNAL(hasPositionChanged()), this, SLOT(updatePositionMarker()) ); connect( source, SIGNAL(positionChanged()), this, SIGNAL(distanceChanged()) ); } emit positionSourceChanged(); } } -MarbleWidget* Tracking::map() +MarbleQuickItem* Tracking::map() { - return m_marbleWidget; + return m_marbleQuickItem; } -void Tracking::setMap( MarbleWidget* widget ) +void Tracking::setMap( MarbleQuickItem* item ) { - if ( widget != m_marbleWidget ) { - m_marbleWidget = widget; + if ( item != m_marbleQuickItem ) { + m_marbleQuickItem = item; - if ( m_marbleWidget ) { - m_marbleWidget->model()->positionTracking()->setTrackVisible( showTrack() ); + if ( m_marbleQuickItem ) { + m_marbleQuickItem->model()->positionTracking()->setTrackVisible( showTrack() ); setShowPositionMarkerPlugin( m_positionMarkerType == Arrow ); - connect( m_marbleWidget, SIGNAL(visibleLatLonAltBoxChanged()), this, SLOT(updatePositionMarker()) ); - connect( m_marbleWidget, SIGNAL(mapThemeChanged()), this, SLOT(updatePositionMarker()) ); + connect( m_marbleQuickItem, SIGNAL(visibleLatLonAltBoxChanged()), this, SLOT(updatePositionMarker()) ); + connect( m_marbleQuickItem, SIGNAL(mapThemeChanged()), this, SLOT(updatePositionMarker()) ); } emit mapChanged(); } } void Tracking::setPositionMarker( QObject* marker ) { if ( marker != m_positionMarker ) { m_positionMarker = marker; emit positionMarkerChanged(); } } QObject* Tracking::positionMarker() { return m_positionMarker; } void Tracking::updatePositionMarker() { - if ( m_marbleWidget && m_positionMarker && m_positionMarkerType == Circle ) { + if ( m_marbleQuickItem && m_positionMarker && m_positionMarkerType == Circle ) { Coordinate* position = 0; - bool visible = m_marbleWidget->model()->planetId() == "earth"; + bool visible = m_marbleQuickItem->model()->planetId() == "earth"; if ( m_positionSource && m_positionSource->hasPosition() ) { position = m_positionSource->position(); } else if ( hasLastKnownPosition() ) { position = lastKnownPosition(); } else { visible = false; } qreal x(0), y(0); if ( position ) { Marble::GeoDataCoordinates const pos( position->longitude(), position->latitude(), 0.0, GeoDataCoordinates::Degree ); - visible = visible && m_marbleWidget->viewport()->screenCoordinates( pos.longitude(), pos.latitude(), x, y ); + visible = visible && m_marbleQuickItem->map()->viewport()->screenCoordinates( pos.longitude(), pos.latitude(), x, y ); QQuickItem* item = qobject_cast( m_positionMarker ); if ( item ) { item->setVisible( visible ); if ( visible ) { item->setX( x - item->width() / 2.0 ); item->setY( y - item->height() / 2.0 ); } } } } else if ( m_positionMarkerType != Circle ) { QQuickItem* item = qobject_cast( m_positionMarker ); if ( item ) { item->setVisible( false ); } } } void Tracking::updateLastKnownPosition() { if ( m_positionSource && m_positionSource->hasPosition() ) { setLastKnownPosition( m_positionSource->position() ); } } void Tracking::setHasLastKnownPosition() { if ( !m_hasLastKnownPosition ) { m_hasLastKnownPosition = true; emit hasLastKnownPositionChanged(); } } void Tracking::setShowPositionMarkerPlugin( bool visible ) { - if ( m_marbleWidget ) { - QList const renderPlugins = m_marbleWidget->renderPlugins(); - foreach( QObject* object, renderPlugins ) { - Marble::RenderPlugin* renderPlugin = qobject_cast( object ); + if ( m_marbleQuickItem ) { + QList const renderPlugins = m_marbleQuickItem->map()->renderPlugins(); + foreach( RenderPlugin* renderPlugin, renderPlugins ) { Q_ASSERT( renderPlugin ); if ( renderPlugin->nameId() == "positionMarker" ) { renderPlugin->setEnabled( true ); renderPlugin->setVisible( visible ); } } } } bool Tracking::hasLastKnownPosition() const { return m_hasLastKnownPosition; } Coordinate * Tracking::lastKnownPosition() { return &m_lastKnownPosition; } void Tracking::setLastKnownPosition( Coordinate* lastKnownPosition ) { if ( lastKnownPosition && *lastKnownPosition != m_lastKnownPosition ) { m_lastKnownPosition.setCoordinates( lastKnownPosition->coordinates() ); emit lastKnownPositionChanged(); } } bool Tracking::autoCenter() const { if ( m_autoNavigation ) { return m_autoNavigation->recenterMode() != Marble::AutoNavigation::DontRecenter; } return false; } void Tracking::setAutoCenter( bool enabled ) { if ( autoCenter() != enabled ) { - if ( enabled && !m_autoNavigation && m_marbleWidget ) { - m_autoNavigation = new Marble::AutoNavigation( m_marbleWidget->model(), m_marbleWidget->viewport(), this ); + if ( enabled && !m_autoNavigation && m_marbleQuickItem ) { + m_autoNavigation = new Marble::AutoNavigation( m_marbleQuickItem->model(), m_marbleQuickItem->map()->viewport(), this ); connect( m_autoNavigation, SIGNAL(zoomIn(FlyToMode)), - m_marbleWidget, SLOT(zoomIn()) ); + m_marbleQuickItem, SLOT(zoomIn()) ); connect( m_autoNavigation, SIGNAL(zoomOut(FlyToMode)), - m_marbleWidget, SLOT(zoomOut()) ); + m_marbleQuickItem, SLOT(zoomOut()) ); connect( m_autoNavigation, SIGNAL(centerOn(GeoDataCoordinates,bool)), - m_marbleWidget, SLOT(centerOn(GeoDataCoordinates)) ); + m_marbleQuickItem, SLOT(centerOn(GeoDataCoordinates)) ); - connect( m_marbleWidget, SIGNAL(visibleLatLonAltBoxChanged()), + connect( m_marbleQuickItem, SIGNAL(visibleLatLonAltBoxChanged()), m_autoNavigation, SLOT(inhibitAutoAdjustments()) ); } if ( m_autoNavigation ) { m_autoNavigation->setRecenter( Marble::AutoNavigation::RecenterOnBorder ); } emit autoCenterChanged(); } } bool Tracking::autoZoom() const { if ( m_autoNavigation ) { return m_autoNavigation->autoZoom(); } return false; } void Tracking::setAutoZoom( bool enabled ) { if ( autoZoom() != enabled ) { - if ( enabled && !m_autoNavigation && m_marbleWidget ) { - m_autoNavigation = new Marble::AutoNavigation( m_marbleWidget->model(), m_marbleWidget->viewport(), this ); + if ( enabled && !m_autoNavigation && m_marbleQuickItem ) { + m_autoNavigation = new Marble::AutoNavigation( m_marbleQuickItem->model(), m_marbleQuickItem->map()->viewport(), this ); connect( m_autoNavigation, SIGNAL(zoomIn(FlyToMode)), - m_marbleWidget, SLOT(zoomIn()) ); + m_marbleQuickItem, SLOT(zoomIn()) ); connect( m_autoNavigation, SIGNAL(zoomOut(FlyToMode)), - m_marbleWidget, SLOT(zoomOut()) ); + m_marbleQuickItem, SLOT(zoomOut()) ); connect( m_autoNavigation, SIGNAL(centerOn(GeoDataCoordinates,bool)), - m_marbleWidget, SLOT(centerOn(GeoDataCoordinates)) ); + m_marbleQuickItem, SLOT(centerOn(GeoDataCoordinates)) ); - connect( m_marbleWidget, SIGNAL(visibleLatLonAltBoxChanged()), + connect( m_marbleQuickItem, SIGNAL(visibleLatLonAltBoxChanged()), m_autoNavigation, SLOT(inhibitAutoAdjustments()) ); } if ( m_autoNavigation ) { m_autoNavigation->setAutoZoom( enabled ); } emit autoZoomChanged(); } } Tracking::PositionMarkerType Tracking::positionMarkerType() const { return m_positionMarkerType; } void Tracking::setPositionMarkerType( Tracking::PositionMarkerType type ) { setShowPositionMarkerPlugin( type == Arrow ); if ( type != m_positionMarkerType ) { m_positionMarkerType = type; emit positionMarkerTypeChanged(); } } double Tracking::distance() const { - return m_marbleWidget ? m_marbleWidget->model()->positionTracking()->length( m_marbleWidget->model()->planetRadius() ) : 0.0; + return m_marbleQuickItem ? m_marbleQuickItem->model()->positionTracking()->length( m_marbleQuickItem->model()->planetRadius() ) : 0.0; } void Tracking::saveTrack( const QString &fileName ) { - if ( m_marbleWidget ) { + if ( m_marbleQuickItem ) { /** @todo FIXME: replace the file:// prefix on QML side */ QString target = fileName.startsWith( QLatin1String( "file://" ) ) ? fileName.mid( 7 ) : fileName; - m_marbleWidget->model()->positionTracking()->saveTrack( target ); + m_marbleQuickItem->model()->positionTracking()->saveTrack( target ); } } void Tracking::openTrack(const QString &fileName) { - if ( m_marbleWidget ) { + if ( m_marbleQuickItem ) { /** @todo FIXME: replace the file:// prefix on QML side */ QString target = fileName.startsWith( QLatin1String( "file://" ) ) ? fileName.mid( 7 ) : fileName; - m_marbleWidget->model()->addGeoDataFile( target ); + m_marbleQuickItem->model()->addGeoDataFile( target ); } } void Tracking::clearTrack() { - if ( m_marbleWidget ) { - m_marbleWidget->model()->positionTracking()->clearTrack(); + if ( m_marbleQuickItem ) { + m_marbleQuickItem->model()->positionTracking()->clearTrack(); } } +} + #include "moc_Tracking.cpp" diff --git a/src/lib/marble/declarative/Tracking.h b/src/lib/marble/declarative/Tracking.h index 0b61608b2..64b0e46cd 100644 --- a/src/lib/marble/declarative/Tracking.h +++ b/src/lib/marble/declarative/Tracking.h @@ -1,142 +1,142 @@ // // 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 2011 Dennis Nienhüser // #ifndef MARBLE_DECLARATIVE_TRACKING_H #define MARBLE_DECLARATIVE_TRACKING_H #include "PositionSource.h" #include #include -class MarbleWidget; - namespace Marble { class AutoNavigation; -} +class MarbleQuickItem; class Tracking : public QObject { Q_OBJECT Q_ENUMS( PositionMarkerType ) - Q_PROPERTY( MarbleWidget* map READ map WRITE setMap NOTIFY mapChanged ) + Q_PROPERTY( MarbleQuickItem* map READ map WRITE setMap NOTIFY mapChanged ) Q_PROPERTY( bool showTrack READ showTrack WRITE setShowTrack NOTIFY showTrackChanged ) Q_PROPERTY( bool autoCenter READ autoCenter WRITE setAutoCenter NOTIFY autoCenterChanged ) Q_PROPERTY( bool autoZoom READ autoZoom WRITE setAutoZoom NOTIFY autoZoomChanged ) Q_PROPERTY( PositionSource* positionSource READ positionSource WRITE setPositionSource NOTIFY positionSourceChanged ) Q_PROPERTY( QObject* positionMarker READ positionMarker WRITE setPositionMarker NOTIFY positionMarkerChanged ) Q_PROPERTY( bool hasLastKnownPosition READ hasLastKnownPosition NOTIFY hasLastKnownPositionChanged ) Q_PROPERTY( Coordinate* lastKnownPosition READ lastKnownPosition WRITE setLastKnownPosition NOTIFY lastKnownPositionChanged ) Q_PROPERTY( PositionMarkerType positionMarkerType READ positionMarkerType WRITE setPositionMarkerType NOTIFY positionMarkerTypeChanged ) Q_PROPERTY( double distance READ distance NOTIFY distanceChanged ) public: enum PositionMarkerType { None, Circle, Arrow }; explicit Tracking( QObject* parent = 0 ); bool showTrack() const; void setShowTrack( bool show ); PositionSource* positionSource(); void setPositionSource( PositionSource* source ); QObject* positionMarker(); void setPositionMarker( QObject* marker ); - MarbleWidget* map(); + MarbleQuickItem* map(); - void setMap( MarbleWidget* widget ); + void setMap( MarbleQuickItem* widget ); bool hasLastKnownPosition() const; Coordinate *lastKnownPosition(); void setLastKnownPosition( Coordinate* lastKnownPosition ); bool autoCenter() const; void setAutoCenter( bool enabled ); bool autoZoom() const; void setAutoZoom( bool enabled ); PositionMarkerType positionMarkerType() const; void setPositionMarkerType( PositionMarkerType type ); double distance() const; public Q_SLOTS: void saveTrack( const QString &fileName ); void openTrack( const QString &fileName ); void clearTrack(); Q_SIGNALS: void mapChanged(); void showTrackChanged(); void positionSourceChanged(); void positionMarkerChanged(); void hasLastKnownPositionChanged(); void lastKnownPositionChanged(); void autoCenterChanged(); void autoZoomChanged(); void positionMarkerTypeChanged(); void distanceChanged(); private Q_SLOTS: void updatePositionMarker(); void updateLastKnownPosition(); void setHasLastKnownPosition(); private: void setShowPositionMarkerPlugin( bool visible ); bool m_showTrack; PositionSource* m_positionSource; QObject* m_positionMarker; - MarbleWidget* m_marbleWidget; + MarbleQuickItem* m_marbleQuickItem; bool m_hasLastKnownPosition; Coordinate m_lastKnownPosition; Marble::AutoNavigation* m_autoNavigation; PositionMarkerType m_positionMarkerType; }; +} + #endif