Warning, /graphics/spectacle/src/Gui/ShortcutsTextBox.qml is written in an unsupported language. File is not indexed.

0001 /* SPDX-FileCopyrightText: 2022 Noah Davis <noahadvs@gmail.com>
0002  * SPDX-License-Identifier: LGPL-2.0-or-later
0003  */
0004 
0005 import QtQuick
0006 import QtQuick.Templates as T
0007 import org.kde.kirigami as Kirigami
0008 import org.kde.spectacle.private
0009 
0010 FloatingBackground {
0011     id: root
0012     property string actionsColumnText: {
0013         let t = i18n("Take Screenshot:")
0014         t += '\n'
0015         t += '\n' + i18n("Create new selection rectangle:")
0016         t += '\n'
0017         if (!Settings.useReleaseToCapture) {
0018             t += '\n' + i18n("Move selection rectangle:")
0019             t += '\n'
0020             t += '\n'
0021             t += '\n' + i18n("Resize selection rectangle:")
0022             t += '\n'
0023             t += '\n'
0024             t += '\n' + i18n("Reset selection:")
0025         }
0026         t += '\n' + i18n("Cancel:")
0027         return t
0028     }
0029     property string shortcutsColumnText: {
0030         let t = Settings.useReleaseToCapture ?
0031             i18nc("Mouse action", "Release left-click") : i18nc("Mouse action", "Double-click")
0032         t += '\n' + i18nc("Keyboard action", "Enter")
0033         t += '\n' + i18nc("Mouse action", "Drag outside selection rectangle")
0034         t += '\n' + i18nc("Keyboard action", "+ Shift: Magnifier")
0035         if (!Settings.useReleaseToCapture) {
0036             t += '\n' + i18nc("Mouse action", "Drag inside selection rectangle")
0037             t += '\n' + i18nc("Keyboard action", "Arrow keys")
0038             t += '\n' + i18nc("Keyboard action", "+ Shift: Move in 1 pixel steps")
0039             t += '\n' + i18nc("Mouse action", "Drag handles")
0040             t += '\n' + i18nc("Keyboard action", "Arrow keys + Alt")
0041             t += '\n' + i18nc("Keyboard action", "+ Shift: Resize in 1 pixel steps")
0042             t += '\n' + i18nc("Mouse action", "Right-click")
0043         }
0044         t += '\n' + i18nc("Keyboard action", "Escape")
0045         return t
0046     }
0047     implicitWidth: Math.round(actionsColumnLabel.implicitWidth) + actionsColumnLabel.anchors.leftMargin
0048         + shortcutsColumnLabel.anchors.leftMargin // spacing
0049         + Math.round(shortcutsColumnLabel.implicitWidth) + shortcutsColumnLabel.anchors.rightMargin
0050     implicitHeight: Math.round(shortcutsColumnLabel.implicitHeight)
0051         + shortcutsColumnLabel.anchors.topMargin
0052         + shortcutsColumnLabel.anchors.bottomMargin
0053     radius: Kirigami.Units.mediumSpacing / 2 + border.width
0054     corners.bottomLeftRadius: 0
0055     corners.bottomRightRadius: 0
0056     color: Qt.rgba(actionsColumnLabel.palette.window.r,
0057                    actionsColumnLabel.palette.window.g,
0058                    actionsColumnLabel.palette.window.b, 0.85)
0059     border.color: Qt.rgba(actionsColumnLabel.color.r,
0060                           actionsColumnLabel.color.g,
0061                           actionsColumnLabel.color.b, 0.2)
0062     border.width: contextWindow.dprRound(1)
0063 
0064     T.Label {
0065         id: actionsColumnLabel
0066         anchors.left: parent.left
0067         anchors.top: parent.top
0068         anchors.bottom: parent.bottom
0069         anchors.leftMargin: Kirigami.Units.mediumSpacing * 2
0070         anchors.topMargin: anchors.leftMargin - QmlUtils.fontMetrics.descent
0071         anchors.bottomMargin: anchors.topMargin
0072         color: palette.windowText
0073         text: root.actionsColumnText
0074         textFormat: Text.PlainText
0075         horizontalAlignment: Text.AlignRight
0076         verticalAlignment: Text.AlignTop
0077         elide: Text.ElideNone
0078         wrapMode: Text.NoWrap
0079     }
0080 
0081     T.Label {
0082         id: shortcutsColumnLabel
0083         anchors.left: actionsColumnLabel.right
0084         anchors.right: parent.right
0085         anchors.top: parent.top
0086         anchors.bottom: parent.bottom
0087         anchors.leftMargin: Kirigami.Units.mediumSpacing
0088         anchors.rightMargin: Kirigami.Units.mediumSpacing * 2
0089         anchors.topMargin: anchors.rightMargin - QmlUtils.fontMetrics.descent
0090         anchors.bottomMargin: anchors.topMargin
0091         color: palette.windowText
0092         text: root.shortcutsColumnText
0093         textFormat: Text.PlainText
0094         horizontalAlignment: Text.AlignLeft
0095         verticalAlignment: Text.AlignTop
0096         elide: Text.ElideNone
0097         wrapMode: Text.NoWrap
0098     }
0099 }