Commit 27a31897 authored by Cyrille Berger's avatar Cyrille Berger

Remove last bit of toLegacyXML

svn path=/trunk/koffice/; revision=1113049
parent 955417c5
......@@ -60,34 +60,6 @@ KisFilterConfiguration::~KisFilterConfiguration()
delete d;
}
void KisFilterConfiguration::toLegacyXML(QDomDocument& doc, QDomElement& root) const
{
root.setAttribute("name", d->name);
root.setAttribute("version", d->version);
QMap<QString, QVariant> properties = getProperties();
QMap<QString, QVariant>::Iterator it;
for (it = properties.begin(); it != properties.end(); ++it) {
QDomElement e = doc.createElement("property");
e.setAttribute("name", QString(it.key().toLatin1()));
QVariant v = it.value();
e.setAttribute("type", v.typeName());
QString s = v.toString();
QDomText text = doc.createCDATASection(v.toString()); // XXX: Unittest this!
e.appendChild(text);
root.appendChild(e);
}
}
QString KisFilterConfiguration::toLegacyXML() const
{
QDomDocument doc = QDomDocument("filterconfig");
QDomElement root = doc.createElement("filterconfig");
doc.appendChild(root);
toLegacyXML(doc, root);
return doc.toString();
}
void KisFilterConfiguration::fromLegacyXML(const QDomElement& e)
{
clearProperties();
......@@ -117,14 +89,6 @@ void KisFilterConfiguration::fromLegacyXML(const QDomElement& e)
}
}
void KisFilterConfiguration::fromLegacyXML(const QString & s)
{
QDomDocument doc;
doc.setContent(s);
QDomElement e = doc.documentElement();
fromLegacyXML(e);
}
const QString & KisFilterConfiguration::name() const
{
return d->name;
......
......@@ -52,22 +52,10 @@ public:
public:
/**
* This function is use to convert from legacy XML as used in .kra file.
*/
virtual void fromLegacyXML(const QString &);
/**
* This function is use to convert from legacy XML as used in .kra file.
*/
virtual void fromLegacyXML(const QDomElement&);
/**
* This function is use to convert to legacy XML as used in .kra file.
*/
virtual QString toLegacyXML() const;
/**
* This function is use to convert to legacy XML as used in .kra file.
*/
virtual void toLegacyXML(QDomDocument&, QDomElement&) const;
/**
* Get the unique, language independent name of the filter.
......
......@@ -43,10 +43,10 @@ void KisFilterConfigurationTest::testRoundTrip()
KisFilterConfiguration * kfc = new KisFilterConfiguration("test", 1);
QCOMPARE(kfc->version(), 1);
QCOMPARE(kfc->name(), QString("test"));
QString s = kfc->toLegacyXML();
QString s = kfc->toXML();
delete kfc;
kfc = new KisFilterConfiguration("test2", 2);
kfc->fromLegacyXML(s);
kfc->fromXML(s);
QCOMPARE(kfc->version(), 1);
QCOMPARE(kfc->name(), QString("test"));
delete kfc;
......@@ -59,13 +59,13 @@ void KisFilterConfigurationTest::testSetGetProperty()
kfc->setProperty("value2", "foo");
QCOMPARE(kfc->getInt("value1"), 10);
QCOMPARE(kfc->getString("value2"), QString("foo"));
QString s = kfc->toLegacyXML();
QString s = kfc->toXML();
delete kfc;
kfc = new KisFilterConfiguration("test2", 2);
kfc->fromLegacyXML(s);
kfc->fromXML(s);
QCOMPARE(kfc->getInt("value1"), 10);
QCOMPARE(kfc->getString("value2"), QString("foo"));
delete kfc;
delete kfc;
}
......
......@@ -79,12 +79,12 @@ QVariantMap Filter::properties()
void Filter::fromXML(const QString& xml)
{
config()->fromLegacyXML(xml);
config()->fromXML(xml);
}
const QString Filter::toXML()
{
return config()->toLegacyXML();
return config()->toXML();
}
bool Filter::process(QObject* layer)
......
......@@ -107,11 +107,6 @@ void KisBrightnessContrastFilterConfiguration::setCurve(const KisCubicCurve &cur
*/
//void KisPerChannelFilterConfiguration::fromXML(const QString& s)
void KisBrightnessContrastFilterConfiguration::toLegacyXML(QDomDocument& doc, QDomElement& root) const
{
toXML(doc, root);
}
void KisBrightnessContrastFilterConfiguration::toXML(QDomDocument& doc, QDomElement& root) const
{
/**
......
......@@ -51,11 +51,9 @@ class KisBrightnessContrastFilterConfiguration : public KisFilterConfiguration
public:
using KisFilterConfiguration::fromXML;
using KisFilterConfiguration::toXML;
using KisFilterConfiguration::toLegacyXML;
using KisFilterConfiguration::fromLegacyXML;
virtual void fromLegacyXML(const QDomElement& root);
virtual void toLegacyXML(QDomDocument& doc, QDomElement& root) const;
virtual void fromXML(const QDomElement& e);
virtual void toXML(QDomDocument& doc, QDomElement& root) const;
......
......@@ -333,11 +333,6 @@ void KisPerChannelFilterConfiguration::fromXML(const QDomElement& root)
*/
//void KisPerChannelFilterConfiguration::fromXML(const QString& s)
void KisPerChannelFilterConfiguration::toLegacyXML(QDomDocument& doc, QDomElement& root) const
{
toXML(doc, root);
}
void KisPerChannelFilterConfiguration::toXML(QDomDocument& doc, QDomElement& root) const
{
/**
......
......@@ -49,11 +49,9 @@ public:
using KisFilterConfiguration::fromXML;
using KisFilterConfiguration::toXML;
using KisFilterConfiguration::toLegacyXML;
using KisFilterConfiguration::fromLegacyXML;
virtual void fromLegacyXML(const QDomElement& root);
virtual void toLegacyXML(QDomDocument& doc, QDomElement& root) const;
virtual void fromXML(const QDomElement& e);
virtual void toXML(QDomDocument& doc, QDomElement& root) const;
......
......@@ -75,7 +75,7 @@ KisFilterConfiguration* KisFilterOpSettings::filterConfig() const
Q_ASSERT(filter);
if(filter) {
KisFilterConfiguration* configuration = filter->factoryConfiguration(0);
configuration->fromLegacyXML(getString(FILTER_CONFIGURATION));
configuration->fromXML(getString(FILTER_CONFIGURATION));
return configuration;
}
}
......@@ -104,7 +104,7 @@ void KisFilterOpSettings::fromXML(const QDomElement& e)
if(filter) {
KisFilterConfiguration* configuration = filter->factoryConfiguration(0);
configuration->fromXML(element);
setProperty(FILTER_CONFIGURATION, configuration->toLegacyXML());
setProperty(FILTER_CONFIGURATION, configuration->toXML());
delete configuration;
}
}
......
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