Warning, /plasma/plasma-desktop/applets/taskmanager/package/contents/ui/ConfigAppearance.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2013 Eike Hein <hein@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 import QtQuick 2.15
0008 import QtQuick.Controls 2.15
0009 import QtQuick.Layouts 1.15
0010 
0011 import org.kde.kirigami 2.19 as Kirigami
0012 import org.kde.plasma.core as PlasmaCore
0013 import org.kde.plasma.plasmoid 2.0
0014 import org.kde.kcmutils as KCM
0015 
0016 KCM.SimpleKCM {
0017     readonly property bool plasmaPaAvailable: Qt.createComponent("PulseAudio.qml").status === Component.Ready
0018     readonly property bool plasmoidVertical: Plasmoid.formFactor === PlasmaCore.Types.Vertical
0019     readonly property bool iconOnly: Plasmoid.pluginName === "org.kde.plasma.icontasks"
0020 
0021     property alias cfg_showToolTips: showToolTips.checked
0022     property alias cfg_highlightWindows: highlightWindows.checked
0023     property bool cfg_indicateAudioStreams
0024     property alias cfg_fill: fill.checked
0025     property alias cfg_maxStripes: maxStripes.value
0026     property alias cfg_forceStripes: forceStripes.checked
0027     property int cfg_iconSpacing: 0
0028 
0029     Component.onCompleted: {
0030         /* Don't rely on bindings for checking the radiobuttons
0031            When checking forceStripes, the condition for the checked value for the allow stripes button
0032            became true and that one got checked instead, stealing the checked state for the just clicked checkbox
0033         */
0034         if (maxStripes.value === 1) {
0035             forbidStripes.checked = true;
0036         } else if (!Plasmoid.configuration.forceStripes && maxStripes.value > 1) {
0037             allowStripes.checked = true;
0038         } else if (Plasmoid.configuration.forceStripes && maxStripes.value > 1) {
0039             forceStripes.checked = true;
0040         }
0041     }
0042     Kirigami.FormLayout {
0043         CheckBox {
0044             id: showToolTips
0045             Kirigami.FormData.label: i18n("General:")
0046             text: i18n("Show small window previews when hovering over Tasks")
0047         }
0048 
0049         CheckBox {
0050             id: highlightWindows
0051             text: i18n("Hide other windows when hovering over previews")
0052         }
0053 
0054         CheckBox {
0055             id: indicateAudioStreams
0056             text: i18n("Mark applications that play audio")
0057             checked: cfg_indicateAudioStreams && plasmaPaAvailable
0058             onToggled: cfg_indicateAudioStreams = checked
0059             enabled: plasmaPaAvailable
0060         }
0061 
0062         CheckBox {
0063             id: fill
0064             text: i18nc("@option:check", "Fill free space on Panel")
0065         }
0066 
0067         Item {
0068             Kirigami.FormData.isSection: true
0069         }
0070 
0071         RadioButton {
0072             id: forbidStripes
0073             Kirigami.FormData.label: plasmoidVertical ? i18nc("@option: radio", "Use multi-column view:") : i18nc("@option:radio", "Use multi-row view:")
0074             onToggled: {
0075                 if (checked) {
0076                     maxStripes.value = 1
0077                 }
0078             }
0079             text: i18nc("Never use multi-column view for Task Manager", "Never")
0080         }
0081 
0082         RadioButton {
0083             id: allowStripes
0084             onToggled: {
0085                 if (checked) {
0086                     maxStripes.value = Math.max(2, maxStripes.value)
0087                 }
0088             }
0089             text: i18nc("When to use multi-row view in Task Manager", "When Panel is low on space and thick enough")
0090         }
0091 
0092         RadioButton {
0093             id: forceStripes
0094             onToggled: {
0095                 if (checked) {
0096                     maxStripes.value = Math.max(2, maxStripes.value)
0097                 }
0098             }
0099             text: i18nc("When to use multi-row view in Task Manager", "Always when Panel is thick enough")
0100         }
0101 
0102         SpinBox {
0103             id: maxStripes
0104             enabled: maxStripes.value > 1
0105             Kirigami.FormData.label: plasmoidVertical ? i18nc("@label:spinbox", "Maximum columns:") : i18nc("@label:spinbox", "Maximum rows:")
0106             from: 1
0107         }
0108 
0109         Item {
0110             Kirigami.FormData.isSection: true
0111         }
0112 
0113         ComboBox {
0114             visible: iconOnly
0115             Kirigami.FormData.label: i18n("Spacing between icons:")
0116 
0117             model: [
0118                 {
0119                     "label": i18nc("@item:inlistbox Icon spacing", "Small"),
0120                     "spacing": 0
0121                 },
0122                 {
0123                     "label": i18nc("@item:inlistbox Icon spacing", "Normal"),
0124                     "spacing": 1
0125                 },
0126                 {
0127                     "label": i18nc("@item:inlistbox Icon spacing", "Large"),
0128                     "spacing": 3
0129                 },
0130             ]
0131 
0132             textRole: "label"
0133             enabled: !Kirigami.Settings.tabletMode
0134 
0135             currentIndex: {
0136                 if (Kirigami.Settings.tabletMode) {
0137                     return 2; // Large
0138                 }
0139 
0140                 switch (cfg_iconSpacing) {
0141                     case 0: return 0; // Small
0142                     case 1: return 1; // Normal
0143                     case 3: return 2; // Large
0144                 }
0145             }
0146             onActivated: cfg_iconSpacing = model[currentIndex]["spacing"];
0147         }
0148 
0149         Label {
0150             visible: Kirigami.Settings.tabletMode
0151             text: i18nc("@info:usagetip under a set of radio buttons when Touch Mode is on", "Automatically set to Large when in Touch Mode")
0152             font: Kirigami.Theme.smallFont
0153         }
0154     }
0155 }