Newer
Older
/** This file is part of Nootka (http://nootka.sf.net) *
* Copyright (C) 2018-2021 by Tomasz Bojczuk (seelook@gmail.com) *
* on the terms of GNU GPLv3 license (http://www.gnu.org/licenses) */
import "../"
import Nootka 1.0
import Nootka.Charts 1.0
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Window 2.12
property alias exam: chartItem.exam
property alias allowOpen: chartItem.allowOpen
//* private
property var helpTip: null
property int upTextSize: Math.round(toolBar.height * 0.25)
property var chDrawer: null
function openExam() {
if (allowOpen)
chartItem.openExam();
}
function openDrawer() {
drawerAct.trigger();
}
visible: true
modality: Qt.WindowModal
title: chartItem.chartWindowTitle
width: nootkaWindow.width
height: nootkaWindow.height
x: nootkaWindow.x
y: nootkaWindow.y
color: activPal.base
onClosing: {
SOUND.startListen();
analyzeWindow.destroy();
}
Component.onCompleted: {
if (allowOpen) {
var h = Qt.createComponent("qrc:/charts/ChartHelpTip.qml");
helpTip = h.createObject(analyzeWindow.contentItem, {
"text": chartItem.chartHelpText()
});
SOUND.stop();
if (chartItem.keepDrawerOpened())
openDrawer();
}
ButtonGroup {
id: chartTypeGr
}
Column {
property TchartItem chartItem
chartItem: TchartItem {
id: chartItem
parent: chartView
anchors.fill: parent
onExamChanged: {
if (helpTip && exam)
helpTip.destroy();
if (tipItem)
tipItem.parent.destroy();
tipItem = Qt.createComponent("qrc:/charts/ChartTip" + (isMelody ? "Melody" : "") + ".qml").createObject(chartView.list).tipItem;
onResetChartPos: chartView.list.positionViewAtBeginning()
onLoadExamFailed: {
if (!helpTip)
helpTip = Qt.createComponent("qrc:/charts/ChartHelpTip.qml").createObject(analyzeWindow.contentItem);
helpTip.text = message;
helpTip.hintColor = GLOB.wrongColor;
}
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
}
ToolBar {
id: toolBar
z: 255
height: helpButt.height
width: analyzeWindow.width
Row {
ChartToolButton {
taction: Taction {
id: drawerAct
text: qsTr("Settings of a chart")
icon: "chartSett"
onTriggered: {
if (chDrawer) {
if (chDrawer.visible)
chDrawer.close();
else
chDrawer.open();
} else {
var d = Qt.createComponent("qrc:/charts/ChartDrawer.qml");
chDrawer = d.createObject(analyzeWindow);
}
}
}
}
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
ChartToolButton {
taction: Taction {
text: NOO.TR("QShortcut", "Zoom In")
icon: "zoom-in"
onTriggered: chartView.sc = Math.min(2, chartView.sc * 1.125)
shortcut: Shortcut {
sequences: [ StandardKey.ZoomIn ]
}
}
}
ChartToolButton {
taction: Taction {
text: NOO.TR("QShortcut", "Zoom Out")
icon: "zoom-out"
onTriggered: chartView.sc = Math.max(0.5, chartView.sc * 0.888889)
shortcut: Shortcut {
sequence: StandardKey.ZoomOut
}
}
}
ChartToolButton {
taction: Taction {
text: NOO.TR("QMdiSubWindow", "Maximize")
icon: "fullscreen"
onTriggered: visibility = visibility === 2 ? 4 : 2
}
}
ChartToolButton {
id: helpButt
taction: Taction {
text: NOO.TR("QShortcut", "Help")
icon: "help"
onTriggered: NOO.openDocLink("2017/05/17/analyze-results/")
}
}
Item {
height: 2
width: (analyzeWindow.width - (helpButt.x + helpButt.width) - exitButt.width - infoRow.width) / 2
}
Row {
id: infoRow
// visible: chartItem.questionCount > 0
Column {
visible: chartItem.isMelody // && chartItem.questionCount > 0
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Y value:")
color: activPal.text
verticalAlignment: Text.AlignVCenter
height: toolBar.height * 0.48
font {
pixelSize: upTextSize
}
}
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: chartItem.yValueActions[chartItem.yValue]
color: activPal.text
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
height: toolBar.height * 0.48
width: analyzeWindow.width / 7
fontSizeMode: Text.Fit
minimumPixelSize: NOO.factor() / 2
font {
pixelSize: upTextSize
bold: true
}
}
}
Item {
height: 2
width: analyzeWindow.width / 100
}
Column {
visible: !chartItem.isMelody //&& chartItem.questionCount > 0
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("ordered by:", "Keep a proper form - whole sentence will be: ordered by: question number, key signature, etc...")
color: activPal.text
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
height: toolBar.height * 0.48
width: analyzeWindow.width / 7
font {
pixelSize: upTextSize
}
}
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: chartItem.xOrderActions[chartItem.xOrder]
color: activPal.text
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
height: toolBar.height * 0.48
width: analyzeWindow.width / 7
fontSizeMode: Text.Fit
minimumPixelSize: NOO.factor() / 2
font {
pixelSize: upTextSize
bold: true
}
}
}
Item {
height: 2
width: analyzeWindow.width / 100
}
Column {
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("student name:")
color: activPal.text
verticalAlignment: Text.AlignVCenter
height: toolBar.height * 0.5
font {
pixelSize: upTextSize
}
}
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: chartItem.userName === "" ? "-----" : chartItem.userName
color: activPal.text
verticalAlignment: Text.AlignVCenter
height: toolBar.height * 0.5
font {
pixelSize: toolBar.height / 4
bold: true
}
}
}
Item {
height: 2
width: analyzeWindow.width / 100
}
Column {
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("level:")
color: activPal.text
verticalAlignment: Text.AlignVCenter
height: toolBar.height * 0.5
font {
pixelSize: upTextSize
}
}
Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
width: levelText.width + NOO.factor()
height: toolBar.height / 2
color: levelArea.containsMouse ? activPal.highlight : "transparent"
radius: height / 5
Text {
id: levelText
anchors.centerIn: parent
text: chartItem.levelName === "" ? "-----" : chartItem.levelName
color: activPal.text
font {
pixelSize: toolBar.height / 4
bold: true
}
}
MouseArea {
id: levelArea
hoverEnabled: chartItem.levelName !== ""
anchors.fill: parent
onClicked: {
var c = Qt.createComponent("qrc:/charts/LevelPopup.qml");
var lp = c.createObject(analyzeWindow.contentItem);
chartItem.fillPreview(lp.levelPreview);
}
}
}
}
Item {
height: 2
width: analyzeWindow.width / 100
}
Column {
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: chartItem.questionCount
color: activPal.text
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
height: toolBar.height * 0.5
font {
pixelSize: upTextSize
}
}
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: chartItem.effectiveness
color: activPal.text
horizontalAlignment: Text.AlignHCenter
font {
pixelSize: toolBar.height / 4
}
}
}
// Row (infoRow)
}
// Row
}
ChartToolButton {
id: exitButt
anchors.right: parent.right
taction: Taction {
text: NOO.TR("QPlatformTheme", "Close")
icon: "exit"
onTriggered: close()
}
}
background: TipRect {
anchors.fill: parent
color: activPal.window
radius: 0
}
}
width: analyzeWindow.width - (chDrawer && chDrawer.pinned && chDrawer.visible ? chDrawer.width : 0)
height: analyzeWindow.height - toolBar.height
transform: Translate {
x: chDrawer ? chDrawer.position * analyzeWindow.height * 0.4 : 0
}
}