refactor: rm QtShell/ShellComponent code superseded by RootWrapper

This commit is contained in:
outfoxxed 2024-01-31 18:35:51 -08:00
parent 9a5ad44aa9
commit ba1e18a125
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
3 changed files with 12 additions and 115 deletions

View file

@ -1,62 +1,26 @@
#pragma once
#include <qdir.h>
#include <qcontainerfwd.h>
#include <qlogging.h>
#include <qobject.h>
#include <qqmlcomponent.h>
#include <qqmlengine.h>
#include <qqmlintegration.h>
#include <qqmllist.h>
#include <qqmlparserstatus.h>
#include <qtmetamacros.h>
extern QString CONFIG_PATH; // NOLINT
class ShellComponent;
class QtShell: public QObject, public QQmlParserStatus {
class QtShell: public QObject {
Q_OBJECT;
Q_INTERFACES(QQmlParserStatus);
Q_PROPERTY(QQmlListProperty<ShellComponent> components READ components FINAL);
Q_PROPERTY(QQmlListProperty<QObject> components READ components FINAL);
Q_CLASSINFO("DefaultProperty", "components");
QML_ELEMENT;
public:
explicit QtShell();
explicit QtShell(QObject* parent = nullptr): QObject(parent) {}
void classBegin() override {}
void componentComplete() override;
QQmlListProperty<ShellComponent> components();
QQmlListProperty<QObject> components();
public slots:
void reload();
private:
static void appendComponent(QQmlListProperty<ShellComponent>* list, ShellComponent* component);
QList<ShellComponent*> mComponents;
QString path;
QDir dir;
};
class ShellComponent: public QObject {
Q_OBJECT;
Q_PROPERTY(QString source WRITE setSource);
Q_PROPERTY(QQmlComponent* component MEMBER mComponent WRITE setComponent);
Q_CLASSINFO("DefaultProperty", "component");
QML_ELEMENT;
public:
explicit ShellComponent(QObject* parent = nullptr): QObject(parent) {}
void setSource(QString source);
void setComponent(QQmlComponent* component);
void prepare(const QDir& basePath);
signals:
void ready();
private:
QString mSource;
QQmlComponent* mComponent = nullptr;
static void appendComponent(QQmlListProperty<QObject>* list, QObject* component);
};