Home · All Namespaces · All Classes · Functions · Coding Style · Plugins · File Structure

core/StelModuleMgr.hpp

00001 /*
00002  * Stellarium
00003  * Copyright (C) 2006 Fabien Chereau
00004  * 
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  * 
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
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 ) 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_

Generated on Mon Feb 2 17:23:47 2009 for Stellarium by  doxygen 1.5.5