diff options
author | Petr Mrázek <peterix@gmail.com> | 2016-11-06 21:58:54 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2016-11-06 21:58:54 +0100 |
commit | 8b952b387041341f556edcf0bb34576a2fc88568 (patch) | |
tree | 804b8976355ef3950628647370e7dfc1bdf96b4f /api/logic/screenshots | |
parent | 37cc59c04d0573a42d67242135495c0a0729f965 (diff) | |
download | MultiMC-8b952b387041341f556edcf0bb34576a2fc88568.tar MultiMC-8b952b387041341f556edcf0bb34576a2fc88568.tar.gz MultiMC-8b952b387041341f556edcf0bb34576a2fc88568.tar.lz MultiMC-8b952b387041341f556edcf0bb34576a2fc88568.tar.xz MultiMC-8b952b387041341f556edcf0bb34576a2fc88568.zip |
NOISSUE Refactor and sanitize MultiMC startup/shutdown
* Always create main window.
* Properly handle netowrk manager - it was created twice, leading to potential crashes.
Diffstat (limited to 'api/logic/screenshots')
-rw-r--r-- | api/logic/screenshots/ImgurAlbumCreation.cpp | 6 | ||||
-rw-r--r-- | api/logic/screenshots/ImgurUpload.cpp | 3 |
2 files changed, 3 insertions, 6 deletions
diff --git a/api/logic/screenshots/ImgurAlbumCreation.cpp b/api/logic/screenshots/ImgurAlbumCreation.cpp index e009ef4d..a6964681 100644 --- a/api/logic/screenshots/ImgurAlbumCreation.cpp +++ b/api/logic/screenshots/ImgurAlbumCreation.cpp @@ -33,14 +33,12 @@ void ImgurAlbumCreation::start() const QByteArray data = "ids=" + ids.join(',').toUtf8() + "&title=Minecraft%20Screenshots&privacy=hidden"; - auto worker = ENV.qnam(); - QNetworkReply *rep = worker->post(request, data); + QNetworkReply *rep = ENV.qnam().post(request, data); m_reply.reset(rep); connect(rep, &QNetworkReply::uploadProgress, this, &ImgurAlbumCreation::downloadProgress); connect(rep, &QNetworkReply::finished, this, &ImgurAlbumCreation::downloadFinished); - connect(rep, SIGNAL(error(QNetworkReply::NetworkError)), - SLOT(downloadError(QNetworkReply::NetworkError))); + connect(rep, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(downloadError(QNetworkReply::NetworkError))); } void ImgurAlbumCreation::downloadError(QNetworkReply::NetworkError error) { diff --git a/api/logic/screenshots/ImgurUpload.cpp b/api/logic/screenshots/ImgurUpload.cpp index 48e0ec18..ef7fee6b 100644 --- a/api/logic/screenshots/ImgurUpload.cpp +++ b/api/logic/screenshots/ImgurUpload.cpp @@ -49,8 +49,7 @@ void ImgurUpload::start() namePart.setBody(m_shot->m_file.baseName().toUtf8()); multipart->append(namePart); - auto worker = ENV.qnam(); - QNetworkReply *rep = worker->post(request, multipart); + QNetworkReply *rep = ENV.qnam().post(request, multipart); m_reply.reset(rep); connect(rep, &QNetworkReply::uploadProgress, this, &ImgurUpload::downloadProgress); |