Warning, /education/gcompris/src/activities/calendar/ChoiceTable.qml is written in an unsupported language. File is not indexed.

0001 /* GCompris - ChoiceTable.qml
0002  *
0003  * SPDX-FileCopyrightText: 2017 Amit Sagtani <asagtani06@gmail.com>
0004  *
0005  * Authors:
0006  *   Amit Sagtani <asagtani06@gmail.com>
0007  *
0008  *   SPDX-License-Identifier: GPL-3.0-or-later
0009  */
0010 
0011 // Creates a active button for making a table of days of weeks.
0012 // Set different behaviours and animations on selecting a day from day table here.
0013 
0014 import QtQuick 2.12
0015 import GCompris 1.0
0016 import "../../core"
0017 import "calendar.js" as Activity
0018 
0019 Rectangle {
0020     id: choiceBox
0021     property alias choices: choices
0022     color: "#AAFFFFFF"
0023     radius: 10
0024     anchors.margins: 30
0025     border.color: "#373737"
0026     border.width: 2
0027 
0028     function select() {
0029         if(Activity.dayOfWeekSelected === Activity.correctAnswer["dayOfWeek"]) {
0030             particles.burst(40);
0031             animWin.start();
0032         }
0033         Activity.checkAnswer();
0034     }
0035 
0036     ParticleSystemStarLoader {
0037         id: particles
0038         clip: false
0039     }
0040 
0041     GCText {
0042         id: choices
0043         anchors.fill: parent
0044         anchors.leftMargin: choiceBox.border.width
0045         anchors.rightMargin: choiceBox.border.width
0046         fontSizeMode: Text.Fit
0047         font.bold: true
0048         color: "#373737"
0049         horizontalAlignment: Text.AlignHCenter
0050         verticalAlignment: Text.AlignVCenter
0051     }
0052 
0053     MouseArea {
0054         id: mouseArea
0055         anchors.fill: parent
0056         onClicked: {
0057                 Activity.dayOfWeekSelected = dayIndex
0058                 select()
0059                 choiceBox.scale = 1
0060         }
0061         hoverEnabled: true
0062         enabled: !items.buttonsBlocked
0063         onEntered: choiceBox.scale = 1.1
0064         onExited: choiceBox.scale = 1
0065     }
0066 
0067     SequentialAnimation {
0068         id: animWin
0069         running: false
0070         loops: 1
0071         NumberAnimation {
0072             target: choiceBox
0073             property: "rotation"
0074             from: 0; to: 360
0075             duration: 600
0076             easing.type: Easing.InOutQuad
0077         }
0078     }
0079 }