115 lines
2.5 KiB
QML
115 lines
2.5 KiB
QML
|
import QtQuick 2.9
|
||
|
import QtQuick.Window 2.3
|
||
|
import QtQuick.Controls 2.4
|
||
|
import "./calender"
|
||
|
import "./calculator"
|
||
|
import com.max.mathtrainingstuff 1.0
|
||
|
|
||
|
|
||
|
Window {
|
||
|
visible: true
|
||
|
width: 540 * 0.6
|
||
|
height: 960 * 0.6
|
||
|
title: qsTr("Training")
|
||
|
|
||
|
color: settings.theme("PageBackgroundColor")
|
||
|
|
||
|
Item {
|
||
|
id: game
|
||
|
anchors.fill: parent
|
||
|
|
||
|
AppSettings {
|
||
|
id: settings
|
||
|
}
|
||
|
|
||
|
state: "starting"
|
||
|
|
||
|
states: [
|
||
|
State {
|
||
|
name: "starting"
|
||
|
PropertyChanges {
|
||
|
target: mainStack
|
||
|
currPage: startPageComp
|
||
|
}
|
||
|
},
|
||
|
|
||
|
State {
|
||
|
name: "calender"
|
||
|
PropertyChanges {
|
||
|
target: mainStack
|
||
|
currPage: calenderPageComp
|
||
|
}
|
||
|
},
|
||
|
State {
|
||
|
name: "calculator"
|
||
|
PropertyChanges {
|
||
|
target: mainStack
|
||
|
currPage: calculatorPageComp
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
|
||
|
StackView {
|
||
|
id: mainStack
|
||
|
|
||
|
property var currPage
|
||
|
|
||
|
anchors.fill: parent
|
||
|
|
||
|
onCurrPageChanged: {
|
||
|
mainStack.replace(currPage)
|
||
|
}
|
||
|
onCurrentItemChanged: {
|
||
|
mainStack.currentItem.pageOpened()
|
||
|
}
|
||
|
|
||
|
Component {
|
||
|
id: startPageComp
|
||
|
StartPage {
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Component {
|
||
|
id: calenderPageComp
|
||
|
Calender {
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Component {
|
||
|
id: calculatorPageComp
|
||
|
Calculator {
|
||
|
}
|
||
|
}
|
||
|
|
||
|
replaceExit: Transition {
|
||
|
NumberAnimation {
|
||
|
from: 1
|
||
|
to: 0
|
||
|
property: "opacity"
|
||
|
duration: 200
|
||
|
easing.type: Easing.InOutQuad
|
||
|
}
|
||
|
}
|
||
|
|
||
|
replaceEnter: Transition {
|
||
|
NumberAnimation {
|
||
|
from: 0
|
||
|
to: 1
|
||
|
property: "opacity"
|
||
|
duration: 200
|
||
|
easing.type: Easing.InOutQuad
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
function start() {
|
||
|
game.state = "starting"
|
||
|
}
|
||
|
function calender() {
|
||
|
game.state = "calender"
|
||
|
}
|
||
|
function calculator() {
|
||
|
game.state = "calculator"
|
||
|
}
|
||
|
}
|
||
|
}
|