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

Add new config option to hide drop shadow around pinned images #3427

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions flameshot.example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
;; Anti-aliasing image when zoom the pinned image (bool)
;antialiasingPinZoom=true
;
;; Hide border effect around the pinned image (bool)
;pinHideDropShadow=false
;
;; Use JPG format instead of PNG (bool)
;useJpgForClipboard=false
;
Expand Down
16 changes: 16 additions & 0 deletions src/config/generalconf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ GeneralConf::GeneralConf(QWidget* parent)
initUploadWithoutConfirmation();
initHistoryConfirmationToDelete();
initAntialiasingPinZoom();
initPinHideDropShadow();
initUploadHistoryMax();
initUndoLimit();
initUploadClientSecret();
Expand Down Expand Up @@ -81,6 +82,7 @@ void GeneralConf::_updateComponents(bool allowEmptySavePath)
m_saveAfterCopy->setChecked(config.saveAfterCopy());
m_copyPathAfterSave->setChecked(config.copyPathAfterSave());
m_antialiasingPinZoom->setChecked(config.antialiasingPinZoom());
m_pinHideDropShadow->setChecked(config.pinHideDropShadow());
m_useJpgForClipboard->setChecked(config.useJpgForClipboard());
m_copyOnDoubleClick->setChecked(config.copyOnDoubleClick());
m_uploadWithoutConfirmation->setChecked(config.uploadWithoutConfirmation());
Expand Down Expand Up @@ -427,6 +429,7 @@ void GeneralConf::initPredefinedColorPaletteLarge()
ConfigHandler().setPredefinedColorPaletteLarge(checked);
});
}

void GeneralConf::initCopyOnDoubleClick()
{
m_copyOnDoubleClick = new QCheckBox(tr("Copy on double click"), this);
Expand Down Expand Up @@ -663,6 +666,19 @@ void GeneralConf::initAntialiasingPinZoom()
});
}

void GeneralConf::initPinHideDropShadow()
{
m_pinHideDropShadow =
new QCheckBox(tr("Hide border effect around the pinned image"), this);
m_pinHideDropShadow->setToolTip(
tr("Remove the drop shadow which lets the pinned image stand out"
"visually"));
m_scrollAreaLayout->addWidget(m_pinHideDropShadow);
connect(m_pinHideDropShadow, &QCheckBox::clicked, [](bool checked) {
ConfigHandler().setPinHideDropShadow(checked);
});
}

void GeneralConf::initUploadWithoutConfirmation()
{
m_uploadWithoutConfirmation =
Expand Down
2 changes: 2 additions & 0 deletions src/config/generalconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ private slots:
void initCopyOnDoubleClick();
void initCopyPathAfterSave();
void initHistoryConfirmationToDelete();
void initPinHideDropShadow();
void initPredefinedColorPaletteLarge();
void initSaveAfterCopy();
void initScrollArea();
Expand Down Expand Up @@ -113,6 +114,7 @@ private slots:
QCheckBox* m_copyURLAfterUpload;
QCheckBox* m_copyPathAfterSave;
QCheckBox* m_antialiasingPinZoom;
QCheckBox* m_pinHideDropShadow;
QCheckBox* m_saveLastRegion;
QCheckBox* m_uploadWithoutConfirmation;
QPushButton* m_importButton;
Expand Down
5 changes: 4 additions & 1 deletion src/tools/pin/pinwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ PinWidget::PinWidget(const QPixmap& pixmap,
ConfigHandler conf;
m_baseColor = conf.uiColor();
m_hoverColor = conf.contrastUiColor();
const bool hideDropShadow = conf.pinHideDropShadow();

m_layout->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);

m_shadowEffect->setColor(m_baseColor);
m_shadowEffect->setBlurRadius(BLUR_RADIUS);
m_shadowEffect->setOffset(0, 0);
setGraphicsEffect(m_shadowEffect);
if (!hideDropShadow) {
setGraphicsEffect(m_shadowEffect);
}
setWindowOpacity(m_opacity);

m_label->setPixmap(m_pixmap);
Expand Down
1 change: 1 addition & 0 deletions src/utils/confighandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ static QMap<class QString, QSharedPointer<ValueHandler>>
OPTION("copyURLAfterUpload" ,Bool ( true )),
OPTION("copyPathAfterSave" ,Bool ( false )),
OPTION("antialiasingPinZoom" ,Bool ( true )),
OPTION("pinHideDropShadow" ,Bool ( false )),
OPTION("useJpgForClipboard" ,Bool ( false )),
OPTION("uploadWithoutConfirmation" ,Bool ( false )),
OPTION("saveAfterCopy" ,Bool ( false )),
Expand Down
1 change: 1 addition & 0 deletions src/utils/confighandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class ConfigHandler : public QObject
CONFIG_GETTER_SETTER(copyPathAfterSave, setCopyPathAfterSave, bool)
CONFIG_GETTER_SETTER(saveAsFileExtension, setSaveAsFileExtension, QString)
CONFIG_GETTER_SETTER(antialiasingPinZoom, setAntialiasingPinZoom, bool)
CONFIG_GETTER_SETTER(pinHideDropShadow, setPinHideDropShadow, bool)
CONFIG_GETTER_SETTER(useJpgForClipboard, setUseJpgForClipboard, bool)
CONFIG_GETTER_SETTER(uploadWithoutConfirmation,
setUploadWithoutConfirmation,
Expand Down