feat: show the real account values in settings

This commit is contained in:
Jonathan Rainville 2020-06-10 11:55:24 -04:00 committed by Iuri Matias
parent 193f1331d1
commit 317c956718
4 changed files with 38 additions and 13 deletions

View File

@ -36,3 +36,11 @@ QtObject:
proc balance*(self: AccountItemView): string {.slot.} = result = ?.self.account.balance
QtProperty[string] balance:
read = balance
proc path*(self: AccountItemView): string {.slot.} = result = ?.self.account.path
QtProperty[string] path:
read = path
proc walletType*(self: AccountItemView): string {.slot.} = result = ?.self.account.walletType
QtProperty[string] walletType:
read = walletType

View File

@ -8,7 +8,7 @@ import strutils, sequtils
import chronicles
type WalletAccount* = object
address*, path*, publicKey*, name*, color*: string
address*, path*, publicKey*, name*, color*, walletType*: string
wallet*, chat*: bool
proc getWalletAccounts*(): seq[WalletAccount] =
@ -22,6 +22,7 @@ proc getWalletAccounts*(): seq[WalletAccount] =
walletAccounts.add(WalletAccount(
address: $account["address"].getStr,
path: $account["path"].getStr,
walletType: if (account.hasKey("type")): $account["type"].getStr else: "",
# Watch accoutns don't have a public key
publicKey: if (account.hasKey("public-key")): $account["public-key"].getStr else: "",
name: $account["name"].getStr,

View File

@ -5,13 +5,14 @@ import "../../../imports"
import "../../../shared"
ModalPopup {
property var currentAccount: walletModel.currentAccount
id: popup
// TODO add icon when we have that feature
title: qsTr("Status account settings")
height: 630
property int marginBetweenInputs: 35
property string selectedColor: Constants.accountColors[0] // TODO use old color
property string selectedColor: currentAccount.iconColor
onOpened: {
accountNameInput.forceActiveFocus(Qt.MouseFocusReason)
@ -21,7 +22,7 @@ ModalPopup {
id: accountNameInput
placeholderText: qsTr("Enter an account name...")
label: qsTr("Account name")
text: "Old name"
text: currentAccount.name
}
Select {
@ -44,32 +45,42 @@ ModalPopup {
TextWithLabel {
id: typeText
label: "Type"
text: "On Status"
label: qsTr("Type")
text: {
var result = ""
switch (currentAccount.walletType) {
case Constants.watchWalletType: result = qsTr("Watch-only"); break;
case Constants.keyWalletType:
case Constants.seedWalletType: result = qsTr("Off Status tree"); break;
default: result = qsTr("On Status tree")
}
return result
}
anchors.top: accountColorInput.bottom
anchors.topMargin: marginBetweenInputs
}
TextWithLabel {
id: addressText
label: "Wallet address"
text: "0x0000"
label: qsTr("Wallet address")
text: currentAccount.address
anchors.top: typeText.bottom
anchors.topMargin: marginBetweenInputs
}
TextWithLabel {
id: pathText
label: "Derivation path"
text: "m/stuff"
label: qsTr("Derivation path")
text: currentAccount.path
anchors.top: addressText.bottom
anchors.topMargin: marginBetweenInputs
}
TextWithLabel {
id: storageText
label: "Storage"
text: "This device"
visible: currentAccount.walletType !== Constants.watchWalletType
label: qsTr("Storage")
text: qsTr("This device")
anchors.top: pathText.bottom
anchors.topMargin: marginBetweenInputs
}
@ -81,7 +92,7 @@ ModalPopup {
anchors.topMargin: Theme.padding
anchors.right: saveBtn.left
anchors.rightMargin: Theme.padding
label: "Delete account"
label: qsTr("Delete account")
btnColor: Theme.white
textColor: Theme.red
@ -97,7 +108,7 @@ ModalPopup {
anchors.topMargin: Theme.padding
anchors.right: parent.right
anchors.rightMargin: Theme.padding
label: "Save changes"
label: qsTr("Save changes")
disabled: accountNameInput.text === ""

View File

@ -16,6 +16,11 @@ QtObject {
readonly property int transactionType: 5
readonly property int systemMessagePrivateGroupType: 6
readonly property string watchWalletType: "watch"
readonly property string keyWalletType: "key"
readonly property string seedWalletType: "seed"
readonly property string generatedWalletType: "generated"
readonly property var accountColors: [
"#9B832F",
"#D37EF4",