Warning, /plasma/xdg-desktop-portal-kde/src/ScreenshotDialog.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 import QtQuick
0008 import QtQuick.Layouts
0009 import QtQuick.Controls as QQC2
0010 import org.kde.kirigami as Kirigami
0011 import org.kde.plasma.workspace.dialogs as PWD
0012 
0013 PWD.SystemDialog {
0014     id: root
0015 
0016     property alias screenshotType: areaCombo.currentIndex
0017     property alias screenshotTypesModel: areaCombo.model
0018     property alias screenshotImage: screenshot.source
0019     property alias withCursor: hasCursor.checked
0020     property alias withBorders: hasWindowBorders.checked
0021     property QtObject app
0022 
0023     title: i18n("Request Screenshot")
0024     iconName: "preferences-system-windows-effect-screenshot"
0025     acceptable: screenshot.valid
0026 
0027     Kirigami.FormLayout {
0028         Kirigami.Heading {
0029             text: i18n("Capture Mode")
0030         }
0031         QQC2.ComboBox {
0032             id: areaCombo
0033             Kirigami.FormData.label: i18n("Area:")
0034             textRole: "display"
0035         }
0036         QQC2.SpinBox {
0037             id: delayTime
0038             Kirigami.FormData.label: i18n("Delay:")
0039             from: 0
0040             to: 60
0041             stepSize: 1
0042             textFromValue: (value, locale) => i18np("%1 second", "%1 seconds", value)
0043             valueFromText: (text, locale) => parseInt(text);
0044         }
0045 
0046         Kirigami.Heading {
0047             text: i18n("Content Options")
0048         }
0049         QQC2.CheckBox {
0050             id: hasCursor
0051             text: i18n("Include cursor pointer")
0052             checked: true
0053         }
0054         QQC2.CheckBox {
0055             id: hasWindowBorders
0056             text: i18n("Include window borders")
0057             enabled: areaCombo.currentIndex === 2
0058             checked: true
0059         }
0060 
0061         Kirigami.Icon {
0062             id: screenshot
0063             Layout.fillWidth: true
0064             Layout.fillHeight: true
0065         }
0066     }
0067 
0068     standardButtons: QQC2.DialogButtonBox.Ok | QQC2.DialogButtonBox.Cancel
0069 
0070     Component.onCompleted: {
0071         dialogButtonBox.standardButton(QQC2.DialogButtonBox.Ok).text = i18n("Save")
0072     }
0073 
0074     actions: [
0075         QQC2.Action {
0076             readonly property Timer takeTimer: Timer {
0077                 repeat: false
0078                 interval: delayTime.value
0079                 onTriggered: root.app.takeScreenshotInteractive()
0080             }
0081             text: i18n("Take")
0082             enabled: !takeTimer.running
0083             onTriggered: takeTimer.restart()
0084         }
0085     ]
0086 }