1
/* GCompris - CategoryReview.qml
3
* Copyright (C) 2016 Divyam Madaan <divyam3897@gmail.com>
6
* Divyam Madaan <divyam3897@gmail.com>
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.
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.
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/>.
25
import "categorization.js" as Activity
29
property alias score: score
30
property alias categoryDataset: categoryDataset
31
property alias instructionBox: instructionBox
32
property alias categoryImage: categoryImage
33
property bool isDropped: true
34
property bool leftAreaContainsDrag: false
35
property bool rightAreaContainsDrag: false
36
property bool started: rootItem.opacity == 1
37
property bool horizontalLayout: categoryBackground.width >= categoryBackground.height
38
property alias leftZone: leftZone.model
39
property alias rightZone: rightZone.model
40
property alias middleZone: middleZone.model
41
property alias leftScreen: leftScreen
42
property alias middleScreen: middleScreen
43
property alias rightScreen: rightScreen
52
id: categoryBackground
53
source: "qrc:/gcompris/src/activities/categorization/resource/background.svg"
55
sourceSize.width:parent.width
59
x: 0.012 * middleScreen.width
61
y: 0.05 * parent.height
70
color: leftAreaContainsDrag ? "#F9F8B4" : "#F9B4B4"
72
border.color: "#EC1313"
79
x: leftScreen.width + middleScreen.width + spacing
81
anchors.top: categoryBackground.top
82
anchors.topMargin: items.mode != "expert" ? rootItem.categoryImage.height + 0.027 * rightScreen.height : 0.05 * categoryBackground.height
89
x: leftScreen.width + middleScreen.width
90
color: rightAreaContainsDrag ? "#F9F8B4" : "#B4F9C5"
92
border.color: "#13EC52"
106
anchors.left: categoryBackground.left
107
anchors.right: categoryImage.left
108
anchors.leftMargin: 0.32 * parent.width
109
anchors.rightMargin: 0.03 * parent.width
111
opacity: items.instructionsVisible ? 0.85 : 0
115
width: horizontalLayout ? parent.width/5 : parent.width/3
116
height: horizontalLayout ? parent.height/6 : parent.height * 0.09
118
GradientStop { position: 0.0; color: "#000" }
119
GradientStop { position: 0.9; color: "#666" }
120
GradientStop { position: 1.0; color: "#AAA" }
126
spacing: 0.012 * middleScreen.width
128
left: leftScreen.right
129
right: rightScreen.left
131
topMargin: 0.05 * parent.height
132
bottom: categoryBackground.bottom
133
leftMargin: 0.015 * middleScreen.width
139
text: items.mode !== "expert" && items.details && items.details[bar.level-1] && items.details[bar.level - 1].instructions ? items.details[bar.level - 1].instructions : qsTr("Place the majority category images to the right and other images to the left")
140
visible: items.instructionsVisible
141
anchors.fill: instructionBox
142
anchors.bottom: instructionBox.bottom
143
fontSizeMode: Text.Fit
147
verticalAlignment: Text.AlignVCenter
148
horizontalAlignment: Text.AlignHCenter
153
fillMode: Image.PreserveAspectFit
154
source: items.details && items.details[bar.level-1] && items.details[bar.level-1].image ? items.details[bar.level-1].image : ""
155
sourceSize.width: horizontalLayout ? rightZone.width * 0.35 : rightZone.width * 0.35
156
width: sourceSize.width
157
height: sourceSize.width
158
y: 0.015*parent.height
159
visible: items.categoryImageChecked
161
left: middleScreen.right
162
leftMargin: 0.15 * rightZone.width
168
source: "qrc:/gcompris/src/core/resource/bar_ok.svg"
169
width: horizontalLayout ? rightZone.width * 0.20 : rightZone.width * 0.35
171
sourceSize.width: width
172
sourceSize.height: height
176
rightMargin: 14 * ApplicationInfo.ratio
183
Activity.allPlaced();
190
anchors.fill: rightZone
195
anchors.fill: leftZone
205
visible: items.scoreChecked
206
width: rightZone.width * 0.4
208
margins: 10 * ApplicationInfo.ratio
218
Keys.onEscapePressed: { Activity.launchMenuScreen(); }
221
if (event.key === Qt.Key_Back) {
222
event.accepted = true
223
Activity.launchMenuScreen()
228
if(items.mode == "expert")
229
items.menuScreen.iAmReady.visible = true
231
rootItem.visible = false
236
rootItem.visible = true