diff --git a/plugins/generators/screentone/kis_wdg_screentone.cpp b/plugins/generators/screentone/kis_wdg_screentone.cpp index 76b5cba6c2..3a5e87f6c7 100644 --- a/plugins/generators/screentone/kis_wdg_screentone.cpp +++ b/plugins/generators/screentone/kis_wdg_screentone.cpp @@ -1,261 +1,256 @@ /* * KDE. Krita Project. * * Copyright (c) 2020 Deif Lou * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "kis_wdg_screentone.h" #include "screentonefunctions.h" #include "screentoneconfigdefaults.h" #include #include #include -#include "ui_wdgscreentoneoptions.h" - KisWdgScreentone::KisWdgScreentone(QWidget* parent, const KoColorSpace *cs) : KisConfigWidget(parent) - , m_widget(new Ui_WdgScreentoneOptions()) , m_colorSpace(cs) { - m_widget->setupUi(this); + m_widget.setupUi(this); setupPatternComboBox(); setupShapeComboBox(); setupInterpolationComboBox(); - m_widget->sliderForegroundOpacity->setRange(0, 100); - m_widget->sliderForegroundOpacity->setPrefix(i18n("Opacity: ")); - m_widget->sliderForegroundOpacity->setSuffix(i18n("%")); - m_widget->sliderBackgroundOpacity->setRange(0, 100); - m_widget->sliderBackgroundOpacity->setPrefix(i18n("Opacity: ")); - m_widget->sliderBackgroundOpacity->setSuffix(i18n("%")); - m_widget->sliderBrightness->setRange(0.0, 100.0, 2); - m_widget->sliderBrightness->setSingleStep(1.0); - m_widget->sliderBrightness->setSuffix(i18n("%")); - m_widget->sliderContrast->setRange(0.0, 100.0, 2); - m_widget->sliderContrast->setSingleStep(1.0); - m_widget->sliderContrast->setSuffix(i18n("%")); + m_widget.sliderForegroundOpacity->setRange(0, 100); + m_widget.sliderForegroundOpacity->setPrefix(i18n("Opacity: ")); + m_widget.sliderForegroundOpacity->setSuffix(i18n("%")); + m_widget.sliderBackgroundOpacity->setRange(0, 100); + m_widget.sliderBackgroundOpacity->setPrefix(i18n("Opacity: ")); + m_widget.sliderBackgroundOpacity->setSuffix(i18n("%")); + m_widget.sliderBrightness->setRange(0.0, 100.0, 2); + m_widget.sliderBrightness->setSingleStep(1.0); + m_widget.sliderBrightness->setSuffix(i18n("%")); + m_widget.sliderContrast->setRange(0.0, 100.0, 2); + m_widget.sliderContrast->setSingleStep(1.0); + m_widget.sliderContrast->setSuffix(i18n("%")); - m_widget->sliderPositionX->setRange(-1000-0, 1000.0, 2); - m_widget->sliderPositionX->setPrefix(i18n("X: ")); - m_widget->sliderPositionX->setSuffix(i18n(" px")); - m_widget->sliderPositionX->setSingleStep(1.0); - m_widget->sliderPositionY->setRange(-1000.0, 1000.0, 2); - m_widget->sliderPositionY->setPrefix(i18n("Y: ")); - m_widget->sliderPositionY->setSuffix(i18n(" px")); - m_widget->sliderPositionY->setSingleStep(1.0); - m_widget->sliderSizeX->setRange(1.0, 1000.0, 2); - m_widget->sliderSizeX->setPrefix(i18n("X: ")); - m_widget->sliderSizeX->setSuffix(i18n(" px")); - m_widget->sliderSizeX->setSingleStep(1.0); - m_widget->sliderSizeX->setExponentRatio(4.32); - m_widget->sliderSizeY->setRange(1.0, 1000.0, 2); - m_widget->sliderSizeY->setPrefix(i18n("Y: ")); - m_widget->sliderSizeY->setSuffix(i18n(" px")); - m_widget->sliderSizeY->setSingleStep(1.0); - m_widget->sliderSizeY->setExponentRatio(4.32); - m_widget->sliderShearX->setRange(-10.0, 10.0, 2); - m_widget->sliderShearX->setPrefix(i18n("X: ")); - m_widget->sliderShearX->setSingleStep(0.1); - m_widget->sliderShearY->setRange(-10.0, 10.0, 2); - m_widget->sliderShearY->setPrefix(i18n("Y: ")); - m_widget->sliderShearY->setSingleStep(0.1); - m_widget->sliderRotation->setRange(0.0, 360.0, 2); - m_widget->sliderRotation->setSuffix(i18n("˚")); - m_widget->sliderRotation->setSingleStep(1.0); + m_widget.sliderPositionX->setRange(-1000-0, 1000.0, 2); + m_widget.sliderPositionX->setPrefix(i18n("X: ")); + m_widget.sliderPositionX->setSuffix(i18n(" px")); + m_widget.sliderPositionX->setSingleStep(1.0); + m_widget.sliderPositionY->setRange(-1000.0, 1000.0, 2); + m_widget.sliderPositionY->setPrefix(i18n("Y: ")); + m_widget.sliderPositionY->setSuffix(i18n(" px")); + m_widget.sliderPositionY->setSingleStep(1.0); + m_widget.sliderSizeX->setRange(1.0, 1000.0, 2); + m_widget.sliderSizeX->setPrefix(i18n("X: ")); + m_widget.sliderSizeX->setSuffix(i18n(" px")); + m_widget.sliderSizeX->setSingleStep(1.0); + m_widget.sliderSizeX->setExponentRatio(4.32); + m_widget.sliderSizeY->setRange(1.0, 1000.0, 2); + m_widget.sliderSizeY->setPrefix(i18n("Y: ")); + m_widget.sliderSizeY->setSuffix(i18n(" px")); + m_widget.sliderSizeY->setSingleStep(1.0); + m_widget.sliderSizeY->setExponentRatio(4.32); + m_widget.sliderShearX->setRange(-10.0, 10.0, 2); + m_widget.sliderShearX->setPrefix(i18n("X: ")); + m_widget.sliderShearX->setSingleStep(0.1); + m_widget.sliderShearY->setRange(-10.0, 10.0, 2); + m_widget.sliderShearY->setPrefix(i18n("Y: ")); + m_widget.sliderShearY->setSingleStep(0.1); + m_widget.sliderRotation->setRange(0.0, 360.0, 2); + m_widget.sliderRotation->setSuffix(i18n("˚")); + m_widget.sliderRotation->setSingleStep(1.0); - connect(m_widget->comboBoxPattern, SIGNAL(currentIndexChanged(int)), this, SLOT(slot_comboBoxPattern_currentIndexChanged(int))); - connect(m_widget->comboBoxShape, SIGNAL(currentIndexChanged(int)), this, SLOT(slot_comboBoxShape_currentIndexChanged(int))); - connect(m_widget->comboBoxInterpolation, SIGNAL(currentIndexChanged(int)), this, SIGNAL(sigConfigurationUpdated())); - connect(m_widget->buttonForegroundColor, SIGNAL(changed(const KoColor&)), this, SIGNAL(sigConfigurationUpdated())); - connect(m_widget->sliderForegroundOpacity, SIGNAL(valueChanged(int)), this, SIGNAL(sigConfigurationUpdated())); - connect(m_widget->buttonBackgroundColor, SIGNAL(changed(const KoColor&)), this, SIGNAL(sigConfigurationUpdated())); - connect(m_widget->sliderBackgroundOpacity, SIGNAL(valueChanged(int)), this, SIGNAL(sigConfigurationUpdated())); - connect(m_widget->checkBoxInvert, SIGNAL(toggled(bool)), this, SIGNAL(sigConfigurationUpdated())); - connect(m_widget->sliderBrightness, SIGNAL(valueChanged(qreal)), this, SIGNAL(sigConfigurationUpdated())); - connect(m_widget->sliderContrast, SIGNAL(valueChanged(qreal)), this, SIGNAL(sigConfigurationUpdated())); - connect(m_widget->sliderPositionX, SIGNAL(valueChanged(qreal)), this, SIGNAL(sigConfigurationUpdated())); - connect(m_widget->sliderPositionY, SIGNAL(valueChanged(qreal)), this, SIGNAL(sigConfigurationUpdated())); - connect(m_widget->sliderSizeX, SIGNAL(valueChanged(qreal)), this, SLOT(slot_sliderSizeX_valueChanged(qreal))); - connect(m_widget->sliderSizeY, SIGNAL(valueChanged(qreal)), this, SLOT(slot_sliderSizeY_valueChanged(qreal))); - connect(m_widget->buttonKeepSizeSquare, SIGNAL(keepAspectRatioChanged(bool)), this, SLOT(slot_buttonKeepSizeSquare_keepAspectRatioChanged(bool))); - connect(m_widget->sliderShearX, SIGNAL(valueChanged(qreal)), this, SIGNAL(sigConfigurationUpdated())); - connect(m_widget->sliderShearY, SIGNAL(valueChanged(qreal)), this, SIGNAL(sigConfigurationUpdated())); - connect(m_widget->sliderRotation, SIGNAL(valueChanged(qreal)), this, SIGNAL(sigConfigurationUpdated())); + connect(m_widget.comboBoxPattern, SIGNAL(currentIndexChanged(int)), this, SLOT(slot_comboBoxPattern_currentIndexChanged(int))); + connect(m_widget.comboBoxShape, SIGNAL(currentIndexChanged(int)), this, SLOT(slot_comboBoxShape_currentIndexChanged(int))); + connect(m_widget.comboBoxInterpolation, SIGNAL(currentIndexChanged(int)), this, SIGNAL(sigConfigurationUpdated())); + connect(m_widget.buttonForegroundColor, SIGNAL(changed(const KoColor&)), this, SIGNAL(sigConfigurationUpdated())); + connect(m_widget.sliderForegroundOpacity, SIGNAL(valueChanged(int)), this, SIGNAL(sigConfigurationUpdated())); + connect(m_widget.buttonBackgroundColor, SIGNAL(changed(const KoColor&)), this, SIGNAL(sigConfigurationUpdated())); + connect(m_widget.sliderBackgroundOpacity, SIGNAL(valueChanged(int)), this, SIGNAL(sigConfigurationUpdated())); + connect(m_widget.checkBoxInvert, SIGNAL(toggled(bool)), this, SIGNAL(sigConfigurationUpdated())); + connect(m_widget.sliderBrightness, SIGNAL(valueChanged(qreal)), this, SIGNAL(sigConfigurationUpdated())); + connect(m_widget.sliderContrast, SIGNAL(valueChanged(qreal)), this, SIGNAL(sigConfigurationUpdated())); + connect(m_widget.sliderPositionX, SIGNAL(valueChanged(qreal)), this, SIGNAL(sigConfigurationUpdated())); + connect(m_widget.sliderPositionY, SIGNAL(valueChanged(qreal)), this, SIGNAL(sigConfigurationUpdated())); + connect(m_widget.sliderSizeX, SIGNAL(valueChanged(qreal)), this, SLOT(slot_sliderSizeX_valueChanged(qreal))); + connect(m_widget.sliderSizeY, SIGNAL(valueChanged(qreal)), this, SLOT(slot_sliderSizeY_valueChanged(qreal))); + connect(m_widget.buttonKeepSizeSquare, SIGNAL(keepAspectRatioChanged(bool)), this, SLOT(slot_buttonKeepSizeSquare_keepAspectRatioChanged(bool))); + connect(m_widget.sliderShearX, SIGNAL(valueChanged(qreal)), this, SIGNAL(sigConfigurationUpdated())); + connect(m_widget.sliderShearY, SIGNAL(valueChanged(qreal)), this, SIGNAL(sigConfigurationUpdated())); + connect(m_widget.sliderRotation, SIGNAL(valueChanged(qreal)), this, SIGNAL(sigConfigurationUpdated())); } KisWdgScreentone::~KisWdgScreentone() -{ - delete m_widget; -} +{} void KisWdgScreentone::setConfiguration(const KisPropertiesConfigurationSP config) { // The double slider spin boxes and the color buttons emit signals // when their value is set via code so we block signals here to // prevent multiple sigConfigurationUpdated being called. // After the widgets are set up, unblock and emit sigConfigurationUpdated // just once blockSignals(true); KoColor c; - m_widget->comboBoxPattern->setCurrentIndex(config->getInt("pattern", ScreentoneConfigDefaults::pattern())); - m_widget->comboBoxShape->setCurrentIndex(config->getInt("shape", ScreentoneConfigDefaults::shape())); - m_widget->comboBoxInterpolation->setCurrentIndex(config->getInt("interpolation", ScreentoneConfigDefaults::interpolation())); + m_widget.comboBoxPattern->setCurrentIndex(config->getInt("pattern", ScreentoneConfigDefaults::pattern())); + m_widget.comboBoxShape->setCurrentIndex(config->getInt("shape", ScreentoneConfigDefaults::shape())); + m_widget.comboBoxInterpolation->setCurrentIndex(config->getInt("interpolation", ScreentoneConfigDefaults::interpolation())); c = config->getColor("foreground_color", ScreentoneConfigDefaults::foregroundColor()); c.convertTo(m_colorSpace); c.setOpacity(1.0); - m_widget->buttonForegroundColor->setColor(c); - m_widget->sliderForegroundOpacity->setValue(config->getInt("foreground_opacity", ScreentoneConfigDefaults::foregroundOpacity())); + m_widget.buttonForegroundColor->setColor(c); + m_widget.sliderForegroundOpacity->setValue(config->getInt("foreground_opacity", ScreentoneConfigDefaults::foregroundOpacity())); c = config->getColor("background_color", ScreentoneConfigDefaults::backgroundColor()); c.convertTo(m_colorSpace); c.setOpacity(1.0); - m_widget->buttonBackgroundColor->setColor(c); - m_widget->sliderBackgroundOpacity->setValue(config->getInt("background_opacity", ScreentoneConfigDefaults::backgroundOpacity())); - m_widget->checkBoxInvert->setChecked(config->getBool("invert", ScreentoneConfigDefaults::invert())); - m_widget->sliderBrightness->setValue(config->getDouble("brightness", ScreentoneConfigDefaults::brightness())); - m_widget->sliderContrast->setValue(config->getDouble("contrast", ScreentoneConfigDefaults::contrast())); - m_widget->sliderPositionX->setValue(config->getDouble("position_x", ScreentoneConfigDefaults::positionX())); - m_widget->sliderPositionY->setValue(config->getDouble("position_y", ScreentoneConfigDefaults::positionY())); - m_widget->buttonKeepSizeSquare->setKeepAspectRatio(config->getBool("keep_size_square", ScreentoneConfigDefaults::keepSizeSquare())); - m_widget->sliderSizeX->setValue(config->getDouble("size_x", ScreentoneConfigDefaults::sizeX())); + m_widget.buttonBackgroundColor->setColor(c); + m_widget.sliderBackgroundOpacity->setValue(config->getInt("background_opacity", ScreentoneConfigDefaults::backgroundOpacity())); + m_widget.checkBoxInvert->setChecked(config->getBool("invert", ScreentoneConfigDefaults::invert())); + m_widget.sliderBrightness->setValue(config->getDouble("brightness", ScreentoneConfigDefaults::brightness())); + m_widget.sliderContrast->setValue(config->getDouble("contrast", ScreentoneConfigDefaults::contrast())); + m_widget.sliderPositionX->setValue(config->getDouble("position_x", ScreentoneConfigDefaults::positionX())); + m_widget.sliderPositionY->setValue(config->getDouble("position_y", ScreentoneConfigDefaults::positionY())); + m_widget.buttonKeepSizeSquare->setKeepAspectRatio(config->getBool("keep_size_square", ScreentoneConfigDefaults::keepSizeSquare())); + m_widget.sliderSizeX->setValue(config->getDouble("size_x", ScreentoneConfigDefaults::sizeX())); // Set the size y slider to the sithe y value only if the size must not be squared - if (m_widget->buttonKeepSizeSquare->keepAspectRatio()) { - m_widget->sliderSizeY->setValue(config->getDouble("size_x", ScreentoneConfigDefaults::sizeX())); + if (m_widget.buttonKeepSizeSquare->keepAspectRatio()) { + m_widget.sliderSizeY->setValue(config->getDouble("size_x", ScreentoneConfigDefaults::sizeX())); } else { - m_widget->sliderSizeY->setValue(config->getDouble("size_y", ScreentoneConfigDefaults::sizeY())); + m_widget.sliderSizeY->setValue(config->getDouble("size_y", ScreentoneConfigDefaults::sizeY())); } - m_widget->sliderShearX->setValue(config->getDouble("shear_x", ScreentoneConfigDefaults::shearX())); - m_widget->sliderShearY->setValue(config->getDouble("shear_y", ScreentoneConfigDefaults::shearY())); - m_widget->sliderRotation->setValue(config->getDouble("rotation", ScreentoneConfigDefaults::rotation())); + m_widget.sliderShearX->setValue(config->getDouble("shear_x", ScreentoneConfigDefaults::shearX())); + m_widget.sliderShearY->setValue(config->getDouble("shear_y", ScreentoneConfigDefaults::shearY())); + m_widget.sliderRotation->setValue(config->getDouble("rotation", ScreentoneConfigDefaults::rotation())); blockSignals(false); emit sigConfigurationUpdated(); } KisPropertiesConfigurationSP KisWdgScreentone::configuration() const { QVariant v; KoColor c; KisFilterConfigurationSP config = new KisFilterConfiguration("screentone", 1, KisGlobalResourcesInterface::instance()); - config->setProperty("pattern", m_widget->comboBoxPattern->currentIndex()); - config->setProperty("shape", m_widget->comboBoxShape->currentIndex()); - config->setProperty("interpolation", m_widget->comboBoxInterpolation->currentIndex()); - c.fromKoColor(m_widget->buttonForegroundColor->color()); + config->setProperty("pattern", m_widget.comboBoxPattern->currentIndex()); + config->setProperty("shape", m_widget.comboBoxShape->currentIndex()); + config->setProperty("interpolation", m_widget.comboBoxInterpolation->currentIndex()); + c.fromKoColor(m_widget.buttonForegroundColor->color()); v.setValue(c); config->setProperty("foreground_color", v); - config->setProperty("foreground_opacity", m_widget->sliderForegroundOpacity->value()); - c.fromKoColor(m_widget->buttonBackgroundColor->color()); + config->setProperty("foreground_opacity", m_widget.sliderForegroundOpacity->value()); + c.fromKoColor(m_widget.buttonBackgroundColor->color()); v.setValue(c); config->setProperty("background_color", v); - config->setProperty("background_opacity", m_widget->sliderBackgroundOpacity->value()); - config->setProperty("invert", m_widget->checkBoxInvert->isChecked()); - config->setProperty("brightness", m_widget->sliderBrightness->value()); - config->setProperty("contrast", m_widget->sliderContrast->value()); - config->setProperty("position_x", m_widget->sliderPositionX->value()); - config->setProperty("position_y", m_widget->sliderPositionY->value()); - config->setProperty("size_x", m_widget->sliderSizeX->value()); - config->setProperty("size_y", m_widget->sliderSizeY->value()); - config->setProperty("keep_size_square", m_widget->buttonKeepSizeSquare->keepAspectRatio()); - config->setProperty("shear_x", m_widget->sliderShearX->value()); - config->setProperty("shear_y", m_widget->sliderShearY->value()); - config->setProperty("rotation", m_widget->sliderRotation->value()); + config->setProperty("background_opacity", m_widget.sliderBackgroundOpacity->value()); + config->setProperty("invert", m_widget.checkBoxInvert->isChecked()); + config->setProperty("brightness", m_widget.sliderBrightness->value()); + config->setProperty("contrast", m_widget.sliderContrast->value()); + config->setProperty("position_x", m_widget.sliderPositionX->value()); + config->setProperty("position_y", m_widget.sliderPositionY->value()); + config->setProperty("size_x", m_widget.sliderSizeX->value()); + config->setProperty("size_y", m_widget.sliderSizeY->value()); + config->setProperty("keep_size_square", m_widget.buttonKeepSizeSquare->keepAspectRatio()); + config->setProperty("shear_x", m_widget.sliderShearX->value()); + config->setProperty("shear_y", m_widget.sliderShearY->value()); + config->setProperty("rotation", m_widget.sliderRotation->value()); return config; } void KisWdgScreentone::setupPatternComboBox() { - m_widget->comboBoxPattern->clear(); - m_widget->comboBoxPattern->addItems(patternNames()); + m_widget.comboBoxPattern->clear(); + m_widget.comboBoxPattern->addItems(patternNames()); } void KisWdgScreentone::setupShapeComboBox() { - m_widget->comboBoxShape->clear(); - QStringList names = shapeNames(m_widget->comboBoxPattern->currentIndex()); + m_widget.comboBoxShape->clear(); + QStringList names = shapeNames(m_widget.comboBoxPattern->currentIndex()); if (names.isEmpty()) { - m_widget->labelShape->hide(); - m_widget->comboBoxShape->hide(); + m_widget.labelShape->hide(); + m_widget.comboBoxShape->hide(); } else { - m_widget->comboBoxShape->addItems(names); - m_widget->labelShape->show(); - m_widget->comboBoxShape->show(); + m_widget.comboBoxShape->addItems(names); + m_widget.labelShape->show(); + m_widget.comboBoxShape->show(); } } void KisWdgScreentone::setupInterpolationComboBox() { - m_widget->comboBoxInterpolation->clear(); - QStringList names = interpolationNames(m_widget->comboBoxPattern->currentIndex(), - m_widget->comboBoxShape->currentIndex()); + m_widget.comboBoxInterpolation->clear(); + QStringList names = interpolationNames(m_widget.comboBoxPattern->currentIndex(), + m_widget.comboBoxShape->currentIndex()); if (names.isEmpty()) { - m_widget->labelInterpolation->hide(); - m_widget->comboBoxInterpolation->hide(); + m_widget.labelInterpolation->hide(); + m_widget.comboBoxInterpolation->hide(); } else { - m_widget->comboBoxInterpolation->addItems(names); - m_widget->labelInterpolation->show(); - m_widget->comboBoxInterpolation->show(); + m_widget.comboBoxInterpolation->addItems(names); + m_widget.labelInterpolation->show(); + m_widget.comboBoxInterpolation->show(); } } void KisWdgScreentone::slot_comboBoxPattern_currentIndexChanged(int) { - m_widget->comboBoxShape->blockSignals(true); - m_widget->comboBoxInterpolation->blockSignals(true); + m_widget.comboBoxShape->blockSignals(true); + m_widget.comboBoxInterpolation->blockSignals(true); setupShapeComboBox(); setupInterpolationComboBox(); - m_widget->comboBoxShape->blockSignals(false); - m_widget->comboBoxInterpolation->blockSignals(false); + m_widget.comboBoxShape->blockSignals(false); + m_widget.comboBoxInterpolation->blockSignals(false); emit sigConfigurationUpdated(); } void KisWdgScreentone::slot_comboBoxShape_currentIndexChanged(int) { - m_widget->comboBoxInterpolation->blockSignals(true); + m_widget.comboBoxInterpolation->blockSignals(true); setupInterpolationComboBox(); - m_widget->comboBoxInterpolation->blockSignals(false); + m_widget.comboBoxInterpolation->blockSignals(false); emit sigConfigurationUpdated(); } void KisWdgScreentone::slot_sliderSizeX_valueChanged(qreal value) { - if (m_widget->buttonKeepSizeSquare->keepAspectRatio()) { - m_widget->sliderSizeY->blockSignals(true); - m_widget->sliderSizeY->setValue(value); - m_widget->sliderSizeY->blockSignals(false); + if (m_widget.buttonKeepSizeSquare->keepAspectRatio()) { + m_widget.sliderSizeY->blockSignals(true); + m_widget.sliderSizeY->setValue(value); + m_widget.sliderSizeY->blockSignals(false); } emit sigConfigurationUpdated(); } void KisWdgScreentone::slot_sliderSizeY_valueChanged(qreal value) { - if (m_widget->buttonKeepSizeSquare->keepAspectRatio()) { - m_widget->sliderSizeX->blockSignals(true); - m_widget->sliderSizeX->setValue(value); - m_widget->sliderSizeX->blockSignals(false); + if (m_widget.buttonKeepSizeSquare->keepAspectRatio()) { + m_widget.sliderSizeX->blockSignals(true); + m_widget.sliderSizeX->setValue(value); + m_widget.sliderSizeX->blockSignals(false); } emit sigConfigurationUpdated(); } void KisWdgScreentone::slot_buttonKeepSizeSquare_keepAspectRatioChanged(bool keep) { if (keep) { - slot_sliderSizeX_valueChanged(m_widget->sliderSizeX->value()); + slot_sliderSizeX_valueChanged(m_widget.sliderSizeX->value()); } } diff --git a/plugins/generators/screentone/kis_wdg_screentone.h b/plugins/generators/screentone/kis_wdg_screentone.h index 56984ff7c1..1e2109574c 100644 --- a/plugins/generators/screentone/kis_wdg_screentone.h +++ b/plugins/generators/screentone/kis_wdg_screentone.h @@ -1,60 +1,59 @@ /* * KDE. Krita Project. * * Copyright (c) 2020 Deif Lou * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KIS_WDG_SCREENTONE_H #define KIS_WDG_SCREENTONE_H #include #include #include +#include "ui_wdgscreentoneoptions.h" + class Ui_WdgScreentoneOptions; class KisWdgScreentone : public KisConfigWidget { Q_OBJECT public: KisWdgScreentone(QWidget* parent = 0, const KoColorSpace *cs = KoColorSpaceRegistry::instance()->rgb8()); ~KisWdgScreentone() override; public: - inline const Ui_WdgScreentoneOptions* widget() const { - return m_widget; - } void setConfiguration(const KisPropertiesConfigurationSP) override; KisPropertiesConfigurationSP configuration() const override; private: - Ui_WdgScreentoneOptions* m_widget; + Ui_WdgScreentoneOptions m_widget; const KoColorSpace *m_colorSpace; void setupPatternComboBox(); void setupShapeComboBox(); void setupInterpolationComboBox(); private Q_SLOTS: void slot_comboBoxPattern_currentIndexChanged(int); void slot_comboBoxShape_currentIndexChanged(int); void slot_sliderSizeX_valueChanged(qreal value); void slot_sliderSizeY_valueChanged(qreal value); void slot_buttonKeepSizeSquare_keepAspectRatioChanged(bool keep); }; #endif diff --git a/plugins/generators/screentone/wdgscreentoneoptions.ui b/plugins/generators/screentone/wdgscreentoneoptions.ui index b2578218ec..d1b5244e01 100644 --- a/plugins/generators/screentone/wdgscreentoneoptions.ui +++ b/plugins/generators/screentone/wdgscreentoneoptions.ui @@ -1,516 +1,513 @@ WdgScreentoneOptions 0 0 - 459 - 470 + 283 + 295 0 0 0 175 - 8 + 0 0 0 0 0 - - - Screentone Type - - - - 4 - - - 4 - - - 8 - - - 8 - - - 8 - - - 8 - - - - - Pattern: - - - - - - - - 0 - 0 - - - - - - - - Shape: - - - - - - - - 0 - 0 - - - - - - - - Interpolation: - - - - - - - - 0 - 0 - - - - - - - - - - - Postprocessing + + + 0 - - - 4 - - - 4 - - - 8 - - - 8 - - - 8 - - - 8 - - - - - Foreground: - - - - - - - 4 - - - - - - - - - - - - - 0 - 0 - - - - Qt::WheelFocus - - - - - - - - - Background: - - - - - - - 4 - - - - - - - - - - - - - 0 - 0 - - - - Qt::WheelFocus - - - - - - - - - Brightness: - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Qt::WheelFocus - - - - - - - Contrast: - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Qt::WheelFocus - - - - - - - - - - - - - - Invert: - - - - - - - - - - Transformation + + false - - - 4 - - - 4 - - - 8 - - - 8 - - - 8 - - - 8 - - - - - Position: - - - - - - - 4 - - - - - - 0 - 0 - - - - Qt::WheelFocus - - - - - - - - 0 - 0 - - - - Qt::WheelFocus - - - - - - - - - Size: - - - - - - - 4 - - - - - - 0 - 0 - - - - Qt::WheelFocus - - - - - - - - 0 - 0 - - - - Qt::WheelFocus - - - - - - - Qt::WheelFocus - - - - - - - - - Rotation: - - - - - - - - 0 - 0 - - - - Qt::WheelFocus - - - - - - - Shear: - - - - - - - 4 - - - - - - 0 - 0 - - - - Qt::WheelFocus - - - - - - - - 0 - 0 - - - - Qt::WheelFocus - - - - - - + + + Screentone Type + + + + 4 + + + 4 + + + 8 + + + 8 + + + 8 + + + 8 + + + + + Pattern: + + + + + + + + 0 + 0 + + + + + + + + Shape: + + + + + + + Interpolation: + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + + + + + Transformation + + + + 4 + + + 4 + + + 8 + + + 8 + + + 8 + + + 8 + + + + + Position: + + + + + + + 4 + + + + + + 0 + 0 + + + + Qt::WheelFocus + + + + + + + + 0 + 0 + + + + Qt::WheelFocus + + + + + + + + + 4 + + + + + + 0 + 0 + + + + Qt::WheelFocus + + + + + + + + 0 + 0 + + + + Qt::WheelFocus + + + + + + + Qt::WheelFocus + + + + + + + + + Size: + + + + + + + 4 + + + + + + 0 + 0 + + + + Qt::WheelFocus + + + + + + + + 0 + 0 + + + + Qt::WheelFocus + + + + + + + + + Shear: + + + + + + + + 0 + 0 + + + + Qt::WheelFocus + + + + + + + Rotation: + + + + + + + + Postprocessing + + + + 4 + + + 4 + + + 8 + + + 8 + + + 8 + + + 8 + + + + + Foreground: + + + + + + + 4 + + + + + + + + + + + + + 0 + 0 + + + + Qt::WheelFocus + + + + + + + + + 4 + + + + + + + + + + + + + 0 + 0 + + + + Qt::WheelFocus + + + + + + + + + Background: + + + + + + + Invert: + + + + + + + + + + + + + + Brightness: + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Qt::WheelFocus + + + + + + + Contrast: + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Qt::WheelFocus + + + + + Qt::Vertical 0 0 KisDoubleSliderSpinBox QWidget
kis_slider_spin_box.h
1
KisSliderSpinBox QWidget
kis_slider_spin_box.h
1
KoAspectButton QWidget
KoAspectButton.h
1
KisColorButton QPushButton
kis_color_button.h
- comboBoxPattern - comboBoxShape - comboBoxInterpolation buttonForegroundColor sliderForegroundOpacity buttonBackgroundColor sliderBackgroundOpacity - checkBoxInvert - sliderBrightness - sliderContrast sliderPositionX sliderPositionY sliderSizeX sliderSizeY buttonKeepSizeSquare sliderShearX sliderShearY - sliderRotation