feat: show the real account values in settings
This commit is contained in:
parent
193f1331d1
commit
317c956718
|
@ -36,3 +36,11 @@ QtObject:
|
||||||
proc balance*(self: AccountItemView): string {.slot.} = result = ?.self.account.balance
|
proc balance*(self: AccountItemView): string {.slot.} = result = ?.self.account.balance
|
||||||
QtProperty[string] balance:
|
QtProperty[string] balance:
|
||||||
read = 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
|
||||||
|
|
|
@ -8,7 +8,7 @@ import strutils, sequtils
|
||||||
import chronicles
|
import chronicles
|
||||||
|
|
||||||
type WalletAccount* = object
|
type WalletAccount* = object
|
||||||
address*, path*, publicKey*, name*, color*: string
|
address*, path*, publicKey*, name*, color*, walletType*: string
|
||||||
wallet*, chat*: bool
|
wallet*, chat*: bool
|
||||||
|
|
||||||
proc getWalletAccounts*(): seq[WalletAccount] =
|
proc getWalletAccounts*(): seq[WalletAccount] =
|
||||||
|
@ -22,6 +22,7 @@ proc getWalletAccounts*(): seq[WalletAccount] =
|
||||||
walletAccounts.add(WalletAccount(
|
walletAccounts.add(WalletAccount(
|
||||||
address: $account["address"].getStr,
|
address: $account["address"].getStr,
|
||||||
path: $account["path"].getStr,
|
path: $account["path"].getStr,
|
||||||
|
walletType: if (account.hasKey("type")): $account["type"].getStr else: "",
|
||||||
# Watch accoutns don't have a public key
|
# Watch accoutns don't have a public key
|
||||||
publicKey: if (account.hasKey("public-key")): $account["public-key"].getStr else: "",
|
publicKey: if (account.hasKey("public-key")): $account["public-key"].getStr else: "",
|
||||||
name: $account["name"].getStr,
|
name: $account["name"].getStr,
|
||||||
|
|
|
@ -5,13 +5,14 @@ import "../../../imports"
|
||||||
import "../../../shared"
|
import "../../../shared"
|
||||||
|
|
||||||
ModalPopup {
|
ModalPopup {
|
||||||
|
property var currentAccount: walletModel.currentAccount
|
||||||
id: popup
|
id: popup
|
||||||
// TODO add icon when we have that feature
|
// TODO add icon when we have that feature
|
||||||
title: qsTr("Status account settings")
|
title: qsTr("Status account settings")
|
||||||
height: 630
|
height: 630
|
||||||
|
|
||||||
property int marginBetweenInputs: 35
|
property int marginBetweenInputs: 35
|
||||||
property string selectedColor: Constants.accountColors[0] // TODO use old color
|
property string selectedColor: currentAccount.iconColor
|
||||||
|
|
||||||
onOpened: {
|
onOpened: {
|
||||||
accountNameInput.forceActiveFocus(Qt.MouseFocusReason)
|
accountNameInput.forceActiveFocus(Qt.MouseFocusReason)
|
||||||
|
@ -21,7 +22,7 @@ ModalPopup {
|
||||||
id: accountNameInput
|
id: accountNameInput
|
||||||
placeholderText: qsTr("Enter an account name...")
|
placeholderText: qsTr("Enter an account name...")
|
||||||
label: qsTr("Account name")
|
label: qsTr("Account name")
|
||||||
text: "Old name"
|
text: currentAccount.name
|
||||||
}
|
}
|
||||||
|
|
||||||
Select {
|
Select {
|
||||||
|
@ -44,32 +45,42 @@ ModalPopup {
|
||||||
|
|
||||||
TextWithLabel {
|
TextWithLabel {
|
||||||
id: typeText
|
id: typeText
|
||||||
label: "Type"
|
label: qsTr("Type")
|
||||||
text: "On Status"
|
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.top: accountColorInput.bottom
|
||||||
anchors.topMargin: marginBetweenInputs
|
anchors.topMargin: marginBetweenInputs
|
||||||
}
|
}
|
||||||
|
|
||||||
TextWithLabel {
|
TextWithLabel {
|
||||||
id: addressText
|
id: addressText
|
||||||
label: "Wallet address"
|
label: qsTr("Wallet address")
|
||||||
text: "0x0000"
|
text: currentAccount.address
|
||||||
anchors.top: typeText.bottom
|
anchors.top: typeText.bottom
|
||||||
anchors.topMargin: marginBetweenInputs
|
anchors.topMargin: marginBetweenInputs
|
||||||
}
|
}
|
||||||
|
|
||||||
TextWithLabel {
|
TextWithLabel {
|
||||||
id: pathText
|
id: pathText
|
||||||
label: "Derivation path"
|
label: qsTr("Derivation path")
|
||||||
text: "m/stuff"
|
text: currentAccount.path
|
||||||
anchors.top: addressText.bottom
|
anchors.top: addressText.bottom
|
||||||
anchors.topMargin: marginBetweenInputs
|
anchors.topMargin: marginBetweenInputs
|
||||||
}
|
}
|
||||||
|
|
||||||
TextWithLabel {
|
TextWithLabel {
|
||||||
id: storageText
|
id: storageText
|
||||||
label: "Storage"
|
visible: currentAccount.walletType !== Constants.watchWalletType
|
||||||
text: "This device"
|
label: qsTr("Storage")
|
||||||
|
text: qsTr("This device")
|
||||||
anchors.top: pathText.bottom
|
anchors.top: pathText.bottom
|
||||||
anchors.topMargin: marginBetweenInputs
|
anchors.topMargin: marginBetweenInputs
|
||||||
}
|
}
|
||||||
|
@ -81,7 +92,7 @@ ModalPopup {
|
||||||
anchors.topMargin: Theme.padding
|
anchors.topMargin: Theme.padding
|
||||||
anchors.right: saveBtn.left
|
anchors.right: saveBtn.left
|
||||||
anchors.rightMargin: Theme.padding
|
anchors.rightMargin: Theme.padding
|
||||||
label: "Delete account"
|
label: qsTr("Delete account")
|
||||||
btnColor: Theme.white
|
btnColor: Theme.white
|
||||||
textColor: Theme.red
|
textColor: Theme.red
|
||||||
|
|
||||||
|
@ -97,7 +108,7 @@ ModalPopup {
|
||||||
anchors.topMargin: Theme.padding
|
anchors.topMargin: Theme.padding
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: Theme.padding
|
anchors.rightMargin: Theme.padding
|
||||||
label: "Save changes"
|
label: qsTr("Save changes")
|
||||||
|
|
||||||
disabled: accountNameInput.text === ""
|
disabled: accountNameInput.text === ""
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,11 @@ QtObject {
|
||||||
readonly property int transactionType: 5
|
readonly property int transactionType: 5
|
||||||
readonly property int systemMessagePrivateGroupType: 6
|
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: [
|
readonly property var accountColors: [
|
||||||
"#9B832F",
|
"#9B832F",
|
||||||
"#D37EF4",
|
"#D37EF4",
|
||||||
|
|
Loading…
Reference in New Issue