From 0562dbbbf9213da32727e9278513227d34911ffe Mon Sep 17 00:00:00 2001 From: LemmyCook Date: Thu, 28 Aug 2025 06:57:37 -0400 Subject: [PATCH] Settings: more cleanup and conditionnal controls (NightLight) + Auto formatting --- Modules/Notification/Notification.qml | 6 +- Modules/SettingsPanel/Tabs/AboutTab.qml | 339 ++++++------ Modules/SettingsPanel/Tabs/AudioTab.qml | 2 + Modules/SettingsPanel/Tabs/BarTab.qml | 1 + Modules/SettingsPanel/Tabs/BrightnessTab.qml | 5 +- Modules/SettingsPanel/Tabs/ColorSchemeTab.qml | 14 +- Modules/SettingsPanel/Tabs/DisplayTab.qml | 486 +++++++++--------- Modules/SettingsPanel/Tabs/GeneralTab.qml | 1 + Modules/SettingsPanel/Tabs/LauncherTab.qml | 1 + Modules/SettingsPanel/Tabs/NetworkTab.qml | 1 + .../SettingsPanel/Tabs/ScreenRecorderTab.qml | 2 + Modules/SettingsPanel/Tabs/TimeWeatherTab.qml | 1 + .../Tabs/WallpaperSelectorTab.qml | 5 +- Modules/SettingsPanel/Tabs/WallpaperTab.qml | 1 + 14 files changed, 434 insertions(+), 431 deletions(-) diff --git a/Modules/Notification/Notification.qml b/Modules/Notification/Notification.qml index 4a2b47f..e293622 100644 --- a/Modules/Notification/Notification.qml +++ b/Modules/Notification/Notification.qml @@ -25,8 +25,10 @@ Variants { property var removingNotifications: ({}) // If no notification display activated in settings, then show them all - active: Settings.isLoaded && modelData && (NotificationService.notificationModel.count > 0) ? (Settings.data.notifications.monitors.includes(modelData.name) - || (Settings.data.notifications.monitors.length === 0)) : false + active: Settings.isLoaded && modelData + && (NotificationService.notificationModel.count > 0) ? (Settings.data.notifications.monitors.includes( + modelData.name) + || (Settings.data.notifications.monitors.length === 0)) : false visible: (NotificationService.notificationModel.count > 0) diff --git a/Modules/SettingsPanel/Tabs/AboutTab.qml b/Modules/SettingsPanel/Tabs/AboutTab.qml index bc02641..876c1c0 100644 --- a/Modules/SettingsPanel/Tabs/AboutTab.qml +++ b/Modules/SettingsPanel/Tabs/AboutTab.qml @@ -9,7 +9,7 @@ import qs.Services import qs.Widgets ColumnLayout { - id: root + id: root property string latestVersion: GitHubService.latestVersion property string currentVersion: "Unknown" // Fallback version @@ -37,199 +37,196 @@ ColumnLayout { } } + NText { + text: "Noctalia Shell" + font.pointSize: Style.fontSizeXXXL * scaling + font.weight: Style.fontWeightBold + color: Color.mOnSurface + Layout.alignment: Qt.AlignCenter + Layout.bottomMargin: Style.marginS * scaling + } + + GridLayout { + Layout.alignment: Qt.AlignCenter + columns: 2 + rowSpacing: Style.marginXS * scaling + columnSpacing: Style.marginS * scaling + + NText { + text: "Latest Version:" + color: Color.mOnSurface + Layout.alignment: Qt.AlignRight + } + + NText { + text: root.latestVersion + color: Color.mOnSurface + font.weight: Style.fontWeightBold + } + + NText { + text: "Installed Version:" + color: Color.mOnSurface + Layout.alignment: Qt.AlignRight + } + + NText { + text: root.currentVersion + color: Color.mOnSurface + font.weight: Style.fontWeightBold + } + } + + Rectangle { + Layout.alignment: Qt.AlignCenter + Layout.topMargin: Style.marginS * scaling + Layout.preferredWidth: updateText.implicitWidth + 46 * scaling + Layout.preferredHeight: Style.barHeight * scaling + radius: Style.radiusL * scaling + color: updateArea.containsMouse ? Color.mPrimary : Color.transparent + border.color: Color.mPrimary + border.width: Math.max(1, Style.borderS * scaling) + visible: { + if (root.currentVersion === "Unknown" || root.latestVersion === "Unknown") + return false + + const latest = root.latestVersion.replace("v", "").split(".") + const current = root.currentVersion.replace("v", "").split(".") + for (var i = 0; i < Math.max(latest.length, current.length); i++) { + const l = parseInt(latest[i] || "0") + const c = parseInt(current[i] || "0") + if (l > c) + return true + + if (l < c) + return false + } + return false + } + + RowLayout { + anchors.centerIn: parent + spacing: Style.marginS * scaling + + NIcon { + text: "system_update" + font.pointSize: Style.fontSizeXXL * scaling + color: updateArea.containsMouse ? Color.mSurface : Color.mPrimary + } NText { - text: "Noctalia Shell" - font.pointSize: Style.fontSizeXXXL * scaling - font.weight: Style.fontWeightBold - color: Color.mOnSurface - Layout.alignment: Qt.AlignCenter - Layout.bottomMargin: Style.marginS * scaling + id: updateText + text: "Download latest release" + font.pointSize: Style.fontSizeL * scaling + color: updateArea.containsMouse ? Color.mSurface : Color.mPrimary } + } - GridLayout { - Layout.alignment: Qt.AlignCenter - columns: 2 - rowSpacing: Style.marginXS * scaling - columnSpacing: Style.marginS * scaling + MouseArea { + id: updateArea - NText { - text: "Latest Version:" - color: Color.mOnSurface - Layout.alignment: Qt.AlignRight - } - - NText { - text: root.latestVersion - color: Color.mOnSurface - font.weight: Style.fontWeightBold - } - - NText { - text: "Installed Version:" - color: Color.mOnSurface - Layout.alignment: Qt.AlignRight - } - - NText { - text: root.currentVersion - color: Color.mOnSurface - font.weight: Style.fontWeightBold - } + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: { + Quickshell.execDetached(["xdg-open", "https://github.com/Ly-sec/Noctalia/releases/latest"]) } + } + } - Rectangle { - Layout.alignment: Qt.AlignCenter - Layout.topMargin: Style.marginS * scaling - Layout.preferredWidth: updateText.implicitWidth + 46 * scaling - Layout.preferredHeight: Style.barHeight * scaling + NDivider { + Layout.fillWidth: true + Layout.topMargin: Style.marginXL * scaling + Layout.bottomMargin: Style.marginxL * scaling + } + + NText { + text: `Shout-out to our ${root.contributors.length} awesome contributors!` + font.pointSize: Style.fontSizeL * scaling + font.weight: Style.fontWeightBold + color: Color.mOnSurface + Layout.alignment: Qt.AlignCenter + Layout.topMargin: Style.marginL * 2 + } + + ScrollView { + Layout.alignment: Qt.AlignCenter + Layout.preferredWidth: 200 * Style.marginXS * scaling + Layout.fillHeight: true + Layout.topMargin: Style.marginL * scaling + clip: true + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + ScrollBar.vertical.policy: ScrollBar.AsNeeded + + GridView { + id: contributorsGrid + + anchors.fill: parent + width: 200 * 4 * scaling + height: Math.ceil(root.contributors.length / 4) * 100 + cellWidth: Style.baseWidgetSize * 6.25 * scaling + cellHeight: Style.baseWidgetSize * 3.125 * scaling + model: root.contributors + + delegate: Rectangle { + width: contributorsGrid.cellWidth - Style.marginL * scaling + height: contributorsGrid.cellHeight - Style.marginXS * scaling radius: Style.radiusL * scaling - color: updateArea.containsMouse ? Color.mPrimary : Color.transparent - border.color: Color.mPrimary - border.width: Math.max(1, Style.borderS * scaling) - visible: { - if (root.currentVersion === "Unknown" || root.latestVersion === "Unknown") - return false - - const latest = root.latestVersion.replace("v", "").split(".") - const current = root.currentVersion.replace("v", "").split(".") - for (var i = 0; i < Math.max(latest.length, current.length); i++) { - const l = parseInt(latest[i] || "0") - const c = parseInt(current[i] || "0") - if (l > c) - return true - - if (l < c) - return false - } - return false - } + color: contributorArea.containsMouse ? Color.mSecondary : Color.transparent RowLayout { - anchors.centerIn: parent - spacing: Style.marginS * scaling + anchors.fill: parent + anchors.margins: Style.marginS * scaling + spacing: Style.marginM * scaling - NIcon { - text: "system_update" - font.pointSize: Style.fontSizeXXL * scaling - color: updateArea.containsMouse ? Color.mSurface : Color.mPrimary + Item { + Layout.alignment: Qt.AlignVCenter + Layout.preferredWidth: Style.baseWidgetSize * 2 * scaling + Layout.preferredHeight: Style.baseWidgetSize * 2 * scaling + + NImageCircled { + imagePath: modelData.avatar_url || "" + anchors.fill: parent + anchors.margins: Style.marginXS * scaling + fallbackIcon: "person" + borderColor: Color.mPrimary + borderWidth: Math.max(1, Style.borderM * scaling) + } } - NText { - id: updateText - text: "Download latest release" - font.pointSize: Style.fontSizeL * scaling - color: updateArea.containsMouse ? Color.mSurface : Color.mPrimary + ColumnLayout { + spacing: Style.marginXS * scaling + Layout.alignment: Qt.AlignVCenter + Layout.fillWidth: true + + NText { + text: modelData.login || "Unknown" + font.weight: Style.fontWeightBold + color: contributorArea.containsMouse ? Color.mSurface : Color.mOnSurface + elide: Text.ElideRight + Layout.fillWidth: true + } + + NText { + text: (modelData.contributions || 0) + " " + ((modelData.contributions || 0) === 1 ? "commit" : "commits") + font.pointSize: Style.fontSizeXS * scaling + color: contributorArea.containsMouse ? Color.mSurface : Color.mOnSurface + } } } MouseArea { - id: updateArea + id: contributorArea anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor onClicked: { - Quickshell.execDetached(["xdg-open", "https://github.com/Ly-sec/Noctalia/releases/latest"]) - } - } - } - - NDivider { - Layout.fillWidth: true - Layout.topMargin: Style.marginXL * scaling - Layout.bottomMargin: Style.marginxL * scaling - } - - NText { - text: `Shout-out to our ${root.contributors.length} awesome contributors!` - font.pointSize: Style.fontSizeL * scaling - font.weight: Style.fontWeightBold - color: Color.mOnSurface - Layout.alignment: Qt.AlignCenter - Layout.topMargin: Style.marginL * 2 - } - - ScrollView { - Layout.alignment: Qt.AlignCenter - Layout.preferredWidth: 200 * Style.marginXS * scaling - Layout.fillHeight: true - Layout.topMargin: Style.marginL * scaling - clip: true - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - ScrollBar.vertical.policy: ScrollBar.AsNeeded - - GridView { - id: contributorsGrid - - anchors.fill: parent - width: 200 * 4 * scaling - height: Math.ceil(root.contributors.length / 4) * 100 - cellWidth: Style.baseWidgetSize * 6.25 * scaling - cellHeight: Style.baseWidgetSize * 3.125 * scaling - model: root.contributors - - delegate: Rectangle { - width: contributorsGrid.cellWidth - Style.marginL * scaling - height: contributorsGrid.cellHeight - Style.marginXS * scaling - radius: Style.radiusL * scaling - color: contributorArea.containsMouse ? Color.mSecondary : Color.transparent - - RowLayout { - anchors.fill: parent - anchors.margins: Style.marginS * scaling - spacing: Style.marginM * scaling - - Item { - Layout.alignment: Qt.AlignVCenter - Layout.preferredWidth: Style.baseWidgetSize * 2 * scaling - Layout.preferredHeight: Style.baseWidgetSize * 2 * scaling - - NImageCircled { - imagePath: modelData.avatar_url || "" - anchors.fill: parent - anchors.margins: Style.marginXS * scaling - fallbackIcon: "person" - borderColor: Color.mPrimary - borderWidth: Math.max(1, Style.borderM * scaling) - } - } - - ColumnLayout { - spacing: Style.marginXS * scaling - Layout.alignment: Qt.AlignVCenter - Layout.fillWidth: true - - NText { - text: modelData.login || "Unknown" - font.weight: Style.fontWeightBold - color: contributorArea.containsMouse ? Color.mSurface : Color.mOnSurface - elide: Text.ElideRight - Layout.fillWidth: true - } - - NText { - text: (modelData.contributions || 0) + " " + ((modelData.contributions - || 0) === 1 ? "commit" : "commits") - font.pointSize: Style.fontSizeXS * scaling - color: contributorArea.containsMouse ? Color.mSurface : Color.mOnSurface - } - } - } - - MouseArea { - id: contributorArea - - anchors.fill: parent - hoverEnabled: true - cursorShape: Qt.PointingHandCursor - onClicked: { - if (modelData.html_url) - Quickshell.execDetached(["xdg-open", modelData.html_url]) - } - } + if (modelData.html_url) + Quickshell.execDetached(["xdg-open", modelData.html_url]) } } } } - + } +} diff --git a/Modules/SettingsPanel/Tabs/AudioTab.qml b/Modules/SettingsPanel/Tabs/AudioTab.qml index 7ee5755..1a6f4b9 100644 --- a/Modules/SettingsPanel/Tabs/AudioTab.qml +++ b/Modules/SettingsPanel/Tabs/AudioTab.qml @@ -7,6 +7,8 @@ import qs.Commons import qs.Services ColumnLayout { + id: root + property real localVolume: AudioService.volume Connections { diff --git a/Modules/SettingsPanel/Tabs/BarTab.qml b/Modules/SettingsPanel/Tabs/BarTab.qml index c86868a..412b560 100644 --- a/Modules/SettingsPanel/Tabs/BarTab.qml +++ b/Modules/SettingsPanel/Tabs/BarTab.qml @@ -6,6 +6,7 @@ import qs.Services import qs.Widgets ColumnLayout { + id: root ColumnLayout { spacing: Style.marginL * scaling diff --git a/Modules/SettingsPanel/Tabs/BrightnessTab.qml b/Modules/SettingsPanel/Tabs/BrightnessTab.qml index 27861de..ab73d82 100644 --- a/Modules/SettingsPanel/Tabs/BrightnessTab.qml +++ b/Modules/SettingsPanel/Tabs/BrightnessTab.qml @@ -7,9 +7,8 @@ import qs.Services import qs.Widgets ColumnLayout { - readonly property real scaling: ScalingService.scale(screen) - readonly property string tabIcon: "brightness_6" - readonly property string tabLabel: "Brightness" + id: root + spacing: Style.marginL * scaling // Brightness Step Section diff --git a/Modules/SettingsPanel/Tabs/ColorSchemeTab.qml b/Modules/SettingsPanel/Tabs/ColorSchemeTab.qml index 795d03c..a735ff6 100644 --- a/Modules/SettingsPanel/Tabs/ColorSchemeTab.qml +++ b/Modules/SettingsPanel/Tabs/ColorSchemeTab.qml @@ -9,6 +9,13 @@ import qs.Widgets ColumnLayout { id: root + // Cache for scheme JSON (can be flat or {dark, light}) + property var schemeColorsCache: ({}) + + // Scale properties for card animations + property real cardScaleLow: 0.95 + property real cardScaleHigh: 1.0 + // Helper function to get color from scheme file (supports dark/light variants) function getSchemeColor(schemePath, colorKey) { // Extract scheme name from path @@ -29,13 +36,6 @@ ColumnLayout { return "#000000" } - // Cache for scheme JSON (can be flat or {dark, light}) - property var schemeColorsCache: ({}) - - // Scale properties for card animations - property real cardScaleLow: 0.95 - property real cardScaleHigh: 1.0 - // This function is called by the FileView Repeater when a scheme file is loaded function schemeLoaded(schemeName, jsonData) { var value = jsonData || {} diff --git a/Modules/SettingsPanel/Tabs/DisplayTab.qml b/Modules/SettingsPanel/Tabs/DisplayTab.qml index 4eecb3b..842da36 100644 --- a/Modules/SettingsPanel/Tabs/DisplayTab.qml +++ b/Modules/SettingsPanel/Tabs/DisplayTab.qml @@ -7,10 +7,7 @@ import qs.Services import qs.Widgets ColumnLayout { - readonly property real scaling: ScalingService.scale(screen) - readonly property string tabIcon: "monitor" - readonly property string tabLabel: "Display" - readonly property int tabIndex: 5 + id: root // Time dropdown options (00:00 .. 23:30) ListModel { @@ -43,168 +40,166 @@ ColumnLayout { }) } + NText { + text: "Monitor-specific configuration" + font.pointSize: Style.fontSizeL * scaling + font.weight: Style.fontWeightBold + } - NText { - text: "Monitor-specific configuration" - font.pointSize: Style.fontSizeL * scaling - font.weight: Style.fontWeightBold - } + NText { + text: "Bars and notifications appear on all displays by default. Choose specific displays below to limit where they're shown." + font.pointSize: Style.fontSizeM * scaling + color: Color.mOnSurfaceVariant + wrapMode: Text.WordWrap + Layout.fillWidth: true + Layout.preferredWidth: parent.width - (Style.marginL * 2 * scaling) + } - NText { - text: "Bars and notifications appear on all displays by default. Choose specific displays below to limit where they're shown." - font.pointSize: Style.fontSizeM * scaling - color: Color.mOnSurfaceVariant - wrapMode: Text.WordWrap - Layout.fillWidth: true - Layout.preferredWidth: parent.width - (Style.marginL * 2 * scaling) - } + ColumnLayout { + spacing: Style.marginL * scaling + Layout.topMargin: Style.marginL * scaling - ColumnLayout { - spacing: Style.marginL * scaling - Layout.topMargin: Style.marginL * scaling + Repeater { + model: Quickshell.screens || [] + delegate: Rectangle { + Layout.fillWidth: true + Layout.minimumWidth: 550 * scaling + radius: Style.radiusM * scaling + color: Color.mSurface + border.color: Color.mOutline + border.width: Math.max(1, Style.borderS * scaling) + implicitHeight: contentCol.implicitHeight + Style.marginXL * 2 * scaling - Repeater { - model: Quickshell.screens || [] - delegate: Rectangle { - Layout.fillWidth: true - Layout.minimumWidth: 550 * scaling - radius: Style.radiusM * scaling - color: Color.mSurface - border.color: Color.mOutline - border.width: Math.max(1, Style.borderS * scaling) - implicitHeight: contentCol.implicitHeight + Style.marginXL * 2 * scaling + ColumnLayout { + id: contentCol + anchors.fill: parent + anchors.margins: Style.marginL * scaling + spacing: Style.marginXXS * scaling + + NText { + text: (modelData.name || "Unknown") + font.pointSize: Style.fontSizeXL * scaling + font.weight: Style.fontWeightBold + color: Color.mSecondary + } + + NText { + text: `Resolution: ${modelData.width}x${modelData.height} - Position: (${modelData.x}, ${modelData.y})` + font.pointSize: Style.fontSizeXS * scaling + color: Color.mOnSurfaceVariant + wrapMode: Text.WordWrap + Layout.fillWidth: true + } ColumnLayout { - id: contentCol - anchors.fill: parent - anchors.margins: Style.marginL * scaling - spacing: Style.marginXXS * scaling + spacing: Style.marginL * scaling + Layout.fillWidth: true - NText { - text: (modelData.name || "Unknown") - font.pointSize: Style.fontSizeXL * scaling - font.weight: Style.fontWeightBold - color: Color.mSecondary + NToggle { + Layout.fillWidth: true + label: "Bar" + description: "Enable the bar on this monitor." + checked: (Settings.data.bar.monitors || []).indexOf(modelData.name) !== -1 + onToggled: checked => { + if (checked) { + Settings.data.bar.monitors = addMonitor(Settings.data.bar.monitors, modelData.name) + } else { + Settings.data.bar.monitors = removeMonitor(Settings.data.bar.monitors, modelData.name) + } + } } - NText { - text: `Resolution: ${modelData.width}x${modelData.height} - Position: (${modelData.x}, ${modelData.y})` - font.pointSize: Style.fontSizeXS * scaling - color: Color.mOnSurfaceVariant - wrapMode: Text.WordWrap + NToggle { Layout.fillWidth: true + label: "Notifications" + description: "Enable notifications on this monitor." + checked: (Settings.data.notifications.monitors || []).indexOf(modelData.name) !== -1 + onToggled: checked => { + if (checked) { + Settings.data.notifications.monitors = addMonitor(Settings.data.notifications.monitors, + modelData.name) + } else { + Settings.data.notifications.monitors = removeMonitor(Settings.data.notifications.monitors, + modelData.name) + } + } + } + + NToggle { + Layout.fillWidth: true + label: "Dock" + description: "Enable the dock on this monitor." + checked: (Settings.data.dock.monitors || []).indexOf(modelData.name) !== -1 + onToggled: checked => { + if (checked) { + Settings.data.dock.monitors = addMonitor(Settings.data.dock.monitors, modelData.name) + } else { + Settings.data.dock.monitors = removeMonitor(Settings.data.dock.monitors, modelData.name) + } + } } ColumnLayout { - spacing: Style.marginL * scaling + spacing: Style.marginS * scaling Layout.fillWidth: true - NToggle { + RowLayout { Layout.fillWidth: true - label: "Bar" - description: "Enable the bar on this monitor." - checked: (Settings.data.bar.monitors || []).indexOf(modelData.name) !== -1 - onToggled: checked => { - if (checked) { - Settings.data.bar.monitors = addMonitor(Settings.data.bar.monitors, modelData.name) - } else { - Settings.data.bar.monitors = removeMonitor(Settings.data.bar.monitors, modelData.name) - } - } - } + spacing: Style.marginL * scaling - NToggle { - Layout.fillWidth: true - label: "Notifications" - description: "Enable notifications on this monitor." - checked: (Settings.data.notifications.monitors || []).indexOf(modelData.name) !== -1 - onToggled: checked => { - if (checked) { - Settings.data.notifications.monitors = addMonitor(Settings.data.notifications.monitors, - modelData.name) - } else { - Settings.data.notifications.monitors = removeMonitor( - Settings.data.notifications.monitors, modelData.name) - } - } - } - - NToggle { - Layout.fillWidth: true - label: "Dock" - description: "Enable the dock on this monitor." - checked: (Settings.data.dock.monitors || []).indexOf(modelData.name) !== -1 - onToggled: checked => { - if (checked) { - Settings.data.dock.monitors = addMonitor(Settings.data.dock.monitors, modelData.name) - } else { - Settings.data.dock.monitors = removeMonitor(Settings.data.dock.monitors, modelData.name) - } - } - } - - ColumnLayout { - spacing: Style.marginS * scaling - Layout.fillWidth: true - - RowLayout { + ColumnLayout { + spacing: Style.marginXXS * scaling Layout.fillWidth: true - spacing: Style.marginL * scaling - - ColumnLayout { - spacing: Style.marginXXS * scaling - Layout.fillWidth: true - - NText { - text: "Scale" - font.pointSize: Style.fontSizeM * scaling - font.weight: Style.fontWeightBold - color: Color.mOnSurface - } - NText { - text: "Scale the user interface on this monitor." - font.pointSize: Style.fontSizeS * scaling - color: Color.mOnSurfaceVariant - wrapMode: Text.WordWrap - Layout.fillWidth: true - } - } NText { - text: `${Math.round(ScalingService.scaleByName(modelData.name) * 100)}%` - Layout.alignment: Qt.AlignVCenter - Layout.minimumWidth: 50 * scaling - horizontalAlignment: Text.AlignRight + text: "Scale" + font.pointSize: Style.fontSizeM * scaling + font.weight: Style.fontWeightBold + color: Color.mOnSurface + } + NText { + text: "Scale the user interface on this monitor." + font.pointSize: Style.fontSizeS * scaling + color: Color.mOnSurfaceVariant + wrapMode: Text.WordWrap + Layout.fillWidth: true } } - RowLayout { - spacing: Style.marginS * scaling - Layout.fillWidth: true + NText { + text: `${Math.round(ScalingService.scaleByName(modelData.name) * 100)}%` + Layout.alignment: Qt.AlignVCenter + Layout.minimumWidth: 50 * scaling + horizontalAlignment: Text.AlignRight + } + } - NSlider { - id: scaleSlider - from: 0.7 - to: 1.8 - stepSize: 0.01 - value: ScalingService.scaleByName(modelData.name) - onPressedChanged: { - var data = Settings.data.monitorsScaling || {} - data[modelData.name] = value - Settings.data.monitorsScaling = data - } - Layout.fillWidth: true - Layout.minimumWidth: 150 * scaling + RowLayout { + spacing: Style.marginS * scaling + Layout.fillWidth: true + + NSlider { + id: scaleSlider + from: 0.7 + to: 1.8 + stepSize: 0.01 + value: ScalingService.scaleByName(modelData.name) + onPressedChanged: { + var data = Settings.data.monitorsScaling || {} + data[modelData.name] = value + Settings.data.monitorsScaling = data } + Layout.fillWidth: true + Layout.minimumWidth: 150 * scaling + } - NIconButton { - icon: "refresh" - tooltipText: "Reset Scaling" - onClicked: { - var data = Settings.data.monitorsScaling || {} - data[modelData.name] = 1.0 - Settings.data.monitorsScaling = data - } + NIconButton { + icon: "refresh" + tooltipText: "Reset Scaling" + onClicked: { + var data = Settings.data.monitorsScaling || {} + data[modelData.name] = 1.0 + Settings.data.monitorsScaling = data } } } @@ -212,121 +207,124 @@ ColumnLayout { } } } + } - NDivider { + NDivider { + Layout.fillWidth: true + Layout.topMargin: Style.marginXL * scaling + Layout.bottomMargin: Style.marginXL * scaling + } + + // Night Light Section + ColumnLayout { + spacing: Style.marginXS * scaling + NText { + text: "Night Light" + font.pointSize: Style.fontSizeXXL * scaling + font.weight: Style.fontWeightBold + color: Color.mSecondary + } + + NText { + text: "Reduce blue light emission to help you sleep better and reduce eye strain." + font.pointSize: Style.fontSizeM * scaling + color: Color.mOnSurfaceVariant + wrapMode: Text.WordWrap Layout.fillWidth: true - Layout.topMargin: Style.marginXL * scaling - Layout.bottomMargin: Style.marginXL * scaling + Layout.preferredWidth: parent.width - (Style.marginL * 2 * scaling) } + } - // Night Light Section - ColumnLayout { - spacing: Style.marginXS * scaling - NText { - text: "Night Light" - font.pointSize: Style.fontSizeXXL * scaling - font.weight: Style.fontWeightBold - color: Color.mSecondary - } + NToggle { + label: "Enable Night Light" + description: "Apply a warm color filter to reduce blue light emission." + checked: Settings.data.nightLight.enabled + onToggled: checked => Settings.data.nightLight.enabled = checked + } - NText { - text: "Reduce blue light emission to help you sleep better and reduce eye strain." - font.pointSize: Style.fontSizeM * scaling - color: Color.mOnSurfaceVariant - wrapMode: Text.WordWrap + // Intensity settings + ColumnLayout { + visible: Settings.data.nightLight.enabled + NLabel { + label: "Intensity" + description: "Higher values create warmer light." + } + RowLayout { + spacing: Style.marginS * scaling + + NSlider { + from: 0 + to: 1 + stepSize: 0.01 + value: Settings.data.nightLight.intensity + onMoved: Settings.data.nightLight.intensity = value Layout.fillWidth: true - Layout.preferredWidth: parent.width - (Style.marginL * 2 * scaling) - } - } - - NToggle { - label: "Enable Night Light" - description: "Apply a warm color filter to reduce blue light emission." - checked: Settings.data.nightLight.enabled - onToggled: checked => Settings.data.nightLight.enabled = checked - } - - NToggle { - label: "Auto Schedule" - description: "Automatically enable night light based on time schedule." - checked: Settings.data.nightLight.autoSchedule - onToggled: checked => Settings.data.nightLight.autoSchedule = checked - } - - // Intensity settings - ColumnLayout { - NLabel { - label: "Intensity" - description: "Higher values create warmer light." - } - RowLayout { - spacing: Style.marginS * scaling - - NSlider { - from: 0 - to: 1 - stepSize: 0.01 - value: Settings.data.nightLight.intensity - onMoved: Settings.data.nightLight.intensity = value - Layout.fillWidth: true - Layout.minimumWidth: 150 * scaling - } - - NText { - text: `${Math.round(Settings.data.nightLight.intensity * 100)}%` - Layout.alignment: Qt.AlignVCenter - Layout.minimumWidth: 60 * scaling - horizontalAlignment: Text.AlignRight - } - } - } - - // Schedule settings - ColumnLayout { - spacing: Style.marginXS * scaling - - NLabel { - label: "Schedule" - description: "Set a start and end time for automatic schedule." + Layout.minimumWidth: 150 * scaling } - RowLayout { - Layout.fillWidth: false - spacing: Style.marginM * scaling - - NText { - text: "Start Time" - font.pointSize: Style.fontSizeM * scaling - color: Color.mOnSurfaceVariant - } - - NComboBox { - model: timeOptions - currentKey: Settings.data.nightLight.startTime - placeholder: "Select start time" - onSelected: key => Settings.data.nightLight.startTime = key - preferredWidth: 120 * scaling - } - - Item {// add a little more spacing - } - - NText { - text: "Stop Time" - font.pointSize: Style.fontSizeM * scaling - color: Color.mOnSurfaceVariant - } - NComboBox { - model: timeOptions - currentKey: Settings.data.nightLight.stopTime - placeholder: "Select stop time" - onSelected: key => Settings.data.nightLight.stopTime = key - preferredWidth: 120 * scaling - } + NText { + text: `${Math.round(Settings.data.nightLight.intensity * 100)}%` + Layout.alignment: Qt.AlignVCenter + Layout.minimumWidth: 60 * scaling + horizontalAlignment: Text.AlignRight } } } - + + NToggle { + label: "Auto Schedule" + description: "Automatically enable night light based on time schedule." + checked: Settings.data.nightLight.autoSchedule + onToggled: checked => Settings.data.nightLight.autoSchedule = checked + visible: Settings.data.nightLight.enabled + } + + // Schedule settings + ColumnLayout { + spacing: Style.marginXS * scaling + visible: Settings.data.nightLight.enabled && Settings.data.nightLight.autoSchedule + + NLabel { + label: "Schedule" + description: "Set a start and end time for automatic schedule." + } + + RowLayout { + Layout.fillWidth: false + spacing: Style.marginM * scaling + + NText { + text: "Start Time" + font.pointSize: Style.fontSizeM * scaling + color: Color.mOnSurfaceVariant + } + + NComboBox { + model: timeOptions + currentKey: Settings.data.nightLight.startTime + placeholder: "Select start time" + onSelected: key => Settings.data.nightLight.startTime = key + preferredWidth: 120 * scaling + } + + Item {// add a little more spacing + } + + NText { + text: "Stop Time" + font.pointSize: Style.fontSizeM * scaling + color: Color.mOnSurfaceVariant + } + NComboBox { + model: timeOptions + currentKey: Settings.data.nightLight.stopTime + placeholder: "Select stop time" + onSelected: key => Settings.data.nightLight.stopTime = key + preferredWidth: 120 * scaling + } + } + } + } NDivider { Layout.fillWidth: true diff --git a/Modules/SettingsPanel/Tabs/GeneralTab.qml b/Modules/SettingsPanel/Tabs/GeneralTab.qml index 9112d74..473a5ce 100644 --- a/Modules/SettingsPanel/Tabs/GeneralTab.qml +++ b/Modules/SettingsPanel/Tabs/GeneralTab.qml @@ -6,6 +6,7 @@ import qs.Services import qs.Widgets ColumnLayout { + id: root // Profile section RowLayout { diff --git a/Modules/SettingsPanel/Tabs/LauncherTab.qml b/Modules/SettingsPanel/Tabs/LauncherTab.qml index c003e2c..49db62e 100644 --- a/Modules/SettingsPanel/Tabs/LauncherTab.qml +++ b/Modules/SettingsPanel/Tabs/LauncherTab.qml @@ -6,6 +6,7 @@ import qs.Services import qs.Widgets ColumnLayout { + id: root ColumnLayout { spacing: Style.marginL * scaling diff --git a/Modules/SettingsPanel/Tabs/NetworkTab.qml b/Modules/SettingsPanel/Tabs/NetworkTab.qml index 24d35c9..4b56ea7 100644 --- a/Modules/SettingsPanel/Tabs/NetworkTab.qml +++ b/Modules/SettingsPanel/Tabs/NetworkTab.qml @@ -8,6 +8,7 @@ import qs.Services import qs.Widgets ColumnLayout { + id: root spacing: Style.marginL * scaling NToggle { diff --git a/Modules/SettingsPanel/Tabs/ScreenRecorderTab.qml b/Modules/SettingsPanel/Tabs/ScreenRecorderTab.qml index 0b439f1..2a000c1 100644 --- a/Modules/SettingsPanel/Tabs/ScreenRecorderTab.qml +++ b/Modules/SettingsPanel/Tabs/ScreenRecorderTab.qml @@ -6,6 +6,8 @@ import qs.Services import qs.Widgets ColumnLayout { + id: root + spacing: Style.marginL * scaling // Output Directory diff --git a/Modules/SettingsPanel/Tabs/TimeWeatherTab.qml b/Modules/SettingsPanel/Tabs/TimeWeatherTab.qml index d02ed79..60bf275 100644 --- a/Modules/SettingsPanel/Tabs/TimeWeatherTab.qml +++ b/Modules/SettingsPanel/Tabs/TimeWeatherTab.qml @@ -6,6 +6,7 @@ import qs.Services import qs.Widgets ColumnLayout { + id: root // Location section NTextInput { diff --git a/Modules/SettingsPanel/Tabs/WallpaperSelectorTab.qml b/Modules/SettingsPanel/Tabs/WallpaperSelectorTab.qml index 0dd49ba..0fa0338 100644 --- a/Modules/SettingsPanel/Tabs/WallpaperSelectorTab.qml +++ b/Modules/SettingsPanel/Tabs/WallpaperSelectorTab.qml @@ -7,10 +7,7 @@ import qs.Services import qs.Widgets ColumnLayout { - readonly property real scaling: ScalingService.scale(screen) - readonly property string tabIcon: "photo_library" - readonly property string tabLabel: "Wallpaper Selector" - readonly property int tabIndex: 7 + id: root spacing: Style.marginL * scaling diff --git a/Modules/SettingsPanel/Tabs/WallpaperTab.qml b/Modules/SettingsPanel/Tabs/WallpaperTab.qml index e6140de..f4f8f98 100644 --- a/Modules/SettingsPanel/Tabs/WallpaperTab.qml +++ b/Modules/SettingsPanel/Tabs/WallpaperTab.qml @@ -7,6 +7,7 @@ import qs.Services import qs.Widgets ColumnLayout { + id: root // Process to check if swww is installed Process {