Commit 0e76ca67 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Make KisConfig create KisPropertiesConfiguration itself

parent 06bec48f
......@@ -186,7 +186,7 @@ KisPropertiesConfigurationSP KisImportExportFilter::defaultConfiguration(const Q
KisPropertiesConfigurationSP KisImportExportFilter::lastSavedConfiguration(const QByteArray &from, const QByteArray &to) const
{
KisPropertiesConfigurationSP cfg = defaultConfiguration(from, to);
const QString filterConfig = KisConfig(true).exportConfiguration(to);
const QString filterConfig = KisConfig(true).exportConfigurationXML(to);
if (cfg && !filterConfig.isEmpty()) {
cfg->fromXML(filterConfig, false);
}
......
......@@ -66,9 +66,7 @@ KisDlgStrokeSelection::KisDlgStrokeSelection(KisImageWSP image, KisViewManager *
setMainWidget(m_page);
resize(m_page->sizeHint());
QString filterConfig = KisConfig(true).exportConfiguration("StrokeSelection");
KisPropertiesConfigurationSP cfg(new KisPropertiesConfiguration());
cfg->fromXML(filterConfig);
KisPropertiesConfigurationSP cfg = KisConfig(true).exportConfiguration("StrokeSelection");
auto &m_options = m_page->m_options;
m_options.color = cfg->getColor("color");
......
......@@ -1308,11 +1308,19 @@ void KisConfig::setFavoriteCompositeOps(const QStringList& compositeOps) const
m_cfg.writeEntry("favoriteCompositeOps", compositeOps);
}
QString KisConfig::exportConfiguration(const QString &filterId, bool defaultValue) const
QString KisConfig::exportConfigurationXML(const QString &filterId, bool defaultValue) const
{
return (defaultValue ? QString() : m_cfg.readEntry("ExportConfiguration-" + filterId, QString()));
}
KisPropertiesConfigurationSP KisConfig::exportConfiguration(const QString &filterId, bool defaultValue) const
{
KisPropertiesConfigurationSP cfg = new KisPropertiesConfiguration();
const QString xmlData = exportConfigurationXML(filterId, defaultValue);
cfg->fromXML(xmlData);
return cfg;
}
void KisConfig::setExportConfiguration(const QString &filterId, KisPropertiesConfigurationSP properties) const
{
QString exportConfig = properties->toXML();
......
......@@ -359,7 +359,8 @@ public:
QStringList favoriteCompositeOps(bool defaultValue = false) const;
void setFavoriteCompositeOps(const QStringList& compositeOps) const;
QString exportConfiguration(const QString &filterId, bool defaultValue = false) const;
QString exportConfigurationXML(const QString &filterId, bool defaultValue = false) const;
KisPropertiesConfigurationSP exportConfiguration(const QString &filterId, bool defaultValue = false) const;
void setExportConfiguration(const QString &filterId, KisPropertiesConfigurationSP properties) const;
QString importConfiguration(const QString &filterId, bool defaultValue = false) const;
......
......@@ -93,8 +93,7 @@ void AnimaterionRenderer::slotRenderSequenceAgain()
KisConfig cfg(true);
KisPropertiesConfigurationSP settings = new KisPropertiesConfiguration();
settings->fromXML(cfg.exportConfiguration("ANIMATION_EXPORT"));
KisPropertiesConfigurationSP settings = cfg.exportConfiguration("ANIMATION_EXPORT");
KisAnimationRenderingOptions encoderOptions;
encoderOptions.fromProperties(settings);
......
......@@ -151,8 +151,7 @@ DlgAnimationRenderer::DlgAnimationRenderer(KisDocument *doc, QWidget *parent)
connect(this, SIGNAL(accepted()), SLOT(slotDialogAccepted()));
{
KisPropertiesConfigurationSP settings = new KisPropertiesConfiguration();
settings->fromXML(cfg.exportConfiguration("ANIMATION_EXPORT"));
KisPropertiesConfigurationSP settings = cfg.exportConfiguration("ANIMATION_EXPORT");
KisAnimationRenderingOptions options;
options.fromProperties(settings);
......@@ -164,8 +163,7 @@ DlgAnimationRenderer::DlgAnimationRenderer(KisDocument *doc, QWidget *parent)
* but we should better read the one, generated by the config widget, because
* it may have some changes made to the "last use type config".
*/
m_frameExportConfig = new KisPropertiesConfiguration();
m_frameExportConfig->fromXML(cfg.exportConfiguration(options.frameMimeType));
m_frameExportConfig = cfg.exportConfiguration(options.frameMimeType);
}
......@@ -251,8 +249,7 @@ void DlgAnimationRenderer::loadAnimationOptions(const KisAnimationRenderingOptio
{
KisConfig cfg(true);
KisPropertiesConfigurationSP settings = new KisPropertiesConfiguration();
settings->fromXML(cfg.exportConfiguration("VIDEO_ENCODER"));
KisPropertiesConfigurationSP settings = cfg.exportConfiguration("VIDEO_ENCODER");
getDefaultVideoEncoderOptions(options.videoMimeType, settings,
&m_customFFMpegOptionsString,
......@@ -309,8 +306,7 @@ void DlgAnimationRenderer::selectRenderOptions()
{
KisConfig cfg(true);
KisPropertiesConfigurationSP settings = new KisPropertiesConfiguration();
settings->fromXML(cfg.exportConfiguration("VIDEO_ENCODER"));
KisPropertiesConfigurationSP settings = cfg.exportConfiguration("VIDEO_ENCODER");
encoderConfigWidget->setConfiguration(settings);
}
......
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