Commit cafed228 authored by Matthias Möller's avatar Matthias Möller
Browse files

removes pointer

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@15921 383ad7c9-94d9-4d36-a494-682f7c89f535
parent d0a22d22
...@@ -717,24 +717,15 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic ...@@ -717,24 +717,15 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
} }
// Check if a plugin has been loaded // Check if a plugin has been loaded
PluginInfo* info; PluginInfo info;
bool alreadyLoaded = false; int alreadyLoadedAt = -1;
for (uint k=0; k < plugins_.size(); k++) for (int k=0; k < plugins_.size(); k++)
{ {
if (plugins_[k].path == _filename) if (plugins_[k].path == _filename)
{ alreadyLoadedAt = k;
info = &plugins_[k];
alreadyLoaded = true;
break;
}
} }
if (!alreadyLoaded) info.status = PluginInfo::FAILED;
{ info.path = _filename;
plugins_.push_back(PluginInfo());
info = &plugins_.back();
}
info->status = PluginInfo::FAILED;
info->path = _filename;
QString supported; QString supported;
emit log(LOGOUT,tr("Location : \t %1").arg( _filename) ); emit log(LOGOUT,tr("Location : \t %1").arg( _filename) );
...@@ -744,12 +735,12 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic ...@@ -744,12 +735,12 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
if ( basePlugin ) { if ( basePlugin ) {
//set basic information about plugin //set basic information about plugin
info->name = basePlugin->name(); info.name = basePlugin->name();
info->rpcName = info->name.remove(" ").toLower(); info.rpcName = info.name.remove(" ").toLower();
info->description = basePlugin->description(); info.description = basePlugin->description();
QStringList additionalPlugins = OpenFlipperSettings().value("PluginControl/AdditionalPlugins", QStringList()).toStringList(); QStringList additionalPlugins = OpenFlipperSettings().value("PluginControl/AdditionalPlugins", QStringList()).toStringList();
info->buildIn = !additionalPlugins.contains(info->path); info.buildIn = !additionalPlugins.contains(info.path);
emit log(LOGOUT,tr("Found Plugin : \t %1").arg(basePlugin->name()) ); emit log(LOGOUT,tr("Found Plugin : \t %1").arg(basePlugin->name()) );
...@@ -768,7 +759,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic ...@@ -768,7 +759,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
if (_silent || OpenFlipper::Options::nogui() ){ //dont load the plugin if (_silent || OpenFlipper::Options::nogui() ){ //dont load the plugin
emit log(LOGWARN, tr("\t\t\t Already loaded from %1").arg( plugins_[k].path) ); emit log(LOGWARN, tr("\t\t\t Already loaded from %1").arg( plugins_[k].path) );
emit log(LOGOUT,"================================================================================"); emit log(LOGOUT,"================================================================================");
info->description = basePlugin->description() + tr(" *Already loaded.*"); info.description = basePlugin->description() + tr(" *Already loaded.*");
return; return;
}else{ //ask the user }else{ //ask the user
int ret = QMessageBox::question(coreWidget_, int ret = QMessageBox::question(coreWidget_,
...@@ -781,7 +772,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic ...@@ -781,7 +772,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
{ {
emit log(LOGWARN, tr("\t\t\t Already loaded from %1.").arg( plugins_[k].path)); emit log(LOGWARN, tr("\t\t\t Already loaded from %1.").arg( plugins_[k].path));
emit log(LOGOUT,"================================================================================"); emit log(LOGOUT,"================================================================================");
info->description = basePlugin->description() + tr(" *Already loaded.*"); info.description = basePlugin->description() + tr(" *Already loaded.*");
return; return;
} }
} }
...@@ -793,7 +784,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic ...@@ -793,7 +784,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
if ( dontLoadPlugins.contains(basePlugin->name(), Qt::CaseInsensitive) ) { if ( dontLoadPlugins.contains(basePlugin->name(), Qt::CaseInsensitive) ) {
emit log(LOGWARN,tr("OpenFlipper.ini prevented Plugin %1 from being loaded! ").arg( basePlugin->name() )); emit log(LOGWARN,tr("OpenFlipper.ini prevented Plugin %1 from being loaded! ").arg( basePlugin->name() ));
emit log(LOGOUT,"================================================================================"); emit log(LOGOUT,"================================================================================");
info->status = PluginInfo::BLOCKED; info.status = PluginInfo::BLOCKED;
return; return;
} }
...@@ -814,7 +805,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic ...@@ -814,7 +805,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
else { else {
emit log(LOGERR,tr("... failed. Plugin access denied.")); emit log(LOGERR,tr("... failed. Plugin access denied."));
emit log(LOGOUT,"================================================================================"); emit log(LOGOUT,"================================================================================");
info->description = basePlugin->description() + tr(" *Plugin access denied.*"); info.description = basePlugin->description() + tr(" *Plugin access denied.*");
// Abort here, as the plugin will not do anything else until correct authentication. // Abort here, as the plugin will not do anything else until correct authentication.
return; return;
} }
...@@ -825,11 +816,11 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic ...@@ -825,11 +816,11 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
supported = "BaseInterface "; supported = "BaseInterface ";
info->plugin = plugin; info.plugin = plugin;
if ( checkSlot(plugin,"version()") ) if ( checkSlot(plugin,"version()") )
info->version = basePlugin->version(); info.version = basePlugin->version();
else else
info->version = QString::number(-1); info.version = QString::number(-1);
if ( OpenFlipper::Options::nogui() ) { if ( OpenFlipper::Options::nogui() ) {
...@@ -971,7 +962,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic ...@@ -971,7 +962,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
supported = supported + "Logging "; supported = supported + "Logging ";
// Create intermediate logger class which will mangle the output // Create intermediate logger class which will mangle the output
PluginLogger* newlog = new PluginLogger(info->name); PluginLogger* newlog = new PluginLogger(info.name);
loggers_.push_back(newlog); loggers_.push_back(newlog);
connect(plugin,SIGNAL(log(Logtype, QString )),newlog,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection); connect(plugin,SIGNAL(log(Logtype, QString )),newlog,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection);
connect(plugin,SIGNAL(log(QString )),newlog,SLOT(slotLog(QString )),Qt::DirectConnection); connect(plugin,SIGNAL(log(QString )),newlog,SLOT(slotLog(QString )),Qt::DirectConnection);
...@@ -1082,7 +1073,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic ...@@ -1082,7 +1073,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
QWidget* widget = 0; QWidget* widget = 0;
if ( optionsPlugin->initializeOptionsWidget( widget ) ) { if ( optionsPlugin->initializeOptionsWidget( widget ) ) {
info->optionsWidget = widget; info.optionsWidget = widget;
if ( checkSlot(plugin,"applyOptions()") ) if ( checkSlot(plugin,"applyOptions()") )
connect(coreWidget_ , SIGNAL( applyOptions() ), connect(coreWidget_ , SIGNAL( applyOptions() ),
...@@ -2069,7 +2060,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic ...@@ -2069,7 +2060,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
); );
// Make plugin available for scripting // Make plugin available for scripting
QString scriptingName = info->name.remove(" ").toLower(); QString scriptingName = info.rpcName;
scriptEngine_.globalObject().setProperty(scriptingName, scriptInstance); scriptEngine_.globalObject().setProperty(scriptingName, scriptInstance);
...@@ -2081,7 +2072,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic ...@@ -2081,7 +2072,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
if ( checkSignal( plugin, it.name().toAscii() ) ) if ( checkSignal( plugin, it.name().toAscii() ) )
continue; continue;
info->rpcFunctions.push_back( it.name() ); info.rpcFunctions.push_back( it.name() );
scriptingFunctions_.push_back( scriptingName + "." + it.name() ); scriptingFunctions_.push_back( scriptingName + "." + it.name() );
...@@ -2093,7 +2084,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic ...@@ -2093,7 +2084,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
supported = supported + "Scripting "; supported = supported + "Scripting ";
// Create intermediate wrapper class which will mangle the call information // Create intermediate wrapper class which will mangle the call information
ScriptingWrapper* newScript = new ScriptingWrapper(info->rpcName); ScriptingWrapper* newScript = new ScriptingWrapper(info.rpcName);
scriptingWrappers_.push_back(newScript); scriptingWrappers_.push_back(newScript);
//========= Part one, Scriptinfos via wrapper to core and than to scipting Plugin ========== //========= Part one, Scriptinfos via wrapper to core and than to scipting Plugin ==========
...@@ -2159,7 +2150,11 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic ...@@ -2159,7 +2150,11 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
//======================================================================================== //========================================================================================
//======================================================================================== //========================================================================================
info->status = PluginInfo::LOADED; info.status = PluginInfo::LOADED;
if (alreadyLoadedAt != -1)
plugins_[alreadyLoadedAt] = info;
else
plugins_.push_back(info);
// Initialize Plugin // Initialize Plugin
if ( basePlugin ) { if ( basePlugin ) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment