forked from quickshell/quickshell
feat: add filesystem watcher and rename QtShell object
This commit is contained in:
parent
cab5ffc65e
commit
c0d6e63f6c
9 changed files with 142 additions and 42 deletions
|
@ -9,24 +9,40 @@
|
|||
|
||||
#include "scavenge.hpp"
|
||||
|
||||
class QtShell: public Scavenger, virtual public Scavengeable {
|
||||
class ShellConfig {
|
||||
Q_GADGET;
|
||||
Q_PROPERTY(bool watchFiles MEMBER mWatchFiles);
|
||||
|
||||
public:
|
||||
bool mWatchFiles = true;
|
||||
};
|
||||
|
||||
class ShellRoot: public Scavenger, virtual public Scavengeable {
|
||||
Q_OBJECT;
|
||||
Q_PROPERTY(ShellConfig config READ config WRITE setConfig);
|
||||
Q_PROPERTY(QQmlListProperty<QObject> components READ components FINAL);
|
||||
Q_CLASSINFO("DefaultProperty", "components");
|
||||
QML_ELEMENT;
|
||||
|
||||
public:
|
||||
explicit QtShell(QObject* parent = nullptr): Scavenger(parent) {}
|
||||
explicit ShellRoot(QObject* parent = nullptr): Scavenger(parent) {}
|
||||
|
||||
void earlyInit(QObject* old) override;
|
||||
QObject* scavengeTargetFor(QObject* child) override;
|
||||
|
||||
void setConfig(ShellConfig config);
|
||||
[[nodiscard]] ShellConfig config() const;
|
||||
|
||||
QQmlListProperty<QObject> components();
|
||||
|
||||
signals:
|
||||
void configChanged();
|
||||
|
||||
private:
|
||||
static void appendComponent(QQmlListProperty<QObject>* list, QObject* component);
|
||||
|
||||
public:
|
||||
ShellConfig mConfig;
|
||||
|
||||
// track only the children assigned to `components` in order
|
||||
QList<QObject*> children;
|
||||
QList<QObject*> scavengeableChildren;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue