コード例 #1
0
void KisColorSelectorSettings::savePreferences() const
{
    // write cfg
    KConfigGroup cfg =  KSharedConfig::openConfig()->group("advancedColorSelector");
    KConfigGroup hsxcfg =  KSharedConfig::openConfig()->group("hsxColorSlider");
    KConfigGroup hotkeycfg =  KSharedConfig::openConfig()->group("colorhotkeys");

    //  advanced color selector
    cfg.writeEntry("onDockerResize", ui->dockerResizeOptionsComboBox->currentIndex());
    cfg.writeEntry("zoomSelectorOptions", ui->zoomSelectorOptionComboBox->currentIndex() );
    cfg.writeEntry("zoomSize", ui->popupSize->value());



    bool useCustomColorSpace =  ui->useDifferentColorSpaceCheckbox->isChecked();
    const KoColorSpace* colorSpace = useCustomColorSpace ? ui->colorSpace->currentColorSpace() : 0;


    KisConfig kisconfig;
    kisconfig.setCustomColorSelectorColorSpace(colorSpace);

    //color patches
    cfg.writeEntry("lastUsedColorsShow", ui->lastUsedColorsShow->isChecked());
    cfg.writeEntry("lastUsedColorsAlignment", ui->lastUsedColorsAlignVertical->isChecked());
    cfg.writeEntry("lastUsedColorsScrolling", ui->lastUsedColorsAllowScrolling->isChecked());
    cfg.writeEntry("lastUsedColorsNumCols", ui->lastUsedColorsNumCols->value());
    cfg.writeEntry("lastUsedColorsNumRows", ui->lastUsedColorsNumRows->value());
    cfg.writeEntry("lastUsedColorsCount", ui->lastUsedColorsPatchCount->value());
    cfg.writeEntry("lastUsedColorsWidth", ui->lastUsedColorsWidth->value());
    cfg.writeEntry("lastUsedColorsHeight", ui->lastUsedColorsHeight->value());

    cfg.writeEntry("commonColorsShow", ui->commonColorsShow->isChecked());
    cfg.writeEntry("commonColorsAlignment", ui->commonColorsAlignVertical->isChecked());
    cfg.writeEntry("commonColorsScrolling", ui->commonColorsAllowScrolling->isChecked());
    cfg.writeEntry("commonColorsNumCols", ui->commonColorsNumCols->value());
    cfg.writeEntry("commonColorsNumRows", ui->commonColorsNumRows->value());
    cfg.writeEntry("commonColorsCount", ui->commonColorsPatchCount->value());
    cfg.writeEntry("commonColorsWidth", ui->commonColorsWidth->value());
    cfg.writeEntry("commonColorsHeight", ui->commonColorsHeight->value());
    cfg.writeEntry("commonColorsAutoUpdate", ui->commonColorsAutoUpdate->isChecked());

    //shade selector



    int shadeSelectorTypeIndex =  ui->ACSShadeSelectorTypeComboBox->currentIndex();

    if(shadeSelectorTypeIndex == 0) {
        cfg.writeEntry("shadeSelectorType", "MyPaint");
    } else if (shadeSelectorTypeIndex == 1) {
        cfg.writeEntry("shadeSelectorType", "Minimal");
    } else {
        cfg.writeEntry("shadeSelectorType", "Hidden");
    }

    cfg.writeEntry("shadeSelectorUpdateOnRightClick", ui->shadeSelectorUpdateOnRightClick->isChecked());
    cfg.writeEntry("shadeSelectorUpdateOnForeground", ui->shadeSelectorUpdateOnForeground->isChecked());
    cfg.writeEntry("shadeSelectorUpdateOnLeftClick", ui->shadeSelectorUpdateOnLeftClick->isChecked());
    cfg.writeEntry("shadeSelectorUpdateOnBackground", ui->shadeSelectorUpdateOnBackground->isChecked());
    cfg.writeEntry("hidePopupOnClickCheck", ui->hidePopupOnClickCheck->isChecked());
    
    //mypaint model

    int shadeMyPaintComboBoxIndex  = ui->ACSshadeSelectorMyPaintColorModelComboBox->currentIndex();
    if (shadeMyPaintComboBoxIndex == 0 ) {
        cfg.writeEntry("shadeMyPaintType",   "HSV");
    } else  if (shadeMyPaintComboBoxIndex == 1 ) {
        cfg.writeEntry("shadeMyPaintType",   "HSL");
    } else  if (shadeMyPaintComboBoxIndex == 2 ) {
        cfg.writeEntry("shadeMyPaintType",   "HSI");
    } else {   // HSY
        cfg.writeEntry("shadeMyPaintType",   "HSY");
    }



    cfg.writeEntry("minimalShadeSelectorAsGradient", ui->minimalShadeSelectorAsGradient->isChecked());
    cfg.writeEntry("minimalShadeSelectorPatchCount", ui->minimalShadeSelectorPatchesPerLine->value());
    cfg.writeEntry("minimalShadeSelectorLineConfig",  ui->minimalShadeSelectorLineSettings->toString());
    cfg.writeEntry("minimalShadeSelectorLineHeight", ui->minimalShadeSelectorLineHeight->value());

    //color selector
    KisColorSelectorComboBox* cstw = dynamic_cast<KisColorSelectorComboBox*>(ui->colorSelectorConfiguration);
    cfg.writeEntry("colorSelectorConfiguration", cstw->configuration().toString());
    
    cfg.writeEntry("hsxSettingType", ui->colorSelectorTypeComboBox->currentIndex());
    
    //luma//
    cfg.writeEntry("lumaR", ui->l_lumaR->value());
    cfg.writeEntry("lumaG", ui->l_lumaG->value());
    cfg.writeEntry("lumaB", ui->l_lumaB->value());
    cfg.writeEntry("gamma", ui->SP_Gamma->value());
    
    //slider//
    hsxcfg.writeEntry("hsvH", ui->csl_hsvH->isChecked());
    hsxcfg.writeEntry("hsvS", ui->csl_hsvS->isChecked());
    hsxcfg.writeEntry("hsvV", ui->csl_hsvV->isChecked());
    hsxcfg.writeEntry("hslH", ui->csl_hslH->isChecked());
    hsxcfg.writeEntry("hslS", ui->csl_hslS->isChecked());
    hsxcfg.writeEntry("hslL", ui->csl_hslL->isChecked());
    hsxcfg.writeEntry("hsiH", ui->csl_hsiH->isChecked());
    hsxcfg.writeEntry("hsiS", ui->csl_hsiS->isChecked());
    hsxcfg.writeEntry("hsiI", ui->csl_hsiI->isChecked());
    hsxcfg.writeEntry("hsyH", ui->csl_hsyH->isChecked());
    hsxcfg.writeEntry("hsyS", ui->csl_hsyS->isChecked());
    hsxcfg.writeEntry("hsyY", ui->csl_hsyY->isChecked());

    //hotkeys//
    hotkeycfg.writeEntry("steps_lightness", ui->sb_lightness->value());
    hotkeycfg.writeEntry("steps_saturation", ui->sb_saturation->value());
    hotkeycfg.writeEntry("steps_hue", ui->sb_hue->value());
    hotkeycfg.writeEntry("steps_redgreen", ui->sb_rg->value());
    hotkeycfg.writeEntry("steps_blueyellow", ui->sb_by->value());

    emit settingsChanged();
}
コード例 #2
0
void KisColorSelectorSettings::savePreferences() const
{
    //write cfg
    KConfigGroup cfg = KGlobal::config()->group("advancedColorSelector");

    //general
    cfg.writeEntry("shadeSelectorHideable", ui->shadeSelectorHideable->isChecked());
    cfg.writeEntry("allowHorizontalLayout", ui->allowHorizontalLayout->isChecked());
    cfg.writeEntry("popupOnMouseOver", ui->popupOnMouseOver->isChecked());
    cfg.writeEntry("popupOnMouseClick", ui->popupOnMouseClick->isChecked());
    cfg.writeEntry("zoomSize", ui->popupSize->value());

    bool useCustomColorSpace = ui->useCustomColorSpace->isChecked();
    const KoColorSpace* colorSpace = useCustomColorSpace ?
        ui->colorSpace->currentColorSpace() : 0;

    KisConfig kisconfig;
    kisconfig.setCustomColorSelectorColorSpace(colorSpace);

    //color patches
    cfg.writeEntry("lastUsedColorsShow", ui->lastUsedColorsShow->isChecked());
    cfg.writeEntry("lastUsedColorsAlignment", ui->lastUsedColorsAlignVertical->isChecked());
    cfg.writeEntry("lastUsedColorsScrolling", ui->lastUsedColorsAllowScrolling->isChecked());
    cfg.writeEntry("lastUsedColorsNumCols", ui->lastUsedColorsNumCols->value());
    cfg.writeEntry("lastUsedColorsNumRows", ui->lastUsedColorsNumRows->value());
    cfg.writeEntry("lastUsedColorsCount", ui->lastUsedColorsPatchCount->value());
    cfg.writeEntry("lastUsedColorsWidth", ui->lastUsedColorsWidth->value());
    cfg.writeEntry("lastUsedColorsHeight", ui->lastUsedColorsHeight->value());

    cfg.writeEntry("commonColorsShow", ui->commonColorsShow->isChecked());
    cfg.writeEntry("commonColorsAlignment", ui->commonColorsAlignVertical->isChecked());
    cfg.writeEntry("commonColorsScrolling", ui->commonColorsAllowScrolling->isChecked());
    cfg.writeEntry("commonColorsNumCols", ui->commonColorsNumCols->value());
    cfg.writeEntry("commonColorsNumRows", ui->commonColorsNumRows->value());
    cfg.writeEntry("commonColorsCount", ui->commonColorsPatchCount->value());
    cfg.writeEntry("commonColorsWidth", ui->commonColorsWidth->value());
    cfg.writeEntry("commonColorsHeight", ui->commonColorsHeight->value());
    cfg.writeEntry("commonColorsAutoUpdate", ui->commonColorsAutoUpdate->isChecked());

    //shade selector
    QString shadeSelectorType("MyPaint");
    if(ui->shadeSelectorTypeMinimal->isChecked())
        shadeSelectorType="Minimal";
    if(ui->shadeSelectorTypeHidden->isChecked())
        shadeSelectorType="Hidden";

    cfg.writeEntry("shadeSelectorType", shadeSelectorType);

    cfg.writeEntry("shadeSelectorUpdateOnRightClick", ui->shadeSelectorUpdateOnRightClick->isChecked());
    cfg.writeEntry("shadeSelectorUpdateOnForeground", ui->shadeSelectorUpdateOnForeground->isChecked());
    cfg.writeEntry("shadeSelectorUpdateOnLeftClick", ui->shadeSelectorUpdateOnLeftClick->isChecked());
    cfg.writeEntry("shadeSelectorUpdateOnBackground", ui->shadeSelectorUpdateOnBackground->isChecked());

    cfg.writeEntry("minimalShadeSelectorAsGradient", ui->minimalShadeSelectorAsGradient->isChecked());
    cfg.writeEntry("minimalShadeSelectorPatchCount", ui->minimalShadeSelectorPatchesPerLine->value());
    cfg.writeEntry("minimalShadeSelectorLineConfig",  ui->minimalShadeSelectorLineSettings->toString());
    cfg.writeEntry("minimalShadeSelectorLineHeight", ui->minimalShadeSelectorLineHeight->value());

    //color selector
    KisColorSelectorComboBox* cstw = dynamic_cast<KisColorSelectorComboBox*>(ui->colorSelectorConfiguration);
    cfg.writeEntry("colorSelectorConfiguration", cstw->configuration().toString());

    emit settingsChanged();
}