22#include <tdeinstance.h>
25#include <kstandarddirs.h>
26#include <tdeparts/plugin.h>
29#include <tdeparts/componentfactory.h>
31#include "kis_generic_registry.h"
33#include "kis_paintop_registry.h"
34#include "kis_paintop.h"
36#include "kis_debug_areas.h"
37#include "kis_colorspace.h"
39KisPaintOpRegistry * KisPaintOpRegistry::m_singleton = 0;
41KisPaintOpRegistry::KisPaintOpRegistry()
43 Q_ASSERT(KisPaintOpRegistry::m_singleton == 0);
44 KisPaintOpRegistry::m_singleton =
this;
46 TDETrader::OfferList offers = TDETrader::self()->query(TQString::fromLatin1(
"Chalk/Paintop"),
47 TQString::fromLatin1(
"(Type == 'Service') and "
48 "([X-Chalk-Version] == 2)"));
50 TDETrader::OfferList::ConstIterator iter;
52 for(iter = offers.begin(); iter != offers.end(); ++iter)
54 KService::Ptr service = *iter;
56 KParts::Plugin* plugin =
57 KParts::ComponentFactory::createInstanceFromService<KParts::Plugin> ( service,
this, 0, TQStringList(), &errCode);
59 kdDebug(41006) <<
"found plugin " << service->property(
"Name").toString() <<
"\n";
61 kdDebug(41006) <<
"found plugin " << service->property(
"Name").toString() <<
", " << errCode <<
"\n";
62 if( errCode == KParts::ComponentFactory::ErrNoLibrary)
64 kdWarning(41006) <<
" Error loading plugin was : ErrNoLibrary " << KLibLoader::self()->lastErrorMessage() << endl;
72KisPaintOpRegistry::~KisPaintOpRegistry()
76KisPaintOpRegistry* KisPaintOpRegistry::instance()
78 if(KisPaintOpRegistry::m_singleton == 0)
80 KisPaintOpRegistry::m_singleton =
new KisPaintOpRegistry();
81 TQ_CHECK_PTR(KisPaintOpRegistry::m_singleton);
83 return KisPaintOpRegistry::m_singleton;
86KisPaintOp * KisPaintOpRegistry::paintOp(
const KisID &
id,
const KisPaintOpSettings * settings,
KisPainter * painter)
const
89 kdWarning() <<
" KisPaintOpRegistry::paintOp painter is null";
92 KisPaintOpFactorySP f = get(
id);
94 return f->createOp(settings, painter);
101KisPaintOp * KisPaintOpRegistry::paintOp(
const TQString &
id,
const KisPaintOpSettings * settings,
KisPainter * painter)
const
103 return paintOp(
KisID(
id,
""), settings, painter);
106KisPaintOpSettings * KisPaintOpRegistry::settings(
const KisID&
id, TQWidget * parent,
const KisInputDevice& inputDevice)
const
110 return f->
settings( parent, inputDevice );
118 KisPaintOpFactorySP f = get(
id);
120 kdDebug(DBG_AREA_REGISTRY) <<
"No paintop " <<
id.id() <<
"\n";
123 return f->userVisible(cs);
127TQString KisPaintOpRegistry::pixmap(
const KisID &
id)
const
129 KisPaintOpFactorySP f = get(
id);
132 kdDebug(DBG_AREA_REGISTRY) <<
"No paintop " <<
id.id() <<
"\n";
139#include "kis_paintop_registry.moc"
A colorspace is the definition of a certain color model in Chalk.
Chalk has a large number of extensible resources.
The paintop factory is responsible for creating paintops of the specified class.
virtual KisPaintOpSettings * settings(TQWidget *parent, const KisInputDevice &inputDevice)
Create and return an (abstracted) widget with options for this paintop when used with the specified i...
KisPainter contains the graphics primitives necessary to draw on a KisPaintDevice.