Commit 23dcf5d9 authored by Wolthera van Hövell's avatar Wolthera van Hövell 🛍

Replace kcolorbutton with new kiscolorbutton in several places.

The new dialog is accesible from all these places.

There's still several places where they still need to be replaced.

Ref T2438
parent c5621355
......@@ -117,7 +117,9 @@ GeneralTab::GeneralTab(QWidget *_parent, const char *_name)
m_cmbMDIType->setCurrentIndex(cfg.readEntry<int>("mdi_viewmode", (int)QMdiArea::TabbedView));
m_chkRubberBand->setChecked(cfg.readEntry<int>("mdi_rubberband", cfg.useOpenGL()));
m_favoritePresetsSpinBox->setValue(cfg.favoritePresets());
m_mdiColor->setColor(cfg.getMDIBackgroundColor());
KoColor mdiColor;
mdiColor.fromQColor(cfg.getMDIBackgroundColor());
m_mdiColor->setColor(mdiColor);
m_backgroundimage->setText(cfg.getMDIBackgroundImage());
m_chkCanvasMessages->setChecked(cfg.showCanvasMessages());
m_chkCompressKra->setChecked(cfg.compressKra());
......@@ -146,7 +148,9 @@ void GeneralTab::setDefault()
m_cmbMDIType->setCurrentIndex((int)QMdiArea::TabbedView);
m_chkRubberBand->setChecked(cfg.useOpenGL(true));
m_favoritePresetsSpinBox->setValue(cfg.favoritePresets(true));
m_mdiColor->setColor(cfg.getMDIBackgroundColor(true));
KoColor mdiColor;
mdiColor.fromQColor(cfg.getMDIBackgroundColor(true));
m_mdiColor->setColor(mdiColor);
m_backgroundimage->setText(cfg.getMDIBackgroundImage(true));
m_chkCanvasMessages->setChecked(cfg.showCanvasMessages(true));
m_chkCompressKra->setChecked(cfg.compressKra(true));
......@@ -340,10 +344,6 @@ ColorSettingsTab::ColorSettingsTab(QWidget *parent, const char *name)
KisImageConfig cfgImage;
KisProofingConfiguration *proofingConfig = cfgImage.defaultProofingconfiguration();
m_gamutWarning = new KoColorPopupAction(this);
m_gamutWarning->setToolTip(i18n("Set default color used for out of Gamut Warning"));
m_gamutWarning->setCurrentColor(proofingConfig->warningColor);
m_page->gamutAlarm->setDefaultAction(m_gamutWarning);
m_page->sldAdaptationState->setMaximum(20);
m_page->sldAdaptationState->setMinimum(0);
m_page->sldAdaptationState->setValue((int)proofingConfig->adaptationState*20);
......@@ -451,7 +451,7 @@ void ColorSettingsTab::setDefault()
m_page->ckbProofBlackPoint->setChecked(proofingConfig->conversionFlags.testFlag(KoColorConversionTransformation::BlackpointCompensation));
m_page->sldAdaptationState->setValue(0);
m_gamutWarning->setCurrentColor(proofingConfig->warningColor);
m_page->gamutAlarm->setColor(proofingConfig->warningColor);
m_page->chkBlackpoint->setChecked(cfg.useBlackPointCompensation(true));
m_page->chkAllowLCMSOptimization->setChecked(cfg.allowLCMSOptimization(true));
......@@ -701,16 +701,23 @@ DisplaySettingsTab::DisplaySettingsTab(QWidget *parent, const char *name)
KoColor c;
c.fromQColor(cfg.selectionOverlayMaskColor());
m_selectionOverlayColorAction = new KoColorPopupAction(this);
m_selectionOverlayColorAction->setCurrentColor(c);
m_selectionOverlayColorAction->setToolTip(i18n("Change the background color of the image"));
btnSelectionOverlayColor->setDefaultAction(m_selectionOverlayColorAction);
c.setOpacity(1.0);
btnSelectionOverlayColor->setColor(c);
sldSelectionOverlayOpacity->setRange(0.0, 1.0, 2);
sldSelectionOverlayOpacity->setSingleStep(0.05);
sldSelectionOverlayOpacity->setValue(cfg.selectionOverlayMaskColor().alphaF());
intCheckSize->setValue(cfg.checkSize());
chkMoving->setChecked(cfg.scrollCheckers());
colorChecks1->setColor(cfg.checkersColor1());
colorChecks2->setColor(cfg.checkersColor2());
canvasBorder->setColor(cfg.canvasBorderColor());
KoColor ck1;
ck1.fromQColor(cfg.checkersColor1());
colorChecks1->setColor(ck1);
KoColor ck2;
ck2.fromQColor(cfg.checkersColor2());
colorChecks2->setColor(ck2);
KoColor cb;
cb.fromQColor(cfg.canvasBorderColor());
canvasBorder->setColor(cb);
hideScrollbars->setChecked(cfg.hideScrollbars());
chkCurveAntialiasing->setChecked(cfg.antialiasCurves());
chkSelectionOutlineAntialiasing->setChecked(cfg.antialiasSelectionOutline());
......@@ -743,9 +750,15 @@ void DisplaySettingsTab::setDefault()
chkMoving->setChecked(cfg.scrollCheckers(true));
intCheckSize->setValue(cfg.checkSize(true));
colorChecks1->setColor(cfg.checkersColor1(true));
colorChecks2->setColor(cfg.checkersColor2(true));
canvasBorder->setColor(cfg.canvasBorderColor(true));
KoColor ck1;
ck1.fromQColor(cfg.checkersColor1(true));
colorChecks1->setColor(ck1);
KoColor ck2;
ck2.fromQColor(cfg.checkersColor2(true));
colorChecks2->setColor(ck2);
KoColor cvb;
cvb.fromQColor(cfg.canvasBorderColor(true));
canvasBorder->setColor(cvb);
hideScrollbars->setChecked(cfg.hideScrollbars(true));
chkCurveAntialiasing->setChecked(cfg.antialiasCurves(true));
chkSelectionOutlineAntialiasing->setChecked(cfg.antialiasSelectionOutline(true));
......@@ -951,7 +964,7 @@ bool KisDlgPreferences::editPreferences()
cfg.setShowOutlineWhilePainting(dialog->m_general->showOutlineWhilePainting());
cfg.setHideSplashScreen(dialog->m_general->hideSplashScreen());
cfg.writeEntry<int>("mdi_viewmode", dialog->m_general->mdiMode());
cfg.setMDIBackgroundColor(dialog->m_general->m_mdiColor->color());
cfg.setMDIBackgroundColor(dialog->m_general->m_mdiColor->color().toQColor());
cfg.setMDIBackgroundImage(dialog->m_general->m_backgroundimage->text());
cfg.setAutoSaveInterval(dialog->m_general->autoSaveInterval());
cfg.setBackupFile(dialog->m_general->m_backupFileCheckBox->isChecked());
......@@ -991,7 +1004,7 @@ bool KisDlgPreferences::editPreferences()
cfg.setWorkingColorSpace(dialog->m_colorSettings->m_page->cmbWorkingColorSpace->currentItem().id());
KisImageConfig cfgImage;
cfgImage.setDefaultProofingConfig(dialog->m_colorSettings->m_page->proofingSpaceSelector->currentColorSpace(), dialog->m_colorSettings->m_page->cmbProofingIntent->currentIndex(), dialog->m_colorSettings->m_page->ckbProofBlackPoint->isChecked(), dialog->m_colorSettings->m_gamutWarning->currentKoColor(), (double)dialog->m_colorSettings->m_page->sldAdaptationState->value()/20);
cfgImage.setDefaultProofingConfig(dialog->m_colorSettings->m_page->proofingSpaceSelector->currentColorSpace(), dialog->m_colorSettings->m_page->cmbProofingIntent->currentIndex(), dialog->m_colorSettings->m_page->ckbProofBlackPoint->isChecked(), dialog->m_colorSettings->m_page->gamutAlarm->color(), (double)dialog->m_colorSettings->m_page->sldAdaptationState->value()/20);
cfg.setUseBlackPointCompensation(dialog->m_colorSettings->m_page->chkBlackpoint->isChecked());
cfg.setAllowLCMSOptimization(dialog->m_colorSettings->m_page->chkAllowLCMSOptimization->isChecked());
cfg.setPasteBehaviour(dialog->m_colorSettings->m_pasteBehaviourGroup.checkedId());
......@@ -1011,11 +1024,13 @@ bool KisDlgPreferences::editPreferences()
cfg.setCheckSize(dialog->m_displaySettings->intCheckSize->value());
cfg.setScrollingCheckers(dialog->m_displaySettings->chkMoving->isChecked());
cfg.setCheckersColor1(dialog->m_displaySettings->colorChecks1->color());
cfg.setCheckersColor2(dialog->m_displaySettings->colorChecks2->color());
cfg.setCanvasBorderColor(dialog->m_displaySettings->canvasBorder->color());
cfg.setCheckersColor1(dialog->m_displaySettings->colorChecks1->color().toQColor());
cfg.setCheckersColor2(dialog->m_displaySettings->colorChecks2->color().toQColor());
cfg.setCanvasBorderColor(dialog->m_displaySettings->canvasBorder->color().toQColor());
cfg.setHideScrollbars(dialog->m_displaySettings->hideScrollbars->isChecked());
cfg.setSelectionOverlayMaskColor(dialog->m_displaySettings->m_selectionOverlayColorAction->currentKoColor().toQColor());
KoColor c = dialog->m_displaySettings->btnSelectionOverlayColor->color();
c.setOpacity(dialog->m_displaySettings->sldSelectionOverlayOpacity->value());
cfg.setSelectionOverlayMaskColor(c.toQColor());
cfg.setAntialiasCurves(dialog->m_displaySettings->chkCurveAntialiasing->isChecked());
cfg.setAntialiasSelectionOutline(dialog->m_displaySettings->chkSelectionOutlineAntialiasing->isChecked());
cfg.setShowSingleChannelAsColor(dialog->m_displaySettings->chkChannelsAsColor->isChecked());
......
......@@ -28,6 +28,7 @@
#include "KoColorPopupAction.h"
#include "kis_global.h"
#include "widgets/squeezedcombobox.h"
#include "ui_wdggeneralsettings.h"
#include "ui_wdgdisplaysettings.h"
......
......@@ -104,7 +104,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="KColorButton" name="leftColorButton">
<widget class="KisColorButton" name="leftColorButton">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
......@@ -185,7 +185,7 @@
</widget>
</item>
<item row="2" column="1">
<widget class="KColorButton" name="rightColorButton">
<widget class="KisColorButton" name="rightColorButton">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
......@@ -374,10 +374,9 @@
<header>kis_int_parse_spin_box.h</header>
</customwidget>
<customwidget>
<class>KColorButton</class>
<class>KisColorButton</class>
<extends>QPushButton</extends>
<header>kcolorbutton.h</header>
<container>1</container>
<header>kis_color_button.h</header>
</customwidget>
<customwidget>
<class>KisGradientSliderWidget</class>
......
......@@ -189,13 +189,6 @@
<string>Soft Proof Options</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="5" column="1">
<widget class="QToolButton" name="gamutAlarm">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lblProofingIntent">
<property name="text">
......@@ -264,6 +257,13 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="KisColorButton" name="gamutAlarm">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......@@ -362,6 +362,11 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KisColorButton</class>
<extends>QPushButton</extends>
<header>kis_color_button.h</header>
</customwidget>
<customwidget>
<class>KisColorSpaceSelector</class>
<extends>QWidget</extends>
......@@ -378,11 +383,6 @@
<extends>QComboBox</extends>
<header>widgets/kis_cmb_idlist.h</header>
</customwidget>
<customwidget>
<class>SqueezedComboBox</class>
<extends>QComboBox</extends>
<header>widgets/squeezedcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
......
......@@ -116,10 +116,10 @@
</widget>
</item>
<item row="0" column="4">
<widget class="KColorButton" name="colorChecks1"/>
<widget class="KisColorButton" name="colorChecks1"/>
</item>
<item row="0" column="5">
<widget class="KColorButton" name="colorChecks2"/>
<widget class="KisColorButton" name="colorChecks2"/>
</item>
<item row="0" column="6">
<spacer name="horizontalSpacer">
......@@ -276,7 +276,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="KColorButton" name="canvasBorder"/>
<widget class="KisColorButton" name="canvasBorder"/>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_4">
......@@ -318,24 +318,21 @@
</widget>
</item>
<item>
<widget class="QToolButton" name="btnSelectionOverlayColor">
<widget class="KisColorButton" name="btnSelectionOverlayColor">
<property name="text">
<string>...</string>
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>358</width>
<height>20</height>
</size>
<widget class="KisDoubleSliderSpinBox" name="sldSelectionOverlayOpacity" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</spacer>
</widget>
</item>
</layout>
</widget>
......@@ -349,9 +346,14 @@
<header>kis_int_parse_spin_box.h</header>
</customwidget>
<customwidget>
<class>KColorButton</class>
<class>KisColorButton</class>
<extends>QPushButton</extends>
<header>kcolorbutton.h</header>
<header>kis_color_button.h</header>
</customwidget>
<customwidget>
<class>KisDoubleSliderSpinBox</class>
<extends>QWidget</extends>
<header>kis_slider_spin_box.h</header>
<container>1</container>
</customwidget>
</customwidgets>
......
......@@ -29,7 +29,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>3</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
......@@ -248,7 +248,7 @@
</layout>
</item>
<item row="2" column="1">
<widget class="KColorButton" name="m_mdiColor">
<widget class="KisColorButton" name="m_mdiColor">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -704,10 +704,9 @@
<header>kis_int_parse_spin_box.h</header>
</customwidget>
<customwidget>
<class>KColorButton</class>
<class>KisColorButton</class>
<extends>QPushButton</extends>
<header>kcolorbutton.h</header>
<container>1</container>
<header>kis_color_button.h</header>
</customwidget>
</customwidgets>
<resources/>
......
......@@ -507,7 +507,7 @@
</layout>
</item>
<item row="2" column="2">
<widget class="KColorButton" name="cmbColor">
<widget class="KisColorButton" name="cmbColor">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -645,21 +645,14 @@
</widget>
<customwidgets>
<customwidget>
<class>KisColorSpaceSelector</class>
<extends>QWidget</extends>
<header>widgets/kis_color_space_selector.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KisDoubleParseSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>kis_double_parse_spin_box.h</header>
<class>KisIntParseSpinBox</class>
<extends>QSpinBox</extends>
<header>kis_int_parse_spin_box.h</header>
</customwidget>
<customwidget>
<class>KColorButton</class>
<class>KisColorButton</class>
<extends>QPushButton</extends>
<header>kcolorbutton.h</header>
<container>1</container>
<header>kis_color_button.h</header>
</customwidget>
<customwidget>
<class>KisDoubleSliderSpinBox</class>
......@@ -668,9 +661,15 @@
<container>1</container>
</customwidget>
<customwidget>
<class>KisIntParseSpinBox</class>
<extends>QSpinBox</extends>
<header>kis_int_parse_spin_box.h</header>
<class>KisColorSpaceSelector</class>
<extends>QWidget</extends>
<header>widgets/kis_color_space_selector.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KisDoubleParseSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>kis_double_parse_spin_box.h</header>
</customwidget>
</customwidgets>
<tabstops>
......
......@@ -50,8 +50,8 @@ KisAutogradient::KisAutogradient(KoSegmentGradient* gradient, QWidget *parent, c
connect(gradientSlider, SIGNAL(sigChangedSegment(KoGradientSegment*)), SLOT(slotChangedSegment(KoGradientSegment*)));
connect(comboBoxColorInterpolationType, SIGNAL(activated(int)), SLOT(slotChangedColorInterpolation(int)));
connect(comboBoxInterpolationType, SIGNAL(activated(int)), SLOT(slotChangedInterpolation(int)));
connect(leftColorButton, SIGNAL(changed(const QColor&)), SLOT(slotChangedLeftColor(const QColor&)));
connect(rightColorButton, SIGNAL(changed(const QColor&)), SLOT(slotChangedRightColor(const QColor&)));
connect(leftColorButton, SIGNAL(changed(const KoColor&)), SLOT(slotChangedLeftColor(const KoColor&)));
connect(rightColorButton, SIGNAL(changed(const KoColor&)), SLOT(slotChangedRightColor(const KoColor&)));
connect(intNumInputLeftOpacity, SIGNAL(valueChanged(int)), SLOT(slotChangedLeftOpacity(int)));
connect(intNumInputRightOpacity, SIGNAL(valueChanged(int)), SLOT(slotChangedRightOpacity(int)));
......@@ -65,22 +65,17 @@ void KisAutogradient::activate()
void KisAutogradient::slotSelectedSegment(KoGradientSegment* segment)
{
QColor startColor;
QColor endColor;
segment->startColor().toQColor(&startColor);
segment->endColor().toQColor(&endColor);
leftColorButton->setColor(startColor);
rightColorButton->setColor(endColor);
leftColorButton->setColor(segment->startColor());
rightColorButton->setColor(segment->endColor());
comboBoxColorInterpolationType->setCurrentIndex(segment->colorInterpolation());
comboBoxInterpolationType->setCurrentIndex(segment->interpolation());
int leftOpacity = (startColor.alpha() * 100) / OPACITY_OPAQUE_U8;
int leftOpacity = segment->startColor().opacityF();
intNumInputLeftOpacity->setValue(leftOpacity);
intNumInputLeftOpacity->setSuffix(i18n(" %"));
int rightOpacity = (endColor.alpha() * 100) / OPACITY_OPAQUE_U8;
int rightOpacity = segment->endColor().opacityF();
intNumInputRightOpacity->setValue(rightOpacity);
intNumInputRightOpacity->setSuffix(i18n(" %"));
......@@ -112,7 +107,7 @@ void KisAutogradient::slotChangedColorInterpolation(int type)
paramChanged();
}
void KisAutogradient::slotChangedLeftColor(const QColor& color)
void KisAutogradient::slotChangedLeftColor(const KoColor& color)
{
KoGradientSegment* segment = gradientSlider->selectedSegment();
if (segment) {
......@@ -125,11 +120,10 @@ void KisAutogradient::slotChangedLeftColor(const QColor& color)
paramChanged();
}
void KisAutogradient::slotChangedRightColor(const QColor& color)
void KisAutogradient::slotChangedRightColor(const KoColor& color)
{
KoGradientSegment* segment = gradientSlider->selectedSegment();
if (segment) {
QColor unused;
KoColor c(color, segment->endColor().colorSpace());
c.setOpacity(segment->endColor().opacityU8());
segment->setEndColor(c);
......@@ -143,7 +137,7 @@ void KisAutogradient::slotChangedLeftOpacity(int value)
{
KoGradientSegment* segment = gradientSlider->selectedSegment();
if (segment) {
KoColor c(segment->startColor().toQColor(), segment->startColor().colorSpace());
KoColor c(segment->startColor(), segment->startColor().colorSpace());
c.setOpacity(qreal(value) / qreal(100.0));
segment->setStartColor(c);
}
......@@ -156,7 +150,7 @@ void KisAutogradient::slotChangedRightOpacity(int value)
{
KoGradientSegment* segment = gradientSlider->selectedSegment();
if (segment) {
KoColor c(segment->endColor().toQColor(), segment->endColor().colorSpace());
KoColor c(segment->endColor(), segment->endColor().colorSpace());
c.setOpacity(quint8((value *OPACITY_OPAQUE_U8) / 100));
segment->setEndColor(c);
}
......
......@@ -39,8 +39,8 @@ private Q_SLOTS:
void slotChangedSegment(KoGradientSegment* segment);
void slotChangedInterpolation(int type);
void slotChangedColorInterpolation(int type);
void slotChangedLeftColor(const QColor& color);
void slotChangedRightColor(const QColor& color);
void slotChangedLeftColor(const KoColor& color);
void slotChangedRightColor(const KoColor& color);
void slotChangedLeftOpacity(int value);
void slotChangedRightOpacity(int value);
void slotChangedName();
......
......@@ -129,7 +129,9 @@ KisCustomImageWidget::KisCustomImageWidget(QWidget* parent, qint32 defWidth, qin
KisConfig cfg;
intNumLayers->setValue(cfg.numDefaultLayers());
cmbColor->setColor(cfg.defaultBackgroundColor());
KoColor bcol(KoColorSpaceRegistry::instance()->rgb8());
bcol.fromQColor(cfg.defaultBackgroundColor());
cmbColor->setColor(bcol);
setBackgroundOpacity(cfg.defaultBackgroundOpacity());
KisConfig::BackgroundStyle bgStyle = cfg.defaultBackgroundStyle();
......@@ -277,7 +279,7 @@ KisDocument* KisCustomImageWidget::createNewImage()
width = static_cast<qint32>(0.5 + KoUnit::ptToUnit(m_width, KoUnit(KoUnit::Pixel, resolution)));
height = static_cast<qint32>(0.5 + KoUnit::ptToUnit(m_height, KoUnit(KoUnit::Pixel, resolution)));
QColor qc = cmbColor->color();
QColor qc = cmbColor->color().toQColor();
qc.setAlpha(backgroundOpacity());
KoColor bgColor(qc, cs);
......@@ -288,7 +290,7 @@ KisDocument* KisCustomImageWidget::createNewImage()
KisConfig cfg;
cfg.setNumDefaultLayers(intNumLayers->value());
cfg.setDefaultBackgroundOpacity(backgroundOpacity());
cfg.setDefaultBackgroundColor(cmbColor->color());
cfg.setDefaultBackgroundColor(cmbColor->color().toQColor());
cfg.setDefaultBackgroundStyle(backgroundAsLayer ? KisConfig::LAYER : KisConfig::PROJECTION);
return doc;
......
......@@ -33,6 +33,7 @@
#include <kis_selection.h>
#include <kis_paint_device.h>
#include <kis_processing_information.h>
#include <KoColorSpaceRegistry.h>
#include "ui_wdgcolortoalphabase.h"
......@@ -48,11 +49,12 @@ KisWdgColorToAlpha::KisWdgColorToAlpha(QWidget * parent)
m_widget->intThreshold->setRange(1, 255, 0);
connect(m_widget->colorSelector, SIGNAL(colorChanged(const QColor&)), SLOT(slotColorSelectorChanged(const QColor&)));
connect(m_widget->colorSelector, SIGNAL(sigNewColor(KoColor)), SLOT(slotColorSelectorChanged(const KoColor&)));
connect(m_widget->intThreshold, SIGNAL(valueChanged(qreal)), SIGNAL(sigConfigurationItemChanged()));
connect(m_widget->btnCustomColor, SIGNAL(changed(const QColor&)), SLOT(slotCustomColorSelected(const QColor&)));
connect(m_widget->btnCustomColor, SIGNAL(changed(const KoColor)), SLOT(slotCustomColorSelected(const KoColor&)));
m_widget->btnCustomColor->setColor(Qt::white);
KoColor c(Qt::white, KoColorSpaceRegistry::instance()->rgb8());
m_widget->btnCustomColor->setColor(c);
}
KisWdgColorToAlpha::~KisWdgColorToAlpha()
......@@ -67,17 +69,17 @@ void KisWdgColorToAlpha::setView(KisViewManager *view)
void KisWdgColorToAlpha::slotFgColorChanged(const KoColor &color)
{
m_widget->btnCustomColor->setColor(color.toQColor());
m_widget->btnCustomColor->setColor(color);
}
void KisWdgColorToAlpha::slotColorSelectorChanged(const QColor &color)
void KisWdgColorToAlpha::slotColorSelectorChanged(const KoColor &color)
{
m_widget->btnCustomColor->setColor(color);
}
void KisWdgColorToAlpha::slotCustomColorSelected(const QColor &color)
void KisWdgColorToAlpha::slotCustomColorSelected(const KoColor &color)
{
m_widget->colorSelector->setQColor(color);
m_widget->colorSelector->slotSetColor(color);
emit sigConfigurationItemChanged();
}
......@@ -85,7 +87,13 @@ void KisWdgColorToAlpha::setConfiguration(const KisPropertiesConfiguration* conf
{
QVariant value;
if (config->getProperty("targetcolor", value)) {
m_widget->colorSelector->setQColor(value.value<QColor>());
KoColor c;
if (value.value<QColor>().isValid()) {
c.fromQColor(value.value<QColor>());
} else {
c = value.value<KoColor>();
}
m_widget->colorSelector->slotSetColor(c);
}
if (config->getProperty("threshold", value)) {
m_widget->intThreshold->setValue(value.toInt());
......@@ -95,7 +103,7 @@ void KisWdgColorToAlpha::setConfiguration(const KisPropertiesConfiguration* conf
KisPropertiesConfiguration* KisWdgColorToAlpha::configuration() const
{
KisFilterConfiguration* config = new KisFilterConfiguration("colortoalpha", 1);
config->setProperty("targetcolor", widget()->colorSelector->color());
config->setProperty("targetcolor", widget()->colorSelector->getCurrentColor().toQColor());
config->setProperty("threshold", widget()->intThreshold->value());
return config;
}
......
......@@ -49,8 +49,8 @@ protected:
private Q_SLOTS:
void slotFgColorChanged(const KoColor &color);
void slotColorSelectorChanged(const QColor &color);
void slotCustomColorSelected(const QColor &color);
void slotColorSelectorChanged(const KoColor &color);
void slotCustomColorSelected(const KoColor &color);
private:
Ui_WdgColorToAlphaBase* m_widget;
......
......@@ -63,7 +63,7 @@
</layout>
</item>
<item>
<widget class="KoTriangleColorSelector" name="colorSelector">
<widget class="KisVisualColorSelector" name="colorSelector" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
......@@ -139,7 +139,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="KisDoubleSliderSpinBox" name="intThreshold">
<widget class="KisDoubleSliderSpinBox" name="intThreshold" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
......@@ -162,7 +162,7 @@
</widget>
</item>
<item row="0" column="1">
<widget class="KColorButton" name="btnCustomColor">
<widget class="KisColorButton" name="btnCustomColor">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
......@@ -192,16 +192,15 @@
</widget>
<customwidgets>
<customwidget>
<class>KColorButton</class>
<extends>QPushButton</extends>
<header>kcolorbutton.h</header>
<class>KisVisualColorSelector</class>
<extends>QWidget</extends>
<header>kis_visual_color_selector.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KoTriangleColorSelector</class>
<extends>QWidget</extends>
<header>KoTriangleColorSelector.h</header>
<container>1</container>
<class>KisColorButton</class>
<extends>QPushButton</extends>
<header>kis_color_button.h</header>
</customwidget>
<customwidget>
<class>KisDoubleSliderSpinBox</class>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment