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 2.15
0008 import QtQuick.Layouts 1.15
0009 import QtQuick.Controls 2.15 as QQC2
0010 import org.kde.kirigami 2.14 as Kirigami
0011 import org.kde.plasma.workspace.dialogs 1.0 as PWD
0012 
0013 PWD.SystemDialog
0014 {
0015     id: root
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.source !== undefined
0026 
0027 
0028     Kirigami.FormLayout {
0029         Kirigami.Heading {
0030             text: i18n("Capture Mode")
0031         }
0032         QQC2.ComboBox {
0033             id: areaCombo
0034             Kirigami.FormData.label: i18n("Area:")
0035             textRole: "display"
0036         }
0037         QQC2.SpinBox {
0038             id: delayTime
0039             Kirigami.FormData.label: i18n("Delay:")
0040             from: 0
0041             to: 60
0042             stepSize: 1
0043             textFromValue: function(value, locale) {
0044                 return i18np("%1 second", "%1 seconds", value)
0045             }
0046             valueFromText: function(text, locale) {
0047                 return parseInt(text);
0048             }
0049         }
0050 
0051         Kirigami.Heading {
0052             text: i18n("Content Options")
0053         }
0054         QQC2.CheckBox {
0055             id: hasCursor
0056             text: i18n("Include cursor pointer")
0057             checked: true
0058         }
0059         QQC2.CheckBox {
0060             id: hasWindowBorders
0061             text: i18n("Include window borders")
0062             enabled: areaCombo.currentIndex === 2
0063             checked: true
0064         }
0065 
0066         Kirigami.Icon {
0067             id: screenshot
0068             Layout.fillWidth: true
0069             Layout.fillHeight: true
0070         }
0071     }
0072     standardButtons: QQC2.DialogButtonBox.Ok | QQC2.DialogButtonBox.Cancel
0073     Component.onCompleted: {
0074         dialogButtonBox.standardButton(QQC2.DialogButtonBox.Ok).text = i18n("Save")
0075     }
0076     actions: [
0077         Kirigami.Action {
0078             Timer {
0079                 id: takeTimer
0080                 repeat: false
0081                 interval: delayTime.value
0082                 onTriggered: root.app.takeScreenshotInteractive()
0083             }
0084             text: i18n("Take")
0085             enabled: !takeTimer.running
0086             onTriggered: takeTimer.restart()
0087         }
0088     ]
0089 }