summaryrefslogtreecommitdiffstats
path: root/logic/net/PasteUpload.cpp
diff options
context:
space:
mode:
authorJan Dalheimer <jan@dalheimer.de>2014-03-10 19:24:29 +0100
committerJan Dalheimer <jan@dalheimer.de>2014-03-10 19:24:29 +0100
commitfcc5bc2ce0a1c8c3f9df9230710dd60363eb5cdb (patch)
tree851d8f8b6e6734e26fd2e4dc7b7477630329ff01 /logic/net/PasteUpload.cpp
parent73fc9c79cff979e9023df0b1a77848c67b590681 (diff)
parentd11f10ea1ed54336254838ff068258d2d42e0774 (diff)
downloadMultiMC-fcc5bc2ce0a1c8c3f9df9230710dd60363eb5cdb.tar
MultiMC-fcc5bc2ce0a1c8c3f9df9230710dd60363eb5cdb.tar.gz
MultiMC-fcc5bc2ce0a1c8c3f9df9230710dd60363eb5cdb.tar.lz
MultiMC-fcc5bc2ce0a1c8c3f9df9230710dd60363eb5cdb.tar.xz
MultiMC-fcc5bc2ce0a1c8c3f9df9230710dd60363eb5cdb.zip
Merge branch 'develop' into feature_badges
Conflicts: logic/OneSixInstance.cpp
Diffstat (limited to 'logic/net/PasteUpload.cpp')
-rw-r--r--logic/net/PasteUpload.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/logic/net/PasteUpload.cpp b/logic/net/PasteUpload.cpp
index fa54d084..402eb400 100644
--- a/logic/net/PasteUpload.cpp
+++ b/logic/net/PasteUpload.cpp
@@ -25,7 +25,7 @@ void PasteUpload::executeTask()
m_reply = std::shared_ptr<QNetworkReply>(rep);
connect(rep, &QNetworkReply::downloadProgress, [&](qint64 value, qint64 max)
- { setProgress(value / max * 100); });
+ { setProgress(value / qMax((qint64)1, max) * 100); });
connect(rep, SIGNAL(error(QNetworkReply::NetworkError)), this,
SLOT(downloadError(QNetworkReply::NetworkError)));
connect(rep, SIGNAL(finished()), this, SLOT(downloadFinished()));
@@ -52,10 +52,9 @@ void PasteUpload::downloadFinished()
emitFailed(jsonError.errorString());
return;
}
- QString error;
- if (!parseResult(doc, &error))
+ if (!parseResult(doc))
{
- emitFailed(error);
+ emitFailed(tr("paste.ee returned an error. Please consult the logs for more information"));
return;
}
}
@@ -69,13 +68,13 @@ void PasteUpload::downloadFinished()
emitSucceeded();
}
-bool PasteUpload::parseResult(QJsonDocument doc, QString *parseError)
+bool PasteUpload::parseResult(QJsonDocument doc)
{
auto object = doc.object();
auto status = object.value("status").toString("error");
if (status == "error")
{
- parseError = new QString(object.value("error").toString());
+ QLOG_ERROR() << "paste.ee reported error:" << QString(object.value("error").toString());
return false;
}
// FIXME: not the place for GUI things.