fix: define declared method + insert new bar entries to config file list + rename Hyprsunset -> Nightlight

This commit is contained in:
2026-09-30 14:26:56 +02:00
parent 133d453f6f
commit 10d763cfe5
23 changed files with 1445 additions and 1184 deletions
+60 -43
View File
@@ -5,65 +5,82 @@
namespace ZShell::settings {
class ListNode : public Node {
Q_OBJECT
QML_ANONYMOUS
Q_OBJECT
QML_ANONYMOUS
Q_PROPERTY(qsizetype count READ count NOTIFY countChanged)
Q_PROPERTY(QVariantList values READ values NOTIFY elementsChanged)
Q_PROPERTY(qsizetype count READ count NOTIFY countChanged)
Q_PROPERTY(QVariantList values READ values NOTIFY elementsChanged)
using NodeChanges = QList<qsizetype>;
using MoveChanges = QList<QPair<qsizetype, qsizetype>>;
using NodeChanges = QList<qsizetype>;
using MoveChanges = QList<QPair<qsizetype, qsizetype>>;
public:
explicit ListNode(ListNode* fallback, QObject* parent = nullptr, bool globalOnly = false);
public:
explicit ListNode(
ListNode* fallback, QObject* parent = nullptr, bool globalOnly = false);
[[nodiscard]] qsizetype count() const;
[[nodiscard]] QVariantList values() const;
[[nodiscard]] qsizetype count() const;
[[nodiscard]] QVariantList values() const;
Q_INVOKABLE void remove(qsizetype index);
Q_INVOKABLE void move(qsizetype from, qsizetype to);
Q_INVOKABLE void clear();
Q_INVOKABLE void remove(qsizetype index);
Q_INVOKABLE void move(qsizetype from, qsizetype to);
Q_INVOKABLE void clear();
[[nodiscard]] QString pathFor(const QString& key) const override;
[[nodiscard]] const Schema& schema() const override;
[[nodiscard]] QVariant value(const QString& key) const override;
bool setValue(const QString& key, const QVariant& value) override;
bool setValue(const QString& key, const QVariant& value, QList<Diagnostic>* diagnostics);
void resetToDefaults() override;
[[nodiscard]] QString pathFor(const QString& key) const override;
[[nodiscard]] const Schema& schema() const override;
[[nodiscard]] QVariant value(const QString& key) const override;
bool setValue(const QString& key, const QVariant& value) override;
bool setValue(
const QString& key,
const QVariant& value,
QList<Diagnostic>* diagnostics);
void resetToDefaults() override;
[[nodiscard]] QJsonValue toJson(bool sparse = true) const override;
bool syncJson(const QJsonValue& json, QList<Diagnostic>& diagnostics) override;
[[nodiscard]] QJsonValue toJson(bool sparse = true) const override;
bool syncJson(
const QJsonValue& json, QList<Diagnostic>& diagnostics) override;
signals:
void countChanged();
void elementsChanged(const NodeChanges& added, const NodeChanges& removed, const MoveChanges& moved);
signals:
void countChanged();
void elementsChanged(
const NodeChanges& added,
const NodeChanges& removed,
const MoveChanges& moved);
protected:
bool recordWrite(const QString& key, bool changed) override;
[[nodiscard]] QString keyOf(const Node* child) const override;
protected:
bool recordWrite(const QString& key, bool changed) override;
[[nodiscard]] QString keyOf(const Node* child) const override;
[[nodiscard]] Node* elementAt(qsizetype index) const;
[[nodiscard]] Node* insertElement(const QVariantMap& props, qsizetype index = -1);
[[nodiscard]] virtual Node* createElement(Node* fallback) = 0;
[[nodiscard]] Node* elementAt(qsizetype index) const;
[[nodiscard]] Node* insertElement(
const QVariantMap& props, qsizetype index = -1);
[[nodiscard]] virtual Node* createElement(Node* fallback) = 0;
private:
QList<Node*> m_elements;
private:
QList<Node*> m_elements;
[[nodiscard]] QList<QVariantMap> defaultValue() const;
[[nodiscard]] bool isNested() const;
[[nodiscard]] QList<QVariantMap> defaultValue() const;
[[nodiscard]] bool isNested() const;
// Returns true if the mutation should be skipped, overlays cannot mutate global lists
[[nodiscard]] bool rejectGlobalMutation() const;
// Returns true if the mutation should be skipped, overlays cannot mutate global lists
[[nodiscard]] bool rejectGlobalMutation() const;
[[nodiscard]] bool validIndex(qsizetype index) const;
[[nodiscard]] const Descriptor* getDescriptor() const;
[[nodiscard]] Node* fallbackFor(qsizetype index) const;
[[nodiscard]] bool validIndex(qsizetype index) const;
[[nodiscard]] const Descriptor* getDescriptor() const;
[[nodiscard]] Node* fallbackFor(qsizetype index) const;
Node* insertNode(qsizetype index, const QVariantMap& props, Node* fallback);
Node* insertNode(qsizetype index, Node* node);
Node* insertNode(qsizetype index, const QJsonObject& json, QList<Diagnostic>& diagnostics);
void insertMissingDefaults();
void onFallbackListNotify(const NodeChanges& added, const NodeChanges& removed, const MoveChanges& moved);
Node* insertNode(qsizetype index, const QVariantMap& props, Node* fallback);
Node* insertNode(qsizetype index, Node* node);
Node* insertNode(
qsizetype index,
const QJsonObject& json,
QList<Diagnostic>& diagnostics);
void onFallbackListNotify(
const NodeChanges& added,
const NodeChanges& removed,
const MoveChanges& moved);
};
} // namespace ZShell::settings