mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Switched to qmlformat.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Services.UI
|
||||
import qs.Commons
|
||||
import qs.Services.UI
|
||||
|
||||
Item {
|
||||
id: root
|
||||
@@ -25,7 +25,7 @@ Item {
|
||||
visible: loader.item ? ((loader.item.opacity > 0.0) || (loader.item.hasOwnProperty("hideMode") && loader.item.hideMode === "transparent")) : false
|
||||
|
||||
function getImplicitSize(item, prop) {
|
||||
return (item && item.visible) ? Math.round(item[prop]) : 0
|
||||
return (item && item.visible) ? Math.round(item[prop]) : 0;
|
||||
}
|
||||
|
||||
Loader {
|
||||
@@ -36,42 +36,41 @@ Item {
|
||||
|
||||
onLoaded: {
|
||||
if (!item)
|
||||
return
|
||||
|
||||
Logger.d("BarWidgetLoader", "Loading widget", widgetId, "on screen:", widgetScreen.name)
|
||||
return;
|
||||
Logger.d("BarWidgetLoader", "Loading widget", widgetId, "on screen:", widgetScreen.name);
|
||||
|
||||
// Apply properties to loaded widget
|
||||
for (var prop in widgetProps) {
|
||||
if (item.hasOwnProperty(prop)) {
|
||||
item[prop] = widgetProps[prop]
|
||||
item[prop] = widgetProps[prop];
|
||||
}
|
||||
}
|
||||
|
||||
// Set screen property
|
||||
if (item.hasOwnProperty("screen")) {
|
||||
item.screen = widgetScreen
|
||||
item.screen = widgetScreen;
|
||||
}
|
||||
|
||||
// Set scaling property
|
||||
if (item.hasOwnProperty("scaling")) {
|
||||
item.scaling = Qt.binding(function () {
|
||||
return root.scaling
|
||||
})
|
||||
return root.scaling;
|
||||
});
|
||||
}
|
||||
|
||||
// Register this widget instance with BarService
|
||||
BarService.registerWidget(widgetScreen.name, section, widgetId, sectionIndex, item)
|
||||
BarService.registerWidget(widgetScreen.name, section, widgetId, sectionIndex, item);
|
||||
|
||||
// Call custom onLoaded if it exists
|
||||
if (item.hasOwnProperty("onLoaded")) {
|
||||
item.onLoaded()
|
||||
item.onLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
// Unregister when destroyed
|
||||
if (widgetScreen && section) {
|
||||
BarService.unregisterWidget(widgetScreen.name, section, widgetId, sectionIndex)
|
||||
BarService.unregisterWidget(widgetScreen.name, section, widgetId, sectionIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,7 +78,7 @@ Item {
|
||||
// Error handling
|
||||
Component.onCompleted: {
|
||||
if (!BarWidgetRegistry.hasWidget(widgetId)) {
|
||||
Logger.w("BarWidgetLoader", "Widget not found in registry:", widgetId)
|
||||
Logger.w("BarWidgetLoader", "Widget not found in registry:", widgetId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user