Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always show post upload actions #2640

Merged
merged 1 commit into from
Jul 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/config/generalconf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,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());
Expand Down Expand Up @@ -428,14 +428,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);
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/config/generalconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private slots:
QCheckBox* m_autoCloseIdleDaemon;
QCheckBox* m_autostart;
QCheckBox* m_showStartupLaunchMessage;
QCheckBox* m_copyAndCloseAfterUpload;
QCheckBox* m_copyURLAfterUpload;
QCheckBox* m_copyPathAfterSave;
QCheckBox* m_antialiasingPinZoom;
QCheckBox* m_saveLastRegion;
Expand Down
6 changes: 1 addition & 5 deletions src/core/flameshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,15 +394,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();
}
});
Expand Down
2 changes: 0 additions & 2 deletions src/tools/imgupload/storages/imguploaderbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
4 changes: 1 addition & 3 deletions src/utils/confighandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ class ConfigHandler : public QObject
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)
Expand Down