aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp')
-rw-r--r--src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp b/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp
index 35bb29f82f1..93db5ac62ab 100644
--- a/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp
+++ b/src/libs/3rdparty/syntax-highlighting/src/lib/definitiondownloader.cpp
@@ -43,7 +43,7 @@ void DefinitionDownloaderPrivate::definitionListDownloadFinished(QNetworkReply *
const auto networkError = reply->error();
if (networkError != QNetworkReply::NoError) {
qCWarning(Log) << networkError;
- emit q->done(); // TODO return error
+ Q_EMIT q->done(); // TODO return error
return;
}
@@ -60,7 +60,7 @@ void DefinitionDownloaderPrivate::definitionListDownloadFinished(QNetworkReply *
}
if (pendingDownloads == 0)
- emit q->informationMessage(QObject::tr("All syntax definitions are up-to-date."));
+ Q_EMIT q->informationMessage(QObject::tr("All syntax definitions are up-to-date."));
checkDone();
}
@@ -72,14 +72,14 @@ void DefinitionDownloaderPrivate::updateDefinition(QXmlStreamReader &parser)
auto localDef = repo->definitionForName(name.toString());
if (!localDef.isValid()) {
- emit q->informationMessage(QObject::tr("Downloading new syntax definition for '%1'...").arg(name.toString()));
+ Q_EMIT q->informationMessage(QObject::tr("Downloading new syntax definition for '%1'...").arg(name.toString()));
downloadDefinition(QUrl(parser.attributes().value(QLatin1String("url")).toString()));
return;
}
const auto version = parser.attributes().value(QLatin1String("version"));
if (localDef.version() < version.toFloat()) {
- emit q->informationMessage(QObject::tr("Updating syntax definition for '%1' to version %2...").arg(name.toString(), version.toString()));
+ Q_EMIT q->informationMessage(QObject::tr("Updating syntax definition for '%1' to version %2...").arg(name.toString(), version.toString()));
downloadDefinition(QUrl(parser.attributes().value(QLatin1String("url")).toString()));
}
}
@@ -94,7 +94,9 @@ void DefinitionDownloaderPrivate::downloadDefinition(const QUrl &downloadUrl)
QNetworkRequest req(url);
auto reply = nam->get(req);
- QObject::connect(reply, &QNetworkReply::finished, q, [this, reply]() { downloadDefinitionFinished(reply); });
+ QObject::connect(reply, &QNetworkReply::finished, q, [this, reply]() {
+ downloadDefinitionFinished(reply);
+ });
++pendingDownloads;
needsReload = true;
}
@@ -134,7 +136,7 @@ void DefinitionDownloaderPrivate::checkDone()
if (needsReload)
repo->reload();
- emit QTimer::singleShot(0, q, &DefinitionDownloader::done);
+ Q_EMIT QTimer::singleShot(0, q, &DefinitionDownloader::done);
}
}
@@ -161,10 +163,12 @@ DefinitionDownloader::~DefinitionDownloader()
void DefinitionDownloader::start()
{
- const QString url = QLatin1String("https://www.kate-editor.org/syntax/update-") + QString::number(SyntaxHighlighting_VERSION_MAJOR) + QLatin1Char('.') + QString::number(SyntaxHighlighting_VERSION_MINOR) + QLatin1String(".xml");
+ const QString url = QLatin1String("https://www.kate-editor.org/syntax/update-") + QString::number(SyntaxHighlighting_VERSION_MAJOR) + QLatin1Char('.')
+ + QString::number(SyntaxHighlighting_VERSION_MINOR) + QLatin1String(".xml");
auto req = QNetworkRequest(QUrl(url));
- req.setAttribute(QNetworkRequest::RedirectPolicyAttribute,
- QNetworkRequest::NoLessSafeRedirectPolicy);
+ req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
auto reply = d->nam->get(req);
- QObject::connect(reply, &QNetworkReply::finished, this, [=]() { d->definitionListDownloadFinished(reply); });
+ QObject::connect(reply, &QNetworkReply::finished, this, [=]() {
+ d->definitionListDownloadFinished(reply);
+ });
}