diff --git a/Modules/Bar/Volume.qml b/Modules/Bar/Volume.qml index 412a196..ddceda1 100644 --- a/Modules/Bar/Volume.qml +++ b/Modules/Bar/Volume.qml @@ -1,6 +1,7 @@ import QtQuick import Quickshell import Quickshell.Services.Pipewire +import qs.Modules.Settings import qs.Services import qs.Widgets @@ -52,7 +53,7 @@ Item { } } onClicked: { - settingsPanel.requestedTab = settingsPanel.tabsIds.AUDIO + settingsPanel.requestedTab = SettingsPanel.Tab.Audio settingsPanel.isLoaded = true } } diff --git a/Modules/Settings/SettingsPanel.qml b/Modules/Settings/SettingsPanel.qml index c5c8f2b..132cf68 100644 --- a/Modules/Settings/SettingsPanel.qml +++ b/Modules/Settings/SettingsPanel.qml @@ -10,26 +10,22 @@ import qs.Widgets NLoader { id: root - property var tabsIds: null - property var requestedTab: null - - Component.onCompleted: { - // Fill up our ideads - tabsIds = Object.freeze({ - "GENERAL": 0, - "BAR": 1, - "TIME_WEATHER": 2, - "SCREEN_RECORDER": 3, - "NETWORK": 4, - "AUDIO": 5, - "DISPLAY": 6, - "WALLPAPER": 7, - "WALLPAPER_SELECTOR": 8, - "MISC": 9, - "ABOUT": 10 - }) + enum Tab { + General, + Bar, + TimeWeather, + ScreenRecorder, + Network, + Audio, + Display, + Wallpaper, + WallpaperSelector, + //Misc, + About } + property int requestedTab: SettingsPanel.Tab.General + content: Component { NPanel { id: panel @@ -74,63 +70,67 @@ NLoader { WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand property var tabsModel: [{ - "id": root.tabsIds.GENERAL, + "id": SettingsPanel.Tab.General, "label": "General", "icon": "tune", "source": "Tabs/General.qml" }, { - "id": root.tabsIds.BAR, + "id": SettingsPanel.Tab.Bar, "label": "Bar", "icon": "web_asset", "source": "Tabs/Bar.qml" }, { - "id": root.tabsIds.TIME_WEATHER, + "id": SettingsPanel.Tab.TimeWeather, "label": "Time & Weather", "icon": "schedule", "source": "Tabs/TimeWeather.qml" }, { - "id": root.tabsIds.SCREEN_RECORDER, + "id": SettingsPanel.Tab.ScreenRecorder, "label": "Screen Recorder", "icon": "videocam", "source": "Tabs/ScreenRecorder.qml" }, { - "id": root.tabsIds.NETWORK, + "id": SettingsPanel.Tab.Network, "label": "Network", "icon": "lan", "source": "Tabs/Network.qml" }, { - "id": root.tabsIds.AUDIO, + "id": SettingsPanel.Tab.Audio, "label": "Audio", "icon": "volume_up", "source": "Tabs/Audio.qml" }, { - "id": root.tabsIds.DISPLAY, + "id": SettingsPanel.Tab.Display, "label": "Display", "icon": "monitor", "source": "Tabs/Display.qml" }, { - "id": root.tabsIds.WALLPAPER, + "id": SettingsPanel.Tab.Wallpaper, "label": "Wallpaper", "icon": "image", "source": "Tabs/Wallpaper.qml" }, { - "id": root.tabsIds.WALLPAPER_SELECTOR, + "id": SettingsPanel.Tab.WallpaperSelector, "label": "Wallpaper Selector", "icon": "wallpaper_slideshow", "source": "Tabs/WallpaperSelector.qml" }, // { - // "id": root.tabsIds.MISC, + // "id": SettingsPanel.Tab.Misc, // "label": "Misc", // "icon": "more_horiz", // "source": "Tabs/Misc.qml" // }, { - "id": root.tabsIds.ABOUT, + "id": SettingsPanel.Tab.About, "label": "About", "icon": "info", "source": "Tabs/About.qml" }] + Component.onCompleted: { + show() + } + // Combined visibility change handler onVisibleChanged: { if (visible) { @@ -156,8 +156,6 @@ NLoader { } } - Component.onCompleted: show() - Rectangle { id: bgRect color: Colors.backgroundPrimary diff --git a/Modules/SidePanel/Cards/PowerProfilesCard.qml b/Modules/SidePanel/Cards/PowerProfilesCard.qml index 54a56dd..8562967 100644 --- a/Modules/SidePanel/Cards/PowerProfilesCard.qml +++ b/Modules/SidePanel/Cards/PowerProfilesCard.qml @@ -42,7 +42,7 @@ NBox { icon: "balance" enabled: hasPP opacity: enabled ? Style.opacityFull : Style.opacityMedium - showFilled: enabled && powerProfiles.profile === PowerProfile.Balanced + showFilled: enabled && powerProfiles.profile === PowerProfile.Balanced showBorder: !enabled || powerProfiles.profile !== PowerProfile.Balanced onClicked: { if (enabled) { diff --git a/Modules/SidePanel/Cards/ProfileCard.qml b/Modules/SidePanel/Cards/ProfileCard.qml index 33d7a4b..39d5b6f 100644 --- a/Modules/SidePanel/Cards/ProfileCard.qml +++ b/Modules/SidePanel/Cards/ProfileCard.qml @@ -4,9 +4,10 @@ import QtQuick.Layouts import Quickshell import Quickshell.Io import Quickshell.Widgets +import qs.Modules.Settings +import qs.Modules.SidePanel import qs.Services import qs.Widgets -import qs.Modules.SidePanel // Header card with avatar, user and quick actions NBox { @@ -14,8 +15,6 @@ NBox { readonly property real scaling: Scaling.scale(screen) property string uptimeText: "--" - - Layout.fillWidth: true // Height driven by content @@ -61,7 +60,7 @@ NBox { icon: "settings" tooltipText: "Open settings" onClicked: { - settingsPanel.requestedTab = settingsPanel.tabsIds.GENERAL + settingsPanel.requestedTab = SettingsPanel.Tab.General settingsPanel.isLoaded = !settingsPanel.isLoaded } } diff --git a/Modules/SidePanel/Cards/UtilitiesCard.qml b/Modules/SidePanel/Cards/UtilitiesCard.qml index e40d9ba..9704d26 100644 --- a/Modules/SidePanel/Cards/UtilitiesCard.qml +++ b/Modules/SidePanel/Cards/UtilitiesCard.qml @@ -2,6 +2,7 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts import Quickshell +import qs.Modules.Settings import qs.Services import qs.Widgets @@ -31,7 +32,7 @@ NBox { NIconButton { icon: "image" onClicked: { - settingsPanel.requestedTab = settingsPanel.tabsIds.WALLPAPER_SELECTOR + settingsPanel.requestedTab = SettingsPanel.Tab.WallpaperSelector settingsPanel.isLoaded = true } } diff --git a/Modules/SidePanel/PowerMenu.qml b/Modules/SidePanel/PowerMenu.qml index 055aad6..93174f5 100644 --- a/Modules/SidePanel/PowerMenu.qml +++ b/Modules/SidePanel/PowerMenu.qml @@ -11,8 +11,6 @@ import qs.Modules.LockScreen NPanel { id: powerMenu visible: false - - // Anchors will be set by the parent component function show() { diff --git a/Modules/SidePanel/SidePanel.qml b/Modules/SidePanel/SidePanel.qml index ba3b546..96de4ce 100644 --- a/Modules/SidePanel/SidePanel.qml +++ b/Modules/SidePanel/SidePanel.qml @@ -15,7 +15,6 @@ NLoader { // Target screen to open on property var targetScreen: null - function openAt(x, screen) { anchorX = x targetScreen = screen diff --git a/Services/IPCManager.qml b/Services/IPCManager.qml index 3a76405..0eac967 100644 --- a/Services/IPCManager.qml +++ b/Services/IPCManager.qml @@ -4,7 +4,7 @@ import qs.Modules.LockScreen Item { id: root - + // Reference to the lockscreen component property var lockscreen: null