/*SPDX-FileCopyrightText: 2013 Eike Hein <hein@kde.org>SPDX-License-Identifier: GPL-2.0-or-later*/import QtQuickimport QtQuick.Controls as QQC2import org.kde.kcmutils as KCMUtilsimport org.kde.kirigami as Kirigamiimport org.kde.plasma.core as PlasmaCoreimport org.kde.plasma.plasmoidKCMUtils.SimpleKCM {id: rootreadonly 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 bool cfg_interactiveMuteproperty bool cfg_tooltipControlsproperty alias cfg_fill: fill.checkedproperty alias cfg_maxStripes: maxStripes.valueproperty alias cfg_forceStripes: forceStripes.checkedproperty alias cfg_taskMaxWidth: taskMaxWidth.currentIndexproperty 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 {QQC2.CheckBox {id: showToolTipsKirigami.FormData.label: i18nc("@label for several checkboxes", "General:")text: i18nc("@option:check section General", "Show small window previews when hovering over tasks")}QQC2.CheckBox {id: highlightWindowstext: showToolTips.checked ? i18nc("@option:check section General", "Hide other windows when hovering over previews") : i18nc("@option:check section General", "Hide other windows when hovering over tooltips")}QQC2.CheckBox {id: indicateAudioStreamstext: i18nc("@option:check section General", "Show an indicator when a task is playing audio")checked: root.cfg_indicateAudioStreams && root.plasmaPaAvailableonToggled: root.cfg_indicateAudioStreams = checkedenabled: root.plasmaPaAvailable}QQC2.CheckBox {id: interactiveMuteleftPadding: mirrored ? 0 : (indicateAudioStreams.indicator.width + indicateAudioStreams.spacing)rightPadding: mirrored ? (indicateAudioStreams.indicator.width + indicateAudioStreams.spacing) : 0text: i18nc("@option:check section General", "Mute task when clicking indicator")checked: root.cfg_interactiveMute && root.plasmaPaAvailableonToggled: root.cfg_interactiveMute = checkedenabled: indicateAudioStreams.checked && root.plasmaPaAvailable}QQC2.CheckBox {id: tooltipControlstext: i18nc("@option:check section General", "Show media and volume controls in tooltip")checked: root.cfg_tooltipControls && root.plasmaPaAvailableonToggled: root.cfg_tooltipControls = checkedenabled: root.plasmaPaAvailable}QQC2.CheckBox {id: filltext: i18nc("@option:check section General", "Fill free space on panel")}Item {Kirigami.FormData.isSection: truevisible: !root.iconOnly}QQC2.ComboBox {id: taskMaxWidthvisible: !root.iconOnly && !root.plasmoidVerticalKirigami.FormData.label: i18nc("@label:listbox", "Maximum task width:")model: [i18nc("@item:inlistbox how wide a task item should be", "Narrow"),i18nc("@item:inlistbox how wide a task item should be", "Medium"),i18nc("@item:inlistbox how wide a task item should be", "Wide")]}Item {Kirigami.FormData.isSection: true}QQC2.RadioButton {id: forbidStripesKirigami.FormData.label: root.plasmoidVertical? i18nc("@label for radio button group, completes sentence: … when panel is low on space etc.", "Use multi-column view:"): i18nc("@label for radio button group, completes sentence: … when panel is low on space etc.", "Use multi-row view:")onToggled: {if (checked) {maxStripes.value = 1}}text: i18nc("@option:radio Never use multi-column view for Task Manager", "Never")}QQC2.RadioButton {id: allowStripesonToggled: {if (checked) {maxStripes.value = Math.max(2, maxStripes.value)}}text: i18nc("@option:radio completes sentence: Use multi-column/row view", "When panel is low on space and thick enough")}QQC2.RadioButton {id: forceStripesonToggled: {if (checked) {maxStripes.value = Math.max(2, maxStripes.value)}}text: i18nc("@option:radio completes sentence: Use multi-column/row view", "Always when panel is thick enough")}QQC2.SpinBox {id: maxStripesenabled: maxStripes.value > 1Kirigami.FormData.label: root.plasmoidVertical? i18nc("@label:spinbox maximum number of columns for tasks", "Maximum columns:"): i18nc("@label:spinbox maximum number of rows for tasks", "Maximum rows:")from: 1}Item {Kirigami.FormData.isSection: true}QQC2.ComboBox {visible: root.iconOnlyKirigami.FormData.label: i18nc("@label:listbox", "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"currentIndex: switch (root.cfg_iconSpacing) {case 0: return 0; // Smallcase 1: return 1; // Normalcase 3: return 2; // Large}onActivated: index => {root.cfg_iconSpacing = model[currentIndex]["spacing"];}}}}