fix: cleanup and fixes after introducing the new assets model

This commit is contained in:
Lukáš Tinkl 2024-01-25 18:53:09 +00:00 committed by Lukáš Tinkl
parent f2482ab003
commit 5080499d29
7 changed files with 40 additions and 16 deletions

View File

@ -48,7 +48,7 @@ SplitView {
})
}
controller: ManageTokensController {
sourceModel: ctrlEmptyModel.checked ? null : assetsModel
sourceModel: ctrlEmptyModel.checked ? null : walletAssetStore.groupedAccountAssetsModel
settingsKey: "WalletAssets"
}
}

View File

@ -7,6 +7,7 @@ import StatusQ.Core 0.1
import StatusQ.Models 0.1
import AppLayouts.Wallet.panels 1.0
import AppLayouts.Wallet.stores 1.0
import utils 1.0
@ -20,8 +21,8 @@ SplitView {
orientation: Qt.Horizontal
ManageTokensModel {
id: assetsModel
readonly property WalletAssetsStore walletAssetStore: WalletAssetsStore {
assetsWithFilteredBalances: groupedAccountsAssetsModel
}
ManageCollectiblesModel {
@ -41,7 +42,7 @@ SplitView {
ManageTokensController {
id: assetsController
sourceModel: ctrlEmptyModel.checked ? null : assetsModel
sourceModel: ctrlEmptyModel.checked ? null : walletAssetStore.groupedAccountAssetsModel
settingsKey: "WalletAssets"
}
@ -61,6 +62,23 @@ SplitView {
width: 500
assetsController: assetsController
collectiblesController: collectiblesController
getCurrencyAmount: function (balance, symbol) {
return ({
amount: balance,
symbol: symbol,
displayDecimals: 2,
stripTrailingZeroes: false
})
}
getCurrentCurrencyAmount: function (balance) {
return ({
amount: balance,
symbol: "USD",
displayDecimals: 2,
stripTrailingZeroes: false
})
}
}
}

View File

@ -191,6 +191,12 @@ ColumnLayout {
Component {
id: hiddenPanel
ManageHiddenPanel {
getCurrencyAmount: function (balance, symbol) {
return root.getCurrencyAmount(balance, symbol)
}
getCurrentCurrencyAmount: function (balance) {
return root.getCurrentCurrencyAmount(balance)
}
assetsController: d.assetsController
collectiblesController: d.collectiblesController
}

View File

@ -71,7 +71,7 @@ DropArea {
width: root.width
title: model.name
readonly property var totalBalance: aggregator.value/(10 ** model.decimals)
readonly property real totalBalance: aggregator.value/(10 ** model.decimals)
secondaryTitle: root.isCollectible ? (root.isCommunityToken ? qsTr("Community minted") : model.collectionName || model.collectionUid) :
hovered || menuBtn.menuVisible ? "%1 • %2".arg(LocaleUtils.currencyAmountToLocaleString(root.getCurrencyAmount(totalBalance, model.symbol)))
@ -123,7 +123,7 @@ DropArea {
SumAggregator {
id: aggregator
model: root.balances
model: root.balances ?? null
roleName: "balance"
}
}

View File

@ -27,9 +27,6 @@ DropArea {
readonly property int childCount: model.enabledNetworkBalance // NB using "balance" as "count" in the grouped model
readonly property alias title: groupedCommunityTokenDelegate.title
property var getCurrencyAmount: function (balance, symbol) {}
property var getCurrentCurrencyAmount: function(balance){}
ListView.onRemove: SequentialAnimation {
PropertyAction { target: root; property: "ListView.delayRemove"; value: true }
NumberAnimation { target: root; property: "scale"; to: 0; easing.type: Easing.InOutQuad }

View File

@ -21,7 +21,7 @@ Control {
readonly property bool hasSettings: root.controller.hasSettings
property var getCurrencyAmount: function (balance, symbol) {}
property var getCurrentCurrencyAmount: function(balance){}
property var getCurrentCurrencyAmount: function(balance) {}
background: null
@ -134,12 +134,6 @@ Control {
controller: root.controller
dragParent: root
dragEnabled: root.controller.communityTokenGroupsModel.count > 1
getCurrencyAmount: function (balance, symbol) {
return root.getCurrencyAmount(balance, symbol)
}
getCurrentCurrencyAmount: function (balance) {
return root.getCurrentCurrencyAmount(balance)
}
}
}
}

View File

@ -22,6 +22,9 @@ Control {
required property var assetsController
required property var collectiblesController
property var getCurrencyAmount: function (balance, symbol) {}
property var getCurrentCurrencyAmount: function (balance) {}
readonly property bool dirty: false // never dirty, the "show xxx" actions are immediate
readonly property bool hasSettings: root.assetsController.hasSettings || root.collectiblesController.hasSettings
@ -155,6 +158,12 @@ Control {
dragParent: null
dragEnabled: false
isHidden: true
getCurrencyAmount: function (balance, symbol) {
return root.getCurrencyAmount(balance, symbol)
}
getCurrentCurrencyAmount: function (balance) {
return root.getCurrentCurrencyAmount(balance)
}
}
}