Settings Tab: replaced Tab IDs by a QML enum
This commit is contained in:
parent
71433c7807
commit
2a7810c17c
9 changed files with 36 additions and 42 deletions
|
|
@ -52,7 +52,7 @@ Item {
|
|||
}
|
||||
}
|
||||
onClicked: {
|
||||
settingsPanel.requestedTab = settingsPanel.tabsIds.AUDIO
|
||||
settingsPanel.requestedTab = Settings.Tab.Audio
|
||||
settingsPanel.isLoaded = true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,25 +10,7 @@ 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
|
||||
})
|
||||
}
|
||||
property int requestedTab: Settings.Tab.General
|
||||
|
||||
content: Component {
|
||||
NPanel {
|
||||
|
|
@ -74,63 +56,67 @@ NLoader {
|
|||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
|
||||
|
||||
property var tabsModel: [{
|
||||
"id": root.tabsIds.GENERAL,
|
||||
"id": Settings.Tab.General,
|
||||
"label": "General",
|
||||
"icon": "tune",
|
||||
"source": "Tabs/General.qml"
|
||||
}, {
|
||||
"id": root.tabsIds.BAR,
|
||||
"id": Settings.Tab.Bar,
|
||||
"label": "Bar",
|
||||
"icon": "web_asset",
|
||||
"source": "Tabs/Bar.qml"
|
||||
}, {
|
||||
"id": root.tabsIds.TIME_WEATHER,
|
||||
"id": Settings.Tab.TimeWeather,
|
||||
"label": "Time & Weather",
|
||||
"icon": "schedule",
|
||||
"source": "Tabs/TimeWeather.qml"
|
||||
}, {
|
||||
"id": root.tabsIds.SCREEN_RECORDER,
|
||||
"id": Settings.Tab.ScreenRecorder,
|
||||
"label": "Screen Recorder",
|
||||
"icon": "videocam",
|
||||
"source": "Tabs/ScreenRecorder.qml"
|
||||
}, {
|
||||
"id": root.tabsIds.NETWORK,
|
||||
"id": Settings.Tab.Network,
|
||||
"label": "Network",
|
||||
"icon": "lan",
|
||||
"source": "Tabs/Network.qml"
|
||||
}, {
|
||||
"id": root.tabsIds.AUDIO,
|
||||
"id": Settings.Tab.Audio,
|
||||
"label": "Audio",
|
||||
"icon": "volume_up",
|
||||
"source": "Tabs/Audio.qml"
|
||||
}, {
|
||||
"id": root.tabsIds.DISPLAY,
|
||||
"id": Settings.Tab.Display,
|
||||
"label": "Display",
|
||||
"icon": "monitor",
|
||||
"source": "Tabs/Display.qml"
|
||||
}, {
|
||||
"id": root.tabsIds.WALLPAPER,
|
||||
"id": Settings.Tab.Wallpaper,
|
||||
"label": "Wallpaper",
|
||||
"icon": "image",
|
||||
"source": "Tabs/Wallpaper.qml"
|
||||
}, {
|
||||
"id": root.tabsIds.WALLPAPER_SELECTOR,
|
||||
"id": Settings.Tab.WallpaperSelector,
|
||||
"label": "Wallpaper Selector",
|
||||
"icon": "wallpaper_slideshow",
|
||||
"source": "Tabs/WallpaperSelector.qml"
|
||||
}, // {
|
||||
// "id": root.tabsIds.MISC,
|
||||
// "id": TabId.Misc,
|
||||
// "label": "Misc",
|
||||
// "icon": "more_horiz",
|
||||
// "source": "Tabs/Misc.qml"
|
||||
// },
|
||||
{
|
||||
"id": root.tabsIds.ABOUT,
|
||||
"id": Settings.Tab.About,
|
||||
"label": "About",
|
||||
"icon": "info",
|
||||
"source": "Tabs/About.qml"
|
||||
}]
|
||||
|
||||
Component.onCompleted: {
|
||||
show()
|
||||
}
|
||||
|
||||
// Combined visibility change handler
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
|
|
@ -156,8 +142,6 @@ NLoader {
|
|||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: show()
|
||||
|
||||
Rectangle {
|
||||
id: bgRect
|
||||
color: Colors.backgroundPrimary
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@ NBox {
|
|||
|
||||
readonly property real scaling: Scaling.scale(screen)
|
||||
property string uptimeText: "--"
|
||||
|
||||
|
||||
|
||||
Layout.fillWidth: true
|
||||
// Height driven by content
|
||||
|
|
@ -61,7 +59,7 @@ NBox {
|
|||
icon: "settings"
|
||||
tooltipText: "Open settings"
|
||||
onClicked: {
|
||||
settingsPanel.requestedTab = settingsPanel.tabsIds.GENERAL
|
||||
settingsPanel.requestedTab = Settings.Tab.General
|
||||
settingsPanel.isLoaded = !settingsPanel.isLoaded
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ NBox {
|
|||
NIconButton {
|
||||
icon: "image"
|
||||
onClicked: {
|
||||
settingsPanel.requestedTab = settingsPanel.tabsIds.WALLPAPER_SELECTOR
|
||||
settingsPanel.requestedTab = Settings.Tab.WallpaperSelector
|
||||
settingsPanel.isLoaded = true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@ import qs.Modules.Lockscreen
|
|||
NPanel {
|
||||
id: powerMenu
|
||||
visible: false
|
||||
|
||||
|
||||
|
||||
// Anchors will be set by the parent component
|
||||
function show() {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ NLoader {
|
|||
// Target screen to open on
|
||||
property var targetScreen: null
|
||||
|
||||
|
||||
function openAt(x, screen) {
|
||||
anchorX = x
|
||||
targetScreen = screen
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import qs.Modules.Lockscreen
|
|||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
|
||||
// Reference to the lockscreen component
|
||||
property var lockscreen: null
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,21 @@ 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue