core/plugin: rename QuickshellPlugin to QsEnginePlugin

Fixes conflict with the autogenerated qml plugin of the same name.
This commit is contained in:
outfoxxed 2024-11-22 18:59:15 -08:00
parent afa1b6f88b
commit 2996e40ff9
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
8 changed files with 27 additions and 27 deletions

View file

@ -42,7 +42,7 @@ EngineGeneration::EngineGeneration(const QDir& rootPath, QmlScanner scanner)
this->engine->addImageProvider("qsimage", new QsImageProvider()); this->engine->addImageProvider("qsimage", new QsImageProvider());
this->engine->addImageProvider("qspixmap", new QsPixmapProvider()); this->engine->addImageProvider("qspixmap", new QsPixmapProvider());
QuickshellPlugin::runConstructGeneration(*this); QsEnginePlugin::runConstructGeneration(*this);
} }
EngineGeneration::~EngineGeneration() { EngineGeneration::~EngineGeneration() {
@ -141,7 +141,7 @@ void EngineGeneration::postReload() {
// This can be called on a generation during its destruction. // This can be called on a generation during its destruction.
if (this->engine == nullptr || this->root == nullptr) return; if (this->engine == nullptr || this->root == nullptr) return;
QuickshellPlugin::runOnReload(); QsEnginePlugin::runOnReload();
PostReloadHook::postReloadTree(this->root); PostReloadHook::postReloadTree(this->root);
this->singletonRegistry.onPostReload(); this->singletonRegistry.onPostReload();
} }

View file

@ -5,41 +5,41 @@
#include "generation.hpp" #include "generation.hpp"
static QVector<QuickshellPlugin*> plugins; // NOLINT static QVector<QsEnginePlugin*> plugins; // NOLINT
void QuickshellPlugin::registerPlugin(QuickshellPlugin& plugin) { plugins.push_back(&plugin); } void QsEnginePlugin::registerPlugin(QsEnginePlugin& plugin) { plugins.push_back(&plugin); }
void QuickshellPlugin::initPlugins() { void QsEnginePlugin::initPlugins() {
plugins.erase( plugins.erase(
std::remove_if( std::remove_if(
plugins.begin(), plugins.begin(),
plugins.end(), plugins.end(),
[](QuickshellPlugin* plugin) { return !plugin->applies(); } [](QsEnginePlugin* plugin) { return !plugin->applies(); }
), ),
plugins.end() plugins.end()
); );
std::sort(plugins.begin(), plugins.end(), [](QuickshellPlugin* a, QuickshellPlugin* b) { std::sort(plugins.begin(), plugins.end(), [](QsEnginePlugin* a, QsEnginePlugin* b) {
return b->dependencies().contains(a->name()); return b->dependencies().contains(a->name());
}); });
for (QuickshellPlugin* plugin: plugins) { for (QsEnginePlugin* plugin: plugins) {
plugin->init(); plugin->init();
} }
for (QuickshellPlugin* plugin: plugins) { for (QsEnginePlugin* plugin: plugins) {
plugin->registerTypes(); plugin->registerTypes();
} }
} }
void QuickshellPlugin::runConstructGeneration(EngineGeneration& generation) { void QsEnginePlugin::runConstructGeneration(EngineGeneration& generation) {
for (QuickshellPlugin* plugin: plugins) { for (QsEnginePlugin* plugin: plugins) {
plugin->constructGeneration(generation); plugin->constructGeneration(generation);
} }
} }
void QuickshellPlugin::runOnReload() { void QsEnginePlugin::runOnReload() {
for (QuickshellPlugin* plugin: plugins) { for (QsEnginePlugin* plugin: plugins) {
plugin->onReload(); plugin->onReload();
} }
} }

View file

@ -6,14 +6,14 @@
class EngineGeneration; class EngineGeneration;
class QuickshellPlugin { class QsEnginePlugin {
public: public:
QuickshellPlugin() = default; QsEnginePlugin() = default;
virtual ~QuickshellPlugin() = default; virtual ~QsEnginePlugin() = default;
QuickshellPlugin(QuickshellPlugin&&) = delete; QsEnginePlugin(QsEnginePlugin&&) = delete;
QuickshellPlugin(const QuickshellPlugin&) = delete; QsEnginePlugin(const QsEnginePlugin&) = delete;
void operator=(QuickshellPlugin&&) = delete; void operator=(QsEnginePlugin&&) = delete;
void operator=(const QuickshellPlugin&) = delete; void operator=(const QsEnginePlugin&) = delete;
virtual QString name() { return QString(); } virtual QString name() { return QString(); }
virtual QList<QString> dependencies() { return {}; } virtual QList<QString> dependencies() { return {}; }
@ -23,7 +23,7 @@ public:
virtual void constructGeneration(EngineGeneration& /*unused*/) {} // NOLINT virtual void constructGeneration(EngineGeneration& /*unused*/) {} // NOLINT
virtual void onReload() {} virtual void onReload() {}
static void registerPlugin(QuickshellPlugin& plugin); static void registerPlugin(QsEnginePlugin& plugin);
static void initPlugins(); static void initPlugins();
static void runConstructGeneration(EngineGeneration& generation); static void runConstructGeneration(EngineGeneration& generation);
static void runOnReload(); static void runOnReload();
@ -33,6 +33,6 @@ public:
#define QS_REGISTER_PLUGIN(clazz) \ #define QS_REGISTER_PLUGIN(clazz) \
[[gnu::constructor]] void qsInitPlugin() { \ [[gnu::constructor]] void qsInitPlugin() { \
static clazz plugin; \ static clazz plugin; \
QuickshellPlugin::registerPlugin(plugin); \ QsEnginePlugin::registerPlugin(plugin); \
} }
// NOLINTEND // NOLINTEND

View file

@ -3,7 +3,7 @@
namespace { namespace {
class IoPlugin: public QuickshellPlugin { class IoPlugin: public QsEnginePlugin {
void onReload() override { DisownedProcessContext::destroyInstance(); } void onReload() override { DisownedProcessContext::destroyInstance(); }
}; };

View file

@ -212,7 +212,7 @@ int launch(const LaunchArgs& args, char** argv, QCoreApplication* coreApplicatio
QQmlDebuggingEnabler::startTcpDebugServer(args.debugPort, wait); QQmlDebuggingEnabler::startTcpDebugServer(args.debugPort, wait);
} }
QuickshellPlugin::initPlugins(); QsEnginePlugin::initPlugins();
// Base window transparency appears to be additive. // Base window transparency appears to be additive.
// Use a fully transparent window with a colored rect. // Use a fully transparent window with a colored rect.

View file

@ -15,7 +15,7 @@ void installPopupPositioner();
namespace { namespace {
class WaylandPlugin: public QuickshellPlugin { class WaylandPlugin: public QsEnginePlugin {
QList<QString> dependencies() override { return {"window"}; } QList<QString> dependencies() override { return {"window"}; }
bool applies() override { bool applies() override {

View file

@ -5,7 +5,7 @@
namespace { namespace {
class WindowPlugin: public QuickshellPlugin { class WindowPlugin: public QsEnginePlugin {
// _Window has to be registered before wayland or x11 modules, otherwise module overlays // _Window has to be registered before wayland or x11 modules, otherwise module overlays
// will apply in the wrong order. // will apply in the wrong order.
QString name() override { return "window"; } QString name() override { return "window"; }

View file

@ -9,7 +9,7 @@
namespace { namespace {
class X11Plugin: public QuickshellPlugin { class X11Plugin: public QsEnginePlugin {
QList<QString> dependencies() override { return {"window"}; } QList<QString> dependencies() override { return {"window"}; }
bool applies() override { return QGuiApplication::platformName() == "xcb"; } bool applies() override { return QGuiApplication::platformName() == "xcb"; }