Skip to content

Commit 29a33f5

Browse files
bekirsoyluBekir Soylu
andauthored
Add option to disable the Circle Counter outline (#4882)
The counter bubble is always drawn with a contrasting ring. An outer ellipse is filled with the anti-contrast color and the pen strokes both ellipses with the contrast color, so the ring reads as black either way: on dark draw colors it comes from the outer ellipse's fill, and on light ones from the pen. There was no way to turn it off. Add a `drawCircleCounterOutline` option together with a checkbox in Configuration > General. It defaults to true, so the existing appearance is unchanged. Closes #3580 Co-authored-by: Bekir Soylu <bso@apptec360.com>
1 parent d3b0d5e commit 29a33f5

6 files changed

Lines changed: 35 additions & 4 deletions

File tree

flameshot.example.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@
7373
;; Last used Circle Counter size (int)
7474
;drawCircleCounterSize=1
7575
;
76+
;; Draw a contrasting outline ring around the Circle Counter bubble (bool)
77+
;drawCircleCounterOutline=true
78+
;
7679
;; Last used Pixelate pixel size (int)
7780
;drawPixelateSize=2
7881
;

src/config/generalconf.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ GeneralConf::GeneralConf(QWidget* parent)
7979
initSquareMagnifier();
8080
initJpegQuality();
8181
initReverseArrow();
82+
initDrawCircleCounterOutline();
8283
// this has to be at the end
8384
initConfigButtons();
8485
updateComponents();
@@ -113,6 +114,7 @@ void GeneralConf::_updateComponents(bool allowEmptySavePath)
113114
m_squareMagnifier->setChecked(config.squareMagnifier());
114115
m_saveLastRegion->setChecked(config.saveLastRegion());
115116
m_reverseArrow->setChecked(config.reverseArrow());
117+
m_drawCircleCounterOutline->setChecked(config.drawCircleCounterOutline());
116118
m_autoCloseIdleDaemon->setChecked(config.autoCloseIdleDaemon());
117119
m_predefinedColorPaletteLarge->setChecked(
118120
config.predefinedColorPaletteLarge());
@@ -865,6 +867,20 @@ void GeneralConf::initReverseArrow()
865867
m_reverseArrow, &QCheckBox::clicked, this, &GeneralConf::setReverseArrow);
866868
}
867869

870+
void GeneralConf::initDrawCircleCounterOutline()
871+
{
872+
m_drawCircleCounterOutline =
873+
new QCheckBox(tr("Draw outline around circle counter"), this);
874+
m_drawCircleCounterOutline->setToolTip(
875+
tr("Draw a contrasting ring around the counter bubble so it stays "
876+
"visible on any background"));
877+
m_scrollAreaLayout->addWidget(m_drawCircleCounterOutline);
878+
879+
connect(m_drawCircleCounterOutline, &QCheckBox::clicked, [](bool checked) {
880+
ConfigHandler().setDrawCircleCounterOutline(checked);
881+
});
882+
}
883+
868884
void GeneralConf::initInsecurePixelate()
869885
{
870886
m_insecurePixelate = new QCheckBox(tr("Insecure Pixelate"), this);

src/config/generalconf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ private slots:
107107
void initShowSelectionGeometry();
108108
void initJpegQuality();
109109
void initReverseArrow();
110+
void initDrawCircleCounterOutline();
110111
void initInsecurePixelate();
111112
#if !defined(Q_OS_MACOS)
112113
void initCaptureActiveMonitor();
@@ -164,6 +165,7 @@ private slots:
164165
QSpinBox* m_xywhTimeout;
165166
QSpinBox* m_jpegQuality;
166167
QCheckBox* m_reverseArrow;
168+
QCheckBox* m_drawCircleCounterOutline;
167169
QCheckBox* m_insecurePixelate;
168170
#if !defined(Q_OS_MACOS)
169171
QCheckBox* m_captureActiveMonitor;

src/tools/circlecount/circlecounttool.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "circlecounttool.h"
55
#include "utils/colorutils.h"
6+
#include "utils/confighandler.h"
67

78
#include <QPainter>
89
#include <QPainterPath>
@@ -134,10 +135,15 @@ void CircleCountTool::process(QPainter& painter, const QPixmap& pixmap)
134135
painter.drawPath(path);
135136
}
136137

137-
painter.setPen(contrastColor);
138-
painter.setBrush(antiContrastColor);
139-
painter.drawEllipse(
140-
points().first, bubble_size + PADDING_VALUE, bubble_size + PADDING_VALUE);
138+
if (ConfigHandler().drawCircleCounterOutline()) {
139+
painter.setPen(contrastColor);
140+
painter.setBrush(antiContrastColor);
141+
painter.drawEllipse(points().first,
142+
bubble_size + PADDING_VALUE,
143+
bubble_size + PADDING_VALUE);
144+
} else {
145+
painter.setPen(Qt::NoPen);
146+
}
141147
painter.setBrush(color());
142148
painter.drawEllipse(points().first, bubble_size, bubble_size);
143149
QRect textRect = QRect(points().first.x() - bubble_size / 2,

src/utils/confighandler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ static QMap<class QString, QSharedPointer<ValueHandler>>
118118
OPTION("drawThickness" ,LowerBoundedInt ( 1, 3 )),
119119
OPTION("drawFontSize" ,LowerBoundedInt ( 1, 8 )),
120120
OPTION("drawCircleCounterSize" ,LowerBoundedInt ( 1, 1 )),
121+
OPTION("drawCircleCounterOutline" ,Bool ( true )),
121122
OPTION("drawPixelateSize" ,LowerBoundedInt ( 1, 2 )),
122123
OPTION("drawRectangleSize" ,LowerBoundedInt ( 1, 1 )),
123124
OPTION("drawMarkerSize" ,LowerBoundedInt ( 1, 5 )),

src/utils/confighandler.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ class ConfigHandler : public QObject
9494
CONFIG_GETTER_SETTER(drawThickness, setDrawThickness, int)
9595
CONFIG_GETTER_SETTER(drawFontSize, setDrawFontSize, int)
9696
CONFIG_GETTER_SETTER(drawCircleCounterSize, setDrawCircleCounterSize, int)
97+
CONFIG_GETTER_SETTER(drawCircleCounterOutline,
98+
setDrawCircleCounterOutline,
99+
bool)
97100
CONFIG_GETTER_SETTER(drawPixelateSize, setDrawPixelateSize, int)
98101
CONFIG_GETTER_SETTER(drawRectangleSize, setDrawRectangleSize, int)
99102
CONFIG_GETTER_SETTER(drawMarkerSize, setDrawMarkerSize, int)

0 commit comments

Comments
 (0)