Skip to content

Commit d420a53

Browse files
authored
Separate sizes for text, circle counter, pixelate, rectange, marker (as discussed in flameshot-org#3812) (flameshot-org#4011)
1 parent 6b8ba90 commit d420a53

File tree

2 files changed

+45
-18
lines changed

2 files changed

+45
-18
lines changed

src/utils/confighandler.cpp

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,24 +100,29 @@ static QMap<class QString, QSharedPointer<ValueHandler>>
100100
OPTION("useJpgForClipboard" ,Bool ( false )),
101101
OPTION("uploadWithoutConfirmation" ,Bool ( false )),
102102
OPTION("saveAfterCopy" ,Bool ( false )),
103-
OPTION("savePath" ,ExistingDir ( )),
103+
OPTION("savePath" ,ExistingDir ( )),
104104
OPTION("savePathFixed" ,Bool ( false )),
105-
OPTION("saveAsFileExtension" ,SaveFileExtension ( )),
106-
OPTION("saveLastRegion" ,Bool (false )),
107-
OPTION("uploadHistoryMax" ,LowerBoundedInt (0, 25 )),
108-
OPTION("undoLimit" ,BoundedInt (0, 999, 100 )),
109-
// Interface tab
110-
OPTION("uiColor" ,Color ( {116, 0, 150} )),
111-
OPTION("contrastUiColor" ,Color ( {39, 0, 50} )),
112-
OPTION("contrastOpacity" ,BoundedInt ( 0, 255, 190 )),
105+
OPTION("saveAsFileExtension" ,SaveFileExtension ( )),
106+
OPTION("saveLastRegion" ,Bool ( false )),
107+
OPTION("uploadHistoryMax" ,LowerBoundedInt ( 0, 25 )),
108+
OPTION("undoLimit" ,BoundedInt ( 0, 999, 100 )),
109+
// Interface tab
110+
OPTION("uiColor" ,Color ( {116, 0, 150} )),
111+
OPTION("contrastUiColor" ,Color ( {39, 0, 50} )),
112+
OPTION("contrastOpacity" ,BoundedInt ( 0, 255, 190 )),
113113
OPTION("buttons" ,ButtonList ( {} )),
114114
// Filename Editor tab
115115
OPTION("filenamePattern" ,FilenamePattern ( {} )),
116116
// Others
117-
OPTION("drawThickness" ,LowerBoundedInt (1 , 3 )),
118-
OPTION("drawFontSize" ,LowerBoundedInt (1 , 8 )),
117+
// drawThickness shared by Pencil, Line, Arrow, Rectangular Selection, Circle
118+
OPTION("drawThickness" ,LowerBoundedInt ( 1, 3 )),
119+
OPTION("drawFontSize" ,LowerBoundedInt ( 1, 8 )),
120+
OPTION("drawCircleCounterSize" ,LowerBoundedInt ( 1, 1 )),
121+
OPTION("drawPixelateSize" ,LowerBoundedInt ( 1, 2 )),
122+
OPTION("drawRectangleSize" ,LowerBoundedInt ( 1, 1 )),
123+
OPTION("drawMarkerSize" ,LowerBoundedInt ( 1, 5 )),
119124
OPTION("drawColor" ,Color ( Qt::red )),
120-
OPTION("userColors" ,UserColors(3, 17 )),
125+
OPTION("userColors" ,UserColors ( 3, 17 )),
121126
OPTION("ignoreUpdateToVersion" ,String ( "" )),
122127
OPTION("keepOpenAppLauncher" ,Bool ( false )),
123128
OPTION("fontFamily" ,String ( "" )),
@@ -126,11 +131,11 @@ static QMap<class QString, QSharedPointer<ValueHandler>>
126131
// NOTE: If another tool size is added besides drawThickness and
127132
// drawFontSize, remember to update ConfigHandler::toolSize
128133
OPTION("copyOnDoubleClick" ,Bool ( false )),
129-
OPTION("uploadClientSecret" ,String ( "313baf0c7b4d3ff" )),
130-
OPTION("showSelectionGeometry" , BoundedInt (0,5,4)),
131-
OPTION("showSelectionGeometryHideTime", LowerBoundedInt (0, 3000)),
132-
OPTION("jpegQuality", BoundedInt (0,100,75)),
133-
OPTION("reverseArrow" ,Bool ( false )),
134+
OPTION("uploadClientSecret" ,String ( "313baf0c7b4d3ff" )),
135+
OPTION("showSelectionGeometry" , BoundedInt ( 0, 5, 4 )),
136+
OPTION("showSelectionGeometryHideTime", LowerBoundedInt ( 0, 3000 )),
137+
OPTION("jpegQuality" , BoundedInt ( 0,100,75 )),
138+
OPTION("reverseArrow" ,Bool ( false )),
134139
};
135140

136141
static QMap<QString, QSharedPointer<KeySequence>> recognizedShortcuts = {
@@ -148,7 +153,7 @@ static QMap<QString, QSharedPointer<KeySequence>> recognizedShortcuts = {
148153
SHORTCUT("TYPE_SAVE" , "Ctrl+S" ),
149154
SHORTCUT("TYPE_ACCEPT" , "Return" ),
150155
SHORTCUT("TYPE_EXIT" , "Ctrl+Q" ),
151-
SHORTCUT("TYPE_CANCEL" , "Ctrl+Backspace" ),
156+
SHORTCUT("TYPE_CANCEL" , "Ctrl+Backspace" ),
152157
SHORTCUT("TYPE_IMAGEUPLOADER" , ),
153158
#if !defined(Q_OS_MACOS)
154159
SHORTCUT("TYPE_OPEN_APP" , "Ctrl+O" ),
@@ -336,7 +341,16 @@ void ConfigHandler::setToolSize(CaptureTool::Type toolType, int size)
336341
{
337342
if (toolType == CaptureTool::TYPE_TEXT) {
338343
setDrawFontSize(size);
344+
} else if (toolType == CaptureTool::TYPE_RECTANGLE) {
345+
setDrawRectangleSize(size);
346+
} else if (toolType == CaptureTool::TYPE_MARKER) {
347+
setDrawMarkerSize(size);
348+
} else if (toolType == CaptureTool::TYPE_PIXELATE) {
349+
setDrawPixelateSize(size);
350+
} else if (toolType == CaptureTool::TYPE_CIRCLECOUNT) {
351+
setDrawCircleCounterSize(size);
339352
} else if (toolType != CaptureTool::NONE) {
353+
// All other tools are sharing the same size
340354
setDrawThickness(size);
341355
}
342356
}
@@ -345,7 +359,16 @@ int ConfigHandler::toolSize(CaptureTool::Type toolType)
345359
{
346360
if (toolType == CaptureTool::TYPE_TEXT) {
347361
return drawFontSize();
362+
} else if (toolType == CaptureTool::TYPE_RECTANGLE) {
363+
return drawRectangleSize();
364+
} else if (toolType == CaptureTool::TYPE_MARKER) {
365+
return drawMarkerSize();
366+
} else if (toolType == CaptureTool::TYPE_PIXELATE) {
367+
return drawPixelateSize();
368+
} else if (toolType == CaptureTool::TYPE_CIRCLECOUNT) {
369+
return drawCircleCounterSize();
348370
} else {
371+
// All other tools are sharing the same size
349372
return drawThickness();
350373
}
351374
}

src/utils/confighandler.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ class ConfigHandler : public QObject
9393
CONFIG_GETTER_SETTER(disabledGrimWarning, disabledGrimWarning, bool)
9494
CONFIG_GETTER_SETTER(drawThickness, setDrawThickness, int)
9595
CONFIG_GETTER_SETTER(drawFontSize, setDrawFontSize, int)
96+
CONFIG_GETTER_SETTER(drawCircleCounterSize, setDrawCircleCounterSize, int)
97+
CONFIG_GETTER_SETTER(drawPixelateSize, setDrawPixelateSize, int)
98+
CONFIG_GETTER_SETTER(drawRectangleSize, setDrawRectangleSize, int)
99+
CONFIG_GETTER_SETTER(drawMarkerSize, setDrawMarkerSize, int)
96100
CONFIG_GETTER_SETTER(keepOpenAppLauncher, setKeepOpenAppLauncher, bool)
97101
#if !defined(DISABLE_UPDATE_CHECKER)
98102
CONFIG_GETTER_SETTER(checkForUpdates, setCheckForUpdates, bool)

0 commit comments

Comments
 (0)