00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _STELMODULEMGR_HPP_
00021 #define _STELMODULEMGR_HPP_
00022
00023 #include <QObject>
00024 #include <QMap>
00025 #include <QList>
00026 #include "StelModule.hpp"
00027
00030 #define GETSTELMODULE( m ) (( m *)StelApp::getInstance().getModuleMgr().getModule( #m ))
00031
00035 class StelModuleMgr : public QObject
00036 {
00037 Q_OBJECT
00038
00039 public:
00040 StelModuleMgr();
00041 ~StelModuleMgr();
00042
00044 void update();
00045
00048 void registerModule(StelModule* m, bool generateCallingLists=false);
00049
00053 void unloadModule(const QString& moduleID, bool alsoDelete=true);
00054
00059 StelModule* loadPlugin(const QString& moduleID);
00060
00062 void unloadAllPlugins();
00063
00066 StelModule* getModule(const QString& moduleID);
00067
00069 QList<StelModule*> getAllModules() {return modules.values();}
00070
00073 void generateCallingLists();
00074
00076 const QList<StelModule*>& getCallOrders(StelModule::StelModuleActionName action)
00077 {
00078 return callOrders[action];
00079 }
00080
00082 struct PluginDescriptor
00083 {
00085 QString key;
00086 QString name;
00087 QString author;
00088 QString contact;
00089 QString description;
00091 bool loadAtStartup;
00092 };
00093
00095 static QList<PluginDescriptor> getPluginsList();
00096
00097 private:
00099 QMap<QString, StelModule*> modules;
00100
00102 QMap<StelModule::StelModuleActionName, QList<StelModule*> > callOrders;
00103
00105 bool callingListsToRegenerate;
00106 };
00107
00108 #endif // _STELMODULEMGR_HPP_