GH-719 Fix paste upload encoding and do not try to upload over limit
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user