mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-07 05:55:37 -05:00
dankslider: tooltip with value
This commit is contained in:
@@ -671,6 +671,55 @@ PanelWindow {
|
|||||||
visible: root.currentTab === "display"
|
visible: root.currentTab === "display"
|
||||||
spacing: Theme.spacingL
|
spacing: Theme.spacingL
|
||||||
|
|
||||||
|
property var brightnessDebounceTimer: Timer {
|
||||||
|
interval: BrightnessService.ddcAvailable ? 500 : 50
|
||||||
|
repeat: false
|
||||||
|
property int pendingValue: 0
|
||||||
|
onTriggered: {
|
||||||
|
BrightnessService.setBrightness(pendingValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Brightness Control
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
visible: BrightnessService.brightnessAvailable
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "Brightness"
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
|
||||||
|
DankSlider {
|
||||||
|
width: parent.width
|
||||||
|
height: 24
|
||||||
|
value: BrightnessService.brightnessLevel
|
||||||
|
leftIcon: "brightness_low"
|
||||||
|
rightIcon: "brightness_high"
|
||||||
|
enabled: BrightnessService.brightnessAvailable
|
||||||
|
showValue: true
|
||||||
|
onSliderValueChanged: function(newValue) {
|
||||||
|
parent.parent.brightnessDebounceTimer.pendingValue = newValue;
|
||||||
|
parent.parent.brightnessDebounceTimer.restart();
|
||||||
|
}
|
||||||
|
onSliderDragFinished: function(finalValue) {
|
||||||
|
parent.parent.brightnessDebounceTimer.stop();
|
||||||
|
BrightnessService.setBrightness(finalValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "ddc changes can be slow to respond"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
visible: BrightnessService.ddcAvailable && !BrightnessService.laptopBacklightAvailable
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DankToggle {
|
DankToggle {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
text: "Night Mode"
|
text: "Night Mode"
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ ScrollView {
|
|||||||
minimum: 0
|
minimum: 0
|
||||||
maximum: 100
|
maximum: 100
|
||||||
unit: ""
|
unit: ""
|
||||||
showValue: false
|
showValue: true
|
||||||
onSliderValueChanged: (newValue) => {
|
onSliderValueChanged: (newValue) => {
|
||||||
Prefs.setTopBarTransparency(newValue / 100);
|
Prefs.setTopBarTransparency(newValue / 100);
|
||||||
}
|
}
|
||||||
@@ -170,7 +170,7 @@ ScrollView {
|
|||||||
minimum: 0
|
minimum: 0
|
||||||
maximum: 100
|
maximum: 100
|
||||||
unit: ""
|
unit: ""
|
||||||
showValue: false
|
showValue: true
|
||||||
onSliderValueChanged: (newValue) => {
|
onSliderValueChanged: (newValue) => {
|
||||||
Prefs.setPopupTransparency(newValue / 100);
|
Prefs.setPopupTransparency(newValue / 100);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ ScrollView {
|
|||||||
maximum: 100
|
maximum: 100
|
||||||
value: Math.round(Prefs.osLogoBrightness * 100)
|
value: Math.round(Prefs.osLogoBrightness * 100)
|
||||||
unit: ""
|
unit: ""
|
||||||
showValue: false
|
showValue: true
|
||||||
onSliderValueChanged: (newValue) => {
|
onSliderValueChanged: (newValue) => {
|
||||||
Prefs.setOSLogoBrightness(newValue / 100);
|
Prefs.setOSLogoBrightness(newValue / 100);
|
||||||
}
|
}
|
||||||
@@ -313,7 +313,7 @@ ScrollView {
|
|||||||
maximum: 200
|
maximum: 200
|
||||||
value: Math.round(Prefs.osLogoContrast * 100)
|
value: Math.round(Prefs.osLogoContrast * 100)
|
||||||
unit: ""
|
unit: ""
|
||||||
showValue: false
|
showValue: true
|
||||||
onSliderValueChanged: (newValue) => {
|
onSliderValueChanged: (newValue) => {
|
||||||
Prefs.setOSLogoContrast(newValue / 100);
|
Prefs.setOSLogoContrast(newValue / 100);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,28 +18,13 @@ Item {
|
|||||||
signal sliderValueChanged(int newValue)
|
signal sliderValueChanged(int newValue)
|
||||||
signal sliderDragFinished(int finalValue)
|
signal sliderDragFinished(int finalValue)
|
||||||
|
|
||||||
height: 80
|
height: 40
|
||||||
|
|
||||||
Column {
|
|
||||||
anchors.fill: parent
|
|
||||||
spacing: Theme.spacingM
|
|
||||||
|
|
||||||
// Value display
|
|
||||||
StyledText {
|
|
||||||
text: slider.value + slider.unit
|
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
|
||||||
color: slider.enabled ? Theme.surfaceText : Theme.surfaceVariantText
|
|
||||||
font.weight: Font.Medium
|
|
||||||
visible: slider.showValue
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
// Slider row
|
|
||||||
Row {
|
Row {
|
||||||
|
anchors.centerIn: parent
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: Theme.spacingM
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
// Left icon
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: slider.leftIcon
|
name: slider.leftIcon
|
||||||
size: Theme.iconSize
|
size: Theme.iconSize
|
||||||
@@ -48,7 +33,6 @@ Item {
|
|||||||
visible: slider.leftIcon.length > 0
|
visible: slider.leftIcon.length > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slider track
|
|
||||||
StyledRect {
|
StyledRect {
|
||||||
id: sliderTrack
|
id: sliderTrack
|
||||||
|
|
||||||
@@ -61,7 +45,6 @@ Item {
|
|||||||
color: slider.enabled ? Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.1)
|
color: slider.enabled ? Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.1)
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
// Fill
|
|
||||||
StyledRect {
|
StyledRect {
|
||||||
id: sliderFill
|
id: sliderFill
|
||||||
|
|
||||||
@@ -75,12 +58,9 @@ Item {
|
|||||||
duration: Theme.shortDuration
|
duration: Theme.shortDuration
|
||||||
easing.type: Theme.standardEasing
|
easing.type: Theme.standardEasing
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draggable handle
|
|
||||||
StyledRect {
|
StyledRect {
|
||||||
id: sliderHandle
|
id: sliderHandle
|
||||||
|
|
||||||
@@ -94,7 +74,6 @@ Item {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
scale: sliderMouseArea.containsMouse || sliderMouseArea.pressed ? 1.2 : 1
|
scale: sliderMouseArea.containsMouse || sliderMouseArea.pressed ? 1.2 : 1
|
||||||
|
|
||||||
// Handle glow effect when active
|
|
||||||
StyledRect {
|
StyledRect {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: parent.width + 4
|
width: parent.width + 4
|
||||||
@@ -111,9 +90,39 @@ Item {
|
|||||||
duration: Theme.shortDuration
|
duration: Theme.shortDuration
|
||||||
easing.type: Theme.standardEasing
|
easing.type: Theme.standardEasing
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
id: valueTooltip
|
||||||
|
width: tooltipText.contentWidth + Theme.spacingS * 2
|
||||||
|
height: tooltipText.contentHeight + Theme.spacingXS * 2
|
||||||
|
radius: Theme.cornerRadiusSmall
|
||||||
|
color: Theme.surfaceContainer
|
||||||
|
border.color: Theme.outline
|
||||||
|
border.width: 1
|
||||||
|
anchors.bottom: parent.top
|
||||||
|
anchors.bottomMargin: Theme.spacingS
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
visible: (sliderMouseArea.containsMouse && slider.showValue) || (slider.isDragging && slider.showValue)
|
||||||
|
opacity: visible ? 1 : 0
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: tooltipText
|
||||||
|
text: slider.value + slider.unit
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
anchors.centerIn: parent
|
||||||
|
font.hintingPreference: Font.PreferFullHinting
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
easing.type: Theme.standardEasing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@@ -127,6 +136,8 @@ Item {
|
|||||||
property bool isDragging: false
|
property bool isDragging: false
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
anchors.topMargin: -10
|
||||||
|
anchors.bottomMargin: -10
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: slider.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
cursorShape: slider.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
enabled: slider.enabled
|
enabled: slider.enabled
|
||||||
@@ -166,7 +177,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Global mouse area for drag tracking
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: sliderGlobalMouseArea
|
id: sliderGlobalMouseArea
|
||||||
|
|
||||||
@@ -191,12 +201,9 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Right icon
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: slider.rightIcon
|
name: slider.rightIcon
|
||||||
size: Theme.iconSize
|
size: Theme.iconSize
|
||||||
@@ -204,9 +211,6 @@ Item {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
visible: slider.rightIcon.length > 0
|
visible: slider.rightIcon.length > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user