quickshell/src/core/rootwrapper.hpp
outfoxxed 463f9a297f
root: recreate the qml engine on reload instead of clearing it
This causes singletons to be recreated instead of kept alive.
2024-03-12 14:55:51 -07:00

32 lines
616 B
C++

#pragma once
#include <qobject.h>
#include <qqmlengine.h>
#include <qtclasshelpermacros.h>
#include <qtmetamacros.h>
#include <qurl.h>
#include "shell.hpp"
#include "watcher.hpp"
class RootWrapper: public QObject {
Q_OBJECT;
public:
explicit RootWrapper(QString rootPath);
~RootWrapper() override;
Q_DISABLE_COPY_MOVE(RootWrapper);
void reloadGraph(bool hard);
private slots:
void onWatchFilesChanged();
void onWatchedFilesChanged();
private:
QString rootPath;
QQmlEngine* engine = nullptr;
ShellRoot* root = nullptr;
FiletreeWatcher* configWatcher = nullptr;
QString originalWorkingDirectory;
};