diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/GuiUtil.cpp | 24 |
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) |