12#include <KConfigGroup>
13#include <KSharedConfig>
16 const QString &windowTitle)
18 , m_windowTitle(windowTitle)
23 const QString &toolId)
151 KConfigGroup cfg = KSharedConfig::openConfig()->group(
"KisToolSelectBase");
152 cfg.writeEntry(
"selectionMode",
static_cast<int>(mode));
158 KConfigGroup cfg = KSharedConfig::openConfig()->group(
"KisToolSelectBase");
159 cfg.writeEntry(
"selectionAction",
static_cast<int>(
action));
166 cfg.writeEntry(
"moveSelectedContent",
value);
172 cfg.writeEntry(
"antiAliasSelection",
value);
178 cfg.writeEntry(
"growSelection",
value);
184 cfg.writeEntry(
"stopGrowingAtDarkestPixel",
value);
190 cfg.writeEntry(
"featherSelection",
value);
198 QString sampleModeString =
"sampleCurrentLayer";
202 sampleModeString =
"sampleAllLayers";
205 sampleModeString =
"sampleCurrentGroup";
208 sampleModeString =
"sampleColorLabeledLayers";
215 cfg.writeEntry(
"sampleLayersMode", sampleModeString);
221 if (colorLabels.isEmpty()) {
224 QString colorLabelsStr = QString::number(colorLabels.first());
225 for (
int i = 1; i < colorLabels.size(); ++i) {
226 colorLabelsStr +=
"," + QString::number(colorLabels[i]);
230 cfg.writeEntry(
"colorLabels", colorLabelsStr);
269 KConfigGroup cfg = KSharedConfig::openConfig()->group(
"KisToolSelectBase");
291 KConfigGroup cfgToolSpecific =
294 cfgToolSpecific.readEntry(
"moveSelectedContent",
false);
296 cfgToolSpecific.readEntry(
"antiAliasSelection",
true);
297 const int growSelection = cfgToolSpecific.readEntry(
"growSelection", 0);
299 cfgToolSpecific.readEntry(
"stopGrowingAtDarkestPixel",
false);
301 cfgToolSpecific.readEntry(
"featherSelection", 0);
302 const QString referenceLayersStr =
303 cfgToolSpecific.readEntry(
"sampleLayersMode",
"sampleCurrentLayer");
306 cfgToolSpecific.readEntry<QString>(
"colorLabels",
"")
307 .split(
',', Qt::SkipEmptyParts);
311 if (referenceLayersStr ==
"sampleAllLayers") {
313 }
else if (referenceLayersStr ==
"sampleCurrentGroup") {
315 }
else if (referenceLayersStr ==
"sampleCurrentLayer") {
317 }
else if (referenceLayersStr ==
"sampleColorLabeledLayers") {
320 qWarning() <<
"KisSelectionToolConfigWidgetHelper::reloadExactToolConfig(): unknown reference layer mode string" << referenceLayersStr;
325 for (
const QString &colorLabelStr : colorLabelsStr) {
327 const int colorLabel = colorLabelStr.toInt(&ok);
329 colorLabels << colorLabel;
float value(const T *src, size_t ch)
int growSelection() const
void setMode(SelectionMode newMode)
void setGrowSelection(int newGrowSelection)
void setAntiAliasSelection(bool newAntiAliasSelection)
void actionChanged(SelectionAction action)
void antiAliasSelectionChanged(bool antiAliasSelection)
void setAction(SelectionAction newAction)
void setMoveSelectedContent(bool newMoveSelectedContent)
SelectionMode mode() const
void setSelectedColorLabels(const QList< int > &newSelectedColorLabels)
void featherSelectionChanged(int featherSelection)
void setReferenceLayers(ReferenceLayers newReferenceLayers)
bool stopGrowingAtDarkestPixel() const
void selectedColorLabelsChanged()
void setFeatherSelection(int newFeatherSelection)
QList< int > selectedColorLabels() const
bool antiAliasSelection() const
ReferenceLayers referenceLayers() const
void referenceLayersChanged(ReferenceLayers referenceLayers)
void stopGrowingAtDarkestPixelChanged(bool stopGrowingAtDarkestPixel)
void growSelectionChanged(int growSelection)
bool moveSelectedContent() const
void setStopGrowingAtDarkestPixel(bool newStopGrowingAtDarkestPixel)
SelectionAction action() const
void modeChanged(SelectionMode mode)
int featherSelection() const
void moveSelectedContentChanged(bool moveSelectedContent)