StelModuleMgr.cpp   StelModuleMgr.cpp 
skipping to change at line 38 skipping to change at line 38
#include "StelModule.hpp" #include "StelModule.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelPluginInterface.hpp" #include "StelPluginInterface.hpp"
#include "StelIniParser.hpp" #include "StelIniParser.hpp"
StelModuleMgr::StelModuleMgr() StelModuleMgr::StelModuleMgr()
{ {
// Initialize empty call lists for each possible actions // Initialize empty call lists for each possible actions
callOrders[StelModule::ActionDraw]=QList<StelModule*>(); callOrders[StelModule::ActionDraw]=QList<StelModule*>();
callOrders[StelModule::ActionUpdate]=QList<StelModule*>(); callOrders[StelModule::ActionUpdate]=QList<StelModule*>();
callOrders[StelModule::ActionHangleMouseClicks]=QList<StelModule*>() ; callOrders[StelModule::ActionHandleMouseClicks]=QList<StelModule*>() ;
callOrders[StelModule::ActionHandleMouseMoves]=QList<StelModule*>(); callOrders[StelModule::ActionHandleMouseMoves]=QList<StelModule*>();
callOrders[StelModule::ActionHandleKeys]=QList<StelModule*>(); callOrders[StelModule::ActionHandleKeys]=QList<StelModule*>();
callingListsToRegenerate = false; callingListsToRegenerate = false;
} }
StelModuleMgr::~StelModuleMgr() StelModuleMgr::~StelModuleMgr()
{ {
} }
// Regenerate calling lists if necessary // Regenerate calling lists if necessary
skipping to change at line 76 skipping to change at line 76
modules.insert(m->objectName(), m); modules.insert(m->objectName(), m);
m->setParent(this); m->setParent(this);
if (fgenerateCallingLists) if (fgenerateCallingLists)
generateCallingLists(); generateCallingLists();
} }
/************************************************************************* /*************************************************************************
Unregister and delete a StelModule. Unregister and delete a StelModule.
*************************************************************************/ *************************************************************************/
void StelModuleMgr::unloadModule(const QString& moduleID) void StelModuleMgr::unloadModule(const QString& moduleID, bool alsoDelete)
{ {
StelModule* m = getModule(moduleID); StelModule* m = getModule(moduleID);
if (!m) if (!m)
{ {
qWarning() << "Module \"" << moduleID << "\" is not loaded." ; qWarning() << "Module \"" << moduleID << "\" is not loaded." ;
return; return;
} }
modules.remove(moduleID); modules.remove(moduleID);
m->setParent(NULL);
callingListsToRegenerate = true; callingListsToRegenerate = true;
m->deleteLater(); if (alsoDelete)
m->deleteLater();
} }
/************************************************************************* /*************************************************************************
Get the corresponding module or NULL if can't find it. Get the corresponding module or NULL if can't find it.
*************************************************************************/ *************************************************************************/
StelModule* StelModuleMgr::getModule(const QString& moduleID) StelModule* StelModuleMgr::getModule(const QString& moduleID)
{ {
QMap<QString, StelModule*>::const_iterator iter = modules.find(modul eID); QMap<QString, StelModule*>::const_iterator iter = modules.find(modul eID);
if (iter==modules.end()) if (iter==modules.end())
{ {
skipping to change at line 122 skipping to change at line 124
#ifdef MACOSX #ifdef MACOSX
moduleFullPath += ".dylib"; moduleFullPath += ".dylib";
#else #else
moduleFullPath += ".so"; moduleFullPath += ".so";
#endif #endif
#endif #endif
try try
{ {
moduleFullPath = StelApp::getInstance().getFileMgr().findFil e(moduleFullPath, StelFileMgr::File); moduleFullPath = StelApp::getInstance().getFileMgr().findFil e(moduleFullPath, StelFileMgr::File);
} }
catch (std::exception& e) catch (std::runtime_error& e)
{ {
qWarning() << "ERROR while locating plugin path: " << e.what (); qWarning() << "ERROR while locating plugin path: " << e.what ();
} }
QPluginLoader loader(moduleFullPath); QPluginLoader loader(moduleFullPath);
if (!loader.load()) if (!loader.load())
{ {
qWarning() << "Couldn't load the dynamic library: " << modul eFullPath << ": " << loader.errorString(); qWarning() << "Couldn't load the dynamic library: " << modul eFullPath << ": " << loader.errorString();
qWarning() << "Plugin " << moduleID << " will not be loaded. "; qWarning() << "Plugin " << moduleID << " will not be loaded. ";
return NULL; return NULL;
skipping to change at line 207 skipping to change at line 209
{ {
QList<StelModuleMgr::PluginDescriptor> result; QList<StelModuleMgr::PluginDescriptor> result;
QSet<QString> moduleDirs; QSet<QString> moduleDirs;
StelFileMgr& fileMan(StelApp::getInstance().getFileMgr()); StelFileMgr& fileMan(StelApp::getInstance().getFileMgr());
try try
{ {
moduleDirs = fileMan.listContents("modules",StelFileMgr::Dir ectory); moduleDirs = fileMan.listContents("modules",StelFileMgr::Dir ectory);
} }
catch(std::exception& e) catch(std::runtime_error& e)
{ {
qWarning() << "ERROR while trying list list modules:" << e.w hat(); qWarning() << "ERROR while trying list list modules:" << e.w hat();
} }
for (QSet<QString>::iterator dir=moduleDirs.begin(); dir!=moduleDirs .end(); dir++) for (QSet<QString>::iterator dir=moduleDirs.begin(); dir!=moduleDirs .end(); dir++)
{ {
try try
{ {
StelModuleMgr::PluginDescriptor mDesc; StelModuleMgr::PluginDescriptor mDesc;
QSettings pd(fileMan.findFile("modules/" + *dir + "/ module.ini"), StelIniFormat); QSettings pd(fileMan.findFile("modules/" + *dir + "/ module.ini"), StelIniFormat);
mDesc.key = *dir; mDesc.key = *dir;
mDesc.name = pd.value("module/name").toString(); mDesc.name = pd.value("module/name").toString();
mDesc.author = pd.value("module/author").toString(); mDesc.author = pd.value("module/author").toString();
mDesc.contact = pd.value("module/contact").toString( ); mDesc.contact = pd.value("module/contact").toString( );
mDesc.description = pd.value("module/description").t oString(); mDesc.description = pd.value("module/description").t oString();
mDesc.loadAtStartup = pd.value("module/load_at_start up").toBool(); mDesc.loadAtStartup = pd.value("module/load_at_start up").toBool();
result.push_back(mDesc); result.push_back(mDesc);
} }
catch (std::exception& e) catch (std::runtime_error& e)
{ {
qWarning() << "WARNING: unable to successfully read module.ini file from plugin " << *dir; qWarning() << "WARNING: unable to successfully read module.ini file from plugin " << *dir;
} }
} }
return result; return result;
} }
 End of changes. 7 change blocks. 
6 lines changed or deleted 8 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/