2023-10-09 08:45:16 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
CalloutCard {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
signal dismiss()
|
|
|
|
signal enableLinkPreviewForThisMessage()
|
|
|
|
signal enableLinkPreview()
|
|
|
|
signal disableLinkPreview()
|
|
|
|
|
|
|
|
implicitHeight: 64
|
|
|
|
borderWidth: 0
|
|
|
|
topPadding: 13
|
|
|
|
bottomPadding: 13
|
2024-10-15 19:26:12 +00:00
|
|
|
horizontalPadding: Theme.padding
|
2023-10-09 08:45:16 +00:00
|
|
|
|
|
|
|
contentItem: RowLayout {
|
2024-10-15 19:26:12 +00:00
|
|
|
spacing: Theme.halfPadding
|
2023-10-09 08:45:16 +00:00
|
|
|
ColumnLayout {
|
|
|
|
spacing: 0
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
StatusBaseText {
|
|
|
|
Layout.alignment: Qt.AlignTop
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2024-10-15 19:26:12 +00:00
|
|
|
font.pixelSize: Theme.additionalTextSize
|
2023-10-09 08:45:16 +00:00
|
|
|
font.weight: Font.Medium
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
elide: Text.ElideRight
|
|
|
|
maximumLineCount: 1
|
|
|
|
text: qsTr("Show link previews?")
|
2024-05-22 02:35:25 +00:00
|
|
|
objectName: "titleText"
|
2023-10-09 08:45:16 +00:00
|
|
|
}
|
|
|
|
StatusBaseText {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2024-10-15 19:26:12 +00:00
|
|
|
font.pixelSize: Theme.additionalTextSize
|
2023-10-09 08:45:16 +00:00
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
elide: Text.ElideRight
|
|
|
|
maximumLineCount: 1
|
|
|
|
text: qsTr("A preview of your link will be shown here before you send it")
|
2024-05-22 02:35:25 +00:00
|
|
|
objectName: "subtitleText"
|
2023-10-09 08:45:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
ComboBox {
|
|
|
|
id: optionsComboBox
|
|
|
|
Layout.leftMargin: 12
|
|
|
|
Layout.preferredHeight: 38
|
|
|
|
leftPadding: 12
|
|
|
|
rightPadding: 12
|
|
|
|
hoverEnabled: true
|
|
|
|
flat: true
|
|
|
|
contentItem: RowLayout {
|
2024-10-15 19:26:12 +00:00
|
|
|
spacing: Theme.halfPadding
|
2023-10-09 08:45:16 +00:00
|
|
|
StatusBaseText {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
2024-10-15 19:26:12 +00:00
|
|
|
font.pixelSize: Theme.additionalTextSize
|
2023-10-09 08:45:16 +00:00
|
|
|
elide: Text.ElideRight
|
|
|
|
text: qsTr("Options")
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
}
|
|
|
|
StatusIcon {
|
|
|
|
Layout.preferredWidth: 16
|
|
|
|
Layout.preferredHeight: 16
|
|
|
|
icon: "chevron-down"
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
background: Rectangle {
|
|
|
|
border.width: 1
|
|
|
|
border.color: Theme.palette.directColor7
|
|
|
|
color: optionsComboBox.popup.visible ? Theme.palette.baseColor2 : "transparent"
|
2024-10-15 19:26:12 +00:00
|
|
|
radius: Theme.radius
|
2023-10-09 08:45:16 +00:00
|
|
|
HoverHandler {
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
enabled: optionsComboBox.enabled
|
|
|
|
}
|
|
|
|
}
|
2023-10-13 12:49:05 +00:00
|
|
|
popup: LinkPreviewSettingsCardMenu {
|
2023-10-09 08:45:16 +00:00
|
|
|
y: - (height + 4)
|
|
|
|
onEnableLinkPreviewForThisMessage: root.enableLinkPreviewForThisMessage()
|
|
|
|
onEnableLinkPreview: root.enableLinkPreview()
|
|
|
|
onDisableLinkPreview: root.disableLinkPreview()
|
|
|
|
}
|
|
|
|
indicator: null
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusFlatRoundButton {
|
|
|
|
id: closeButton
|
2024-05-22 02:35:25 +00:00
|
|
|
objectName: "closeLinkPreviewButton"
|
2023-10-09 08:45:16 +00:00
|
|
|
Layout.preferredHeight: 38
|
|
|
|
Layout.preferredWidth: 38
|
|
|
|
type: StatusFlatRoundButton.Type.Secondary
|
|
|
|
icon.name: "close"
|
|
|
|
icon.color: Theme.palette.directColor1
|
|
|
|
onClicked: root.dismiss()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
component ContextMenu: StatusMenu {
|
|
|
|
id: contextMenu
|
|
|
|
|
|
|
|
signal enableLinkPreviewForThisMessage()
|
|
|
|
signal enableLinkPreview()
|
|
|
|
signal disableLinkPreview()
|
|
|
|
|
|
|
|
hideDisabledItems: false
|
|
|
|
StatusAction {
|
|
|
|
text: qsTr("Link previews")
|
|
|
|
enabled: false
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusAction {
|
|
|
|
text: qsTr("Show for this message")
|
2024-05-20 10:11:37 +00:00
|
|
|
objectName: "showForThisMessagePreviewMenuItem"
|
2023-10-09 08:45:16 +00:00
|
|
|
icon.name: "show"
|
|
|
|
onTriggered: contextMenu.enableLinkPreviewForThisMessage()
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusAction {
|
|
|
|
text: qsTr("Always show previews")
|
2024-05-20 10:11:37 +00:00
|
|
|
objectName: "alwaysShowPreviewMenuItem"
|
2023-10-09 08:45:16 +00:00
|
|
|
icon.name: "show"
|
|
|
|
onTriggered: contextMenu.enableLinkPreview()
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuSeparator { }
|
|
|
|
|
|
|
|
StatusAction {
|
|
|
|
text: qsTr("Never show previews")
|
2024-05-20 10:11:37 +00:00
|
|
|
objectName: "neverShowPreviewsMenuItem"
|
2023-10-09 08:45:16 +00:00
|
|
|
icon.name: "hide"
|
|
|
|
type: StatusAction.Type.Danger
|
|
|
|
onTriggered: contextMenu.disableLinkPreview()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|