diff options
author | Thomas Preud'homme <robotux@celest.fr> | 2013-03-21 11:01:59 +0100 |
---|---|---|
committer | Thomas Preud'homme <robotux@celest.fr> | 2013-03-21 11:01:59 +0100 |
commit | e297dbd8052ef4e66f069e2dd1865ae7fa8af28e (patch) | |
tree | 342fea0a2f6f33b8b62dad2d1729f8209da1a1ba /PluginsManager.cpp | |
parent | 8f9f382e1c97cab2e72e97495650c73ac4b97314 (diff) |
Imported Upstream version 0.3.1.0
Diffstat (limited to 'PluginsManager.cpp')
-rw-r--r-- | PluginsManager.cpp | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/PluginsManager.cpp b/PluginsManager.cpp index 4dc9157..e3c71ec 100644 --- a/PluginsManager.cpp +++ b/PluginsManager.cpp @@ -29,10 +29,10 @@ PluginsManager::PluginsManager() englishPluginType << "CopyEngine" << "Languages" << "Listener" << "PluginLoader" << "SessionLoader" << "Themes"; //catPlugin << tr("CopyEngine") << tr("Languages") << tr("Listener") << tr("PluginLoader") << tr("SessionLoader") << tr("Themes"); importingPlugin=false; - connect(&decodeThread, SIGNAL(decodedIsFinish()), this, SLOT(decodingFinished())); - connect(checkPluginThread, SIGNAL(authentifiedPath(QString)), this, SLOT(newAuthPath(QString))); - connect(this, SIGNAL(finished()), this, SLOT(post_operation())); - connect(this, SIGNAL(newLanguageLoaded()), &pluginInformationWindows, SLOT(retranslateInformation())); + connect(&decodeThread, SIGNAL(decodedIsFinish()), this, SLOT(decodingFinished()),Qt::QueuedConnection); + connect(checkPluginThread, SIGNAL(authentifiedPath(QString)), this, SLOT(newAuthPath(QString)),Qt::QueuedConnection); + connect(this, SIGNAL(finished()), this, SLOT(post_operation()),Qt::QueuedConnection); + connect(this, SIGNAL(newLanguageLoaded()), &pluginInformationWindows, SLOT(retranslateInformation()),Qt::QueuedConnection); // connect(this, SIGNAL(pluginListingIsfinish()), options,SLOT(setInterfaceValue())); //load the plugins list /// \bug bug when I put here: moveToThread(this);, due to the direction connection to remove the plugin @@ -100,9 +100,9 @@ void PluginsManager::run() QDir dir(pluginComposed); if(stopIt) return; + ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"search plugin into: "+pluginComposed); if(dir.exists()) { - ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"search plugin into: "+pluginComposed); foreach(QString dirName, dir.entryList(QDir::Dirs|QDir::NoDotAndDotDot)) { if(stopIt) @@ -164,11 +164,12 @@ QString PluginsManager::categoryToTranslation(const PluginType &category) bool PluginsManager::isSamePlugin(const PluginsAvailable &pluginA,const PluginsAvailable &pluginB) { - if(pluginA.category!=pluginB.category) - return false; + /*if(pluginA.category!=pluginB.category) + return false;*/ + //only this test should be suffisent if(pluginA.path!=pluginB.path) return false; - if(pluginA.name!=pluginB.name) + /*if(pluginA.name!=pluginB.name) return false; if(pluginA.writablePath!=pluginB.writablePath) return false; @@ -177,7 +178,7 @@ bool PluginsManager::isSamePlugin(const PluginsAvailable &pluginA,const PluginsA if(pluginA.version!=pluginB.version) return false; if(pluginA.informations!=pluginB.informations) - return false; + return false;*/ return true; } @@ -215,6 +216,8 @@ bool PluginsManager::loadPluginInformation(const QString &path) } editionSemList.acquire(); pluginsList << tempPlugin; + if(tempPlugin.errorString=="") + pluginsListIndexed.insert(tempPlugin.category,tempPlugin); editionSemList.release(); if(tempPlugin.errorString=="") { @@ -283,7 +286,7 @@ void PluginsManager::loadPluginXml(PluginsAvailable * thePlugin,const QByteArray else if(tempCat=="Themes") thePlugin->category=PluginType_Themes; else - thePlugin->errorString="Unknow category: "+(int)thePlugin->category; + thePlugin->errorString="Unknow category: "+QString::number((int)thePlugin->category); if(thePlugin->errorString.isEmpty()) { if(thePlugin->category!=PluginType_Languages) @@ -578,15 +581,7 @@ bool PluginsManager::compareVersion(const QString &versionA,const QString &sign, QList<PluginsAvailable> PluginsManager::getPluginsByCategory(const PluginType &category) { - QList<PluginsAvailable> list; - int index=0,loop_size=pluginsList.size(); - while(index<loop_size) - { - if(pluginsList.at(index).category==category && pluginsList.at(index).errorString=="") - list<<pluginsList.at(index); - index++; - } - return list; + return pluginsListIndexed.values(category); } QList<PluginsAvailable> PluginsManager::getPlugins() @@ -603,7 +598,6 @@ QList<PluginsAvailable> PluginsManager::getPlugins() } /// \brief show the information -/// \todo pass plugin info void PluginsManager::showInformation(const QString &path) { ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start"); @@ -636,7 +630,6 @@ void PluginsManager::removeThePluginSelected(const QString &path) if(pluginsList.at(index).path==path) { QMessageBox::StandardButton reply; - /// \todo check if previous version as internal, if yes ask if switch to it, else remove and do marked to disable the internal version too // if(pluginsList.at(index).internalVersionAlternative.isEmpty()) reply = QMessageBox::question(NULL,tr("Remove %1").arg(pluginsList.at(index).name),tr("Are you sure about removing \"%1\" in version %2?").arg(pluginsList.at(index).name).arg(pluginsList.at(index).version),QMessageBox::Yes|QMessageBox::No,QMessageBox::No); // else @@ -649,8 +642,9 @@ void PluginsManager::removeThePluginSelected(const QString &path) if(!ResourcesManager::removeFolder(pluginsList.at(index).path)) { ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"unable to remove the plugin"); - QMessageBox::critical(NULL,tr("Error"),tr("Error while the removing plugin, please check right of remove on the folder: \n%1").arg(pluginsList.at(index).path)); + QMessageBox::critical(NULL,tr("Error"),tr("Error while the removing plugin, please check the rights on the folder: \n%1").arg(pluginsList.at(index).path)); } + pluginsListIndexed.remove(pluginsList.at(index).category,pluginsList.at(index)); pluginsList.removeAt(index); checkDependencies(); } |