mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-13 09:12:08 -04:00
settings: restore notifyHorizontalBarChanged
This commit is contained in:
@@ -28,6 +28,35 @@ Item {
|
|||||||
return pos === SettingsData.Position.Left || pos === SettingsData.Position.Right;
|
return pos === SettingsData.Position.Left || pos === SettingsData.Position.Right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: horizontalBarChangeDebounce
|
||||||
|
interval: 500
|
||||||
|
repeat: false
|
||||||
|
onTriggered: {
|
||||||
|
const verticalBars = SettingsData.barConfigs.filter(cfg => {
|
||||||
|
const pos = cfg.position ?? SettingsData.Position.Top;
|
||||||
|
return pos === SettingsData.Position.Left || pos === SettingsData.Position.Right;
|
||||||
|
});
|
||||||
|
|
||||||
|
verticalBars.forEach(bar => {
|
||||||
|
if (!bar.enabled)
|
||||||
|
return;
|
||||||
|
SettingsData.updateBarConfig(bar.id, {
|
||||||
|
enabled: false
|
||||||
|
});
|
||||||
|
Qt.callLater(() => SettingsData.updateBarConfig(bar.id, {
|
||||||
|
enabled: true
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function notifyHorizontalBarChange() {
|
||||||
|
if (selectedBarIsVertical)
|
||||||
|
return;
|
||||||
|
horizontalBarChangeDebounce.restart();
|
||||||
|
}
|
||||||
|
|
||||||
function createNewBar() {
|
function createNewBar() {
|
||||||
if (SettingsData.barConfigs.length >= 4)
|
if (SettingsData.barConfigs.length >= 4)
|
||||||
return;
|
return;
|
||||||
@@ -514,6 +543,9 @@ Item {
|
|||||||
SettingsData.updateBarConfig(selectedBarId, {
|
SettingsData.updateBarConfig(selectedBarId, {
|
||||||
position: newPos
|
position: newPos
|
||||||
});
|
});
|
||||||
|
const isVertical = newPos === SettingsData.Position.Left || newPos === SettingsData.Position.Right;
|
||||||
|
if (wasVertical !== isVertical || !isVertical)
|
||||||
|
notifyHorizontalBarChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -532,6 +564,7 @@ Item {
|
|||||||
SettingsData.updateBarConfig(selectedBarId, {
|
SettingsData.updateBarConfig(selectedBarId, {
|
||||||
autoHide: toggled
|
autoHide: toggled
|
||||||
});
|
});
|
||||||
|
notifyHorizontalBarChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -598,6 +631,7 @@ Item {
|
|||||||
SettingsData.updateBarConfig(selectedBarId, {
|
SettingsData.updateBarConfig(selectedBarId, {
|
||||||
visible: toggled
|
visible: toggled
|
||||||
});
|
});
|
||||||
|
notifyHorizontalBarChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ Singleton {
|
|||||||
function registerWidget(widgetId, screenName, widgetRef) {
|
function registerWidget(widgetId, screenName, widgetRef) {
|
||||||
if (!widgetId || !screenName || !widgetRef)
|
if (!widgetId || !screenName || !widgetRef)
|
||||||
return;
|
return;
|
||||||
|
if (typeof widgetRegistry !== "object" || widgetRegistry === null)
|
||||||
|
widgetRegistry = ({});
|
||||||
|
|
||||||
if (!widgetRegistry[widgetId])
|
if (!widgetRegistry[widgetId])
|
||||||
widgetRegistry[widgetId] = {};
|
widgetRegistry[widgetId] = {};
|
||||||
@@ -29,6 +31,8 @@ Singleton {
|
|||||||
function unregisterWidget(widgetId, screenName) {
|
function unregisterWidget(widgetId, screenName) {
|
||||||
if (!widgetId || !screenName)
|
if (!widgetId || !screenName)
|
||||||
return;
|
return;
|
||||||
|
if (typeof widgetRegistry !== "object" || widgetRegistry === null)
|
||||||
|
return;
|
||||||
if (!widgetRegistry[widgetId])
|
if (!widgetRegistry[widgetId])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user