21 #ifndef __qSlicerAbstractModuleFactoryManager_h 22 #define __qSlicerAbstractModuleFactoryManager_h 29 #include <ctkAbstractFileBasedFactory.h> 31 #include "qSlicerBaseQTCoreExport.h" 35 class qSlicerAbstractModuleFactoryManagerPrivate;
78 Q_PROPERTY(QStringList searchPaths READ searchPaths WRITE setSearchPaths)
81 Q_PROPERTY(QStringList modulesToIgnore READ modulesToIgnore WRITE setModulesToIgnore NOTIFY modulesToIgnoreChanged)
97 virtual void printAdditionalInfo();
116 void registerFactory(qSlicerModuleFactory* factory,
int priority = 0);
117 void unregisterFactory(qSlicerModuleFactory* factory);
118 void unregisterFactories();
120 void setSearchPaths(
const QStringList& searchPaths);
121 QStringList searchPaths()
const;
125 inline void addSearchPaths(
const QStringList& paths);
127 inline void addSearchPath(
const QString& path);
131 inline void removeSearchPaths(
const QStringList& paths);
134 inline void removeSearchPath(
const QString& path);
136 void setExplicitModules(
const QStringList& moduleNames);
137 QStringList explicitModules()
const;
144 void setModulesToIgnore(
const QStringList& modulesNames);
145 QStringList modulesToIgnore()
const;
149 inline void addModuleToIgnore(
const QString& moduleName);
153 inline void removeModuleToIgnore(
const QString& moduleName);
157 QStringList ignoredModuleNames()
const;
161 void registerModules();
163 Q_INVOKABLE
void registerModule(
const QFileInfo& file);
166 Q_INVOKABLE QStringList registeredModuleNames()
const;
169 Q_INVOKABLE
bool isRegistered(
const QString& name)
const;
172 virtual void instantiateModules();
175 Q_INVOKABLE QStringList instantiatedModuleNames()
const;
178 Q_INVOKABLE
bool isInstantiated(
const QString& name)
const;
184 void uninstantiateModules();
187 void setVerboseModuleDiscovery(
bool value);
192 QStringList dependentModules(
const QString& module)
const;
197 QStringList moduleDependees(
const QString& module)
const;
202 void modulesRegistered(
const QStringList& moduleNames);
203 void moduleRegistered(
const QString& moduleName);
205 void explicitModulesChanged(
const QStringList& moduleNames);
207 void modulesToIgnoreChanged(
const QStringList& moduleNames);
208 void moduleIgnored(
const QString& moduleName);
210 void modulesInstantiated(
const QStringList& moduleNames);
211 void moduleInstantiated(
const QString& moduleName);
213 void modulesAboutToBeUninstantiated(
const QStringList& moduleNames);
214 void moduleAboutToBeUninstantiated(
const QString& moduleName);
216 void modulesUninstantiated(
const QStringList& moduleNames);
217 void moduleUninstantiated(
const QString& moduleName);
223 void setIsVerbose(
bool flag);
224 bool isVerbose()
const;
226 QScopedPointer<qSlicerAbstractModuleFactoryManagerPrivate>
d_ptr;
228 void registerModules(
const QString& directoryPath);
234 virtual void uninstantiateModule(
const QString& moduleName);
244 this->setSearchPaths(this->searchPaths() << paths);
250 this->setSearchPaths(this->searchPaths() << path);
256 foreach(
const QString& path, paths)
258 this->removeSearchPath(path);
265 QStringList newSearchPaths = this->searchPaths();
266 newSearchPaths.removeAll(path);
267 this->setSearchPaths(newSearchPaths);
273 QStringList modules = this->modulesToIgnore();
274 if (modules.contains(moduleName))
278 modules << moduleName;
279 this->setModulesToIgnore(modules);
285 QStringList modules = this->modulesToIgnore();
286 modules.removeAll(moduleName);
287 this->setModulesToIgnore(modules);
void removeSearchPath(const QString &path)
Utility function that removes a path from the current searchPaths list.
ctkAbstractFactory< qSlicerAbstractCoreModule > qSlicerModuleFactory
void removeSearchPaths(const QStringList &paths)
ctkAbstractFileBasedFactory< qSlicerAbstractCoreModule > qSlicerFileBasedModuleFactory
qSlicerAbstractCoreModule is the base class of any module in Slicer.
void addModuleToIgnore(const QString &moduleName)
void removeModuleToIgnore(const QString &moduleName)
void addSearchPaths(const QStringList &paths)
QScopedPointer< qSlicerAbstractModuleFactoryManagerPrivate > d_ptr
void addSearchPath(const QString &path)
Utility function that adds a path to the current searchPaths list.