2023-10-17 19:09:45 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Models 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
import AppLayouts.Wallet.controls 1.0
|
|
|
|
|
|
|
|
Control {
|
|
|
|
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
|
|
|
background: null
|
|
|
|
|
|
|
|
function saveSettings() {
|
2024-01-16 16:22:05 +00:00
|
|
|
root.controller.saveSettings();
|
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-01-16 16:22:05 +00:00
|
|
|
root.controller.clearSettings();
|
2023-10-17 19:09:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
contentItem: ColumnLayout {
|
|
|
|
spacing: Style.current.padding
|
|
|
|
|
|
|
|
StatusListView {
|
|
|
|
Layout.fillWidth: true
|
2024-01-16 16:22:05 +00:00
|
|
|
model: root.controller.regularTokensModel
|
2023-10-17 19:09:45 +00:00
|
|
|
implicitHeight: contentHeight
|
|
|
|
interactive: false
|
|
|
|
|
|
|
|
displaced: Transition {
|
|
|
|
NumberAnimation { properties: "x,y"; easing.type: Easing.OutQuad }
|
|
|
|
}
|
|
|
|
|
2023-11-09 11:21:56 +00:00
|
|
|
delegate: ManageTokensDelegate {
|
2024-01-16 16:22:05 +00:00
|
|
|
controller: root.controller
|
2023-11-09 11:21:56 +00:00
|
|
|
dragParent: root
|
2024-01-16 16:22:05 +00:00
|
|
|
count: root.controller.regularTokensModel.count
|
2023-10-17 19:09:45 +00:00
|
|
|
dragEnabled: count > 1
|
2024-01-24 16:35:53 +00:00
|
|
|
getCurrencyAmount: function (balance, symbol) {
|
|
|
|
return root.getCurrencyAmount(balance, symbol)
|
|
|
|
}
|
|
|
|
getCurrentCurrencyAmount: function (balance) {
|
|
|
|
return root.getCurrentCurrencyAmount(balance)
|
|
|
|
}
|
2023-10-17 19:09:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: Style.current.padding
|
2024-01-16 16:22:05 +00:00
|
|
|
visible: root.controller.communityTokensModel.count
|
2023-10-17 19:09:45 +00:00
|
|
|
StatusBaseText {
|
2024-01-19 09:53:32 +00:00
|
|
|
Layout.fillWidth: true
|
2023-11-09 11:21:56 +00:00
|
|
|
text: qsTr("Community")
|
2023-10-17 19:09:45 +00:00
|
|
|
}
|
|
|
|
StatusSwitch {
|
|
|
|
LayoutMirroring.enabled: true
|
|
|
|
LayoutMirroring.childrenInherit: true
|
|
|
|
id: switchArrangeByCommunity
|
|
|
|
textColor: Theme.palette.baseColor1
|
2024-01-19 09:53:32 +00:00
|
|
|
font.pixelSize: 13
|
2023-10-17 19:09:45 +00:00
|
|
|
text: qsTr("Arrange by community")
|
2024-01-19 09:53:32 +00:00
|
|
|
checked: root.controller.arrangeByCommunity
|
|
|
|
onToggled: root.controller.arrangeByCommunity = checked
|
2023-10-17 19:09:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
Layout.fillWidth: true
|
2024-01-16 16:22:05 +00:00
|
|
|
active: root.controller.communityTokensModel.count
|
2023-10-17 19:09:45 +00:00
|
|
|
visible: active
|
|
|
|
sourceComponent: switchArrangeByCommunity.checked ? cmpCommunityTokenGroups : cmpCommunityTokens
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: cmpCommunityTokens
|
|
|
|
StatusListView {
|
2024-01-16 16:22:05 +00:00
|
|
|
model: root.controller.communityTokensModel
|
2023-10-17 19:09:45 +00:00
|
|
|
implicitHeight: contentHeight
|
|
|
|
interactive: false
|
|
|
|
|
|
|
|
displaced: Transition {
|
|
|
|
NumberAnimation { properties: "x,y"; easing.type: Easing.OutQuad }
|
|
|
|
}
|
|
|
|
|
2023-11-09 11:21:56 +00:00
|
|
|
delegate: ManageTokensDelegate {
|
2024-01-16 16:22:05 +00:00
|
|
|
controller: root.controller
|
2023-11-09 11:21:56 +00:00
|
|
|
dragParent: root
|
2024-01-16 16:22:05 +00:00
|
|
|
count: root.controller.communityTokensModel.count
|
2023-10-17 19:09:45 +00:00
|
|
|
dragEnabled: count > 1
|
2024-01-24 16:35:53 +00:00
|
|
|
getCurrencyAmount: function (balance, symbol) {
|
|
|
|
return root.getCurrencyAmount(balance, symbol)
|
|
|
|
}
|
|
|
|
getCurrentCurrencyAmount: function (balance) {
|
|
|
|
return root.getCurrentCurrencyAmount(balance)
|
|
|
|
}
|
2023-10-17 19:09:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: cmpCommunityTokenGroups
|
|
|
|
StatusListView {
|
2024-01-16 16:22:05 +00:00
|
|
|
model: root.controller.communityTokenGroupsModel
|
2023-10-17 19:09:45 +00:00
|
|
|
implicitHeight: contentHeight
|
|
|
|
interactive: false
|
|
|
|
|
|
|
|
displaced: Transition {
|
|
|
|
NumberAnimation { properties: "x,y"; easing.type: Easing.OutQuad }
|
|
|
|
}
|
|
|
|
|
2023-11-09 11:21:56 +00:00
|
|
|
delegate: ManageTokensGroupDelegate {
|
2024-01-16 16:22:05 +00:00
|
|
|
controller: root.controller
|
2023-11-09 11:21:56 +00:00
|
|
|
dragParent: root
|
2024-01-16 16:22:05 +00:00
|
|
|
dragEnabled: root.controller.communityTokenGroupsModel.count > 1
|
2023-11-09 11:21:56 +00:00
|
|
|
}
|
2023-10-17 19:09:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|