2021-10-05 20:50:22 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
|
2022-07-13 12:29:38 +00:00
|
|
|
import StatusQ.Core 0.1
|
2022-08-08 21:12:12 +00:00
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
|
|
|
import SortFilterProxyModel 0.2
|
2022-07-13 12:29:38 +00:00
|
|
|
|
2021-10-05 20:50:22 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
import "../stores"
|
|
|
|
|
|
|
|
Item {
|
2022-08-08 21:12:12 +00:00
|
|
|
id: root
|
|
|
|
|
2022-03-25 08:46:47 +00:00
|
|
|
property var account
|
2022-08-08 21:12:12 +00:00
|
|
|
property bool assetDetailsLaunched: false
|
|
|
|
|
|
|
|
signal assetClicked(var token)
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
readonly property var alwaysVisible : ["ETH", "SNT", "DAI", "STT"]
|
|
|
|
property int selectedAssetIndex: -1
|
|
|
|
}
|
2022-03-25 08:46:47 +00:00
|
|
|
|
2021-10-05 20:50:22 +00:00
|
|
|
height: assetListView.height
|
|
|
|
|
2022-07-14 11:03:36 +00:00
|
|
|
StatusListView {
|
|
|
|
id: assetListView
|
2022-08-08 10:07:29 +00:00
|
|
|
objectName: "assetViewStatusListView"
|
2022-08-08 21:12:12 +00:00
|
|
|
anchors.fill: parent
|
|
|
|
model: SortFilterProxyModel {
|
|
|
|
sourceModel: account.assets
|
|
|
|
filters: [
|
|
|
|
ExpressionFilter {
|
|
|
|
expression: d.alwaysVisible.includes(symbol) || (networkVisible && enabledNetworkBalance > 0)
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
delegate: StatusListItem {
|
|
|
|
width: parent.width
|
|
|
|
title: name
|
|
|
|
subTitle: qsTr("%1 %2").arg(Utils.toLocaleString(enabledNetworkBalance, RootStore.locale, {"currency": true})).arg(symbol)
|
|
|
|
image.source: symbol ? Style.png("tokens/" + symbol) : ""
|
|
|
|
components: [
|
|
|
|
StatusBaseText {
|
|
|
|
font.pixelSize: 15
|
|
|
|
font.strikeout: false
|
|
|
|
text: enabledNetworkCurrencyBalance.toLocaleCurrencyString(Qt.locale(), RootStore.currencyStore.currentCurrencySymbol)
|
|
|
|
}
|
|
|
|
]
|
|
|
|
onClicked: {
|
|
|
|
d.selectedAssetIndex = index
|
|
|
|
assetClicked(model)
|
|
|
|
}
|
|
|
|
Component.onCompleted: {
|
|
|
|
// on Model reset if the detail view is shown, update the data in background.
|
|
|
|
if(root.assetDetailsLaunched && index === d.selectedAssetIndex)
|
|
|
|
assetClicked(model)
|
|
|
|
}
|
2022-07-14 11:03:36 +00:00
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
|
2022-07-14 11:03:36 +00:00
|
|
|
ScrollBar.vertical: ScrollBar { policy: ScrollBar.AsNeeded }
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
|
|
|
}
|