fix: define declared method + insert new bar entries to config file list + rename Hyprsunset -> Nightlight
C++ / fmt (pull_request) Failing after 5s
C++ / build (pull_request) Failing after 10s
JS/TS / fmt (pull_request) Successful in 6s
C++ / clang-tidy (pull_request) Failing after 21s
JS/TS / lint (pull_request) Successful in 10s
Python / static (pull_request) Successful in 26s
Rust / build (pull_request) Successful in 47s
Rust / fmt (pull_request) Successful in 28s
Python / verify (pull_request) Successful in 1m39s
Rust / clippy (pull_request) Successful in 46s

This commit is contained in:
2026-09-28 13:11:31 +02:00
parent 5618ba9e6b
commit 4c3d38f023
23 changed files with 1443 additions and 1182 deletions
+22 -21
View File
@@ -5,42 +5,43 @@
namespace ZShell::settings {
RootNode::RootNode(const QString& path, RootNode* fallback, QObject* parent)
: ObjectNode(fallback, parent)
, m_file(new SettingsFile(path, this)) {
QObject::connect(batcher(), &ChangeBatcher::dirtied, this, &RootNode::saveToFile);
QObject::connect(m_file, &SettingsFile::changed, this, &RootNode::reloadFromFile);
QObject::connect(m_file, &SettingsFile::readFailed, this, [this](const QString& error) {
emit treeLoadFailed(this, error);
});
QObject::connect(m_file, &SettingsFile::writeFailed, this, [this](const QString& error) {
emit treeSaveFailed(this, error);
});
: ObjectNode(fallback, parent), m_file(new SettingsFile(path, this)) {
QObject::connect(
batcher(), &ChangeBatcher::dirtied, this, &RootNode::saveToFile);
QObject::connect(
m_file, &SettingsFile::changed, this, &RootNode::reloadFromFile);
QObject::connect(
m_file, &SettingsFile::readFailed, this, [this](const QString& error) {
emit treeLoadFailed(this, error);
});
QObject::connect(
m_file, &SettingsFile::writeFailed, this, [this](const QString& error) {
emit treeSaveFailed(this, error);
});
}
void RootNode::load() {
if (m_file->load() != SettingsFile::LoadResult::Changed)
reloadFromFile();
if (m_file->load() != SettingsFile::LoadResult::Changed) reloadFromFile();
}
QList<Diagnostic> RootNode::diagnostics() const {
return m_diagnostics;
return m_diagnostics;
}
void RootNode::reloadFromFile() {
const auto oldDiagnostics = m_diagnostics;
m_diagnostics.clear();
const auto oldDiagnostics = m_diagnostics;
m_diagnostics.clear();
const auto data = m_file->read();
syncJson(data ? data.value() : QJsonObject(), m_diagnostics);
const auto data = m_file->read();
syncJson(data ? data.value() : QJsonObject(), m_diagnostics);
if (m_diagnostics != oldDiagnostics)
emit diagnosticsChanged();
if (m_diagnostics != oldDiagnostics) emit diagnosticsChanged();
emit treeLoaded(this);
emit treeLoaded(this);
}
void RootNode::saveToFile() {
m_file->write(toJson());
m_file->write(toJson());
}
} // namespace ZShell::settings