Files
DankMaterialShell/quickshell/Modules/Plugins/SliderSetting.qml
T
bbedward 014c69b09a settings: tile color restyle and re-org, use materials own shift for
them towards theme
controlCenter: make a real grid, add numerous more tile varieties, add
icon size option
surfaces: fix elevation levels in general, and shift them down
settings: restyles and re-org
sliders: scale down universally
2026-09-18 14:32:55 -04:00

76 lines
2.0 KiB
QML

import QtQuick
import qs.Common
import qs.Widgets
import "../../Common/QmlUtils.js" as QmlUtils
Column {
id: root
required property string settingKey
required property string label
property string description: ""
property int defaultValue: 0
property int value: defaultValue
property int minimum: 0
property int maximum: 100
property string startIcon: ""
property string endIcon: ""
property alias leftIcon: root.startIcon // ! TODO deprecate me after 1.7 release
property alias rightIcon: root.endIcon // ! TODO deprecate me after 1.7 release
property bool iconsClickable: false
property string unit: ""
width: parent.width
spacing: Theme.spacingS
function loadValue() {
const settings = QmlUtils.findSettings(root.parent);
if (settings && settings.pluginService) {
value = settings.loadValue(settingKey, defaultValue);
}
}
Component.onCompleted: {
loadValue();
}
onValueChanged: {
const settings = QmlUtils.findSettings(root.parent);
if (settings) {
settings.saveValue(settingKey, value);
}
}
StyledText {
text: root.label
font.pixelSize: Theme.fontSizeMedium
font.weight: Theme.fontWeightMedium
color: Theme.surfaceText
}
StyledText {
text: root.description
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
width: parent.width
wrapMode: Text.WordWrap
visible: root.description !== ""
}
DankSlider {
width: parent.width
value: root.value
minimum: root.minimum
maximum: root.maximum
startIcon: root.startIcon
endIcon: root.endIcon
iconsClickable: root.iconsClickable
unit: root.unit
wheelEnabled: false
thumbOutlineColor: Theme.withAlpha(Theme.cardSurface, Theme.popupTransparency)
onSliderValueChanged: newValue => {
root.value = newValue;
}
}
}