pluginloader.h (krename-4.0.9) | : | pluginloader.h (krename-4.90.90) | ||
---|---|---|---|---|
skipping to change at line 18 | skipping to change at line 18 | |||
/*************************************************************************** | /*************************************************************************** | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * This program is free software; you can redistribute it and/or modify * | |||
* it under the terms of the GNU General Public License as published by * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | * (at your option) any later version. * | |||
* * | * * | |||
***************************************************************************/ | ***************************************************************************/ | |||
#ifndef _PLUGIN_LOADER_H_ | #ifndef PLUGIN_LOADER_H | |||
#define _PLUGIN_LOADER_H_ | #define PLUGIN_LOADER_H | |||
#include <QHash> | #include <QHash> | |||
#include <QList> | #include <QList> | |||
#include <QMap> | #include <QMap> | |||
#include <QObject> | ||||
class Plugin; | class Plugin; | |||
class KConfigGroup; | class KConfigGroup; | |||
class KRenameImpl; | class KRenameImpl; | |||
class PluginLoader { | class PluginLoader | |||
public: | { | |||
public: | ||||
~PluginLoader(); | ~PluginLoader(); | |||
static PluginLoader* Instance(); | static PluginLoader *Instance(); | |||
/** Find a plugin that supports a certain token | /** Find a plugin that supports a certain token | |||
* | * | |||
* This works only for plugins of the type ePluginType_Token | * This works only for plugins of the type ePluginType_Token | |||
* | * | |||
* @param token a token | * @param token a token | |||
* @returns a plugin or NULL | * @returns a plugin or NULL | |||
*/ | */ | |||
Plugin* findPlugin( const QString & token ); | Plugin *findPlugin(const QString &token); | |||
/** Find a plugin by its name | /** Find a plugin by its name | |||
* | * | |||
* @param name as returned by Plugin::name() | * @param name as returned by Plugin::name() | |||
* @returns a plugin or NULL | * @returns a plugin or NULL | |||
*/ | */ | |||
Plugin* findPluginByName( const QString & name ); | Plugin *findPluginByName(const QString &name); | |||
/** A read-only list of all plugins | /** A read-only list of all plugins | |||
* | * | |||
* @returns a list of all plugins; | * @returns a list of all plugins; | |||
*/ | */ | |||
inline const QList<Plugin*> & plugins() const { return m_plugins; } | inline const QList<Plugin *> &plugins() const | |||
{ | ||||
return m_plugins; | ||||
} | ||||
/** This maybe called by plugins, | /** This maybe called by plugins, | |||
* if a setting in their UI was changed | * if a setting in their UI was changed | |||
* so that the preview in KRename | * so that the preview in KRename | |||
* should be updated. | * should be updated. | |||
*/ | */ | |||
void sendUpdatePreview(); | void sendUpdatePreview(); | |||
/** Save the plugin configuration. | /** Save the plugin configuration. | |||
* | * | |||
* Called when plugins should save their configuration. | * Called when plugins should save their configuration. | |||
* | * | |||
* @param group config group where the configuration should be stored | * @param group config group where the configuration should be stored | |||
*/ | */ | |||
void saveConfig( KConfigGroup & group ); | void saveConfig(KConfigGroup &group); | |||
/** Load the plugin configuration. | /** Load the plugin configuration. | |||
* | * | |||
* Called when plugins should load their configuration. | * Called when plugins should load their configuration. | |||
* | * | |||
* @param group config group where the configuration should be read from | * @param group config group where the configuration should be read from | |||
*/ | */ | |||
void loadConfig( KConfigGroup & group ); | void loadConfig(KConfigGroup &group); | |||
void registerForUpdates( KRenameImpl* kreanme ); | void registerForUpdates(KRenameImpl *kreanme); | |||
void deregisterForUpdates( KRenameImpl* kreanme ); | void deregisterForUpdates(KRenameImpl *kreanme); | |||
private: | private: | |||
PluginLoader(); | PluginLoader(); | |||
/** Clear the plugin loader. | /** Clear the plugin loader. | |||
* I.e reset the object to its initial state and unload all plugins | * I.e reset the object to its initial state and unload all plugins | |||
*/ | */ | |||
void clear(); | void clear(); | |||
/** Load all plugins | /** Load all plugins | |||
*/ | */ | |||
void load(); | void load(); | |||
private: | private: | |||
static PluginLoader* s_instance; ///< The handle to the only pluginloade | static PluginLoader *s_instance; ///< The handle to the only pluginloade | |||
r instance | r instance | |||
QList<Plugin*> m_plugins; ///< The list of all plugins | QList<Plugin *> m_plugins; ///< The list of all plugins | |||
QMap<QString,Plugin*> m_tokenMap; ///< All supported tokens in brackets a | QMap<QString, Plugin *> m_tokenMap; ///< All supported tokens in brackets a | |||
re listed here | re listed here | |||
QHash<QString,Plugin*> m_tokenCache; ///< All used tokens are listed here | QHash<QString, Plugin *> m_tokenCache; ///< All used tokens are listed here | |||
QList<KRenameImpl*> m_observers; ///< A list of KRenameImpls that should be notified on updates | QList<KRenameImpl *> m_observers; ///< A list of KRenameImpls that should be notified on updates | |||
}; | }; | |||
#endif // _PLUGIN_LOADER_H_ | #endif // PLUGIN_LOADER_H | |||
End of changes. 16 change blocks. | ||||
22 lines changed or deleted | 25 lines changed or added |