fix: signal and emit macros -> keywords

Only the ones inside macros are unable to use the keywords
This commit is contained in:
2 * r + 2 * t 2026-04-11 20:16:37 +10:00
parent d5d6f70f52
commit 4f2b90147e
7 changed files with 34 additions and 24 deletions

View file

@ -35,7 +35,8 @@ public:
[[nodiscard]] int large() const; [[nodiscard]] int large() const;
[[nodiscard]] int full() const; [[nodiscard]] int full() const;
Q_SIGNAL void valuesChanged(); signals:
void valuesChanged();
private: private:
RoundingTokens* m_tokens = nullptr; RoundingTokens* m_tokens = nullptr;
@ -65,7 +66,8 @@ public:
[[nodiscard]] int larger() const; [[nodiscard]] int larger() const;
[[nodiscard]] int large() const; [[nodiscard]] int large() const;
Q_SIGNAL void valuesChanged(); signals:
void valuesChanged();
private: private:
SpacingTokens* m_tokens = nullptr; SpacingTokens* m_tokens = nullptr;
@ -95,7 +97,8 @@ public:
[[nodiscard]] int larger() const; [[nodiscard]] int larger() const;
[[nodiscard]] int large() const; [[nodiscard]] int large() const;
Q_SIGNAL void valuesChanged(); signals:
void valuesChanged();
private: private:
PaddingTokens* m_tokens = nullptr; PaddingTokens* m_tokens = nullptr;
@ -141,7 +144,8 @@ public:
[[nodiscard]] int large() const; [[nodiscard]] int large() const;
[[nodiscard]] int extraLarge() const; [[nodiscard]] int extraLarge() const;
Q_SIGNAL void valuesChanged(); signals:
void valuesChanged();
private: private:
FontSizeTokens* m_tokens = nullptr; FontSizeTokens* m_tokens = nullptr;
@ -189,7 +193,8 @@ public:
[[nodiscard]] int expressiveDefaultSpatial() const; [[nodiscard]] int expressiveDefaultSpatial() const;
[[nodiscard]] int expressiveSlowSpatial() const; [[nodiscard]] int expressiveSlowSpatial() const;
Q_SIGNAL void valuesChanged(); signals:
void valuesChanged();
private: private:
AnimDurationTokens* m_tokens = nullptr; AnimDurationTokens* m_tokens = nullptr;

View file

@ -116,7 +116,8 @@ public:
static Config* qmlAttachedProperties(QObject* object); static Config* qmlAttachedProperties(QObject* object);
Q_SIGNAL void sourceChanged(); signals:
void sourceChanged();
private: private:
void connectScope(); void connectScope();

View file

@ -276,7 +276,7 @@ void ConfigObject::emitBatchedChanges() {
auto changes = std::move(m_pendingChanges); auto changes = std::move(m_pendingChanges);
m_pendingChanges.clear(); m_pendingChanges.clear();
Q_EMIT propertiesChanged(changes); emit propertiesChanged(changes);
} }
void ConfigObject::setupFileBackend(const QString& path) { void ConfigObject::setupFileBackend(const QString& path) {
@ -300,14 +300,14 @@ void ConfigObject::setupFileBackend(const QString& path) {
if (!file.open(QIODevice::WriteOnly)) { if (!file.open(QIODevice::WriteOnly)) {
qCWarning(lcConfig, "Failed to write %s", qUtf8Printable(m_filePath)); qCWarning(lcConfig, "Failed to write %s", qUtf8Printable(m_filePath));
if (auto* root = qobject_cast<RootConfig*>(this)) if (auto* root = qobject_cast<RootConfig*>(this))
Q_EMIT root->fileSaveFailed(QStringLiteral("Failed to open file for writing")); emit root->fileSaveFailed(QStringLiteral("Failed to open file for writing"));
return; return;
} }
auto json = m_sparse ? toSparseJsonObject() : toJsonObject(); auto json = m_sparse ? toSparseJsonObject() : toJsonObject();
file.write(QJsonDocument(json).toJson(QJsonDocument::Indented)); file.write(QJsonDocument(json).toJson(QJsonDocument::Indented));
if (auto* root = qobject_cast<RootConfig*>(this)) if (auto* root = qobject_cast<RootConfig*>(this))
Q_EMIT root->fileSaved(); emit root->fileSaved();
}); });
m_cooldownTimer->setSingleShot(true); m_cooldownTimer->setSingleShot(true);
@ -387,9 +387,9 @@ void ConfigObject::onFileChanged() {
bool ok = reloadFromFile(); bool ok = reloadFromFile();
if (auto* root = qobject_cast<RootConfig*>(this)) { if (auto* root = qobject_cast<RootConfig*>(this)) {
if (ok) if (ok)
Q_EMIT root->fileLoaded(); emit root->fileLoaded();
else else
Q_EMIT root->fileLoadFailed(QStringLiteral("Failed to load config file")); emit root->fileLoadFailed(QStringLiteral("Failed to load config file"));
} }
} }
} }
@ -405,7 +405,7 @@ void RootConfig::save() {
void RootConfig::reload() { void RootConfig::reload() {
if (reloadFromFile()) if (reloadFromFile())
Q_EMIT fileLoaded(); emit fileLoaded();
} }
} // namespace caelestia::config } // namespace caelestia::config

View file

@ -87,7 +87,8 @@ public:
return true; return true;
} }
Q_SIGNAL void propertiesChanged(const QMap<QString, QVariant>& changed); signals:
void propertiesChanged(const QMap<QString, QVariant>& changed);
protected: protected:
void notifyPropertyChanged(const QString& name, const QVariant& value); void notifyPropertyChanged(const QString& name, const QVariant& value);
@ -126,10 +127,11 @@ public:
Q_INVOKABLE void save(); Q_INVOKABLE void save();
Q_INVOKABLE void reload(); Q_INVOKABLE void reload();
Q_SIGNAL void fileLoaded(); signals:
Q_SIGNAL void fileLoadFailed(const QString& error); void fileLoaded();
Q_SIGNAL void fileSaved(); void fileLoadFailed(const QString& error);
Q_SIGNAL void fileSaveFailed(const QString& error); void fileSaved();
void fileSaveFailed(const QString& error);
}; };
} // namespace caelestia::config } // namespace caelestia::config

View file

@ -11,7 +11,7 @@ void ConfigScope::setScreen(const QString& screen) {
return; return;
m_screen = screen; m_screen = screen;
Q_EMIT screenChanged(); emit screenChanged();
resolveConfig(); resolveConfig();
} }
@ -28,12 +28,12 @@ void ConfigScope::resolveConfig() {
if (m_config != newConfig) { if (m_config != newConfig) {
m_config = newConfig; m_config = newConfig;
Q_EMIT configChanged(); emit configChanged();
} }
if (m_tokens != newTokens) { if (m_tokens != newTokens) {
m_tokens = newTokens; m_tokens = newTokens;
Q_EMIT tokensChanged(); emit tokensChanged();
} }
} }

View file

@ -31,9 +31,10 @@ public:
static ConfigScope* find(QObject* object); static ConfigScope* find(QObject* object);
Q_SIGNAL void screenChanged(); signals:
Q_SIGNAL void configChanged(); void screenChanged();
Q_SIGNAL void tokensChanged(); void configChanged();
void tokensChanged();
private: private:
void resolveConfig(); void resolveConfig();

View file

@ -363,7 +363,8 @@ public:
static Tokens* qmlAttachedProperties(QObject* object); static Tokens* qmlAttachedProperties(QObject* object);
Q_SIGNAL void sourceChanged(); signals:
void sourceChanged();
private: private:
void connectScope(); void connectScope();