aboutsummaryrefslogtreecommitdiff
path: root/launcher/screenshots/ImgurAlbumCreation.cpp
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2023-08-14 18:16:53 +0200
committerSefa Eyeoglu <contact@scrumplex.net>2023-08-14 18:16:53 +0200
commit91ba4cf75ee30c64779edb5b7644e5a830de5026 (patch)
treeaa8c2433bfc3a54577aceeb706c4c2cd0986c95d /launcher/screenshots/ImgurAlbumCreation.cpp
parent779f70057b021e285afd60cc650a14cd5feacffd (diff)
downloadPrismLauncher-91ba4cf75ee30c64779edb5b7644e5a830de5026.tar.gz
PrismLauncher-91ba4cf75ee30c64779edb5b7644e5a830de5026.tar.bz2
PrismLauncher-91ba4cf75ee30c64779edb5b7644e5a830de5026.zip
chore: reformat
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Diffstat (limited to 'launcher/screenshots/ImgurAlbumCreation.cpp')
-rw-r--r--launcher/screenshots/ImgurAlbumCreation.cpp28
1 files changed, 11 insertions, 17 deletions
diff --git a/launcher/screenshots/ImgurAlbumCreation.cpp b/launcher/screenshots/ImgurAlbumCreation.cpp
index 78bf111e..4f087b0f 100644
--- a/launcher/screenshots/ImgurAlbumCreation.cpp
+++ b/launcher/screenshots/ImgurAlbumCreation.cpp
@@ -36,15 +36,15 @@
#include "ImgurAlbumCreation.h"
-#include <QNetworkRequest>
+#include <QDebug>
#include <QJsonDocument>
#include <QJsonObject>
-#include <QUrl>
+#include <QNetworkRequest>
#include <QStringList>
-#include <QDebug>
+#include <QUrl>
-#include "BuildConfig.h"
#include "Application.h"
+#include "BuildConfig.h"
ImgurAlbumCreation::ImgurAlbumCreation(QList<ScreenShot::Ptr> screenshots) : NetAction(), m_screenshots(screenshots)
{
@@ -62,19 +62,18 @@ void ImgurAlbumCreation::executeTask()
request.setRawHeader("Accept", "application/json");
QStringList hashes;
- for (auto shot : m_screenshots)
- {
+ for (auto shot : m_screenshots) {
hashes.append(shot->m_imgurDeleteHash);
}
const QByteArray data = "deletehashes=" + hashes.join(',').toUtf8() + "&title=Minecraft%20Screenshots&privacy=hidden";
- QNetworkReply *rep = APPLICATION->network()->post(request, data);
+ QNetworkReply* rep = APPLICATION->network()->post(request, data);
m_reply.reset(rep);
connect(rep, &QNetworkReply::uploadProgress, this, &ImgurAlbumCreation::downloadProgress);
connect(rep, &QNetworkReply::finished, this, &ImgurAlbumCreation::downloadFinished);
-#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) // QNetworkReply::errorOccurred added in 5.15
+#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) // QNetworkReply::errorOccurred added in 5.15
connect(rep, &QNetworkReply::errorOccurred, this, &ImgurAlbumCreation::downloadError);
#else
connect(rep, QOverload<QNetworkReply::NetworkError>::of(&QNetworkReply::error), this, &ImgurAlbumCreation::downloadError);
@@ -90,21 +89,18 @@ void ImgurAlbumCreation::downloadError([[maybe_unused]] QNetworkReply::NetworkEr
void ImgurAlbumCreation::downloadFinished()
{
- if (m_state != State::Failed)
- {
+ if (m_state != State::Failed) {
QByteArray data = m_reply->readAll();
m_reply.reset();
QJsonParseError jsonError;
QJsonDocument doc = QJsonDocument::fromJson(data, &jsonError);
- if (jsonError.error != QJsonParseError::NoError)
- {
+ if (jsonError.error != QJsonParseError::NoError) {
qDebug() << jsonError.errorString();
emitFailed();
return;
}
auto object = doc.object();
- if (!object.value("success").toBool())
- {
+ if (!object.value("success").toBool()) {
qDebug() << doc.toJson();
emitFailed();
return;
@@ -114,9 +110,7 @@ void ImgurAlbumCreation::downloadFinished()
m_state = State::Succeeded;
emit succeeded();
return;
- }
- else
- {
+ } else {
qDebug() << m_reply->readAll();
m_reply.reset();
emitFailed();