2023-03-20 12:29:05 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
2024-02-23 11:28:19 +00:00
|
|
|
import QtGraphicalEffects 1.0
|
|
|
|
import QtQml 2.15
|
2023-03-20 12:29:05 +00:00
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
2024-02-09 13:31:36 +00:00
|
|
|
import AppLayouts.Wallet.controls 1.0
|
|
|
|
|
2023-03-20 12:29:05 +00:00
|
|
|
import utils 1.0
|
2024-03-03 11:02:30 +00:00
|
|
|
import shared.controls 1.0
|
2023-03-20 12:29:05 +00:00
|
|
|
|
|
|
|
StatusDraggableListItem {
|
|
|
|
id: root
|
|
|
|
|
2024-03-04 22:07:09 +00:00
|
|
|
property alias actionComponent: additionalActionsLoader.sourceComponent
|
2024-03-10 21:31:48 +00:00
|
|
|
|
2023-03-20 12:29:05 +00:00
|
|
|
property int showcaseVisibility: Constants.ShowcaseVisibility.NoOne
|
2024-03-10 21:31:48 +00:00
|
|
|
property int showcaseMaxVisibility: Constants.ShowcaseVisibility.Everyone
|
|
|
|
|
2024-02-23 11:28:19 +00:00
|
|
|
property bool blurState: false
|
2024-03-03 11:02:30 +00:00
|
|
|
property bool contextMenuEnabled: true
|
|
|
|
property string tooltipTextWhenContextMenuDisabled
|
2023-03-20 12:29:05 +00:00
|
|
|
|
|
|
|
signal showcaseVisibilityRequested(int value)
|
|
|
|
|
|
|
|
component ShowcaseVisibilityAction: StatusMenuItem {
|
2024-03-10 21:31:48 +00:00
|
|
|
id: menuItem
|
|
|
|
required property int showcaseVisibility
|
|
|
|
|
|
|
|
ButtonGroup.group: showcaseVisibilityGroup
|
2023-03-20 12:29:05 +00:00
|
|
|
icon.name: ProfileUtils.visibilityIcon(showcaseVisibility)
|
|
|
|
icon.color: Theme.palette.primaryColor1
|
2024-03-10 21:31:48 +00:00
|
|
|
checked: root.showcaseVisibility === showcaseVisibility
|
|
|
|
|
|
|
|
enabled: root.showcaseMaxVisibility >= showcaseVisibility
|
2023-03-20 12:29:05 +00:00
|
|
|
}
|
|
|
|
|
2024-02-23 11:28:19 +00:00
|
|
|
layer.enabled: root.blurState
|
|
|
|
layer.effect: fastBlur
|
|
|
|
|
2024-02-23 07:14:55 +00:00
|
|
|
height: ProfileUtils.defaultDelegateHeight
|
|
|
|
topInset: 0
|
|
|
|
bottomInset: 0
|
|
|
|
changeColorOnDragActive: false
|
|
|
|
bgColor: Theme.palette.getColor(Theme.palette.statusAppLayout.rightPanelBackgroundColor, 0.7)
|
|
|
|
|
2023-03-20 12:29:05 +00:00
|
|
|
icon.width: 40
|
|
|
|
icon.height: 40
|
|
|
|
|
|
|
|
draggable: true
|
|
|
|
dragAxis: Drag.XAndYAxis
|
|
|
|
|
|
|
|
actions: [
|
2024-03-04 22:07:09 +00:00
|
|
|
Loader {
|
|
|
|
id: additionalActionsLoader
|
2023-03-20 12:29:05 +00:00
|
|
|
|
2024-03-03 11:02:30 +00:00
|
|
|
Layout.maximumWidth: root.width *.4
|
|
|
|
},
|
2024-03-12 15:52:02 +00:00
|
|
|
StatusButton {
|
2024-03-03 11:02:30 +00:00
|
|
|
interactive: root.contextMenuEnabled
|
2024-03-12 15:52:02 +00:00
|
|
|
tooltip.text: root.tooltipTextWhenContextMenuDisabled
|
|
|
|
icon.name: ProfileUtils.visibilityIcon(root.showcaseVisibility)
|
|
|
|
horizontalPadding: Style.current.halfPadding
|
|
|
|
verticalPadding: 3
|
|
|
|
Layout.preferredWidth: 72
|
|
|
|
Layout.preferredHeight: root.height/2
|
|
|
|
radius: height/2
|
|
|
|
highlighted: menuLoader.item && menuLoader.item.opened
|
|
|
|
onClicked: {
|
|
|
|
menuLoader.active = true
|
|
|
|
menuLoader.item.popup(width - menuLoader.item.width, height)
|
|
|
|
}
|
|
|
|
text: " " // NB to give the icon and indicator some even space
|
|
|
|
|
|
|
|
indicator: StatusIcon {
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: parent.horizontalPadding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
icon: "chevron-down"
|
|
|
|
color: parent.interactive ? Theme.palette.primaryColor1 : Theme.palette.baseColor1
|
|
|
|
}
|
|
|
|
|
|
|
|
ButtonGroup {
|
|
|
|
id: showcaseVisibilityGroup
|
|
|
|
exclusive: true
|
|
|
|
onClicked: function(button) {
|
|
|
|
const newVisibility = (button as ShowcaseVisibilityAction).showcaseVisibility
|
|
|
|
if (newVisibility !== root.showcaseVisibility)
|
|
|
|
root.showcaseVisibilityRequested(newVisibility)
|
2023-03-20 12:29:05 +00:00
|
|
|
}
|
2024-03-12 15:52:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
id: menuLoader
|
|
|
|
active: false
|
|
|
|
sourceComponent: StatusMenu {
|
|
|
|
onClosed: menuLoader.active = false
|
|
|
|
StatusMenuHeadline { text: qsTr("Show to") }
|
2023-03-20 12:29:05 +00:00
|
|
|
|
2024-03-12 15:52:02 +00:00
|
|
|
Binding on width {
|
|
|
|
value: Math.max(implicitWidth, everyoneAction.implicitWidth, contactsAction.implicitWidth, idVerifiedContactsAction.implicitWidth) + margins * 2
|
|
|
|
delayed: true
|
2023-03-20 12:29:05 +00:00
|
|
|
}
|
|
|
|
|
2024-03-12 15:52:02 +00:00
|
|
|
ShowcaseVisibilityAction {
|
|
|
|
id: everyoneAction
|
|
|
|
showcaseVisibility: Constants.ShowcaseVisibility.Everyone
|
|
|
|
text: enabled ? qsTr("Everyone") : qsTr("Everyone (set account to Everyone)")
|
|
|
|
}
|
|
|
|
ShowcaseVisibilityAction {
|
|
|
|
id: contactsAction
|
|
|
|
showcaseVisibility: Constants.ShowcaseVisibility.Contacts
|
|
|
|
text: enabled ? qsTr("Contacts") : qsTr("Contacts (set account to Contacts)")
|
|
|
|
}
|
|
|
|
ShowcaseVisibilityAction {
|
|
|
|
id: idVerifiedContactsAction
|
|
|
|
showcaseVisibility: Constants.ShowcaseVisibility.IdVerifiedContacts
|
|
|
|
text: enabled ? qsTr("ID verified contacts") : qsTr("ID verified contacts (set account to ID verified contacts)")
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuSeparator {}
|
|
|
|
|
|
|
|
ShowcaseVisibilityAction {
|
|
|
|
showcaseVisibility: Constants.ShowcaseVisibility.NoOne
|
|
|
|
text: qsTr("No one")
|
2023-03-20 12:29:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2024-02-23 11:28:19 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: fastBlur
|
|
|
|
|
|
|
|
FastBlur {
|
|
|
|
radius: 32
|
|
|
|
transparentBorder: true
|
|
|
|
}
|
|
|
|
}
|
2023-03-20 12:29:05 +00:00
|
|
|
}
|