plasma-taskmanager-zoom/contents/ui/ConfigAppearance.qml

411 lines
15 KiB
QML

/*
SPDX-FileCopyrightText: 2013 Eike Hein <hein@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick
import QtQuick.Controls as QQC2
import QtQuick.Layouts
import org.kde.kcmutils as KCMUtils
import org.kde.kirigami as Kirigami
import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.plasmoid
KCMUtils.SimpleKCM {
readonly property bool plasmaPaAvailable: Qt.createComponent("PulseAudio.qml").status === Component.Ready
readonly property bool plasmoidVertical: Plasmoid.formFactor === PlasmaCore.Types.Vertical
readonly property bool iconOnly: Plasmoid.pluginName === "org.kde.plasma.icontasks" || Plasmoid.pluginName === "org.kde.plasma.icontasks.zoom"
property alias cfg_showToolTips: showToolTips.checked
property alias cfg_highlightWindows: highlightWindows.checked
property alias cfg_interactiveMute: interactiveMute.checked
property alias cfg_fill: fill.checked
property alias cfg_maxStripes: maxStripes.value
property alias cfg_forceStripes: forceStripes.checked
property alias cfg_taskMaxWidth: taskMaxWidth.currentIndex
property int cfg_iconSpacing: 0
property alias cfg_magnifyFactor: magnifyFactor.value
property alias cfg_zoomDuration: zoomDuration.value
property alias cfg_zoomEasing: zoomEasing.currentIndex
property alias cfg_hoverDelay: hoverDelay.value
property alias cfg_resetDelay: resetDelay.value
property alias cfg_zoomAnchor: zoomAnchor.currentIndex
property alias cfg_launchAnimationType: launchAnimationType.currentIndex
property alias cfg_launchAnimationDuration: launchAnimationDuration.value
property alias cfg_launchAnimationIntensity: launchAnimationIntensity.value
Component.onCompleted: {
/* Don't rely on bindings for checking the radiobuttons
When checking forceStripes, the condition for the checked value for the allow stripes button
became 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: showToolTips
Kirigami.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: highlightWindows
text: i18nc("@option:check section General", "Hide other windows when hovering over previews")
}
QQC2.CheckBox {
id: interactiveMute
text: i18nc("@option:check section General", "Use audio indicators to mute tasks")
enabled: plasmaPaAvailable
}
QQC2.CheckBox {
id: fill
text: i18nc("@option:check section General", "Fill free space on panel")
}
Item {
Kirigami.FormData.isSection: true
visible: !iconOnly
}
QQC2.ComboBox {
id: taskMaxWidth
visible: !iconOnly && !plasmoidVertical
Kirigami.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: forbidStripes
Kirigami.FormData.label: 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: allowStripes
onToggled: {
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: forceStripes
onToggled: {
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: maxStripes
enabled: maxStripes.value > 1
Kirigami.FormData.label: 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: iconOnly
Kirigami.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"
enabled: !Kirigami.Settings.tabletMode
currentIndex: {
if (Kirigami.Settings.tabletMode) {
return 2; // Large
}
switch (cfg_iconSpacing) {
case 0: return 0; // Small
case 1: return 1; // Normal
case 3: return 2; // Large
}
}
onActivated: index => {
cfg_iconSpacing = model[currentIndex]["spacing"];
}
}
QQC2.Label {
visible: Kirigami.Settings.tabletMode
text: 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
}
Item {
Kirigami.FormData.isSection: true
visible: iconOnly
}
QQC2.CheckBox {
id: enableZoomEffect
visible: iconOnly
Kirigami.FormData.label: i18nc("@label for zoom effect section", "Zoom Effect:")
text: i18nc("@option:check", "Enable icon zoom on hover")
checked: cfg_magnifyFactor > 0
onToggled: {
if (checked) {
cfg_magnifyFactor = 0.3;
} else {
cfg_magnifyFactor = 0;
}
}
}
QQC2.Label {
visible: iconOnly && enableZoomEffect.checked
text: i18nc("@info:usagetip", "Icons will smoothly zoom with configurable animation when you hover over them. Adjust the settings below to customize the zoom behavior.")
font: Kirigami.Theme.smallFont
wrapMode: Text.Wrap
Layout.fillWidth: true
}
RowLayout {
visible: iconOnly && enableZoomEffect.checked
Kirigami.FormData.label: i18nc("@label:slider", "Zoom intensity:")
QQC2.Slider {
id: magnifyFactor
Layout.fillWidth: true
from: 0.1
to: 1.0
stepSize: 0.05
value: cfg_magnifyFactor
onValueChanged: cfg_magnifyFactor = value
}
QQC2.Label {
text: Math.round(magnifyFactor.value * 100) + "%"
font: Kirigami.Theme.smallFont
Layout.minimumWidth: Kirigami.Units.gridUnit * 2
}
}
RowLayout {
visible: iconOnly && enableZoomEffect.checked
Kirigami.FormData.label: i18nc("@label:slider", "Animation duration:")
QQC2.Slider {
id: zoomDuration
Layout.fillWidth: true
from: 50
to: 500
stepSize: 25
value: cfg_zoomDuration
onValueChanged: cfg_zoomDuration = value
}
QQC2.Label {
text: Math.round(zoomDuration.value) + "ms"
font: Kirigami.Theme.smallFont
Layout.minimumWidth: Kirigami.Units.gridUnit * 2
}
}
QQC2.ComboBox {
id: zoomEasing
visible: iconOnly && enableZoomEffect.checked
Kirigami.FormData.label: i18nc("@label:listbox", "Animation style:")
model: [
i18nc("@item:inlistbox animation easing", "Linear"),
i18nc("@item:inlistbox animation easing", "Smooth (Quad)"),
i18nc("@item:inlistbox animation easing", "Smooth (Cubic)"),
i18nc("@item:inlistbox animation easing", "Smooth (Quart)"),
i18nc("@item:inlistbox animation easing", "Bouncy (Back)"),
i18nc("@item:inlistbox animation easing", "Elastic"),
i18nc("@item:inlistbox animation easing", "Bounce")
]
currentIndex: cfg_zoomEasing
onActivated: cfg_zoomEasing = currentIndex
}
RowLayout {
visible: iconOnly && enableZoomEffect.checked
Kirigami.FormData.label: i18nc("@label:slider", "Hover delay:")
QQC2.Slider {
id: hoverDelay
Layout.fillWidth: true
from: 0
to: 300
stepSize: 25
value: cfg_hoverDelay
onValueChanged: cfg_hoverDelay = value
}
QQC2.Label {
text: Math.round(hoverDelay.value) + "ms"
font: Kirigami.Theme.smallFont
Layout.minimumWidth: Kirigami.Units.gridUnit * 2
}
}
RowLayout {
visible: iconOnly && enableZoomEffect.checked
Kirigami.FormData.label: i18nc("@label:slider", "Reset delay:")
QQC2.Slider {
id: resetDelay
Layout.fillWidth: true
from: 0
to: 300
stepSize: 25
value: cfg_resetDelay
onValueChanged: cfg_resetDelay = value
}
QQC2.Label {
text: Math.round(resetDelay.value) + "ms"
font: Kirigami.Theme.smallFont
Layout.minimumWidth: Kirigami.Units.gridUnit * 2
}
}
QQC2.ComboBox {
id: zoomAnchor
visible: iconOnly && enableZoomEffect.checked
Kirigami.FormData.label: i18nc("@label:listbox", "Zoom anchor:")
model: [
i18nc("@item:inlistbox zoom anchor", "Center"),
i18nc("@item:inlistbox zoom anchor", "Bottom (macOS style)"),
i18nc("@item:inlistbox zoom anchor", "Top"),
i18nc("@item:inlistbox zoom anchor", "Left"),
i18nc("@item:inlistbox zoom anchor", "Right"),
i18nc("@item:inlistbox zoom anchor", "Bottom Left"),
i18nc("@item:inlistbox zoom anchor", "Bottom Right"),
i18nc("@item:inlistbox zoom anchor", "Top Left"),
i18nc("@item:inlistbox zoom anchor", "Top Right")
]
currentIndex: cfg_zoomAnchor
onActivated: cfg_zoomAnchor = currentIndex
}
Item {
Kirigami.FormData.isSection: true
}
QQC2.ComboBox {
id: launchAnimationType
Kirigami.FormData.label: i18nc("@label for launch animation section", "Launch Animation:")
model: [
i18nc("@item:inlistbox launch animation type", "Classic Busy Indicator"),
i18nc("@item:inlistbox launch animation type", "Pulsing Icon"),
i18nc("@item:inlistbox launch animation type", "Bouncing Icon"),
i18nc("@item:inlistbox launch animation type", "Rotating Icon"),
i18nc("@item:inlistbox launch animation type", "Scaling Icon"),
i18nc("@item:inlistbox launch animation type", "Fading Icon"),
i18nc("@item:inlistbox launch animation type", "Glow Effect")
]
currentIndex: cfg_launchAnimationType
onActivated: cfg_launchAnimationType = currentIndex
}
QQC2.Label {
text: i18nc("@info:usagetip", "Choose how launching applications are visually indicated. Each animation type provides a different visual feedback when starting apps.")
font: Kirigami.Theme.smallFont
wrapMode: Text.Wrap
Layout.fillWidth: true
}
RowLayout {
visible: cfg_launchAnimationType !== 0 // Hide for classic busy indicator
Kirigami.FormData.label: i18nc("@label:slider", "Animation duration:")
QQC2.Slider {
id: launchAnimationDuration
Layout.fillWidth: true
from: 500
to: 3000
stepSize: 100
value: cfg_launchAnimationDuration
onValueChanged: cfg_launchAnimationDuration = value
}
QQC2.Label {
text: Math.round(launchAnimationDuration.value) + "ms"
font: Kirigami.Theme.smallFont
Layout.minimumWidth: Kirigami.Units.gridUnit * 2.5
}
}
RowLayout {
visible: cfg_launchAnimationType !== 0 // Hide for classic busy indicator
Kirigami.FormData.label: i18nc("@label:slider", "Animation intensity:")
QQC2.Slider {
id: launchAnimationIntensity
Layout.fillWidth: true
from: 0.1
to: 1.0
stepSize: 0.05
value: cfg_launchAnimationIntensity
onValueChanged: cfg_launchAnimationIntensity = value
}
QQC2.Label {
text: Math.round(launchAnimationIntensity.value * 100) + "%"
font: Kirigami.Theme.smallFont
Layout.minimumWidth: Kirigami.Units.gridUnit * 2
}
}
}
}