# HG changeset patch # User Jeandet Alexis # Date 2015-09-28 18:09:16 # Node ID 11a895cff789ec536c7cd9e33f0c194465880649 # Parent bb6776ca85e69aa992fa2b4af35faa7ceb4b7cb7 Some more cleaning. Removed useless function Converted some QDebug calls to SocExplorerEngine::message calls Added static void message(QObject* sender,const QString& message,int debugLevel=0); and static void message(const QString& sender,const QString& message,int debugLevel=0); diff --git a/src/SocExplorerEngine/engine/socexplorerengine.cpp b/src/SocExplorerEngine/engine/socexplorerengine.cpp --- a/src/SocExplorerEngine/engine/socexplorerengine.cpp +++ b/src/SocExplorerEngine/engine/socexplorerengine.cpp @@ -289,13 +289,29 @@ void SocExplorerEngine::removeSOC(socexp delete soc; } + void SocExplorerEngine::message(socexplorerplugin *sender, const QString &message, int debugLevel) { + if(!_self) + init(); + SocExplorerEngine::message(sender->instanceName(),message,debugLevel); +} + +void SocExplorerEngine::message(QObject *sender, const QString &message, int debugLevel) +{ + if(!_self) + init(); + SocExplorerEngine::message(sender->objectName(),message,debugLevel); +} + +void SocExplorerEngine::message(const QString &sender, const QString &message, int debugLevel) +{ // TODO add multi output message manager IE also log in files + static QTextStream SocExplorerEngineStdout(stdout); if(!_self) init(); if(loglvl>=debugLevel) - qDebug()<< QTime::currentTime().toString()+" " + sender->instanceName()+":"+message; + SocExplorerEngineStdout << QTime::currentTime().toString()+" " + sender+":"+message << endl; } void SocExplorerEngine::setLogLevel(int level) diff --git a/src/SocExplorerEngine/engine/socexplorerengine.h b/src/SocExplorerEngine/engine/socexplorerengine.h --- a/src/SocExplorerEngine/engine/socexplorerengine.h +++ b/src/SocExplorerEngine/engine/socexplorerengine.h @@ -109,6 +109,8 @@ public: static void addSOC(socexplorerplugin* rootPlugin); static void removeSOC(socexplorerplugin* rootPlugin); static void message(socexplorerplugin* sender,const QString& message,int debugLevel=0); + static void message(QObject* sender,const QString& message,int debugLevel=0); + static void message(const QString& sender,const QString& message,int debugLevel=0); static void setLogLevel(int level); static bool isSocLitleEndian(socexplorerplugin* plugin); signals: diff --git a/src/SocExplorerEngine/engine/socexplorersettings.cpp b/src/SocExplorerEngine/engine/socexplorersettings.cpp --- a/src/SocExplorerEngine/engine/socexplorersettings.cpp +++ b/src/SocExplorerEngine/engine/socexplorersettings.cpp @@ -1,6 +1,6 @@ /*------------------------------------------------------------------------------ -- This file is a part of the SocExplorer Software --- Copyright (C) 2012, Plasma Physics Laboratory - CNRS +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/src/SocExplorerEngine/pluginloader/pluginloader.cpp b/src/SocExplorerEngine/pluginloader/pluginloader.cpp --- a/src/SocExplorerEngine/pluginloader/pluginloader.cpp +++ b/src/SocExplorerEngine/pluginloader/pluginloader.cpp @@ -13,6 +13,8 @@ #ifdef SOCEXPLORER_CUSTOM_PLUGIN_LOADER #include "unix/unixpluginloader.h" #endif +#include +#include pluginloader* pluginloader::_self = NULL; PluginsCache* pluginloader::_cache = NULL; @@ -27,38 +29,6 @@ pluginloader::pluginloader() scanFolders(); } - -QStringList pluginloader::readFoldersList(const QStringList confFiles) -{ - QDir testDir; - QStringList folders; - QFile confFile; - for(int i=0;iappend(fileInfo.fileName(),fileInfo.path(),_getlibName(fileInfo.filePath()),_getlibPID(fileInfo.filePath()),_getlibPID(fileInfo.filePath())); @@ -90,7 +61,7 @@ int pluginloader::p_checklibraryQlib(con lib->load(); if(!lib->isLoaded()) { - qDebug()<errorString(); + SocExplorerEngine::message("pluginloader::p_checklibraryQlib",lib->errorString(),3); lib->~QLibrary(); lib = new QLibrary(fileName); lib->load(); diff --git a/src/SocExplorerEngine/pluginloader/pluginloader.h b/src/SocExplorerEngine/pluginloader/pluginloader.h --- a/src/SocExplorerEngine/pluginloader/pluginloader.h +++ b/src/SocExplorerEngine/pluginloader/pluginloader.h @@ -81,7 +81,6 @@ private: int p_checklibraryCustom(const QString fileName); socexplorerplugin* p_newsocexplorerpluginQlib(const QString Name); socexplorerplugin* p_newsocexplorerpluginCustom(const QString Name); - static QStringList readFoldersList(const QStringList confFiles); static QString* _cacheLookup(const QString Name); static QString _getlibName(const QString fileName); static int _getlibPID(const QString fileName); diff --git a/src/SocExplorerEngine/pluginloader/pluginscache.cpp b/src/SocExplorerEngine/pluginloader/pluginscache.cpp --- a/src/SocExplorerEngine/pluginloader/pluginscache.cpp +++ b/src/SocExplorerEngine/pluginloader/pluginscache.cpp @@ -1,5 +1,6 @@ #include "pluginscache.h" #include +#include PluginsCacheItem::PluginsCacheItem(const QString &fileName, const QString &path, const QString &pluginName, int VID, int PID) { @@ -56,12 +57,12 @@ void PluginsCache::append(const QString { if(this->items->at(i)->compare(item)) { - qDebug()<< fileName << "already in the cache"; + SocExplorerEngine::message("PluginsCache",fileName + " already in the cache",3); delete item; return; } } - qDebug()<< fileName << "added to cache"; + SocExplorerEngine::message("PluginsCache",fileName + " added to cache",3); this->items->append(item); } diff --git a/src/SocExplorerEngine/pluginloader/unix/unixpluginloader.cpp b/src/SocExplorerEngine/pluginloader/unix/unixpluginloader.cpp --- a/src/SocExplorerEngine/pluginloader/unix/unixpluginloader.cpp +++ b/src/SocExplorerEngine/pluginloader/unix/unixpluginloader.cpp @@ -1,15 +1,16 @@ #include "unixpluginloader.h" #include #include +#include unixPluginLoader::unixPluginLoader(const QString &libPath) { - qDebug()<<"try to open "+libPath; + SocExplorerEngine::message("unixPluginLoader::unixPluginLoader","try to open "+libPath,3); dlHandle = dlopen(libPath.toStdString().c_str(),RTLD_LAZY|RTLD_GLOBAL); if(dlHandle==NULL) - qDebug() << "Failed"<< dlerror(); + SocExplorerEngine::message("unixPluginLoader::unixPluginLoader",QString("Failed ") + dlerror(),3); else - qDebug() << "Success"; + SocExplorerEngine::message("unixPluginLoader::unixPluginLoader","Success " ,3); this->libPath = libPath; } @@ -17,12 +18,12 @@ void *unixPluginLoader::resolve(const QS { if(dlHandle!=NULL) { - qDebug()<<"try to resolve "+symbol+" in "+libPath; + SocExplorerEngine::message("unixPluginLoader::resolve","try to resolve "+symbol+" in "+libPath ,3); void* sym = dlsym (dlHandle, symbol.toStdString().c_str()); if(sym==NULL) - qDebug() << "Failed"<< dlerror(); + SocExplorerEngine::message("unixPluginLoader::resolve",QString("Failed")+ dlerror() ,3); else - qDebug() << "Success"; + SocExplorerEngine::message("unixPluginLoader::resolve","Success",3); return sym; } return NULL; @@ -33,6 +34,6 @@ void unixPluginLoader::close() if(dlHandle!=NULL) { dlclose(dlHandle); - qDebug() << dlerror(); + SocExplorerEngine::message("unixPluginLoader::close",dlerror(),3); } }