feat(socket): add SocketServer and Socket.write

This commit is contained in:
outfoxxed 2024-03-03 01:26:43 -08:00
parent f004454395
commit f45d298b66
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
5 changed files with 248 additions and 7 deletions

View file

@ -7,8 +7,10 @@
#include <qobject.h>
#include <qqmlcomponent.h>
#include <qqmlengine.h>
#include <qtimer.h>
#include <qurl.h>
#include "reload.hpp"
#include "shell.hpp"
#include "watcher.hpp"
@ -48,14 +50,21 @@ void RootWrapper::reloadGraph(bool hard) {
component.completeCreate();
newRoot->onReload(hard ? nullptr : this->root);
auto* oldRoot = this->root;
this->root = newRoot;
if (this->root != nullptr) {
this->root->deleteLater();
this->root = nullptr;
this->root->onReload(hard ? nullptr : oldRoot);
if (oldRoot != nullptr) {
oldRoot->deleteLater();
QTimer::singleShot(0, [this, newRoot]() {
if (this->root == newRoot) PostReloadHook::postReloadTree(this->root);
});
} else {
PostReloadHook::postReloadTree(newRoot);
}
this->root = newRoot;
this->onConfigChanged();
}