Changeset View
Changeset View
Standalone View
Standalone View
src/PluginManager.h
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | 35 | public: | |||
---|---|---|---|---|---|
62 | 62 | | |||
63 | /** | 63 | /** | ||
64 | * Load any services that are configured to be loaded | 64 | * Load any services that are configured to be loaded | ||
65 | */ | 65 | */ | ||
66 | void init(); | 66 | void init(); | ||
67 | 67 | | |||
68 | /** Returns enabled plugin factories for the given plugin type. | 68 | /** Returns enabled plugin factories for the given plugin type. | ||
69 | * | 69 | * | ||
70 | * This function will only return enable factories. | 70 | * This function will only return factories for enabled plugins. | ||
71 | * | | |||
72 | * Owner of the PluginFactory pointers is the PluginManager | | |||
73 | * and the pointers will only be valid while the PluginManager exists. | | |||
74 | */ | 71 | */ | ||
75 | QList<PluginFactory*> factories( Type type ) const; | 72 | QList<QSharedPointer<PluginFactory> > factories( Type type ) const; | ||
76 | 73 | | |||
77 | KPluginInfo::List plugins( Type type ) const; | 74 | KPluginInfo::List plugins( Type type ) const; | ||
78 | 75 | | |||
79 | QList<KPluginMetaData> enabledPlugins (Type type ) const; | 76 | QList<KPluginMetaData> enabledPlugins (Type type ) const; | ||
80 | 77 | | |||
81 | /** Check if any services were disabled and needs to be removed, or any | 78 | /** Check if any services were disabled and needs to be removed, or any | ||
82 | * that are hidden needs to be enabled | 79 | * that are hidden needs to be enabled | ||
83 | * | 80 | * | ||
Show All 9 Lines | 86 | private: | |||
93 | /** Returns true if the plugin is enabled. | 90 | /** Returns true if the plugin is enabled. | ||
94 | * This function will check the default enabled state, | 91 | * This function will check the default enabled state, | ||
95 | * the Amarok configuration state and the primary collection. | 92 | * the Amarok configuration state and the primary collection. | ||
96 | * | 93 | * | ||
97 | * @returns true if the plugin is enabled. | 94 | * @returns true if the plugin is enabled. | ||
98 | */ | 95 | */ | ||
99 | bool isPluginEnabled( const KPluginMetaData &plugin ) const; | 96 | bool isPluginEnabled( const KPluginMetaData &plugin ) const; | ||
100 | 97 | | |||
101 | /** Creates a factories for an info */ | 98 | /** Creates a factories for a plugin */ | ||
102 | PluginFactory* createFactory( const KPluginMetaData &pluginInfo ); | 99 | QSharedPointer<PluginFactory> createFactory( const KPluginMetaData &pluginInfo ); | ||
103 | 100 | | |||
104 | /// contains the names of all KPluginInfos that have factories created | 101 | /// contains the names of all KPluginInfos that have factories created | ||
105 | QVector<KPluginMetaData> m_plugins; | 102 | QVector<KPluginMetaData> m_plugins; | ||
106 | QHash<Type, QList<KPluginMetaData> > m_pluginsByType; | 103 | QHash<Type, QList<KPluginMetaData> > m_pluginsByType; | ||
107 | QHash<Type, QList<PluginFactory*> > m_factoriesByType; | 104 | QHash<Type, QList<QSharedPointer<PluginFactory> > > m_factoriesByType; | ||
108 | QHash<QString, PluginFactory*> m_factoryCreated; | 105 | QHash<QString, QSharedPointer<PluginFactory>> m_factoryCreated; | ||
109 | 106 | | |||
110 | static const int s_pluginFrameworkVersion; | 107 | static const int s_pluginFrameworkVersion; | ||
111 | static PluginManager *s_instance; | 108 | static PluginManager *s_instance; | ||
112 | 109 | | |||
113 | explicit PluginManager( QObject *parent = 0 ); | 110 | explicit PluginManager( QObject *parent = 0 ); | ||
114 | }; | 111 | }; | ||
115 | 112 | | |||
116 | } // namespace Plugins | 113 | } // namespace Plugins | ||
117 | 114 | | |||
118 | namespace The | 115 | namespace The | ||
119 | { | 116 | { | ||
120 | inline Plugins::PluginManager *pluginManager() { return Plugins::PluginManager::instance(); } | 117 | inline Plugins::PluginManager *pluginManager() { return Plugins::PluginManager::instance(); } | ||
121 | } | 118 | } | ||
122 | 119 | | |||
123 | #endif /* AMAROK_PLUGINMANAGER_H */ | 120 | #endif /* AMAROK_PLUGINMANAGER_H */ |