• 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
ActivitySelectionView.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 
14 /*
15  * Page to select activity. This component also contains the model for
16  * the activities, which stores all relevant information.
17  */
18 Item {
19  id: activityPage
20 
21  property alias model: activityView.model
22  property bool shown: false
23 
24  signal itemSelected
25 
26  Loader {
27  id: lazyLoader
28  }
29 
30  Image {
31  anchors.bottom: parent.bottom
32  anchors.right: parent.right
33  anchors.margins: 20
34  source: "qrc:/marble/globe.svg"
35  smooth: true
36  width: 360
37  height: 360
38  opacity: 0.1
39  }
40 
41  // Grid view to display images and names of activities.
42  ListView {
43  id: activityView
44  currentIndex: -1
45  //anchors.top: parent.top
46  //anchors.topMargin: 4
47  //anchors.left: parent.left
48  //anchors.right: parent.right
49  //anchors.bottom: changelog.visible ? changelog.top : parent.bottom
50  //anchors.margins: 9
51  //anchors.leftMargin: 2
52  model: activityModel
53  focus: true
54  clip: true
55  spacing: 3
56  width: parent.width
57  height: parent.height
58 
59  delegate:
60  Item {
61 
62  id: delegateItem
63  property bool mouseOver: mouseTracker.containsMouse
64 
65  width: activityView.width
66  height: 47
67 
68  Rectangle {
69  color: delegateItem.mouseOver ? "#dddddd" : "white"
70  radius: 10
71  anchors.fill: parent
72 
73  Row {
74  anchors.verticalCenter: parent.verticalCenter
75  spacing: 5
76  width: 140
77  height: parent.height
78  smooth: true
79 
80  Item {
81  width: 2
82  height: parent.height
83  }
84 
85  Image {
86  id: activityImage
87  anchors.verticalCenter: parent.verticalCenter
88  height: 36
89  width: height
90  source: imagePath
91  smooth: true
92  }
93 
94  Label {
95  anchors.verticalCenter: parent.verticalCenter
96  color: delegateItem.mouseOver ? "#111111" : "black"
97  text: name
98  width: 180
99  font.bold: true
100  }
101  }
102 
103  MouseArea {
104  id: mouseTracker
105  anchors.fill: parent
106  hoverEnabled: true
107  }
108  }
109 
110  MouseArea {
111  anchors.fill: parent
112  onClicked: {
113  activityPage.itemSelected()
114  activityPage.openActivity( name, path )
115  }
116  }
117  }
118  }
119 
120  ScrollDecorator {
121  flickableItem: activityView
122  }
123 
124  Label {
125  id: changelog
126  anchors.bottom: parent.bottom
127  anchors.left: parent.left
128  anchors.right: parent.right
129  anchors.margins: 10
130  font.pixelSize: 16
131  visible: settings.changelogShown !== project.version
132  color: "white"
133  text: "New in version " + project.changelog.get(0).version + ": " + project.changelog.get(0).summary
134  MarbleTouch { id: project }
135  MouseArea {
136  anchors.fill: parent
137  onClicked: pageStack.push( "qrc:/AboutMarblePage.qml" )
138  }
139  }
140 
141  // Model that stores information about activities.
142  ListModel {
143  id: activityModel
144  property string configureIcon: main.icon( "actions/configure", 48 );
145 
146  ListElement {
147  name: "Virtual Globe"
148  imagePath: "qrc:/icons/activity-virtualglobe.png"
149  path: "qrc:/activities/VirtualGlobe.qml"
150  }
151 
152  ListElement {
153  name: "Search"
154  imagePath: "qrc:/icons/activity-search.png"
155  path: "qrc:/activities/Search.qml"
156  }
157  ListElement {
158  name: "Routing"
159  imagePath: "qrc:/icons/activity-routing.png"
160  path: "qrc:/activities/Routing.qml"
161  }
162  ListElement {
163  name: "Tracking"
164  imagePath: "qrc:/icons/activity-tracking.png"
165  path: "qrc:/activities/Tracking.qml"
166  }
167  ListElement {
168  name: "Navigation"
169  imagePath: "qrc:/icons/activity-navigation.png"
170  path: "qrc:/activities/Navigation.qml"
171  }
172  ListElement {
173  name: "Weather"
174  imagePath: "qrc:/icons/activity-weather.png"
175  path: "qrc:/activities/Weather.qml"
176  }
177  ListElement {
178  name: "Community"
179  imagePath: "qrc:/icons/activity-friends.png"
180  path: "qrc:/activities/Friends.qml"
181  }
182  ListElement {
183  name: "Space View"
184  imagePath: "qrc:/icons/activity-spaceview.png"
185  path: "qrc:/activities/SpaceView.qml"
186  }
187  ListElement {
188  name: "Explore"
189  imagePath: "qrc:/icons/activity-explore.png"
190  path: "qrc:/activities/Explore.qml"
191  }
192  ListElement {
193  name: "Info"
194  imagePath: "qrc:/icons/information.png"
195  path: "qrc:/AboutMarblePage.qml"
196  }
197  ListElement {
198  name: "Preferences"
199  imagePath: "qrc:/icons/preferences.png"
200  path: "qrc:/PreferencesPage.qml"
201  }
202  }
203 
204  function openActivity( name ) {
205  for ( var i=0; i<activityModel.count; i++ ) {
206  if ( activityModel.get(i).name === name ) {
207  switchTo( name, activityModel.get(i).path )
208  return
209  }
210  }
211  }
212 
213  function switchTo( name, path ) {
214  if ( marbleWidget === null ) {
215  lazyLoader.source = "qrc:/MainWidget.qml";
216  marbleWidget = lazyLoader.item
217  }
218 
219  settings.lastActivity = name
220  pageStack.replace( path, undefined, true )
221  activityPage.shown = false
222  }
223 
224  Timer {
225  id: loadTimer
226  interval: 50; running: false; repeat: false
227  onTriggered: activityPage.initialize()
228  }
229 
230  function initializeDelayed() {
231  if ( marbleWidget === null ) {
232  loadTimer.running = true
233  }
234  }
235 
236  function initialize() {
237  if ( marbleWidget === null ) {
238  lazyLoader.source = "qrc:/MainWidget.qml";
239  marbleWidget = lazyLoader.item
240  }
241  }
242 }
Rectangle
Marble::radius
static qreal radius(qreal zoom)
Definition: thumbnailer.cpp:99
MarbleWindow::icon
void icon(name, size)
main
Definition: examples/cpp/marbleQuick2/main.qml:3
MarbleTouch
Definition: MarbleTouch.qml:9
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:38 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