Skip to content

Commit

Permalink
Added an option to remove the contrast ring around the counting tool …
Browse files Browse the repository at this point in the history
…(but brings it back when drawing it with an arrow)
  • Loading branch information
FelixJochems committed Oct 7, 2024
1 parent 14a1367 commit a6499c2
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
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();
initCountingCircleNoContrast();

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_countingCircleNoContrast->setChecked(config.countingCircleNoContrast());
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::setCountingCircleNoContrast(bool checked)
{
ConfigHandler().setCountingCircleNoContrast(checked);
}
void GeneralConf::autoCloseIdleDaemonChanged(bool checked)
{
ConfigHandler().setAutoCloseIdleDaemon(checked);
Expand Down Expand Up @@ -799,6 +805,17 @@ void GeneralConf::initJpegQuality()
&GeneralConf::setJpegQuality);
}

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

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 setCountingCircleNoContrast(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 initCountingCircleNoContrast();

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_countingCircleNoContrast;
};
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().countingCircleNoContrast())
{
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("countingCircleNoContrast" ,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(countingCircleNoContrast, setCountingCircleNoContrast, bool)
CONFIG_GETTER_SETTER(drawThickness, setDrawThickness, int)
CONFIG_GETTER_SETTER(drawFontSize, setDrawFontSize, int)
CONFIG_GETTER_SETTER(keepOpenAppLauncher, setKeepOpenAppLauncher, bool)
Expand Down

0 comments on commit a6499c2

Please sign in to comment.