Settings: tab enum cleanup

This commit is contained in:
quadbyte 2025-08-14 07:52:01 -04:00
parent 2a7810c17c
commit ef5fff12d1
5 changed files with 33 additions and 31 deletions

View file

@ -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 = Settings.Tab.Audio
settingsPanel.requestedTab = SettingsPanel.Tab.Audio
settingsPanel.isLoaded = true
}
}

View file

@ -10,7 +10,21 @@ import qs.Widgets
NLoader {
id: root
property int requestedTab: Settings.Tab.General
enum Tab {
General,
Bar,
TimeWeather,
ScreenRecorder,
Network,
Audio,
Display,
Wallpaper,
WallpaperSelector,
//Misc,
About
}
property int requestedTab: SettingsPanel.Tab.General
content: Component {
NPanel {
@ -56,58 +70,58 @@ NLoader {
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
property var tabsModel: [{
"id": Settings.Tab.General,
"id": SettingsPanel.Tab.General,
"label": "General",
"icon": "tune",
"source": "Tabs/General.qml"
}, {
"id": Settings.Tab.Bar,
"id": SettingsPanel.Tab.Bar,
"label": "Bar",
"icon": "web_asset",
"source": "Tabs/Bar.qml"
}, {
"id": Settings.Tab.TimeWeather,
"id": SettingsPanel.Tab.TimeWeather,
"label": "Time & Weather",
"icon": "schedule",
"source": "Tabs/TimeWeather.qml"
}, {
"id": Settings.Tab.ScreenRecorder,
"id": SettingsPanel.Tab.ScreenRecorder,
"label": "Screen Recorder",
"icon": "videocam",
"source": "Tabs/ScreenRecorder.qml"
}, {
"id": Settings.Tab.Network,
"id": SettingsPanel.Tab.Network,
"label": "Network",
"icon": "lan",
"source": "Tabs/Network.qml"
}, {
"id": Settings.Tab.Audio,
"id": SettingsPanel.Tab.Audio,
"label": "Audio",
"icon": "volume_up",
"source": "Tabs/Audio.qml"
}, {
"id": Settings.Tab.Display,
"id": SettingsPanel.Tab.Display,
"label": "Display",
"icon": "monitor",
"source": "Tabs/Display.qml"
}, {
"id": Settings.Tab.Wallpaper,
"id": SettingsPanel.Tab.Wallpaper,
"label": "Wallpaper",
"icon": "image",
"source": "Tabs/Wallpaper.qml"
}, {
"id": Settings.Tab.WallpaperSelector,
"id": SettingsPanel.Tab.WallpaperSelector,
"label": "Wallpaper Selector",
"icon": "wallpaper_slideshow",
"source": "Tabs/WallpaperSelector.qml"
}, // {
// "id": TabId.Misc,
// "id": SettingsPanel.Tab.Misc,
// "label": "Misc",
// "icon": "more_horiz",
// "source": "Tabs/Misc.qml"
// },
{
"id": Settings.Tab.About,
"id": SettingsPanel.Tab.About,
"label": "About",
"icon": "info",
"source": "Tabs/About.qml"

View file

@ -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 {
@ -59,7 +60,7 @@ NBox {
icon: "settings"
tooltipText: "Open settings"
onClicked: {
settingsPanel.requestedTab = Settings.Tab.General
settingsPanel.requestedTab = SettingsPanel.Tab.General
settingsPanel.isLoaded = !settingsPanel.isLoaded
}
}

View file

@ -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 = Settings.Tab.WallpaperSelector
settingsPanel.requestedTab = SettingsPanel.Tab.WallpaperSelector
settingsPanel.isLoaded = true
}
}

View file

@ -7,21 +7,6 @@ pragma Singleton
Singleton {
id: root
// Our tabs used in the UI, needs to be defined in a Singleton so they can be accessed anywhere
enum Tab {
General,
Bar,
TimeWeather,
ScreenRecorder,
Network,
Audio,
Display,
Wallpaper,
WallpaperSelector,
//Misc,
About
}
// Define our app directories
// Default config directory: ~/.config/noctalia
// Default cache directory: ~/.cache/noctalia