Changeset View
Changeset View
Standalone View
Standalone View
src/activities/calendar/resource/TutorialBase.qml
- This file was added.
1 | /* GCompris - TutorialBase.qml | ||||
---|---|---|---|---|---|
2 | * | ||||
3 | * Copyright (C) 2019 Akshay Kumar <email.akshay98@gmail.com> | ||||
4 | * | ||||
5 | * Authors: | ||||
6 | * Akshay Kumar <email.akshay98@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 <https://www.gnu.org/licenses/>. | ||||
20 | */ | ||||
21 | import QtQuick 2.6 | ||||
22 | import "../../../core" | ||||
23 | | ||||
24 | Rectangle { | ||||
25 | id: tutorialRectangle | ||||
26 | anchors.fill: parent | ||||
27 | color: "#80FFFFFF" | ||||
28 | property alias firstNumber: firstNumber.textLabel | ||||
29 | property alias secondNumber: secondNumber.textLabel | ||||
30 | property alias questionText: question.text | ||||
31 | property int answer | ||||
32 | | ||||
33 | GCText { | ||||
34 | id: question | ||||
35 | fontSizeMode: Text.Fit | ||||
36 | fontSize: mediumSize | ||||
37 | anchors.left: tutorialRectangle.left | ||||
38 | anchors.leftMargin: parent.height * 0.01 | ||||
39 | color: "black" | ||||
40 | horizontalAlignment: Text.AlignLeft | ||||
41 | width: parent.width | ||||
42 | height: parent.height | ||||
43 | wrapMode: Text.WordWrap | ||||
44 | z: 2 | ||||
45 | } | ||||
46 | | ||||
47 | AnswerButton { | ||||
48 | id: firstNumber | ||||
49 | visible: answer | ||||
50 | textLabel: "" | ||||
51 | anchors { | ||||
52 | top: parent.top | ||||
53 | topMargin: parent.height * 0.3 | ||||
54 | left: parent.left | ||||
55 | leftMargin: parent.width * 0.2 | ||||
56 | } | ||||
57 | width: parent.width * 0.2 | ||||
58 | height: parent.height * 0.4 | ||||
59 | isCorrectAnswer: Number(textLabel) === tutorialRectangle.answer | ||||
60 | onPressed: { | ||||
61 | if(isCorrectAnswer) { | ||||
62 | message.text = qsTr("Great") | ||||
63 | message.visible = true | ||||
64 | messageRectangle.visible = true | ||||
65 | } | ||||
66 | } | ||||
67 | } | ||||
68 | | ||||
69 | AnswerButton { | ||||
70 | id: secondNumber | ||||
71 | textLabel: "" | ||||
72 | visible: answer | ||||
73 | anchors { | ||||
74 | top: parent.top | ||||
75 | topMargin: parent.height * 0.3 | ||||
76 | left: parent.left | ||||
77 | leftMargin: parent.width * 0.65 | ||||
78 | } | ||||
79 | width: parent.width * 0.2 | ||||
80 | height: parent.height * 0.4 | ||||
81 | isCorrectAnswer: Number(textLabel) === tutorialRectangle.answer | ||||
82 | onPressed: { | ||||
83 | if(isCorrectAnswer) { | ||||
84 | message.text = qsTr("Great") | ||||
85 | message.visible = true | ||||
86 | messageRectangle.visible = true | ||||
87 | } | ||||
88 | } | ||||
89 | | ||||
90 | } | ||||
91 | | ||||
92 | Rectangle { | ||||
93 | id: messageRectangle | ||||
94 | anchors { | ||||
95 | horizontalCenter: parent.horizontalCenter | ||||
96 | top: parent.top | ||||
97 | topMargin: parent.height * 0.75 | ||||
98 | } | ||||
99 | opacity: 0.8 | ||||
100 | radius: 10 | ||||
101 | border.width: 6 | ||||
102 | color: "white" | ||||
103 | border.color: "#87A6DD" | ||||
104 | width: parent.width * 1.15 | ||||
105 | height: parent.height * 0.4 | ||||
106 | visible: false | ||||
107 | | ||||
108 | GCText { | ||||
109 | id: message | ||||
110 | anchors { | ||||
111 | centerIn: parent | ||||
112 | margins: parent.border.width+1 | ||||
113 | } | ||||
114 | text: "" | ||||
115 | fontSizeMode: Text.Fit | ||||
116 | fontSize: smallSize | ||||
117 | color: "black" | ||||
118 | horizontalAlignment: Text.AlignHCenter | ||||
119 | verticalAlignment: Text.AlignVCenter | ||||
120 | width: parent.width | ||||
121 | height: parent.height | ||||
122 | wrapMode: Text.WordWrap | ||||
123 | z: 2 | ||||
124 | } | ||||
125 | } | ||||
126 | } |