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

Added a config option to remove the contrast ring around the counting circle tool #3746

Open
wants to merge 4 commits 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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 @@ -51,6 +51,9 @@
;; Disable Grim Warning notification
;disabledGrimWarning=true
;
;; Disable the contrast on the counting tool when it has no arrow
;disableCountingCircleContrast=false
;
;; Automatically close daemon when it's not needed (not available on Windows)
;autoCloseIdleDaemon=false
;
Expand Down
17 changes: 17 additions & 0 deletions src/config/generalconf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ GeneralConf::GeneralConf(QWidget* parent)
initUploadClientSecret();
initPredefinedColorPaletteLarge();
initShowSelectionGeometry();
initDisableCountingCircleContrast();

m_layout->addStretch();

Expand All @@ -82,6 +83,7 @@ void GeneralConf::_updateComponents(bool allowEmptySavePath)
m_copyPathAfterSave->setChecked(config.copyPathAfterSave());
m_antialiasingPinZoom->setChecked(config.antialiasingPinZoom());
m_useJpgForClipboard->setChecked(config.useJpgForClipboard());
m_disableCountingCircleContrast->setChecked(config.disableCountingCircleContrast());
m_copyOnDoubleClick->setChecked(config.copyOnDoubleClick());
m_uploadWithoutConfirmation->setChecked(config.uploadWithoutConfirmation());
m_historyConfirmationToDelete->setChecked(
Expand Down Expand Up @@ -150,6 +152,10 @@ void GeneralConf::allowMultipleGuiInstancesChanged(bool checked)
ConfigHandler().setAllowMultipleGuiInstances(checked);
}

void GeneralConf::setDisableCountingCircleContrast(bool checked)
{
ConfigHandler().setDisableCountingCircleContrast(checked);
}
void GeneralConf::autoCloseIdleDaemonChanged(bool checked)
{
ConfigHandler().setAutoCloseIdleDaemon(checked);
Expand Down Expand Up @@ -799,6 +805,17 @@ void GeneralConf::initJpegQuality()
&GeneralConf::setJpegQuality);
}

void GeneralConf::initDisableCountingCircleContrast()
{
m_disableCountingCircleContrast = new QCheckBox(tr("Disable contrast on the counting bubble"), this);
m_disableCountingCircleContrast->setToolTip(
tr("Disable the contrasting circle that is around the counting circle tool when it has no arrow"));
m_scrollAreaLayout->addWidget(m_disableCountingCircleContrast);
connect(m_disableCountingCircleContrast,
&QCheckBox::clicked,
this,
&GeneralConf::setDisableCountingCircleContrast);}

void GeneralConf::setSelGeoHideTime(int v)
{
ConfigHandler().setValue("showSelectionGeometryHideTime", v);
Expand Down
3 changes: 3 additions & 0 deletions src/config/generalconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ private slots:
void setGeometryLocation(int index);
void setSelGeoHideTime(int v);
void setJpegQuality(int v);
void setDisableCountingCircleContrast(bool checked);

private:
const QString chooseFolder(const QString& currentPath = "");
Expand Down Expand Up @@ -92,6 +93,7 @@ private slots:
void initSaveLastRegion();
void initShowSelectionGeometry();
void initJpegQuality();
void initDisableCountingCircleContrast();

void _updateComponents(bool allowEmptySavePath);

Expand Down Expand Up @@ -136,4 +138,5 @@ private slots:
QComboBox* m_selectGeometryLocation;
QSpinBox* m_xywhTimeout;
QSpinBox* m_jpegQuality;
QCheckBox* m_disableCountingCircleContrast;
};
14 changes: 11 additions & 3 deletions src/tools/circlecount/circlecounttool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

#include "circlecounttool.h"
#include "colorutils.h"
#include "confighandler.h"
#include <QPainter>
#include <QPainterPath>
#include <qdebug.h>

namespace {
#define PADDING_VALUE 2
Expand Down Expand Up @@ -130,11 +132,17 @@ void CircleCountTool::process(QPainter& painter, const QPixmap& pixmap)
path.lineTo(points().first);
painter.drawPath(path);
}

painter.setPen(contrastColor);
painter.setBrush(antiContrastColor);
painter.drawEllipse(
points().first, bubble_size + PADDING_VALUE, bubble_size + PADDING_VALUE);
if(ConfigHandler().disableCountingCircleContrast())
{
if(line.length() < bubble_size)
{
painter.setBrush(color());
painter.setPen(color());
}
}
painter.drawEllipse(points().first, bubble_size + PADDING_VALUE, bubble_size + PADDING_VALUE);
painter.setBrush(color());
painter.drawEllipse(points().first, bubble_size, bubble_size);
QRect textRect = QRect(points().first.x() - bubble_size / 2,
Expand Down
1 change: 1 addition & 0 deletions src/utils/confighandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ static QMap<class QString, QSharedPointer<ValueHandler>>
OPTION("showDesktopNotification" ,Bool ( true )),
OPTION("disabledTrayIcon" ,Bool ( false )),
OPTION("disabledGrimWarning" ,Bool ( false )),
OPTION("disableCountingCircleContrast" ,Bool ( false )),
OPTION("historyConfirmationToDelete" ,Bool ( true )),
#if !defined(DISABLE_UPDATE_CHECKER)
OPTION("checkForUpdates" ,Bool ( true )),
Expand Down
1 change: 1 addition & 0 deletions src/utils/confighandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class ConfigHandler : public QObject
CONFIG_GETTER_SETTER(filenamePattern, setFilenamePattern, QString)
CONFIG_GETTER_SETTER(disabledTrayIcon, setDisabledTrayIcon, bool)
CONFIG_GETTER_SETTER(disabledGrimWarning, disabledGrimWarning, bool)
CONFIG_GETTER_SETTER(disableCountingCircleContrast, setDisableCountingCircleContrast, bool)
CONFIG_GETTER_SETTER(drawThickness, setDrawThickness, int)
CONFIG_GETTER_SETTER(drawFontSize, setDrawFontSize, int)
CONFIG_GETTER_SETTER(keepOpenAppLauncher, setKeepOpenAppLauncher, bool)
Expand Down