2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
2020-09-29 06:39:29 +00:00
|
|
|
import QtGraphicalEffects 1.13
|
2020-06-12 20:47:44 +00:00
|
|
|
import "../imports"
|
|
|
|
import "../shared"
|
2020-09-30 12:33:26 +00:00
|
|
|
import "../shared/status"
|
2020-06-12 20:47:44 +00:00
|
|
|
|
|
|
|
ModalPopup {
|
|
|
|
property var onConfirmSeedClick: function () {}
|
2020-09-30 12:33:26 +00:00
|
|
|
property alias error: errorText.text
|
2020-06-12 20:47:44 +00:00
|
|
|
id: popup
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Enter seed phrase"
|
|
|
|
title: qsTrId("enter-seed-phrase")
|
2020-06-12 20:47:44 +00:00
|
|
|
height: 400
|
|
|
|
|
|
|
|
onOpened: {
|
|
|
|
mnemonicTextField.text = "";
|
|
|
|
mnemonicTextField.forceActiveFocus(Qt.MouseFocusReason)
|
|
|
|
}
|
|
|
|
TextArea {
|
|
|
|
id: mnemonicTextField
|
2020-09-30 12:33:26 +00:00
|
|
|
anchors.top: parent.top
|
2021-01-06 13:11:26 +00:00
|
|
|
anchors.topMargin: 40
|
|
|
|
height: 100
|
2020-06-12 20:47:44 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 76
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: 76
|
2020-09-30 12:33:26 +00:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
horizontalAlignment: TextEdit.AlignHCenter
|
|
|
|
verticalAlignment: TextEdit.AlignVCenter
|
|
|
|
font.pixelSize: 15
|
2021-01-06 13:11:26 +00:00
|
|
|
font.weight: Font.DemiBold
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Start with the first word"
|
|
|
|
placeholderText: qsTrId("start-with-the-first-word")
|
2020-09-30 12:33:26 +00:00
|
|
|
placeholderTextColor: Style.current.secondaryText
|
2021-01-06 13:11:26 +00:00
|
|
|
selectByMouse: true
|
|
|
|
selectByKeyboard: true
|
|
|
|
selectionColor: Style.current.secondaryBackground
|
|
|
|
selectedTextColor: Style.current.secondaryText
|
2020-09-30 12:33:26 +00:00
|
|
|
|
2020-09-29 06:39:29 +00:00
|
|
|
color: Style.current.textColor
|
2020-06-12 20:47:44 +00:00
|
|
|
|
|
|
|
Keys.onReturnPressed: {
|
|
|
|
submitBtn.clicked()
|
|
|
|
}
|
2020-09-30 12:33:26 +00:00
|
|
|
KeyNavigation.priority: KeyNavigation.BeforeItem
|
|
|
|
KeyNavigation.tab: submitBtn
|
2020-06-12 20:47:44 +00:00
|
|
|
}
|
|
|
|
|
2020-10-03 13:53:46 +00:00
|
|
|
StyledText {
|
|
|
|
text: Utils.seedPhraseWordCountText(mnemonicTextField.text)
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.top: mnemonicTextField.bottom
|
2021-01-06 13:11:26 +00:00
|
|
|
anchors.topMargin: Style.current.smallPadding
|
|
|
|
color: Style.current.secondaryText
|
2020-10-03 13:53:46 +00:00
|
|
|
}
|
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-09-30 12:33:26 +00:00
|
|
|
id: errorText
|
|
|
|
visible: !!text && text != ""
|
|
|
|
color: Style.current.danger
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2021-01-06 13:11:26 +00:00
|
|
|
anchors.top: mnemonicTextField.bottom
|
|
|
|
anchors.topMargin: Style.current.smallPadding
|
2020-09-30 12:33:26 +00:00
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: helpText
|
2020-07-06 20:39:55 +00:00
|
|
|
//% "Enter 12, 15, 18, 21 or 24 words.\nSeperate words by a single space."
|
2020-07-07 19:25:20 +00:00
|
|
|
text: qsTrId("enter-12--15--18--21-or-24-words--nseperate-words-by-a-single-space-")
|
2020-06-12 20:47:44 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.bottomMargin: 0
|
2021-01-06 13:11:26 +00:00
|
|
|
horizontalAlignment: TextEdit.AlignHCenter
|
2020-09-29 06:39:29 +00:00
|
|
|
color: Style.current.secondaryText
|
2020-06-12 20:47:44 +00:00
|
|
|
font.pixelSize: 12
|
|
|
|
}
|
|
|
|
|
2020-09-30 12:33:26 +00:00
|
|
|
footer: StatusRoundButton {
|
2020-06-12 20:47:44 +00:00
|
|
|
id: submitBtn
|
|
|
|
anchors.bottom: parent.bottom
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.topMargin: Style.current.padding
|
2020-06-12 20:47:44 +00:00
|
|
|
anchors.right: parent.right
|
2020-09-30 12:33:26 +00:00
|
|
|
icon.name: "arrow-right"
|
|
|
|
icon.width: 20
|
|
|
|
icon.height: 16
|
|
|
|
enabled: mnemonicTextField.text.length > 0
|
2020-06-12 20:47:44 +00:00
|
|
|
|
|
|
|
onClicked : {
|
|
|
|
if (mnemonicTextField.text === "") {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
onConfirmSeedClick(mnemonicTextField.text)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
|
|
|
D{i:0;formeditorColor:"#ffffff";height:500;width:400}
|
|
|
|
}
|
|
|
|
##^##*/
|