2018-11-22 12:39:09 +01:00
|
|
|
import QtQuick 2.9
|
|
|
|
import QtQuick.Controls 2.4
|
|
|
|
import "./"
|
|
|
|
|
|
|
|
Page {
|
2018-11-23 17:14:09 +01:00
|
|
|
id: root
|
2018-11-22 12:39:09 +01:00
|
|
|
|
2018-11-24 13:50:06 +01:00
|
|
|
signal pageOpened()
|
|
|
|
|
2018-11-23 17:14:09 +01:00
|
|
|
Label {
|
2018-12-15 19:44:11 +01:00
|
|
|
id: date
|
2018-11-23 17:14:09 +01:00
|
|
|
anchors.centerIn: parent
|
2018-12-15 19:44:11 +01:00
|
|
|
font.pixelSize: parent.height * 0.2
|
|
|
|
text: calender.nextDate
|
|
|
|
visible: calender.runningPageState ? true:false
|
2018-11-22 12:39:09 +01:00
|
|
|
}
|
|
|
|
|
2018-11-27 17:15:34 +01:00
|
|
|
Label {
|
|
|
|
id: gameProcess
|
2018-12-15 19:44:11 +01:00
|
|
|
text: calender.actualDateCount + " of " + calender.dateCount
|
2018-11-27 19:32:17 +01:00
|
|
|
font.pixelSize: parent.width * 0.05
|
2018-11-27 17:15:34 +01:00
|
|
|
anchors {
|
|
|
|
right: parent.right
|
|
|
|
rightMargin: parent.width * 0.025
|
|
|
|
bottom: parent.bottom
|
|
|
|
bottomMargin: parent.height * 0.05
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-22 12:39:09 +01:00
|
|
|
|
2018-11-23 17:14:09 +01:00
|
|
|
ProgressBar {
|
|
|
|
id: prog
|
|
|
|
property int progress: 0
|
2018-11-27 20:58:27 +01:00
|
|
|
property string color: "green"
|
2018-11-24 13:50:06 +01:00
|
|
|
value: progress/100
|
2018-11-23 17:14:09 +01:00
|
|
|
anchors {
|
|
|
|
bottom: parent.bottom
|
|
|
|
bottomMargin: parent.height * 0.02
|
|
|
|
left: parent.left
|
|
|
|
leftMargin: parent.width * 0.01
|
|
|
|
right: parent.right
|
|
|
|
rightMargin: parent.width * 0.01
|
|
|
|
}
|
2018-12-15 19:44:11 +01:00
|
|
|
visible: calender.runningPageState ? true:false
|
2018-11-27 20:58:27 +01:00
|
|
|
contentItem: Item {
|
|
|
|
Rectangle {
|
|
|
|
width: prog.visualPosition * parent.width
|
|
|
|
height: parent.height
|
|
|
|
color: prog.color
|
|
|
|
}
|
2018-11-24 13:50:06 +01:00
|
|
|
}
|
|
|
|
|
2018-11-23 17:14:09 +01:00
|
|
|
NumberAnimation {
|
2018-11-24 13:50:06 +01:00
|
|
|
id: progNumAnim
|
2018-11-23 17:14:09 +01:00
|
|
|
target: prog
|
|
|
|
property: "progress"
|
|
|
|
from: 100
|
|
|
|
to: 0
|
|
|
|
duration: tick.interval
|
|
|
|
easing.type: Easing.Linear
|
2018-11-22 12:39:09 +01:00
|
|
|
}
|
2018-11-27 20:58:27 +01:00
|
|
|
|
|
|
|
SequentialAnimation {
|
2018-11-24 13:50:06 +01:00
|
|
|
id: progColAnim
|
2018-11-27 20:58:27 +01:00
|
|
|
loops: 1
|
|
|
|
ColorAnimation {
|
|
|
|
id: progColAnim1
|
|
|
|
target: prog
|
|
|
|
property: "color"
|
|
|
|
from: "green"
|
|
|
|
to: "goldenrod"
|
|
|
|
duration: tick.interval/2
|
|
|
|
easing.type: Easing.Linear
|
|
|
|
}
|
|
|
|
ColorAnimation {
|
|
|
|
id: progColAnim2
|
|
|
|
target: prog
|
|
|
|
property: "color"
|
|
|
|
from: "goldenrod"
|
|
|
|
to: "darkRed"
|
|
|
|
duration: tick.interval/2
|
|
|
|
easing.type: Easing.Linear
|
|
|
|
}
|
2018-11-24 13:50:06 +01:00
|
|
|
}
|
2018-12-15 19:44:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ComboBox {
|
|
|
|
id: comboBox
|
|
|
|
model: ["None", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
|
|
|
|
anchors.centerIn: parent
|
|
|
|
visible: calender.runningPageState ? false:true
|
|
|
|
onCurrentTextChanged: {
|
|
|
|
if (currentIndex !== 0) {
|
|
|
|
if (currentIndex === calender.weekDay) {
|
|
|
|
calender.correct += 1
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
calender.wrong += 1
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
Timer, {
|
|
|
|
id: pause
|
|
|
|
interval: 200
|
|
|
|
repeat: false
|
|
|
|
}
|
|
|
|
*/
|
2018-11-27 20:58:27 +01:00
|
|
|
|
2018-12-15 19:44:11 +01:00
|
|
|
if (calender.actualDateCount < calender.dateCount) {
|
|
|
|
calender.generateNextDate()
|
|
|
|
tick.start()
|
|
|
|
calender.runningPageState = true
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
calender.state = "gameOver"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-11-23 17:14:09 +01:00
|
|
|
}
|
2018-11-22 12:39:09 +01:00
|
|
|
|
2018-11-23 17:14:09 +01:00
|
|
|
Timer {
|
|
|
|
id: tick
|
2018-12-15 19:44:11 +01:00
|
|
|
interval: calender.tickInterval
|
2018-11-23 17:14:09 +01:00
|
|
|
repeat: false
|
2018-12-15 19:44:11 +01:00
|
|
|
running: calender.state === "running"
|
2018-11-22 12:39:09 +01:00
|
|
|
|
2018-11-23 17:14:09 +01:00
|
|
|
onTriggered: {
|
2018-12-15 19:44:11 +01:00
|
|
|
calender.runningPageState = false
|
|
|
|
comboBox.currentIndex = 0
|
2018-11-22 12:39:09 +01:00
|
|
|
}
|
|
|
|
|
2018-11-23 17:14:09 +01:00
|
|
|
onRunningChanged: {
|
|
|
|
if(running){
|
2018-11-24 13:50:06 +01:00
|
|
|
progNumAnim.start()
|
2018-11-27 20:58:27 +01:00
|
|
|
progColAnim.start()
|
2018-11-22 12:39:09 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|