mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-12 16:52:10 -04:00
feat: configurable volume amount on scroll for Media widget (#1641)
* Add audioWheelScrollAmount setting * Add UI to configure volume change amount for Media Player widget * Let Media Player widget use the configured volume change on wheel event
This commit is contained in:
@@ -270,6 +270,7 @@ Singleton {
|
|||||||
property bool scrollTitleEnabled: true
|
property bool scrollTitleEnabled: true
|
||||||
property bool audioVisualizerEnabled: true
|
property bool audioVisualizerEnabled: true
|
||||||
property string audioScrollMode: "volume"
|
property string audioScrollMode: "volume"
|
||||||
|
property int audioWheelScrollAmount: 5
|
||||||
property bool clockCompactMode: false
|
property bool clockCompactMode: false
|
||||||
property bool focusedWindowCompactMode: false
|
property bool focusedWindowCompactMode: false
|
||||||
property bool runningAppsCompactMode: true
|
property bool runningAppsCompactMode: true
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ var SPEC = {
|
|||||||
scrollTitleEnabled: { def: true },
|
scrollTitleEnabled: { def: true },
|
||||||
audioVisualizerEnabled: { def: true },
|
audioVisualizerEnabled: { def: true },
|
||||||
audioScrollMode: { def: "volume" },
|
audioScrollMode: { def: "volume" },
|
||||||
|
audioWheelScrollAmount: { def: 5 },
|
||||||
clockCompactMode: { def: false },
|
clockCompactMode: { def: false },
|
||||||
focusedWindowCompactMode: { def: false },
|
focusedWindowCompactMode: { def: false },
|
||||||
runningAppsCompactMode: { def: true },
|
runningAppsCompactMode: { def: true },
|
||||||
|
|||||||
@@ -71,9 +71,9 @@ BasePill {
|
|||||||
let newVolume = currentVolume;
|
let newVolume = currentVolume;
|
||||||
if (isMouseWheelY) {
|
if (isMouseWheelY) {
|
||||||
if (deltaY > 0) {
|
if (deltaY > 0) {
|
||||||
newVolume = Math.min(100, currentVolume + 5);
|
newVolume = Math.min(100, currentVolume + SettingsData.audioWheelScrollAmount);
|
||||||
} else if (deltaY < 0) {
|
} else if (deltaY < 0) {
|
||||||
newVolume = Math.max(0, currentVolume - 5);
|
newVolume = Math.max(0, currentVolume - SettingsData.audioWheelScrollAmount);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
scrollAccumulatorY += deltaY;
|
scrollAccumulatorY += deltaY;
|
||||||
|
|||||||
@@ -65,6 +65,47 @@ Item {
|
|||||||
SettingsData.set("audioScrollMode", scrollOptsInternal[idx]);
|
SettingsData.set("audioScrollMode", scrollOptsInternal[idx]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: parent.width
|
||||||
|
height: audioWheelScrollAmountColumn.height
|
||||||
|
visible: SettingsData.audioScrollMode == "volume"
|
||||||
|
opacity: visible ? 1 : 0
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: audioWheelScrollAmountColumn
|
||||||
|
x: Theme.spacingL
|
||||||
|
width: 120
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Adjust volume per scroll indent")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
horizontalAlignment: Text.AlignLeft
|
||||||
|
}
|
||||||
|
|
||||||
|
DankTextField {
|
||||||
|
width: 100
|
||||||
|
height: 28
|
||||||
|
placeholderText: "5"
|
||||||
|
text: SettingsData.audioWheelScrollAmount
|
||||||
|
maximumLength: 2
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
topPadding: Theme.spacingXS
|
||||||
|
bottomPadding: Theme.spacingXS
|
||||||
|
onEditingFinished: SettingsData.set("audioWheelScrollAmount", parseInt(text, 10))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.mediumDuration
|
||||||
|
easing.type: Theme.emphasizedEasing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user