summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-01-11 03:08:41 +0100
committerPetr Mrázek <peterix@gmail.com>2015-01-11 03:08:41 +0100
commit1151037f968628cd659f06457f9ca7403f77f071 (patch)
treee0749ab4d39ebf7767efd44885d7411fe1193f34 /gui
parentacb3346409cb1b90fbb9abc929fd8a80038b447c (diff)
downloadMultiMC-1151037f968628cd659f06457f9ca7403f77f071.tar
MultiMC-1151037f968628cd659f06457f9ca7403f77f071.tar.gz
MultiMC-1151037f968628cd659f06457f9ca7403f77f071.tar.lz
MultiMC-1151037f968628cd659f06457f9ca7403f77f071.tar.xz
MultiMC-1151037f968628cd659f06457f9ca7403f77f071.zip
GH-719 Fix paste upload encoding and do not try to upload over limit
Diffstat (limited to 'gui')
-rw-r--r--gui/GuiUtil.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/gui/GuiUtil.cpp b/gui/GuiUtil.cpp
index 72c09ffe..fcbc8acd 100644
--- a/gui/GuiUtil.cpp
+++ b/gui/GuiUtil.cpp
@@ -11,12 +11,22 @@
void GuiUtil::uploadPaste(const QString &text, QWidget *parentWidget)
{
ProgressDialog dialog(parentWidget);
- PasteUpload *paste = new PasteUpload(parentWidget, text);
- dialog.exec(paste);
+ std::unique_ptr<PasteUpload> paste(new PasteUpload(parentWidget, text));
+
+ if (!paste->validateText())
+ {
+ CustomMessageBox::selectable(
+ parentWidget, QObject::tr("Upload failed"),
+ QObject::tr("The log file is too big. You'll have to upload it manually."),
+ QMessageBox::Warning)->exec();
+ return;
+ }
+
+ dialog.exec(paste.get());
if (!paste->successful())
{
- CustomMessageBox::selectable(parentWidget, "Upload failed", paste->failReason(),
- QMessageBox::Critical)->exec();
+ CustomMessageBox::selectable(parentWidget, QObject::tr("Upload failed"),
+ paste->failReason(), QMessageBox::Critical)->exec();
}
else
{
@@ -25,11 +35,11 @@ void GuiUtil::uploadPaste(const QString &text, QWidget *parentWidget)
QDesktopServices::openUrl(link);
CustomMessageBox::selectable(
parentWidget, QObject::tr("Upload finished"),
- QObject::tr("The <a href=\"%1\">link to the uploaded log</a> has been opened in the default "
- "browser and placed in your clipboard.").arg(link),
+ QObject::tr("The <a href=\"%1\">link to the uploaded log</a> has been opened in "
+ "the default "
+ "browser and placed in your clipboard.").arg(link),
QMessageBox::Information)->exec();
}
- delete paste;
}
void GuiUtil::setClipboardText(const QString &text)