Filters configuration

Boudewijn Rempt boud at valdyas.org
Wed Jan 4 22:17:44 CET 2006


On Tuesday 18 October 2005 21:19, Cyrille Berger wrote:

> And anyway, as boud has already decide, I don't think we will ever see
> automatic ui for filters :(

Okay, back in business... Laptop up and running and Krita up and running, too, 
with Casper fixing the last LAYERREMOVE's, I'm free to thing about this some 
more.

We've got the following requirements:

* must be serializable (and fit into our krita file dtd)
* must contain a variety of data types
* must be easy to map for the filter to a ui (if Cyrille wants to autogenerate 
a ui from the filter config data, I guess that's going to be possible because 
if you've got property name and type you can do that, it's just that I want 
to discourage that in Krita itself. But it would be possible for them as 
wants it to build a gui-creating class for this config).
* easy to use

Not a requirement is:

* super efficient: filter configs will be small and there won't be thousands 
of them in a single Krita document
* generate a gui by itself
* group the properties
* order the properties

The config data model must be easy to map to a certain filter, and easy to 
read by the filter.

I was thinking about making the filter config an xml document, but I guess 
that was my Java background speaking. A simple dictionary to QVariants would 
suffice, with a obligatory fields filtername and filterversion. Or a simple 
class on top of that with filtername and filterversion as data fields and a 
getter/setter wrapper. Something like:

KisFilterConfig {

	/**
	 * Create the filter config from the serialized representation.
	 * Checks the serialized representation whether name and version
	 * are correct.
	 */
	KisFilterConfig(const KisID & name, int version, const QString &);

	/**
         * Create a serialized version of this filter config
	 */
	QString toString();

	const QString & getName() const;
	int getVersion() const;

	/**
         * Set the property with name to value. 
	 */
	void setProperty(const QString & name, const QVariant & value);

	/**
         * Set value to the value associated with property name
         * @return false if the specified property did not exist.
         */
	bool getProperty(const QString name &, QVariant & value);

}

As simple as that. The resulting xml in Krita's file format would be something 
like:


<filterconfig name="" version="">
<property type=""></a>
</filterconfig>


-- 
Boudewijn Rempt 
http://www.valdyas.org/fading/index.cgi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kimageshop/attachments/20060104/c29c0ca7/attachment.pgp


More information about the kimageshop mailing list