core/reloader: do not require ShellRoot

This commit is contained in:
outfoxxed 2024-11-22 19:40:39 -08:00
parent 2996e40ff9
commit c21df95087
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
3 changed files with 7 additions and 20 deletions

View file

@ -14,7 +14,6 @@
#include "generation.hpp"
#include "qmlglobal.hpp"
#include "scan.hpp"
#include "shell.hpp"
RootWrapper::RootWrapper(QString rootPath, QString shellId)
: QObject(nullptr)
@ -60,9 +59,9 @@ void RootWrapper::reloadGraph(bool hard) {
url.setScheme("qsintercept");
auto component = QQmlComponent(generation->engine, url);
auto* obj = component.beginCreate(generation->engine->rootContext());
auto* newRoot = component.beginCreate(generation->engine->rootContext());
if (obj == nullptr) {
if (newRoot == nullptr) {
const QString error = "failed to create root component\n" + component.errorString();
qWarning().noquote() << error;
generation->destroy();
@ -74,20 +73,6 @@ void RootWrapper::reloadGraph(bool hard) {
return;
}
auto* newRoot = qobject_cast<ShellRoot*>(obj);
if (newRoot == nullptr) {
const QString error = "root component was not a Quickshell.ShellRoot";
qWarning().noquote() << error;
delete obj;
generation->destroy();
if (this->generation != nullptr && this->generation->qsgInstance != nullptr) {
emit this->generation->qsgInstance->reloadFailed(error);
}
return;
}
generation->root = newRoot;
component.completeCreate();