Add BrightnessTab
This commit is contained in:
parent
9832d3d9bd
commit
51e758a888
6 changed files with 274 additions and 12 deletions
|
|
@ -75,6 +75,7 @@ Singleton {
|
|||
property bool showActiveWindow: true
|
||||
property bool showSystemInfo: false
|
||||
property bool showMedia: false
|
||||
property bool hideBrightness: false
|
||||
property list<string> monitors: []
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ Item {
|
|||
|
||||
width: pill.width
|
||||
height: pill.height
|
||||
visible: !Settings.data.bar.hideBrightness
|
||||
|
||||
// Used to avoid opening the pill on Quickshell startup
|
||||
property bool firstBrightnessReceived: false
|
||||
|
|
@ -67,7 +68,7 @@ Item {
|
|||
}
|
||||
}
|
||||
onClicked: {
|
||||
settingsPanel.requestedTab = SettingsPanel.Tab.Display
|
||||
settingsPanel.requestedTab = SettingsPanel.Tab.Brightness
|
||||
settingsPanel.isLoaded = true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ NLoader {
|
|||
About,
|
||||
AudioService,
|
||||
Bar,
|
||||
Brightness,
|
||||
ColorScheme,
|
||||
Display,
|
||||
General,
|
||||
|
|
@ -76,6 +77,10 @@ NLoader {
|
|||
id: audioTab
|
||||
Tabs.AudioTab {}
|
||||
}
|
||||
Component {
|
||||
id: brightnessTab
|
||||
Tabs.BrightnessTab {}
|
||||
}
|
||||
Component {
|
||||
id: displayTab
|
||||
Tabs.DisplayTab {}
|
||||
|
|
@ -121,9 +126,14 @@ NLoader {
|
|||
"source": barTab
|
||||
}, {
|
||||
"id": SettingsPanel.Tab.AudioService,
|
||||
"label": "AudioService",
|
||||
"label": "Audio",
|
||||
"icon": "volume_up",
|
||||
"source": audioTab
|
||||
}, {
|
||||
"id": SettingsPanel.Tab.Brightness,
|
||||
"label": "Brightness",
|
||||
"icon": "brightness_6",
|
||||
"source": brightnessTab
|
||||
}, {
|
||||
"id": SettingsPanel.Tab.Display,
|
||||
"label": "Display",
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ ColumnLayout {
|
|||
Layout.fillWidth: true
|
||||
|
||||
NText {
|
||||
text: "AudioService"
|
||||
text: "Audio"
|
||||
font.pointSize: Style.fontSizeXL * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
color: Colors.mOnSurface
|
||||
|
|
@ -145,7 +145,7 @@ ColumnLayout {
|
|||
Layout.fillWidth: true
|
||||
|
||||
NText {
|
||||
text: "AudioService Devices"
|
||||
text: "Audio Devices"
|
||||
font.pointSize: Style.fontSizeXL * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
color: Colors.mOnSurface
|
||||
|
|
@ -243,7 +243,7 @@ ColumnLayout {
|
|||
Layout.fillWidth: true
|
||||
|
||||
NText {
|
||||
text: "AudioService Visualizer"
|
||||
text: "Audio Visualizer"
|
||||
font.pointSize: Style.fontSizeXL * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
color: Colors.mOnSurface
|
||||
|
|
|
|||
250
Modules/SettingsPanel/Tabs/BrightnessTab.qml
Normal file
250
Modules/SettingsPanel/Tabs/BrightnessTab.qml
Normal file
|
|
@ -0,0 +1,250 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import Quickshell
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
Item {
|
||||
property real scaling: 1
|
||||
readonly property string tabIcon: "brightness_6"
|
||||
readonly property string tabLabel: "Brightness"
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
ScrollView {
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||
ScrollBar.horizontal.policy: ScrollBar.AsNeeded
|
||||
contentWidth: parent.width
|
||||
|
||||
ColumnLayout {
|
||||
width: parent.width
|
||||
ColumnLayout {
|
||||
spacing: Style.marginLarge * scaling
|
||||
Layout.margins: Style.marginLarge * scaling
|
||||
Layout.fillWidth: true
|
||||
|
||||
NText {
|
||||
text: "Brightness Settings"
|
||||
font.pointSize: Style.fontSizeXL * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
color: Colors.mOnSurface
|
||||
}
|
||||
|
||||
NText {
|
||||
text: "Configure brightness controls and monitor settings."
|
||||
font.pointSize: Style.fontSize * scaling
|
||||
color: Colors.mOnSurfaceVariant
|
||||
}
|
||||
|
||||
// Bar Visibility Section
|
||||
ColumnLayout {
|
||||
spacing: Style.marginSmall * scaling
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: Style.marginLarge * scaling
|
||||
|
||||
NText {
|
||||
text: "Bar Integration"
|
||||
font.pointSize: Style.fontSizeLarge * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
color: Colors.mOnSurface
|
||||
}
|
||||
|
||||
NToggle {
|
||||
label: "Show Brightness Icon"
|
||||
description: "Display the brightness control icon in the top bar"
|
||||
checked: !Settings.data.bar.hideBrightness
|
||||
onToggled: checked => {
|
||||
Settings.data.bar.hideBrightness = !checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: Style.marginLarge * scaling
|
||||
Layout.bottomMargin: Style.marginLarge * scaling
|
||||
}
|
||||
|
||||
// Brightness Step Section
|
||||
ColumnLayout {
|
||||
spacing: Style.marginSmall * scaling
|
||||
Layout.fillWidth: true
|
||||
|
||||
NText {
|
||||
text: "Brightness Step Size"
|
||||
font.pointSize: Style.fontSizeLarge * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
color: Colors.mOnSurface
|
||||
}
|
||||
|
||||
NText {
|
||||
text: "Adjust the step size for brightness changes (scroll wheel, keyboard shortcuts)"
|
||||
font.pointSize: Style.fontSizeSmall * scaling
|
||||
color: Colors.mOnSurfaceVariant
|
||||
wrapMode: Text.WordWrap
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginMedium * scaling
|
||||
|
||||
NSlider {
|
||||
Layout.fillWidth: true
|
||||
from: 1
|
||||
to: 50
|
||||
value: Settings.data.brightness.brightnessStep
|
||||
stepSize: 1
|
||||
onPressedChanged: {
|
||||
if (!pressed) {
|
||||
Settings.data.brightness.brightnessStep = value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NText {
|
||||
text: Settings.data.brightness.brightnessStep + "%"
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
color: Colors.mOnSurface
|
||||
font.pointSize: Style.fontSizeMedium * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: Style.marginLarge * scaling
|
||||
Layout.bottomMargin: Style.marginLarge * scaling
|
||||
}
|
||||
|
||||
// Monitor Overview Section
|
||||
ColumnLayout {
|
||||
spacing: Style.marginSmall * scaling
|
||||
Layout.fillWidth: true
|
||||
|
||||
NText {
|
||||
text: "Monitor Brightness Overview"
|
||||
font.pointSize: Style.fontSizeLarge * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
color: Colors.mOnSurface
|
||||
}
|
||||
|
||||
NText {
|
||||
text: "Current brightness levels for all detected monitors"
|
||||
font.pointSize: Style.fontSizeSmall * scaling
|
||||
color: Colors.mOnSurfaceVariant
|
||||
wrapMode: Text.WordWrap
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
// Single monitor display using the same data source as the bar icon
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
radius: Style.radiusMedium * scaling
|
||||
color: Colors.mSurface
|
||||
border.color: Colors.mOutline
|
||||
border.width: Math.max(1, Style.borderThin * scaling)
|
||||
implicitHeight: contentCol.implicitHeight + Style.marginXL * 2 * scaling
|
||||
|
||||
ColumnLayout {
|
||||
id: contentCol
|
||||
anchors.fill: parent
|
||||
anchors.margins: Style.marginLarge * scaling
|
||||
spacing: Style.marginMedium * scaling
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginMedium * scaling
|
||||
|
||||
NText {
|
||||
text: "Primary Monitor"
|
||||
font.pointSize: Style.fontSizeLarge * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
color: Colors.mSecondary
|
||||
}
|
||||
|
||||
Item { Layout.fillWidth: true }
|
||||
|
||||
NText {
|
||||
text: BrightnessService.currentMethod === "ddcutil" ? "External (DDC)" : "Internal"
|
||||
font.pointSize: Style.fontSizeSmall * scaling
|
||||
color: Colors.mOnSurfaceVariant
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginMedium * scaling
|
||||
|
||||
NText {
|
||||
text: "Brightness:"
|
||||
font.pointSize: Style.fontSizeMedium * scaling
|
||||
color: Colors.mOnSurface
|
||||
}
|
||||
|
||||
NSlider {
|
||||
Layout.fillWidth: true
|
||||
from: 0
|
||||
to: 100
|
||||
value: BrightnessService.brightness
|
||||
stepSize: 1
|
||||
enabled: BrightnessService.available
|
||||
onPressedChanged: {
|
||||
if (!pressed && BrightnessService.available) {
|
||||
BrightnessService.setBrightness(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NText {
|
||||
text: BrightnessService.available ? Math.round(BrightnessService.brightness) + "%" : "N/A"
|
||||
font.pointSize: Style.fontSizeMedium * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
color: BrightnessService.available ? Colors.mPrimary : Colors.mOnSurfaceVariant
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginMedium * scaling
|
||||
|
||||
NText {
|
||||
text: "Method:"
|
||||
font.pointSize: Style.fontSizeSmall * scaling
|
||||
color: Colors.mOnSurfaceVariant
|
||||
}
|
||||
|
||||
NText {
|
||||
text: BrightnessService.currentMethod || "Unknown"
|
||||
font.pointSize: Style.fontSizeSmall * scaling
|
||||
color: Colors.mOnSurface
|
||||
Layout.alignment: Qt.AlignLeft
|
||||
}
|
||||
|
||||
Item { Layout.fillWidth: true }
|
||||
|
||||
NText {
|
||||
text: BrightnessService.available ? "Available" : "Unavailable"
|
||||
font.pointSize: Style.fontSizeSmall * scaling
|
||||
color: BrightnessService.available ? Colors.mPrimary : Colors.mError
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -207,23 +207,23 @@ ColumnLayout {
|
|||
Layout.bottomMargin: Style.marginLarge * scaling
|
||||
}
|
||||
|
||||
// AudioService Settings
|
||||
// Audio Settings
|
||||
ColumnLayout {
|
||||
spacing: Style.marginLarge * scaling
|
||||
Layout.fillWidth: true
|
||||
|
||||
NText {
|
||||
text: "AudioService Settings"
|
||||
text: "Audio Settings"
|
||||
font.pointSize: Style.fontSizeXL * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
color: Colors.mOnSurface
|
||||
Layout.bottomMargin: Style.marginSmall * scaling
|
||||
}
|
||||
|
||||
// AudioService Source
|
||||
// Audio Source
|
||||
NComboBox {
|
||||
label: "AudioService Source"
|
||||
description: "AudioService source to capture during recording"
|
||||
label: "Audio Source"
|
||||
description: "Audio source to capture during recording"
|
||||
model: ListModel {
|
||||
ListElement {
|
||||
key: "default_output"
|
||||
|
|
@ -244,9 +244,9 @@ ColumnLayout {
|
|||
}
|
||||
}
|
||||
|
||||
// AudioService Codec
|
||||
// Audio Codec
|
||||
NComboBox {
|
||||
label: "AudioService Codec"
|
||||
label: "Audio Codec"
|
||||
description: "Opus is recommended for best performance and smallest audio size"
|
||||
model: ListModel {
|
||||
ListElement {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue