mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2026-04-10 06:11:54 +10:00
Some checks failed
Build / Nix (push) Has been cancelled
Build / Nix-1 (push) Has been cancelled
Build / Nix-2 (push) Has been cancelled
Build / Nix-3 (push) Has been cancelled
Build / Nix-4 (push) Has been cancelled
Build / Nix-5 (push) Has been cancelled
Build / Nix-6 (push) Has been cancelled
Build / Nix-7 (push) Has been cancelled
Build / Nix-8 (push) Has been cancelled
Build / Nix-9 (push) Has been cancelled
Build / Nix-10 (push) Has been cancelled
Build / Nix-11 (push) Has been cancelled
Build / Nix-12 (push) Has been cancelled
Build / Nix-13 (push) Has been cancelled
Build / Nix-14 (push) Has been cancelled
Build / Nix-15 (push) Has been cancelled
Build / Nix-16 (push) Has been cancelled
Build / Nix-17 (push) Has been cancelled
Build / Nix-18 (push) Has been cancelled
Build / Nix-19 (push) Has been cancelled
Build / Nix-20 (push) Has been cancelled
Build / Nix-21 (push) Has been cancelled
Build / Nix-22 (push) Has been cancelled
Build / Nix-23 (push) Has been cancelled
Build / Nix-24 (push) Has been cancelled
Build / Nix-25 (push) Has been cancelled
Build / Nix-26 (push) Has been cancelled
Build / Nix-27 (push) Has been cancelled
Build / Nix-28 (push) Has been cancelled
Build / Nix-29 (push) Has been cancelled
Build / Nix-30 (push) Has been cancelled
Build / Nix-31 (push) Has been cancelled
Build / Archlinux (push) Has been cancelled
Lint / Lint (push) Has been cancelled
This change requires more QtPrivate usage but eliminates generation or cleanup related window incubation controller bugs. Additionally it enables async loads prior to rendering windows.
100 lines
2.6 KiB
C++
100 lines
2.6 KiB
C++
#pragma once
|
|
|
|
#include <qcontainerfwd.h>
|
|
#include <qdir.h>
|
|
#include <qfilesystemwatcher.h>
|
|
#include <qhash.h>
|
|
#include <qlist.h>
|
|
#include <qobject.h>
|
|
#include <qqmlengine.h>
|
|
#include <qqmlerror.h>
|
|
#include <qqmlincubator.h>
|
|
#include <qquickwindow.h>
|
|
#include <qtclasshelpermacros.h>
|
|
|
|
#include "incubator.hpp"
|
|
#include "qsintercept.hpp"
|
|
#include "scan.hpp"
|
|
#include "singleton.hpp"
|
|
|
|
class RootWrapper;
|
|
class QuickshellGlobal;
|
|
|
|
class EngineGenerationExt {
|
|
public:
|
|
EngineGenerationExt() = default;
|
|
virtual ~EngineGenerationExt() = default;
|
|
Q_DISABLE_COPY_MOVE(EngineGenerationExt);
|
|
};
|
|
|
|
class EngineGeneration: public QObject {
|
|
Q_OBJECT;
|
|
|
|
public:
|
|
explicit EngineGeneration();
|
|
explicit EngineGeneration(const QDir& rootPath, QmlScanner scanner);
|
|
~EngineGeneration() override;
|
|
Q_DISABLE_COPY_MOVE(EngineGeneration);
|
|
|
|
// assumes root has been initialized, consumes old generation
|
|
void onReload(EngineGeneration* old);
|
|
void setWatchingFiles(bool watching);
|
|
bool setExtraWatchedFiles(const QVector<QString>& files);
|
|
|
|
void trackWindowIncubationController(QQuickWindow* window);
|
|
|
|
// takes ownership
|
|
void registerExtension(const void* key, EngineGenerationExt* extension);
|
|
EngineGenerationExt* findExtension(const void* key);
|
|
|
|
static EngineGeneration* findEngineGeneration(const QQmlEngine* engine);
|
|
static EngineGeneration* findObjectGeneration(const QObject* object);
|
|
|
|
// Returns the current generation if there is only one generation,
|
|
// otherwise null.
|
|
static EngineGeneration* currentGeneration();
|
|
|
|
RootWrapper* wrapper = nullptr;
|
|
QDir rootPath;
|
|
QmlScanner scanner;
|
|
QsUrlInterceptor urlInterceptor;
|
|
QsInterceptNetworkAccessManagerFactory interceptNetFactory;
|
|
QQmlEngine* engine = nullptr;
|
|
QObject* root = nullptr;
|
|
SingletonRegistry singletonRegistry;
|
|
QFileSystemWatcher* watcher = nullptr;
|
|
QVector<QString> deletedWatchedFiles;
|
|
QVector<QString> extraWatchedFiles;
|
|
QsIncubationController incubationController;
|
|
bool reloadComplete = false;
|
|
QuickshellGlobal* qsgInstance = nullptr;
|
|
|
|
void destroy();
|
|
void shutdown();
|
|
|
|
signals:
|
|
void filesChanged();
|
|
void reloadFinished();
|
|
void firePostReload();
|
|
|
|
public slots:
|
|
void quit();
|
|
void exit(int code);
|
|
|
|
private slots:
|
|
void onFileChanged(const QString& name);
|
|
void onDirectoryChanged();
|
|
void onTrackedWindowDestroyed(QObject* object);
|
|
static void onEngineWarnings(const QList<QQmlError>& warnings);
|
|
|
|
private:
|
|
void postReload();
|
|
void updateIncubationMode();
|
|
QVector<QQuickWindow*> trackedWindows;
|
|
bool incubationControllersLocked = false;
|
|
QHash<const void*, EngineGenerationExt*> extensions;
|
|
|
|
bool destroying = false;
|
|
bool shouldTerminate = false;
|
|
int exitCode = 0;
|
|
};
|