2024-01-25 12:33:02 +00:00
|
|
|
#pragma once
|
|
|
|
|
2024-02-01 02:35:51 +00:00
|
|
|
#include <qcontainerfwd.h>
|
2024-02-01 09:29:45 +00:00
|
|
|
#include <qlist.h>
|
2024-01-25 12:33:02 +00:00
|
|
|
#include <qqmlengine.h>
|
2024-02-01 02:35:51 +00:00
|
|
|
#include <qtmetamacros.h>
|
2024-01-25 12:33:02 +00:00
|
|
|
|
2024-02-01 09:29:45 +00:00
|
|
|
#include "scavenge.hpp"
|
|
|
|
|
2024-02-05 07:00:59 +00:00
|
|
|
class ShellConfig {
|
|
|
|
Q_GADGET;
|
|
|
|
Q_PROPERTY(bool watchFiles MEMBER mWatchFiles);
|
|
|
|
|
|
|
|
public:
|
|
|
|
bool mWatchFiles = true;
|
|
|
|
};
|
|
|
|
|
2024-02-12 12:21:24 +00:00
|
|
|
///! Root config element
|
2024-02-14 11:03:41 +00:00
|
|
|
class ShellRoot: public ScavengeableScope {
|
2024-01-25 12:33:02 +00:00
|
|
|
Q_OBJECT;
|
2024-02-12 12:21:24 +00:00
|
|
|
/// If `config.watchFiles` is true the configuration will be reloaded whenever it changes.
|
|
|
|
/// Defaults to true.
|
2024-02-05 07:00:59 +00:00
|
|
|
Q_PROPERTY(ShellConfig config READ config WRITE setConfig);
|
2024-01-25 12:33:02 +00:00
|
|
|
QML_ELEMENT;
|
|
|
|
|
|
|
|
public:
|
2024-02-14 11:03:41 +00:00
|
|
|
explicit ShellRoot(QObject* parent = nullptr): ScavengeableScope(parent) {}
|
2024-01-25 12:33:02 +00:00
|
|
|
|
2024-02-05 07:00:59 +00:00
|
|
|
void setConfig(ShellConfig config);
|
|
|
|
[[nodiscard]] ShellConfig config() const;
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void configChanged();
|
|
|
|
|
2024-01-25 12:33:02 +00:00
|
|
|
private:
|
2024-02-05 07:00:59 +00:00
|
|
|
ShellConfig mConfig;
|
2024-01-25 12:33:02 +00:00
|
|
|
};
|