• Skip to content
  • Skip to link menu
KDE API Documentation - ActivityBase.qml Source File (GCompris-qt)
  • KDE Home
  • Contact Us
 

GCompris-qt

  • src
  • core
ActivityBase.qml
1 /* GCompris - ActivityBase.qml
2  *
3  * Copyright (C) 2014 Bruno Coudoin <bruno.coudoin@gcompris.net>
4  *
5  * Authors:
6  * Bruno Coudoin <bruno.coudoin@gcompris.net>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, see <http://www.gnu.org/licenses/>.
20  */
21 import QtQuick 2.2
22 import GCompris 1.0
23 import "qrc:/gcompris/src/core/core.js" as Core
24 
54 Item {
55  id: page
56 
61  property Item main: parent;
62 
75  property Component pageComponent
76 
83  property QtObject menu
84 
91  property QtObject activityInfo
92 
105  property GCAudio audioVoices
106 
114  property GCAudio audioEffects
115 
119  signal home
120 
126  signal start
127 
133  signal stop
134 
143  signal displayDialog(Item dialog)
144 
145  onHome: menu ? menu.home() : ""
146  onDisplayDialog: menu ? menu.displayDialog(dialog) : ""
147 
148  Keys.forwardTo: activity.children
149  Keys.onEscapePressed: home()
150  Keys.onPressed: {
151  if (event.modifiers === Qt.ControlModifier &&
152  event.key === Qt.Key_Q) {
153  // Ctrl+Q exit the application
154  Core.quit(main);
155  } else if (event.modifiers === Qt.ControlModifier &&
156  event.key === Qt.Key_B) {
157  // Ctrl+B toggle the bar
158  ApplicationSettings.isBarHidden = !ApplicationSettings.isBarHidden;
159  } else if (event.modifiers === Qt.ControlModifier &&
160  event.key === Qt.Key_F) {
161  // Ctrl+F toggle fullscreen
162  ApplicationSettings.isFullscreen = !ApplicationSettings.isFullscreen
163  } else if (event.modifiers === Qt.ControlModifier &&
164  event.key === Qt.Key_M) {
165  // Ctrl+M toggle sound
166  // We mute / unmute both channels in sync
167  ApplicationSettings.isAudioVoicesEnabled = !ApplicationSettings.isAudioVoicesEnabled
168  ApplicationSettings.isAudioEffectsEnabled = ApplicationSettings.isAudioVoicesEnabled
169  } else if (event.modifiers === Qt.ControlModifier &&
170  event.key === Qt.Key_W) {
171  // Ctrl+W exit the current activity
172  home()
173  } else if (event.modifiers === Qt.ControlModifier &&
174  event.key === Qt.Key_P) {
175  // Ctrl+P Screenshot
176  ApplicationInfo.screenshot("/tmp/" + activityInfo.name.split('/')[0] + ".png")
177  }
178  }
179  Keys.onReleased: {
180  if (event.key === Qt.Key_Back) {
181  event.accepted = true
182  home()
183  }
184  }
185 
186  Loader {
187  id: activity
188  sourceComponent: pageComponent
189  anchors.fill: parent
190  }
191 
192  Loader {
193  id: demoPageLoader
194  source: "BuyMeOverlay.qml"
195  anchors.fill: parent
196  active: !activityInfo.demo && ApplicationSettings.isDemoMode
197  }
198 }
QtQuick
GCAudio
A QML component for audio playback.
Definition: GCAudio.qml:44
ApplicationSettings::isFullscreen
bool isFullscreen
Whether GCompris should run in fullscreen mode.
Definition: ApplicationSettings.h:88
ApplicationSettings::isDemoMode
bool isDemoMode
Whether in demo mode.
Definition: ApplicationSettings.h:144
GCompris
ApplicationInfo::screenshot
Q_INVOKABLE void screenshot(const QString &file)
Stores a screenshot in the passed file.
Definition: ApplicationInfo.cpp:180
ApplicationSettings::isAudioEffectsEnabled
bool isAudioEffectsEnabled
Whether audio effects should be enabled.
Definition: ApplicationSettings.h:83
ApplicationSettings
Singleton that contains GCompris' persistent settings.
Definition: ApplicationSettings.h:63
main
GCompris' main QML file defining the top level window.
Definition: main.qml:41
ApplicationInfo
A general purpose singleton that exposes miscellaneous native functions to the QML layer...
Definition: ApplicationInfo.h:43
ApplicationSettings::isAudioVoicesEnabled
bool isAudioVoicesEnabled
Whether audio voices/speech should be enabled.
Definition: ApplicationSettings.h:78
This file is part of the KDE documentation.
Documentation copyright © 1996-2015 The KDE developers.
Generated on Tue Jun 2 2015 21:47:47 by doxygen 1.8.9.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

GCompris-qt

Skip menu "GCompris-qt"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • File List
  • Modules

Class Picker

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