2024-10-15 19:26:12 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
2022-06-28 10:55:33 +00:00
|
|
|
|
2022-07-13 12:29:38 +00:00
|
|
|
import StatusQ.Core 0.1
|
2022-05-26 13:40:41 +00:00
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Controls.Validators 0.1
|
2022-06-28 10:55:33 +00:00
|
|
|
|
|
|
|
import shared.panels 1.0
|
2022-05-26 13:40:41 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
2022-07-13 12:29:38 +00:00
|
|
|
StatusScrollView {
|
2022-06-28 10:55:33 +00:00
|
|
|
id: root
|
|
|
|
|
2022-05-26 13:40:41 +00:00
|
|
|
property int wordRandomNumber: -1
|
|
|
|
property string wordAtRandomNumber
|
|
|
|
property bool secondWordValid: true
|
|
|
|
property alias titleText: txtTitle.text
|
|
|
|
property alias inputValid: inputText.valid
|
|
|
|
|
2022-06-28 10:55:33 +00:00
|
|
|
default property alias content: column.children
|
|
|
|
|
2023-08-11 10:17:28 +00:00
|
|
|
signal enterPressed()
|
|
|
|
|
2022-10-19 12:18:33 +00:00
|
|
|
function forceInputFocus() {
|
|
|
|
inputText.input.edit.forceActiveFocus();
|
|
|
|
}
|
|
|
|
|
2023-05-31 20:58:23 +00:00
|
|
|
contentWidth: availableWidth
|
2022-09-27 08:51:53 +00:00
|
|
|
clip: false
|
2022-06-28 10:55:33 +00:00
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: column
|
2022-07-14 11:03:36 +00:00
|
|
|
width: root.availableWidth
|
2024-10-15 19:26:12 +00:00
|
|
|
spacing: Theme.padding
|
2022-06-28 10:55:33 +00:00
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: txtTitle
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
wrapMode: Text.WordWrap
|
2024-10-15 19:26:12 +00:00
|
|
|
font.pixelSize: Theme.primaryTextFontSize
|
2022-06-28 10:55:33 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
2022-05-26 13:40:41 +00:00
|
|
|
|
2022-06-28 10:55:33 +00:00
|
|
|
StatusInput {
|
|
|
|
id: inputText
|
2022-08-16 16:35:10 +00:00
|
|
|
input.edit.objectName: "BackupSeedStepBase_inputText"
|
2022-06-28 10:55:33 +00:00
|
|
|
visible: (wordRandomNumber > -1)
|
|
|
|
implicitWidth: 448
|
|
|
|
label: qsTr("Word #%1").arg(wordRandomNumber + 1)
|
2022-07-22 10:28:04 +00:00
|
|
|
placeholderText: qsTr("Enter word")
|
2022-06-28 10:55:33 +00:00
|
|
|
validators: [
|
|
|
|
StatusValidator {
|
|
|
|
validate: function (t) { return (root.wordAtRandomNumber === inputText.text); }
|
2022-08-16 16:22:59 +00:00
|
|
|
errorMessage: qsTr("Wrong word")
|
2022-06-28 10:55:33 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
Layout.fillWidth: true
|
2023-08-11 10:17:28 +00:00
|
|
|
onKeyPressed: {
|
|
|
|
if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && inputText.valid) {
|
|
|
|
root.enterPressed();
|
|
|
|
}
|
|
|
|
}
|
2022-06-28 10:55:33 +00:00
|
|
|
}
|
2022-05-26 13:40:41 +00:00
|
|
|
}
|
|
|
|
}
|