From 2fe3ad48a79258211b3690ea37da8511289fedb9 Mon Sep 17 00:00:00 2001 From: quadbyte Date: Wed, 13 Aug 2025 08:34:30 -0400 Subject: [PATCH] Bar Volume: OnClick open SettingsPanel with audio tab focused --- Modules/Bar/Bar.qml | 2 -- Modules/Bar/Volume.qml | 14 ++------------ Modules/Settings/SettingsPanel.qml | 16 ++++++---------- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/Modules/Bar/Bar.qml b/Modules/Bar/Bar.qml index 3a0a1ab..bd14629 100644 --- a/Modules/Bar/Bar.qml +++ b/Modules/Bar/Bar.qml @@ -15,8 +15,6 @@ Variants { required property ShellScreen modelData readonly property real scaling: Scaling.scale(screen) - property var settingsPanel: null - screen: modelData implicitHeight: Style.barHeight * scaling color: "transparent" diff --git a/Modules/Bar/Volume.qml b/Modules/Bar/Volume.qml index 5e02908..7d17e8f 100644 --- a/Modules/Bar/Volume.qml +++ b/Modules/Bar/Volume.qml @@ -10,9 +10,6 @@ Item { width: pill.width height: pill.height - // Reference to settings panel - property var settingsPanel: null - Component.onCompleted: { console.log("[Volume] settingsPanel received:", !!settingsPanel) } @@ -87,15 +84,8 @@ Item { } } onClicked: { - // Open settings panel and navigate to Audio tab - console.log("[Volume] Attempting to open settings panel...") - 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) - } + settingsPanel.currentTabIndex = 5 // Audio tab index + settingsPanel.isLoaded = true } } } diff --git a/Modules/Settings/SettingsPanel.qml b/Modules/Settings/SettingsPanel.qml index 189e969..a073432 100644 --- a/Modules/Settings/SettingsPanel.qml +++ b/Modules/Settings/SettingsPanel.qml @@ -10,6 +10,8 @@ import qs.Widgets NLoader { id: root + property int currentTabIndex: 0 + content: Component { NPanel { id: panel @@ -18,7 +20,6 @@ NLoader { WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand - property int currentTabIndex: 0 property var tabsModel: [{ "label": "General", "icon": "tune", @@ -65,11 +66,6 @@ NLoader { "source": "Tabs/About.qml" }] - onVisibleChanged: { - if (visible) - currentTabIndex = 0 - } - Component.onCompleted: show() Rectangle { @@ -113,7 +109,7 @@ NLoader { delegate: Rectangle { id: tabItem - readonly property bool selected: index === panel.currentTabIndex + readonly property bool selected: index === currentTabIndex width: parent.width height: 32 * scaling // Back to original height radius: Style.radiusSmall * scaling @@ -154,7 +150,7 @@ NLoader { onEntered: tabItem.hovering = true onExited: 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 NText { - text: panel.tabsModel[panel.currentTabIndex].label + text: panel.tabsModel[currentTabIndex].label font.pointSize: Style.fontSizeLarge * scaling font.weight: Style.fontWeightBold color: Colors.accentPrimary @@ -209,7 +205,7 @@ NLoader { id: stack Layout.fillWidth: true Layout.fillHeight: true - currentIndex: panel.currentTabIndex + currentIndex: currentTabIndex Tabs.General {} Tabs.Bar {}