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

GCompris-qt

  • src
  • core
DialogActivityConfig.qml
1 /* GCompris - DialogActivityConfig.qml
2  *
3  * Copyright (C) 2014 Johnny Jazeix <jazeix@gmail.com>
4  *
5  * Authors:
6  * Johnny Jazeix <jazeix@gmail.com>
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 
44 Rectangle {
45  id: dialogActivityContent
46 
47  /* Public interface: */
48 
53  property alias configItem: loader.item
54 
60  property Component content
61 
68  property string activityName: ""
69 
77  property var dataToSave
78 
80 
81  property bool isDialog: true
82 
89  readonly property string title: {
90  if(activityName != "")
91  qsTr("%1 configuration").arg(activityInfo.title)
92  else
93  qsTr("Configuration")
94  }
95  property alias active: loader.active
96  property alias loader: loader
97  property QtObject activityInfo: ActivityInfoTree.currentActivity
98 
99  property ActivityBase currentActivity
100 
102 
106  signal close
107 
111  signal start
112 
120  signal saveData
121 
125  signal loadData
126 
127  signal stop
128 
129 
130  color: "#696da3"
131  border.color: "black"
132  border.width: 1
133  z: 1000
134 
135  function getInitialConfiguration() {
136  if(activityName == "") {
137  activityName = ActivityInfoTree.currentActivity.name.split('/')[0];
138  }
139  dataToSave = ApplicationSettings.loadActivityConfiguration(activityName)
140  loadData()
141  }
142 
143  Row {
144  visible: dialogActivityContent.active
145  spacing: 2
146  Item { width: 10; height: 1 }
147 
148  Column {
149  spacing: 10
150  anchors.top: parent.top
151  Item { width: 1; height: 10 }
152  Rectangle {
153  color: "#e6e6e6"
154  radius: 6.0
155  width: dialogActivityContent.width - 30
156  height: title.height * 1.2
157  border.color: "black"
158  border.width: 2
159 
160  Image {
161  id: titleIcon
162  anchors {
163  left: parent.left
164  top: parent.top
165  margins: 4 * ApplicationInfo.ratio
166  }
167  }
168 
169  GCText {
170  id: title
171  text: dialogActivityContent.title
172  width: dialogActivityContent.width - 30
173  horizontalAlignment: Text.AlignHCenter
174  verticalAlignment: Text.AlignVCenter
175  color: "black"
176  fontSize: 20
177  font.weight: Font.DemiBold
178  wrapMode: Text.WordWrap
179  }
180  }
181  Rectangle {
182  color: "#e6e6e6"
183  radius: 6.0
184  width: dialogActivityContent.width - 30
185  height: dialogActivityContent.height - 100
186  border.color: "black"
187  border.width: 2
188  anchors.margins: 100
189 
190  Flickable {
191  id: flick
192  anchors.margins: 8
193  anchors.fill: parent
194  flickableDirection: Flickable.VerticalFlick
195  clip: true
196  contentHeight: contentItem.childrenRect.height + 40 * ApplicationInfo.ratio
197  Loader {
198  id: loader
199  active: false
200  sourceComponent: dialogActivityContent.content
201  property alias rootItem: dialogActivityContent
202  }
203  }
204  }
205  Item { width: 1; height: 10 }
206  }
207  }
208 
209  // The cancel button
210  GCButtonCancel {
211  onClose: {
212  saveData()
213  ApplicationSettings.saveActivityConfiguration(activityName, dataToSave)
214  parent.close()
215  }
216  }
217 
218 }
ActivityBase
The base QML component for activities in GCompris.
Definition: ActivityBase.qml:52
GCButtonCancel
A QML component representing GCompris' cancel button.
Definition: GCButtonCancel.qml:30
ApplicationSettings::loadActivityConfiguration
Q_INVOKABLE QVariantMap loadActivityConfiguration(const QString &activity)
Loads per-activity configuration data for activity.
Definition: ApplicationSettings.cpp:320
GCText
A QML component unifying text presentation in GCompris.
Definition: GCText.qml:47
QtQuick
GCompris
ApplicationSettings
Singleton that contains GCompris' persistent settings.
Definition: ApplicationSettings.h:63
ApplicationInfo
A general purpose singleton that exposes miscellaneous native functions to the QML layer...
Definition: ApplicationInfo.h:43
ApplicationInfo::ratio
qreal ratio
Ratio factor used for scaling of sizes on high-dpi devices.
Definition: ApplicationInfo.h:91
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