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: {
|
onClicked: {
|
||||||
settingsPanel.requestedTab = settingsPanel.tabsIds.AUDIO
|
settingsPanel.requestedTab = Settings.Tab.Audio
|
||||||
settingsPanel.isLoaded = true
|
settingsPanel.isLoaded = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,25 +10,7 @@ import qs.Widgets
|
||||||
NLoader {
|
NLoader {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var tabsIds: null
|
property int requestedTab: Settings.Tab.General
|
||||||
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
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
content: Component {
|
content: Component {
|
||||||
NPanel {
|
NPanel {
|
||||||
|
|
@ -74,63 +56,67 @@ NLoader {
|
||||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
|
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
|
||||||
|
|
||||||
property var tabsModel: [{
|
property var tabsModel: [{
|
||||||
"id": root.tabsIds.GENERAL,
|
"id": Settings.Tab.General,
|
||||||
"label": "General",
|
"label": "General",
|
||||||
"icon": "tune",
|
"icon": "tune",
|
||||||
"source": "Tabs/General.qml"
|
"source": "Tabs/General.qml"
|
||||||
}, {
|
}, {
|
||||||
"id": root.tabsIds.BAR,
|
"id": Settings.Tab.Bar,
|
||||||
"label": "Bar",
|
"label": "Bar",
|
||||||
"icon": "web_asset",
|
"icon": "web_asset",
|
||||||
"source": "Tabs/Bar.qml"
|
"source": "Tabs/Bar.qml"
|
||||||
}, {
|
}, {
|
||||||
"id": root.tabsIds.TIME_WEATHER,
|
"id": Settings.Tab.TimeWeather,
|
||||||
"label": "Time & Weather",
|
"label": "Time & Weather",
|
||||||
"icon": "schedule",
|
"icon": "schedule",
|
||||||
"source": "Tabs/TimeWeather.qml"
|
"source": "Tabs/TimeWeather.qml"
|
||||||
}, {
|
}, {
|
||||||
"id": root.tabsIds.SCREEN_RECORDER,
|
"id": Settings.Tab.ScreenRecorder,
|
||||||
"label": "Screen Recorder",
|
"label": "Screen Recorder",
|
||||||
"icon": "videocam",
|
"icon": "videocam",
|
||||||
"source": "Tabs/ScreenRecorder.qml"
|
"source": "Tabs/ScreenRecorder.qml"
|
||||||
}, {
|
}, {
|
||||||
"id": root.tabsIds.NETWORK,
|
"id": Settings.Tab.Network,
|
||||||
"label": "Network",
|
"label": "Network",
|
||||||
"icon": "lan",
|
"icon": "lan",
|
||||||
"source": "Tabs/Network.qml"
|
"source": "Tabs/Network.qml"
|
||||||
}, {
|
}, {
|
||||||
"id": root.tabsIds.AUDIO,
|
"id": Settings.Tab.Audio,
|
||||||
"label": "Audio",
|
"label": "Audio",
|
||||||
"icon": "volume_up",
|
"icon": "volume_up",
|
||||||
"source": "Tabs/Audio.qml"
|
"source": "Tabs/Audio.qml"
|
||||||
}, {
|
}, {
|
||||||
"id": root.tabsIds.DISPLAY,
|
"id": Settings.Tab.Display,
|
||||||
"label": "Display",
|
"label": "Display",
|
||||||
"icon": "monitor",
|
"icon": "monitor",
|
||||||
"source": "Tabs/Display.qml"
|
"source": "Tabs/Display.qml"
|
||||||
}, {
|
}, {
|
||||||
"id": root.tabsIds.WALLPAPER,
|
"id": Settings.Tab.Wallpaper,
|
||||||
"label": "Wallpaper",
|
"label": "Wallpaper",
|
||||||
"icon": "image",
|
"icon": "image",
|
||||||
"source": "Tabs/Wallpaper.qml"
|
"source": "Tabs/Wallpaper.qml"
|
||||||
}, {
|
}, {
|
||||||
"id": root.tabsIds.WALLPAPER_SELECTOR,
|
"id": Settings.Tab.WallpaperSelector,
|
||||||
"label": "Wallpaper Selector",
|
"label": "Wallpaper Selector",
|
||||||
"icon": "wallpaper_slideshow",
|
"icon": "wallpaper_slideshow",
|
||||||
"source": "Tabs/WallpaperSelector.qml"
|
"source": "Tabs/WallpaperSelector.qml"
|
||||||
}, // {
|
}, // {
|
||||||
// "id": root.tabsIds.MISC,
|
// "id": TabId.Misc,
|
||||||
// "label": "Misc",
|
// "label": "Misc",
|
||||||
// "icon": "more_horiz",
|
// "icon": "more_horiz",
|
||||||
// "source": "Tabs/Misc.qml"
|
// "source": "Tabs/Misc.qml"
|
||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
"id": root.tabsIds.ABOUT,
|
"id": Settings.Tab.About,
|
||||||
"label": "About",
|
"label": "About",
|
||||||
"icon": "info",
|
"icon": "info",
|
||||||
"source": "Tabs/About.qml"
|
"source": "Tabs/About.qml"
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
show()
|
||||||
|
}
|
||||||
|
|
||||||
// Combined visibility change handler
|
// Combined visibility change handler
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
|
|
@ -156,8 +142,6 @@ NLoader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: show()
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: bgRect
|
id: bgRect
|
||||||
color: Colors.backgroundPrimary
|
color: Colors.backgroundPrimary
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,6 @@ NBox {
|
||||||
readonly property real scaling: Scaling.scale(screen)
|
readonly property real scaling: Scaling.scale(screen)
|
||||||
property string uptimeText: "--"
|
property string uptimeText: "--"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
// Height driven by content
|
// Height driven by content
|
||||||
implicitHeight: content.implicitHeight + Style.marginMedium * 2 * scaling
|
implicitHeight: content.implicitHeight + Style.marginMedium * 2 * scaling
|
||||||
|
|
@ -61,7 +59,7 @@ NBox {
|
||||||
icon: "settings"
|
icon: "settings"
|
||||||
tooltipText: "Open settings"
|
tooltipText: "Open settings"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
settingsPanel.requestedTab = settingsPanel.tabsIds.GENERAL
|
settingsPanel.requestedTab = Settings.Tab.General
|
||||||
settingsPanel.isLoaded = !settingsPanel.isLoaded
|
settingsPanel.isLoaded = !settingsPanel.isLoaded
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ NBox {
|
||||||
NIconButton {
|
NIconButton {
|
||||||
icon: "image"
|
icon: "image"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
settingsPanel.requestedTab = settingsPanel.tabsIds.WALLPAPER_SELECTOR
|
settingsPanel.requestedTab = Settings.Tab.WallpaperSelector
|
||||||
settingsPanel.isLoaded = true
|
settingsPanel.isLoaded = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,6 @@ NPanel {
|
||||||
id: powerMenu
|
id: powerMenu
|
||||||
visible: false
|
visible: false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Anchors will be set by the parent component
|
// Anchors will be set by the parent component
|
||||||
function show() {
|
function show() {
|
||||||
visible = true
|
visible = true
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ NLoader {
|
||||||
// Target screen to open on
|
// Target screen to open on
|
||||||
property var targetScreen: null
|
property var targetScreen: null
|
||||||
|
|
||||||
|
|
||||||
function openAt(x, screen) {
|
function openAt(x, screen) {
|
||||||
anchorX = x
|
anchorX = x
|
||||||
targetScreen = screen
|
targetScreen = screen
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,21 @@ pragma Singleton
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
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
|
// Define our app directories
|
||||||
// Default config directory: ~/.config/noctalia
|
// Default config directory: ~/.config/noctalia
|
||||||
// Default cache directory: ~/.cache/noctalia
|
// Default cache directory: ~/.cache/noctalia
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue