/*SPDX-FileCopyrightText: 2013 Eike Hein <hein@kde.org>SPDX-License-Identifier: GPL-2.0-or-later*/import QtQuick 2.15import QtQuick.Controls 2.15import QtQuick.Layouts 1.15import org.kde.kirigami 2.19 as Kirigamiimport org.kde.plasma.core as PlasmaCoreimport org.kde.plasma.plasmoid 2.0import org.kde.kcmutils as KCMKCM.SimpleKCM {readonly property bool plasmaPaAvailable: Qt.createComponent("PulseAudio.qml").status === Component.Readyreadonly property bool plasmoidVertical: Plasmoid.formFactor === PlasmaCore.Types.Verticalreadonly property bool iconOnly: Plasmoid.pluginName === "org.kde.plasma.icontasks"property alias cfg_showToolTips: showToolTips.checkedproperty alias cfg_highlightWindows: highlightWindows.checkedproperty bool cfg_indicateAudioStreamsproperty alias cfg_fill: fill.checkedproperty alias cfg_maxStripes: maxStripes.valueproperty alias cfg_forceStripes: forceStripes.checkedproperty int cfg_iconSpacing: 0Component.onCompleted: {/* Don't rely on bindings for checking the radiobuttonsWhen checking forceStripes, the condition for the checked value for the allow stripes buttonbecame true and that one got checked instead, stealing the checked state for the just clicked checkbox*/if (maxStripes.value === 1) {forbidStripes.checked = true;} else if (!Plasmoid.configuration.forceStripes && maxStripes.value > 1) {allowStripes.checked = true;} else if (Plasmoid.configuration.forceStripes && maxStripes.value > 1) {forceStripes.checked = true;}}Kirigami.FormLayout {CheckBox {id: showToolTipsKirigami.FormData.label: i18n("General:")text: i18n("Show small window previews when hovering over Tasks")}CheckBox {id: highlightWindowstext: i18n("Hide other windows when hovering over previews")}CheckBox {id: indicateAudioStreamstext: i18n("Mark applications that play audio")checked: cfg_indicateAudioStreams && plasmaPaAvailableonToggled: cfg_indicateAudioStreams = checkedenabled: plasmaPaAvailable}CheckBox {id: filltext: i18nc("@option:check", "Fill free space on Panel")}Item {Kirigami.FormData.isSection: true}RadioButton {id: forbidStripesKirigami.FormData.label: plasmoidVertical ? i18nc("@option: radio", "Use multi-column view:") : i18nc("@option:radio", "Use multi-row view:")onToggled: {if (checked) {maxStripes.value = 1}}text: i18nc("Never use multi-column view for Task Manager", "Never")}RadioButton {id: allowStripesonToggled: {if (checked) {maxStripes.value = Math.max(2, maxStripes.value)}}text: i18nc("When to use multi-row view in Task Manager", "When Panel is low on space and thick enough")}RadioButton {id: forceStripesonToggled: {if (checked) {maxStripes.value = Math.max(2, maxStripes.value)}}text: i18nc("When to use multi-row view in Task Manager", "Always when Panel is thick enough")}SpinBox {id: maxStripesenabled: maxStripes.value > 1Kirigami.FormData.label: plasmoidVertical ? i18nc("@label:spinbox", "Maximum columns:") : i18nc("@label:spinbox", "Maximum rows:")from: 1}Item {Kirigami.FormData.isSection: true}ComboBox {visible: iconOnlyKirigami.FormData.label: i18n("Spacing between icons:")model: [{"label": i18nc("@item:inlistbox Icon spacing", "Small"),"spacing": 0},{"label": i18nc("@item:inlistbox Icon spacing", "Normal"),"spacing": 1},{"label": i18nc("@item:inlistbox Icon spacing", "Large"),"spacing": 3},]textRole: "label"enabled: !Kirigami.Settings.tabletModecurrentIndex: {if (Kirigami.Settings.tabletMode) {return 2; // Large}switch (cfg_iconSpacing) {case 0: return 0; // Smallcase 1: return 1; // Normalcase 3: return 2; // Large}}onActivated: cfg_iconSpacing = model[currentIndex]["spacing"];}Label {visible: Kirigami.Settings.tabletModetext: i18nc("@info:usagetip under a set of radio buttons when Touch Mode is on", "Automatically set to Large when in Touch Mode")font: Kirigami.Theme.smallFont}}}