koffice/krita
Cyrille Berger
cyb at lepi.org
Sat Mar 14 02:27:46 CET 2009
SVN commit 939162 by berger:
* make a KisSerializedWhateverConfigurationFactory generic to KisBaseProcessor, and remove all the children of KisFilterConfigurationFactory (and remove it too)
(I strongly suggest a make clean in Krita after those change, if you want properly working filters)
CCMAIL:kimageshop at kde.org
M +3 -8 image/filter/kis_filter.cc
M +0 -28 image/filter/kis_filter_configuration.cc
M +0 -12 image/filter/kis_filter_configuration.h
M +4 -8 image/generator/kis_generator.cpp
M +1 -1 image/generator/kis_generator.h
M +24 -6 image/kis_base_processor.cpp
M +3 -5 image/kis_base_processor.h
M +1 -19 plugins/filters/colorsfilters/kis_brightness_contrast_filter.cc
M +0 -17 plugins/filters/colorsfilters/kis_perchannel_filter.cc
--- trunk/koffice/krita/image/filter/kis_filter.cc #939161:939162
@@ -78,11 +78,10 @@
}
-KisFilter::KisFilter(const KoID& id, const KoID & category, const QString & entry)
- : KisBaseProcessor(id, category, entry)
+KisFilter::KisFilter(const KoID& _id, const KoID & category, const QString & entry)
+ : KisBaseProcessor(_id, category, entry)
{
- setBookmarkManager(new KisBookmarkedConfigurationManager(configEntryGroup(),
- new KisFilterConfigurationFactory(id.id(), 1)));
+ init(id() + "_filter_bookmarks");
}
KisFilter::~KisFilter()
@@ -110,10 +109,6 @@
process(info, info, rect.size(), config, 0);
}
-QString KisFilter::configEntryGroup() const
-{
- return id() + "_filter_bookmarks";
-}
bool KisFilter::workWith(const KoColorSpace* cs) const
{
--- trunk/koffice/krita/image/filter/kis_filter_configuration.cc #939161:939162
@@ -155,31 +155,3 @@
{
d->channelFlags = channelFlags;
}
-
-struct KisFilterConfigurationFactory::Private {
- QString name;
- qint32 version;
-};
-
-KisFilterConfigurationFactory::KisFilterConfigurationFactory(const QString & name, qint32 version) : d(new Private)
-{
- d->name = name;
- d->version = version;
-}
-
-KisFilterConfigurationFactory::~KisFilterConfigurationFactory()
-{
- delete d;
-}
-
-KisSerializableConfiguration* KisFilterConfigurationFactory::createDefault()
-{
- return new KisFilterConfiguration(d->name, d->version);
-}
-
-KisSerializableConfiguration* KisFilterConfigurationFactory::create(const QDomElement& e)
-{
- KisFilterConfiguration* fc = new KisFilterConfiguration(d->name, d->version);
- fc->fromXML(e);
- return fc;
-}
--- trunk/koffice/krita/image/filter/kis_filter_configuration.h #939161:939162
@@ -107,16 +107,4 @@
Private* const d;
};
-class KRITAIMAGE_EXPORT KisFilterConfigurationFactory : public KisSerializableConfigurationFactory
-{
-public:
- KisFilterConfigurationFactory(const QString & name, qint32 version);
- virtual ~KisFilterConfigurationFactory();
- virtual KisSerializableConfiguration* createDefault();
- virtual KisSerializableConfiguration* create(const QDomElement& e);
-private:
- struct Private;
- Private* const d;
-};
-
#endif // _KIS_FILTER_CONFIGURATION_H_
--- trunk/koffice/krita/image/generator/kis_generator.cpp #939161:939162
@@ -29,10 +29,11 @@
#include "kis_selection.h"
#include "kis_types.h"
-KisGenerator::KisGenerator(const KoID& id, const KoID & category, const QString & entry)
- : KisBaseProcessor(id, category, entry)
+
+KisGenerator::KisGenerator(const KoID& _id, const KoID & category, const QString & entry)
+ : KisBaseProcessor(_id, category, entry)
{
- setBookmarkManager(new KisBookmarkedConfigurationManager(configEntryGroup(), new KisFilterConfigurationFactory(id.id(), 1)));
+ init(id() + "_generator_bookmarks");
}
KisGenerator::~KisGenerator()
@@ -52,11 +53,6 @@
return 0;
}
-QString KisGenerator::configEntryGroup() const
-{
- return id() + "_generator_bookmarks";
-}
-
QRect KisGenerator::generatedRect( QRect _imageArea, const KisFilterConfiguration* ) const
{
return _imageArea;
--- trunk/koffice/krita/image/generator/kis_generator.h #939161:939162
@@ -43,7 +43,7 @@
*/
class KRITAIMAGE_EXPORT KisGenerator : public KisBaseProcessor
{
-
+ friend class KisGeneratorConfigurationFactory;
public:
KisGenerator(const KoID& id, const KoID & category, const QString & entry);
--- trunk/koffice/krita/image/kis_base_processor.cpp #939161:939162
@@ -26,6 +26,25 @@
#include "kis_selection.h"
#include "kis_types.h"
+
+class KisBaseProcessorConfigurationFactory : public KisSerializableConfigurationFactory
+{
+public:
+ KisBaseProcessorConfigurationFactory(KisBaseProcessor* _generator) : m_generator(_generator) {}
+ virtual ~KisBaseProcessorConfigurationFactory() {}
+ virtual KisSerializableConfiguration* createDefault() {
+ return m_generator->factoryConfiguration(0);
+ }
+ virtual KisSerializableConfiguration* create(const QDomElement& e)
+ {
+ KisSerializableConfiguration* config = m_generator->factoryConfiguration(0);
+ config->fromXML(e);
+ return config;
+ }
+private:
+ KisBaseProcessor* m_generator;
+};
+
struct KisBaseProcessor::Private {
Private()
: bookmarkManager(0)
@@ -59,6 +78,11 @@
d->entry = entry;
}
+void KisBaseProcessor::init(const QString& configEntryGroup)
+{
+ d->bookmarkManager = new KisBookmarkedConfigurationManager(configEntryGroup, new KisBaseProcessorConfigurationFactory(this));
+}
+
KisBaseProcessor::~KisBaseProcessor()
{
delete d->bookmarkManager;
@@ -97,12 +121,6 @@
return d->bookmarkManager;
}
-void KisBaseProcessor::setBookmarkManager(KisBookmarkedConfigurationManager* bm)
-{
- delete d->bookmarkManager;
- d->bookmarkManager = bm;
-}
-
QString KisBaseProcessor::id() const
{
return d->id.id();
--- trunk/koffice/krita/image/kis_base_processor.h #939161:939162
@@ -55,6 +55,7 @@
*/
class KRITAIMAGE_EXPORT KisBaseProcessor : public KisShared
{
+ friend class KisBaseProcessorConfigurationFactory;
public:
@@ -72,7 +73,7 @@
*
* @return the default configuration of this widget
*/
- virtual KisFilterConfiguration * defaultConfiguration(const KisPaintDeviceSP) const;
+ KisFilterConfiguration * defaultConfiguration(const KisPaintDeviceSP) const;
/**
* @return the bookmark manager for this processor
@@ -148,11 +149,8 @@
protected:
- void setBookmarkManager(KisBookmarkedConfigurationManager*);
+ void init(const QString& configEntryGroup);
- /// @return the name of config group in KConfig
- virtual QString configEntryGroup() const = 0;
-
/// @return the default configuration as defined by whoever wrote the plugin
virtual KisFilterConfiguration* factoryConfiguration(const KisPaintDeviceSP) const;
--- trunk/koffice/krita/plugins/filters/colorsfilters/kis_brightness_contrast_filter.cc #939161:939162
@@ -50,21 +50,6 @@
#include "kis_histogram.h"
#include "kis_painter.h"
-class KisBrightnessContrastFilterConfigurationFactory : public KisFilterConfigurationFactory
-{
-public:
- KisBrightnessContrastFilterConfigurationFactory() : KisFilterConfigurationFactory("brightnesscontrast", 1) {}
- virtual ~KisBrightnessContrastFilterConfigurationFactory() { }
- virtual KisSerializableConfiguration* createDefault() {
- return new KisBrightnessContrastFilterConfiguration();
- }
- virtual KisSerializableConfiguration* create(const QDomElement& e) {
- KisFilterConfiguration* fc = new KisBrightnessContrastFilterConfiguration();
- fc->fromXML(e);
- return fc;
- }
-};
-
KisBrightnessContrastFilterConfiguration::KisBrightnessContrastFilterConfiguration()
: KisFilterConfiguration("brightnesscontrast", 1)
{
@@ -160,8 +145,6 @@
setSupportsPreview(true);
setSupportsIncrementalPainting(false);
setColorSpaceIndependence(TO_LAB16);
- setBookmarkManager(new KisBookmarkedConfigurationManager(configEntryGroup(), new KisBrightnessContrastFilterConfigurationFactory()));
-
}
KisConfigWidget * KisBrightnessContrastFilter::createConfigurationWidget(QWidget *parent, const KisPaintDeviceSP dev, const KisImageSP image) const
@@ -173,8 +156,7 @@
KisFilterConfiguration* KisBrightnessContrastFilter::factoryConfiguration(const KisPaintDeviceSP)
const
{
- KisFilterConfiguration* config = new KisBrightnessContrastFilterConfiguration();
- return config;
+ return new KisBrightnessContrastFilterConfiguration();
}
--- trunk/koffice/krita/plugins/filters/colorsfilters/kis_perchannel_filter.cc #939161:939162
@@ -255,21 +255,6 @@
}
-class KisPerChannelFilterConfigurationFactory : public KisFilterConfigurationFactory
-{
-public:
- KisPerChannelFilterConfigurationFactory() : KisFilterConfigurationFactory("perchannel", 1) {}
- virtual ~KisPerChannelFilterConfigurationFactory() { }
- virtual KisSerializableConfiguration* createDefault() {
- return new KisPerChannelFilterConfiguration(0);
- }
- virtual KisSerializableConfiguration* create(const QDomElement& e) {
- KisFilterConfiguration* fc = new KisPerChannelFilterConfiguration(0);
- fc->fromXML(e);
- return fc;
- }
-};
-
KisPerChannelFilterConfiguration::KisPerChannelFilterConfiguration(int nCh)
: KisFilterConfiguration("perchannel", 1)
{
@@ -481,8 +466,6 @@
setSupportsPreview(true);
setSupportsIncrementalPainting(false);
setColorSpaceIndependence(TO_LAB16);
- setBookmarkManager(new KisBookmarkedConfigurationManager(configEntryGroup(),
- new KisPerChannelFilterConfigurationFactory()));
}
KisConfigWidget * KisPerChannelFilter::createConfigurationWidget(QWidget *parent, const KisPaintDeviceSP dev, const KisImageSP image) const
More information about the kimageshop
mailing list