mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-18 09:14:01 -04:00
settings: keep page history when opening plugin settings from bar widgets
fixes #3466
This commit is contained in:
@@ -430,6 +430,10 @@ Item {
|
||||
const item = getItemsForSection(sectionId)[widgetIndex];
|
||||
if (!item)
|
||||
return;
|
||||
if (item.pluginId) {
|
||||
parentModal?.navigateTo(SettingsTabs.pluginPrefix + item.pluginId);
|
||||
return;
|
||||
}
|
||||
SettingsUiState.selectedWidgetSection = sectionId;
|
||||
SettingsUiState.selectedWidgetIndex = widgetIndex;
|
||||
SettingsUiState.selectedWidgetTitle = item.text;
|
||||
|
||||
@@ -126,13 +126,7 @@ Column {
|
||||
return gpu.driver?.toUpperCase() ?? "";
|
||||
}
|
||||
clickable: configurable
|
||||
onClicked: {
|
||||
if (modelData.pluginId) {
|
||||
PopoutService.openSettingsWithTab(SettingsTabs.pluginPrefix + modelData.pluginId);
|
||||
return;
|
||||
}
|
||||
root.configureWidget(root.sectionId, index);
|
||||
}
|
||||
onClicked: root.configureWidget(root.sectionId, index)
|
||||
|
||||
Item {
|
||||
width: Theme.iconButtonSize
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Modules.Settings
|
||||
import qs.DankCommon.Common as DC
|
||||
|
||||
ShellRoot {
|
||||
id: root
|
||||
|
||||
property bool failed: false
|
||||
property var tab: null
|
||||
|
||||
function check(condition, label) {
|
||||
if (condition)
|
||||
return;
|
||||
failed = true;
|
||||
console.log("FIXTURE_FAIL " + label);
|
||||
}
|
||||
|
||||
function findPluginRow(item) {
|
||||
if (item.modelData?.pluginId && typeof item.clicked === "function")
|
||||
return item;
|
||||
for (const child of item.children || []) {
|
||||
const found = findPluginRow(child);
|
||||
if (found)
|
||||
return found;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
QtObject {
|
||||
id: modalStub
|
||||
|
||||
property var navigated: []
|
||||
|
||||
function navigateTo(pageId) {
|
||||
navigated = navigated.concat([pageId]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: tabComponent
|
||||
WidgetsTab {}
|
||||
}
|
||||
|
||||
PanelWindow {
|
||||
color: "transparent"
|
||||
implicitWidth: 900
|
||||
implicitHeight: 1600
|
||||
anchors {
|
||||
top: true
|
||||
left: true
|
||||
}
|
||||
|
||||
Item {
|
||||
id: stage
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 1500
|
||||
running: true
|
||||
repeat: true
|
||||
property int step: 0
|
||||
onTriggered: {
|
||||
if (step++ === 0) {
|
||||
Quickshell.watchFiles = false;
|
||||
DC.Style.theme = Theme;
|
||||
DC.Style.settings = SettingsData;
|
||||
DC.I18n.backend = I18n;
|
||||
SettingsData.barConfigs = [
|
||||
{
|
||||
"id": "default",
|
||||
"enabled": true,
|
||||
"position": SettingsData.Position.Top,
|
||||
"leftWidgets": ["plugin_fixture"],
|
||||
"centerWidgets": [],
|
||||
"rightWidgets": []
|
||||
}
|
||||
];
|
||||
root.tab = tabComponent.createObject(stage, {
|
||||
width: 860,
|
||||
height: 1500,
|
||||
parentModal: modalStub,
|
||||
baseWidgetDefinitions: [
|
||||
{
|
||||
"id": "plugin_fixture",
|
||||
"pluginId": "fixture",
|
||||
"text": "Fixture Plugin",
|
||||
"description": "",
|
||||
"icon": "extension",
|
||||
"enabled": true
|
||||
}
|
||||
]
|
||||
});
|
||||
if (!root.tab) {
|
||||
console.error("FIXTURE_FAIL " + tabComponent.errorString());
|
||||
Qt.quit();
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
const row = findPluginRow(root.tab);
|
||||
check(!!row, "plugin widget row is rendered");
|
||||
row?.clicked();
|
||||
check(JSON.stringify(modalStub.navigated) === JSON.stringify([SettingsTabs.pluginPrefix + "fixture"]), "plugin row pushes the plugin page onto the modal history, got " + JSON.stringify(modalStub.navigated));
|
||||
console.log(root.failed ? "FIXTURE_FAIL see above" : "FIXTURE_PASS");
|
||||
stop();
|
||||
Qt.quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user