2023-10-17 19:09:45 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
|
|
|
StatusFlatButton {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property int currentIndex
|
|
|
|
property int count
|
|
|
|
|
|
|
|
property bool inHidden
|
|
|
|
property bool isGroup
|
2024-01-19 09:53:32 +00:00
|
|
|
property bool isCollection
|
2023-10-17 19:09:45 +00:00
|
|
|
property string groupId
|
2024-01-19 09:53:32 +00:00
|
|
|
property bool isCommunityToken
|
2023-11-09 11:21:56 +00:00
|
|
|
property bool isCollectible
|
2023-10-17 19:09:45 +00:00
|
|
|
|
|
|
|
readonly property bool hideEnabled: model.symbol !== "ETH"
|
|
|
|
readonly property bool menuVisible: menuLoader.active
|
|
|
|
|
|
|
|
signal moveRequested(int from, int to)
|
2024-01-16 16:22:05 +00:00
|
|
|
signal showHideRequested(string symbol, bool flag)
|
2023-10-17 19:09:45 +00:00
|
|
|
signal showHideGroupRequested(string groupId, bool flag)
|
|
|
|
|
|
|
|
icon.name: "more"
|
|
|
|
horizontalPadding: 4
|
|
|
|
verticalPadding: 4
|
|
|
|
textColor: hovered || highlighted ? Theme.palette.directColor1 : Theme.palette.baseColor1
|
|
|
|
highlighted: menuLoader.item && menuLoader.item.opened
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
menuLoader.active = true
|
|
|
|
menuLoader.item.popup(width - menuLoader.item.width, height)
|
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
id: menuLoader
|
2023-11-09 11:21:56 +00:00
|
|
|
objectName: "manageTokensContextMenuLoader"
|
2023-10-17 19:09:45 +00:00
|
|
|
active: false
|
|
|
|
sourceComponent: StatusMenu {
|
|
|
|
onClosed: menuLoader.active = false
|
|
|
|
|
|
|
|
StatusAction {
|
2023-11-09 11:21:56 +00:00
|
|
|
objectName: "miMoveToTop"
|
2023-10-17 19:09:45 +00:00
|
|
|
enabled: !root.inHidden && root.currentIndex !== 0
|
|
|
|
icon.name: "arrow-top"
|
|
|
|
text: qsTr("Move to top")
|
|
|
|
onTriggered: root.moveRequested(root.currentIndex, 0)
|
|
|
|
}
|
|
|
|
StatusAction {
|
2023-11-09 11:21:56 +00:00
|
|
|
objectName: "miMoveUp"
|
2023-10-17 19:09:45 +00:00
|
|
|
enabled: !root.inHidden && root.currentIndex !== 0
|
|
|
|
icon.name: "arrow-up"
|
|
|
|
text: qsTr("Move up")
|
|
|
|
onTriggered: root.moveRequested(root.currentIndex, root.currentIndex - 1)
|
|
|
|
}
|
|
|
|
StatusAction {
|
2023-11-09 11:21:56 +00:00
|
|
|
objectName: "miMoveDown"
|
2023-10-17 19:09:45 +00:00
|
|
|
enabled: !root.inHidden && root.currentIndex < root.count - 1
|
|
|
|
icon.name: "arrow-down"
|
|
|
|
text: qsTr("Move down")
|
|
|
|
onTriggered: root.moveRequested(root.currentIndex, root.currentIndex + 1)
|
|
|
|
}
|
|
|
|
StatusAction {
|
2023-11-09 11:21:56 +00:00
|
|
|
objectName: "miMoveToBottom"
|
2023-10-17 19:09:45 +00:00
|
|
|
enabled: !root.inHidden && root.currentIndex < root.count - 1
|
|
|
|
icon.name: "arrow-bottom"
|
|
|
|
text: qsTr("Move to bottom")
|
|
|
|
onTriggered: root.moveRequested(root.currentIndex, root.count - 1)
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuSeparator { enabled: !root.inHidden && root.hideEnabled }
|
|
|
|
|
|
|
|
// any token
|
|
|
|
StatusAction {
|
2023-11-09 11:21:56 +00:00
|
|
|
objectName: "miHideToken"
|
2024-01-25 11:40:22 +00:00
|
|
|
enabled: !root.inHidden && root.hideEnabled && !root.isGroup && !root.isCommunityToken && !root.groupId
|
2023-10-17 19:09:45 +00:00
|
|
|
type: StatusAction.Type.Danger
|
|
|
|
icon.name: "hide"
|
2023-11-09 11:21:56 +00:00
|
|
|
text: root.isCollectible ? qsTr("Hide collectible") : qsTr("Hide asset")
|
2024-01-16 16:22:05 +00:00
|
|
|
onTriggered: root.showHideRequested(model.symbol, false)
|
2023-10-17 19:09:45 +00:00
|
|
|
}
|
|
|
|
StatusAction {
|
2023-11-09 11:21:56 +00:00
|
|
|
objectName: "miShowToken"
|
2024-01-16 16:22:05 +00:00
|
|
|
enabled: root.inHidden && !root.isGroup
|
2023-10-17 19:09:45 +00:00
|
|
|
icon.name: "show"
|
2023-11-09 11:21:56 +00:00
|
|
|
text: root.isCollectible ? qsTr("Show collectible") : qsTr("Show asset")
|
2024-01-16 16:22:05 +00:00
|
|
|
onTriggered: root.showHideRequested(model.symbol, true)
|
2023-10-17 19:09:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// (hide) community tokens
|
|
|
|
StatusMenu {
|
|
|
|
id: communitySubmenu
|
2024-01-19 09:53:32 +00:00
|
|
|
enabled: !root.inHidden && root.isCommunityToken
|
2023-10-17 19:09:45 +00:00
|
|
|
title: qsTr("Hide")
|
|
|
|
assetSettings.name: "hide"
|
|
|
|
type: StatusAction.Type.Danger
|
|
|
|
|
|
|
|
StatusAction {
|
2023-11-09 11:21:56 +00:00
|
|
|
objectName: "miHideCommunityToken"
|
|
|
|
text: root.isCollectible ? qsTr("This collectible") : qsTr("This asset")
|
2023-10-17 19:09:45 +00:00
|
|
|
onTriggered: {
|
2024-01-16 16:22:05 +00:00
|
|
|
root.showHideRequested(model.symbol, false)
|
2023-10-17 19:09:45 +00:00
|
|
|
communitySubmenu.dismiss()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
StatusAction {
|
2023-11-09 11:21:56 +00:00
|
|
|
objectName: "miHideAllCommunityTokens"
|
|
|
|
text: root.isCollectible ? qsTr("All collectibles from this community") : qsTr("All assets from this community")
|
2023-10-17 19:09:45 +00:00
|
|
|
onTriggered: {
|
|
|
|
root.showHideGroupRequested(root.groupId, false)
|
|
|
|
communitySubmenu.dismiss()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-19 09:53:32 +00:00
|
|
|
// (hide) collection tokens
|
|
|
|
StatusMenu {
|
|
|
|
id: collectionSubmenu
|
2024-01-25 11:40:22 +00:00
|
|
|
enabled: !root.inHidden && root.isCollectible && !root.isCommunityToken && !root.isGroup && root.groupId
|
2024-01-19 09:53:32 +00:00
|
|
|
title: qsTr("Hide")
|
|
|
|
assetSettings.name: "hide"
|
|
|
|
type: StatusAction.Type.Danger
|
|
|
|
|
|
|
|
StatusAction {
|
|
|
|
objectName: "miHideCollectionToken"
|
|
|
|
text: qsTr("This collectible")
|
|
|
|
onTriggered: {
|
|
|
|
root.showHideRequested(model.symbol, false)
|
|
|
|
communitySubmenu.dismiss()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
StatusAction {
|
|
|
|
objectName: "miHideAllCollectionTokens"
|
|
|
|
text: qsTr("All collectibles from this collection")
|
|
|
|
onTriggered: {
|
|
|
|
root.showHideGroupRequested(root.groupId, false)
|
|
|
|
communitySubmenu.dismiss()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-17 19:09:45 +00:00
|
|
|
// token group
|
|
|
|
StatusAction {
|
2023-11-09 11:21:56 +00:00
|
|
|
objectName: "miHideTokenGroup"
|
2023-10-17 19:09:45 +00:00
|
|
|
enabled: !root.inHidden && root.isGroup
|
|
|
|
type: StatusAction.Type.Danger
|
|
|
|
icon.name: "hide"
|
2024-01-19 09:53:32 +00:00
|
|
|
text: {
|
|
|
|
if (root.isCollection)
|
|
|
|
return qsTr("Hide all collectibles from this collection")
|
|
|
|
return root.isCollectible ? qsTr("Hide all collectibles from this community")
|
|
|
|
: qsTr("Hide all assets from this community")
|
|
|
|
}
|
2023-10-17 19:09:45 +00:00
|
|
|
onTriggered: root.showHideGroupRequested(root.groupId, false)
|
|
|
|
}
|
|
|
|
StatusAction {
|
2023-11-09 11:21:56 +00:00
|
|
|
objectName: "miShowTokenGroup"
|
2023-10-17 19:09:45 +00:00
|
|
|
enabled: root.inHidden && root.groupId
|
|
|
|
icon.name: "show"
|
2024-01-19 09:53:32 +00:00
|
|
|
text: {
|
|
|
|
if (root.isCollection)
|
|
|
|
return qsTr("Show all collectibles from this collection")
|
|
|
|
return root.isCollectible ? qsTr("Show all collectibles from this community")
|
|
|
|
: qsTr("Show all assets from this community")
|
|
|
|
}
|
2023-10-17 19:09:45 +00:00
|
|
|
onTriggered: root.showHideGroupRequested(root.groupId, true)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|