Krita Source Code Documentation
Loading...
Searching...
No Matches
KisColorSelectorSettings Class Reference

#include <kis_color_selector_settings.h>

+ Inheritance diagram for KisColorSelectorSettings:

Public Slots

void changedACSColorAlignment (bool)
 
void changedACSColorSelectorType (int)
 
void changedACSLastUsedColorAlignment (bool)
 
void changedACSShadeSelectorType (int)
 
void changedColorDocker (int)
 
void loadDefaultPreferences () override
 
void loadPreferences () override
 
void savePreferences () const override
 
void useCustomColorForSelector (bool)
 
void useDifferentColorSpaceChecked (bool)
 
- Public Slots inherited from KisPreferenceSet
virtual void loadDefaultPreferences ()=0
 
virtual void loadPreferences ()=0
 
virtual void savePreferences () const =0
 

Signals

void hsxchanged (int)
 
void settingsChanged () const
 

Public Member Functions

QString header () override
 
QIcon icon () override
 
QString id () override
 
 KisColorSelectorSettings (QWidget *parent=0)
 
QString name () override
 
 ~KisColorSelectorSettings () override
 
- Public Member Functions inherited from KisPreferenceSet
 KisPreferenceSet (QWidget *parent=0)
 

Private Attributes

Ui::KisColorSelectorSettings * ui
 

Detailed Description

Definition at line 19 of file kis_color_selector_settings.h.

Constructor & Destructor Documentation

◆ KisColorSelectorSettings()

KisColorSelectorSettings::KisColorSelectorSettings ( QWidget * parent = 0)

Definition at line 29 of file kis_color_selector_settings.cpp.

29 :
30 KisPreferenceSet(parent),
31 ui(new Ui::KisColorSelectorSettings)
32{
33 ui->setupUi(this);
34
35 resize(minimumSize());
36
37 ui->colorSelectorConfiguration->setColorSpace(ui->colorSpace->currentColorSpace());
38 ui->useDifferentColorSpaceCheckbox->setChecked(false);
39
40 connect(ui->useDifferentColorSpaceCheckbox, SIGNAL(clicked(bool)), this, SLOT(useDifferentColorSpaceChecked(bool)));
41
42 /* color docker selector drop down */
43 ui->dockerColorSettingsComboBox->addItem(i18n("Advanced Color Selector"));
44 ui->dockerColorSettingsComboBox->addItem(i18n("Color Hotkeys"));
45
46 connect(ui->dockerColorSettingsComboBox,
47 qOverload<int>(&QComboBox::currentIndexChanged),
48 this,
50 // start off seeing advanced color selector properties
51 ui->dockerColorSettingsComboBox->setCurrentIndex(0);
52
53 /* advanced color docker options */
54 ui->dockerResizeOptionsComboBox->addItem(i18n("Change to a Horizontal Layout"));
55 ui->dockerResizeOptionsComboBox->addItem(i18n("Hide Shade Selector"));
56 ui->dockerResizeOptionsComboBox->addItem(i18n("Do Nothing"));
57 ui->dockerResizeOptionsComboBox->setCurrentIndex(0);
58
59
60 ui->zoomSelectorOptionComboBox->addItem(i18n("When Pressing Middle Mouse Button"));
61 ui->zoomSelectorOptionComboBox->addItem(i18n("On Mouse Over"));
62 ui->zoomSelectorOptionComboBox->addItem(i18n("Never"));
63 ui->zoomSelectorOptionComboBox->setCurrentIndex(0);
64
65
66 ui->colorSelectorTypeComboBox->addItem(i18n("HSV"));
67 ui->colorSelectorTypeComboBox->addItem(i18n("HSL"));
68 ui->colorSelectorTypeComboBox->addItem(i18n("HSI"));
69 ui->colorSelectorTypeComboBox->addItem(i18n("HSY'"));
70 ui->colorSelectorTypeComboBox->setCurrentIndex(0);
71 connect( ui->colorSelectorTypeComboBox, SIGNAL(currentIndexChanged(int)),this, SLOT(changedACSColorSelectorType(int)));
72 changedACSColorSelectorType(0); // initialize everything to HSV at the start
73
74
75 ui->ACSshadeSelectorMyPaintColorModelComboBox->addItem(i18n("HSV"));
76 ui->ACSshadeSelectorMyPaintColorModelComboBox->addItem(i18n("HSL"));
77 ui->ACSshadeSelectorMyPaintColorModelComboBox->addItem(i18n("HSI"));
78 ui->ACSshadeSelectorMyPaintColorModelComboBox->addItem(i18n("HSY'"));
79 ui->ACSshadeSelectorMyPaintColorModelComboBox->setCurrentIndex(0);
80
81
82 ui->ACSShadeSelectorTypeComboBox->addItem(i18n("MyPaint"));
83 ui->ACSShadeSelectorTypeComboBox->addItem(i18n("Minimal"));
84 ui->ACSShadeSelectorTypeComboBox->addItem(i18n("Do Not Show"));
85 ui->ACSShadeSelectorTypeComboBox->setCurrentIndex(0);
86 changedACSShadeSelectorType(0); // show/hide UI elements for MyPaint settings
87 connect( ui->ACSShadeSelectorTypeComboBox, SIGNAL(currentIndexChanged(int)),this, SLOT(changedACSShadeSelectorType(int)));
88
89
90 ui->commonColorsAlignVertical->setChecked(true);
91 ui->commonColorsAlignHorizontal->setChecked(true);
92 connect( ui->commonColorsAlignHorizontal, SIGNAL(toggled(bool)), this, SLOT(changedACSColorAlignment(bool)));
93 connect( ui->lastUsedColorsAlignHorizontal, SIGNAL(toggled(bool)), this, SLOT(changedACSLastUsedColorAlignment(bool)));
94
95 changedACSColorAlignment(ui->commonColorsAlignHorizontal->isChecked());
96 changedACSLastUsedColorAlignment(ui->lastUsedColorsAlignHorizontal->isChecked());
97
98
99 connect(ui->colorSpace, SIGNAL(colorSpaceChanged(const KoColorSpace*)),
100 ui->colorSelectorConfiguration, SLOT(setColorSpace(const KoColorSpace*)));
101
102
103 connect(this, SIGNAL(hsxchanged(int)),
104 ui->colorSelectorConfiguration, SLOT(setList(int)));
105
106 connect(ui->minimalShadeSelectorLineCount, SIGNAL(valueChanged(int)),
107 ui->minimalShadeSelectorLineSettings, SLOT(setLineCount(int)));
108
109 connect(ui->minimalShadeSelectorLineSettings, SIGNAL(lineCountChanged(int)),
110 ui->minimalShadeSelectorLineCount, SLOT(setValue(int)));
111
112 connect(ui->minimalShadeSelectorAsGradient, SIGNAL(toggled(bool)),
113 ui->minimalShadeSelectorLineSettings, SIGNAL(setGradient(bool)));
114
115 connect(ui->minimalShadeSelectorAsColorPatches, SIGNAL(toggled(bool)),
116 ui->minimalShadeSelectorLineSettings, SIGNAL(setPatches(bool)));
117
118 connect(ui->minimalShadeSelectorLineHeight, SIGNAL(valueChanged(int)),
119 ui->minimalShadeSelectorLineSettings, SIGNAL(setLineHeight(int)));
120
121 connect(ui->minimalShadeSelectorPatchesPerLine, SIGNAL(valueChanged(int)),
122 ui->minimalShadeSelectorLineSettings, SIGNAL(setPatchCount(int)));
123}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
Ui::KisColorSelectorSettings * ui
KisPreferenceSet(QWidget *parent=0)

References changedACSColorAlignment(), changedACSColorSelectorType(), changedACSLastUsedColorAlignment(), changedACSShadeSelectorType(), changedColorDocker(), connect(), hsxchanged(), ui, and useDifferentColorSpaceChecked().

◆ ~KisColorSelectorSettings()

KisColorSelectorSettings::~KisColorSelectorSettings ( )
override

Definition at line 125 of file kis_color_selector_settings.cpp.

126{
127 delete ui;
128}

References ui.

Member Function Documentation

◆ changedACSColorAlignment

void KisColorSelectorSettings::changedACSColorAlignment ( bool toggled)
slot

Definition at line 289 of file kis_color_selector_settings.cpp.

290{
291 // this slot is tied to the horizontal radio button's state being changed
292 // you can infer the vertical state
293
294 ui->lbl_commonColorsNumCols->setDisabled(toggled);
295 ui->commonColorsNumCols->setDisabled(toggled);
296
297 ui->lbl_commonColorsNumRows->setEnabled(toggled);
298 ui->commonColorsNumRows->setEnabled(toggled);
299}

References ui.

◆ changedACSColorSelectorType

void KisColorSelectorSettings::changedACSColorSelectorType ( int index)
slot

Definition at line 265 of file kis_color_selector_settings.cpp.

266{
267 ui->lumaCoefficientGroupbox->setEnabled(false);
268
269 if (index == 0) { // HSV
270 ui->ACSTypeDescriptionLabel->setText(i18n("Values goes from black to white, or black to the most saturated color. Saturation, in turn, goes from the most saturated color to white, gray or black."));
271 }
272 else if (index == 1) { // HSL
273 ui->ACSTypeDescriptionLabel->setText(i18n("Lightness goes from black to white, with middle gray being equal to the most saturated color."));
274 }
275 else if (index == 2) { // HSI
276 ui->ACSTypeDescriptionLabel->setText(i18n("Intensity maps to the sum of rgb components"));
277 }
278 else { // HSY'
279 ui->ACSTypeDescriptionLabel->setText(i18n("Luma(Y') is weighted by its coefficients which are configurable. Default values are set to 'rec 709'."));
280 ui->lumaCoefficientGroupbox->setEnabled(true);
281 }
282
283 ui->colorSelectorConfiguration->update();
284 Q_EMIT hsxchanged(index);
285
286}

References hsxchanged(), and ui.

◆ changedACSLastUsedColorAlignment

void KisColorSelectorSettings::changedACSLastUsedColorAlignment ( bool toggled)
slot

Definition at line 301 of file kis_color_selector_settings.cpp.

302{
303 // this slot is tied to the horizontal radio button's state being changed
304 // you can infer the vertical state
305
306 ui->lbl_lastUsedNumCols->setDisabled(toggled);
307 ui->lastUsedColorsNumCols->setDisabled(toggled);
308
309 ui->lbl_lastUsedNumRows->setEnabled(toggled);
310 ui->lastUsedColorsNumRows->setEnabled(toggled);
311}

References ui.

◆ changedACSShadeSelectorType

void KisColorSelectorSettings::changedACSShadeSelectorType ( int index)
slot

Definition at line 313 of file kis_color_selector_settings.cpp.

314{
315
316 if (index == 0) { // MyPaint
317 ui->minimalShadeSelectorGroup->hide();
318 ui->myPaintColorModelLabel->show();
319 ui->ACSshadeSelectorMyPaintColorModelComboBox->show();
320
321 } else if (index == 1) { // Minimal
322 ui->minimalShadeSelectorGroup->show();
323 ui->myPaintColorModelLabel->hide();
324 ui->ACSshadeSelectorMyPaintColorModelComboBox->hide();
325
326 }else { // do not show
327 ui->minimalShadeSelectorGroup->hide();
328 ui->myPaintColorModelLabel->hide();
329 ui->ACSshadeSelectorMyPaintColorModelComboBox->hide();
330 }
331}

References ui.

◆ changedColorDocker

void KisColorSelectorSettings::changedColorDocker ( int index)
slot

Definition at line 260 of file kis_color_selector_settings.cpp.

261{
262 ui->dockerOptionsPanel->setCurrentIndex(index);
263}

References ui.

◆ header()

QString KisColorSelectorSettings::header ( )
overridevirtual

Implements KisPreferenceSet.

Definition at line 140 of file kis_color_selector_settings.cpp.

141{
142 return QString(i18n("Color Selector Settings"));
143}

◆ hsxchanged

void KisColorSelectorSettings::hsxchanged ( int )
signal

◆ icon()

QIcon KisColorSelectorSettings::icon ( )
overridevirtual

Implements KisPreferenceSet.

Definition at line 146 of file kis_color_selector_settings.cpp.

147{
148 return KisIconUtils::loadIcon("extended_color_selector");
149}
QIcon loadIcon(const QString &name)

References KisIconUtils::loadIcon().

◆ id()

QString KisColorSelectorSettings::id ( )
overridevirtual

Implements KisPreferenceSet.

Definition at line 130 of file kis_color_selector_settings.cpp.

131{
132 return QString("advancedColorSelector");
133}

◆ loadDefaultPreferences

void KisColorSelectorSettings::loadDefaultPreferences ( )
overrideslot

Definition at line 472 of file kis_color_selector_settings.cpp.

473{
474 //set defaults
475 //if you change something, don't forget that loadPreferences should be kept in sync
476
477 // advanced color selector docker
478 ui->dockerResizeOptionsComboBox->setCurrentIndex(0);
479 ui->zoomSelectorOptionComboBox->setCurrentIndex(0);
480 ui->popupSize->setValue(280);
481 ui->chkShowColorSelector->setChecked(true);
482
483
484 ui->useDifferentColorSpaceCheckbox->setChecked(false);
485 ui->colorSpace->setCurrentColorModel(KoID("RGBA"));
486 ui->colorSpace->setCurrentColorDepth(KoID("U8"));
487 ui->colorSpace->setCurrentProfile(KoColorSpaceRegistry::instance()->rgb8()->profile()->name());
488
489 //color patches
490 ui->lastUsedColorsShow->setChecked(true);
491 ui->lastUsedColorsAlignVertical->setChecked(true);
492 ui->lastUsedColorsAlignHorizontal->setChecked(false);
493 ui->lastUsedColorsAllowScrolling->setChecked(true);
494 ui->lastUsedColorsNumCols->setValue(1);
495 ui->lastUsedColorsNumRows->setValue(1);
496 ui->lastUsedColorsPatchCount->setValue(20);
497 ui->lastUsedColorsWidth->setValue(16);
498 ui->lastUsedColorsHeight->setValue(16);
499
500 ui->commonColorsShow->setChecked(true);
501 ui->commonColorsAlignVertical->setChecked(false);
502 ui->commonColorsAlignHorizontal->setChecked(true);
503 ui->commonColorsAllowScrolling->setChecked(true);
504 ui->commonColorsNumCols->setValue(1);
505 ui->commonColorsNumRows->setValue(1);
506 ui->commonColorsPatchCount->setValue(12);
507 ui->commonColorsWidth->setValue(16);
508 ui->commonColorsHeight->setValue(16);
509 ui->commonColorsAutoUpdate->setChecked(false);
510
511 //shade selector
512 ui->ACSShadeSelectorTypeComboBox->setCurrentIndex(1); // Minimal
513
514 ui->ACSshadeSelectorMyPaintColorModelComboBox->setCurrentIndex(0);
515
516 ui->shadeSelectorUpdateOnRightClick->setChecked(false);
517 ui->shadeSelectorUpdateOnLeftClick->setChecked(false);
518 ui->shadeSelectorUpdateOnForeground->setChecked(true);
519 ui->shadeSelectorUpdateOnBackground->setChecked(true);
520
521 ui->minimalShadeSelectorAsGradient->setChecked(true);
522 ui->minimalShadeSelectorAsColorPatches->setChecked(false);
523
524 ui->minimalShadeSelectorPatchesPerLine->setValue(10);
525 ui->minimalShadeSelectorLineSettings->fromString("0|0.2|0|0|0|0|0;1|0|1|1|0|0|0;2|0|-1|1|0|0|0;");
526 ui->minimalShadeSelectorLineHeight->setValue(10);
527
528 // set advanced color selector to use HSV
529 ui->colorSelectorTypeComboBox->setCurrentIndex(0);
530
531 KisColorSelectorComboBox* cstw = dynamic_cast<KisColorSelectorComboBox*>(ui->colorSelectorConfiguration);
532 KIS_ASSERT(cstw);
533
534 cstw->setConfiguration(KisColorSelectorConfiguration("3|0|5|0")); // triangle selector
535
536 //luma//
537 ui->l_lumaR->setValue(0.2126);
538 ui->l_lumaG->setValue(0.7152);
539 ui->l_lumaB->setValue(0.0722);
540 ui->SP_Gamma->setValue(2.2);
541
542 //hotkeys//
543 ui->sb_lightness->setValue(10);
544 ui->sb_saturation->setValue(10);
545 ui->sb_hue->setValue(36);
546 ui->sb_rg->setValue(10);
547 ui->sb_by->setValue(10);
548
549}
void setConfiguration(KisColorSelectorConfiguration)
Definition KoID.h:30
#define KIS_ASSERT(cond)
Definition kis_assert.h:33
static KoColorSpaceRegistry * instance()

References KoColorSpaceRegistry::instance(), KIS_ASSERT, name(), KisColorSelectorComboBox::setConfiguration(), and ui.

◆ loadPreferences

void KisColorSelectorSettings::loadPreferences ( )
overrideslot

Definition at line 343 of file kis_color_selector_settings.cpp.

344{
345 //read cfg
346 //don't forget to also add a new entry to the default preferences
347
348 KConfigGroup cfg = KSharedConfig::openConfig()->group("advancedColorSelector");
349 KConfigGroup hsxcfg = KSharedConfig::openConfig()->group("hsxColorSlider");
350 KConfigGroup hotkeycfg = KSharedConfig::openConfig()->group("colorhotkeys");
351
352
353 // Advanced color selector
354 ui->dockerResizeOptionsComboBox->setCurrentIndex( (int)cfg.readEntry("onDockerResize", 0) );
355 ui->zoomSelectorOptionComboBox->setCurrentIndex( (int) cfg.readEntry("zoomSelectorOptions", 0) );
356 ui->popupSize->setValue(cfg.readEntry("zoomSize", 280));
357 ui->chkShowColorSelector->setChecked((bool) cfg.readEntry("showColorSelector", true));
358
359 {
360 KisConfig kisconfig(true);
361 const KoColorSpace *cs = kisconfig.customColorSelectorColorSpace();
362
363 if (cs) {
364 ui->useDifferentColorSpaceCheckbox->setChecked(true);
365 ui->colorSpace->setEnabled(true);
366 ui->colorSpace->setCurrentColorSpace(cs);
367 } else {
368 ui->useDifferentColorSpaceCheckbox->setChecked(false);
369 ui->colorSpace->setEnabled(false);
370 }
371 }
372
373
374 //color patches
375 ui->lastUsedColorsPerDocument->setChecked(cfg.readEntry("lastUsedColorsPerDocument", false));
376 ui->lastUsedColorsShow->setChecked(cfg.readEntry("lastUsedColorsShow", true));
377 bool a = cfg.readEntry("lastUsedColorsAlignment", true);
378 ui->lastUsedColorsAlignVertical->setChecked(a);
379 ui->lastUsedColorsAlignHorizontal->setChecked(!a);
380 ui->lastUsedColorsAllowScrolling->setChecked(cfg.readEntry("lastUsedColorsScrolling", true));
381 ui->lastUsedColorsNumCols->setValue(cfg.readEntry("lastUsedColorsNumCols", 1));
382 ui->lastUsedColorsNumRows->setValue(cfg.readEntry("lastUsedColorsNumRows", 1));
383 ui->lastUsedColorsPatchCount->setValue(cfg.readEntry("lastUsedColorsCount", 20));
384 ui->lastUsedColorsWidth->setValue(cfg.readEntry("lastUsedColorsWidth", 16));
385 ui->lastUsedColorsHeight->setValue(cfg.readEntry("lastUsedColorsHeight", 16));
386
387 ui->commonColorsShow->setChecked(cfg.readEntry("commonColorsShow", true));
388 a = cfg.readEntry("commonColorsAlignment", false);
389 ui->commonColorsAlignVertical->setChecked(a);
390 ui->commonColorsAlignHorizontal->setChecked(!a);
391 ui->commonColorsAllowScrolling->setChecked(cfg.readEntry("commonColorsScrolling", true));
392 ui->commonColorsNumCols->setValue(cfg.readEntry("commonColorsNumCols", 1));
393 ui->commonColorsNumRows->setValue(cfg.readEntry("commonColorsNumRows", 1));
394 ui->commonColorsPatchCount->setValue(cfg.readEntry("commonColorsCount", 12));
395 ui->commonColorsWidth->setValue(cfg.readEntry("commonColorsWidth", 16));
396 ui->commonColorsHeight->setValue(cfg.readEntry("commonColorsHeight", 16));
397 ui->commonColorsAutoUpdate->setChecked(cfg.readEntry("commonColorsAutoUpdate", false));
398
399 //shade selector
400 QString shadeSelectorType=cfg.readEntry("shadeSelectorType", "Minimal");
401
402 if ( shadeSelectorType == "MyPaint") {
403 ui->ACSShadeSelectorTypeComboBox->setCurrentIndex(0);
404 } else if (shadeSelectorType == "Minimal") {
405 ui->ACSShadeSelectorTypeComboBox->setCurrentIndex(1);
406 } else { // Hidden
407 ui->ACSShadeSelectorTypeComboBox->setCurrentIndex(2);
408 }
409
410 ui->shadeSelectorUpdateOnRightClick->setChecked(cfg.readEntry("shadeSelectorUpdateOnRightClick", false));
411 ui->shadeSelectorUpdateOnLeftClick->setChecked(cfg.readEntry("shadeSelectorUpdateOnLeftClick", false));
412 ui->shadeSelectorUpdateOnForeground->setChecked(cfg.readEntry("shadeSelectorUpdateOnForeground", true));
413 ui->shadeSelectorUpdateOnBackground->setChecked(cfg.readEntry("shadeSelectorUpdateOnBackground", true));
414 ui->hidePopupOnClickCheck->setChecked(cfg.readEntry("hidePopupOnClickCheck", false));
415 ui->useCustomColorForBackground->setChecked(cfg.readEntry("useCustomColorForBackground", false));
416 connect(ui->useCustomColorForBackground, SIGNAL(clicked(bool)), this, SLOT(useCustomColorForSelector(bool)));
417
418
419 QColor storedColor = cfg.readEntry("customSelectorBackgroundColor", QColor(Qt::gray));
420 KoColor c;
421 c.fromQColor(storedColor);
422 ui->customColorBackgroundSelector->setColor(c);
423
424 ui->customColorBackgroundSelector->setEnabled(cfg.readEntry("useCustomColorForBackground", false));
425
426 QString shadeMyPaintType = cfg.readEntry("shadeMyPaintType", "HSV");
427
428 if (shadeMyPaintType == "HSV" ) {
429 ui->ACSshadeSelectorMyPaintColorModelComboBox->setCurrentIndex(0);
430 } else if (shadeMyPaintType == "HSL" ) {
431 ui->ACSshadeSelectorMyPaintColorModelComboBox->setCurrentIndex(1);
432 } else if (shadeMyPaintType == "HSI" ) {
433 ui->ACSshadeSelectorMyPaintColorModelComboBox->setCurrentIndex(2);
434 } else { // HSY
435 ui->ACSshadeSelectorMyPaintColorModelComboBox->setCurrentIndex(3);
436 }
437
438
439 bool asGradient = cfg.readEntry("minimalShadeSelectorAsGradient", true);
440 if(asGradient) ui->minimalShadeSelectorAsGradient->setChecked(true);
441 else ui->minimalShadeSelectorAsColorPatches->setChecked(true);
442
443 ui->minimalShadeSelectorPatchesPerLine->setValue(cfg.readEntry("minimalShadeSelectorPatchCount", 10));
444 ui->minimalShadeSelectorLineSettings->fromString(cfg.readEntry("minimalShadeSelectorLineConfig", "0|0.2|0|0|0|0|0;1|0|1|1|0|0|0;2|0|-1|1|0|0|0;"));
445 ui->minimalShadeSelectorLineHeight->setValue(cfg.readEntry("minimalShadeSelectorLineHeight", 10));
446
447 int hsxSettingType= (int)cfg.readEntry("hsxSettingType", 0);
448 ui->colorSelectorTypeComboBox->setCurrentIndex(hsxSettingType);
449
450
451 //color selector
452 KisColorSelectorComboBox* cstw = dynamic_cast<KisColorSelectorComboBox*>(ui->colorSelectorConfiguration);
453 KIS_ASSERT(cstw);
454 cstw->setConfiguration(KisColorSelectorConfiguration::fromString(cfg.readEntry("colorSelectorConfiguration", "3|0|5|0"))); // triangle selector
455
456 //luma values//
457 ui->l_lumaR->setValue(cfg.readEntry("lumaR", 0.2126));
458 ui->l_lumaG->setValue(cfg.readEntry("lumaG", 0.7152));
459 ui->l_lumaB->setValue(cfg.readEntry("lumaB", 0.0722));
460 ui->SP_Gamma->setValue(cfg.readEntry("gamma", 2.2));
461
462 //hotkeys//
463 ui->sb_lightness->setValue(hotkeycfg.readEntry("steps_lightness", 10));
464 ui->sb_saturation->setValue(hotkeycfg.readEntry("steps_saturation", 10));
465 ui->sb_hue->setValue(hotkeycfg.readEntry("steps_hue", 36));
466 ui->sb_rg->setValue(hotkeycfg.readEntry("steps_redgreen", 10));
467 ui->sb_by->setValue(hotkeycfg.readEntry("steps_blueyellow", 10));
468
469
470}
static KisColorSelectorConfiguration fromString(QString string)
void fromQColor(const QColor &c)
Convenient function for converting from a QColor.
Definition KoColor.cpp:213

References connect(), KisConfig::customColorSelectorColorSpace(), KoColor::fromQColor(), KisColorSelectorConfiguration::fromString(), KIS_ASSERT, KisColorSelectorComboBox::setConfiguration(), ui, and useCustomColorForSelector().

◆ name()

QString KisColorSelectorSettings::name ( )
overridevirtual

Implements KisPreferenceSet.

Definition at line 135 of file kis_color_selector_settings.cpp.

136{
137 return header();
138}

References header().

◆ savePreferences

void KisColorSelectorSettings::savePreferences ( ) const
overrideslot

Definition at line 152 of file kis_color_selector_settings.cpp.

153{
154 // write cfg
155 KConfigGroup cfg = KSharedConfig::openConfig()->group("advancedColorSelector");
156 KConfigGroup hsxcfg = KSharedConfig::openConfig()->group("hsxColorSlider");
157 KConfigGroup hotkeycfg = KSharedConfig::openConfig()->group("colorhotkeys");
158
159 // advanced color selector
160 cfg.writeEntry("onDockerResize", ui->dockerResizeOptionsComboBox->currentIndex());
161 cfg.writeEntry("zoomSelectorOptions", ui->zoomSelectorOptionComboBox->currentIndex() );
162 cfg.writeEntry("zoomSize", ui->popupSize->value());
163 cfg.writeEntry("showColorSelector", ui->chkShowColorSelector->isChecked());
164
165 bool useCustomColorSpace = ui->useDifferentColorSpaceCheckbox->isChecked();
166 const KoColorSpace* colorSpace = useCustomColorSpace ? ui->colorSpace->currentColorSpace() : 0;
167
168 KisConfig kisconfig(false);
169 kisconfig.setCustomColorSelectorColorSpace(colorSpace);
170
171 //color patches
172 cfg.writeEntry("lastUsedColorsPerDocument", ui->lastUsedColorsPerDocument->isChecked());
173 cfg.writeEntry("lastUsedColorsShow", ui->lastUsedColorsShow->isChecked());
174 cfg.writeEntry("lastUsedColorsAlignment", ui->lastUsedColorsAlignVertical->isChecked());
175 cfg.writeEntry("lastUsedColorsScrolling", ui->lastUsedColorsAllowScrolling->isChecked());
176 cfg.writeEntry("lastUsedColorsNumCols", ui->lastUsedColorsNumCols->value());
177 cfg.writeEntry("lastUsedColorsNumRows", ui->lastUsedColorsNumRows->value());
178 cfg.writeEntry("lastUsedColorsCount", ui->lastUsedColorsPatchCount->value());
179 cfg.writeEntry("lastUsedColorsWidth", ui->lastUsedColorsWidth->value());
180 cfg.writeEntry("lastUsedColorsHeight", ui->lastUsedColorsHeight->value());
181
182 cfg.writeEntry("commonColorsShow", ui->commonColorsShow->isChecked());
183 cfg.writeEntry("commonColorsAlignment", ui->commonColorsAlignVertical->isChecked());
184 cfg.writeEntry("commonColorsScrolling", ui->commonColorsAllowScrolling->isChecked());
185 cfg.writeEntry("commonColorsNumCols", ui->commonColorsNumCols->value());
186 cfg.writeEntry("commonColorsNumRows", ui->commonColorsNumRows->value());
187 cfg.writeEntry("commonColorsCount", ui->commonColorsPatchCount->value());
188 cfg.writeEntry("commonColorsWidth", ui->commonColorsWidth->value());
189 cfg.writeEntry("commonColorsHeight", ui->commonColorsHeight->value());
190 cfg.writeEntry("commonColorsAutoUpdate", ui->commonColorsAutoUpdate->isChecked());
191
192 //shade selector
193
194
195
196 int shadeSelectorTypeIndex = ui->ACSShadeSelectorTypeComboBox->currentIndex();
197
198 if(shadeSelectorTypeIndex == 0) {
199 cfg.writeEntry("shadeSelectorType", "MyPaint");
200 } else if (shadeSelectorTypeIndex == 1) {
201 cfg.writeEntry("shadeSelectorType", "Minimal");
202 } else {
203 cfg.writeEntry("shadeSelectorType", "Hidden");
204 }
205
206 cfg.writeEntry("shadeSelectorUpdateOnRightClick", ui->shadeSelectorUpdateOnRightClick->isChecked());
207 cfg.writeEntry("shadeSelectorUpdateOnForeground", ui->shadeSelectorUpdateOnForeground->isChecked());
208 cfg.writeEntry("shadeSelectorUpdateOnLeftClick", ui->shadeSelectorUpdateOnLeftClick->isChecked());
209 cfg.writeEntry("shadeSelectorUpdateOnBackground", ui->shadeSelectorUpdateOnBackground->isChecked());
210 cfg.writeEntry("hidePopupOnClickCheck", ui->hidePopupOnClickCheck->isChecked());
211 cfg.writeEntry("useCustomColorForBackground", ui->useCustomColorForBackground->isChecked());
212
213 cfg.writeEntry("customSelectorBackgroundColor", ui->customColorBackgroundSelector->color().toQColor());
214
215 //mypaint model
216
217 int shadeMyPaintComboBoxIndex = ui->ACSshadeSelectorMyPaintColorModelComboBox->currentIndex();
218 if (shadeMyPaintComboBoxIndex == 0 ) {
219 cfg.writeEntry("shadeMyPaintType", "HSV");
220 } else if (shadeMyPaintComboBoxIndex == 1 ) {
221 cfg.writeEntry("shadeMyPaintType", "HSL");
222 } else if (shadeMyPaintComboBoxIndex == 2 ) {
223 cfg.writeEntry("shadeMyPaintType", "HSI");
224 } else { // HSY
225 cfg.writeEntry("shadeMyPaintType", "HSY");
226 }
227
228
229
230 cfg.writeEntry("minimalShadeSelectorAsGradient", ui->minimalShadeSelectorAsGradient->isChecked());
231 cfg.writeEntry("minimalShadeSelectorPatchCount", ui->minimalShadeSelectorPatchesPerLine->value());
232 cfg.writeEntry("minimalShadeSelectorLineConfig", ui->minimalShadeSelectorLineSettings->toString());
233 cfg.writeEntry("minimalShadeSelectorLineHeight", ui->minimalShadeSelectorLineHeight->value());
234
235 //color selector
236 KisColorSelectorComboBox* cstw = dynamic_cast<KisColorSelectorComboBox*>(ui->colorSelectorConfiguration);
237 KIS_ASSERT(cstw);
238
239 cfg.writeEntry("colorSelectorConfiguration", cstw->configuration().toString());
240
241 cfg.writeEntry("hsxSettingType", ui->colorSelectorTypeComboBox->currentIndex());
242
243 //luma//
244 cfg.writeEntry("lumaR", ui->l_lumaR->value());
245 cfg.writeEntry("lumaG", ui->l_lumaG->value());
246 cfg.writeEntry("lumaB", ui->l_lumaB->value());
247 cfg.writeEntry("gamma", ui->SP_Gamma->value());
248
249 //hotkeys//
250 hotkeycfg.writeEntry("steps_lightness", ui->sb_lightness->value());
251 hotkeycfg.writeEntry("steps_saturation", ui->sb_saturation->value());
252 hotkeycfg.writeEntry("steps_hue", ui->sb_hue->value());
253 hotkeycfg.writeEntry("steps_redgreen", ui->sb_rg->value());
254 hotkeycfg.writeEntry("steps_blueyellow", ui->sb_by->value());
255
256 Q_EMIT settingsChanged();
258}
KisColorSelectorConfiguration configuration() const
void settingsChanged() const
static KisConfigNotifier * instance()

References KisColorSelectorComboBox::configuration(), KisConfigNotifier::instance(), KIS_ASSERT, KisConfigNotifier::notifyColorHistoryModeChanged(), KisConfig::setCustomColorSelectorColorSpace(), settingsChanged(), KisColorSelectorConfiguration::toString(), and ui.

◆ settingsChanged

void KisColorSelectorSettings::settingsChanged ( ) const
signal

◆ useCustomColorForSelector

void KisColorSelectorSettings::useCustomColorForSelector ( bool enabled)
slot

Definition at line 338 of file kis_color_selector_settings.cpp.

339{
340 ui->customColorBackgroundSelector->setEnabled(enabled);
341}

References ui.

◆ useDifferentColorSpaceChecked

void KisColorSelectorSettings::useDifferentColorSpaceChecked ( bool enabled)
slot

Definition at line 333 of file kis_color_selector_settings.cpp.

334{
335 ui->colorSpace->setEnabled(enabled);
336}

References ui.

Member Data Documentation

◆ ui

Ui::KisColorSelectorSettings* KisColorSelectorSettings::ui
private

Definition at line 48 of file kis_color_selector_settings.h.


The documentation for this class was generated from the following files: