Bar Volume: OnClick open SettingsPanel with audio tab focused

This commit is contained in:
quadbyte 2025-08-13 08:34:30 -04:00
parent 07b29ee873
commit 2fe3ad48a7
3 changed files with 8 additions and 24 deletions

View file

@ -15,8 +15,6 @@ Variants {
required property ShellScreen modelData required property ShellScreen modelData
readonly property real scaling: Scaling.scale(screen) readonly property real scaling: Scaling.scale(screen)
property var settingsPanel: null
screen: modelData screen: modelData
implicitHeight: Style.barHeight * scaling implicitHeight: Style.barHeight * scaling
color: "transparent" color: "transparent"

View file

@ -10,9 +10,6 @@ Item {
width: pill.width width: pill.width
height: pill.height height: pill.height
// Reference to settings panel
property var settingsPanel: null
Component.onCompleted: { Component.onCompleted: {
console.log("[Volume] settingsPanel received:", !!settingsPanel) console.log("[Volume] settingsPanel received:", !!settingsPanel)
} }
@ -87,15 +84,8 @@ Item {
} }
} }
onClicked: { onClicked: {
// Open settings panel and navigate to Audio tab settingsPanel.currentTabIndex = 5 // Audio tab index
console.log("[Volume] Attempting to open settings panel...") settingsPanel.isLoaded = true
try {
settingsPanel.isLoaded = true
settingsPanel.content.currentTabIndex = 5 // Audio tab index
console.log("[Volume] Settings panel opened successfully")
} catch (error) {
console.log("[Volume] Error opening settings panel:", error)
}
} }
} }
} }

View file

@ -10,6 +10,8 @@ import qs.Widgets
NLoader { NLoader {
id: root id: root
property int currentTabIndex: 0
content: Component { content: Component {
NPanel { NPanel {
id: panel id: panel
@ -18,7 +20,6 @@ NLoader {
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
property int currentTabIndex: 0
property var tabsModel: [{ property var tabsModel: [{
"label": "General", "label": "General",
"icon": "tune", "icon": "tune",
@ -65,11 +66,6 @@ NLoader {
"source": "Tabs/About.qml" "source": "Tabs/About.qml"
}] }]
onVisibleChanged: {
if (visible)
currentTabIndex = 0
}
Component.onCompleted: show() Component.onCompleted: show()
Rectangle { Rectangle {
@ -113,7 +109,7 @@ NLoader {
delegate: Rectangle { delegate: Rectangle {
id: tabItem id: tabItem
readonly property bool selected: index === panel.currentTabIndex readonly property bool selected: index === currentTabIndex
width: parent.width width: parent.width
height: 32 * scaling // Back to original height height: 32 * scaling // Back to original height
radius: Style.radiusSmall * scaling radius: Style.radiusSmall * scaling
@ -154,7 +150,7 @@ NLoader {
onEntered: tabItem.hovering = true onEntered: tabItem.hovering = true
onExited: tabItem.hovering = false onExited: tabItem.hovering = false
onCanceled: tabItem.hovering = false onCanceled: tabItem.hovering = false
onClicked: panel.currentTabIndex = index onClicked: currentTabIndex = index
} }
} }
} }
@ -185,7 +181,7 @@ NLoader {
// Tab label on the main right // Tab label on the main right
NText { NText {
text: panel.tabsModel[panel.currentTabIndex].label text: panel.tabsModel[currentTabIndex].label
font.pointSize: Style.fontSizeLarge * scaling font.pointSize: Style.fontSizeLarge * scaling
font.weight: Style.fontWeightBold font.weight: Style.fontWeightBold
color: Colors.accentPrimary color: Colors.accentPrimary
@ -209,7 +205,7 @@ NLoader {
id: stack id: stack
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
currentIndex: panel.currentTabIndex currentIndex: currentTabIndex
Tabs.General {} Tabs.General {}
Tabs.Bar {} Tabs.Bar {}