Skip to content

Commit

Permalink
Always show post upload actions (#2640)
Browse files Browse the repository at this point in the history
  • Loading branch information
borgmanJeremy authored Jul 24, 2022
1 parent a951f93 commit bd3431a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 19 deletions.
15 changes: 7 additions & 8 deletions src/config/generalconf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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);
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/config/generalconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,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 @@ -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();
}
});
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 @@ -97,9 +97,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

1 comment on commit bd3431a

@zensubz
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @borgmanJeremy for the work on #2312. IMHO, change is also required at confighandler.cpp to open the config window.

As such, this won't compile for me with Qt 5.9.7 without making necessary changes as mentioned in #2758.

Please sign in to comment.