24 import
"qrc:/gcompris/src/core/core.js" as Core
47 activityInfo: ActivityInfoTree.rootMenu
50 if(pageView.depth === 1) {
56 if(pageView.currentItem == menuActivity)
61 onDisplayDialog: pageView.push(dialog)
64 property string url:
"qrc:/gcompris/src/activities/menu/resource/"
65 property variant sections: [
67 icon: menuActivity.url +
"all.svg",
71 icon: menuActivity.url +
"computer.svg",
75 icon: menuActivity.url +
"discovery.svg",
79 icon: menuActivity.url +
"experience.svg",
83 icon: menuActivity.url +
"fun.svg",
87 icon: menuActivity.url +
"math.svg",
91 icon: menuActivity.url +
"puzzle.svg",
95 icon: menuActivity.url +
"reading.svg",
99 icon: menuActivity.url +
"strategy.svg",
103 property string currentTag: sections[0].tag
106 pageComponent: Image {
108 source: menuActivity.url +
"background.svg"
109 sourceSize.width: parent.width
110 fillMode: Image.PreserveAspectCrop
112 function loadActivity() {
113 pageView.push(activityLoader.item)
119 onStatusChanged:
if (status == Loader.Ready) loadActivity()
123 property bool horizontal:
main.width >
main.height
124 property int sectionIconWidth:
128 property int sectionIconHeight: sectionIconWidth
129 property int sectionCellWidth: sectionIconWidth * 1.1
130 property int sectionCellHeight: sectionIconHeight * 1.1
132 property var currentActiveGrid: activitiesGrid
133 property bool keyboardMode:
false
135 if (event.modifiers === Qt.ControlModifier &&
136 event.key === Qt.Key_S) {
139 }
else if(event.key === Qt.Key_Space) {
140 currentActiveGrid.currentItem.selectCurrentItem()
145 event.accepted =
false
147 Keys.onTabPressed: currentActiveGrid = ((currentActiveGrid == activitiesGrid) ?
148 section : activitiesGrid);
149 Keys.onEnterPressed: currentActiveGrid.currentItem.selectCurrentItem();
150 Keys.onReturnPressed: currentActiveGrid.currentItem.selectCurrentItem();
151 Keys.onRightPressed: currentActiveGrid.moveCurrentIndexRight();
152 Keys.onLeftPressed: currentActiveGrid.moveCurrentIndexLeft();
153 Keys.onDownPressed: currentActiveGrid.moveCurrentIndexDown();
154 Keys.onUpPressed: currentActiveGrid.moveCurrentIndexUp();
159 width: horizontal ?
main.width : sectionCellWidth
160 height: horizontal ? sectionCellHeight :
main.height - bar.height
163 cellWidth: sectionCellWidth
164 cellHeight: sectionCellHeight
166 keyNavigationWraps:
true
168 property int initialX: 4
169 property int initialY: 4
174 id: backgroundSection
175 width: sectionCellWidth
176 height: sectionCellHeight
179 source: modelData.icon
180 sourceSize.height: sectionIconHeight
182 anchors.horizontalCenter: parent.horizontalCenter
187 anchors.fill: backgroundSection
191 anchors.fill: backgroundSection
197 function selectCurrentItem() {
199 ActivityInfoTree.filterByTag(modelData.tag)
200 ActivityInfoTree.filterLockedActivities()
201 ActivityInfoTree.filterEnabledActivities()
202 menuActivity.currentTag = modelData.tag
203 section.currentIndex = index
207 delegate: sectionDelegate
209 width: sectionCellWidth
210 height: sectionCellHeight
217 source:
"qrc:/gcompris/src/core/resource/button.svg"
220 Behavior on x { SpringAnimation { spring: 2; damping: 0.2 } }
221 Behavior on y { SpringAnimation { spring: 2; damping: 0.2 } }
228 property int activityCellWidth:
229 horizontal ? background.width / Math.floor(background.width / iconWidth) :
230 (background.width - section.width) / Math.floor((background.width - section.width) / iconWidth)
231 property int activityCellHeight: iconHeight * 1.5
236 top: horizontal ? section.bottom : parent.top
237 bottom: parent.bottom
238 left: horizontal ? parent.left : section.right
242 active: (ActivityInfoTree.menuTree.length === 0) && (currentTag ===
"favorite")
243 sourceComponent: Item {
249 x: (parent.width - width) / 2
251 width: parent.width * 0.6
252 horizontalAlignment: Text.AlignHCenter
253 wrapMode: Text.WordWrap
254 font.weight: Font.DemiBold
256 text: qsTr(
"Put your favorite activities here by selecting the " +
257 "sun on each activity top right.")
260 anchors.fill: instructionTxt
266 border.color:
"black"
268 GradientStop { position: 0.0; color:
"#000" }
269 GradientStop { position: 0.9; color:
"#666" }
270 GradientStop { position: 1.0; color:
"#AAA" }
280 top: horizontal ? section.bottom : parent.top
282 left: horizontal ? parent.left : section.right
285 width: background.width
286 cellWidth: activityCellWidth
287 cellHeight: activityCellHeight
289 model: ActivityInfoTree.menuTree
290 keyNavigationWraps:
true
291 property int spacing: 10
295 width: activityCellWidth - activitiesGrid.spacing
296 height: activityCellHeight - activitiesGrid.spacing
298 id: activityBackground
299 width: activityCellWidth - activitiesGrid.spacing
300 height: activityCellHeight - activitiesGrid.spacing
301 anchors.horizontalCenter: parent.horizontalCenter
306 source:
"qrc:/gcompris/src/activities/" + icon;
307 anchors.top: activityBackground.top
308 anchors.horizontalCenter: parent.horizontalCenter
309 sourceSize.height: iconHeight
312 source:
"qrc:/gcompris/src/core/resource/difficulty" +
313 ActivityInfoTree.menuTree[index].difficulty +
".svg";
314 anchors.top: parent.top
315 sourceSize.width: iconWidth * 0.15
320 horizontalCenter: parent.horizontalCenter
326 menuActivity.url +
"lock.svg"
331 anchors.top: parent.bottom
332 anchors.horizontalCenter: parent.horizontalCenter
333 horizontalAlignment: Text.AlignHCenter
334 width: activityBackground.width
335 fontSizeMode: Text.Fit
337 fontSize: regularSize
338 elide: Text.ElideRight
340 wrapMode: Text.WordWrap
341 text: ActivityInfoTree.menuTree[index].title
346 visible: delegateItem.height - (title.y + title.height) > description.height ? 1 : 0
347 anchors.top: title.bottom
348 anchors.horizontalCenter: parent.horizontalCenter
349 horizontalAlignment: Text.AlignHCenter
350 width: activityBackground.width
351 fontSizeMode: Text.Fit
353 fontSize: regularSize
354 elide: Text.ElideRight
356 wrapMode: Text.WordWrap
357 text: ActivityInfoTree.menuTree[index].description
362 anchors.fill: activityBackground
365 anchors.fill: activityBackground
366 onClicked: selectCurrentItem()
369 source: menuActivity.url + (favorite ?
"all.svg" :
"all_disabled.svg");
375 sourceSize.width: iconWidth * 0.25
379 onClicked: favorite = !favorite
383 function selectCurrentItem() {
387 ActivityInfoTree.currentActivity = ActivityInfoTree.menuTree[index]
388 activityLoader.setSource(
"qrc:/gcompris/src/activities/" + ActivityInfoTree.menuTree[index].name,
390 'audioVoices': audioVoices,
391 'audioEffects': audioEffects,
392 'menu': menuActivity,
393 'activityInfo': ActivityInfoTree.currentActivity
395 if (activityLoader.status == Loader.Ready) loadActivity()
398 highlight: Rectangle {
399 width: activityCellWidth - activitiesGrid.spacing
400 height: activityCellHeight - activitiesGrid.spacing
403 border.color:
"black"
404 visible: background.keyboardMode
405 Behavior on x { SpringAnimation { spring: 2; damping: 0.2 } }
406 Behavior on y { SpringAnimation { spring: 2; damping: 0.2 } }
412 anchors.fill: activitiesGrid
414 GradientStop { position: 0.0; color:
"#FFFFFFFF" }
415 GradientStop { position: 0.92; color:
"#FFFFFFFF" }
416 GradientStop { position: 0.96; color:
"#00FFFFFF"}
420 layer.effect: OpacityMask {
421 id: activitiesOpacity
422 source: activitiesGrid
423 maskSource: activitiesMask
424 anchors.fill: activitiesGrid
433 displayDialog(dialogAbout)
437 displayDialog(dialogHelp)
441 dialogActivityConfig.active =
true
442 dialogActivityConfig.loader.item.loadFromConfig()
443 displayDialog(dialogActivityConfig)
455 activityInfo: ActivityInfoTree.rootMenu
459 id: dialogActivityConfig
460 currentActivity: menuActivity
470 dialogActivityConfig.configItem.save();
473 ActivityInfoTree.filterByTag(menuActivity.currentTag)
474 ActivityInfoTree.filterLockedActivities()
475 ActivityInfoTree.filterEnabledActivities()
GCompris' full screen about dialog.
QML container for defining all visible child elements of a Bar.
A QML component for a full screen configuration dialog.
A QML component unifying text presentation in GCompris.
A QML component for GCompris' navigation bar.
GCompris' full screen help dialog.
bool isDemoMode
Whether in demo mode.
bool sectionVisible
Whether the section selection row is visible in the menu view.
Singleton that contains GCompris' persistent settings.
GCompris' main QML file defining the top level window.
A QML loader that wraps ParticleSystemStar.
A general purpose singleton that exposes miscellaneous native functions to the QML layer...
void burst(val)
Emits count particles from the particle emitter immediately.
qreal ratio
Ratio factor used for scaling of sizes on high-dpi devices.