KisConfigWidget::KisConfigWidget(QWidget * parent, Qt::WFlags f, int delay) : QWidget(parent, f) , m_delay(delay) { m_timer.setSingleShot(true); connect(&m_timer, SIGNAL(timeout()), SLOT(slotConfigChanged())); connect(this, SIGNAL(sigConfigurationItemChanged()), SLOT(kickTimer())); }
void KisHSVConfigWidget::configureSliderLimitsAndLabels() { const WidgetSlidersConfig& widget = getCurrentWidgetConfig(m_page->cmbType->currentIndex(), m_page->chkColorize->isChecked()); widget.m_sliders[0].apply(m_page->hueSpinBox, m_page->hueSlider, m_page->label); widget.m_sliders[1].apply(m_page->saturationSpinBox, m_page->saturationSlider, m_page->label_2); widget.m_sliders[2].apply(m_page->valueSpinBox, m_page->valueSlider, m_page->label_3); emit sigConfigurationItemChanged(); }
void KisHSVConfigWidget::switchType(int index) { emit sigConfigurationItemChanged(); switch(index) { case 0: m_page->label_3->setText(i18n("Value")); return; case 1: default: m_page->label_3->setText(i18n("Lightness")); } }
KisWdgColorToAlpha::KisWdgColorToAlpha(QWidget * parent) : KisConfigWidget(parent), m_view(0) { m_widget = new Ui_WdgColorToAlphaBase(); m_widget->setupUi(this); m_widget->textLabel1->hide(); m_widget->intThreshold->setRange(1, 255, 0); 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 KoColor)), SLOT(slotCustomColorSelected(const KoColor&))); KoColor c(Qt::white, KoColorSpaceRegistry::instance()->rgb8()); m_widget->btnCustomColor->setColor(c); }
void KisHSVConfigWidget::switchColorize(bool toggle) { if (toggle) { m_page->hue->setMinimum(0); m_page->hue->setMaximum(360); m_page->saturation->setMinimum(0); m_page->saturation->setMaximum(100); m_page->saturation->setValue(50); switchType(1); } else { m_page->hue->setMinimum(-180); m_page->hue->setMaximum(180); m_page->saturation->setMinimum(-100); m_page->saturation->setMaximum(100); } emit sigConfigurationItemChanged(); }
void KisWdgIndexColors::setup(QStringList shadesLabels, int ramps) { int rows = shadesLabels.length(); int collumns = ramps; m_colorSelectors.resize(rows); m_stepSpinners.resize(rows-1); // Labels for the shades for(int row = 0; row < rows; ++row) { QLabel* l = new QLabel(shadesLabels[row], ui->colorsBox); ui->layoutColors->addWidget(l, row+1, 0); m_colorSelectors[row].resize(collumns); } // Labels for the ramps /*for(int col = 0; col < collumns; ++col) { QLabel* l = new QLabel(rampsLabels[col], ui->colorsBox); l->setAlignment(Qt::AlignRight | Qt::AlignVCenter); ui->layoutColors->addWidget(l, 0, col+1); }*/ // Step selectors for the shade gradients for(int row = 0; row < (rows-1); ++row) { QLabel* l0 = new QLabel(shadesLabels[row+1]); QLabel* l1 = new QLabel(QString::fromUtf8("↔")); QLabel* l2 = new QLabel(shadesLabels[row]); QSpinBox* s = new KisIntParseSpinBox(); s->setMinimum(0); s->setMaximum(32); s->setValue(2); connect(s, SIGNAL(valueChanged(int)), this, SIGNAL(sigConfigurationItemChanged())); m_stepSpinners[row] = s; ui->layoutRowSteps->addWidget(l0, row, 0); ui->layoutRowSteps->addWidget(l1, row, 1); ui->layoutRowSteps->addWidget(l2, row, 2); ui->layoutRowSteps->addWidget(s, row, 3); } // Color selectors for(int y = 0; y < rows; ++y) for(int x = 0; x < collumns; ++x) { KisColorButton* b = new KisColorButton; QCheckBox* c = new QCheckBox; c->setChecked(false); b->setEnabled(false); b->setMaximumWidth(50); c->setMaximumWidth(21); // Ugh. I hope this won't be causing any issues. Trying to get rid of the unnecessary spacing after it. connect(c, SIGNAL(toggled(bool)), b, SLOT(setEnabled(bool))); connect(c, SIGNAL(toggled(bool)), this, SIGNAL(sigConfigurationItemChanged())); connect(b, SIGNAL(changed(KoColor)), this, SIGNAL(sigConfigurationItemChanged())); QHBoxLayout* cell = new QHBoxLayout(); cell->setSpacing(0); cell->setContentsMargins(0, 0, 0, 0); cell->addWidget(c); cell->addWidget(b); ui->layoutColors->addLayout(cell, 1+y, 1+x); m_colorSelectors[y][x].button = b; m_colorSelectors[y][x].checkbox = c; } }
KisBrightnessContrastConfigWidget::KisBrightnessContrastConfigWidget(QWidget * parent, KisPaintDeviceSP dev, Qt::WFlags f) : KisConfigWidget(parent, f) { int i; int height; m_page = new WdgBrightnessContrast(this); QHBoxLayout * l = new QHBoxLayout(this); Q_CHECK_PTR(l); //Hide these buttons and labels as they are not implemented in 1.5 m_page->pb_more_contrast->hide(); m_page->pb_less_contrast->hide(); m_page->pb_more_brightness->hide(); m_page->pb_less_brightness->hide(); m_page->textLabelBrightness->hide(); m_page->textLabelContrast->hide(); l->addWidget(m_page, 0, Qt::AlignTop); height = 256; connect(m_page->curveWidget, SIGNAL(modified()), SIGNAL(sigConfigurationItemChanged())); // Create the horizontal gradient label QPixmap hgradientpix(256, 1); QPainter hgp(&hgradientpix); hgp.setPen(QPen(QColor(0, 0, 0), 1, Qt::SolidLine)); for (i = 0; i < 256; ++i) { hgp.setPen(QColor(i, i, i)); hgp.drawPoint(i, 0); } m_page->hgradient->setPixmap(hgradientpix); // Create the vertical gradient label QPixmap vgradientpix(1, 256); QPainter vgp(&vgradientpix); vgp.setPen(QPen(QColor(0, 0, 0), 1, Qt::SolidLine)); for (i = 0; i < 256; ++i) { vgp.setPen(QColor(i, i, i)); vgp.drawPoint(0, 255 - i); } m_page->vgradient->setPixmap(vgradientpix); KoHistogramProducerSP producer = KoHistogramProducerSP(new KoGenericLabHistogramProducer()); KisHistogram histogram(dev, dev->exactBounds(), producer, LINEAR); QPixmap pix(256, height); pix.fill(); QPainter p(&pix); p.setPen(QPen(Qt::gray, 1, Qt::SolidLine)); double highest = (double)histogram.calculations().getHighest(); qint32 bins = histogram.producer()->numberOfBins(); if (histogram.getHistogramType() == LINEAR) { double factor = (double)height / highest; for (i = 0; i < bins; ++i) { p.drawLine(i, height, i, height - int(histogram.getValue(i) * factor)); } } else { double factor = (double)height / (double)log(highest); for (i = 0; i < bins; ++i) { p.drawLine(i, height, i, height - int(log((double)histogram.getValue(i)) * factor)); } } m_page->curveWidget->setPixmap(pix); }
KisPhongBumpmapConfigWidget::KisPhongBumpmapConfigWidget(const KisPaintDeviceSP dev, QWidget *parent, Qt::WFlags f) : KisConfigWidget(parent, f) , m_device(dev) { Q_ASSERT(m_device); m_page = new KisPhongBumpmapWidget(this); KisSizeGroup *matPropLabelsGroup = new KisSizeGroup(this); matPropLabelsGroup->addWidget(m_page->lblAmbientReflectivity); matPropLabelsGroup->addWidget(m_page->lblDiffuseReflectivity); matPropLabelsGroup->addWidget(m_page->lblSpecularReflectivity); matPropLabelsGroup->addWidget(m_page->lblSpecularShinyExp); // Connect widgets to each other connect(m_page->azimuthDial1, SIGNAL(valueChanged(int)), m_page->azimuthSpinBox1, SLOT(setValue(int))); connect(m_page->azimuthDial2, SIGNAL(valueChanged(int)), m_page->azimuthSpinBox2, SLOT(setValue(int))); connect(m_page->azimuthDial3, SIGNAL(valueChanged(int)), m_page->azimuthSpinBox3, SLOT(setValue(int))); connect(m_page->azimuthDial4, SIGNAL(valueChanged(int)), m_page->azimuthSpinBox4, SLOT(setValue(int))); connect(m_page->azimuthSpinBox1, SIGNAL(valueChanged(int)), m_page->azimuthDial1, SLOT(setValue(int))); connect(m_page->azimuthSpinBox2, SIGNAL(valueChanged(int)), m_page->azimuthDial2, SLOT(setValue(int))); connect(m_page->azimuthSpinBox3, SIGNAL(valueChanged(int)), m_page->azimuthDial3, SLOT(setValue(int))); connect(m_page->azimuthSpinBox4, SIGNAL(valueChanged(int)), m_page->azimuthDial4, SLOT(setValue(int))); //Let widgets warn the preview of when they are updated connect(m_page->azimuthDial1, SIGNAL(valueChanged(int)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->azimuthDial2, SIGNAL(valueChanged(int)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->azimuthDial3, SIGNAL(valueChanged(int)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->azimuthDial4, SIGNAL(valueChanged(int)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->lightKColorCombo1, SIGNAL(currentIndexChanged(int)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->lightKColorCombo2, SIGNAL(currentIndexChanged(int)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->lightKColorCombo3, SIGNAL(currentIndexChanged(int)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->lightKColorCombo4, SIGNAL(currentIndexChanged(int)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->inclinationSpinBox1, SIGNAL(valueChanged(int)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->inclinationSpinBox2, SIGNAL(valueChanged(int)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->inclinationSpinBox3, SIGNAL(valueChanged(int)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->inclinationSpinBox4, SIGNAL(valueChanged(int)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->useNormalMap, SIGNAL(toggled(bool)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->diffuseReflectivityGroup, SIGNAL(toggled(bool)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->specularReflectivityGroup, SIGNAL(toggled(bool)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->ambientReflectivityKisDoubleSliderSpinBox, SIGNAL(valueChanged(qreal)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->diffuseReflectivityKisDoubleSliderSpinBox, SIGNAL(valueChanged(qreal)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->specularReflectivityKisDoubleSliderSpinBox, SIGNAL(valueChanged(qreal)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->shinynessExponentKisSliderSpinBox, SIGNAL(valueChanged(int)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->heightChannelComboBox, SIGNAL(currentIndexChanged(int)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->lightSourceGroupBox1, SIGNAL(toggled(bool)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->lightSourceGroupBox2, SIGNAL(toggled(bool)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->lightSourceGroupBox3, SIGNAL(toggled(bool)), SIGNAL(sigConfigurationItemChanged())); connect(m_page->lightSourceGroupBox4, SIGNAL(toggled(bool)), SIGNAL(sigConfigurationItemChanged())); QVBoxLayout *l = new QVBoxLayout(this); Q_CHECK_PTR(l); l->addWidget(m_page); /* fill in the channel chooser */ QList<KoChannelInfo *> channels = m_device->colorSpace()->channels(); for (quint8 ch = 0; ch < m_device->colorSpace()->colorChannelCount(); ch++) m_page->heightChannelComboBox->addItem(channels.at(ch)->name()); connect(m_page->useNormalMap, SIGNAL(toggled(bool)), this, SLOT(slotDisableHeightChannelCombobox(bool) ) ); }
void KisGmicSettingsWidget::createSettingsWidget(ROLE role) { QList<Parameter *> parameters = m_commandDefinition->m_parameters; if (parameters.size() == 0) { dbgPlugins << "No parameters!"; return; } QGridLayout * gridLayout(0); if (role == CreateRole) { gridLayout = new QGridLayout(this); } int row = 0; for (int i = 0; i < parameters.size();i++) { Parameter * p = parameters.at(i); dbgPlugins << "Processing: " << qPrintable(p->typeName()) << " " << qPrintable(p->toString()); switch (p->m_type) { case Parameter::INT_P: { IntParameter * intParam = static_cast<IntParameter *>(p); KisSliderSpinBox * spinBox(0); if (role == CreateRole) { spinBox = new KisSliderSpinBox; spinBox->setMinimum(intParam->m_minValue); spinBox->setMaximum(intParam->m_maxValue); // map widget to parameter index m_widgetToParameterIndexMapper[spinBox] = i; mapParameterWidget(intParam, spinBox); // TODO: check if it should update preview!!!, only then recompute preview connect(spinBox, SIGNAL(valueChanged(int)), this, SIGNAL(sigConfigurationItemChanged())); connect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(setIntValue(int))); gridLayout->addWidget(new QLabel(intParam->name()), row, 0); gridLayout->addWidget(spinBox, row, 1, 1, 3); row++; } else if (role == LoadRole) { spinBox = qobject_cast<KisSliderSpinBox *>(widget(intParam)); } if (spinBox) { spinBox->setValue(intParam->m_value); } else { dbgPlugins << "Widget not available; Role: " << role << p->m_type; } break; } case Parameter::FLOAT_P: { FloatParameter * floatParam = static_cast<FloatParameter *>(p); KisDoubleSliderSpinBox * spinBox(0); if (role == CreateRole) { spinBox = new KisDoubleSliderSpinBox; // TODO: check if 2 decimals is correct spinBox->setRange(floatParam->m_minValue, floatParam->m_maxValue, 2); m_widgetToParameterIndexMapper[spinBox] = i; mapParameterWidget(floatParam, spinBox); connect(spinBox, SIGNAL(valueChanged(qreal)), this, SIGNAL(sigConfigurationItemChanged())); connect(spinBox, SIGNAL(valueChanged(qreal)), this, SLOT(setFloatValue(qreal))); gridLayout->addWidget(new QLabel(floatParam->name()), row, 0); gridLayout->addWidget(spinBox, row, 1, 1, 3); row++; } else if (role == LoadRole) { spinBox = qobject_cast<KisDoubleSliderSpinBox *>(widget(floatParam)); } if (spinBox) { spinBox->setValue(floatParam->m_value); } else { dbgPlugins << "Widget not available; Role: " << role << " TYPE " <<p->m_type; } break; } case Parameter::CHOICE_P: { ChoiceParameter * choiceParam = static_cast<ChoiceParameter *>(p); QComboBox * combo(0); if (role == CreateRole) { combo = new QComboBox; QStringListModel *model = new QStringListModel(); model->setStringList(choiceParam->m_choices); combo->setModel(model); m_widgetToParameterIndexMapper[combo] = i; mapParameterWidget(choiceParam, combo); connect(combo, SIGNAL(currentIndexChanged(QString)), this, SIGNAL(sigConfigurationItemChanged())); connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(setChoiceIndex(int))); gridLayout->addWidget(new QLabel(choiceParam->name()), row, 0); gridLayout->addWidget(combo, row, 1, 1, 3); row++; } else if (role == LoadRole)
void KisWdgColorToAlpha::slotCustomColorSelected(const KoColor &color) { KoColor c(color, KoColorSpaceRegistry::instance()->rgb8()); m_widget->colorSelector->slotSetColor(color); emit sigConfigurationItemChanged(); }