2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import QtGraphicalEffects 1.13
|
2020-05-14 16:16:01 +00:00
|
|
|
import "../../../imports"
|
|
|
|
import "../../../shared"
|
2020-06-04 20:56:44 +00:00
|
|
|
import "./components"
|
2020-05-14 16:16:01 +00:00
|
|
|
|
2020-05-27 18:40:58 +00:00
|
|
|
Item {
|
2020-06-03 19:59:18 +00:00
|
|
|
property int selectedAccount: 0
|
2020-06-10 20:21:23 +00:00
|
|
|
property var changeSelectedAccount: function(newIndex) {
|
|
|
|
if (newIndex > walletModel.accounts) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
selectedAccount = newIndex
|
|
|
|
walletModel.setCurrentAccountByIndex(newIndex)
|
2020-09-04 15:37:38 +00:00
|
|
|
walletTabBar.currentIndex = 0;
|
2020-06-10 20:21:23 +00:00
|
|
|
}
|
2020-05-14 16:16:01 +00:00
|
|
|
id: walletInfoContainer
|
|
|
|
|
|
|
|
|
2020-06-09 14:51:38 +00:00
|
|
|
|
2020-07-15 19:38:03 +00:00
|
|
|
StyledText {
|
|
|
|
id: title
|
|
|
|
//% "Wallet"
|
|
|
|
text: qsTrId("wallet")
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
font.weight: Font.Bold
|
|
|
|
font.pixelSize: 17
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: walletValueTextContainer
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.padding
|
|
|
|
anchors.top: title.bottom
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
height: childrenRect.height
|
|
|
|
|
|
|
|
StyledTextEdit {
|
|
|
|
id: walletAmountValue
|
|
|
|
color: Style.current.textColor
|
2020-09-16 11:11:31 +00:00
|
|
|
text: Utils.toLocaleString(walletModel.totalFiatBalance, appSettings.locale) + " " + walletModel.defaultCurrency.toUpperCase()
|
2020-07-15 19:38:03 +00:00
|
|
|
selectByMouse: true
|
|
|
|
cursorVisible: true
|
|
|
|
readOnly: true
|
2020-06-09 14:51:38 +00:00
|
|
|
anchors.left: parent.left
|
2020-07-15 19:38:03 +00:00
|
|
|
font.weight: Font.Medium
|
|
|
|
font.pixelSize: 30
|
|
|
|
}
|
2020-06-09 14:51:38 +00:00
|
|
|
|
2020-07-15 19:38:03 +00:00
|
|
|
StyledText {
|
|
|
|
id: totalValue
|
2021-02-25 14:35:25 +00:00
|
|
|
color: Style.current.secondaryText
|
2020-08-26 15:52:26 +00:00
|
|
|
//% "Total value"
|
|
|
|
text: qsTrId("wallet-total-value")
|
2020-07-15 19:38:03 +00:00
|
|
|
anchors.left: walletAmountValue.left
|
|
|
|
anchors.top: walletAmountValue.bottom
|
|
|
|
font.weight: Font.Medium
|
|
|
|
font.pixelSize: 13
|
2020-05-14 16:16:01 +00:00
|
|
|
}
|
|
|
|
|
2020-06-25 15:09:44 +00:00
|
|
|
AddAccount {
|
2020-07-15 19:38:03 +00:00
|
|
|
anchors.top: parent.top
|
2020-06-25 15:09:44 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
}
|
2020-06-09 14:51:38 +00:00
|
|
|
}
|
2020-05-27 19:53:36 +00:00
|
|
|
|
2020-07-15 19:38:03 +00:00
|
|
|
|
2020-05-27 19:53:36 +00:00
|
|
|
Component {
|
|
|
|
id: walletDelegate
|
|
|
|
|
|
|
|
Rectangle {
|
2021-03-16 19:19:48 +00:00
|
|
|
property bool selected: index === selectedAccount
|
2020-05-27 19:53:36 +00:00
|
|
|
|
|
|
|
id: rectangle
|
|
|
|
height: 64
|
2021-03-16 19:19:48 +00:00
|
|
|
color: selected ? Style.current.buttonForegroundColor : Style.current.transparent
|
2020-07-02 15:14:31 +00:00
|
|
|
radius: Style.current.radius
|
2020-05-27 19:53:36 +00:00
|
|
|
anchors.right: parent.right
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.rightMargin: Style.current.padding
|
2020-05-27 19:53:36 +00:00
|
|
|
anchors.left: parent.left
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.leftMargin: Style.current.padding
|
2020-05-27 19:53:36 +00:00
|
|
|
|
2020-06-25 13:23:17 +00:00
|
|
|
SVGImage {
|
2020-05-27 19:53:36 +00:00
|
|
|
id: walletIcon
|
|
|
|
width: 12
|
|
|
|
height: 12
|
|
|
|
anchors.top: parent.top
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.topMargin: Style.current.smallPadding
|
2020-05-27 19:53:36 +00:00
|
|
|
anchors.left: parent.left
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.leftMargin: Style.current.padding
|
2020-05-27 19:53:36 +00:00
|
|
|
source: "../../img/walletIcon.svg"
|
|
|
|
}
|
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: walletIcon
|
|
|
|
source: walletIcon
|
2021-03-16 19:19:48 +00:00
|
|
|
color: selected || !iconColor ? Style.current.white :
|
|
|
|
Utils.getCurrentThemeAccountColor(iconColor) || Style.current.accountColors[0]
|
2020-05-27 19:53:36 +00:00
|
|
|
}
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-05-27 19:53:36 +00:00
|
|
|
id: walletName
|
|
|
|
text: name
|
2020-08-14 19:19:08 +00:00
|
|
|
elide: Text.ElideRight
|
|
|
|
anchors.right: walletBalance.left
|
|
|
|
anchors.rightMargin: Style.current.smallPadding
|
2020-05-27 19:53:36 +00:00
|
|
|
anchors.top: parent.top
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.topMargin: Style.current.smallPadding
|
2020-05-27 19:53:36 +00:00
|
|
|
anchors.left: walletIcon.right
|
2020-08-14 19:19:08 +00:00
|
|
|
anchors.leftMargin: Style.current.smallPadding
|
|
|
|
|
2020-05-27 19:53:36 +00:00
|
|
|
font.pixelSize: 15
|
|
|
|
font.weight: Font.Medium
|
2020-07-13 18:45:54 +00:00
|
|
|
color: selected ? Style.current.white : Style.current.textColor
|
2020-05-27 19:53:36 +00:00
|
|
|
}
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-05-27 19:53:36 +00:00
|
|
|
id: walletAddress
|
2020-07-02 15:14:31 +00:00
|
|
|
font.family: Style.current.fontHexRegular.name
|
2020-05-27 19:53:36 +00:00
|
|
|
text: address
|
2020-06-02 20:10:48 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: parent.width/2
|
|
|
|
elide: Text.ElideMiddle
|
2020-05-27 19:53:36 +00:00
|
|
|
anchors.bottom: parent.bottom
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.bottomMargin: Style.current.smallPadding
|
2020-05-27 19:53:36 +00:00
|
|
|
anchors.left: walletName.left
|
|
|
|
anchors.leftMargin: 0
|
|
|
|
font.pixelSize: 15
|
|
|
|
font.weight: Font.Medium
|
2021-03-16 19:19:48 +00:00
|
|
|
color: selected ? Style.current.white : Style.current.secondaryText
|
2020-05-27 19:53:36 +00:00
|
|
|
opacity: selected ? 0.7 : 1
|
|
|
|
}
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-05-27 19:53:36 +00:00
|
|
|
id: walletBalance
|
2021-01-20 20:04:23 +00:00
|
|
|
text: isLoading ? "..." : Utils.toLocaleString(fiatBalance, appSettings.locale) + " " + walletModel.defaultCurrency.toUpperCase()
|
2020-05-27 19:53:36 +00:00
|
|
|
anchors.top: parent.top
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.topMargin: Style.current.smallPadding
|
2020-05-27 19:53:36 +00:00
|
|
|
anchors.right: parent.right
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.rightMargin: Style.current.padding
|
2020-05-27 19:53:36 +00:00
|
|
|
font.pixelSize: 15
|
|
|
|
font.weight: Font.Medium
|
2020-07-13 18:45:54 +00:00
|
|
|
color: selected ? Style.current.white : Style.current.textColor
|
2020-05-27 19:53:36 +00:00
|
|
|
}
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
2020-12-01 21:10:15 +00:00
|
|
|
cursorShape: Qt.PointingHandCursor
|
2020-05-27 19:53:36 +00:00
|
|
|
onClicked: {
|
2020-06-10 20:21:23 +00:00
|
|
|
changeSelectedAccount(index)
|
2020-05-27 19:53:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-27 13:49:57 +00:00
|
|
|
ScrollView {
|
2020-06-05 20:18:25 +00:00
|
|
|
anchors.bottom: parent.bottom
|
2020-07-15 19:38:03 +00:00
|
|
|
anchors.top: walletValueTextContainer.bottom
|
|
|
|
anchors.topMargin: Style.current.padding
|
2020-05-27 19:53:36 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.left: parent.left
|
2020-11-27 13:49:57 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
|
|
|
ScrollBar.vertical.policy: listView.contentHeight > listView.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
|
|
|
|
|
|
|
|
ListView {
|
|
|
|
id: listView
|
|
|
|
|
|
|
|
spacing: 5
|
|
|
|
anchors.fill: parent
|
|
|
|
boundsBehavior: Flickable.StopAtBounds
|
|
|
|
|
|
|
|
delegate: walletDelegate
|
|
|
|
|
|
|
|
ListModel {
|
|
|
|
id: exampleWalletModel
|
|
|
|
ListElement {
|
|
|
|
name: "Status account"
|
|
|
|
address: "0xcfc9f08bbcbcb80760e8cb9a3c1232d19662fc6f"
|
|
|
|
balance: "12.00 USD"
|
|
|
|
iconColor: "#7CDA00"
|
|
|
|
}
|
2020-05-27 19:53:36 +00:00
|
|
|
|
2020-11-27 13:49:57 +00:00
|
|
|
ListElement {
|
|
|
|
name: "Test account 1"
|
|
|
|
address: "0x2Ef1...E0Ba"
|
|
|
|
balance: "12.00 USD"
|
|
|
|
iconColor: "#FA6565"
|
|
|
|
}
|
|
|
|
ListElement {
|
|
|
|
name: "Status account"
|
|
|
|
address: "0x2Ef1...E0Ba"
|
|
|
|
balance: "12.00 USD"
|
|
|
|
iconColor: "#7CDA00"
|
|
|
|
}
|
2020-05-27 19:53:36 +00:00
|
|
|
}
|
|
|
|
|
2020-11-27 13:49:57 +00:00
|
|
|
model: walletModel.accounts
|
|
|
|
// model: exampleWalletModel
|
2020-05-27 19:53:36 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-14 16:16:01 +00:00
|
|
|
}
|
2020-05-14 20:04:38 +00:00
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
2020-06-09 14:51:38 +00:00
|
|
|
D{i:0;formeditorColor:"#ffffff";formeditorZoom:0.75;height:770;width:340}
|
2020-05-14 20:04:38 +00:00
|
|
|
}
|
|
|
|
##^##*/
|