feat: add basic generate account popup

This commit is contained in:
Jonathan Rainville 2020-06-04 10:53:10 -04:00 committed by Iuri Matias
parent 2449a12fb7
commit bf5f0b6dda
11 changed files with 84 additions and 26 deletions

View File

@ -19,12 +19,9 @@ ModalPopup {
height: 44
color: Theme.grey
anchors.top: parent.top
anchors.topMargin: 16
radius: 8
anchors.right: parent.right
anchors.rightMargin: 16
anchors.left: parent.left
anchors.leftMargin: 16
TextField {
id: chatKey

View File

@ -20,10 +20,9 @@ ModalPopup {
Layout.fillHeight: false
Layout.fillWidth: true
width: parent.width
padding: 20
Text {
width: parent.width - 20
width: parent.width
font.pixelSize: 15
text: qsTr("A public chat is where you get to hang out with others, make friends and talk about subjects of your interest.")
wrapMode: Text.WordWrap
@ -38,9 +37,7 @@ ModalPopup {
anchors.top: description.bottom
radius: 8
anchors.right: parent.right
anchors.rightMargin: 16
anchors.left: parent.left
anchors.leftMargin: 16
TextField {
id: channelName

View File

@ -77,6 +77,10 @@ Rectangle {
newAccountMenu.popup(x, addAccountLbl.height + 10)
}
GenerateAccountModal {
id: generateAccountModal
}
PopupMenu {
id: newAccountMenu
width: 280
@ -84,7 +88,7 @@ Rectangle {
text: qsTr("Generate an account")
icon.source: "../../../img/generate_account.svg"
onTriggered: {
console.log("TODO: Generate an account")
generateAccountModal.open()
}
}
QQC2.Action {
@ -117,6 +121,6 @@ Rectangle {
/*##^##
Designer {
D{i:0;formeditorZoom:3}
D{i:0;height:36;width:36}
}
##^##*/

View File

@ -0,0 +1,57 @@
import QtQuick 2.12
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import "../../../../imports"
import "../../../../shared"
ModalPopup {
id: popup
title: qsTr("Generate an account")
property int marginBetweenInputs: 38
onOpened: {
passwordInput.text = "";
passwordInput.forceActiveFocus(Qt.MouseFocusReason)
}
Input {
id: passwordInput
placeholderText: qsTr("Enter your password…")
label: qsTr("Password")
textField.echoMode: TextInput.Password
}
Input {
id: accountNameInput
anchors.top: passwordInput.bottom
anchors.topMargin: marginBetweenInputs
placeholderText: qsTr("Enter an account name...")
label: qsTr("Account name")
}
Input {
id: accountColorInput
anchors.top: accountNameInput.bottom
anchors.topMargin: marginBetweenInputs
label: qsTr("Account color")
}
footer: StyledButton {
label: "Add account >"
disabled: passwordInput.text === "" && accountNameInput === ""
onClicked : {
if(chatKey.text === "") return;
chatsModel.joinChat(chatKey.text, Constants.chatTypeOneToOne);
popup.close();
}
}
}
/*##^##
Designer {
D{i:0;formeditorColor:"#ffffff";height:500;width:400}
}
##^##*/

View File

@ -59,11 +59,6 @@ Item {
label: "Amount"
icon: "../../../img/token-icons/eth.svg"
anchors.top: parent.top
anchors.topMargin: 0
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: parent.left
anchors.leftMargin: 0
placeholderText: qsTr("Enter ETH")
}

View File

@ -2,3 +2,4 @@ SendModalContent 1.0 SendModalContent.qml
SetCurrencyModalContent 1.0 SetCurrencyModalContent.qml
TokenSettingsModalContent 1.0 TokenSettingsModalContent.qml
AddAccount 1.0 AddAccount.qml
GenerateAccountModal 1.0 GenerateAccountModal.qml

View File

@ -80,6 +80,7 @@ DISTFILES += \
app/AppLayouts/Wallet/AssetsTab.qml \
app/AppLayouts/Wallet/CollectiblesTab.qml \
app/AppLayouts/Wallet/Components/AddAccount.qml \
app/AppLayouts/Wallet/Components/GenerateAccountModal.qml \
app/AppLayouts/Wallet/Components/SendModalContent.qml \
app/AppLayouts/Wallet/Components/SetCurrencyModalContent.qml \
app/AppLayouts/Wallet/Components/TokenSettingsModalContent.qml \

View File

@ -66,10 +66,7 @@ SwipeView {
anchors.left: parent.left
anchors.right: parent.right
placeholderText: "Enter password"
Component.onCompleted: {
this.textField.echoMode = TextInput.Password
}
textField.echoMode: TextInput.Password
Keys.onReturnPressed: {
submitBtn.clicked()
}

View File

@ -6,7 +6,7 @@ import "../imports"
Item {
property alias textField: inputValue
property string placeholderText: "My placeholder"
property string text: ""
property alias text: inputValue.text
property string label: ""
// property string label: "My Label"
@ -21,6 +21,8 @@ Item {
id: inputBox
height: inputRectangle.height + (hasLabel ? inputLabel.height + labelMargin : 0)
anchors.right: parent.right
anchors.left: parent.left
Text {
id: inputLabel
@ -42,9 +44,7 @@ Item {
anchors.top: inputBox.hasLabel ? inputLabel.bottom : parent.top
anchors.topMargin: inputBox.hasLabel ? inputBox.labelMargin : 0
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: parent.left
anchors.leftMargin: 0
TextField {
id: inputValue

View File

@ -80,10 +80,13 @@ Popup {
Item {
id: popupContent
anchors.top: separator.bottom
anchors.topMargin: Theme.padding
anchors.bottom: separator2.top
anchors.left: popup.left
anchors.right: popup.right
width: popup.width
anchors.bottomMargin: Theme.padding
anchors.left: parent.left
anchors.leftMargin: Theme.padding
anchors.right: parent.right
anchors.rightMargin: Theme.padding
}
Separator {

View File

@ -7,8 +7,8 @@ Menu {
property alias arrowX: bgPopupMenuTopArrow.x
closePolicy: Popup.CloseOnPressOutsideParent
id: popupMenu
topPadding: 16
bottomPadding: 16
topPadding: Theme.padding
bottomPadding: Theme.padding
delegate: MenuItem {
id: popupMenuItem
implicitWidth: 200
@ -107,3 +107,9 @@ Menu {
}
}
}
/*##^##
Designer {
D{i:0;autoSize:true;height:480;width:640}
}
##^##*/