• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • apps
  • marble-touch
  • activities
Tracking.qml
Go to the documentation of this file.
1 // This file is part of the Marble Virtual Globe.
2 //
3 // This program is free software licensed under the GNU LGPL. You can
4 // find a copy of this license in LICENSE.txt in the top directory of
5 // the source code.
6 //
7 // Copyright 2011 Dennis Nienhüser <earthwings@gentoo.org>
8 // Copyright 2011 Daniel Marth <danielmarth@gmx.at>
9 
10 import QtQuick 1.0
11 import com.nokia.meego 1.0
12 import org.kde.edu.marble 0.11
13 import QtMobility.systeminfo 1.1
14 import ".."
15 
16 /*
17  * Page for geocaching activity.
18  */
19 Page {
20  id: trackingActivityPage
21  anchors.fill: parent
22 
23  tools: ToolBarLayout {
24  MarbleToolIcon {
25  iconSource: main.icon( "actions/go-home", 48 );
26  onClicked: main.showNavigation()
27  }
28  MarbleToolIcon {
29  iconSource: main.icon( "places/user-identity", 48 );
30  onClicked: {
31  marbleWidget.centerOn( marbleWidget.tracking.lastKnownPosition.longitude, marbleWidget.tracking.lastKnownPosition.latitude )
32  if (marbleWidget.zoom < 22026 ) {
33  marbleWidget.zoom = 4197500
34  }
35  }
36  }
37  ToolButton {
38  id: searchButton
39  checkable: true
40  width: 60
41  flat: true
42  iconSource: main.icon( "actions/edit-find", 48 );
43  }
44  MarbleToolIcon {
45  id: menuIcon
46  iconSource: main.icon( "actions/show-menu", 48 );
47  onClicked: {
48  if (main.components === "plasma") {
49  pageMenu.visualParent = menuIcon
50  }
51  pageMenu.open()
52  }
53  }
54  }
55 
56  Menu {
57  id: pageMenu
58  content: MarbleMenuLayout {
59  MenuItem {
60  text: "Save Track"
61  onClicked: {
62  saveTrackDialog.filename = Qt.formatDateTime(new Date(), "yyyy-MM-dd_hh.mm.ss") + ".kml"
63  saveTrackDialog.open()
64  }
65  }
66  MenuItem {
67  text: "Open Track"
68  onClicked: openTrackDialog.open()
69  }
70  MenuItemSwitch {
71  text: "Auto Center"
72  checked: false
73  onCheckedChanged: {
74  marbleWidget.tracking.autoCenter = checked
75  }
76  }
77  MenuItemSwitch {
78  text: "Auto Zoom"
79  checked: false
80  onCheckedChanged: {
81  marbleWidget.tracking.autoZoom = checked
82  }
83  }
84  }
85  }
86 
87  SearchField {
88  id: searchField
89  anchors.left: parent.left
90  anchors.right: parent.right
91  anchors.top: parent.top
92  visible: searchButton.checked
93  width: parent.width
94  onSearch: {
95  searchField.busy = true
96  marbleWidget.find( term )
97  }
98 
99  Component.onCompleted: {
100  marbleWidget.search.searchFinished.connect( searchFinished )
101  }
102 
103  function searchFinished() {
104  searchField.busy = false
105  }
106  }
107 
108  Item {
109  id: mapContainer
110  anchors.left: parent.left
111  anchors.right: parent.right
112  anchors.top: searchButton.checked ? searchField.bottom : parent.top
113  anchors.bottom: parent.bottom
114  clip: true
115 
116  function embedMarbleWidget() {
117  marbleWidget.parent = mapContainer
118  settings.projection = "Mercator"
119  var plugins = settings.defaultRenderPlugins
120  settings.removeElementsFromArray(plugins, ["coordinate-grid", "sun", "stars", "compass"])
121  plugins.push( "speedometer" )
122  settings.activeRenderPlugins = plugins
123  settings.mapTheme = settings.streetMapTheme
124  settings.gpsTracking = true
125  settings.showPositionIndicator = true
126  marbleWidget.tracking.positionMarkerType = Tracking.Arrow
127  settings.showTrack = true
128  marbleWidget.visible = true
129  }
130 
131  Component.onDestruction: {
132  if ( marbleWidget.parent === mapContainer ) {
133  marbleWidget.parent = null
134  marbleWidget.visible = false
135  }
136  }
137  }
138 
139  FileSaveDialog {
140  id: saveTrackDialog
141  anchors.fill: parent
142  folder: "/home/user/MyDocs"
143  filename: ""
144  nameFilters: [ "*.kml" ]
145 
146  onAccepted: { marbleWidget.tracking.saveTrack( folder + "/" + filename ); }
147  }
148 
149  FileOpenDialog {
150  id: openTrackDialog
151  anchors.fill: parent
152  folder: "/home/user/MyDocs"
153  nameFilters: [ "*.kml", "*.gpx" ]
154 
155  onAccepted: { marbleWidget.tracking.openTrack( folder + "/" + filename ); }
156  }
157 
158  ScreenSaver {
159  id: saver
160  }
161 
162  onStatusChanged: {
163  if ( status === PageStatus.Activating ) {
164  mapContainer.embedMarbleWidget()
165  saver.screenSaverDelayed = settings.inhibitScreensaver
166  } else if ( status === PageStatus.Deactivating ) {
167  saver.screenSaverDelayed = false
168  }
169  }
170 }
MarbleWindow::components
string components
Definition: harmattan/MarbleWindow.qml:19
Tracking
Definition: Tracking.qml:16
FileOpenDialog
Definition: FileOpenDialog.qml:10
FileSaveDialog
Definition: FileSaveDialog.qml:10
SearchField
Definition: SearchField.qml:14
Tracking::Arrow
Definition: Tracking.h:49
MenuItem
MenuItemSwitch
Definition: harmattan/MenuItemSwitch.qml:49
MarbleWindow::icon
void icon(name, size)
MarbleMenuLayout
Definition: harmattan/MarbleMenuLayout.qml:10
MarbleToolIcon
Definition: harmattan/MarbleToolIcon.qml:10
MarbleWindow::showNavigation
void showNavigation()
main
Definition: examples/cpp/marbleQuick2/main.qml:3
SearchField::busy
bool busy
Definition: SearchField.qml:19
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:42 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal