Commit 9690a1b0 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Remove the old pattern for instantiating the plugin, in which we checked

that the parent was the right class for loading the plugin. We don't care
who loads us, we just grab the right registry. This prepares the way for
using KoPluginLoader for filters and generators

svn path=/trunk/koffice/; revision=940305
parent d76d8b50
......@@ -32,10 +32,8 @@ BlurFilterPlugin::BlurFilterPlugin(QObject *parent, const QStringList &)
{
setComponentData(BlurFilterPluginFactory::componentData());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * manager = dynamic_cast<KisFilterRegistry *>(parent);
manager->add(KisFilterSP(new KisBlurFilter()));
}
KisFilterRegistry::instance()->add(new KisBlurFilter());
}
BlurFilterPlugin::~BlurFilterPlugin()
......
......@@ -77,12 +77,8 @@ KritaBumpmap::KritaBumpmap(QObject *parent, const QStringList &)
: KParts::Plugin(parent)
{
setComponentData(KritaBumpmapFactory::componentData());
KisFilterRegistry::instance()->add( new KisFilterBumpmap());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * manager = dynamic_cast<KisFilterRegistry *>(parent);
manager->add(KisFilterSP(new KisFilterBumpmap()));
}
}
KritaBumpmap::~KritaBumpmap()
......
......@@ -33,12 +33,11 @@ KritaExtensionsColors::KritaExtensionsColors(QObject *parent, const QStringList
{
setComponentData(KritaExtensionsColorsFactory::componentData());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * manager = dynamic_cast<KisFilterRegistry *>(parent);
manager->add(KisFilterSP(new KisFilterMax()));
manager->add(KisFilterSP(new KisFilterMin()));
manager->add(KisFilterSP(new KisFilterColorToAlpha()));
}
KisFilterRegistry * manager = KisFilterRegistry::instance();
manager->add(new KisFilterMax());
manager->add(new KisFilterMin());
manager->add(new KisFilterColorToAlpha());
}
KritaExtensionsColors::~KritaExtensionsColors()
......
......@@ -69,14 +69,13 @@ ColorsFilters::ColorsFilters(QObject *parent, const QStringList &)
{
setComponentData(ColorsFiltersFactory::componentData());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * manager = dynamic_cast<KisFilterRegistry *>(parent);
manager->add(new KisBrightnessContrastFilter());
manager->add(new KisAutoContrast());
manager->add(new KisPerChannelFilter());
manager->add(new KisDesaturateFilter());
manager->add(new KisHSVAdjustmentFilter());
}
KisFilterRegistry * manager = KisFilterRegistry::instance();
manager->add(new KisBrightnessContrastFilter());
manager->add(new KisAutoContrast());
manager->add(new KisPerChannelFilter());
manager->add(new KisDesaturateFilter());
manager->add(new KisHSVAdjustmentFilter());
}
ColorsFilters::~ColorsFilters()
......
......@@ -61,22 +61,20 @@ KritaConvolutionFilters::KritaConvolutionFilters(QObject *parent, const QStringL
: KParts::Plugin(parent)
{
setComponentData(KritaConvolutionFiltersFactory::componentData());
KisFilterRegistry * manager = KisFilterRegistry::instance();
manager->add(new KisGaussianBlurFilter());
manager->add(new KisSharpenFilter());
manager->add(new KisMeanRemovalFilter());
manager->add(new KisEmbossLaplascianFilter());
manager->add(new KisEmbossInAllDirectionsFilter());
manager->add(new KisEmbossHorizontalVerticalFilter());
manager->add(new KisEmbossVerticalFilter());
manager->add(new KisEmbossHorizontalFilter());
manager->add(new KisTopEdgeDetectionFilter());
manager->add(new KisRightEdgeDetectionFilter());
manager->add(new KisBottomEdgeDetectionFilter());
manager->add(new KisLeftEdgeDetectionFilter());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * manager = dynamic_cast<KisFilterRegistry *>(parent);
manager->add(KisFilterSP(new KisGaussianBlurFilter()));
manager->add(KisFilterSP(new KisSharpenFilter()));
manager->add(KisFilterSP(new KisMeanRemovalFilter()));
manager->add(KisFilterSP(new KisEmbossLaplascianFilter()));
manager->add(KisFilterSP(new KisEmbossInAllDirectionsFilter()));
manager->add(KisFilterSP(new KisEmbossHorizontalVerticalFilter()));
manager->add(KisFilterSP(new KisEmbossVerticalFilter()));
manager->add(KisFilterSP(new KisEmbossHorizontalFilter()));
manager->add(KisFilterSP(new KisTopEdgeDetectionFilter()));
manager->add(KisFilterSP(new KisRightEdgeDetectionFilter()));
manager->add(KisFilterSP(new KisBottomEdgeDetectionFilter()));
manager->add(KisFilterSP(new KisLeftEdgeDetectionFilter()));
}
}
KritaConvolutionFilters::~KritaConvolutionFilters()
......
......@@ -31,11 +31,8 @@ K_EXPORT_COMPONENT_FACTORY(kritacubismfilter, KisCubismFilterPluginFactory("krit
KisCubismFilterPlugin::KisCubismFilterPlugin(QObject *parent, const QStringList &) : KParts::Plugin(parent)
{
setComponentData(KisCubismFilterPluginFactory::componentData());
KisFilterRegistry::instance()->add(new KisCubismFilter());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * r = dynamic_cast<KisFilterRegistry*>(parent);
r->add(new KisCubismFilter());
}
}
KisCubismFilterPlugin::~KisCubismFilterPlugin()
......
......@@ -31,11 +31,8 @@ K_EXPORT_COMPONENT_FACTORY(kritaembossfilter, KisEmbossFilterPluginFactory("krit
KisEmbossFilterPlugin::KisEmbossFilterPlugin(QObject *parent, const QStringList &) : KParts::Plugin(parent)
{
setComponentData(KisEmbossFilterPluginFactory::componentData());
KisFilterRegistry::instance()->add(new KisEmbossFilter());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * manager = dynamic_cast<KisFilterRegistry *>(parent);
manager->add(KisFilterSP(new KisEmbossFilter()));
}
}
KisEmbossFilterPlugin::~KisEmbossFilterPlugin()
......
......@@ -52,11 +52,7 @@ KritaExample::KritaExample(QObject *parent, const QStringList &)
{
setComponentData(KritaExampleFactory::componentData());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * manager = dynamic_cast<KisFilterRegistry *>(parent);
if (manager)
manager->add(KisFilterSP(new KisFilterInvert()));
}
KisFilterRegistry::instance()->add(KisFilterSP(new KisFilterInvert()));
}
KritaExample::~KritaExample()
......
......@@ -44,13 +44,9 @@ K_EXPORT_COMPONENT_FACTORY(kritafastcolortransferfilter, KritaFastColorTransferF
FastColorTransferPlugin::FastColorTransferPlugin(QObject *parent, const QStringList &)
: KParts::Plugin(parent)
{
dbgPlugins << "Load FastColorTransferPlugin";
setComponentData(KritaFastColorTransferFactory::componentData());
KisFilterRegistry::instance()->add(new KisFilterFastColorTransfer());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * manager = dynamic_cast<KisFilterRegistry *>(parent);
manager->add(KisFilterSP(new KisFilterFastColorTransfer()));
}
}
FastColorTransferPlugin::~FastColorTransferPlugin()
......
......@@ -50,12 +50,8 @@ KritaImageEnhancement::KritaImageEnhancement(QObject *parent, const QStringList
: KParts::Plugin(parent)
{
setComponentData(KritaImageEnhancementFactory::componentData());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * r = dynamic_cast<KisFilterRegistry*>(parent);
r->add(KisFilterSP(new KisSimpleNoiseReducer()));
r->add(KisFilterSP(new KisWaveletNoiseReduction()));
}
KisFilterRegistry::instance()->add( new KisSimpleNoiseReducer());
KisFilterRegistry::instance()->add( new KisWaveletNoiseReduction());
}
KritaImageEnhancement::~KritaImageEnhancement()
......
......@@ -60,12 +60,8 @@ KritaLensCorrectionFilter::KritaLensCorrectionFilter(QObject *parent, const QStr
: KParts::Plugin(parent)
{
setComponentData(KritaLensCorrectionFilterFactory::componentData());
KisFilterRegistry::instance()->add(new KisFilterLensCorrection());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * manager = dynamic_cast<KisFilterRegistry *>(parent);
manager->add(KisFilterSP(new KisFilterLensCorrection()));
}
}
KritaLensCorrectionFilter::~KritaLensCorrectionFilter()
......
......@@ -32,11 +32,8 @@ LevelFilter::LevelFilter(QObject *parent, const QStringList &)
: KParts::Plugin(parent)
{
setComponentData(LevelFilterFactory::componentData());
dbgFilters << "Loading Level filter";
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * manager = dynamic_cast<KisFilterRegistry *>(parent);
manager->add(new KisLevelFilter());
}
KisFilterRegistry::instance()->add(new KisLevelFilter());
}
LevelFilter::~LevelFilter()
......
......@@ -57,12 +57,8 @@ KritaNoiseFilter::KritaNoiseFilter(QObject *parent, const QStringList &)
: KParts::Plugin(parent)
{
setComponentData(KritaNoiseFilterFactory::componentData());
KisFilterRegistry::instance()->add(new KisFilterNoise());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * manager = dynamic_cast<KisFilterRegistry *>(parent);
manager->add(KisFilterSP(new KisFilterNoise()));
}
}
KritaNoiseFilter::~KritaNoiseFilter()
......
......@@ -31,11 +31,7 @@ K_EXPORT_COMPONENT_FACTORY(kritaoilpaintfilter, KisOilPaintFilterPluginFactory("
KisOilPaintFilterPlugin::KisOilPaintFilterPlugin(QObject *parent, const QStringList &) : KParts::Plugin(parent)
{
setComponentData(KisOilPaintFilterPluginFactory::componentData());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * manager = dynamic_cast<KisFilterRegistry *>(parent);
manager->add(KisFilterSP(new KisOilPaintFilter()));
}
KisFilterRegistry::instance()->add(new KisOilPaintFilter());
}
......
......@@ -36,11 +36,7 @@ KisPixelizeFilterPlugin::KisPixelizeFilterPlugin(QObject *parent, const QStringL
: KParts::Plugin(parent)
{
setComponentData(KisPixelizeFilterPluginFactory::componentData());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * manager = dynamic_cast<KisFilterRegistry *>(parent);
manager->add(KisFilterSP(new KisPixelizeFilter()));
}
KisFilterRegistry::instance()->add(new KisPixelizeFilter());
}
KisPixelizeFilterPlugin::~KisPixelizeFilterPlugin()
......
......@@ -34,11 +34,8 @@ K_EXPORT_COMPONENT_FACTORY(kritaraindropsfilter, KisRainDropsFilterPluginFactory
KisRainDropsFilterPlugin::KisRainDropsFilterPlugin(QObject *parent, const QStringList &) : KParts::Plugin(parent)
{
setComponentData(KisRainDropsFilterPluginFactory::componentData());
KisFilterRegistry::instance()->add(new KisRainDropsFilter());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * manager = dynamic_cast<KisFilterRegistry *>(parent);
manager->add(KisFilterSP(new KisRainDropsFilter()));
}
}
KisRainDropsFilterPlugin::~KisRainDropsFilterPlugin()
......
......@@ -58,12 +58,7 @@ KritaRandomPickFilter::KritaRandomPickFilter(QObject *parent, const QStringList
: KParts::Plugin(parent)
{
setComponentData(KritaRandomPickFilterFactory::componentData());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * manager = dynamic_cast<KisFilterRegistry *>(parent);
manager->add(KisFilterSP(new KisFilterRandomPick()));
}
KisFilterRegistry::instance()->add(new KisFilterRandomPick());
}
KritaRandomPickFilter::~KritaRandomPickFilter()
......
......@@ -32,11 +32,8 @@ KisRoundCornersFilterPlugin::KisRoundCornersFilterPlugin(QObject *parent, const
: KParts::Plugin(parent)
{
setComponentData(KisRoundCornersFilterPluginFactory::componentData());
KisFilterRegistry::instance()->add(new KisRoundCornersFilter());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * manager = dynamic_cast<KisFilterRegistry *>(parent);
manager->add(KisFilterSP(new KisRoundCornersFilter()));
}
}
KisRoundCornersFilterPlugin::~KisRoundCornersFilterPlugin()
......
......@@ -33,11 +33,7 @@ KisSmallTilesFilterPlugin::KisSmallTilesFilterPlugin(QObject *parent, const QStr
: KParts::Plugin(parent)
{
setComponentData(KisSmallTilesFilterPluginFactory::componentData());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * manager = dynamic_cast<KisFilterRegistry *>(parent);
manager->add(KisFilterSP(new KisSmallTilesFilter()));
}
KisFilterRegistry::instance()->add(new KisSmallTilesFilter());
}
KisSmallTilesFilterPlugin::~KisSmallTilesFilterPlugin()
......
......@@ -33,11 +33,7 @@ KisSobelFilterPlugin::KisSobelFilterPlugin(QObject *parent, const QStringList &)
: KParts::Plugin(parent)
{
setComponentData(KisSobelFilterPluginFactory::componentData());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * manager = dynamic_cast<KisFilterRegistry *>(parent);
manager->add(KisFilterSP(new KisSobelFilter()));
}
KisFilterRegistry::instance()->add(new KisSobelFilter());
}
KisSobelFilterPlugin::~KisSobelFilterPlugin()
......
......@@ -32,11 +32,8 @@ UnsharpPlugin::UnsharpPlugin(QObject *parent, const QStringList &)
: KParts::Plugin(parent)
{
setComponentData(UnsharpPluginFactory::componentData());
KisFilterRegistry::instance()->add(new KisUnsharpFilter());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * manager = dynamic_cast<KisFilterRegistry *>(parent);
manager->add(KisFilterSP(new KisUnsharpFilter()));
}
}
UnsharpPlugin::~UnsharpPlugin()
......
......@@ -94,12 +94,7 @@ private:
: KParts::Plugin(parent)
{
setComponentData(KritaWaveFilterFactory::componentData());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * manager = dynamic_cast<KisFilterRegistry *>(parent);
manager->add(KisFilterSP(new KisFilterWave()));
}
KisFilterRegistry::instance()->add(new KisFilterWave());
}
KritaWaveFilter::~KritaWaveFilter()
......
......@@ -56,12 +56,7 @@ KritaColorGenerator::KritaColorGenerator(QObject *parent, const QStringList &)
: KParts::Plugin(parent)
{
setComponentData(KritaColorGeneratorFactory::componentData());
if (parent->inherits("KisGeneratorRegistry")) {
KisGeneratorRegistry * manager = dynamic_cast<KisGeneratorRegistry *>(parent);
if (manager) {
manager->add(new KisColorGenerator());
}
}
KisGeneratorRegistry::instance()->add(new KisColorGenerator());
}
KritaColorGenerator::~KritaColorGenerator()
......
......@@ -47,4 +47,4 @@ Comment[zh_TW]=產生一實心顏色
X-KDE-ServiceTypes=Krita/Generator
Type=Service
X-KDE-Library=kritacolorgenerator
X-Krita-Version=4
X-Krita-Version=3
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