123 lines
3.5 KiB
QML
123 lines
3.5 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import "../../../colors"
|
|
|
|
Item { // Kana_Try
|
|
id: kanaVoicing
|
|
width: window.width
|
|
height: window.height - head.height
|
|
anchors.margins: 15
|
|
visible: false
|
|
|
|
Component.onCompleted: {
|
|
randomKnownKana()
|
|
}
|
|
|
|
KanaData {
|
|
id: kanaData
|
|
}
|
|
|
|
property var currentKana: []
|
|
|
|
property int roundNum: 0
|
|
property int maxRoundNum: 9
|
|
|
|
function randomKana() {
|
|
if (roundNum >= maxRoundNum) {
|
|
console.log("Switching back")
|
|
roundNum = 0
|
|
parent.switchModeChooser()
|
|
}
|
|
var list = kanaData.kana
|
|
currentKana = list[Math.floor(Math.random() * list.length)]
|
|
console.log("Round Num: " + roundNum + " - Choosing Kana: " + currentKana.hira)
|
|
roundNum = roundNum + 1
|
|
}
|
|
|
|
function randomKnownKana() {
|
|
if (roundNum >= maxRoundNum) {
|
|
console.log("Switching back")
|
|
roundNum = 0
|
|
parent.switchModeChooser()
|
|
}
|
|
var knownList = kanaData.kana.filter(k => k.known)
|
|
currentKana = knownList[Math.floor(Math.random() * knownList.length)]
|
|
console.log("Round Num: " + roundNum + " - Choosing Kana: " + currentKana.hira)
|
|
roundNum = roundNum + 1
|
|
}
|
|
|
|
Column {
|
|
anchors.fill: parent
|
|
spacing: 10
|
|
|
|
Rectangle {
|
|
id: kanaVoicingTextRectangale
|
|
color: "#FFFFFF"
|
|
width: parent.width
|
|
height: kanaVoicingText.height + parent.spacing/2
|
|
|
|
Text {
|
|
id: kanaVoicingText
|
|
text: "Im Spiel"
|
|
width: parent.width
|
|
horizontalAlignment: Text.AlignHCenter
|
|
font.pixelSize: 28
|
|
color: "black"
|
|
}
|
|
}
|
|
|
|
Row {
|
|
width: parent.width
|
|
height: parent.height - kanaVoicingTextRectangale.height - parent.spacing
|
|
spacing: 15
|
|
|
|
MouseArea {
|
|
hoverEnabled: true
|
|
cursorShape: Qt.PointingHandCursor
|
|
width: (parent.width - parent.spacing) / 2
|
|
height: parent.height
|
|
|
|
onClicked: {
|
|
kanaVoicing.randomKnownKana()
|
|
}
|
|
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
color: "#FFFFFF"
|
|
|
|
Text {
|
|
id: kanaVoicingKana1
|
|
text: kanaVoicing.currentKana ? kanaVoicing.currentKana.hira : ""
|
|
anchors.centerIn: parent
|
|
font.pixelSize: Math.min(parent.width / text.length * 1.2, parent.height * 0.8)
|
|
color: "black"
|
|
}
|
|
}
|
|
}
|
|
|
|
MouseArea {
|
|
hoverEnabled: true
|
|
cursorShape: Qt.PointingHandCursor
|
|
width: (parent.width - parent.spacing) / 2
|
|
height: parent.height
|
|
|
|
onClicked: {
|
|
kanaVoicing.randomKnownKana()
|
|
}
|
|
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
color: "#000000"
|
|
|
|
Text {
|
|
id: kanaVoicingKana2
|
|
text: kanaVoicing.currentKana ? kanaVoicing.currentKana.hira : ""
|
|
anchors.centerIn: parent
|
|
font.pixelSize: Math.min(parent.width / text.length * 1.2, parent.height * 0.8)
|
|
color: "white"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |