-
Notifications
You must be signed in to change notification settings - Fork 74
fix(osd/notch/shell): animation fixes, SafeLoader component, Vulkan backend detection #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
f475b72
0ec7429
24cefdf
da034a6
8981c6c
f1cd73f
7361de6
695dbac
dfe1658
3d5a3ac
c7ec92a
b5bdcd8
6e35f19
07133b3
deba604
f489476
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| import QtQuick | ||
|
|
||
| /** | ||
| * SafeLoader - A Loader with built-in error handling and fallback UI | ||
| * Use this instead of plain Loader for components that may fail to load | ||
| */ | ||
| Item { | ||
| id: root | ||
|
|
||
| property var sourceComponent | ||
| property string placeholderText: "Loading..." | ||
| property bool showPlaceholder: true | ||
| property color placeholderColor: "#808080" | ||
| property var fallbackItem | ||
|
|
||
| // Internal loader — not exposed as public API to prevent callers from | ||
| // bypassing root.sourceComponent and writing to it directly. | ||
| Loader { | ||
| id: internalLoader | ||
| anchors.fill: parent | ||
| sourceComponent: root.sourceComponent | ||
| asynchronous: true | ||
|
|
||
| onStatusChanged: { | ||
| if (internalLoader.status === Loader.Error) { | ||
| console.error("[SafeLoader] Failed to load component:", internalLoader.errorString); | ||
| root.handleError(internalLoader.errorString); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| signal loadError(string errorString) | ||
|
|
||
| function handleError(errorString) { | ||
| root.loadError(errorString); | ||
| } | ||
|
|
||
| // Read-only state properties | ||
| readonly property bool isLoading: internalLoader.status === Loader.Loading | ||
| readonly property bool hasError: internalLoader.status === Loader.Error | ||
| readonly property bool isReady: internalLoader.status === Loader.Ready | ||
|
|
||
| // Fallback content when loading or error | ||
| StyledRect { | ||
| id: placeholder | ||
| anchors.fill: parent | ||
| visible: root.showPlaceholder && (root.isLoading || root.hasError) && !root.fallbackItem | ||
| color: root.hasError ? "#20000000" : "transparent" | ||
|
|
||
| Text { | ||
| anchors.centerIn: parent | ||
| text: root.hasError ? "Failed to load" : root.placeholderText | ||
| color: root.placeholderColor | ||
| font.pixelSize: 14 | ||
| } | ||
| } | ||
|
|
||
| // Container for a caller-supplied fallback item; shown on error only. | ||
| Item { | ||
| id: fallbackContainer | ||
| anchors.fill: parent | ||
| visible: root.fallbackItem !== null && root.hasError | ||
| z: 10 | ||
| } | ||
|
|
||
| // Reparent a caller-supplied item into the fallback container so it | ||
| // becomes visible when the load fails. | ||
| function setFallback(item) { | ||
| root.fallbackItem = item; | ||
| item.parent = fallbackContainer; | ||
| } | ||
|
|
||
| // Retry loading by null-cycling sourceComponent (standard QML pattern). | ||
| function retry() { | ||
| var current = root.sourceComponent; | ||
| internalLoader.sourceComponent = null; | ||
| internalLoader.sourceComponent = current; | ||
|
Comment on lines
+76
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StyledRectrequires itsvariantproperty, but this placeholder instance never sets one. As soon asSafeLoaderis instantiated, QML will raise a required-property initialization error for this child and the fallback/loading UI cannot be created reliably. Assign a valid variant (for example"common"or"popup") on thisStyledRectinstance.Useful? React with 👍 / 👎.