Added UploaderManager for further multiple Storage for images support (#2142)

Co-authored-by: Yuriy Puchkov <yuriy.puchkov@namecheap.com>
This commit is contained in:
Yurii Puchkov
2021-12-08 01:19:32 +02:00
committed by GitHub
parent f5bbf73cfd
commit 203b5baab6
17 changed files with 391 additions and 177 deletions

View File

@@ -4,10 +4,10 @@
#include "capturerequest.h"
#include "confighandler.h"
#include "controller.h"
#include "imguruploader.h"
#include "imgupload/imguploadermanager.h"
#include "pinwidget.h"
#include "src/utils/screenshotsaver.h"
#include "src/widgets/imguruploaddialog.h"
#include "src/widgets/imguploaddialog.h"
#include "systemnotification.h"
#include <QApplication>
#include <QClipboard>
@@ -166,18 +166,19 @@ void CaptureRequest::exportCapture(const QPixmap& capture)
if (m_tasks & UPLOAD) {
if (!ConfigHandler().uploadWithoutConfirmation()) {
ImgurUploadDialog* dialog = new ImgurUploadDialog();
ImgUploadDialog* dialog = new ImgUploadDialog();
if (dialog->exec() == QDialog::Rejected) {
return;
}
}
ImgurUploader* widget = new ImgurUploader(capture);
ImgUploaderBase* widget = ImgUploaderManager().uploader(capture);
widget->show();
widget->activateWindow();
// NOTE: lambda can't capture 'this' because it might be destroyed later
ExportTask tasks = m_tasks;
QObject::connect(
widget, &ImgurUploader::uploadOk, [widget, tasks](const QUrl& url) {
widget, &ImgUploaderBase::uploadOk, [widget, tasks](const QUrl& url) {
if (ConfigHandler().copyAndCloseAfterUpload()) {
if (!(tasks & COPY)) {
SystemNotification().sendMessage(