mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-13 00:42:49 -05:00
qmlfmt with 4 space
This commit is contained in:
@@ -34,12 +34,9 @@ Item {
|
||||
width: parent.width
|
||||
sourceComponent: settingsComponent
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Component {
|
||||
id: brightnessComponent
|
||||
|
||||
@@ -62,57 +59,62 @@ Item {
|
||||
visible: BrightnessService.devices.length > 1
|
||||
text: "Device"
|
||||
description: {
|
||||
const deviceInfo = BrightnessService.getCurrentDeviceInfo();
|
||||
const deviceInfo = BrightnessService.getCurrentDeviceInfo()
|
||||
if (deviceInfo && deviceInfo.class === "ddc") {
|
||||
return "DDC changes can be slow and unreliable";
|
||||
return "DDC changes can be slow and unreliable"
|
||||
}
|
||||
return "";
|
||||
return ""
|
||||
}
|
||||
currentValue: BrightnessService.currentDevice
|
||||
options: BrightnessService.devices.map(function(d) {
|
||||
return d.name;
|
||||
options: BrightnessService.devices.map(function (d) {
|
||||
return d.name
|
||||
})
|
||||
optionIcons: BrightnessService.devices.map(function(d) {
|
||||
optionIcons: BrightnessService.devices.map(function (d) {
|
||||
if (d.class === "backlight")
|
||||
return "desktop_windows";
|
||||
|
||||
return "desktop_windows"
|
||||
|
||||
if (d.class === "ddc")
|
||||
return "tv";
|
||||
return "tv"
|
||||
|
||||
if (d.name.includes("kbd"))
|
||||
return "keyboard";
|
||||
return "keyboard"
|
||||
|
||||
return "lightbulb";
|
||||
return "lightbulb"
|
||||
})
|
||||
onValueChanged: function(value) {
|
||||
BrightnessService.setCurrentDevice(value, true);
|
||||
onValueChanged: function (value) {
|
||||
BrightnessService.setCurrentDevice(value, true)
|
||||
}
|
||||
|
||||
|
||||
Connections {
|
||||
target: BrightnessService
|
||||
function onDevicesChanged() {
|
||||
if (BrightnessService.currentDevice) {
|
||||
deviceDropdown.currentValue = BrightnessService.currentDevice;
|
||||
deviceDropdown.currentValue = BrightnessService.currentDevice
|
||||
}
|
||||
|
||||
|
||||
// Check if saved device is now available
|
||||
const lastDevice = SessionData.lastBrightnessDevice || "";
|
||||
const lastDevice = SessionData.lastBrightnessDevice
|
||||
|| ""
|
||||
if (lastDevice) {
|
||||
const deviceExists = BrightnessService.devices.some(d => d.name === lastDevice);
|
||||
if (deviceExists && (!BrightnessService.currentDevice || BrightnessService.currentDevice !== lastDevice)) {
|
||||
BrightnessService.setCurrentDevice(lastDevice, false);
|
||||
const deviceExists = BrightnessService.devices.some(
|
||||
d => d.name === lastDevice)
|
||||
if (deviceExists
|
||||
&& (!BrightnessService.currentDevice
|
||||
|| BrightnessService.currentDevice !== lastDevice)) {
|
||||
BrightnessService.setCurrentDevice(lastDevice,
|
||||
false)
|
||||
}
|
||||
}
|
||||
}
|
||||
function onDeviceSwitched() {
|
||||
// Force update the description when device switches
|
||||
deviceDropdown.description = Qt.binding(function() {
|
||||
const deviceInfo = BrightnessService.getCurrentDeviceInfo();
|
||||
deviceDropdown.description = Qt.binding(function () {
|
||||
const deviceInfo = BrightnessService.getCurrentDeviceInfo()
|
||||
if (deviceInfo && deviceInfo.class === "ddc") {
|
||||
return "DDC changes can be slow and unreliable";
|
||||
return "DDC changes can be slow and unreliable"
|
||||
}
|
||||
return "";
|
||||
});
|
||||
return ""
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,31 +125,31 @@ Item {
|
||||
value: BrightnessService.brightnessLevel
|
||||
leftIcon: "brightness_low"
|
||||
rightIcon: "brightness_high"
|
||||
enabled: BrightnessService.brightnessAvailable && BrightnessService.isCurrentDeviceReady()
|
||||
enabled: BrightnessService.brightnessAvailable
|
||||
&& BrightnessService.isCurrentDeviceReady()
|
||||
opacity: BrightnessService.isCurrentDeviceReady() ? 1.0 : 0.5
|
||||
onSliderValueChanged: function(newValue) {
|
||||
brightnessDebounceTimer.pendingValue = newValue;
|
||||
brightnessDebounceTimer.restart();
|
||||
onSliderValueChanged: function (newValue) {
|
||||
brightnessDebounceTimer.pendingValue = newValue
|
||||
brightnessDebounceTimer.restart()
|
||||
}
|
||||
onSliderDragFinished: function(finalValue) {
|
||||
brightnessDebounceTimer.stop();
|
||||
BrightnessService.setBrightnessInternal(finalValue, BrightnessService.currentDevice);
|
||||
onSliderDragFinished: function (finalValue) {
|
||||
brightnessDebounceTimer.stop()
|
||||
BrightnessService.setBrightnessInternal(
|
||||
finalValue, BrightnessService.currentDevice)
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: BrightnessService
|
||||
function onBrightnessChanged() {
|
||||
brightnessSlider.value = BrightnessService.brightnessLevel;
|
||||
brightnessSlider.value = BrightnessService.brightnessLevel
|
||||
}
|
||||
|
||||
|
||||
function onDeviceSwitched() {
|
||||
brightnessSlider.value = BrightnessService.brightnessLevel;
|
||||
brightnessSlider.value = BrightnessService.brightnessLevel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Component {
|
||||
@@ -172,7 +174,11 @@ Item {
|
||||
width: (parent.width - Theme.spacingM) / 2
|
||||
height: 80
|
||||
radius: Theme.cornerRadius
|
||||
color: BrightnessService.nightModeActive ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : (nightModeToggle.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08))
|
||||
color: BrightnessService.nightModeActive ? Qt.rgba(
|
||||
Theme.primary.r,
|
||||
Theme.primary.g,
|
||||
Theme.primary.b,
|
||||
0.12) : (nightModeToggle.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08))
|
||||
border.color: BrightnessService.nightModeActive ? Theme.primary : "transparent"
|
||||
border.width: BrightnessService.nightModeActive ? 1 : 0
|
||||
|
||||
@@ -194,7 +200,6 @@ Item {
|
||||
font.weight: Font.Medium
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
@@ -204,17 +209,20 @@ Item {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
BrightnessService.toggleNightMode();
|
||||
BrightnessService.toggleNightMode()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: (parent.width - Theme.spacingM) / 2
|
||||
height: 80
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.isLightMode ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : (lightModeToggle.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08))
|
||||
color: Theme.isLightMode ? Qt.rgba(
|
||||
Theme.primary.r,
|
||||
Theme.primary.g,
|
||||
Theme.primary.b,
|
||||
0.12) : (lightModeToggle.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08))
|
||||
border.color: Theme.isLightMode ? Theme.primary : "transparent"
|
||||
border.width: Theme.isLightMode ? 1 : 0
|
||||
|
||||
@@ -236,7 +244,6 @@ Item {
|
||||
font.weight: Font.Medium
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
@@ -246,7 +253,7 @@ Item {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
Theme.toggleLightMode();
|
||||
Theme.toggleLightMode()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,15 +262,10 @@ Item {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
brightnessDebounceTimer: Timer {
|
||||
@@ -271,13 +273,13 @@ Item {
|
||||
|
||||
interval: {
|
||||
// Use longer interval for DDC devices since ddcutil is slow
|
||||
const deviceInfo = BrightnessService.getCurrentDeviceInfo();
|
||||
return (deviceInfo && deviceInfo.class === "ddc") ? 100 : 50;
|
||||
const deviceInfo = BrightnessService.getCurrentDeviceInfo()
|
||||
return (deviceInfo && deviceInfo.class === "ddc") ? 100 : 50
|
||||
}
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
BrightnessService.setBrightnessInternal(pendingValue, BrightnessService.currentDevice);
|
||||
BrightnessService.setBrightnessInternal(
|
||||
pendingValue, BrightnessService.currentDevice)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user