From bd3431a9f5af89f013966c45933115a6bb56eaae Mon Sep 17 00:00:00 2001 From: borgmanJeremy <46930769+borgmanJeremy@users.noreply.github.com> Date: Sun, 24 Jul 2022 09:18:09 -0500 Subject: [PATCH] Always show post upload actions (#2640) --- src/config/generalconf.cpp | 15 +++++++-------- src/config/generalconf.h | 2 +- src/core/flameshot.cpp | 6 +----- src/tools/imgupload/storages/imguploaderbase.cpp | 2 -- src/utils/confighandler.h | 4 +--- 5 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/config/generalconf.cpp b/src/config/generalconf.cpp index 3de49881..bd6f032f 100644 --- a/src/config/generalconf.cpp +++ b/src/config/generalconf.cpp @@ -76,7 +76,7 @@ void GeneralConf::_updateComponents(bool allowEmptySavePath) m_sidePanelButton->setChecked(config.showSidePanelButton()); m_sysNotifications->setChecked(config.showDesktopNotification()); m_autostart->setChecked(config.startupLaunch()); - m_copyAndCloseAfterUpload->setChecked(config.copyAndCloseAfterUpload()); + m_copyURLAfterUpload->setChecked(config.copyURLAfterUpload()); m_saveAfterCopy->setChecked(config.saveAfterCopy()); m_copyPathAfterSave->setChecked(config.copyPathAfterSave()); m_antialiasingPinZoom->setChecked(config.antialiasingPinZoom()); @@ -438,14 +438,13 @@ void GeneralConf::initCopyOnDoubleClick() void GeneralConf::initCopyAndCloseAfterUpload() { - m_copyAndCloseAfterUpload = - new QCheckBox(tr("Copy URL after upload"), this); - m_copyAndCloseAfterUpload->setToolTip( - tr("Copy URL and close window after uploading was successful")); - m_scrollAreaLayout->addWidget(m_copyAndCloseAfterUpload); + m_copyURLAfterUpload = new QCheckBox(tr("Copy URL after upload"), this); + m_copyURLAfterUpload->setToolTip( + tr("Copy URL after uploading was successful")); + m_scrollAreaLayout->addWidget(m_copyURLAfterUpload); - connect(m_copyAndCloseAfterUpload, &QCheckBox::clicked, [](bool checked) { - ConfigHandler().setCopyAndCloseAfterUpload(checked); + connect(m_copyURLAfterUpload, &QCheckBox::clicked, [](bool checked) { + ConfigHandler().setCopyURLAfterUpload(checked); }); } diff --git a/src/config/generalconf.h b/src/config/generalconf.h index 2ff495e4..29bbfffe 100644 --- a/src/config/generalconf.h +++ b/src/config/generalconf.h @@ -108,7 +108,7 @@ private: QCheckBox* m_autoCloseIdleDaemon; QCheckBox* m_autostart; QCheckBox* m_showStartupLaunchMessage; - QCheckBox* m_copyAndCloseAfterUpload; + QCheckBox* m_copyURLAfterUpload; QCheckBox* m_copyPathAfterSave; QCheckBox* m_antialiasingPinZoom; QCheckBox* m_saveLastRegion; diff --git a/src/core/flameshot.cpp b/src/core/flameshot.cpp index 6ab5bb80..ca7d5fb2 100644 --- a/src/core/flameshot.cpp +++ b/src/core/flameshot.cpp @@ -395,15 +395,11 @@ void Flameshot::exportCapture(QPixmap capture, CR::ExportTask tasks = tasks; QObject::connect( widget, &ImgUploaderBase::uploadOk, [=](const QUrl& url) { - if (ConfigHandler().copyAndCloseAfterUpload()) { + if (ConfigHandler().copyURLAfterUpload()) { if (!(tasks & CR::COPY)) { FlameshotDaemon::copyToClipboard( url.toString(), tr("URL copied to clipboard.")); - widget->close(); - } else { - widget->showPostUploadDialog(); } - } else { widget->showPostUploadDialog(); } }); diff --git a/src/tools/imgupload/storages/imguploaderbase.cpp b/src/tools/imgupload/storages/imguploaderbase.cpp index 26b08be6..9aa5ee8d 100644 --- a/src/tools/imgupload/storages/imguploaderbase.cpp +++ b/src/tools/imgupload/storages/imguploaderbase.cpp @@ -37,12 +37,10 @@ ImgUploaderBase::ImgUploaderBase(const QPixmap& capture, QWidget* parent) setWindowTitle(tr("Upload image")); setWindowIcon(QIcon(GlobalValues::iconPath())); -#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) QRect position = frameGeometry(); QScreen* screen = QGuiApplication::screenAt(QCursor::pos()); position.moveCenter(screen->availableGeometry().center()); move(position.topLeft()); -#endif m_spinner = new LoadSpinner(this); m_spinner->setColor(ConfigHandler().uiColor()); diff --git a/src/utils/confighandler.h b/src/utils/confighandler.h index 1e9f9a4c..bae2d8b4 100644 --- a/src/utils/confighandler.h +++ b/src/utils/confighandler.h @@ -97,9 +97,7 @@ public: setShowStartupLaunchMessage, bool) CONFIG_GETTER_SETTER(contrastOpacity, setContrastOpacity, int) - CONFIG_GETTER_SETTER(copyAndCloseAfterUpload, - setCopyAndCloseAfterUpload, - bool) + CONFIG_GETTER_SETTER(copyURLAfterUpload, setCopyURLAfterUpload, bool) CONFIG_GETTER_SETTER(historyConfirmationToDelete, setHistoryConfirmationToDelete, bool)