2021-10-05 20:50:22 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import QtGraphicalEffects 1.13
|
|
|
|
|
2022-07-14 11:03:36 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
2023-01-05 12:50:55 +00:00
|
|
|
import StatusQ.Popups 0.1
|
2022-07-14 11:03:36 +00:00
|
|
|
|
2021-10-05 20:50:22 +00:00
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.controls 1.0
|
2022-10-27 09:26:34 +00:00
|
|
|
import shared.popups.keycard 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
|
2021-10-05 20:50:22 +00:00
|
|
|
import "../controls"
|
|
|
|
import "../popups"
|
|
|
|
import "../stores"
|
|
|
|
|
2022-02-09 09:43:23 +00:00
|
|
|
Rectangle {
|
2022-07-18 10:39:31 +00:00
|
|
|
id: root
|
2021-10-05 20:50:22 +00:00
|
|
|
|
|
|
|
property var changeSelectedAccount: function(){}
|
2023-01-05 12:50:55 +00:00
|
|
|
property bool showSavedAddresses: false
|
|
|
|
onShowSavedAddressesChanged: {
|
|
|
|
walletAccountsListView.footerItem.button.highlighted = showSavedAddresses
|
|
|
|
}
|
|
|
|
|
2022-03-10 17:01:17 +00:00
|
|
|
property var emojiPopup: null
|
2021-10-05 20:50:22 +00:00
|
|
|
|
|
|
|
function onAfterAddAccount () {
|
2022-07-18 10:39:31 +00:00
|
|
|
root.changeSelectedAccount(RootStore.accounts.rowCount() - 1)
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
color: Style.current.secondaryMenuBackground
|
|
|
|
|
2022-10-27 09:26:34 +00:00
|
|
|
Loader {
|
2022-07-18 10:39:31 +00:00
|
|
|
id: addAccountModal
|
2022-10-27 09:26:34 +00:00
|
|
|
active: false
|
|
|
|
asynchronous: true
|
|
|
|
|
|
|
|
function open() {
|
|
|
|
if (!active) {
|
|
|
|
RootStore.createSharedKeycardModule()
|
|
|
|
active = true
|
|
|
|
}
|
|
|
|
item.open()
|
|
|
|
}
|
|
|
|
|
|
|
|
function close() {
|
|
|
|
if (item) {
|
|
|
|
RootStore.destroySharedKeycarModule()
|
|
|
|
item.close()
|
|
|
|
}
|
|
|
|
active = false
|
|
|
|
}
|
|
|
|
|
|
|
|
sourceComponent: AddAccountModal {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
onAfterAddAccount: root.onAfterAddAccount()
|
|
|
|
emojiPopup: root.emojiPopup
|
|
|
|
onClosed: addAccountModal.close()
|
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
|
|
|
|
2022-07-18 10:39:31 +00:00
|
|
|
ColumnLayout {
|
|
|
|
anchors.fill: parent
|
|
|
|
spacing: Style.current.padding
|
2021-10-05 20:50:22 +00:00
|
|
|
|
2023-01-05 12:50:55 +00:00
|
|
|
Item {
|
2022-07-18 10:39:31 +00:00
|
|
|
Layout.fillWidth: true
|
2023-01-05 12:50:55 +00:00
|
|
|
Layout.preferredHeight: walletTitleText.height
|
|
|
|
Layout.leftMargin: Style.current.padding
|
|
|
|
Layout.rightMargin: Style.current.padding
|
|
|
|
Layout.topMargin: Style.current.padding
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
id: walletTitleText
|
|
|
|
text: qsTr("Wallet")
|
|
|
|
font.weight: Font.Bold
|
|
|
|
font.pixelSize: 17
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusRoundButton {
|
|
|
|
objectName: "addAccountButton"
|
|
|
|
icon.name: "add-circle"
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: -Style.current.smallPadding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
width: height
|
|
|
|
height: parent.height * 2
|
|
|
|
color: hovered || highlighted ? Theme.palette.primaryColor3
|
|
|
|
: "transparent"
|
|
|
|
onClicked: addAccountModal.open()
|
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
|
|
|
|
2022-07-18 10:39:31 +00:00
|
|
|
Item {
|
|
|
|
height: childrenRect.height
|
|
|
|
Layout.fillWidth: true
|
2023-01-05 12:50:55 +00:00
|
|
|
Layout.leftMargin: Style.current.padding
|
2021-10-05 20:50:22 +00:00
|
|
|
|
2022-07-18 10:39:31 +00:00
|
|
|
StyledTextEdit {
|
|
|
|
id: walletAmountValue
|
2022-10-20 12:58:56 +00:00
|
|
|
objectName: "walletLeftListAmountValue"
|
2022-07-18 10:39:31 +00:00
|
|
|
color: Style.current.textColor
|
|
|
|
text: {
|
2023-01-08 22:23:51 +00:00
|
|
|
LocaleUtils.currencyAmountToLocaleString(RootStore.totalCurrencyBalance)
|
2022-07-18 10:39:31 +00:00
|
|
|
}
|
|
|
|
selectByMouse: true
|
|
|
|
cursorVisible: true
|
|
|
|
readOnly: true
|
|
|
|
width: parent.width
|
|
|
|
font.weight: Font.Medium
|
|
|
|
font.pixelSize: 22
|
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
|
2023-01-05 12:50:55 +00:00
|
|
|
StatusBaseText {
|
2022-07-18 10:39:31 +00:00
|
|
|
id: totalValue
|
2023-01-05 12:50:55 +00:00
|
|
|
color: Theme.palette.baseColor1
|
2022-07-18 10:39:31 +00:00
|
|
|
text: qsTr("Total value")
|
2022-03-10 17:01:17 +00:00
|
|
|
width: parent.width
|
2022-07-18 10:39:31 +00:00
|
|
|
anchors.top: walletAmountValue.bottom
|
|
|
|
anchors.topMargin: 4
|
|
|
|
font.pixelSize: 12
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
2022-07-18 10:39:31 +00:00
|
|
|
}
|
|
|
|
|
2022-07-14 11:03:36 +00:00
|
|
|
StatusListView {
|
2023-01-05 12:50:55 +00:00
|
|
|
id: walletAccountsListView
|
|
|
|
|
2022-10-21 07:17:48 +00:00
|
|
|
objectName: "walletAccountsListView"
|
2022-07-14 11:03:36 +00:00
|
|
|
spacing: Style.current.smallPadding
|
2022-07-18 10:39:31 +00:00
|
|
|
Layout.fillWidth: true
|
2022-07-19 15:36:09 +00:00
|
|
|
Layout.fillHeight: true
|
2022-07-18 10:39:31 +00:00
|
|
|
Layout.topMargin: Style.current.halfPadding
|
|
|
|
|
2022-07-20 14:54:30 +00:00
|
|
|
// ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
2021-10-05 20:50:22 +00:00
|
|
|
|
2023-01-05 12:50:55 +00:00
|
|
|
readonly property Item firstItem: count > 0 ? itemAtIndex(0) : null
|
|
|
|
|
2022-07-14 11:03:36 +00:00
|
|
|
delegate: StatusListItem {
|
2022-10-21 07:17:48 +00:00
|
|
|
objectName: "walletAccountItem"
|
2023-01-05 12:50:55 +00:00
|
|
|
width: ListView.view.width - Style.current.padding * 2
|
|
|
|
highlighted: !ListView.view.footerItem.button.highlighted &&
|
|
|
|
RootStore.currentAccount.name === model.name
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2022-07-14 11:03:36 +00:00
|
|
|
title: model.name
|
2023-01-08 22:23:51 +00:00
|
|
|
subTitle: LocaleUtils.currencyAmountToLocaleString(model.currencyBalance)
|
2022-08-11 11:55:08 +00:00
|
|
|
asset.emoji: !!model.emoji ? model.emoji: ""
|
|
|
|
asset.color: model.color
|
|
|
|
asset.name: !model.emoji ? "filled-account": ""
|
2023-01-05 12:50:55 +00:00
|
|
|
asset.width: 40
|
|
|
|
asset.height: 40
|
2022-08-11 11:55:08 +00:00
|
|
|
asset.letterSize: 14
|
|
|
|
asset.isLetterIdenticon: !!model.emoji ? true : false
|
|
|
|
asset.bgColor: Theme.palette.primaryColor3
|
2022-07-14 11:03:36 +00:00
|
|
|
statusListItemTitle.font.weight: Font.Medium
|
|
|
|
color: sensor.containsMouse || highlighted ? Theme.palette.baseColor3 : "transparent"
|
|
|
|
onClicked: {
|
|
|
|
changeSelectedAccount(index)
|
2023-01-05 12:50:55 +00:00
|
|
|
showSavedAddresses = false
|
2022-03-28 08:19:57 +00:00
|
|
|
}
|
2023-01-05 12:50:55 +00:00
|
|
|
components: [
|
|
|
|
StatusIcon {
|
|
|
|
icon: {
|
|
|
|
if (model.walletType == "watch")
|
|
|
|
return "show"
|
|
|
|
else if (model.walletType == "key")
|
|
|
|
return "keycard"
|
|
|
|
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
width: 15
|
|
|
|
height: 15
|
|
|
|
}
|
|
|
|
]
|
2022-07-14 11:03:36 +00:00
|
|
|
}
|
2022-03-28 08:19:57 +00:00
|
|
|
|
2023-01-05 12:50:55 +00:00
|
|
|
readonly property bool footerOverlayed: contentHeight > availableHeight
|
|
|
|
|
|
|
|
footerPositioning: footerOverlayed ? ListView.OverlayFooter : ListView.InlineFooter
|
|
|
|
footer: Control {
|
|
|
|
id: footer
|
|
|
|
|
|
|
|
z: 2 // to be on top of delegates when in ListView.OverlayFooter
|
|
|
|
horizontalPadding: Style.current.padding
|
|
|
|
verticalPadding: Style.current.padding
|
|
|
|
|
|
|
|
property alias button: savedAddressesBtn
|
|
|
|
|
|
|
|
background: Rectangle {
|
|
|
|
color: root.color
|
|
|
|
implicitWidth: root.width
|
|
|
|
implicitHeight: parent.ListView.view.firstItem.height + Style.current.xlPadding
|
|
|
|
|
|
|
|
layer.enabled: parent.ListView.view.footerOverlayed
|
|
|
|
layer.effect: DropShadow {
|
|
|
|
verticalOffset: -10
|
|
|
|
radius: 20
|
|
|
|
samples: 41
|
|
|
|
fast: true
|
|
|
|
cached: true
|
|
|
|
color: Theme.palette.dropShadow2
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuSeparator {
|
|
|
|
id: footerSeparator
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
visible: !footer.ListView.view.footerOverlayed
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
contentItem: StatusButton {
|
|
|
|
id: savedAddressesBtn
|
|
|
|
|
|
|
|
objectName: "savedAddressesBtn"
|
|
|
|
size: StatusBaseButton.Size.Large
|
|
|
|
normalColor: "transparent"
|
|
|
|
hoverColor: Theme.palette.primaryColor3
|
|
|
|
asset.color: Theme.palette.primaryColor1
|
|
|
|
asset.bgColor: Theme.palette.primaryColor3
|
2022-07-14 11:03:36 +00:00
|
|
|
font.weight: Font.Medium
|
2023-01-05 12:50:55 +00:00
|
|
|
text: qsTr("Saved addresses")
|
|
|
|
icon.name: "address"
|
|
|
|
icon.width: 40
|
|
|
|
icon.height: 40
|
|
|
|
isRoundIcon: true
|
|
|
|
textColor: Theme.palette.directColor1
|
|
|
|
textAlignment: Qt.AlignVCenter | Qt.AlignLeft
|
|
|
|
textFillWidth: true
|
|
|
|
spacing: parent.ListView.view.firstItem.statusListItemTitleArea.anchors.leftMargin
|
|
|
|
onClicked: {
|
|
|
|
showSavedAddresses = true
|
|
|
|
}
|
2022-07-18 10:39:31 +00:00
|
|
|
}
|
|
|
|
}
|
2022-07-14 11:03:36 +00:00
|
|
|
|
|
|
|
model: RootStore.accounts
|
|
|
|
// model: RootStore.exampleWalletModel
|
2022-07-18 10:39:31 +00:00
|
|
|
}
|
2022-03-01 10:14:13 +00:00
|
|
|
}
|
2022-07-26 18:46:07 +00:00
|
|
|
}
|