35 resize(minimumSize());
37 ui->colorSelectorConfiguration->setColorSpace(
ui->colorSpace->currentColorSpace());
38 ui->useDifferentColorSpaceCheckbox->setChecked(
false);
43 ui->dockerColorSettingsComboBox->addItem(i18n(
"Advanced Color Selector"));
44 ui->dockerColorSettingsComboBox->addItem(i18n(
"Color Hotkeys"));
47 qOverload<int>(&QComboBox::currentIndexChanged),
51 ui->dockerColorSettingsComboBox->setCurrentIndex(0);
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);
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);
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);
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);
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);
90 ui->commonColorsAlignVertical->setChecked(
true);
91 ui->commonColorsAlignHorizontal->setChecked(
true);
100 ui->colorSelectorConfiguration, SLOT(setColorSpace(
const KoColorSpace*)));
104 ui->colorSelectorConfiguration, SLOT(setList(
int)));
106 connect(
ui->minimalShadeSelectorLineCount, SIGNAL(valueChanged(
int)),
107 ui->minimalShadeSelectorLineSettings, SLOT(setLineCount(
int)));
109 connect(
ui->minimalShadeSelectorLineSettings, SIGNAL(lineCountChanged(
int)),
110 ui->minimalShadeSelectorLineCount, SLOT(setValue(
int)));
112 connect(
ui->minimalShadeSelectorAsGradient, SIGNAL(toggled(
bool)),
113 ui->minimalShadeSelectorLineSettings, SIGNAL(setGradient(
bool)));
115 connect(
ui->minimalShadeSelectorAsColorPatches, SIGNAL(toggled(
bool)),
116 ui->minimalShadeSelectorLineSettings, SIGNAL(setPatches(
bool)));
118 connect(
ui->minimalShadeSelectorLineHeight, SIGNAL(valueChanged(
int)),
119 ui->minimalShadeSelectorLineSettings, SIGNAL(setLineHeight(
int)));
121 connect(
ui->minimalShadeSelectorPatchesPerLine, SIGNAL(valueChanged(
int)),
122 ui->minimalShadeSelectorLineSettings, SIGNAL(setPatchCount(
int)));
155 KConfigGroup cfg = KSharedConfig::openConfig()->group(
"advancedColorSelector");
156 KConfigGroup hsxcfg = KSharedConfig::openConfig()->group(
"hsxColorSlider");
157 KConfigGroup hotkeycfg = KSharedConfig::openConfig()->group(
"colorhotkeys");
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());
165 bool useCustomColorSpace =
ui->useDifferentColorSpaceCheckbox->isChecked();
166 const KoColorSpace* colorSpace = useCustomColorSpace ?
ui->colorSpace->currentColorSpace() : 0;
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());
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());
196 int shadeSelectorTypeIndex =
ui->ACSShadeSelectorTypeComboBox->currentIndex();
198 if(shadeSelectorTypeIndex == 0) {
199 cfg.writeEntry(
"shadeSelectorType",
"MyPaint");
200 }
else if (shadeSelectorTypeIndex == 1) {
201 cfg.writeEntry(
"shadeSelectorType",
"Minimal");
203 cfg.writeEntry(
"shadeSelectorType",
"Hidden");
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());
213 cfg.writeEntry(
"customSelectorBackgroundColor",
ui->customColorBackgroundSelector->color().toQColor());
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");
225 cfg.writeEntry(
"shadeMyPaintType",
"HSY");
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());
241 cfg.writeEntry(
"hsxSettingType",
ui->colorSelectorTypeComboBox->currentIndex());
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());
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());
348 KConfigGroup cfg = KSharedConfig::openConfig()->group(
"advancedColorSelector");
349 KConfigGroup hsxcfg = KSharedConfig::openConfig()->group(
"hsxColorSlider");
350 KConfigGroup hotkeycfg = KSharedConfig::openConfig()->group(
"colorhotkeys");
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));
364 ui->useDifferentColorSpaceCheckbox->setChecked(
true);
365 ui->colorSpace->setEnabled(
true);
366 ui->colorSpace->setCurrentColorSpace(cs);
368 ui->useDifferentColorSpaceCheckbox->setChecked(
false);
369 ui->colorSpace->setEnabled(
false);
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));
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));
400 QString shadeSelectorType=cfg.readEntry(
"shadeSelectorType",
"Minimal");
402 if ( shadeSelectorType ==
"MyPaint") {
403 ui->ACSShadeSelectorTypeComboBox->setCurrentIndex(0);
404 }
else if (shadeSelectorType ==
"Minimal") {
405 ui->ACSShadeSelectorTypeComboBox->setCurrentIndex(1);
407 ui->ACSShadeSelectorTypeComboBox->setCurrentIndex(2);
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));
419 QColor storedColor = cfg.readEntry(
"customSelectorBackgroundColor", QColor(Qt::gray));
422 ui->customColorBackgroundSelector->setColor(c);
424 ui->customColorBackgroundSelector->setEnabled(cfg.readEntry(
"useCustomColorForBackground",
false));
426 QString shadeMyPaintType = cfg.readEntry(
"shadeMyPaintType",
"HSV");
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);
435 ui->ACSshadeSelectorMyPaintColorModelComboBox->setCurrentIndex(3);
439 bool asGradient = cfg.readEntry(
"minimalShadeSelectorAsGradient",
true);
440 if(asGradient)
ui->minimalShadeSelectorAsGradient->setChecked(
true);
441 else ui->minimalShadeSelectorAsColorPatches->setChecked(
true);
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));
447 int hsxSettingType= (int)cfg.readEntry(
"hsxSettingType", 0);
448 ui->colorSelectorTypeComboBox->setCurrentIndex(hsxSettingType);
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));
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));
478 ui->dockerResizeOptionsComboBox->setCurrentIndex(0);
479 ui->zoomSelectorOptionComboBox->setCurrentIndex(0);
480 ui->popupSize->setValue(280);
481 ui->chkShowColorSelector->setChecked(
true);
484 ui->useDifferentColorSpaceCheckbox->setChecked(
false);
485 ui->colorSpace->setCurrentColorModel(
KoID(
"RGBA"));
486 ui->colorSpace->setCurrentColorDepth(
KoID(
"U8"));
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);
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);
512 ui->ACSShadeSelectorTypeComboBox->setCurrentIndex(1);
514 ui->ACSshadeSelectorMyPaintColorModelComboBox->setCurrentIndex(0);
516 ui->shadeSelectorUpdateOnRightClick->setChecked(
false);
517 ui->shadeSelectorUpdateOnLeftClick->setChecked(
false);
518 ui->shadeSelectorUpdateOnForeground->setChecked(
true);
519 ui->shadeSelectorUpdateOnBackground->setChecked(
true);
521 ui->minimalShadeSelectorAsGradient->setChecked(
true);
522 ui->minimalShadeSelectorAsColorPatches->setChecked(
false);
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);
529 ui->colorSelectorTypeComboBox->setCurrentIndex(0);
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);
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);
555 QLayout* l =
new QVBoxLayout(
this);
560 QDialogButtonBox* buttonBox =
new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::RestoreDefaults,
563 l->addWidget(buttonBox);
565 KGuiItem::assign(buttonBox->button(QDialogButtonBox::Ok), KStandardGuiItem::ok());
566 KGuiItem::assign(buttonBox->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());
567 KGuiItem::assign(buttonBox->button(QDialogButtonBox::RestoreDefaults), KStandardGuiItem::defaults());
569 connect(buttonBox, SIGNAL(accepted()),
m_widget, SLOT(savePreferences()));
570 connect(buttonBox, SIGNAL(accepted()),
this, SLOT(accept()));
571 connect(buttonBox, SIGNAL(rejected()),
this, SLOT(reject()));
572 connect(buttonBox->button(QDialogButtonBox::RestoreDefaults),
573 SIGNAL(clicked()),
m_widget, SLOT(loadDefaultPreferences()));