Warning, /education/gcompris/src/activities/hexagon/Hexagon.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - Hexagon.qml
0002 *
0003 * SPDX-FileCopyrightText: 2014 Bruno Coudoin <bruno.coudoin@gcompris.net>
0004 *
0005 * Authors:
0006 * Christof Petig and Ingo Konrad (GTK+ version)
0007 * Bruno Coudoin <bruno.coudoin@gcompris.net> (Qt Quick port)
0008 *
0009 * SPDX-License-Identifier: GPL-3.0-or-later
0010 */
0011
0012 import QtQuick 2.12
0013 import GCompris 1.0
0014
0015 import "../../core"
0016 import "hexagon.js" as Activity
0017
0018 ActivityBase {
0019 id: activity
0020
0021 onStart: focus = true
0022
0023 pageComponent: Image {
0024 id: background
0025 source: "qrc:/gcompris/src/activities/menu/resource/background.svg"
0026 sourceSize.width: width
0027 sourceSize.height: height
0028 fillMode: Image.PreserveAspectCrop
0029 signal start
0030 signal stop
0031 focus: true
0032
0033 Component.onCompleted: {
0034 activity.start.connect(start)
0035 activity.stop.connect(stop)
0036 }
0037 QtObject {
0038 id: items
0039 property alias background: background
0040 property int currentLevel: activity.currentLevel
0041 property alias bonus: bonus
0042 property alias hexagonModel: hexagonModel
0043 }
0044
0045 onStart: Activity.start(main, items)
0046 onStop: Activity.stop()
0047
0048 function checkTouchPoint(touchPoints) {
0049 for(var i in touchPoints) {
0050 var touch = touchPoints[i]
0051 var block = rootItem.childAt(touch.x, touch.y)
0052 if(block)
0053 block.touched()
0054 }
0055 }
0056
0057 MultiPointTouchArea {
0058 anchors.fill: parent
0059 onPressed: checkTouchPoint(touchPoints)
0060 }
0061
0062 Item {
0063 id: rootItem
0064 anchors.fill: parent
0065 }
0066
0067 ListModel {
0068 id: hexagonModel
0069 }
0070
0071 Repeater {
0072 model: hexagonModel
0073 parent: rootItem
0074
0075 HexagonItem {
0076 audioEffects: activity.audioEffects
0077 ix: m_ix
0078 iy: m_iy
0079 nbx: m_nbx
0080 nby: m_nby
0081 hasStrawberry: m_hasStrawberry
0082 color: "#0099FF"
0083 }
0084 }
0085
0086 DialogHelp {
0087 id: dialogHelpLeftRight
0088 onClose: home()
0089 }
0090
0091 Bar {
0092 id: bar
0093 level: items.currentLevel + 1
0094 content: BarEnumContent { value: help | home | level }
0095 onHelpClicked: {
0096 displayDialog(dialogHelpLeftRight)
0097 }
0098 onPreviousLevelClicked: Activity.previousLevel()
0099 onNextLevelClicked: Activity.nextLevel()
0100 onHomeClicked: home()
0101 }
0102
0103 Bonus {
0104 id: bonus
0105 interval: 2000
0106 Component.onCompleted: win.connect(Activity.nextLevel)
0107 }
0108 }
0109
0110 }