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-24 15:47:26 +00:00
|
|
|
import StatusQ.Core.Theme 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"
|
2022-11-23 17:58:22 +00:00
|
|
|
import shared.controls 1.0
|
2021-10-05 20:50:22 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
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 {
|
2022-11-03 14:11:13 +00:00
|
|
|
expression: networkVisible
|
2022-08-08 21:12:12 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2022-08-24 15:47:26 +00:00
|
|
|
|
2022-11-23 17:58:22 +00:00
|
|
|
delegate: TokenDelegate {
|
2022-08-25 18:17:54 +00:00
|
|
|
objectName: "AssetView_TokenListItem_" + symbol
|
2022-11-23 17:58:22 +00:00
|
|
|
readonly property string balance: enabledNetworkBalance // Needed for the tests
|
|
|
|
currentCurrencySymbol: RootStore.currencyStore.currentCurrencySymbol
|
2022-09-27 21:26:26 +00:00
|
|
|
width: ListView.view.width
|
2022-08-08 21:12:12 +00:00
|
|
|
onClicked: {
|
2022-09-27 08:30:18 +00:00
|
|
|
RootStore.getHistoricalDataForToken(symbol, RootStore.currencyStore.currentCurrency)
|
2022-08-08 21:12:12 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|