diff options
Diffstat (limited to 'gui/pages')
-rw-r--r-- | gui/pages/LogPage.cpp | 15 | ||||
-rw-r--r-- | gui/pages/ScreenshotsPage.cpp | 10 |
2 files changed, 23 insertions, 2 deletions
diff --git a/gui/pages/LogPage.cpp b/gui/pages/LogPage.cpp index dd088862..a9e32cc2 100644 --- a/gui/pages/LogPage.cpp +++ b/gui/pages/LogPage.cpp @@ -6,6 +6,8 @@ #include "ui_LogPage.h" #include "logic/net/PasteUpload.h" #include <QScrollBar> +#include <QtGui/QClipboard> +#include <QtGui/QDesktopServices> QString LogPage::displayName() { @@ -56,6 +58,19 @@ void LogPage::on_btnPaste_clicked() CustomMessageBox::selectable(this, "Upload failed", paste->failReason(), QMessageBox::Critical)->exec(); } + else + { + QString link = paste->pasteLink(); + QClipboard *clipboard = QApplication::clipboard(); + clipboard->setText(link); + QDesktopServices::openUrl(link); + CustomMessageBox::selectable( + this, tr("Upload finished"), + 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 LogPage::writeColor(QString text, const char *color, const char * background) diff --git a/gui/pages/ScreenshotsPage.cpp b/gui/pages/ScreenshotsPage.cpp index 466b3c19..ff4f0099 100644 --- a/gui/pages/ScreenshotsPage.cpp +++ b/gui/pages/ScreenshotsPage.cpp @@ -11,6 +11,8 @@ #include <QLineEdit> #include <QtGui/qevent.h> #include <QtGui/QPainter> +#include <QtGui/QClipboard> +#include <QtGui/QDesktopServices> #include <pathutils.h> @@ -333,11 +335,15 @@ void ScreenshotsPage::on_uploadBtn_clicked() } else { + auto link = QString("https://imgur.com/a/%1").arg(imgurAlbum->id()); + QClipboard *clipboard = QApplication::clipboard(); + clipboard->setText(link); + QDesktopServices::openUrl(link); CustomMessageBox::selectable( this, tr("Upload finished"), - tr("<a href=\"https://imgur.com/a/%1\">Visit album</a><br/>Delete hash: %2 (save " + tr("The <a href=\"%1\">link to the uploaded album</a> has been opened in the default browser and placed in your clipboard.<br/>Delete hash: %2 (save " "this if you want to be able to edit/delete the album)") - .arg(imgurAlbum->id(), imgurAlbum->deleteHash()), + .arg(link, imgurAlbum->deleteHash()), QMessageBox::Information)->exec(); } } |