Better panel naming and removed ref to SettingsWindow

This commit is contained in:
quadbyte 2025-08-12 21:33:22 -04:00
parent 9a70d8028a
commit ce22559ee2
6 changed files with 22 additions and 31 deletions

View file

@ -13,7 +13,7 @@ NClock {
}
onEntered: {
if (!calendar.isLoaded) {
if (!calendarPanel.isLoaded) {
tooltip.show()
}
}
@ -22,6 +22,6 @@ NClock {
}
onClicked: {
tooltip.hide()
calendar.isLoaded = !calendar.isLoaded
calendarPanel.isLoaded = !calendarPanel.isLoaded
}
}

View file

@ -13,7 +13,7 @@ NLoader {
content: Component {
NPanel {
id: settingsPanel
id: panel
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
@ -105,11 +105,11 @@ NLoader {
Repeater {
id: sections
model: settingsPanel.tabsModel
model: panel.tabsModel
delegate: Rectangle {
id: tabItem
readonly property bool selected: index === settingsPanel.currentTabIndex
readonly property bool selected: index === panel.currentTabIndex
width: parent.width
height: 32 * scaling // Back to original height
radius: Style.radiusSmall * scaling
@ -149,7 +149,7 @@ NLoader {
onEntered: tabItem.hovering = true
onExited: tabItem.hovering = false
onCanceled: tabItem.hovering = false
onClicked: settingsPanel.currentTabIndex = index
onClicked: panel.currentTabIndex = index
}
}
}
@ -178,19 +178,18 @@ NLoader {
Layout.fillWidth: true
spacing: Style.marginSmall * scaling
NText {
text: settingsPanel.tabsModel[settingsPanel.currentTabIndex].label
text: panel.tabsModel[panel.currentTabIndex].label
font.pointSize: Style.fontSizeLarge * scaling
font.weight: Style.fontWeightBold
color: Colors.textPrimary
Layout.fillWidth: true
}
NIconButton {
id: demoPanelToggle
icon: "close"
tooltipText: "Close settings panel"
tooltipText: "Close"
Layout.alignment: Qt.AlignVCenter
onClicked: {
settingsWindow.isLoaded = !settingsWindow.isLoaded
settingsPanel.isLoaded = !settingsPanel.isLoaded
}
}
}
@ -203,7 +202,7 @@ NLoader {
id: stack
Layout.fillWidth: true
Layout.fillHeight: true
currentIndex: settingsPanel.currentTabIndex
currentIndex: panel.currentTabIndex
Tabs.General {}
Tabs.Bar {}

View file

@ -12,9 +12,6 @@ NBox {
id: root
readonly property real scaling: Scaling.scale(screen)
// Hold a single instance of the Settings window (root is NLoader)
property var settingsWindow: null
property string uptimeText: "--"
Layout.fillWidth: true
@ -59,8 +56,9 @@ NBox {
}
NIconButton {
icon: "settings"
tooltipText: "Open settings"
onClicked: {
PanelManager.settingsWindow.isLoaded = !PanelManager.settingsWindow.isLoaded
settingsPanel.isLoaded = !settingsPanel.isLoaded
}
}
NIconButton {

View file

@ -7,5 +7,4 @@ Singleton {
id: root
property var openedPanel: null
property SettingsWindow settingsWindow: null
}

View file

@ -8,7 +8,7 @@ import qs.Widgets
import qs.Modules.Audio
import qs.Modules.Bar
import qs.Modules.Calendar
import qs.Modules.DemoPanel
import qs.Modules.Demo
import qs.Modules.Background
import qs.Modules.SidePanel
import qs.Modules.Notification
@ -31,25 +31,20 @@ ShellRoot {
id: sidePanel
}
Calendar {
id: calendarPanel
}
SettingsPanel {
id: settingsPanel
}
Notification {
id: notification
}
Calendar {
id: calendar
}
SettingsWindow {
id: settingsWindow
}
Component.onCompleted: {
PanelManager.settingsWindow = settingsWindow
// Ensure our singleton is created as soon as possible
// so we start fetching weather asap if necessary
// Ensure our singleton is created as soon as possible so we start fetching weather asap
Location.init()
}
}