12#include <KConfigGroup>
13#include <KSharedConfig>
16 const QString &windowTitle)
18 , m_windowTitle(windowTitle)
23 const QString &toolId)
139 KConfigGroup cfg = KSharedConfig::openConfig()->group(
"KisToolSelectBase");
140 cfg.writeEntry(
"selectionMode",
static_cast<int>(mode));
146 KConfigGroup cfg = KSharedConfig::openConfig()->group(
"KisToolSelectBase");
147 cfg.writeEntry(
"selectionAction",
static_cast<int>(
action));
154 cfg.writeEntry(
"antiAliasSelection",
value);
160 cfg.writeEntry(
"growSelection",
value);
166 cfg.writeEntry(
"stopGrowingAtDarkestPixel",
value);
172 cfg.writeEntry(
"featherSelection",
value);
184 ?
"sampleColorLabeledLayers"
185 :
"sampleCurrentLayer"));
191 if (colorLabels.isEmpty()) {
194 QString colorLabelsStr = QString::number(colorLabels.first());
195 for (
int i = 1; i < colorLabels.size(); ++i) {
196 colorLabelsStr +=
"," + QString::number(colorLabels[i]);
200 cfg.writeEntry(
"colorLabels", colorLabelsStr);
239 KConfigGroup cfg = KSharedConfig::openConfig()->group(
"KisToolSelectBase");
261 KConfigGroup cfgToolSpecific =
264 cfgToolSpecific.readEntry(
"antiAliasSelection",
true);
265 const int growSelection = cfgToolSpecific.readEntry(
"growSelection", 0);
267 cfgToolSpecific.readEntry(
"stopGrowingAtDarkestPixel",
false);
269 cfgToolSpecific.readEntry(
"featherSelection", 0);
270 const QString referenceLayersStr =
271 cfgToolSpecific.readEntry(
"sampleLayersMode",
"sampleCurrentLayer");
274 cfgToolSpecific.readEntry<QString>(
"colorLabels",
"")
275 .split(
',', Qt::SkipEmptyParts);
278 referenceLayersStr ==
"sampleAllLayers"
280 : (referenceLayersStr ==
"sampleColorLabeledLayers"
284 for (
const QString &colorLabelStr : colorLabelsStr) {
286 const int colorLabel = colorLabelStr.toInt(&ok);
288 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)
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)
void setStopGrowingAtDarkestPixel(bool newStopGrowingAtDarkestPixel)
SelectionAction action() const
void modeChanged(SelectionMode mode)
int featherSelection() const