File: LaunchFeedbackDialog.qml

package info (click to toggle)
plasma-workspace 4%3A5.27.5-2%2Bdeb12u2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 102,040 kB
  • sloc: cpp: 121,800; xml: 3,238; python: 645; perl: 586; sh: 254; javascript: 113; ruby: 62; makefile: 15; ansic: 13
file content (147 lines) | stat: -rw-r--r-- 5,507 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*
    SPDX-FileCopyrightText: 2017 Eike Hein <hein@kde.org>

    SPDX-License-Identifier: LGPL-2.0-only
*/

import QtQuick 2.15
import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15
import org.kde.kcm 1.3 as KCM
import org.kde.kirigami 2.20 as Kirigami

Kirigami.OverlaySheet {
    id: sheet

    title: i18nc("@title", "Launch Feedback")

    contentItem: ColumnLayout {
        Layout.preferredWidth: Kirigami.Units.gridUnit * 20
        Layout.maximumWidth: Kirigami.Units.gridUnit * 30
        spacing: Kirigami.Units.largeSpacing

        QQC2.Label {
            Layout.fillWidth: true
            text: i18nc("@info:usagetip", "Configure the animations played while an application is launching.")
            wrapMode: Text.Wrap
        }

        Kirigami.FormLayout {
            id: formLayout

            readonly property bool cursorImmutable: kcm.launchFeedbackSettings.isBusyCursorImmutable || kcm.launchFeedbackSettings.isBlinkingImmutable || kcm.launchFeedbackSettings.isBouncingImmutable

            QQC2.ButtonGroup {
                id: busyCursorGroup
                onCheckedButtonChanged: {
                    kcm.launchFeedbackSettings.busyCursor = busyCursorStatic.checked || busyCursorBlinking.checked || busyCursorBouncing.checked;
                    kcm.launchFeedbackSettings.blinking = busyCursorBlinking.checked;
                    kcm.launchFeedbackSettings.bouncing = busyCursorBouncing.checked;
                }
            }

            QQC2.RadioButton {
                id: busyCursorDisabled

                Kirigami.FormData.label: i18nc("@label", "Cursor feedback:")
                text: i18nc("@option:radio No cursor feedback when launching apps", "None")
                checked: !kcm.launchFeedbackSettings.busyCursor && !kcm.launchFeedbackSettings.blinking && !kcm.launchFeedbackSettings.bouncing
                enabled: !formLayout.cursorImmutable
                QQC2.ButtonGroup.group: busyCursorGroup
            }

            QQC2.RadioButton {
                id: busyCursorStatic

                text: i18nc("@option:radio", "Static")
                checked: kcm.launchFeedbackSettings.busyCursor && !busyCursorBlinking.checked && !busyCursorBouncing.checked
                enabled: !formLayout.cursorImmutable
                QQC2.ButtonGroup.group: busyCursorGroup
            }

            QQC2.RadioButton {
                id: busyCursorBlinking

                text: i18nc("@option:radio", "Blinking")
                checked: kcm.launchFeedbackSettings.blinking
                enabled: !formLayout.cursorImmutable
                QQC2.ButtonGroup.group: busyCursorGroup
            }

            QQC2.RadioButton {
                id: busyCursorBouncing

                text: i18nc("@option:radio", "Bouncing")
                checked: kcm.launchFeedbackSettings.bouncing
                enabled: !formLayout.cursorImmutable
                QQC2.ButtonGroup.group: busyCursorGroup

                KCM.SettingStateBinding {
                    configObject: kcm.launchFeedbackSettings
                    settingName: "bouncing"
                    extraEnabledConditions: !formLayout.cursorImmutable
                }
            }

            QQC2.CheckBox {
                id: taskManagerNotification

                Kirigami.FormData.label: i18nc("@label", "Task Manager feedback:")

                text: i18nc("@option:check", "Enable animation")

                checked: kcm.launchFeedbackSettings.taskbarButton
                enabled: !kcm.launchFeedbackSettings.isTaskbarButtonImmutable
                onToggled: kcm.launchFeedbackSettings.taskbarButton = checked;

                KCM.SettingStateBinding {
                    configObject: kcm.launchFeedbackSettings
                    settingName: "taskbarButton"
                }
            }

            Item {
                Kirigami.FormData.isSection: true
            }

            QQC2.SpinBox {
                id: notificationTimeout
                Layout.preferredWidth: notificationTimeoutMetrics.implicitWidth + leftPadding + rightPadding
                Kirigami.FormData.label: i18nc("@label", "Stop animations after:")

                enabled: !kcm.launchFeedbackSettings.isCursorTimeoutImmutable || !kcm.launchFeedbackSettings.isTaskbarTimeoutImmutable
                from: 1
                to: 60
                stepSize: 1
                editable: true

                value: kcm.launchFeedbackSettings.cursorTimeout
                onValueModified: {
                    kcm.launchFeedbackSettings.cursorTimeout = value
                    kcm.launchFeedbackSettings.taskbarTimeout = value
                }

                textFromValue: function(value, locale) { return i18np("%1 second", "%1 seconds", value)}
                valueFromText: function(text, locale) { return parseInt(text) }

                KCM.SettingStateBinding {
                    configObject: kcm.launchFeedbackSettings
                    settingName: "cursorTimeout"
                    extraEnabledConditions: taskManagerNotification.checked
                }

                TextMetrics {
                    id: notificationTimeoutMetrics
                    font: notificationTimeout.font
                    text: i18np("%1 second", "%1 seconds", 60)
                }
            }
        }
    }

    onSheetOpenChanged: if (!sheetOpen) {
        destroy(Kirigami.Units.humanMoment);
    }

    Component.onCompleted: open();
}