diff options
author | Petr Mrázek <peterix@users.noreply.github.com> | 2019-06-23 21:15:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-23 21:15:06 +0200 |
commit | e7c5b266c86cb24cf3c1fc92ef34ad6726ac5df1 (patch) | |
tree | bcfd5c9c4dcca07bce190e3ca19aa37f7c98482d | |
parent | 384979bf94ce7a1d6645c9a8550e988c4edd38d1 (diff) | |
parent | 2a96e1690248e8e7f4ba7dc266fbfb2675b702be (diff) | |
download | MultiMC-e7c5b266c86cb24cf3c1fc92ef34ad6726ac5df1.tar MultiMC-e7c5b266c86cb24cf3c1fc92ef34ad6726ac5df1.tar.gz MultiMC-e7c5b266c86cb24cf3c1fc92ef34ad6726ac5df1.tar.lz MultiMC-e7c5b266c86cb24cf3c1fc92ef34ad6726ac5df1.tar.xz MultiMC-e7c5b266c86cb24cf3c1fc92ef34ad6726ac5df1.zip |
Merge pull request #2708 from Janrupf/feature/single_imgur_uploads
GH-689 Don't create album for single screenshot
-rw-r--r-- | application/pages/instance/ScreenshotsPage.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/application/pages/instance/ScreenshotsPage.cpp b/application/pages/instance/ScreenshotsPage.cpp index 3420e86b..e61bf5c1 100644 --- a/application/pages/instance/ScreenshotsPage.cpp +++ b/application/pages/instance/ScreenshotsPage.cpp @@ -286,6 +286,38 @@ void ScreenshotsPage::on_uploadBtn_clicked() QList<ScreenshotPtr> uploaded; auto job = NetJobPtr(new NetJob("Screenshot Upload")); + if(selection.size() < 2) + { + auto item = selection.at(0); + auto info = m_model->fileInfo(item); + auto screenshot = std::make_shared<ScreenShot>(info); + job->addNetAction(ImgurUpload::make(screenshot)); + + m_uploadActive = true; + ProgressDialog dialog(this); + if(dialog.execWithTask(job.get()) != QDialog::Accepted) + { + CustomMessageBox::selectable(this, tr("Failed to upload screenshots!"), + tr("Unknown error"), QMessageBox::Warning)->exec(); + } + else + { + auto link = screenshot->m_url; + QClipboard *clipboard = QApplication::clipboard(); + clipboard->setText(link); + CustomMessageBox::selectable( + this, + tr("Upload finished"), + tr("The <a href=\"%1\">link to the uploaded screenshot</a> has been placed in your clipboard.") + .arg(link), + QMessageBox::Information + )->exec(); + } + + m_uploadActive = false; + return; + } + for (auto item : selection) { auto info = m_model->fileInfo(item); |