Commit 58aead0c authored by Boudewijn Rempt's avatar Boudewijn Rempt

Implement a KisPaintopPropertiesBase class for KisAirbrushOption

parent 00d41156
......@@ -88,6 +88,9 @@ void KisAirbrushOptionWidget::writeOptionSetting(KisPropertiesConfigurationSP se
}
setting->setProperty(AIRBRUSH_ENABLED, isChecked());
setting->setProperty(AIRBRUSH_RATE, 1000.0 / m_d->airbrushInterval);
qDebug() << "writeOptionSetting. Interval:" << m_d->airbrushInterval << "Calculated rate" << 1000.0 / m_d->airbrushInterval << "Rate in widget" << m_d->configPage->sliderRate->value();
setting->setProperty(AIRBRUSH_IGNORE_SPACING, m_d->ignoreSpacing);
}
......@@ -97,8 +100,9 @@ void KisAirbrushOptionWidget::readOptionSetting(const KisPropertiesConfiguration
// Update settings in the widget. The widget's signals should cause the changes to be propagated
// to this->m_d as well.
m_d->configPage->sliderRate->setValue(setting->getDouble(AIRBRUSH_RATE, DEFAULT_RATE));
m_d->configPage->checkBoxIgnoreSpacing->setChecked(setting->getBool(AIRBRUSH_IGNORE_SPACING,
false));
qDebug() << "readOptionSetting. Interval:" << m_d->airbrushInterval << "Rate from settings" << setting->getDouble(AIRBRUSH_RATE, DEFAULT_RATE) << "Rate in widget" << m_d->configPage->sliderRate->value();
m_d->configPage->checkBoxIgnoreSpacing->setChecked(setting->getBool(AIRBRUSH_IGNORE_SPACING, false));
}
qreal KisAirbrushOptionWidget::airbrushInterval() const
......@@ -131,9 +135,23 @@ void KisAirbrushOptionWidget::updateInterval()
rate = 1.0;
}
m_d->airbrushInterval = 1000.0 / rate;
qDebug() << "updateInterval();. Interval:" << m_d->airbrushInterval << "Rate in widget" << m_d->configPage->sliderRate->value();
}
void KisAirbrushOptionWidget::updateIgnoreSpacing()
{
m_d->ignoreSpacing = m_d->configPage->checkBoxIgnoreSpacing->isChecked();
}
void KisAirbrushOptionProperties::readOptionSettingImpl(const KisPropertiesConfiguration *setting){
enabled = setting->getBool(AIRBRUSH_ENABLED);
airbrushInterval = 1000.0 / setting->getDouble(AIRBRUSH_RATE, DEFAULT_RATE);
ignoreSpacing = setting->getBool(AIRBRUSH_IGNORE_SPACING, false);
}
void KisAirbrushOptionProperties::writeOptionSettingImpl(KisPropertiesConfiguration *setting) const{
setting->setProperty(AIRBRUSH_ENABLED, enabled);
setting->setProperty(AIRBRUSH_RATE, 1000.0 / airbrushInterval > 0 ? airbrushInterval : 1.0);
setting->setProperty(AIRBRUSH_IGNORE_SPACING, ignoreSpacing);
}
......@@ -63,10 +63,15 @@ private:
Private *const m_d;
};
//class KisAirbrushOptionProperties : public KisPaintopPropertiesBase
//{
//protected:
//};
struct KisAirbrushOptionProperties : public KisPaintopPropertiesBase
{
bool enabled {false};
qreal airbrushInterval {1000.0 / 20.0};
bool ignoreSpacing {false};
void readOptionSettingImpl(const KisPropertiesConfiguration *setting) override;
void writeOptionSettingImpl(KisPropertiesConfiguration *setting) const override;
};
#endif
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