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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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