2023-10-17 19:09:45 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
2024-01-26 15:39:42 +00:00
|
|
|
import QtQml.Models 2.15
|
2023-10-17 19:09:45 +00:00
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2024-01-26 15:39:42 +00:00
|
|
|
import StatusQ.Core.Utils 0.1
|
2023-10-17 19:09:45 +00:00
|
|
|
|
|
|
|
import AppLayouts.Wallet.controls 1.0
|
|
|
|
|
2024-02-15 17:25:03 +00:00
|
|
|
import shared.controls 1.0
|
2024-01-26 15:39:42 +00:00
|
|
|
|
2024-01-31 10:41:19 +00:00
|
|
|
DoubleFlickableWithFolding {
|
2023-10-17 19:09:45 +00:00
|
|
|
id: root
|
|
|
|
|
2024-01-16 16:22:05 +00:00
|
|
|
required property var controller
|
2023-10-17 19:09:45 +00:00
|
|
|
|
2024-01-16 16:22:05 +00:00
|
|
|
readonly property bool dirty: root.controller.dirty
|
|
|
|
readonly property bool hasSettings: root.controller.hasSettings
|
2023-10-17 19:09:45 +00:00
|
|
|
|
2024-01-24 16:35:53 +00:00
|
|
|
property var getCurrencyAmount: function (balance, symbol) {}
|
2024-01-25 18:53:09 +00:00
|
|
|
property var getCurrentCurrencyAmount: function(balance) {}
|
2024-01-24 16:35:53 +00:00
|
|
|
|
2023-10-17 19:09:45 +00:00
|
|
|
function saveSettings() {
|
2024-03-01 02:04:36 +00:00
|
|
|
let jsonSettings = root.controller.serializeSettingsAsJson()
|
|
|
|
root.controller.requestSaveSettings(jsonSettings);
|
2023-10-17 19:09:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function revert() {
|
2024-01-16 16:22:05 +00:00
|
|
|
root.controller.revert();
|
2023-10-17 19:09:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function clearSettings() {
|
2024-03-01 02:04:36 +00:00
|
|
|
root.controller.requestClearSettings()
|
2023-10-17 19:09:45 +00:00
|
|
|
}
|
|
|
|
|
2024-01-31 10:41:19 +00:00
|
|
|
clip: true
|
|
|
|
|
2024-01-26 15:39:42 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
|
|
|
|
readonly property int sectionHeight: 64
|
|
|
|
}
|
|
|
|
|
2024-01-31 10:41:19 +00:00
|
|
|
ScrollBar.vertical: StatusScrollBar {
|
|
|
|
policy: ScrollBar.AsNeeded
|
|
|
|
visible: resolveVisibility(policy, root.height, root.contentHeight)
|
|
|
|
}
|
2023-10-17 19:09:45 +00:00
|
|
|
|
2024-02-15 17:25:03 +00:00
|
|
|
flickable1: EmptyShapeRectangleFooterListView {
|
2024-01-31 10:41:19 +00:00
|
|
|
model: root.controller.regularTokensModel
|
|
|
|
width: root.width
|
2024-01-26 15:39:42 +00:00
|
|
|
|
2024-01-31 10:41:19 +00:00
|
|
|
header: FoldableHeader {
|
|
|
|
width: ListView.view.width
|
|
|
|
title: qsTr("Assets")
|
|
|
|
folded: root.flickable1Folded
|
2024-01-26 15:39:42 +00:00
|
|
|
|
2024-01-31 10:41:19 +00:00
|
|
|
onToggleFolding: root.flip1Folding()
|
|
|
|
}
|
2023-10-17 19:09:45 +00:00
|
|
|
|
2024-01-31 10:41:19 +00:00
|
|
|
delegate: ManageTokensDelegate {
|
|
|
|
controller: root.controller
|
|
|
|
dragParent: root
|
|
|
|
count: root.controller.regularTokensModel.count
|
|
|
|
dragEnabled: count > 1
|
|
|
|
getCurrencyAmount: function (balance, symbol) {
|
|
|
|
return root.getCurrencyAmount(balance, symbol)
|
2023-10-17 19:09:45 +00:00
|
|
|
}
|
2024-01-31 10:41:19 +00:00
|
|
|
getCurrentCurrencyAmount: function (balance) {
|
|
|
|
return root.getCurrentCurrencyAmount(balance)
|
2023-10-17 19:09:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-31 10:41:19 +00:00
|
|
|
placeholderText: qsTr("Your assets will appear here")
|
|
|
|
}
|
2024-01-26 15:39:42 +00:00
|
|
|
|
2024-02-15 17:25:03 +00:00
|
|
|
flickable2: EmptyShapeRectangleFooterListView {
|
2024-01-31 10:41:19 +00:00
|
|
|
width: root.width
|
2024-01-26 15:39:42 +00:00
|
|
|
|
2024-01-31 10:41:19 +00:00
|
|
|
model: root.controller.arrangeByCommunity ? communityGroupedModel
|
|
|
|
: communityNonGroupedModel
|
2024-01-26 15:39:42 +00:00
|
|
|
|
2024-01-31 10:41:19 +00:00
|
|
|
header: FoldableHeader {
|
|
|
|
width: ListView.view.width
|
|
|
|
title: qsTr("Community minted")
|
|
|
|
switchText: qsTr("Arrange by community")
|
|
|
|
folded: root.flickable2Folded
|
|
|
|
checked: root.controller.arrangeByCommunity
|
2023-10-17 19:09:45 +00:00
|
|
|
|
2024-01-31 10:41:19 +00:00
|
|
|
onToggleFolding: root.flip2Folding()
|
|
|
|
onToggleSwitch: root.controller.arrangeByCommunity = checked
|
2023-10-17 19:09:45 +00:00
|
|
|
}
|
2024-01-31 10:41:19 +00:00
|
|
|
|
|
|
|
placeholderText: qsTr("Your community minted assets will appear here")
|
2023-10-17 19:09:45 +00:00
|
|
|
}
|
|
|
|
|
2024-01-26 15:39:42 +00:00
|
|
|
DelegateModel {
|
|
|
|
id: communityNonGroupedModel
|
2023-10-17 19:09:45 +00:00
|
|
|
|
2024-01-26 15:39:42 +00:00
|
|
|
model: root.controller.communityTokensModel
|
2023-10-17 19:09:45 +00:00
|
|
|
|
2024-01-26 15:39:42 +00:00
|
|
|
function moveItem(from, to) {
|
|
|
|
model.moveItem(from, to)
|
|
|
|
}
|
|
|
|
|
|
|
|
delegate: ManageTokensDelegate {
|
|
|
|
controller: root.controller
|
|
|
|
dragParent: root
|
|
|
|
count: root.controller.communityTokensModel.count
|
|
|
|
dragEnabled: count > 1
|
|
|
|
getCurrencyAmount: function (balance, symbol) {
|
|
|
|
return root.getCurrencyAmount(balance, symbol)
|
|
|
|
}
|
|
|
|
getCurrentCurrencyAmount: function (balance) {
|
|
|
|
return root.getCurrentCurrencyAmount(balance)
|
2023-10-17 19:09:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-26 15:39:42 +00:00
|
|
|
DelegateModel {
|
|
|
|
id: communityGroupedModel
|
2023-10-17 19:09:45 +00:00
|
|
|
|
2024-01-26 15:39:42 +00:00
|
|
|
model: root.controller.communityTokenGroupsModel
|
2023-10-17 19:09:45 +00:00
|
|
|
|
2024-01-26 15:39:42 +00:00
|
|
|
function moveItem(from, to) {
|
|
|
|
model.moveItem(from, to)
|
|
|
|
}
|
|
|
|
|
|
|
|
delegate: ManageTokensGroupDelegate {
|
|
|
|
height: 76
|
|
|
|
|
|
|
|
controller: root.controller
|
|
|
|
dragParent: root
|
|
|
|
dragEnabled: root.controller.communityTokenGroupsModel.count > 1
|
2023-10-17 19:09:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|