Krita Source Code Documentation
Loading...
Searching...
No Matches
KoToolRegistry Class Reference

#include <KoToolRegistry.h>

+ Inheritance diagram for KoToolRegistry:

Public Member Functions

 KoToolRegistry ()
 
 ~KoToolRegistry () override
 
- Public Member Functions inherited from KoGenericRegistry< KoToolFactoryBase * >
void add (const QString &id, KoToolFactoryBase * item)
 
void add (KoToolFactoryBase * item)
 
void addAlias (const QString &alias, const QString &id)
 
QHash< QString, KoToolFactoryBase * >::const_iterator constBegin () const
 
QHash< QString, KoToolFactoryBase * >::const_iterator constEnd () const
 
bool contains (const QString &id) const
 
int count () const
 
QList< KoToolFactoryBase * > doubleEntries () const
 
KoToolFactoryBaseget (const QString &id) const
 
QList< QString > keys () const
 
 KoGenericRegistry ()
 
void remove (const QString &id)
 
void removeAlias (const QString &alias)
 
const KoToolFactoryBasevalue (const QString &id) const
 
QList< KoToolFactoryBase * > values () const
 
virtual ~KoGenericRegistry ()
 

Static Public Member Functions

static KoToolRegistryinstance ()
 

Private Member Functions

void init ()
 
 KoToolRegistry (const KoToolRegistry &)
 
KoToolRegistry operator= (const KoToolRegistry &)
 

Private Attributes

Private *const d
 

Detailed Description

This singleton class keeps a register of all available flake tools, or rather, of the factories that the KoToolBox (and KoToolManager) will use to create flake tools.

Definition at line 21 of file KoToolRegistry.h.

Constructor & Destructor Documentation

◆ KoToolRegistry() [1/2]

KoToolRegistry::KoToolRegistry ( )

Definition at line 24 of file KoToolRegistry.cpp.

25 : d(0)
26{
27}
Private *const d

◆ ~KoToolRegistry()

KoToolRegistry::~KoToolRegistry ( )
override

Definition at line 49 of file KoToolRegistry.cpp.

50{
51 qDeleteAll(doubleEntries());
52 qDeleteAll(values());
53}
QList< KoToolFactoryBase * > doubleEntries() const
QList< KoToolFactoryBase * > values() const

References KoGenericRegistry< KoToolFactoryBase * >::doubleEntries(), and KoGenericRegistry< KoToolFactoryBase * >::values().

◆ KoToolRegistry() [2/2]

KoToolRegistry::KoToolRegistry ( const KoToolRegistry & )
private

Member Function Documentation

◆ init()

void KoToolRegistry::init ( )
private

Definition at line 29 of file KoToolRegistry.cpp.

30{
32 config.group = "krita";
33 config.blacklist = "ToolPluginsDisabled";
34 KoPluginLoader::instance()->load(QString::fromLatin1("Krita/Tool"),
35 config);
36
37 // register generic tools
40
41 KConfigGroup cfg = KSharedConfig::openConfig()->group("krita");
42 QStringList toolsBlacklist = cfg.readEntry("ToolsBlacklist", QStringList());
43 foreach (const QString& toolID, toolsBlacklist) {
44 delete value(toolID);
45 remove(toolID);
46 }
47}
QList< QString > QStringList
const KoToolFactoryBase * value(const QString &id) const
void add(KoToolFactoryBase * item)
Factory for the KoPathTool.
void load(const QString &serviceType, const PluginsConfig &config=PluginsConfig(), QObject *owner=0, bool cache=true)
static KoPluginLoader * instance()
Factory for the KoZoomTool.
const char * blacklist
This contains the variable name for the list of plugins (by library name) that will not be loaded.

References KoGenericRegistry< KoToolFactoryBase * >::add(), KoPluginLoader::PluginsConfig::blacklist, KoPluginLoader::PluginsConfig::group, KoPluginLoader::instance(), KoPluginLoader::load(), KoGenericRegistry< KoToolFactoryBase * >::remove(), and KoGenericRegistry< KoToolFactoryBase * >::value().

◆ instance()

KoToolRegistry * KoToolRegistry::instance ( )
static

Return an instance of the KoToolRegistry Create a new instance on first call and return the singleton.

Definition at line 55 of file KoToolRegistry.cpp.

56{
57 if (!s_instance.exists()) {
58 s_instance->init();
59 }
60 return s_instance;
61}

References init().

◆ operator=()

KoToolRegistry KoToolRegistry::operator= ( const KoToolRegistry & )
private

Member Data Documentation

◆ d

Private* const KoToolRegistry::d
private

Definition at line 39 of file KoToolRegistry.h.


The documentation for this class was generated from the following files: