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

marble

  • sources
  • kde-4.12
  • kdeedu
  • marble
  • src
  • apps
  • marble-touch
  • activities
SpaceView.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 
9 import QtQuick 1.1
10 import com.nokia.meego 1.0
11 import org.kde.edu.marble 0.11
12 import ".."
13 
14 /*
15  * Page for the space view activity.
16  */
17 Page {
18  id: spaceViewActivityPage
19  anchors.fill: parent
20 
21  tools: ToolBarLayout {
22  MarbleToolIcon {
23  iconSource: main.icon( "actions/go-home", 48 );
24  onClicked: main.showNavigation()
25  }
26 
27  ButtonRow {
28  Button {
29  id: earthButton
30  text: "Earth"
31  onCheckedChanged: { if ( checked ) spaceViewActivityPage.setEarthSettings() }
32  }
33  Button {
34  text: "Moon"
35  onCheckedChanged: { if ( checked ) settings.mapTheme = "moon/clementine/clementine.dgml" }
36  }
37  Button {
38  text: "More"
39  onCheckedChanged: { if ( checked ) themeDialog.open() }
40 
41  MapThemeModel {
42  id: mapThemeModel
43  mapThemeFilter: MapThemeModel.Terrestrial
44  }
45 
46  SelectionDialog {
47  id: themeDialog
48  titleText: "Select Map Theme"
49  selectedIndex: mapThemeModel.indexOf(settings.mapTheme)
50  model: mapThemeModel
51  delegate:
52  Rectangle {
53  id: delegate
54  width: row.width
55  height: row.height
56 
57  color: index === themeDialog.selectedIndex ? "lightsteelblue" : "#00ffffff"
58 
59  Row {
60  id: row
61  Image {
62  id: mapImage
63  source: "image://maptheme/" + mapThemeId
64  smooth: true
65  width: 68
66  height: 68
67  }
68  Label {
69  id: themeLabel
70  text: display
71  color: index === themeDialog.selectedIndex ? "black" : "white"
72  anchors.verticalCenter: parent.verticalCenter
73  }
74  }
75 
76  MouseArea {
77  anchors.fill: parent
78  onClicked: {
79  themeDialog.selectedIndex = index
80  themeDialog.accept()
81  delayedMapThemeSwitch.theme = mapThemeId
82  delayedMapThemeSwitch.start()
83  }
84  }
85  }
86  }
87  }
88  }
89 
90  MarbleToolIcon {
91  id: menuIcon
92  iconSource: main.icon( "actions/show-menu", 48 );
93  visible: earthButton.checked
94  onClicked: {
95  if (main.components === "plasma") {
96  pageMenu.visualParent = menuIcon
97  }
98  pageMenu.open()
99  }
100  }
101  }
102 
103  Menu {
104  id: pageMenu
105  content: MarbleMenuLayout {
106  MenuItemSwitch {
107  id: satellitesSwitch
108  text: "Satellites"
109  checked: false
110  onCheckedChanged: spaceViewActivityPage.setEarthSettings()
111  }
112 
113  MenuItemSwitch {
114  id: cloudsSwitch
115  text: "Clouds"
116  checked: false
117  onCheckedChanged: spaceViewActivityPage.setEarthSettings()
118  }
119 
120  MenuItem {
121  id: dayNightMode
122  text: "Day/Night"
123  onClicked: dayNightInput.open()
124 
125  SelectionDialog {
126  id: dayNightInput
127  titleText: "Select sun light view"
128  selectedIndex: 0
129  model: ListModel {
130  ListElement { name: "Day" }
131  ListElement { name: "Night" }
132  ListElement { name: "Realistic" }
133  }
134 
135  onAccepted: spaceViewActivityPage.setEarthSettings()
136  }
137  }
138  }
139  }
140 
141  Item {
142  id: mapContainer
143  anchors.fill: parent
144 
145  function embedMarbleWidget() {
146  marbleWidget.parent = mapContainer
147  settings.projection = "Spherical"
148  settings.activeRenderPlugins = settings.defaultRenderPlugins
149  spaceViewActivityPage.setEarthSettings()
150  if (marbleWidget.radius > 655 ) {
151  marbleWidget.radius = 170
152  }
153  settings.gpsTracking = false
154  settings.showPositionIndicator = false
155  marbleWidget.tracking.positionMarkerType = Tracking.Circle
156  settings.showTrack = false
157  marbleWidget.visible = true
158  }
159 
160  Component.onDestruction: {
161  if ( marbleWidget.parent === mapContainer ) {
162  marbleWidget.parent = null
163  marbleWidget.visible = false
164  }
165  }
166  }
167 
168  Timer {
169  id: delayedMapThemeSwitch
170  property string theme: "earth/bluemarble/bluemarble.dgml"
171  interval: 10; running: false; repeat: false
172  onTriggered: settings.mapTheme = theme
173  }
174 
175  onStatusChanged: {
176  if ( status === PageStatus.Activating ) {
177  mapContainer.embedMarbleWidget()
178  }
179  }
180 
181  function setEarthSettings() {
182  if (dayNightInput === null || dayNightInput.selectedIndex === 0) {
183  settings.mapTheme = "earth/bluemarble/bluemarble.dgml"
184  marbleWidget.setGeoSceneProperty( "citylights", false )
185  marbleWidget.setGeoSceneProperty( "clouds_data", cloudsSwitch === null || cloudsSwitch.checked )
186  } else if (dayNightInput.selectedIndex === 1) {
187  settings.mapTheme = "earth/citylights/citylights.dgml"
188  marbleWidget.setGeoSceneProperty( "citylights", false )
189  marbleWidget.setGeoSceneProperty( "clouds_data", cloudsSwitch.checked )
190  } else {
191  settings.mapTheme = "earth/bluemarble/bluemarble.dgml"
192  marbleWidget.setGeoSceneProperty( "citylights", true )
193  marbleWidget.setGeoSceneProperty( "clouds_data", cloudsSwitch.checked )
194  }
195 
196  var plugins = settings.activeRenderPlugins
197  if ( satellitesSwitch.checked ) {
198  plugins.push( "satellites" )
199  } else {
200  settings.removeElementsFromArray( plugins, ["satellites"] )
201  }
202  settings.activeRenderPlugins = plugins
203  }
204 }
MarbleWindow::components
string components
Definition: harmattan/MarbleWindow.qml:19
Tracking
Definition: Tracking.qml:16
Button
Definition: cloud-sync/Button.qml:11
ListModel
Rectangle
MenuItem
MenuItemSwitch
Definition: harmattan/MenuItemSwitch.qml:49
Tracking::Circle
Definition: Tracking.h:48
Item
MarbleWindow::icon
void icon(name, size)
MapThemeModel
Definition: MapThemeModel.h:18
MarbleMenuLayout
Definition: harmattan/MarbleMenuLayout.qml:10
MarbleToolIcon
Definition: harmattan/MarbleToolIcon.qml:10
MarbleWindow::showNavigation
void showNavigation()
main
Definition: main.qml:12
MapThemeModel::Terrestrial
Definition: MapThemeModel.h:27
Page
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:52 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
  • kstars
  • libkdeedu
  •   keduvocdocument
  • 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