diff options
382 files changed, 22536 insertions, 27645 deletions
diff --git a/CliParser.cpp b/CliParser.cpp index e2a9780..7d375ac 100644 --- a/CliParser.cpp +++ b/CliParser.cpp @@ -4,50 +4,65 @@ \licence GPL3, see the file COPYING */ #include "CliParser.h" +#include "cpp11addition.h" +#include "Core.h" #include <QDebug> CliParser::CliParser(QObject *parent) : QObject(parent) { + //this->core=core; } /** \brief method to parse the ultracopier arguments \param ultracopierArguments the argument list \param external true if the arguments come from other instance of ultracopier */ -void CliParser::cli(const QStringList &ultracopierArguments,const bool &external,const bool &onlyCheck) +void CliParser::cli(const std::vector<std::string> &ultracopierArguments,const bool &external,const bool &onlyCheck) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("ultracopierArguments: ")+ultracopierArguments.join(QStringLiteral(";"))); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"ultracopierArguments: "+stringimplode(ultracopierArguments,';')); if(ultracopierArguments.size()==1) { if(external) - QMessageBox::warning(NULL,tr("Warning"),tr("Ultracopier is already running, right click on its system tray icon (near the clock) to use it")); + { + //if(!core->startNewTransferOneUniqueCopyEngine()) + { + #ifdef Q_OS_WIN32 + QString message(tr("Ultracopier is already running, right click on its system tray icon (near the clock) to use it or just copy and paste")); + #else + QString message(tr("Ultracopier is already running, view all notification area icons (near the clock), right click on its system tray icon to use it or just copy and paste")); + #endif + + QMessageBox::warning(NULL,tr("Warning"),message); + showSystrayMessage(message.toStdString()); + } + } // else do nothing, is normal starting without arguements return; } else if(ultracopierArguments.size()==2) { - if(ultracopierArguments.last()==QStringLiteral("quit")) + if(ultracopierArguments.back()=="quit") { if(onlyCheck) return; QCoreApplication::exit(); return; } - else if(ultracopierArguments.last()==QStringLiteral("--help")) + else if(ultracopierArguments.back()=="--help") { showHelp(false); return; } - else if(ultracopierArguments.last()==QStringLiteral("--options")) + else if(ultracopierArguments.back()=="--options") { emit showOptions(); return; } - else if(ultracopierArguments.last().endsWith(QStringLiteral(".urc"))) + else if(stringEndsWith(ultracopierArguments.back(),".urc")) { - tryLoadPlugin(ultracopierArguments.last()); + tryLoadPlugin(ultracopierArguments.back()); return; } ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Command line not understand"); @@ -56,41 +71,41 @@ void CliParser::cli(const QStringList &ultracopierArguments,const bool &external } else if(ultracopierArguments.size()==3) { - if(ultracopierArguments.at(1)==QStringLiteral("Transfer-list")) + if(ultracopierArguments.at(1)=="Transfer-list") { if(onlyCheck) return; - QFile transferFile(ultracopierArguments.last()); + QFile transferFile(QString::fromStdString(ultracopierArguments.back())); if(transferFile.open(QIODevice::ReadOnly)) { QString content; QByteArray data=transferFile.readLine(64); if(data.size()<=0) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Problem reading file, or file size is 0")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Problem reading file, or file size is 0"); QMessageBox::warning(NULL,tr("Warning"),tr("Problem reading file, or file size is 0")); transferFile.close(); return; } content=QString::fromUtf8(data); - QStringList transferListArguments=content.split(';'); - transferListArguments[3].remove('\n'); + std::vector<std::string> transferListArguments=stringsplit(content.toStdString(),';'); + transferListArguments[3].erase(std::remove(transferListArguments[3].begin(), transferListArguments[3].end(),'\n'),transferListArguments[3].end()); if(transferListArguments.at(0)!="Ultracopier" || transferListArguments.at(1)!="Transfer-list" || (transferListArguments.at(2)!="Transfer" && transferListArguments.at(2)!="Copy" && transferListArguments.at(2)!="Move") ) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QString("This file is not supported transfer list")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"This file is not supported transfer list"); QMessageBox::warning(NULL,tr("Warning"),tr("This file is not supported transfer list")); transferFile.close(); return; } transferFile.close(); - emit newTransferList(transferListArguments.at(3),transferListArguments.at(2),ultracopierArguments.last()); + emit newTransferList(transferListArguments.at(3),transferListArguments.at(2),ultracopierArguments.back()); } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QString("Unable to open the transfer list file: %1").arg(transferFile.errorString())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to open the transfer list file: "+transferFile.errorString().toStdString()); QMessageBox::warning(NULL,tr("Warning"),tr("Unable to open the transfer list file")); return; } @@ -102,51 +117,51 @@ void CliParser::cli(const QStringList &ultracopierArguments,const bool &external } else if(ultracopierArguments.size()>3) { - if(ultracopierArguments.at(1)==QStringLiteral("Copy") || ultracopierArguments.at(1)==QStringLiteral("cp")) + if(ultracopierArguments.at(1)=="Copy" || ultracopierArguments.at(1)=="cp") { if(onlyCheck) return; - QStringList transferList=ultracopierArguments; - transferList.removeFirst(); - transferList.removeFirst(); - if(transferList.last()=="?") + std::vector<std::string> transferList=ultracopierArguments; + transferList.erase(transferList.cbegin()); + transferList.erase(transferList.cbegin()); + if(transferList.back()=="?") { - transferList.removeLast(); + transferList.erase(transferList.cbegin()); emit newCopyWithoutDestination(transferList); } else { - QString destination=transferList.last(); - transferList.removeLast(); + std::string destination=transferList.back(); + transferList.erase(transferList.cbegin()); emit newCopy(transferList,destination); } return; } - else if(ultracopierArguments.at(1)==QStringLiteral("Move") || ultracopierArguments.at(1)==QStringLiteral("mv")) + else if(ultracopierArguments.at(1)=="Move" || ultracopierArguments.at(1)=="mv") { if(onlyCheck) return; - QStringList transferList=ultracopierArguments; - transferList.removeFirst(); - transferList.removeFirst(); - if(transferList.last()=="?") + std::vector<std::string> transferList=ultracopierArguments; + transferList.erase(transferList.cbegin()); + transferList.erase(transferList.cbegin()); + if(transferList.back()=="?") { - transferList.removeLast(); + transferList.erase(transferList.cbegin()); emit newMoveWithoutDestination(transferList); } else { - QString destination=transferList.last(); - transferList.removeLast(); + std::string destination=transferList.back(); + transferList.erase(transferList.cbegin()); emit newMove(transferList,destination); } return; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Command line not understand")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Command line not understand"); showHelp(); return; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Command line not understand")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Command line not understand"); showHelp(); } diff --git a/CliParser.h b/CliParser.h index a2f3617..edcf115 100644 --- a/CliParser.h +++ b/CliParser.h @@ -13,37 +13,43 @@ #include "Environment.h" +class Core; /** \brief class to parse all command line options */ class CliParser : public QObject { Q_OBJECT public: - explicit CliParser(QObject *parent = 0); + explicit CliParser(/*Core *core,*/QObject *parent = 0); public slots: /** \brief method to parse the ultracopier arguments \param ultracopierArguments the argument list \param external true if the arguments come from other instance of ultracopier */ - void cli(const QStringList &ultracopierArguments,const bool &external,const bool &onlyCheck); + void cli(const std::vector<std::string> &ultracopierArguments,const bool &external,const bool &onlyCheck); signals: /** new copy without destination have been pased by the CLI */ - void newCopyWithoutDestination(QStringList sources) const; + void newCopyWithoutDestination(std::vector<std::string> sources) const; /** new copy with destination have been pased by the CLI */ - void newCopy(QStringList sources,QString destination) const; + void newCopy(std::vector<std::string> sources,std::string destination) const; /** new move without destination have been pased by the CLI */ - void newMoveWithoutDestination(QStringList sources) const; + void newMoveWithoutDestination(std::vector<std::string> sources) const; /** new move with destination have been pased by the CLI */ - void newMove(QStringList sources,QString destination) const; + void newMove(std::vector<std::string> sources,std::string destination) const; /** new transfer list pased by the CLI */ - void newTransferList(QString engine,QString mode,QString file) const; + void newTransferList(std::string engine,std::string mode,std::string file) const; - void tryLoadPlugin(const QString &file) const; + void tryLoadPlugin(const std::string &file) const; /// \brief Show the help option void showOptions() const; + + /// \brief For show a message linked to the systray icon + void showSystrayMessage(const std::string& text); private: /** \brief show the help *\param incorrectArguments if the help is call because the arguments are wrong */ void showHelp(const bool &incorrectArguments=true); + + //Core *core; }; #endif // CLIPARSER_H diff --git a/CompilerInfo.h b/CompilerInfo.h index c4b4464..78ba379 100644 --- a/CompilerInfo.h +++ b/CompilerInfo.h @@ -5,11 +5,11 @@ /// \def COMPILERINFO the string to identify the compiler #if defined(Q_CC_GNU) - #define COMPILERINFO QString("GCC %1.%2.%3 build: ").arg(__GNUC__).arg(__GNUC_MINOR__).arg(__GNUC_PATCHLEVEL__)+__DATE__+" "+__TIME__ + #define COMPILERINFO std::string("GCC ")+std::to_string(__GNUC__)+"."+std::to_string(__GNUC_MINOR__)+"."+std::to_string(__GNUC_PATCHLEVEL__)+" build: "+__DATE__+" "+__TIME__ #else - #if defined(__DATE__) && defined(__TIME__) - #define COMPILERINFO QString("Unknow compiler: ")+__DATE__+" "+__TIME__ - #else - #define COMPILERINFO QString("Unknow compiler") - #endif -#endif + #if defined(__DATE__) && defined(__TIME__) + #define COMPILERINFO std::string("Unknown compiler: ")+__DATE__+" "+__TIME__ + #else + #define COMPILERINFO std::string("Unknown compiler") + #endif +#endif diff --git a/CopyEngineManager.cpp b/CopyEngineManager.cpp index 2355743..a3934b3 100644 --- a/CopyEngineManager.cpp +++ b/CopyEngineManager.cpp @@ -7,6 +7,7 @@ #include "CopyEngineManager.h" #include "LanguagesManager.h" +#include "cpp11addition.h" #ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT #include "plugins/CopyEngine/Ultracopier/CopyEngineFactory.h" @@ -24,7 +25,7 @@ CopyEngineManager::CopyEngineManager(OptionDialog *optionDialog) connect(PluginsManager::pluginsManager,&PluginsManager::onePluginWillBeRemoved, this,&CopyEngineManager::onePluginWillBeRemoved,Qt::DirectConnection); #endif connect(PluginsManager::pluginsManager,&PluginsManager::pluginListingIsfinish, this,&CopyEngineManager::allPluginIsloaded,Qt::QueuedConnection); - QList<PluginsAvailable> list=PluginsManager::pluginsManager->getPluginsByCategory(PluginType_CopyEngine); + std::vector<PluginsAvailable> list=PluginsManager::pluginsManager->getPluginsByCategory(PluginType_CopyEngine); foreach(PluginsAvailable currentPlugin,list) emit previouslyPluginAdded(currentPlugin); PluginsManager::pluginsManager->unlockPluginListEdition(); @@ -37,23 +38,23 @@ void CopyEngineManager::onePluginAdded(const PluginsAvailable &plugin) if(plugin.category!=PluginType_CopyEngine) return; //setFileName - QString pluginPath=plugin.path+PluginsManager::getResolvedPluginName(QStringLiteral("copyEngine")); + std::string pluginPath=plugin.path+PluginsManager::getResolvedPluginName("copyEngine"); #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE /*more IO if(!QFile(pluginPath).exists()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("The plugin binary is missing: ")+pluginPath); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"The plugin binary is missing: "+pluginPath); return; }*/ #endif - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start: ")+pluginPath); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start: "+pluginPath); //search into loaded session - int index=0; + unsigned int index=0; while(index<pluginList.size()) { if(pluginList.at(index).pluginPath==pluginPath) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("Engine already found!")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"Engine already found!"); return; } index++; @@ -63,7 +64,7 @@ void CopyEngineManager::onePluginAdded(const PluginsAvailable &plugin) newItem.path=plugin.path; newItem.name=plugin.name; #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT - newItem.pointer=new QPluginLoader(newItem.pluginPath); + newItem.pointer=new QPluginLoader(QString::fromStdString(newItem.pluginPath)); #ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE QObjectList objectList=QPluginLoader::staticInstances(); index=0; @@ -78,15 +79,15 @@ void CopyEngineManager::onePluginAdded(const PluginsAvailable &plugin) } if(index==objectList.size()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("static copy engine not found")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"static copy engine not found"); return; } #else QObject *pluginObject = newItem.pointer->instance(); if(pluginObject==NULL) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("unable to load the plugin: %1").arg(newItem.pointer->errorString())); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("unable to load the plugin for %1").arg(newItem.pluginPath)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to load the plugin: "+newItem.pointer->errorString().toStdString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to load the plugin for "+newItem.pluginPath); newItem.pointer->unload(); return; } @@ -97,7 +98,7 @@ void CopyEngineManager::onePluginAdded(const PluginsAvailable &plugin) { if(pluginList.at(index).factory==newItem.factory) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Plugin already found")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Plugin already found"); newItem.pointer->unload(); return; } @@ -105,7 +106,7 @@ void CopyEngineManager::onePluginAdded(const PluginsAvailable &plugin) } if(newItem.factory==NULL) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("unable to cast the plugin: %1").arg(newItem.pointer->errorString())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to cast the plugin: "+newItem.pointer->errorString().toStdString()); newItem.pointer->unload(); return; } @@ -117,7 +118,7 @@ void CopyEngineManager::onePluginAdded(const PluginsAvailable &plugin) #ifdef ULTRACOPIER_DEBUG connect(newItem.factory,&PluginInterface_CopyEngineFactory::debugInformation,this,&CopyEngineManager::debugInformation,Qt::QueuedConnection); #endif // ULTRACOPIER_DEBUG - newItem.options=new LocalPluginOptions(QStringLiteral("CopyEngine-")+newItem.name); + newItem.options=new LocalPluginOptions("CopyEngine-"+newItem.name); newItem.factory->setResources(newItem.options,plugin.writablePath,plugin.path,&FacilityEngine::facilityEngine,ULTRACOPIER_VERSION_PORTABLE_BOOL); newItem.optionsWidget=newItem.factory->options(); newItem.supportedProtocolsForTheSource=newItem.factory->supportedProtocolsForTheSource(); @@ -126,9 +127,9 @@ void CopyEngineManager::onePluginAdded(const PluginsAvailable &plugin) newItem.type=newItem.factory->getCopyType(); newItem.transferListOperation=newItem.factory->getTransferListOperation(); optionDialog->addPluginOptionWidget(PluginType_CopyEngine,newItem.name,newItem.optionsWidget); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("plugin: ")+newItem.name+QStringLiteral(" loaded, send options")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"plugin: "+newItem.name+" loaded, send options"); //emit newCopyEngineOptions(plugin.path,newItem.name,newItem.optionsWidget); - pluginList << newItem; + pluginList.push_back(newItem); connect(LanguagesManager::languagesManager,&LanguagesManager::newLanguageLoaded,newItem.factory,&PluginInterface_CopyEngineFactory::newLanguageLoaded); if(PluginsManager::pluginsManager->allPluginHaveBeenLoaded()) allPluginIsloaded(); @@ -139,7 +140,7 @@ void CopyEngineManager::onePluginAdded(const PluginsAvailable &plugin) #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE void CopyEngineManager::onePluginWillBeRemoved(const PluginsAvailable &plugin) { - int index=0; + unsigned int index=0; while(index<pluginList.size()) { if(pluginList.at(index).path==plugin.path) @@ -147,7 +148,7 @@ void CopyEngineManager::onePluginWillBeRemoved(const PluginsAvailable &plugin) if(pluginList.at(index).intances.size()<=0) { emit removeCopyEngine(pluginList.at(index).name); - pluginList.removeAt(index); + pluginList.erase(pluginList.begin()+index); allPluginIsloaded(); return; } @@ -160,8 +161,8 @@ void CopyEngineManager::onePluginWillBeUnloaded(const PluginsAvailable &plugin) { if(plugin.category!=PluginType_CopyEngine) return; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - int index=0; + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + unsigned int index=0; while(index<pluginList.size()) { if(pluginList.at(index).path==plugin.path) @@ -176,33 +177,35 @@ void CopyEngineManager::onePluginWillBeUnloaded(const PluginsAvailable &plugin) } #endif -CopyEngineManager::returnCopyEngine CopyEngineManager::getCopyEngine(const Ultracopier::CopyMode &mode,const QStringList &protocolsUsedForTheSources,const QString &protocolsUsedForTheDestination) +CopyEngineManager::returnCopyEngine CopyEngineManager::getCopyEngine(const Ultracopier::CopyMode &mode, + const std::vector<std::string> &protocolsUsedForTheSources,const std::string &protocolsUsedForTheDestination) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start, pluginList.size(): %1, mode: %2, and particular protocol").arg(pluginList.size()).arg((int)mode)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, pluginList.size(): "+std::to_string(pluginList.size())+", mode: "+std::to_string((int)mode)+", and particular protocol"); returnCopyEngine temp; - int index=0; + unsigned int index=0; bool isTheGoodEngine=false; while(index<pluginList.size()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("pluginList.at(%1).name: %2").arg(index).arg(pluginList.at(index).name)); + const CopyEnginePlugin ©EnginePlugin=pluginList.at(index); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"pluginList.at("+std::to_string(index)+").name: "+copyEnginePlugin.name); isTheGoodEngine=false; - if(mode!=Ultracopier::Move || !pluginList.at(index).canDoOnlyCopy) + if(mode!=Ultracopier::Move || !copyEnginePlugin.canDoOnlyCopy) { if(protocolsUsedForTheSources.size()==0) isTheGoodEngine=true; else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("pluginList.at(index).supportedProtocolsForTheDestination: %1").arg(pluginList.at(index).supportedProtocolsForTheDestination.join(";"))); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("protocolsUsedForTheDestination: %1").arg(protocolsUsedForTheDestination)); - if(protocolsUsedForTheDestination.isEmpty() || pluginList.at(index).supportedProtocolsForTheDestination.contains(protocolsUsedForTheDestination)) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"copyEnginePlugin.supportedProtocolsForTheDestination: "+stringimplode(copyEnginePlugin.supportedProtocolsForTheDestination,";")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"protocolsUsedForTheDestination: "+protocolsUsedForTheDestination); + if(protocolsUsedForTheDestination.empty() || vectorcontainsAtLeastOne(copyEnginePlugin.supportedProtocolsForTheDestination,protocolsUsedForTheDestination)) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("pluginList.at(index).supportedProtocolsForTheSource: %1").arg(pluginList.at(index).supportedProtocolsForTheSource.join(";"))); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("protocolsUsedForTheSources.at(indexProto): %1").arg(protocolsUsedForTheSources.join(";"))); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"copyEnginePlugin.supportedProtocolsForTheSource: "+stringimplode(copyEnginePlugin.supportedProtocolsForTheSource,";")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"protocolsUsedForTheSources.at(indexProto): "+stringimplode(protocolsUsedForTheSources,";")); isTheGoodEngine=true; - int indexProto=0; + unsigned int indexProto=0; while(indexProto<protocolsUsedForTheSources.size()) { - if(!pluginList.at(index).supportedProtocolsForTheSource.contains(protocolsUsedForTheSources.at(indexProto))) + if(!vectorcontainsAtLeastOne(copyEnginePlugin.supportedProtocolsForTheSource,protocolsUsedForTheSources.at(indexProto))) { isTheGoodEngine=false; break; @@ -214,8 +217,8 @@ CopyEngineManager::returnCopyEngine CopyEngineManager::getCopyEngine(const Ultra } if(isTheGoodEngine) { - pluginList[index].intances<<pluginList.at(index).factory->getInstance(); - temp.engine=pluginList.at(index).intances.last(); + pluginList[index].intances.push_back(pluginList.at(index).factory->getInstance()); + temp.engine=pluginList.at(index).intances.back(); temp.canDoOnlyCopy=pluginList.at(index).canDoOnlyCopy; temp.type=pluginList.at(index).type; temp.transferListOperation=pluginList.at(index).transferListOperation; @@ -233,7 +236,7 @@ CopyEngineManager::returnCopyEngine CopyEngineManager::getCopyEngine(const Ultra ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Cannot find any compatible engine!"); QMessageBox::critical(NULL,tr("Warning"),tr("Cannot find any compatible engine!")); } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("protocolsUsedForTheSources: %1, protocolsUsedForTheDestination: %2").arg(protocolsUsedForTheSources.join(";")).arg(protocolsUsedForTheDestination)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"protocolsUsedForTheSources: "+stringimplode(protocolsUsedForTheSources,";")+", protocolsUsedForTheDestination: "+protocolsUsedForTheDestination); temp.engine=NULL; temp.type=Ultracopier::File; @@ -241,25 +244,25 @@ CopyEngineManager::returnCopyEngine CopyEngineManager::getCopyEngine(const Ultra return temp; } -CopyEngineManager::returnCopyEngine CopyEngineManager::getCopyEngine(const Ultracopier::CopyMode &mode,const QString &name) +CopyEngineManager::returnCopyEngine CopyEngineManager::getCopyEngine(const Ultracopier::CopyMode &mode,const std::string &name) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start, pluginList.size(): %1, with mode: %2, and name: %3").arg(pluginList.size()).arg((int)mode).arg(name)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, pluginList.size(): "+std::to_string(pluginList.size())+", with mode: "+std::to_string((int)mode)+", and name: "+name); returnCopyEngine temp; - int index=0; + unsigned int index=0; while(index<pluginList.size()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Check matching: %1").arg(pluginList.at(index).name)); - if(pluginList.at(index).name==name) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Check matching: "+pluginList.at(index).name); + if(pluginList.at(index).name==name || name.empty()) { if(mode==Ultracopier::Move && pluginList.at(index).canDoOnlyCopy) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"This copy engine does not support move: pluginList.at(index).canDoOnlyCopy: "+QString::number(pluginList.at(index).canDoOnlyCopy)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"This copy engine does not support move: pluginList.at(index).canDoOnlyCopy: "+std::to_string(pluginList.at(index).canDoOnlyCopy)); QMessageBox::critical(NULL,tr("Warning"),tr("This copy engine does not support move")); temp.engine=NULL; return temp; } - pluginList[index].intances<<pluginList.at(index).factory->getInstance(); - temp.engine=pluginList.at(index).intances.last(); + pluginList[index].intances.push_back(pluginList.at(index).factory->getInstance()); + temp.engine=pluginList.at(index).intances.back(); temp.canDoOnlyCopy=pluginList.at(index).canDoOnlyCopy; temp.type=pluginList.at(index).type; temp.transferListOperation=pluginList.at(index).transferListOperation; @@ -267,8 +270,8 @@ CopyEngineManager::returnCopyEngine CopyEngineManager::getCopyEngine(const Ultra } index++; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Cannot find any engine with this name: %1").arg(name)); - QMessageBox::critical(NULL,tr("Warning"),tr("Cannot find any engine with this name: %1").arg(name)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Cannot find any engine with this name: "+name); + QMessageBox::critical(NULL,tr("Warning"),tr("Cannot find any engine with this name: %1").arg(QString::fromStdString(name))); temp.engine=NULL; temp.type=Ultracopier::File; temp.canDoOnlyCopy=true; @@ -276,19 +279,19 @@ CopyEngineManager::returnCopyEngine CopyEngineManager::getCopyEngine(const Ultra } #ifdef ULTRACOPIER_DEBUG -void CopyEngineManager::debugInformation(const Ultracopier::DebugLevel &level,const QString& fonction,const QString& text,const QString& file,const int& ligne) +void CopyEngineManager::debugInformation(const Ultracopier::DebugLevel &level,const std::string& fonction,const std::string& text,const std::string& file,const int& ligne) { - DebugEngine::addDebugInformationStatic(level,fonction,text,file,ligne,QStringLiteral("Copy Engine plugin")); + DebugEngine::addDebugInformationStatic(level,fonction,text,file,ligne,"Copy Engine plugin"); } #endif // ULTRACOPIER_DEBUG /// \brief To notify when new value into a group have changed -void CopyEngineManager::newOptionValue(const QString &groupName,const QString &variableName,const QVariant &value) +void CopyEngineManager::newOptionValue(const std::string &groupName,const std::string &variableName,const std::string &value) { - if(groupName==QStringLiteral("CopyEngine") && variableName==QStringLiteral("List")) + if(groupName=="CopyEngine" && variableName=="List") { Q_UNUSED(value) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"start(\""+groupName+"\",\""+variableName+"\",\""+value.toString()+"\")"); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"start(\""+groupName+"\",\""+variableName+"\",\""+value+"\")"); allPluginIsloaded(); } } @@ -299,7 +302,7 @@ void CopyEngineManager::setIsConnected() prevent bug, I don't know why, in one case it bug here */ isConnected=true; - int index=0; + unsigned int index=0; while(index<pluginList.size()) { emit addCopyEngine(pluginList.at(index).name,pluginList.at(index).canDoOnlyCopy); @@ -309,23 +312,23 @@ void CopyEngineManager::setIsConnected() void CopyEngineManager::allPluginIsloaded() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - QStringList actualList; - int index=0; + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + std::vector<std::string> actualList; + unsigned int index=0; while(index<pluginList.size()) { - actualList << pluginList.at(index).name; + actualList.push_back(pluginList.at(index).name); index++; } - QStringList preferedList=OptionEngine::optionEngine->getOptionValue(QStringLiteral("CopyEngine"),QStringLiteral("List")).toStringList(); - preferedList.removeDuplicates(); - actualList.removeDuplicates(); + std::vector<std::string> preferedList=stringsplit(OptionEngine::optionEngine->getOptionValue("CopyEngine","List"),';'); + vectorRemoveDuplicatesForSmallList(preferedList); + vectorRemoveDuplicatesForSmallList(actualList); index=0; while(index<preferedList.size()) { - if(!actualList.contains(preferedList.at(index))) + if(!vectorcontainsAtLeastOne(actualList,preferedList.at(index))) { - preferedList.removeAt(index); + preferedList.erase(preferedList.cbegin()+index); index--; } index++; @@ -333,21 +336,21 @@ void CopyEngineManager::allPluginIsloaded() index=0; while(index<actualList.size()) { - if(!preferedList.contains(actualList.at(index))) - preferedList << actualList.at(index); + if(!vectorcontainsAtLeastOne(preferedList,actualList.at(index))) + preferedList.push_back( actualList.at(index)); index++; } - OptionEngine::optionEngine->setOptionValue(QStringLiteral("CopyEngine"),QStringLiteral("List"),preferedList); - QList<CopyEnginePlugin> newPluginList; + OptionEngine::optionEngine->setOptionValue("CopyEngine","List",stringimplode(preferedList,';')); + std::vector<CopyEnginePlugin> newPluginList; index=0; while(index<preferedList.size()) { - int pluginListIndex=0; + unsigned int pluginListIndex=0; while(pluginListIndex<pluginList.size()) { if(preferedList.at(index)==pluginList.at(pluginListIndex).name) { - newPluginList << pluginList.at(pluginListIndex); + newPluginList.push_back(pluginList.at(pluginListIndex)); break; } pluginListIndex++; @@ -357,20 +360,21 @@ void CopyEngineManager::allPluginIsloaded() pluginList=newPluginList; } -bool CopyEngineManager::protocolsSupportedByTheCopyEngine(PluginInterface_CopyEngine * engine,const QStringList &protocolsUsedForTheSources,const QString &protocolsUsedForTheDestination) +bool CopyEngineManager::protocolsSupportedByTheCopyEngine(PluginInterface_CopyEngine * engine,const std::vector<std::string> &protocolsUsedForTheSources,const std::string &protocolsUsedForTheDestination) { - int index=0; + unsigned int index=0; while(index<pluginList.size()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("pluginList.at(%1).name: %2").arg(index).arg(pluginList.at(index).name)); - if(pluginList.at(index).intances.contains(engine)) + const CopyEnginePlugin ©EnginePlugin=pluginList.at(index); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"pluginList.at("+std::to_string(index)+").name: "+copyEnginePlugin.name); + if(vectorcontainsAtLeastOne(copyEnginePlugin.intances,engine)) { - if(!pluginList.at(index).supportedProtocolsForTheDestination.contains(protocolsUsedForTheDestination)) + if(!vectorcontainsAtLeastOne(copyEnginePlugin.supportedProtocolsForTheDestination,protocolsUsedForTheDestination)) return false; - int indexProto=0; + unsigned int indexProto=0; while(indexProto<protocolsUsedForTheSources.size()) { - if(!pluginList.at(index).supportedProtocolsForTheSource.contains(protocolsUsedForTheSources.at(indexProto))) + if(!vectorcontainsAtLeastOne(copyEnginePlugin.supportedProtocolsForTheSource,protocolsUsedForTheSources.at(indexProto))) return false; indexProto++; } diff --git a/CopyEngineManager.h b/CopyEngineManager.h index 1338081..904508c 100644 --- a/CopyEngineManager.h +++ b/CopyEngineManager.h @@ -44,22 +44,22 @@ public: \param protocolsUsedForTheDestination list of destination used \see getCopyEngine() */ - returnCopyEngine getCopyEngine(const Ultracopier::CopyMode &mode,const QStringList &protocolsUsedForTheSources,const QString &protocolsUsedForTheDestination); + returnCopyEngine getCopyEngine(const Ultracopier::CopyMode &mode,const std::vector<std::string> &protocolsUsedForTheSources,const std::string &protocolsUsedForTheDestination); /** \brief return copy engine instance with specific engine \param mode the mode (copy/move) \param name name of the engine needed \see getCopyEngine() */ - returnCopyEngine getCopyEngine(const Ultracopier::CopyMode &mode,const QString &name); - //bool currentEngineCanDoOnlyCopy(QStringList protocolsUsedForTheSources,QString protocolsUsedForTheDestination=""); - //CopyType currentEngineGetCopyType(QStringList protocolsUsedForTheSources,QString protocolsUsedForTheDestination=""); + returnCopyEngine getCopyEngine(const Ultracopier::CopyMode &mode,const std::string &name); + //bool currentEngineCanDoOnlyCopy(std::vector<std::string> protocolsUsedForTheSources,std::string protocolsUsedForTheDestination=""); + //CopyType currentEngineGetCopyType(std::vector<std::string> protocolsUsedForTheSources,std::string protocolsUsedForTheDestination=""); /** \brief to send all signal because all object is connected on it */ void setIsConnected(); /** \brief check if the protocols given is supported by the copy engine \see Core::newCopy() \see Core::newMove() */ - bool protocolsSupportedByTheCopyEngine(PluginInterface_CopyEngine * engine,const QStringList &protocolsUsedForTheSources,const QString &protocolsUsedForTheDestination); + bool protocolsSupportedByTheCopyEngine(PluginInterface_CopyEngine * engine,const std::vector<std::string> &protocolsUsedForTheSources,const std::string &protocolsUsedForTheDestination); private slots: void onePluginAdded(const PluginsAvailable &plugin); #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE @@ -67,38 +67,38 @@ private slots: void onePluginWillBeUnloaded(const PluginsAvailable &plugin); #endif #ifdef ULTRACOPIER_DEBUG - void debugInformation(const Ultracopier::DebugLevel &level, const QString& fonction, const QString& text, const QString& file, const int& ligne); + void debugInformation(const Ultracopier::DebugLevel &level, const std::string& fonction, const std::string& text, const std::string& file, const int& ligne); #endif // ULTRACOPIER_DEBUG /// \brief To notify when new value into a group have changed - void newOptionValue(const QString &groupName,const QString &variableName,const QVariant &value); + void newOptionValue(const std::string &groupName,const std::string &variableName,const std::string &value); void allPluginIsloaded(); private: /// \brief the option interface struct CopyEnginePlugin { - QString path; - QString name; - QString pluginPath; - QStringList supportedProtocolsForTheSource; - QStringList supportedProtocolsForTheDestination; + std::string path; + std::string name; + std::string pluginPath; + std::vector<std::string> supportedProtocolsForTheSource; + std::vector<std::string> supportedProtocolsForTheDestination; #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT QPluginLoader * pointer; #endif PluginInterface_CopyEngineFactory * factory; - QList<PluginInterface_CopyEngine *> intances; + std::vector<PluginInterface_CopyEngine *> intances; bool canDoOnlyCopy; Ultracopier::CopyType type; Ultracopier::TransferListOperation transferListOperation; LocalPluginOptions *options; QWidget *optionsWidget; }; - QList<CopyEnginePlugin> pluginList; + std::vector<CopyEnginePlugin> pluginList; OptionDialog *optionDialog; bool isConnected; signals: - //void newCopyEngineOptions(QString,QString,QWidget *); - void addCopyEngine(QString name,bool canDoOnlyCopy) const; - void removeCopyEngine(QString name) const; + //void newCopyEngineOptions(std::string,std::string,QWidget *); + void addCopyEngine(std::string name,bool canDoOnlyCopy) const; + void removeCopyEngine(std::string name) const; void previouslyPluginAdded(PluginsAvailable) const; }; diff --git a/CopyListener.cpp b/CopyListener.cpp index 897a4c4..3c72695 100644 --- a/CopyListener.cpp +++ b/CopyListener.cpp @@ -5,6 +5,7 @@ #include "CopyListener.h" #include "LanguagesManager.h" +#include "cpp11addition.h" #ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT #include "plugins/Listener/catchcopy-v0002/listener.h" @@ -21,7 +22,7 @@ CopyListener::CopyListener(OptionDialog *optionDialog) //load the options tryListen=false; PluginsManager::pluginsManager->lockPluginListEdition(); - QList<PluginsAvailable> list=PluginsManager::pluginsManager->getPluginsByCategory(PluginType_Listener); + std::vector<PluginsAvailable> list=PluginsManager::pluginsManager->getPluginsByCategory(PluginType_Listener); connect(this,&CopyListener::previouslyPluginAdded, this,&CopyListener::onePluginAdded,Qt::QueuedConnection); connect(PluginsManager::pluginsManager,&PluginsManager::onePluginAdded, this,&CopyListener::onePluginAdded,Qt::QueuedConnection); #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE @@ -35,7 +36,7 @@ CopyListener::CopyListener(OptionDialog *optionDialog) last_state=Ultracopier::NotListening; last_have_plugin=false; last_inWaitOfReply=false; - stripSeparatorRegex=QRegularExpression(QStringLiteral("[\\\\/]+$")); + stripSeparatorRegex=std::regex("[\\\\/]+$"); } CopyListener::~CopyListener() @@ -63,7 +64,7 @@ void CopyListener::onePluginAdded(const PluginsAvailable &plugin) if(plugin.category!=PluginType_Listener) return; PluginListener newPluginListener; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("try load: ")+plugin.path+PluginsManager::getResolvedPluginName("listener")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"try load: "+plugin.path+PluginsManager::getResolvedPluginName("listener")); //setFileName #ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE PluginInterface_Listener *listen; @@ -81,7 +82,7 @@ void CopyListener::onePluginAdded(const PluginsAvailable &plugin) } if(index==objectList.size()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("static listener not found")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"static listener not found"); return; } #else @@ -91,26 +92,26 @@ void CopyListener::onePluginAdded(const PluginsAvailable &plugin) newPluginListener.pluginLoader=NULL; #endif #else - QPluginLoader *pluginOfPluginLoader=new QPluginLoader(plugin.path+PluginsManager::getResolvedPluginName(QStringLiteral("listener"))); + QPluginLoader *pluginOfPluginLoader=new QPluginLoader(QString::fromStdString(plugin.path+PluginsManager::getResolvedPluginName("listener"))); QObject *pluginInstance = pluginOfPluginLoader->instance(); if(!pluginInstance) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("unable to load the plugin: ")+pluginOfPluginLoader->errorString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to load the plugin: "+pluginOfPluginLoader->errorString().toStdString()); return; } PluginInterface_Listener *listen = qobject_cast<PluginInterface_Listener *>(pluginInstance); if(!listen) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("unable to load the plugin: ")+pluginOfPluginLoader->errorString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to load the plugin: "+pluginOfPluginLoader->errorString().toStdString()); return; } //check if found - int index=0; + unsigned int index=0; while(index<pluginList.size()) { if(pluginList.at(index).listenInterface==listen) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Plugin already found %1 for %2").arg(pluginList.at(index).path).arg(plugin.path)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Plugin already found "+pluginList.at(index).path+" for "+plugin.path); pluginOfPluginLoader->unload(); return; } @@ -118,7 +119,7 @@ void CopyListener::onePluginAdded(const PluginsAvailable &plugin) } newPluginListener.pluginLoader = pluginOfPluginLoader; #endif - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Plugin correctly loaded")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Plugin correctly loaded"); #ifdef ULTRACOPIER_DEBUG connect(listen,&PluginInterface_Listener::debugInformation,this,&CopyListener::debugInformation,Qt::DirectConnection); #endif // ULTRACOPIER_DEBUG @@ -130,32 +131,32 @@ void CopyListener::onePluginAdded(const PluginsAvailable &plugin) connect(listen,&PluginInterface_Listener::newClientList, this,&CopyListener::reloadClientList,Qt::DirectConnection); newPluginListener.listenInterface = listen; - newPluginListener.path = plugin.path+PluginsManager::getResolvedPluginName(QStringLiteral("listener")); + newPluginListener.path = plugin.path+PluginsManager::getResolvedPluginName("listener"); newPluginListener.state = Ultracopier::NotListening; newPluginListener.inWaitOfReply = false; - newPluginListener.options=new LocalPluginOptions(QStringLiteral("Listener-")+plugin.name); + newPluginListener.options=new LocalPluginOptions("Listener-"+plugin.name); newPluginListener.listenInterface->setResources(newPluginListener.options,plugin.writablePath,plugin.path,ULTRACOPIER_VERSION_PORTABLE_BOOL); optionDialog->addPluginOptionWidget(PluginType_Listener,plugin.name,newPluginListener.listenInterface->options()); connect(LanguagesManager::languagesManager,&LanguagesManager::newLanguageLoaded,newPluginListener.listenInterface,&PluginInterface_Listener::newLanguageLoaded,Qt::DirectConnection); - pluginList << newPluginListener; - connect(pluginList.last().listenInterface,&PluginInterface_Listener::newState,this,&CopyListener::newState,Qt::DirectConnection); + pluginList.push_back(newPluginListener); + connect(pluginList.back().listenInterface,&PluginInterface_Listener::newState,this,&CopyListener::newState,Qt::DirectConnection); if(tryListen) { - pluginList.last().inWaitOfReply=true; + pluginList.back().inWaitOfReply=true; listen->listen(); } } #ifdef ULTRACOPIER_DEBUG -void CopyListener::debugInformation(const Ultracopier::DebugLevel &level, const QString& fonction, const QString& text, const QString& file, const int& ligne) +void CopyListener::debugInformation(const Ultracopier::DebugLevel &level, const std::string& fonction, const std::string& text, const std::string& file, const int& ligne) { - DebugEngine::addDebugInformationStatic(level,fonction,text,file,ligne,QStringLiteral("Listener plugin")); + DebugEngine::addDebugInformationStatic(level,fonction,text,file,ligne,"Listener plugin"); } #endif // ULTRACOPIER_DEBUG -void CopyListener::error(const QString &error) +void CopyListener::error(const std::string &error) { - QMessageBox::critical(NULL,tr("Error"),tr("Error during the reception of the copy/move list\n%1").arg(error)); + QMessageBox::critical(NULL,tr("Error"),tr("Error during the reception of the copy/move list\n%1").arg(QString::fromStdString(error))); } bool CopyListener::oneListenerIsLoaded() @@ -168,12 +169,12 @@ void CopyListener::onePluginWillBeRemoved(const PluginsAvailable &plugin) { if(plugin.category!=PluginType_Listener) return; - int indexPlugin=0; + unsigned int indexPlugin=0; while(indexPlugin<pluginList.size()) { - if((plugin.path+PluginsManager::getResolvedPluginName(QStringLiteral("listener")))==pluginList.at(indexPlugin).path) + if((plugin.path+PluginsManager::getResolvedPluginName("listener"))==pluginList.at(indexPlugin).path) { - int index=0; + unsigned int index=0; while(index<copyRunningList.size()) { if(copyRunningList.at(index).listenInterface==pluginList.at(indexPlugin).listenInterface) @@ -190,7 +191,7 @@ void CopyListener::onePluginWillBeRemoved(const PluginsAvailable &plugin) pluginList.at(indexPlugin).pluginLoader->unload(); delete pluginList.at(indexPlugin).options; } - pluginList.removeAt(indexPlugin); + pluginList.erase(pluginList.cbegin()+indexPlugin); sendState(); return; } @@ -204,34 +205,34 @@ void CopyListener::newState(const Ultracopier::ListeningState &state) { if(stopIt) return; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); PluginInterface_Listener *temp=qobject_cast<PluginInterface_Listener *>(QObject::sender()); if(temp==NULL) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("listener not located!")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"listener not located!"); return; } - int index=0; + unsigned int index=0; while(index<pluginList.size()) { if(temp==pluginList.at(index).listenInterface) { pluginList[index].state=state; pluginList[index].inWaitOfReply=false; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("new state for the plugin %1: %2").arg(index).arg(state)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"new state for the plugin "+std::to_string(index)+": "+std::to_string((int)state)); sendState(true); return; } index++; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("listener not found!")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"listener not found!"); } void CopyListener::listen() { tryListen=true; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - int index=0; + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + unsigned int index=0; while(index<pluginList.size()) { pluginList[index].inWaitOfReply=true; @@ -244,11 +245,11 @@ void CopyListener::listen() void CopyListener::close() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); tryListen=false; if(pluginLoader!=NULL) pluginLoader->unload(); - int index=0; + unsigned int index=0; while(index<pluginList.size()) { pluginList[index].inWaitOfReply=true; @@ -258,143 +259,155 @@ void CopyListener::close() copyRunningList.clear(); } -QStringList CopyListener::stripSeparator(QStringList sources) +std::vector<std::string> CopyListener::stripSeparator(std::vector<std::string> sources) { - int index=0; + unsigned int index=0; while(index<sources.size()) { - sources[index].remove(stripSeparatorRegex); + std::regex_replace(sources[index],stripSeparatorRegex,""); index++; } return sources; } /** new copy without destination have been pased by the CLI */ -void CopyListener::copyWithoutDestination(QStringList sources) +void CopyListener::copyWithoutDestination(std::vector<std::string> sources) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - emit newCopyWithoutDestination(incrementOrderId(),QStringList() << QStringLiteral("file"),stripSeparator(sources)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + std::vector<std::string> list; + list.push_back("file"); + emit newCopyWithoutDestination(incrementOrderId(),list,stripSeparator(sources)); } /** new copy with destination have been pased by the CLI */ -void CopyListener::copy(QStringList sources,QString destination) +void CopyListener::copy(std::vector<std::string> sources,std::string destination) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - emit newCopy(incrementOrderId(),QStringList() << QStringLiteral("file"),stripSeparator(sources),QStringLiteral("file"),destination); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + std::vector<std::string> list; + list.push_back("file"); + emit newCopy(incrementOrderId(),list,stripSeparator(sources),"file",destination); } /** new move without destination have been pased by the CLI */ -void CopyListener::moveWithoutDestination(QStringList sources) +void CopyListener::moveWithoutDestination(std::vector<std::string> sources) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - emit newMoveWithoutDestination(incrementOrderId(),QStringList() << QStringLiteral("file"),stripSeparator(sources)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + std::vector<std::string> list; + list.push_back("file"); + emit newMoveWithoutDestination(incrementOrderId(),list,stripSeparator(sources)); } /** new move with destination have been pased by the CLI */ -void CopyListener::move(QStringList sources,QString destination) +void CopyListener::move(std::vector<std::string> sources,std::string destination) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - emit newMove(incrementOrderId(),QStringList() << QStringLiteral("file"),stripSeparator(sources),QStringLiteral("file"),destination); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + std::vector<std::string> list; + list.push_back("file"); + emit newMove(incrementOrderId(),list,stripSeparator(sources),"file",destination); } void CopyListener::copyFinished(const quint32 & orderId,const bool &withError) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - int index=0; + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + unsigned int index=0; while(index<copyRunningList.size()) { if(orderId==copyRunningList.at(index).orderId) { - orderList.removeAll(orderId); + vectorRemoveAll(orderList,orderId); if(copyRunningList.at(index).listenInterface!=NULL) copyRunningList.at(index).listenInterface->transferFinished(copyRunningList.at(index).pluginOrderId,withError); - copyRunningList.removeAt(index); + copyRunningList.erase(copyRunningList.cbegin()+index); return; } index++; } } -void CopyListener::copyCanceled(const quint32 & orderId) +void CopyListener::copyCanceled(const uint32_t & orderId) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - int index=0; + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + unsigned int index=0; while(index<copyRunningList.size()) { if(orderId==copyRunningList.at(index).orderId) { - orderList.removeAll(orderId); + vectorRemoveAll(orderList,orderId); if(copyRunningList.at(index).listenInterface!=NULL) copyRunningList.at(index).listenInterface->transferCanceled(copyRunningList.at(index).pluginOrderId); - copyRunningList.removeAt(index); + copyRunningList.erase(copyRunningList.cbegin()+index); return; } index++; } } -void CopyListener::newPluginCopyWithoutDestination(const quint32 &orderId,const QStringList &sources) +void CopyListener::newPluginCopyWithoutDestination(const uint32_t &orderId,const std::vector<std::string> &sources) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("sources: ")+sources.join(QStringLiteral(";"))); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"sources: "+stringimplode(sources,";")); PluginInterface_Listener *plugin = qobject_cast<PluginInterface_Listener *>(sender()); CopyRunning newCopyInformation; newCopyInformation.listenInterface = plugin; newCopyInformation.pluginOrderId = orderId; newCopyInformation.orderId = incrementOrderId(); - copyRunningList << newCopyInformation; - emit newCopyWithoutDestination(orderId,QStringList() << QStringLiteral("file"),stripSeparator(sources)); + copyRunningList.push_back(newCopyInformation); + std::vector<std::string> stringList;stringList.push_back("file"); + emit newCopyWithoutDestination(orderId,stringList,stripSeparator(sources)); } -void CopyListener::newPluginCopy(const quint32 &orderId,const QStringList &sources,const QString &destination) +void CopyListener::newPluginCopy(const quint32 &orderId,const std::vector<std::string> &sources,const std::string &destination) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("sources: ")+sources.join(QStringLiteral(";"))+QStringLiteral(", destination: ")+destination); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"sources: "+stringimplode(sources,";")+", destination: "+destination); PluginInterface_Listener *plugin = qobject_cast<PluginInterface_Listener *>(sender()); CopyRunning newCopyInformation; newCopyInformation.listenInterface = plugin; newCopyInformation.pluginOrderId = orderId; newCopyInformation.orderId = incrementOrderId(); - copyRunningList << newCopyInformation; - emit newCopy(orderId,QStringList() << QStringLiteral("file"),stripSeparator(sources),QStringLiteral("file"),destination); + copyRunningList.push_back(newCopyInformation); + std::vector<std::string> stringList;stringList.push_back("file"); + emit newCopy(orderId,stringList,stripSeparator(sources),"file",destination); } -void CopyListener::newPluginMoveWithoutDestination(const quint32 &orderId,const QStringList &sources) +void CopyListener::newPluginMoveWithoutDestination(const uint32_t &orderId,const std::vector<std::string> &sources) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("sources: ")+sources.join(QStringLiteral(";"))); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"sources: "+stringimplode(sources,";")); PluginInterface_Listener *plugin = qobject_cast<PluginInterface_Listener *>(sender()); CopyRunning newCopyInformation; newCopyInformation.listenInterface = plugin; newCopyInformation.pluginOrderId = orderId; newCopyInformation.orderId = incrementOrderId(); - copyRunningList << newCopyInformation; - emit newMoveWithoutDestination(orderId,QStringList() << QStringLiteral("file"),stripSeparator(sources)); + copyRunningList.push_back(newCopyInformation); + std::vector<std::string> stringList;stringList.push_back("file"); + emit newMoveWithoutDestination(orderId,stringList,stripSeparator(sources)); } -void CopyListener::newPluginMove(const quint32 &orderId,const QStringList &sources,const QString &destination) +void CopyListener::newPluginMove(const quint32 &orderId,const std::vector<std::string> &sources,const std::string &destination) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("sources: ")+sources.join(";")+QStringLiteral(", destination: ")+destination); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"sources: "+stringimplode(sources,";")+", destination: "+destination); PluginInterface_Listener *plugin = qobject_cast<PluginInterface_Listener *>(sender()); CopyRunning newCopyInformation; newCopyInformation.listenInterface = plugin; newCopyInformation.pluginOrderId = orderId; newCopyInformation.orderId = incrementOrderId(); - copyRunningList << newCopyInformation; - emit newMove(orderId,QStringList() << QStringLiteral("file"),stripSeparator(sources),QStringLiteral("file"),destination); + copyRunningList.push_back(newCopyInformation); + std::vector<std::string> stringList;stringList.push_back("file"); + emit newMove(orderId,stringList,stripSeparator(sources),"file",destination); } -quint32 CopyListener::incrementOrderId() +uint32_t CopyListener::incrementOrderId() { do { nextOrderId++; if(nextOrderId>2000000) nextOrderId=0; - } while(orderList.contains(nextOrderId)); + } while(vectorcontainsAtLeastOne(orderList,nextOrderId)); return nextOrderId; } void CopyListener::allPluginIsloaded() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("with value: ")+QString::number(pluginList.size()>0)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"with value: "+std::to_string(pluginList.size()>0)); sendState(true); reloadClientList(); } @@ -403,14 +416,16 @@ void CopyListener::reloadClientList() { if(!PluginsManager::pluginsManager->allPluginHaveBeenLoaded()) return; - QStringList clients; - int indexPlugin=0; + std::vector<std::string> clients; + unsigned int indexPlugin=0; while(indexPlugin<pluginList.size()) { if(pluginList.at(indexPlugin).listenInterface!=NULL) { - clients << pluginList.at(indexPlugin).listenInterface->clientsList(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("ask client to: ")+pluginList.at(indexPlugin).path); + const PluginListener &pluginListener=pluginList.at(indexPlugin); + const std::vector<std::string> &clientsList=pluginListener.listenInterface->clientsList(); + clients.insert(clients.cbegin(),clientsList.cbegin(),clientsList.cend()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"ask client to: "+pluginList.at(indexPlugin).path); } indexPlugin++; } @@ -421,10 +436,10 @@ void CopyListener::sendState(bool force) { if(stopIt) return; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start, pluginList.size(): %1, force: %2").arg(pluginList.size()).arg(force)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, pluginList.size(): "+std::to_string(pluginList.size())+", force: "+std::to_string(force)); Ultracopier::ListeningState current_state=Ultracopier::NotListening; bool found_not_listen=false,found_listen=false,found_inWaitOfReply=false; - int index=0; + unsigned int index=0; while(index<pluginList.size()) { if(current_state==Ultracopier::NotListening) @@ -454,11 +469,11 @@ void CopyListener::sendState(bool force) bool have_plugin=pluginList.size()>0; if(force || current_state!=last_state || have_plugin!=last_have_plugin || found_inWaitOfReply!=last_inWaitOfReply) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("send listenerReady(%1,%2,%3)").arg(current_state).arg(have_plugin).arg(found_inWaitOfReply)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"send listenerReady("+std::to_string(current_state)+","+std::to_string(have_plugin)+","+std::to_string(found_inWaitOfReply)+")"); emit listenerReady(current_state,have_plugin,found_inWaitOfReply); } else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Skip the signal sending")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Skip the signal sending"); last_state=current_state; last_have_plugin=have_plugin; last_inWaitOfReply=found_inWaitOfReply; diff --git a/CopyListener.h b/CopyListener.h index 447ecb8..3003aec 100644 --- a/CopyListener.h +++ b/CopyListener.h @@ -30,19 +30,19 @@ class CopyListener : public QObject void resendState(); private slots: //void newPlugin(); - void newPluginCopyWithoutDestination(const quint32 &orderId,const QStringList &sources); - void newPluginCopy(const quint32 &orderId,const QStringList &sources,const QString &destination); - void newPluginMoveWithoutDestination(const quint32 &orderId,const QStringList &sources); - void newPluginMove(const quint32 &orderId,const QStringList &sources,const QString &destination); + void newPluginCopyWithoutDestination(const uint32_t &orderId,const std::vector<std::string> &sources); + void newPluginCopy(const uint32_t &orderId,const std::vector<std::string> &sources,const std::string &destination); + void newPluginMoveWithoutDestination(const uint32_t &orderId,const std::vector<std::string> &sources); + void newPluginMove(const uint32_t &orderId,const std::vector<std::string> &sources,const std::string &destination); void onePluginAdded(const PluginsAvailable &plugin); #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE void onePluginWillBeRemoved(const PluginsAvailable &plugin); #endif void newState(const Ultracopier::ListeningState &state); #ifdef ULTRACOPIER_DEBUG - void debugInformation(const Ultracopier::DebugLevel &level,const QString& fonction,const QString& text,const QString& file,const int& ligne); + void debugInformation(const Ultracopier::DebugLevel &level,const std::string& fonction,const std::string& text,const std::string& file,const int& ligne); #endif // ULTRACOPIER_DEBUG - void error(const QString &error); + void error(const std::string &error); void allPluginIsloaded(); void reloadClientList(); public slots: @@ -52,13 +52,13 @@ class CopyListener : public QObject \see newCopy() \see newMove() */ - void copyFinished(const quint32 & orderId,const bool &withError); + void copyFinished(const uint32_t & orderId,const bool &withError); /** \brief the copy is canceled by the user \param orderId id used when it have send the copy \see newCopy() \see newMove() */ - void copyCanceled(const quint32 & orderId); + void copyCanceled(const uint32_t & orderId); /** \brief try listen, to get copy/move from external source (mainly the file manager) \see close() */ @@ -68,22 +68,22 @@ class CopyListener : public QObject */ void close(); /** new copy without destination have been pased by the CLI */ - void copyWithoutDestination(QStringList sources); + void copyWithoutDestination(std::vector<std::string> sources); /** new copy with destination have been pased by the CLI */ - void copy(QStringList sources,QString destination); + void copy(std::vector<std::string> sources,std::string destination); /** new move without destination have been pased by the CLI */ - void moveWithoutDestination(QStringList sources); + void moveWithoutDestination(std::vector<std::string> sources); /** new move with destination have been pased by the CLI */ - void move(QStringList sources,QString destination); + void move(std::vector<std::string> sources,std::string destination); signals: - void newCopyWithoutDestination(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources) const; - void newCopy(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources,const QString &protocolsUsedForTheDestination,const QString &destination) const; - void newMoveWithoutDestination(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources) const; - void newMove(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources,const QString &protocolsUsedForTheDestination,const QString &destination) const; + void newCopyWithoutDestination(const uint32_t &orderId,const std::vector<std::string> &protocolsUsedForTheSources,const std::vector<std::string> &sources) const; + void newCopy(const uint32_t &orderId,const std::vector<std::string> &protocolsUsedForTheSources,const std::vector<std::string> &sources,const std::string &protocolsUsedForTheDestination,const std::string &destination) const; + void newMoveWithoutDestination(const uint32_t &orderId,const std::vector<std::string> &protocolsUsedForTheSources,const std::vector<std::string> &sources) const; + void newMove(const uint32_t &orderId,const std::vector<std::string> &protocolsUsedForTheSources,const std::vector<std::string> &sources,const std::string &protocolsUsedForTheDestination,const std::string &destination) const; void listenerReady(const Ultracopier::ListeningState &state,const bool &havePlugin,const bool &someAreInWaitOfReply) const; void pluginLoaderReady(const Ultracopier::CatchState &state,const bool &havePlugin,const bool &someAreInWaitOfReply) const; void previouslyPluginAdded(const PluginsAvailable &) const; - void newClientList(const QStringList &clientsList) const; + void newClientList(const std::vector<std::string> &clientsList) const; private: struct PluginListener { @@ -91,33 +91,33 @@ class CopyListener : public QObject #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT QPluginLoader *pluginLoader; #endif - QString path; + std::string path; Ultracopier::ListeningState state; bool inWaitOfReply; LocalPluginOptions *options; }; - QList<PluginListener> pluginList; + std::vector<PluginListener> pluginList; //for the options - quint32 nextOrderId; - QList<quint32> orderList; + uint32_t nextOrderId; + std::vector<uint32_t> orderList; //for the copy as suspend struct CopyRunning { PluginInterface_Listener *listenInterface; - quint32 pluginOrderId; - quint32 orderId; + uint32_t pluginOrderId; + uint32_t orderId; }; - QList<CopyRunning> copyRunningList; - quint32 incrementOrderId(); + std::vector<CopyRunning> copyRunningList; + uint32_t incrementOrderId(); bool tryListen; PluginLoader *pluginLoader; Ultracopier::ListeningState last_state; bool last_have_plugin,last_inWaitOfReply; void sendState(bool force=false); - QStringList stripSeparator(QStringList sources); + std::vector<std::string> stripSeparator(std::vector<std::string> sources); OptionDialog *optionDialog; bool stopIt; - QRegularExpression stripSeparatorRegex; + std::regex stripSeparatorRegex; }; #endif // COPYLISTENER_H @@ -9,10 +9,11 @@ #include "Core.h" #include "ThemesManager.h" +#include "cpp11addition.h" Core::Core(CopyEngineManager *copyEngineList) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); this->copyEngineList=copyEngineList; nextId=0; forUpateInformation.setInterval(ULTRACOPIER_TIME_INTERFACE_UPDATE); @@ -25,7 +26,7 @@ Core::Core(CopyEngineManager *copyEngineList) Core::~Core() { - int index=0; + unsigned int index=0; while(index<copyList.size()) { copyList[index].engine->cancel(); @@ -36,30 +37,30 @@ Core::~Core() } } -void Core::newCopyWithoutDestination(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources) +void Core::newCopyWithoutDestination(const uint32_t &orderId,const std::vector<std::string> &protocolsUsedForTheSources,const std::vector<std::string> &sources) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); if(openNewCopyEngineInstance(Ultracopier::Copy,false,protocolsUsedForTheSources)==-1) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to get a copy engine instance"); QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a copy engine instance")); return; } - copyList.last().orderId<<orderId; - copyList.last().engine->newCopy(sources); - copyList.last().interface->haveExternalOrder(); + copyList.back().orderId.push_back(orderId); + copyList.back().engine->newCopy(sources); + copyList.back().interface->haveExternalOrder(); } -void Core::newTransfer(const Ultracopier::CopyMode &mode,const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources,const QString &protocolsUsedForTheDestination,const QString &destination) +void Core::newTransfer(const Ultracopier::CopyMode &mode,const uint32_t &orderId,const std::vector<std::string> &protocolsUsedForTheSources,const std::vector<std::string> &sources,const std::string &protocolsUsedForTheDestination,const std::string &destination) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start: ")+sources.join(QStringLiteral(";"))+QStringLiteral(", dest: ")+destination+QStringLiteral(", mode: ")+QString::number(mode)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start: "+stringimplode(sources,";")+", dest: "+destination+", mode: "+std::to_string(mode)); //search to group the window - int GroupWindowWhen=OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("GroupWindowWhen")).toInt(); + int GroupWindowWhen=stringtoint32(OptionEngine::optionEngine->getOptionValue("Ultracopier","GroupWindowWhen")); bool haveSameSource=false,haveSameDestination=false; if(GroupWindowWhen!=0) { - bool needConfirmation=OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("confirmToGroupWindows")).toInt(); - int index=0; + bool needConfirmation=stringtobool(OptionEngine::optionEngine->getOptionValue("Ultracopier","confirmToGroupWindows")); + unsigned int index=0; while(index<copyList.size()) { bool rightMode=false; @@ -95,7 +96,7 @@ void Core::newTransfer(const Ultracopier::CopyMode &mode,const quint32 &orderId, } if(confirmed) { - copyList[index].orderId<<orderId; + copyList[index].orderId.push_back(orderId); if(mode==Ultracopier::Copy) copyList.at(index).engine->newCopy(sources,destination); else @@ -112,29 +113,29 @@ void Core::newTransfer(const Ultracopier::CopyMode &mode,const quint32 &orderId, //else open new windows if(openNewCopyEngineInstance(mode,false,protocolsUsedForTheSources,protocolsUsedForTheDestination)==-1) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Unable to get a engine instance")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to get a engine instance"); QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a engine instance")); return; } - copyList.last().orderId<<orderId; + copyList.back().orderId.push_back(orderId); if(mode==Ultracopier::Copy) - copyList.last().engine->newCopy(sources,destination); + copyList.back().engine->newCopy(sources,destination); else - copyList.last().engine->newMove(sources,destination); - copyList.last().interface->haveExternalOrder(); + copyList.back().engine->newMove(sources,destination); + copyList.back().interface->haveExternalOrder(); } -void Core::newCopy(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources,const QString &protocolsUsedForTheDestination,const QString &destination) +void Core::newCopy(const uint32_t &orderId,const std::vector<std::string> &protocolsUsedForTheSources,const std::vector<std::string> &sources,const std::string &protocolsUsedForTheDestination,const std::string &destination) { newTransfer(Ultracopier::Copy,orderId,protocolsUsedForTheSources,sources,protocolsUsedForTheDestination,destination); } -void Core::newMove(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources,const QString &protocolsUsedForTheDestination,const QString &destination) +void Core::newMove(const uint32_t &orderId,const std::vector<std::string> &protocolsUsedForTheSources,const std::vector<std::string> &sources,const std::string &protocolsUsedForTheDestination,const std::string &destination) { newTransfer(Ultracopier::Move,orderId,protocolsUsedForTheSources,sources,protocolsUsedForTheDestination,destination); } -void Core::newMoveWithoutDestination(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources) +void Core::newMoveWithoutDestination(const uint32_t &orderId,const std::vector<std::string> &protocolsUsedForTheSources,const std::vector<std::string> &sources) { if(openNewCopyEngineInstance(Ultracopier::Move,false,protocolsUsedForTheSources)==-1) { @@ -142,35 +143,35 @@ void Core::newMoveWithoutDestination(const quint32 &orderId,const QStringList &p QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a copy engine instance")); return; } - copyList.last().orderId<<orderId; - copyList.last().engine->newMove(sources); - copyList.last().interface->haveExternalOrder(); + copyList.back().orderId.push_back(orderId); + copyList.back().engine->newMove(sources); + copyList.back().interface->haveExternalOrder(); } /// \brief name to open the right copy engine -void Core::addWindowCopyMove(const Ultracopier::CopyMode &mode,const QString &name) +void Core::addWindowCopyMove(const Ultracopier::CopyMode &mode,const std::string &name) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start: ")+name); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start: "+name); if(openNewCopyEngineInstance(mode,false,name)==-1) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to get a copy engine instance"); QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a copy engine instance")); return; } - ActionOnManualOpen ActionOnManualOpen_value=(ActionOnManualOpen)OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("ActionOnManualOpen")).toInt(); + ActionOnManualOpen ActionOnManualOpen_value=static_cast<ActionOnManualOpen>(stringtoint32(OptionEngine::optionEngine->getOptionValue("Ultracopier","ActionOnManualOpen"))); if(ActionOnManualOpen_value!=ActionOnManualOpen_Nothing) { if(ActionOnManualOpen_value==ActionOnManualOpen_Folder) - copyList.last().engine->userAddFolder(mode); + copyList.back().engine->userAddFolder(mode); else - copyList.last().engine->userAddFile(mode); + copyList.back().engine->userAddFile(mode); } } /// \brief name to open the right copy engine -void Core::addWindowTransfer(const QString &name) +void Core::addWindowTransfer(const std::string &name) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")+name); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"+name); if(openNewCopyEngineInstance(Ultracopier::Copy,true,name)==-1) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to get a copy engine instance"); @@ -180,10 +181,10 @@ void Core::addWindowTransfer(const QString &name) } /** new transfer list pased by the CLI */ -void Core::newTransferList(QString engine,QString mode,QString file) +void Core::newTransferList(std::string engine,std::string mode,std::string file) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("engine: %1, mode: %2, file: %3").arg(engine).arg(mode).arg(file)); - if(mode==QStringLiteral("Transfer")) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"engine: "+engine+", mode: "+mode+", file: "+file); + if(mode=="Transfer") { if(openNewCopyEngineInstance(Ultracopier::Copy,true,engine)==-1) { @@ -192,7 +193,7 @@ void Core::newTransferList(QString engine,QString mode,QString file) return; } } - else if(mode==QStringLiteral("Copy")) + else if(mode=="Copy") { if(openNewCopyEngineInstance(Ultracopier::Copy,false,engine)==-1) { @@ -201,7 +202,7 @@ void Core::newTransferList(QString engine,QString mode,QString file) return; } } - else if(mode==QStringLiteral("Move")) + else if(mode=="Move") { if(openNewCopyEngineInstance(Ultracopier::Move,false,engine)==-1) { @@ -216,17 +217,31 @@ void Core::newTransferList(QString engine,QString mode,QString file) QMessageBox::critical(NULL,tr("Error"),tr("The argument for the mode is not valid")); return; } - copyList.last().engine->newTransferList(file); + copyList.back().engine->newTransferList(file); +} + +bool Core::startNewTransferOneUniqueCopyEngine() +{ + if(copyList.size()!=1) + return false; + + if(openNewCopyEngineInstance(Ultracopier::Copy,true,std::string())==-1) + { + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to get a copy engine instance"); + QMessageBox::critical(NULL,tr("Error"),tr("Unable to get a copy engine instance")); + return false; + } + return true; } void Core::loadInterface() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); //load the extra files to check the themes availability if(copyList.size()>0) { bool error=false; - int index=0; + unsigned int index=0; while(index<copyList.size()) { copyList[index].interface=ThemesManager::themesManager->getThemesInstance(); @@ -239,7 +254,7 @@ void Core::loadInterface() { if(!copyList.at(index).ignoreMode) copyList.at(index).interface->forceCopyMode(copyList.at(index).mode); - connectInterfaceAndSync(copyList.count()-1); + connectInterfaceAndSync(static_cast<unsigned int>(copyList.size()-1)); copyList.at(index).engine->syncTransferList(); index++; } @@ -254,10 +269,9 @@ void Core::loadInterface() void Core::unloadInterface() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - int index=0; - const int &loop_size=copyList.size(); - while(index<loop_size) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + size_t index=0; + while(index<copyList.size()) { if(copyList.at(index).interface!=NULL) { @@ -270,14 +284,14 @@ void Core::unloadInterface() } } -int Core::incrementId() +unsigned int Core::incrementId() { do { nextId++; if(nextId>2000000) nextId=0; - } while(idList.contains(nextId)); + } while(vectorcontainsAtLeastOne(idList,nextId)); return nextId; } @@ -287,9 +301,10 @@ int Core::incrementId() \param protocolsUsedForTheSources protocols used for sources \param protocolsUsedForTheDestination protocols used for destination */ -int Core::openNewCopyEngineInstance(const Ultracopier::CopyMode &mode,const bool &ignoreMode,const QStringList &protocolsUsedForTheSources,const QString &protocolsUsedForTheDestination) +int Core::openNewCopyEngineInstance(const Ultracopier::CopyMode &mode,const bool &ignoreMode, + const std::vector<std::string> &protocolsUsedForTheSources,const std::string &protocolsUsedForTheDestination) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); CopyEngineManager::returnCopyEngine returnInformations=copyEngineList->getCopyEngine(mode,protocolsUsedForTheSources,protocolsUsedForTheDestination); if(returnInformations.engine==NULL) return -1; @@ -302,9 +317,9 @@ int Core::openNewCopyEngineInstance(const Ultracopier::CopyMode &mode,const bool \param protocolsUsedForTheSources protocols used for sources \param protocolsUsedForTheDestination protocols used for destination */ -int Core::openNewCopyEngineInstance(const Ultracopier::CopyMode &mode,const bool &ignoreMode,const QString &name) +int Core::openNewCopyEngineInstance(const Ultracopier::CopyMode &mode,const bool &ignoreMode,const std::string &name) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, mode: "+QString::number(mode)+", name: "+name); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, mode: "+std::to_string(mode)+", name: "+name); CopyEngineManager::returnCopyEngine returnInformations=copyEngineList->getCopyEngine(mode,name); if(returnInformations.engine==NULL) return -1; @@ -348,7 +363,7 @@ int Core::connectCopyEngine(const Ultracopier::CopyMode &mode,bool ignoreMode,co newItem.copyEngineIsSync=true; newItem.canceled=false; - switch(OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("remainingTimeAlgorithm")).toUInt()) + switch(stringtoint32(OptionEngine::optionEngine->getOptionValue("Ultracopier","remainingTimeAlgorithm"))) { default: case 0: @@ -363,7 +378,7 @@ int Core::connectCopyEngine(const Ultracopier::CopyMode &mode,bool ignoreMode,co RemainingTimeLogarithmicColumn remainingTimeLogarithmicColumn; remainingTimeLogarithmicColumn.totalSize=0; remainingTimeLogarithmicColumn.transferedSize=0; - newItem.remainingTimeLogarithmicValue << remainingTimeLogarithmicColumn; + newItem.remainingTimeLogarithmicValue.push_back(remainingTimeLogarithmicColumn); index++; } } @@ -377,10 +392,10 @@ int Core::connectCopyEngine(const Ultracopier::CopyMode &mode,bool ignoreMode,co } if(copyList.size()==0) forUpateInformation.start(); - copyList << newItem; - connectEngine(copyList.count()-1); - connectInterfaceAndSync(copyList.count()-1); - return newItem.id; + copyList.push_back(newItem); + connectEngine(static_cast<unsigned int>(copyList.size()-1)); + connectInterfaceAndSync(static_cast<unsigned int>(copyList.size()-1)); + return static_cast<int>(newItem.id); } ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to load the interface, copy aborted"); delete newItem.engine; @@ -398,24 +413,25 @@ void Core::resetSpeedDetectedEngine() { int index=indexCopySenderCopyEngine(); if(index!=-1) - resetSpeedDetected(index); + resetSpeedDetected(static_cast<unsigned int>(index)); } void Core::resetSpeedDetectedInterface() { int index=indexCopySenderInterface(); if(index!=-1) - resetSpeedDetected(index); + resetSpeedDetected(static_cast<unsigned int>(index)); } -void Core::resetSpeedDetected(const int &index) +void Core::resetSpeedDetected(const unsigned int &bindex) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start on %1").arg(index)); + const size_t &index=bindex; + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start on "+std::to_string(index)); switch(copyList.at(index).remainingTimeAlgo) { case Ultracopier::RemainingTimeAlgo_Logarithmic: { - int sub_index=0; + size_t sub_index=0; while(sub_index<ULTRACOPIER_MAXREMAININGTIMECOL) { copyList[index].remainingTimeLogarithmicValue[sub_index].lastProgressionSpeed.clear(); @@ -424,6 +440,7 @@ void Core::resetSpeedDetected(const int &index) sub_index++; } } + break; default: case Ultracopier::RemainingTimeAlgo_Traditional: copyList[index].lastSpeedDetected.clear(); @@ -434,41 +451,43 @@ void Core::resetSpeedDetected(const int &index) } } -void Core::doneTime(const QList<QPair<quint64,quint32> > &timeList) +void Core::doneTime(const std::vector<std::pair<uint64_t,uint32_t> > &timeList) { int index=indexCopySenderCopyEngine(); if(index!=-1) { - switch(copyList.at(index).remainingTimeAlgo) + CopyInstance ©Instance=copyList[index]; + switch(copyInstance.remainingTimeAlgo) { case Ultracopier::RemainingTimeAlgo_Logarithmic: - if(copyList.at(index).remainingTimeLogarithmicValue.size()<ULTRACOPIER_MAXREMAININGTIMECOL) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("bug, copyList.at(index).remainingTimeLogarithmicValue.size() %1 <ULTRACOPIER_MAXREMAININGTIMECOL").arg(copyList.at(index).remainingTimeLogarithmicValue.size())); + if(copyInstance.remainingTimeLogarithmicValue.size()<ULTRACOPIER_MAXREMAININGTIMECOL) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"bug, copyInstance.remainingTimeLogarithmicValue.size() "+std::to_string(copyInstance.remainingTimeLogarithmicValue.size())+" <ULTRACOPIER_MAXREMAININGTIMECOL"); else { - int size=timeList.size(); - int sub_index=0; - while(sub_index<size) + unsigned int sub_index=0; + while(sub_index<timeList.size()) { - const QPair<quint64,quint32> &timeUnit=timeList.at(sub_index); - const quint8 &col=fileCatNumber(timeUnit.first); - if(copyList.at(index).remainingTimeLogarithmicValue.size()<=col) + const std::pair<uint64_t,uint32_t> &timeUnit=timeList.at(sub_index); + const uint8_t &col=fileCatNumber(timeUnit.first); + RemainingTimeLogarithmicColumn &remainingTimeLogarithmicColumn=copyInstance.remainingTimeLogarithmicValue[col]; + if(copyInstance.remainingTimeLogarithmicValue.size()<=col) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("bug, copyList.at(index).remainingTimeLogarithmicValue.size() %1 < col %2").arg(copyList.at(index).remainingTimeLogarithmicValue.size()).arg(col)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"bug, copyInstance.remainingTimeLogarithmicValue.size() "+std::to_string(copyInstance.remainingTimeLogarithmicValue.size())+" < col %2"+std::to_string(col)); break; } else { if(timeUnit.second>0) { - copyList[index].remainingTimeLogarithmicValue[col].lastProgressionSpeed << timeUnit.first/timeUnit.second; - if(copyList[index].remainingTimeLogarithmicValue[col].lastProgressionSpeed.size()>ULTRACOPIER_MAXVALUESPEEDSTORED) - copyList[index].remainingTimeLogarithmicValue[col].lastProgressionSpeed.removeFirst(); + remainingTimeLogarithmicColumn.lastProgressionSpeed.push_back(static_cast<unsigned int>(timeUnit.first/timeUnit.second)); + if(remainingTimeLogarithmicColumn.lastProgressionSpeed.size()>ULTRACOPIER_MAXVALUESPEEDSTORED) + remainingTimeLogarithmicColumn.lastProgressionSpeed.pop_back(); } } sub_index++; } } + break; default: case Ultracopier::RemainingTimeAlgo_Traditional: break; @@ -483,11 +502,11 @@ void Core::actionInProgess(const Ultracopier::EngineActionInProgress &action) int index=indexCopySenderCopyEngine(); if(index!=-1) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("action: %1, from %2").arg(action).arg(index)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"action: "+std::to_string(action)+", from "+std::to_string(index)); //drop here the duplicate action if(copyList.at(index).action==action) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("The copy engine have send 2x the same EngineActionInProgress")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"The copy engine have send 2x the same EngineActionInProgress"); return; } //update time runing for time remaning caculation @@ -508,9 +527,8 @@ void Core::actionInProgess(const Ultracopier::EngineActionInProgress &action) copyList.at(index).interface->actionInProgess(action); if(action==Ultracopier::Idle) { - int index_sub_loop=0; - const int &loop_size=copyList.at(index).orderId.size(); - while(index_sub_loop<loop_size) + unsigned int index_sub_loop=0; + while(index_sub_loop<copyList.at(index).orderId.size()) { emit copyCanceled(copyList.at(index).orderId.at(index_sub_loop)); index_sub_loop++; @@ -523,7 +541,7 @@ void Core::actionInProgess(const Ultracopier::EngineActionInProgress &action) ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to locate the interface sender"); } -void Core::newFolderListing(const QString &path) +void Core::newFolderListing(const std::string &path) { int index=indexCopySenderCopyEngine(); if(index!=-1) @@ -555,9 +573,8 @@ int Core::indexCopySenderCopyEngine() ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Qt sender() NULL"); return -1; } - int index=0; - const int &loop_size=copyList.size(); - while(index<loop_size) + unsigned int index=0; + while(index<copyList.size()) { if(copyList.at(index).engine==senderObject) return index; @@ -578,9 +595,8 @@ int Core::indexCopySenderInterface() ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Qt sender() NULL"); return -1; } - int index=0; - const int &loop_size=copyList.size(); - while(index<loop_size) + unsigned int index=0; + while(index<copyList.size()) { if(copyList.at(index).interface==senderObject) return index; @@ -595,7 +611,7 @@ int Core::indexCopySenderInterface() return -1; } index=0; - while(index<loop_size) + while(index<copyList.size()) { if(copyList.at(index).interface==interface) return index; @@ -606,88 +622,88 @@ int Core::indexCopySenderInterface() return -1; } -void Core::connectEngine(const int &index) +void Core::connectEngine(const unsigned int &index) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start with index: %1: %2").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start with index: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())); //disconnectEngine(index); CopyInstance& currentCopyInstance=copyList[index]; if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::newFolderListing, this,&Core::newFolderListing,Qt::QueuedConnection))//to check to change - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the engine can not work correctly: %1: %2 for newFolderListing()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the engine can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for newFolderListing()"); if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::actionInProgess, this,&Core::actionInProgess,Qt::QueuedConnection)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the engine can not work correctly: %1: %2 for actionInProgess()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the engine can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for actionInProgess()"); if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::isInPause, this,&Core::isInPause,Qt::QueuedConnection))//to check to change - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the engine can not work correctly: %1: %2 for isInPause()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the engine can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for isInPause()"); if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::cancelAll, this,&Core::copyInstanceCanceledByEngine,Qt::QueuedConnection)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the engine can not work correctly: %1: %2 for cancelAll()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the engine can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for cancelAll()"); if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::error, this,&Core::error,Qt::QueuedConnection)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the engine can not work correctly: %1: %2 for error()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the engine can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for error()"); if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::rmPath, this,&Core::rmPath,Qt::QueuedConnection)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the engine can not work correctly: %1: %2 for rmPath()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the engine can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for rmPath()"); if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::mkPath, this,&Core::mkPath,Qt::QueuedConnection)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the engine can not work correctly: %1: %2 for mkPath()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the engine can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for mkPath()"); if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::syncReady, this,&Core::syncReady,Qt::QueuedConnection)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the engine can not work correctly: %1: %2 for syncReady()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the engine can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for syncReady()"); if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::canBeDeleted, this,&Core::deleteCopyEngine,Qt::QueuedConnection)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the engine can not work correctly: %1: %2 for syncReady()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the engine can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for syncReady()"); if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::doneTime, this,&Core::doneTime,Qt::QueuedConnection)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the engine can not work correctly: %1: %2 for doneTime()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the engine can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for doneTime()"); } -void Core::connectInterfaceAndSync(const int &index) +void Core::connectInterfaceAndSync(const unsigned int &index) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start with index: %1: %2").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start with index: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())); //disconnectInterface(index); CopyInstance& currentCopyInstance=copyList[index]; if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::pause, currentCopyInstance.engine,&PluginInterface_CopyEngine::pause)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for pause()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for pause()"); if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::resume, currentCopyInstance.engine,&PluginInterface_CopyEngine::resume)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for resume()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for resume()"); if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::skip, currentCopyInstance.engine,&PluginInterface_CopyEngine::skip)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for skip()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for skip()"); if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::newSpeedLimitation, currentCopyInstance.engine,&PluginInterface_CopyEngine::setSpeedLimitation)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for newSpeedLimitation()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for newSpeedLimitation()"); if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::userAddFolder, currentCopyInstance.engine,&PluginInterface_CopyEngine::userAddFolder)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for userAddFolder()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for userAddFolder()"); if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::userAddFile, currentCopyInstance.engine,&PluginInterface_CopyEngine::userAddFile)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for userAddFile()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for userAddFile()"); if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::removeItems, currentCopyInstance.engine,&PluginInterface_CopyEngine::removeItems)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for removeItems()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for removeItems()"); if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::moveItemsOnTop, currentCopyInstance.engine,&PluginInterface_CopyEngine::moveItemsOnTop)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for moveItemsOnTop()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for moveItemsOnTop()"); if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::moveItemsUp, currentCopyInstance.engine,&PluginInterface_CopyEngine::moveItemsUp)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for moveItemsUp()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for moveItemsUp()"); if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::moveItemsDown, currentCopyInstance.engine,&PluginInterface_CopyEngine::moveItemsDown)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for moveItemsDown()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for moveItemsDown()"); if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::moveItemsOnBottom, currentCopyInstance.engine,&PluginInterface_CopyEngine::moveItemsOnBottom)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for moveItemsOnBottom()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for moveItemsOnBottom()"); if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::exportTransferList, currentCopyInstance.engine,&PluginInterface_CopyEngine::exportTransferList)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for exportTransferList()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for exportTransferList()"); if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::exportErrorIntoTransferList, currentCopyInstance.engine,&PluginInterface_CopyEngine::exportErrorIntoTransferList)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for exportErrorIntoTransferList()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for exportErrorIntoTransferList()"); if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::importTransferList, currentCopyInstance.engine,&PluginInterface_CopyEngine::importTransferList)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for importTransferList()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for importTransferList()"); if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::newSpeedLimitation, this,&Core::resetSpeedDetectedInterface)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for newSpeedLimitation()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for newSpeedLimitation()"); if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::resume, this,&Core::resetSpeedDetectedInterface)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for resume()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for resume()"); if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::cancel, this,&Core::copyInstanceCanceledByInterface,Qt::QueuedConnection)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for cancel()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for cancel()"); if(!connect(currentCopyInstance.interface,&PluginInterface_Themes::urlDropped, this,&Core::urlDropped,Qt::QueuedConnection)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for urlDropped()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for urlDropped()"); if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::newActionOnList,this,&Core::getActionOnList, Qt::QueuedConnection)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for newActionOnList()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for newActionOnList()"); if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::pushFileProgression, currentCopyInstance.interface,&PluginInterface_Themes::setFileProgression, Qt::QueuedConnection)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for pushFileProgression()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for pushFileProgression()"); if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::pushGeneralProgression, currentCopyInstance.interface,&PluginInterface_Themes::setGeneralProgression, Qt::QueuedConnection)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for pushGeneralProgression()").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for pushGeneralProgression()"); if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::pushGeneralProgression, this,&Core::pushGeneralProgression, Qt::QueuedConnection)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for pushGeneralProgression() for this").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for pushGeneralProgression() for this"); if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::errorToRetry, currentCopyInstance.interface,&PluginInterface_Themes::errorToRetry, Qt::QueuedConnection)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("error at connect, the interface can not work correctly: %1: %2 for errorToRetry() for this").arg(index).arg((quint64)sender())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for errorToRetry() for this"); currentCopyInstance.interface->setSupportSpeedLimitation(currentCopyInstance.engine->supportSpeedLimitation()); currentCopyInstance.interface->setCopyType(currentCopyInstance.type); @@ -711,9 +727,8 @@ void Core::connectInterfaceAndSync(const int &index) void Core::periodicSynchronization() { - int index_sub_loop=0; - const int &loop_size=copyList.size(); - while(index_sub_loop<loop_size) + unsigned int index_sub_loop=0; + while(index_sub_loop<copyList.size()) { if(copyList.at(index_sub_loop).action==Ultracopier::Copying || copyList.at(index_sub_loop).action==Ultracopier::CopyingAndListing) periodicSynchronizationWithIndex(index_sub_loop); @@ -759,25 +774,24 @@ void Core::periodicSynchronizationWithIndex(const int &index) { if((currentCopyInstance.action==Ultracopier::Copying || currentCopyInstance.action==Ultracopier::CopyingAndListing)) { - currentCopyInstance.lastSpeedTime << lastProgressionTime.elapsed(); - currentCopyInstance.lastSpeedDetected << diffCopiedSize; - currentCopyInstance.lastAverageSpeedTime << lastProgressionTime.elapsed(); - currentCopyInstance.lastAverageSpeedDetected << diffCopiedSize; + currentCopyInstance.lastSpeedTime.push_back(lastProgressionTime.elapsed()); + currentCopyInstance.lastSpeedDetected.push_back(diffCopiedSize); + currentCopyInstance.lastAverageSpeedTime.push_back(lastProgressionTime.elapsed()); + currentCopyInstance.lastAverageSpeedDetected.push_back(diffCopiedSize); while(currentCopyInstance.lastSpeedTime.size()>ULTRACOPIER_MAXVALUESPEEDSTORED) - currentCopyInstance.lastSpeedTime.removeFirst(); + currentCopyInstance.lastSpeedTime.erase(currentCopyInstance.lastSpeedTime.cbegin()); while(currentCopyInstance.lastSpeedDetected.size()>ULTRACOPIER_MAXVALUESPEEDSTORED) - currentCopyInstance.lastSpeedDetected.removeFirst(); + currentCopyInstance.lastSpeedDetected.erase(currentCopyInstance.lastSpeedDetected.cbegin()); while(currentCopyInstance.lastAverageSpeedTime.size()>ULTRACOPIER_MAXVALUESPEEDSTOREDTOREMAININGTIME) - currentCopyInstance.lastAverageSpeedTime.removeFirst(); + currentCopyInstance.lastAverageSpeedTime.erase(currentCopyInstance.lastAverageSpeedTime.cbegin()); while(currentCopyInstance.lastAverageSpeedDetected.size()>ULTRACOPIER_MAXVALUESPEEDSTOREDTOREMAININGTIME) - currentCopyInstance.lastAverageSpeedDetected.removeFirst(); + currentCopyInstance.lastAverageSpeedDetected.erase(currentCopyInstance.lastAverageSpeedDetected.cbegin()); double totTime=0,totAverageTime=0; double totSpeed=0,totAverageSpeed=0; //current speed - int index_sub_loop=0; - int loop_size=currentCopyInstance.lastSpeedDetected.size(); - while(index_sub_loop<loop_size) + unsigned int index_sub_loop=0; + while(index_sub_loop<currentCopyInstance.lastSpeedDetected.size()) { totTime+=currentCopyInstance.lastSpeedTime.at(index_sub_loop); totSpeed+=currentCopyInstance.lastSpeedDetected.at(index_sub_loop); @@ -787,8 +801,7 @@ void Core::periodicSynchronizationWithIndex(const int &index) //speed to calculate the remaining time index_sub_loop=0; - loop_size=currentCopyInstance.lastAverageSpeedDetected.size(); - while(index_sub_loop<loop_size) + while(index_sub_loop<currentCopyInstance.lastAverageSpeedDetected.size()) { totAverageTime+=currentCopyInstance.lastAverageSpeedTime.at(index_sub_loop); totAverageSpeed+=currentCopyInstance.lastAverageSpeedDetected.at(index_sub_loop); @@ -797,11 +810,11 @@ void Core::periodicSynchronizationWithIndex(const int &index) totAverageTime/=1000; if(totTime>0) - if(loop_size>=ULTRACOPIER_MINVALUESPEED) + if(currentCopyInstance.lastAverageSpeedDetected.size()>=ULTRACOPIER_MINVALUESPEED) currentCopyInstance.interface->detectedSpeed(totSpeed/totTime); if(totAverageTime>0) - if(loop_size>=ULTRACOPIER_MINVALUESPEEDTOREMAININGTIME) + if(currentCopyInstance.lastAverageSpeedDetected.size()>=ULTRACOPIER_MINVALUESPEEDTOREMAININGTIME) { if(currentCopyInstance.remainingTimeAlgo==Ultracopier::RemainingTimeAlgo_Traditional) { @@ -821,8 +834,7 @@ void Core::periodicSynchronizationWithIndex(const int &index) int remainingTimeValue=0; //calculate for each file class index_sub_loop=0; - loop_size=currentCopyInstance.remainingTimeLogarithmicValue.size(); - while(index_sub_loop<loop_size) + while(index_sub_loop<currentCopyInstance.remainingTimeLogarithmicValue.size()) { const RemainingTimeLogarithmicColumn &remainingTimeLogarithmicColumn=currentCopyInstance.remainingTimeLogarithmicValue.at(index_sub_loop); //normal detect @@ -830,7 +842,7 @@ void Core::periodicSynchronizationWithIndex(const int &index) if(remainingTimeLogarithmicColumn.lastProgressionSpeed.size()>=ULTRACOPIER_MINVALUESPEED) { int average_speed=0; - int temp_loop_index=0; + unsigned int temp_loop_index=0; while(temp_loop_index<remainingTimeLogarithmicColumn.lastProgressionSpeed.size()) { average_speed+=remainingTimeLogarithmicColumn.lastProgressionSpeed.at(temp_loop_index); @@ -866,7 +878,7 @@ void Core::periodicSynchronizationWithIndex(const int &index) } } -quint8 Core::fileCatNumber(quint64 size) +uint8_t Core::fileCatNumber(uint64_t size) { //all is in base 10 to understand more easily //drop the big value @@ -879,7 +891,7 @@ quint8 Core::fileCatNumber(quint64 size) /// \brief the copy engine have canceled the transfer void Core::copyInstanceCanceledByEngine() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); int index=indexCopySenderCopyEngine(); if(index!=-1) copyInstanceCanceledByIndex(index); @@ -890,7 +902,7 @@ void Core::copyInstanceCanceledByEngine() /// \brief the interface have canceled the transfer void Core::copyInstanceCanceledByInterface() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); int index=indexCopySenderInterface(); if(index!=-1) copyInstanceCanceledByIndex(index); @@ -899,9 +911,9 @@ void Core::copyInstanceCanceledByInterface() } /// \brief the transfer have been canceled -void Core::copyInstanceCanceledByIndex(const int &index) +void Core::copyInstanceCanceledByIndex(const unsigned int &index) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, remove with the index: "+QString::number(index)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, remove with the index: "+std::to_string(index)); //disconnectEngine(index); //disconnectInterface(index); copyList[index].canceled=true; @@ -909,18 +921,17 @@ void Core::copyInstanceCanceledByIndex(const int &index) currentCopyInstance.engine->cancel(); delete currentCopyInstance.nextConditionalSync; delete currentCopyInstance.interface; - int index_sub_loop=0; - const int &loop_size=currentCopyInstance.orderId.size(); - while(index_sub_loop<loop_size) + unsigned int index_sub_loop=0; + while(index_sub_loop<currentCopyInstance.orderId.size()) { emit copyCanceled(currentCopyInstance.orderId.at(index_sub_loop)); index_sub_loop++; } currentCopyInstance.orderId.clear(); - copyList.removeAt(index); + copyList.erase(copyList.cbegin()+index); if(copyList.size()==0) forUpateInformation.stop(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"copyList.size(): "+QString::number(copyList.size())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"copyList.size(): "+std::to_string(copyList.size())); } /// \brief only when the copy engine say it's ready to delete them self, it call this @@ -946,7 +957,7 @@ void Core::deleteCopyEngine() } //error occurred -void Core::error(const QString &path,const quint64 &size,const QDateTime &mtime,const QString &error) +void Core::error(const std::string &path,const uint64_t &size,const uint64_t &mtime,const std::string &error) { log.error(path,size,mtime,error); int index=indexCopySenderCopyEngine(); @@ -960,12 +971,12 @@ void Core::error(const QString &path,const quint64 &size,const QDateTime &mtime, } //for the extra logging -void Core::rmPath(const QString &path) +void Core::rmPath(const std::string &path) { log.rmPath(path); } -void Core::mkPath(const QString &path) +void Core::mkPath(const std::string &path) { log.mkPath(path); } @@ -980,27 +991,26 @@ void Core::syncReady() ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to locate the copy engine sender"); } -void Core::getActionOnList(const QList<Ultracopier::ReturnActionOnCopyList> &actionList) +void Core::getActionOnList(const std::vector<Ultracopier::ReturnActionOnCopyList> &actionList) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); //send the the interface const int &index=indexCopySenderCopyEngine(); if(index!=-1) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start2")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start2"); if(copyList.at(index).copyEngineIsSync) copyList.at(index).interface->getActionOnList(actionList); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start3")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start3"); //log to the file and compute the remaining time if(log.logTransfer() || copyList.at(index).remainingTimeAlgo==Ultracopier::RemainingTimeAlgo_Logarithmic) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start4")); - int sub_index=0; - const int &size=actionList.size(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start4"); + unsigned int sub_index=0; if(log.logTransfer() && copyList.at(index).remainingTimeAlgo==Ultracopier::RemainingTimeAlgo_Logarithmic) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start5")); - while(sub_index<size) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start5"); + while(sub_index<actionList.size()) { const Ultracopier::ReturnActionOnCopyList &returnAction=actionList.at(sub_index); switch(returnAction.type) @@ -1034,8 +1044,8 @@ void Core::getActionOnList(const QList<Ultracopier::ReturnActionOnCopyList> &act } else if(log.logTransfer()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start6")); - while(sub_index<size) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start6"); + while(sub_index<actionList.size()) { const Ultracopier::ReturnActionOnCopyList &returnAction=actionList.at(sub_index); switch(returnAction.type) @@ -1062,8 +1072,8 @@ void Core::getActionOnList(const QList<Ultracopier::ReturnActionOnCopyList> &act } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start7")); - while(sub_index<size) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start7"); + while(sub_index<actionList.size()) { const Ultracopier::ReturnActionOnCopyList &returnAction=actionList.at(sub_index); switch(returnAction.type) @@ -1088,16 +1098,16 @@ void Core::getActionOnList(const QList<Ultracopier::ReturnActionOnCopyList> &act sub_index++; } } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start8")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start8"); } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start9")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start9"); } else ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to locate the copy engine sender"); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start end")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start end"); } -void Core::pushGeneralProgression(const quint64 ¤t,const quint64 &total) +void Core::pushGeneralProgression(const uint64_t ¤t,const uint64_t &total) { int index=indexCopySenderCopyEngine(); if(index!=-1) @@ -1110,18 +1120,19 @@ void Core::pushGeneralProgression(const quint64 ¤t,const quint64 &total) } /// \brief used to drag and drop files -void Core::urlDropped(const QList<QUrl> &urls) +void Core::urlDropped(const std::vector<std::string> &urls) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - int index=indexCopySenderInterface(); - if(index!=-1) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + int bindex=indexCopySenderInterface(); + if(bindex!=-1) { - QStringList sources; - int index_loop=0; + const unsigned int &index=static_cast<unsigned int>(bindex); + std::vector<std::string> sources; + unsigned int index_loop=0; while(index_loop<urls.size()) { - if(!urls.at(index_loop).isEmpty()) - sources << urls.at(index_loop).toLocalFile(); + if(!urls.at(index_loop).empty()) + sources.push_back(urls.at(index_loop)); index_loop++; } if(sources.size()==0) @@ -41,28 +41,28 @@ class Core : public QObject }; struct RemainingTimeLogarithmicColumn { - QList<int> lastProgressionSpeed; - quint64 totalSize; - quint64 transferedSize; + std::vector<int> lastProgressionSpeed; + uint64_t totalSize; + uint64_t transferedSize; }; struct CopyInstance { - int id; + unsigned int id; PluginInterface_CopyEngine * engine; PluginInterface_Themes * interface; bool ignoreMode; Ultracopier::CopyMode mode; - quint64 numberOfFile; - quint64 numberOfTransferedFile; - quint64 currentProgression,totalProgression;//store the file byte transfered, used into the remaining time + uint64_t numberOfFile; + uint64_t numberOfTransferedFile; + uint64_t currentProgression,totalProgression;//store the file byte transfered, used into the remaining time Ultracopier::EngineActionInProgress action; - quint64 lastProgression;//store the real byte transfered, used in speed calculation - QList<RunningTransfer> transferItemList;//full info of started item, to have wich progression to poll - QList<quint32> orderId;//external order send via listener plugin - QString folderListing; - QString collisionAction; - QString errorAction; + uint64_t lastProgression;//store the real byte transfered, used in speed calculation + std::vector<RunningTransfer> transferItemList;//full info of started item, to have wich progression to poll + std::vector<uint32_t> orderId;//external order send via listener plugin + std::string folderListing; + std::string collisionAction; + std::string errorAction; bool isPaused; bool isRunning; Ultracopier::CopyType type; @@ -77,38 +77,37 @@ class Core : public QObject /** for RemainingTimeAlgo_Traditional **/ //this speed is for instant speed - QList<quint64> lastSpeedDetected;//stored in bytes - QList<double> lastSpeedTime;//stored in ms + std::vector<uint64_t> lastSpeedDetected;//stored in bytes + std::vector<double> lastSpeedTime;//stored in ms //this speed is average speed on more time to calculate the remaining time - QList<quint64> lastAverageSpeedDetected;//stored in bytes - QList<double> lastAverageSpeedTime;//stored in ms + std::vector<uint64_t> lastAverageSpeedDetected;//stored in bytes + std::vector<double> lastAverageSpeedTime;//stored in ms /** for RemainingTimeAlgo_Logarithmic **/ - QList<RemainingTimeLogarithmicColumn> remainingTimeLogarithmicValue; + std::vector<RemainingTimeLogarithmicColumn> remainingTimeLogarithmicValue; }; - QList<CopyInstance> copyList; + std::vector<CopyInstance> copyList; /** open with specific source/destination \param move Copy or move \param ignoreMode if need ignore the mode \param protocolsUsedForTheSources protocols used for sources \param protocolsUsedForTheDestination protocols used for destination */ - int openNewCopyEngineInstance(const Ultracopier::CopyMode &mode,const bool &ignoreMode,const QStringList &protocolsUsedForTheSources=QStringList(),const QString &protocolsUsedForTheDestination=""); + int openNewCopyEngineInstance(const Ultracopier::CopyMode &mode,const bool &ignoreMode,const std::vector<std::string> &protocolsUsedForTheSources=std::vector<std::string>(),const std::string &protocolsUsedForTheDestination=""); /** open with specific copy engine \param move Copy or move \param ignoreMode if need ignore the mode - \param protocolsUsedForTheSources protocols used for sources - \param protocolsUsedForTheDestination protocols used for destination + \param name protocols used for sources */ - int openNewCopyEngineInstance(const Ultracopier::CopyMode &mode,const bool &ignoreMode,const QString &name); + int openNewCopyEngineInstance(const Ultracopier::CopyMode &mode,const bool &ignoreMode,const std::string &name); /// \brief get the right copy instance (copy engine + interface), by signal emited from copy engine int indexCopySenderCopyEngine(); /// \brief get the right copy instance (copy engine + interface), by signal emited from interface int indexCopySenderInterface(); - void connectEngine(const int &index); - void connectInterfaceAndSync(const int &index); + void connectEngine(const unsigned int &index); + void connectInterfaceAndSync(const unsigned int &index); //void disconnectEngine(const int &index); //void disconnectInterface(const int &index); @@ -117,52 +116,54 @@ class Core : public QObject void periodicSynchronizationWithIndex(const int &index); //for the internal management - int incrementId(); - int nextId; - QList<int> idList; + unsigned int incrementId(); + unsigned int nextId; + std::vector<unsigned int> idList; QTime lastProgressionTime; QTimer forUpateInformation;///< used to call \see periodicSynchronization() - void resetSpeedDetected(const int &index); + void resetSpeedDetected(const unsigned int &bindex); /** Connect the copy engine instance provided previously to the management */ int connectCopyEngine(const Ultracopier::CopyMode &mode,bool ignoreMode,const CopyEngineManager::returnCopyEngine &returnInformations); LogThread log;///< To save the log like mkpath, rmpath, error, copy, ... - quint64 realByteTransfered; + uint64_t realByteTransfered; - static quint8 fileCatNumber(quint64 size); + static uint8_t fileCatNumber(uint64_t size); signals: - void copyFinished(const quint32 & orderId,bool withError) const; - void copyCanceled(const quint32 & orderId) const; + void copyFinished(const uint32_t & orderId,bool withError) const; + void copyCanceled(const uint32_t & orderId) const; public slots: /** \brief do copy with sources, but ask the destination */ - void newCopyWithoutDestination(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources); - void newTransfer(const Ultracopier::CopyMode &mode,const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources,const QString &protocolsUsedForTheDestination,const QString &destination); + void newCopyWithoutDestination(const uint32_t &orderId,const std::vector<std::string> &protocolsUsedForTheSources,const std::vector<std::string> &sources); + void newTransfer(const Ultracopier::CopyMode &mode,const uint32_t &orderId,const std::vector<std::string> &protocolsUsedForTheSources,const std::vector<std::string> &sources,const std::string &protocolsUsedForTheDestination,const std::string &destination); /** \brief do copy with sources and destination */ - void newCopy(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources,const QString &protocolsUsedForTheDestination,const QString &destination); + void newCopy(const uint32_t &orderId,const std::vector<std::string> &protocolsUsedForTheSources,const std::vector<std::string> &sources,const std::string &protocolsUsedForTheDestination,const std::string &destination); /** \brief do move with sources, but ask the destination */ - void newMoveWithoutDestination(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources); + void newMoveWithoutDestination(const uint32_t &orderId,const std::vector<std::string> &protocolsUsedForTheSources,const std::vector<std::string> &sources); /** \brief do move with sources and destination */ - void newMove(const quint32 &orderId,const QStringList &protocolsUsedForTheSources,const QStringList &sources,const QString &protocolsUsedForTheDestination,const QString &destination); + void newMove(const uint32_t &orderId,const std::vector<std::string> &protocolsUsedForTheSources,const std::vector<std::string> &sources,const std::string &protocolsUsedForTheDestination,const std::string &destination); /** \brief open copy/move windows with specific engine */ - void addWindowCopyMove(const Ultracopier::CopyMode &mode,const QString &name); + void addWindowCopyMove(const Ultracopier::CopyMode &mode,const std::string &name); /** \brief open transfer (copy+move) windows with specific engine */ - void addWindowTransfer(const QString &name); + void addWindowTransfer(const std::string &name); /** new transfer list pased by the CLI */ - void newTransferList(QString engine,QString mode,QString file); + void newTransferList(std::string engine,std::string mode,std::string file); + + bool startNewTransferOneUniqueCopyEngine(); private slots: /// \brief the copy engine have canceled the transfer void copyInstanceCanceledByEngine(); /// \brief the interface have canceled the transfer void copyInstanceCanceledByInterface(); /// \brief the transfer have been canceled - void copyInstanceCanceledByIndex(const int &index); + void copyInstanceCanceledByIndex(const unsigned int &index); /// \brief only when the copy engine say it's ready to delete them self, it call this void deleteCopyEngine(); // some stat update void actionInProgess(const Ultracopier::EngineActionInProgress &action); - void newFolderListing(const QString &path); + void newFolderListing(const std::string &path); void isInPause(const bool&); /** \brief update at periodic interval, the synchronization between copy engine and interface @@ -178,19 +179,19 @@ class Core : public QObject void unloadInterface(); //error occurred - void error(const QString &path,const quint64 &size,const QDateTime &mtime,const QString &error); + void error(const std::string &path,const uint64_t &size,const uint64_t &mtime,const std::string &error); //for the extra logging - void rmPath(const QString &path); - void mkPath(const QString &path); + void rmPath(const std::string &path); + void mkPath(const std::string &path); /// \brief used to drag and drop files - void urlDropped(const QList<QUrl> &urls); + void urlDropped(const std::vector<std::string> &urls); /// \brief to rsync after a new interface connection void syncReady(); - void doneTime(const QList<QPair<quint64,quint32> > &timeList); + void doneTime(const std::vector<std::pair<uint64_t,uint32_t> > &timeList); - void getActionOnList(const QList<Ultracopier::ReturnActionOnCopyList> & actionList); - void pushGeneralProgression(const quint64 ¤t,const quint64 &total); + void getActionOnList(const std::vector<Ultracopier::ReturnActionOnCopyList> & actionList); + void pushGeneralProgression(const uint64_t ¤t,const uint64_t &total); }; #endif // CORE_H diff --git a/DebugEngine.cpp b/DebugEngine.cpp index 2cdfaab..2168210 100644 --- a/DebugEngine.cpp +++ b/DebugEngine.cpp @@ -7,11 +7,13 @@ #include <QMessageBox> #include <QFileDialog> #include <QLocalSocket> -#include <QRegularExpression> +#include <regex> +#include <iostream> #include "Variable.h" #include "DebugEngine.h" #include "ExtraSocket.h" +#include "cpp11addition.h" #ifdef WIN32 # define __func__ __FUNCTION__ @@ -29,7 +31,7 @@ /// \brief initiate the ultracopier event dispatcher and check if no other session is running DebugEngine::DebugEngine() { - fileNameCleaner=QRegularExpression(QStringLiteral("\\.\\.?[/\\\\]([^/]+[/\\\\])?")); + //fileNameCleaner=std::regex("\\.\\.?[/\\\\]([^/]+[/\\\\])?"); quit=false; QStringList ultracopierArguments=QCoreApplication::arguments(); if(ultracopierArguments.size()==2) @@ -56,12 +58,8 @@ DebugEngine::DebugEngine() debugHtmlContent+="td {white-space:nowrap;}"; debugHtmlContent+="</style>"; debugHtmlContent+="<title>"; - #ifdef ULTRACOPIER_MODE_SUPERCOPIER - debugHtmlContent+="Supercopier"; - #else debugHtmlContent+="Ultracopier"; - #endif - debugHtmlContent+=" "+QString(ULTRACOPIER_VERSION)+" "+QString(ULTRACOPIER_PLATFORM_NAME)+", debug report</title>"; + debugHtmlContent+=" "+std::string(ULTRACOPIER_VERSION)+" "+ULTRACOPIER_PLATFORM_NAME.toStdString()+", debug report</title>"; debugHtmlContent+="</head>"; debugHtmlContent+="<body>"; debugHtmlContent+="<table>"; @@ -85,14 +83,14 @@ DebugEngine::DebugEngine() dir.cdUp(); dir.cdUp(); dir.cd("Data"); - logFile.setFileName(dir.absolutePath()+QDir::separator()+"log.html"); - lockFile.setFileName(dir.absolutePath()+QDir::separator()+"ultracopier.lock"); + logFile.setFileName(dir.absolutePath()+FacilityEngine::separator()+"log.html"); + lockFile.setFileName(dir.absolutePath()+FacilityEngine::separator()+"ultracopier.lock"); fileNameIsLoaded=true; #else //Load the ultracopier path QDir dir(QCoreApplication::applicationDirPath()); - logFile.setFileName(dir.absolutePath()+QDir::separator()+"log.html"); - lockFile.setFileName(dir.absolutePath()+QDir::separator()+"ultracopier.lock"); + logFile.setFileName(dir.absolutePath()+FacilityEngine::separator()+"log.html"); + lockFile.setFileName(dir.absolutePath()+FacilityEngine::separator()+"ultracopier.lock"); fileNameIsLoaded=true; #endif #else @@ -136,10 +134,10 @@ DebugEngine::DebugEngine() //Ask to the user QMessageBox::StandardButton reply = QMessageBox::question(NULL,"Save the previous report", #ifdef ULTRACOPIER_MODE_SUPERCOPIER - QString("Supercopier")+ + QString("Supercopier")+ #else - QString("Ultracopier")+ - #endif + QString("Ultracopier")+ + #endif " seam have crashed, do you want save the previous report for report it to the forum?",QMessageBox::Yes|QMessageBox::No,QMessageBox::No); if(reply==QMessageBox::Yes) saveBugReport(); @@ -165,7 +163,7 @@ DebugEngine::DebugEngine() { logFile.resize(0); currentBackend=File; - logFile.write(debugHtmlContent.toUtf8()); + logFile.write(debugHtmlContent.data(),static_cast<qint64>(debugHtmlContent.size())); } } } @@ -178,7 +176,7 @@ DebugEngine::~DebugEngine() { removeTheLockFile(); //Finalize the log file - logFile.write(endOfLogFile.toUtf8()); + logFile.write(endOfLogFile.data(),static_cast<qint64>(endOfLogFile.size())); logFile.close(); } } @@ -231,11 +229,11 @@ bool DebugEngine::removeTheLockFile() return true; } -void DebugEngine::addDebugInformationStatic(const Ultracopier::DebugLevel &level,const QString& function,const QString& text,const QString& file,const int& ligne,const QString& location) +void DebugEngine::addDebugInformationStatic(const Ultracopier::DebugLevel &level,const std::string& function,const std::string& text,const std::string& file,const int& ligne,const std::string& location) { if(DebugEngine::debugEngine==NULL) { - qWarning() << QStringLiteral("After close: ") << function << file << ligne; + std::cerr << "After close: " << function << file << ligne; return; } DebugLevel_custom tempLevel=DebugLevel_custom_Information; @@ -259,74 +257,77 @@ void DebugEngine::addDebugInformationStatic(const Ultracopier::DebugLevel &level DebugEngine::debugEngine->addDebugInformation(tempLevel,function,text,file,ligne,location); } -void DebugEngine::addDebugNote(const QString& text) +void DebugEngine::addDebugNote(const std::string& text) { if(DebugEngine::debugEngine==NULL) return; - DebugEngine::debugEngine->addDebugInformation(DebugLevel_custom_UserNote,QStringLiteral(""),text,QStringLiteral(""),-1,QStringLiteral("Core")); + DebugEngine::debugEngine->addDebugInformation(DebugLevel_custom_UserNote,"",text,"",-1,"Core"); } /// \brief For add message info, this function is thread safe -void DebugEngine::addDebugInformation(const DebugLevel_custom &level,const QString& function,const QString& text,QString file,const int& ligne,const QString& location) +void DebugEngine::addDebugInformation(const DebugLevel_custom &level,const std::string& function,const std::string& text,std::string file,const int& ligne,const std::string& location) { if(DebugEngine::debugEngine==NULL) { - qWarning() << QStringLiteral("After close: ") << function << file << ligne; + std::cerr << "After close: " << function << file << ligne; return; } //Remove the compiler extra patch generated - file=file.remove(fileNameCleaner); - QString addDebugInformation_lignestring=QString::number(ligne); - QString addDebugInformation_fileString=file; + //file=file.remove(fileNameCleaner);don't clean, too many performance heart + std::string addDebugInformation_lignestring=std::to_string(ligne); + std::string addDebugInformation_fileString=file; if(ligne!=-1) - addDebugInformation_fileString+=QStringLiteral(":")+addDebugInformation_lignestring; + addDebugInformation_fileString+=":"+addDebugInformation_lignestring; //Load the time from start - QString addDebugInformation_time = QString::number(startTime.elapsed()); - QString addDebugInformation_htmlFormat; + std::string addDebugInformation_time = std::to_string(startTime.elapsed()); + std::string addDebugInformation_htmlFormat; bool important=true; switch(level) { case DebugLevel_custom_Information: - addDebugInformation_htmlFormat=QStringLiteral("<tr class=\"Information\"><td class=\"time\">")+addDebugInformation_time+QStringLiteral("</span></td><td>")+addDebugInformation_fileString+QStringLiteral("</td><td class=\"function\">")+function+QStringLiteral("()</td><td class=\"location\">")+location+QStringLiteral("</td><td>")+htmlEntities(text)+QStringLiteral("</td></tr>\n"); + addDebugInformation_htmlFormat="<tr class=\"Information\"><td class=\"time\">"; break; case DebugLevel_custom_Critical: - addDebugInformation_htmlFormat=QStringLiteral("<tr class=\"Critical\"><td class=\"time\">")+addDebugInformation_time+QStringLiteral("</span></td><td>")+addDebugInformation_fileString+QStringLiteral("</td><td class=\"function\">")+function+QStringLiteral("()</td><td class=\"location\">")+location+QStringLiteral("</td><td>")+htmlEntities(text)+QStringLiteral("</td></tr>\n"); + addDebugInformation_htmlFormat="<tr class=\"Critical\"><td class=\"time\">"; break; case DebugLevel_custom_Warning: - addDebugInformation_htmlFormat=QStringLiteral("<tr class=\"Warning\"><td class=\"time\">")+addDebugInformation_time+QStringLiteral("</span></td><td>")+addDebugInformation_fileString+QStringLiteral("</td><td class=\"function\">")+function+QStringLiteral("()</td><td class=\"location\">")+location+QStringLiteral("</td><td>")+htmlEntities(text)+QStringLiteral("</td></tr>\n"); + addDebugInformation_htmlFormat="<tr class=\"Warning\"><td class=\"time\">"; break; case DebugLevel_custom_Notice: { - addDebugInformation_htmlFormat=QStringLiteral("<tr class=\"Notice\"><td class=\"time\">")+addDebugInformation_time+QStringLiteral("</span></td><td>")+addDebugInformation_fileString+QStringLiteral("</td><td class=\"function\">")+function+QStringLiteral("()</td><td class=\"location\">")+location+QStringLiteral("</td><td>")+htmlEntities(text)+QStringLiteral("</td></tr>\n"); + addDebugInformation_htmlFormat="<tr class=\"Notice\"><td class=\"time\">"; important=false; } break; case DebugLevel_custom_UserNote: - addDebugInformation_htmlFormat=QStringLiteral("<tr class=\"Note\"><td class=\"time\">")+addDebugInformation_time+QStringLiteral("</span></td><td>")+addDebugInformation_fileString+QStringLiteral("</td><td class=\"function\">")+function+QStringLiteral("()</td><td class=\"location\">")+location+QStringLiteral("</td><td>")+htmlEntities(text)+QStringLiteral("</td></tr>\n"); + addDebugInformation_htmlFormat="<tr class=\"Note\"><td class=\"time\">"; break; } + addDebugInformation_htmlFormat+=addDebugInformation_time+"</span></td><td>"+addDebugInformation_fileString+"</td><td class=\"function\">"+function+"()</td><td class=\"location\">"+location+"</td><td>"+htmlEntities(text)+"</td></tr>\n"; //To prevent access of string in multi-thread { //Show the text in console - QString addDebugInformation_textFormat; - addDebugInformation_textFormat = QStringLiteral("(")+addDebugInformation_time.rightJustified(8,' ')+QStringLiteral(") "); - if(file!="" && ligne!=-1) - addDebugInformation_textFormat += file+QStringLiteral(":")+addDebugInformation_lignestring+QStringLiteral(":"); - addDebugInformation_textFormat += function+QStringLiteral("(), (location: ")+location+QStringLiteral("): ")+text; + std::string addDebugInformation_textFormat; + if(addDebugInformation_time.size()<8) + addDebugInformation_time=std::string(8-addDebugInformation_time.size(),' ')+addDebugInformation_time; + addDebugInformation_textFormat = "("+addDebugInformation_time+") "; + if(!file.empty() && ligne!=-1) + addDebugInformation_textFormat += file+":"+addDebugInformation_lignestring+":"; + addDebugInformation_textFormat += function+"(), (location: "+location+"): "+text; QMutexLocker lock_mutex(&mutex); if(currentBackend==File) { if(logFile.size()<ULTRACOPIER_DEBUG_MAX_ALL_SIZE*1024*1024 || (important && logFile.size()<ULTRACOPIER_DEBUG_MAX_IMPORTANT_SIZE*1024*1024)) { - puts(qPrintable(addDebugInformation_textFormat)); - logFile.write(addDebugInformation_htmlFormat.toUtf8()); + std::cout << addDebugInformation_textFormat << std::endl; + logFile.write(addDebugInformation_htmlFormat.data(),static_cast<qint64>(addDebugInformation_htmlFormat.size())); } } else { if(debugHtmlContent.size()<ULTRACOPIER_DEBUG_MAX_ALL_SIZE*1024*1024 || (important && debugHtmlContent.size()<ULTRACOPIER_DEBUG_MAX_IMPORTANT_SIZE*1024*1024)) { - puts(qPrintable(addDebugInformation_textFormat)); + std::cout << addDebugInformation_textFormat << std::endl; debugHtmlContent+=addDebugInformation_htmlFormat; } } @@ -334,40 +335,41 @@ void DebugEngine::addDebugInformation(const DebugLevel_custom &level,const QStri if(addDebugInformationCallNumber<ULTRACOPIER_DEBUG_MAX_GUI_LINE) { addDebugInformationCallNumber++; - DebugModel::debugModel->addDebugInformation(startTime.elapsed(),level,function,text,file,ligne,location); + DebugModel::debugModel->addDebugInformation(startTime.elapsed(),level,function,text,file,static_cast<const unsigned int>(ligne),location); } } } /// \brief Get the html text info for re-show it -QString DebugEngine::getTheDebugHtml() +std::string DebugEngine::getTheDebugHtml() { if(currentBackend==File) { logFile.seek(0); if(!logFile.isOpen()) ULTRACOPIER_DEBUGCONSOLE(DebugLevel_custom_Warning,"The log file is not open"); - return QString().fromUtf8(logFile.readAll().data())+endOfLogFile; + const QByteArray &data=logFile.readAll(); + return std::string(data.constData(),static_cast<size_t>(data.size()))+endOfLogFile; } else return debugHtmlContent+endOfLogFile; } /// \brief Get the html end -QString DebugEngine::getTheDebugEnd() +std::string DebugEngine::getTheDebugEnd() { return endOfLogFile; } /// \brief Drop the html entities -QString DebugEngine::htmlEntities(const QString &text) +std::string DebugEngine::htmlEntities(const std::string &text) { - QString newText(text); - newText.replace('&',"&"); - newText.replace('"',"""); - newText.replace('\'',"'"); - newText.replace('<',"<"); - newText.replace('>',">"); + std::string newText(text); + stringreplaceAll(newText,"&","&"); + /*stringreplaceAll(newText,"\"","""); + stringreplaceAll(newText,"\\","'");*/ + stringreplaceAll(newText,"<","<"); + stringreplaceAll(newText,">",">"); return newText; } @@ -380,7 +382,7 @@ DebugEngine::Backend DebugEngine::getCurrentBackend() bool DebugEngine::tryConnect() { QLocalSocket localSocket; - localSocket.connectToServer(ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME),QIODevice::WriteOnly|QIODevice::Unbuffered); + localSocket.connectToServer(QString::fromStdString(ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME)),QIODevice::WriteOnly|QIODevice::Unbuffered); if(localSocket.waitForConnected(1000)) { localSocket.disconnectFromServer(); diff --git a/DebugEngine.h b/DebugEngine.h index e39470e..7a75264 100644 --- a/DebugEngine.h +++ b/DebugEngine.h @@ -9,6 +9,7 @@ #include <QObject> #include <QString> +#include <string> #include <QFile> #include <QMutex> #include <QTime> @@ -17,6 +18,7 @@ #include <QCoreApplication> #include <QAbstractTableModel> #include <QRegularExpression> +#include <regex> #include "Variable.h" #include "PlatformMacro.h" @@ -32,12 +34,12 @@ public: /// \brief the transfer item displayed struct DebugItem { - int time; + unsigned int time; DebugLevel_custom level; - QString function; - QString text; - QString file; - QString location; + std::string function; + std::string text; + std::string file; + std::string location; }; static DebugModel *debugModel; @@ -50,13 +52,13 @@ public: virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; virtual bool setData(const QModelIndex&, const QVariant&, int = Qt::EditRole); - void addDebugInformation(const int &time, const DebugLevel_custom &level, const QString& function, const QString& text, const QString &file="", const int& ligne=-1, const QString& location="Core"); + void addDebugInformation(const int &time, const DebugLevel_custom &level, const std::string& function, const std::string& text, const std::string &file="", const unsigned int& ligne=0, const std::string& location="Core"); void setupTheTimer(); QTimer *updateDisplayTimer; bool displayed; bool inWaitOfDisplay; private: - QList<DebugItem> list; + std::vector<DebugItem> list; private slots: void updateDisplay(); }; @@ -75,7 +77,7 @@ class DebugEngine : public QObject ~DebugEngine(); /** \brief Get the html text info for re-show it \note This function is thread safe */ - QString getTheDebugHtml(); + std::string getTheDebugHtml(); /// \brief Enumeration of backend enum Backend { @@ -85,17 +87,17 @@ class DebugEngine : public QObject /// \brief return the current backend Backend getCurrentBackend(); /// \brief Get the html end - QString getTheDebugEnd(); + std::string getTheDebugEnd(); /** \brief For add message info, this function \note This function is reentrant */ - static void addDebugInformationStatic(const Ultracopier::DebugLevel &level,const QString& function,const QString& text,const QString& file="",const int& ligne=-1,const QString& location="Core"); - static void addDebugNote(const QString& text); + static void addDebugInformationStatic(const Ultracopier::DebugLevel &level,const std::string& function,const std::string& text,const std::string& file="",const int& ligne=-1,const std::string& location="Core"); + static void addDebugNote(const std::string& text); static DebugEngine *debugEngine; public slots: /** \brief ask to the user where save the bug report \warning This function can be only call by the graphical thread */ void saveBugReport(); - void addDebugInformation(const DebugLevel_custom &level,const QString& fonction,const QString& text,QString file="",const int& ligne=-1,const QString& location="Core"); + void addDebugInformation(const DebugLevel_custom &level,const std::string& fonction,const std::string& text,std::string file="",const int& ligne=-1,const std::string& location="Core"); private: /// \brief Path for log file QFile logFile; @@ -110,18 +112,18 @@ class DebugEngine : public QObject /// \brief For record the start time QTime startTime; /// \brief String for the end of log file - QString endOfLogFile; + std::string endOfLogFile; /// \brief Drop the html entities - QString htmlEntities(const QString &text); + std::string htmlEntities(const std::string &text); /// \brief To store the debug informations - QString debugHtmlContent; + std::string debugHtmlContent; /// \brief The current backend Backend currentBackend; /// try connect to send to the current running instance the arguements bool tryConnect(); int addDebugInformationCallNumber; bool quit; - QRegularExpression fileNameCleaner; + //std::regex fileNameCleaner;don't clean, too many performance heart }; #endif // ULTRACOPIER_DEBUG diff --git a/DebugModel.cpp b/DebugModel.cpp index 2a7b173..5afa3ba 100644 --- a/DebugModel.cpp +++ b/DebugModel.cpp @@ -31,7 +31,7 @@ QVariant DebugModel::data( const QModelIndex& index, int role ) const int row,column; row=index.row(); column=index.column(); - if(index.parent()!=QModelIndex() || row < 0 || row >= list.count() || column < 0 || column >= COLUMN_COUNT) + if(index.parent()!=QModelIndex() || row < 0 || row >= (int)list.size() || column < 0 || column >= COLUMN_COUNT) return QVariant(); const DebugItem& item = list.at(row); @@ -45,16 +45,16 @@ QVariant DebugModel::data( const QModelIndex& index, int role ) const return item.time; break; case 1: - return item.file; + return QString::fromStdString(item.file); break; case 2: - return item.function; + return QString::fromStdString(item.function); break; case 3: - return item.location; + return QString::fromStdString(item.location); break; case 4: - return item.text; + return QString::fromStdString(item.text); break; default: return QVariant(); @@ -89,7 +89,7 @@ QVariant DebugModel::data( const QModelIndex& index, int role ) const int DebugModel::rowCount( const QModelIndex& parent ) const { - return parent == QModelIndex() ? list.count() : 0; + return parent == QModelIndex() ? list.size() : 0; } QVariant DebugModel::headerData( int section, Qt::Orientation orientation, int role ) const @@ -117,16 +117,16 @@ bool DebugModel::setData( const QModelIndex&, const QVariant&, int) return false; } -void DebugModel::addDebugInformation(const int &time,const DebugLevel_custom &level,const QString& function,const QString& text,const QString &file,const int& ligne,const QString& location) +void DebugModel::addDebugInformation(const int &time, const DebugLevel_custom &level, const std::string &function, const std::string &text, const std::string &file, const unsigned int& ligne, const std::string &location) { DebugItem item; item.time=time; item.level=level; item.function=function; item.text=text; - item.file=QStringLiteral("%1:%2").arg(file).arg(ligne); + item.file=file+":"+std::to_string(ligne); item.location=location; - list << item; + list.push_back(item); if(!displayed) { displayed=true; diff --git a/EventDispatcher.cpp b/EventDispatcher.cpp index 744bc6a..b2595fb 100644 --- a/EventDispatcher.cpp +++ b/EventDispatcher.cpp @@ -7,11 +7,13 @@ #include <QMessageBox> #include <QWidget> #include <QStorageInfo> +#include <iostream> #include "EventDispatcher.h" #include "ExtraSocket.h" #include "CompilerInfo.h" #include "ThemesManager.h" +#include "cpp11addition.h" #ifdef Q_OS_UNIX #include <unistd.h> @@ -47,21 +49,54 @@ EventDispatcher::EventDispatcher() qRegisterMetaType<Ultracopier::EngineActionInProgress>("Ultracopier::EngineActionInProgress"); qRegisterMetaType<QList<QUrl> >("QList<QUrl>"); qRegisterMetaType<Ultracopier::ItemOfCopyList>("Ultracopier::ItemOfCopyList"); - #ifdef ULTRACOPIER_CGMINER - qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus"); - qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError"); - #endif + qRegisterMetaType<std::string>("std::string"); + qRegisterMetaType<uint64_t>("uint64_t"); + qRegisterMetaType<std::vector<Ultracopier::ProgressionItem> >("std::vector<Ultracopier::ProgressionItem>"); + qRegisterMetaType<std::vector<Ultracopier::ReturnActionOnCopyList> >("std::vector<Ultracopier::ReturnActionOnCopyList>"); + qRegisterMetaType<std::vector<std::string> >("std::vector<std::string>"); copyServer=new CopyListener(&optionDialog); - connect(&localListener, &LocalListener::cli, &cliParser, &CliParser::cli,Qt::QueuedConnection); - connect(ThemesManager::themesManager, &ThemesManager::newThemeOptions, &optionDialog, &OptionDialog::newThemeOptions); - connect(&cliParser, &CliParser::newCopyWithoutDestination, copyServer, &CopyListener::copyWithoutDestination); - connect(&cliParser, &CliParser::newCopy, copyServer, &CopyListener::copy); - connect(&cliParser, &CliParser::newMoveWithoutDestination, copyServer, &CopyListener::moveWithoutDestination); - connect(&cliParser, &CliParser::newMove, copyServer, &CopyListener::move); - connect(copyServer, &CopyListener::newClientList, &optionDialog, &OptionDialog::newClientList); + if(!connect(&localListener, &LocalListener::cli, &cliParser, &CliParser::cli,Qt::QueuedConnection)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } + if(!connect(ThemesManager::themesManager, &ThemesManager::newThemeOptions, &optionDialog, &OptionDialog::newThemeOptions)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } + if(!connect(&cliParser, &CliParser::newCopyWithoutDestination, copyServer, &CopyListener::copyWithoutDestination)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } + if(!connect(&cliParser, &CliParser::newCopy, copyServer, &CopyListener::copy)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } + if(!connect(&cliParser, &CliParser::newMoveWithoutDestination, copyServer, &CopyListener::moveWithoutDestination)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } + if(!connect(&cliParser, &CliParser::newMove, copyServer, &CopyListener::move)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } + if(!connect(copyServer, &CopyListener::newClientList, &optionDialog, &OptionDialog::newClientList)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } #ifdef ULTRACOPIER_PLUGIN_IMPORT_SUPPORT - connect(&cliParser, &CliParser::tryLoadPlugin, PluginsManager::pluginsManager, &PluginsManager::tryLoadPlugin); + if(!connect(&cliParser, &CliParser::tryLoadPlugin, PluginsManager::pluginsManager, &PluginsManager::tryLoadPlugin)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } #endif copyMoveEventIdIndex=0; backgroundIcon=NULL; @@ -73,33 +108,33 @@ EventDispatcher::EventDispatcher() #endif copyEngineList=new CopyEngineManager(&optionDialog); core=new Core(copyEngineList); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); //show the ultracopier information #if defined(Q_OS_WIN32) || defined(Q_OS_MAC) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("Windows version: %1").arg(GetOSDisplayString())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"Windows version: "+GetOSDisplayString()); #endif - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("ULTRACOPIER_VERSION: ")+ULTRACOPIER_VERSION); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("Qt version: %1 (%2)").arg(qVersion()).arg(QT_VERSION)); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("ULTRACOPIER_PLATFORM_NAME: ")+ULTRACOPIER_PLATFORM_NAME); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("Application path: %1 (%2)").arg(QCoreApplication::applicationFilePath()).arg(QCoreApplication::applicationPid())); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,COMPILERINFO); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("Local socket: ")+ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME)); - #ifdef ULTRACOPIER_CGMINER - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("With cgminer")); + #ifdef __STDC_VERSION__ + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"__STDC_VERSION__: "+std::to_string(__STDC_VERSION__)); #endif + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,std::string("ULTRACOPIER_VERSION: ")+ULTRACOPIER_VERSION); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,std::string("Qt version: ")+qVersion()+" "+std::to_string(QT_VERSION)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,std::string("ULTRACOPIER_PLATFORM_NAME: ")+ULTRACOPIER_PLATFORM_NAME.toStdString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"Application path: "+QCoreApplication::applicationFilePath().toStdString()+" "+std::to_string(QCoreApplication::applicationPid())); + //ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,COMPILERINFO); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"Local socket: "+ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME)); #if defined(ULTRACOPIER_DEBUG) && defined(ULTRACOPIER_PLUGIN_ALL_IN_ONE) - #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("Version as all in one")); - QObjectList objectList=QPluginLoader::staticInstances(); - int index=0; - while(index<objectList.size()) - { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("static plugin: %1").arg(objectList.at(index)->metaObject()->className())); - index++; - } - #else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("Version as all in one, direct")); - #endif + #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"Version as all in one"); + QObjectList objectList=QPluginLoader::staticInstances(); + int index=0; + while(index<objectList.size()) + { + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"static plugin: "+objectList.at(index)->metaObject()->className().toStdString()); + index++; + } + #else + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"Version as all in one, direct"); + #endif #endif { @@ -107,11 +142,11 @@ EventDispatcher::EventDispatcher() int index=0; while(index<mountedVolumesList.size()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("mountSysPoint: %1").arg(mountedVolumesList.at(index).rootPath())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"mountSysPoint: "+mountedVolumesList.at(index).rootPath().toStdString()); index++; } if(mountedVolumesList.isEmpty()) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("mountSysPoint is empty")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"mountSysPoint is empty"); } //To lunch some initialization after QApplication::exec() to quit eventually @@ -119,17 +154,17 @@ EventDispatcher::EventDispatcher() lunchInitFunction.setSingleShot(true); connect(&lunchInitFunction,&QTimer::timeout,this,&EventDispatcher::initFunction,Qt::QueuedConnection); lunchInitFunction.start(); - if(OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("Last_version_used"))!=QVariant(QStringLiteral("na")) && OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("Last_version_used"))!=QVariant(ULTRACOPIER_VERSION)) + if(OptionEngine::optionEngine->getOptionValue("Ultracopier","Last_version_used")!="na" && OptionEngine::optionEngine->getOptionValue("Ultracopier","Last_version_used")!=ULTRACOPIER_VERSION) { //then ultracopier have been updated } - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("Last_version_used"),QVariant(ULTRACOPIER_VERSION)); - int a=OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("ActionOnManualOpen")).toInt(); - if(a<0 || a>2) - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("ActionOnManualOpen"),QVariant(1)); - a=OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("GroupWindowWhen")).toInt(); - if(a<0 || a>5) - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("GroupWindowWhen"),QVariant(0)); + OptionEngine::optionEngine->setOptionValue("Ultracopier","Last_version_used",ULTRACOPIER_VERSION); + unsigned int a=stringtouint32(OptionEngine::optionEngine->getOptionValue("Ultracopier","ActionOnManualOpen")); + if(a>2) + OptionEngine::optionEngine->setOptionValue("Ultracopier","ActionOnManualOpen","1"); + a=stringtouint32(OptionEngine::optionEngine->getOptionValue("Ultracopier","GroupWindowWhen")); + if(a>5) + OptionEngine::optionEngine->setOptionValue("Ultracopier","GroupWindowWhen","0"); #ifdef ULTRACOPIER_VERSION_ULTIMATE #ifdef ULTRACOPIER_ILLEGAL @@ -141,8 +176,8 @@ EventDispatcher::EventDispatcher() { while(1) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("ultimate key")); - QString key=OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("key")).toString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"ultimate key"); + QString key=QString::fromStdString(OptionEngine::optionEngine->getOptionValue("Ultracopier","key")); if(!key.isEmpty()) { QCryptographicHash hash(QCryptographicHash::Sha224); @@ -166,7 +201,7 @@ EventDispatcher::EventDispatcher() const QByteArray &result=hash.result(); if(!result.isEmpty() && result.at(0)==0x00 && result.at(1)==0x00) { - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("key"),key); + OptionEngine::optionEngine->setOptionValue("Ultracopier","key",key.toStdString()); break; } } @@ -218,7 +253,7 @@ bool EventDispatcher::shouldBeClosed() /// \brief Quit ultracopier void EventDispatcher::quit() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Will quit ultracopier")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Will quit ultracopier"); //disconnect(QCoreApplication::instance(),SIGNAL(aboutToQuit()),this,SLOT(quit())); QCoreApplication::exit(); } @@ -232,12 +267,36 @@ void EventDispatcher::initFunction() return; } ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Initialize the variable of event loop"); - connect(copyServer, &CopyListener::newCopyWithoutDestination, core, &Core::newCopyWithoutDestination,Qt::DirectConnection); - connect(copyServer, &CopyListener::newCopy, core, &Core::newCopy,Qt::DirectConnection); - connect(copyServer, &CopyListener::newMoveWithoutDestination, core, &Core::newMoveWithoutDestination,Qt::DirectConnection); - connect(copyServer, &CopyListener::newMove, core, &Core::newMove,Qt::DirectConnection); - connect(core, &Core::copyFinished, copyServer, &CopyListener::copyFinished,Qt::DirectConnection); - connect(core, &Core::copyCanceled, copyServer, &CopyListener::copyCanceled,Qt::DirectConnection); + if(!connect(copyServer, &CopyListener::newCopyWithoutDestination, core, &Core::newCopyWithoutDestination,Qt::DirectConnection)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } + if(!connect(copyServer, &CopyListener::newCopy, core, &Core::newCopy,Qt::DirectConnection)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } + if(!connect(copyServer, &CopyListener::newMoveWithoutDestination, core, &Core::newMoveWithoutDestination,Qt::DirectConnection)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } + if(!connect(copyServer, &CopyListener::newMove, core, &Core::newMove,Qt::DirectConnection)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } + if(!connect(core, &Core::copyFinished, copyServer, &CopyListener::copyFinished,Qt::DirectConnection)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } + if(!connect(core, &Core::copyCanceled, copyServer, &CopyListener::copyCanceled,Qt::DirectConnection)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } if(localListener.tryConnect()) { stopIt=true; @@ -252,43 +311,105 @@ void EventDispatcher::initFunction() //connect the slot //quit is for this object // connect(core, &Core::newCanDoOnlyCopy, backgroundIcon, &SystrayIcon::newCanDoOnlyCopy,Qt::DirectConnection); - connect(backgroundIcon, &SystrayIcon::quit,this,&EventDispatcher::quit); + if(!connect(backgroundIcon, &SystrayIcon::quit,this,&EventDispatcher::quit)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } //show option is for OptionEngine object - connect(backgroundIcon, &SystrayIcon::showOptions, &optionDialog, &OptionDialog::show,Qt::DirectConnection); - connect(&cliParser, &CliParser::showOptions, &optionDialog, &OptionDialog::show,Qt::DirectConnection); - connect(copyServer, &CopyListener::listenerReady, backgroundIcon, &SystrayIcon::listenerReady,Qt::DirectConnection); - connect(copyServer, &CopyListener::pluginLoaderReady, backgroundIcon, &SystrayIcon::pluginLoaderReady,Qt::DirectConnection); - connect(backgroundIcon, &SystrayIcon::tryCatchCopy, copyServer, &CopyListener::listen,Qt::DirectConnection); - connect(backgroundIcon, &SystrayIcon::tryUncatchCopy, copyServer, &CopyListener::close,Qt::DirectConnection); - if(OptionEngine::optionEngine->getOptionValue("CopyListener","CatchCopyAsDefault").toBool()) + if(!connect(backgroundIcon, &SystrayIcon::showOptions, &optionDialog, &OptionDialog::show,Qt::DirectConnection)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } + if(!connect(&cliParser, &CliParser::showOptions, &optionDialog, &OptionDialog::show,Qt::DirectConnection)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } + if(!connect(copyServer, &CopyListener::listenerReady, backgroundIcon, &SystrayIcon::listenerReady,Qt::DirectConnection)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } + if(!connect(copyServer, &CopyListener::pluginLoaderReady, backgroundIcon, &SystrayIcon::pluginLoaderReady,Qt::DirectConnection)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } + if(!connect(backgroundIcon, &SystrayIcon::tryCatchCopy, copyServer, &CopyListener::listen,Qt::DirectConnection)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } + if(!connect(backgroundIcon, &SystrayIcon::tryUncatchCopy, copyServer, &CopyListener::close,Qt::DirectConnection)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } + if(stringtobool(OptionEngine::optionEngine->getOptionValue("CopyListener","CatchCopyAsDefault"))) copyServer->listen(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"copyServer.oneListenerIsLoaded(): "+QString::number(copyServer->oneListenerIsLoaded())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"copyServer.oneListenerIsLoaded(): "+std::to_string(copyServer->oneListenerIsLoaded())); //backgroundIcon->readyToListen(copyServer.oneListenerIsLoaded()); #ifdef ULTRACOPIER_DEBUG - connect(backgroundIcon, &SystrayIcon::saveBugReport, DebugEngine::debugEngine, &DebugEngine::saveBugReport,Qt::QueuedConnection); + if(!connect(backgroundIcon, &SystrayIcon::saveBugReport, DebugEngine::debugEngine, &DebugEngine::saveBugReport,Qt::QueuedConnection)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } #endif - connect(backgroundIcon, &SystrayIcon::addWindowCopyMove, core, &Core::addWindowCopyMove,Qt::DirectConnection); - connect(backgroundIcon, &SystrayIcon::addWindowTransfer, core, &Core::addWindowTransfer,Qt::DirectConnection); - connect(copyEngineList, &CopyEngineManager::addCopyEngine, backgroundIcon, &SystrayIcon::addCopyEngine,Qt::DirectConnection); - connect(copyEngineList, &CopyEngineManager::removeCopyEngine, backgroundIcon, &SystrayIcon::removeCopyEngine,Qt::DirectConnection); + if(!connect(backgroundIcon, &SystrayIcon::addWindowCopyMove, core, &Core::addWindowCopyMove,Qt::DirectConnection)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } + if(!connect(backgroundIcon, &SystrayIcon::addWindowTransfer, core, &Core::addWindowTransfer,Qt::DirectConnection)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } + if(!connect(copyEngineList, &CopyEngineManager::addCopyEngine, backgroundIcon, &SystrayIcon::addCopyEngine,Qt::DirectConnection)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } + if(!connect(copyEngineList, &CopyEngineManager::removeCopyEngine, backgroundIcon, &SystrayIcon::removeCopyEngine,Qt::DirectConnection)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } #ifdef ULTRACOPIER_INTERNET_SUPPORT - connect(&internetUpdater,&InternetUpdater::newUpdate, backgroundIcon, &SystrayIcon::newUpdate); + if(!connect(&internetUpdater,&InternetUpdater::newUpdate, backgroundIcon, &SystrayIcon::newUpdate)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } #endif copyEngineList->setIsConnected(); copyServer->resendState(); + + connect(&cliParser, &CliParser::showSystrayMessage, backgroundIcon,&SystrayIcon::showSystrayMessage,Qt::QueuedConnection); } //conntect the last chance signal before quit - connect(QCoreApplication::instance(),&QCoreApplication::aboutToQuit,this,&EventDispatcher::quit,Qt::DirectConnection); + if(!connect(QCoreApplication::instance(),&QCoreApplication::aboutToQuit,this,&EventDispatcher::quit,Qt::DirectConnection)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } //connect the slot for the help dialog - connect(backgroundIcon,&SystrayIcon::showHelp,&theHelp,&HelpDialog::show); + if(!connect(backgroundIcon,&SystrayIcon::showHelp,&theHelp,&HelpDialog::show)) + { + std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl; + abort(); + } #ifdef ULTRACOPIER_DEBUG DebugModel::debugModel->setupTheTimer(); #endif } #ifdef Q_OS_WIN32 -QString EventDispatcher::GetOSDisplayString() +std::string EventDispatcher::GetOSDisplayString() { QString Os; OSVERSIONINFOEX osvi; @@ -304,8 +425,8 @@ QString EventDispatcher::GetOSDisplayString() osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*) &osvi); - if(bOsVersionInfoEx == NULL) - return QStringLiteral("Os detection blocked"); + if(bOsVersionInfoEx == 0) + return "Os detection blocked"; // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise. @@ -501,12 +622,12 @@ QString EventDispatcher::GetOSDisplayString() Os+=QStringLiteral("Windows (dwMajorVersion: %1, dwMinorVersion: %2)").arg(osvi.dwMinorVersion).arg(osvi.dwMinorVersion); else Os+=QStringLiteral("Windows Server (dwMajorVersion: %1, dwMinorVersion: %2)").arg(osvi.dwMinorVersion).arg(osvi.dwMinorVersion); } - return Os; + return Os.toStdString(); } #endif #ifdef Q_OS_MAC -QString EventDispatcher::GetOSDisplayString() +std::string EventDispatcher::GetOSDisplayString() { QStringList key; QStringList string; @@ -520,12 +641,12 @@ QString EventDispatcher::GetOSDisplayString() int errorColumn; QDomDocument domDocument; if (!domDocument.setContent(content, false, &errorStr,&errorLine,&errorColumn)) - return QStringLiteral("Mac OS X"); + return "Mac OS X"; else { QDomElement root = domDocument.documentElement(); if(root.tagName()!=QStringLiteral("plist")) - return QStringLiteral("Mac OS X"); + return "Mac OS X"; else { if(root.isElement()) @@ -541,7 +662,7 @@ QString EventDispatcher::GetOSDisplayString() if(SubChild2.isElement()) key << SubChild2.text(); else - return QStringLiteral("Mac OS X"); + return "Mac OS X"; SubChild2 = SubChild2.nextSiblingElement(QStringLiteral("key")); } SubChild2=SubChild.firstChildElement(QStringLiteral("string")); @@ -550,29 +671,29 @@ QString EventDispatcher::GetOSDisplayString() if(SubChild2.isElement()) string << SubChild2.text(); else - return QStringLiteral("Mac OS X"); + return "Mac OS X"; SubChild2 = SubChild2.nextSiblingElement(QStringLiteral("string")); } } else - return QStringLiteral("Mac OS X"); + return "Mac OS X"; SubChild = SubChild.nextSiblingElement(QStringLiteral("property")); } } else - return QStringLiteral("Mac OS X"); + return "Mac OS X"; } } } if(key.size()!=string.size()) - return QStringLiteral("Mac OS X"); + return "Mac OS X"; int index=0; while(index<key.size()) { if(key.at(index)==QStringLiteral("ProductVersion")) - return QStringLiteral("Mac OS X ")+string.at(index); + return "Mac OS X "+string.at(index).toStdString(); index++; } - return QStringLiteral("Mac OS X"); + return "Mac OS X"; } #endif diff --git a/EventDispatcher.h b/EventDispatcher.h index b597c90..77b1948 100644 --- a/EventDispatcher.h +++ b/EventDispatcher.h @@ -44,7 +44,7 @@ class EventDispatcher : public QObject /// \brief return if need be close bool shouldBeClosed(); #if defined(Q_OS_WIN32) || defined(Q_OS_MAC) - static QString GetOSDisplayString(); + static std::string GetOSDisplayString(); #endif public slots: /// \brief Quit ultracopier @@ -67,7 +67,7 @@ class EventDispatcher : public QObject struct CoreSession { Core * CoreWindow; - QList<int> copyMoveEventIdManaged; + std::vector<int> copyMoveEventIdManaged; }; /// \brief the systray icon SystrayIcon *backgroundIcon; diff --git a/ExtraSocket.cpp b/ExtraSocket.cpp index 8175c5f..ef196fa 100644 --- a/ExtraSocket.cpp +++ b/ExtraSocket.cpp @@ -7,10 +7,10 @@ #include <QByteArray> #include <stdio.h> -QString ExtraSocket::pathSocket(const QString &name) +std::string ExtraSocket::pathSocket(const std::string &name) { #ifdef Q_OS_UNIX - return name+QStringLiteral("-")+QString::number(getuid()); + return name+"-"+std::to_string(getuid()); #else QString userName; @@ -18,7 +18,7 @@ QString ExtraSocket::pathSocket(const QString &name) char uname[1024]; DWORD len=1023; if(GetUserNameA(uname, &len)!=FALSE) - userName=QString::fromLatin1(toHex(uname));*/ + userName=toHex(uname);*/ QChar charTemp; DWORD size=255; @@ -37,7 +37,7 @@ QString ExtraSocket::pathSocket(const QString &name) userName=tempArray.toHex(); } delete userNameW; - return name+QStringLiteral("-")+userName; + return name+"-"+userName.toStdString(); #endif } diff --git a/ExtraSocket.h b/ExtraSocket.h index 4fa15e1..c8d44c5 100644 --- a/ExtraSocket.h +++ b/ExtraSocket.h @@ -23,7 +23,7 @@ class ExtraSocket { public: /** \brief class to return always the same socket resolution */ - static QString pathSocket(const QString &name); + static std::string pathSocket(const std::string &name); static char * toHex(const char *str); }; diff --git a/FacilityEngine.cpp b/FacilityEngine.cpp index ca6d467..8356f05 100644 --- a/FacilityEngine.cpp +++ b/FacilityEngine.cpp @@ -20,105 +20,115 @@ FacilityEngine::FacilityEngine() retranslate(); } +/// \brief separator native to the current OS +std::string FacilityEngine::separator() +{ + #ifdef Q_OS_WIN32 + return "\\"; + #else + return "/"; + #endif +} + /// \brief To force the text re-translation void FacilityEngine::retranslate() { //undirect translated string - Translation_perSecond=QStringLiteral("/")+tr("s"); - Translation_tooBig=tr("Too big"); - Translation_B=tr("B"); - Translation_KB=tr("KB"); - Translation_MB=tr("MB"); - Translation_GB=tr("GB"); - Translation_TB=tr("TB"); - Translation_PB=tr("PB"); - Translation_EB=tr("EB"); - Translation_ZB=tr("ZB"); - Translation_YB=tr("YB"); - Translation_SimplifiedRemaningTime_LessThan10s=tr("Less than %10 seconds"); - Translation_SimplifiedRemaningTime_AboutSeconds=tr("About %10 seconds remaining"); - Translation_SimplifiedRemaningTime_AboutMinutes=tr("About %1 minutes remaining"); - Translation_SimplifiedRemaningTime_AboutHours=tr("About %1 hours remaining"); + Translation_perSecond="/"+tr("s").toStdString(); + Translation_tooBig=tr("Too big").toStdString(); + Translation_B=tr("B").toStdString(); + Translation_KB=tr("KB").toStdString(); + Translation_MB=tr("MB").toStdString(); + Translation_GB=tr("GB").toStdString(); + Translation_TB=tr("TB").toStdString(); + Translation_PB=tr("PB").toStdString(); + Translation_EB=tr("EB").toStdString(); + Translation_ZB=tr("ZB").toStdString(); + Translation_YB=tr("YB").toStdString(); + Translation_SimplifiedRemaningTime_LessThan10s=tr("Less than %10 seconds").toStdString(); + Translation_SimplifiedRemaningTime_AboutSeconds=tr("About %10 seconds remaining").toStdString(); + Translation_SimplifiedRemaningTime_AboutMinutes=tr("About %1 minutes remaining").toStdString(); + Translation_SimplifiedRemaningTime_AboutHours=tr("About %1 hours remaining").toStdString(); //load the translations tab - translations["Copy engine"]=tr("Copy engine"); + translations["Copy engine"]=tr("Copy engine").toStdString(); //: a copy - translations["Copy"]=tr("Copy"); + translations["Copy"]=tr("Copy").toStdString(); //: a transfer - translations["Transfer"]=tr("Transfer"); + translations["Transfer"]=tr("Transfer").toStdString(); //: a move - translations["Move"]=tr("Move"); - translations["Start"]=tr("Start"); - translations["Pause"]=tr("Pause"); - translations["Resume"]=tr("Resume"); - translations["Skip"]=tr("Skip"); - translations["Unlimited"]=tr("Unlimited"); - translations["Source"]=tr("Source"); - translations["Size"]=tr("Size"); - translations["Destination"]=tr("Destination"); - translations["Quit"]=tr("Quit"); - translations["Target"]=tr("Target"); - translations["Time remaining:"]=tr("Time remaining:"); - translations["Listing"]=tr("Listing"); - translations["Copying"]=tr("Copying"); - translations["Listing and copying"]=tr("Listing and copying"); - translations["Time remaining:"]=tr("Time remaining:"); + translations["Move"]=tr("Move").toStdString(); + translations["Start"]=tr("Start").toStdString(); + translations["Pause"]=tr("Pause").toStdString(); + translations["Resume"]=tr("Resume").toStdString(); + translations["Skip"]=tr("Skip").toStdString(); + translations["Unlimited"]=tr("Unlimited").toStdString(); + translations["Source"]=tr("Source").toStdString(); + translations["Size"]=tr("Size").toStdString(); + translations["Destination"]=tr("Destination").toStdString(); + translations["Quit"]=tr("Quit").toStdString(); + translations["Target"]=tr("Target").toStdString(); + translations["Time remaining:"]=tr("Time remaining:").toStdString(); + translations["Listing"]=tr("Listing").toStdString(); + translations["Copying"]=tr("Copying").toStdString(); + translations["Listing and copying"]=tr("Listing and copying").toStdString(); + translations["Time remaining:"]=tr("Time remaining:").toStdString(); //for copy engine - translations["Ask"]=tr("Ask"); - translations["Skip"]=tr("Skip"); - translations["Overwrite"]=tr("Overwrite"); - translations["Overwrite if newer"]=tr("Overwrite if newer"); - translations["Overwrite if the last modification dates are different"]=tr("Overwrite if the last modification dates are different"); - translations["Rename"]=tr("Rename"); - translations["Put to the end of the list"]=tr("Put to the end of the list"); - translations["Select source directory"]=tr("Select source directory"); - translations["Select destination directory"]=tr("Select destination directory"); - translations["Internal error"]=tr("Internal error"); - translations["Select one or more files to open"]=tr("Select one or more files to open"); - translations["All files"]=tr("All files"); - translations["Save transfer list"]=tr("Save transfer list"); - translations["Open transfer list"]=tr("Open transfer list"); - translations["Transfer list"]=tr("Transfer list"); - translations["Error"]=tr("Error"); - translations["Not supported on this platform"]=tr("Not supported on this platform"); - translations["Completed in %1"]=tr("Completed in %1"); + translations["Ask"]=tr("Ask").toStdString(); + translations["Skip"]=tr("Skip").toStdString(); + translations["Overwrite"]=tr("Overwrite").toStdString(); + translations["Overwrite if newer"]=tr("Overwrite if newer").toStdString(); + translations["Overwrite if the last modification dates are different"]=tr("Overwrite if the last modification dates are different").toStdString(); + translations["Rename"]=tr("Rename").toStdString(); + translations["Put to the end of the list"]=tr("Put to the end of the list").toStdString(); + translations["Select source directory"]=tr("Select source directory").toStdString(); + translations["Select destination directory"]=tr("Select destination directory").toStdString(); + translations["Internal error"]=tr("Internal error").toStdString(); + translations["Select one or more files to open"]=tr("Select one or more files to open").toStdString(); + translations["All files"]=tr("All files").toStdString(); + translations["Save transfer list"]=tr("Save transfer list").toStdString(); + translations["Open transfer list"]=tr("Open transfer list").toStdString(); + translations["Transfer list"]=tr("Transfer list").toStdString(); + translations["Error"]=tr("Error").toStdString(); + translations["Not supported on this platform"]=tr("Not supported on this platform").toStdString(); + translations["Completed in %1"]=tr("Completed in %1").toStdString(); } /// \brief convert size in Byte to String -QString FacilityEngine::sizeToString(const double &size) const +std::string FacilityEngine::sizeToString(const double &size) const { double size_temp=size; if(size_temp<1024) - return QString::number(size_temp)+sizeUnitToString(Ultracopier::SizeUnit_byte); + return std::to_string((unsigned int)size_temp)+sizeUnitToString(Ultracopier::SizeUnit_byte); if((size_temp=size_temp/1024)<1024) - return adaptString(size_temp)+sizeUnitToString(Ultracopier::SizeUnit_KiloByte); + return adaptString(static_cast<float>(size_temp))+sizeUnitToString(Ultracopier::SizeUnit_KiloByte); if((size_temp=size_temp/1024)<1024) - return adaptString(size_temp)+sizeUnitToString(Ultracopier::SizeUnit_MegaByte); + return adaptString(static_cast<float>(size_temp))+sizeUnitToString(Ultracopier::SizeUnit_MegaByte); if((size_temp=size_temp/1024)<1024) - return adaptString(size_temp)+sizeUnitToString(Ultracopier::SizeUnit_GigaByte); + return adaptString(static_cast<float>(size_temp))+sizeUnitToString(Ultracopier::SizeUnit_GigaByte); if((size_temp=size_temp/1024)<1024) - return adaptString(size_temp)+sizeUnitToString(Ultracopier::SizeUnit_TeraByte); + return adaptString(static_cast<float>(size_temp))+sizeUnitToString(Ultracopier::SizeUnit_TeraByte); if((size_temp=size_temp/1024)<1024) - return adaptString(size_temp)+sizeUnitToString(Ultracopier::SizeUnit_PetaByte); + return adaptString(static_cast<float>(size_temp))+sizeUnitToString(Ultracopier::SizeUnit_PetaByte); if((size_temp=size_temp/1024)<1024) - return adaptString(size_temp)+sizeUnitToString(Ultracopier::SizeUnit_ExaByte); + return adaptString(static_cast<float>(size_temp))+sizeUnitToString(Ultracopier::SizeUnit_ExaByte); if((size_temp=size_temp/1024)<1024) - return adaptString(size_temp)+sizeUnitToString(Ultracopier::SizeUnit_ZettaByte); + return adaptString(static_cast<float>(size_temp))+sizeUnitToString(Ultracopier::SizeUnit_ZettaByte); if((size_temp=size_temp/1024)<1024) - return adaptString(size_temp)+sizeUnitToString(Ultracopier::SizeUnit_YottaByte); + return adaptString(static_cast<float>(size_temp))+sizeUnitToString(Ultracopier::SizeUnit_YottaByte); return Translation_tooBig; } -QString FacilityEngine::adaptString(const float &size) const +std::string FacilityEngine::adaptString(const float &size) const { if(size>=100) - return QString::number(size,'f',0); + return QString::number(static_cast<double>(size),'f',0).toStdString(); else - return QString::number(size,'g',3); + return QString::number(static_cast<double>(size),'g',3).toStdString(); } /// \brief convert size unit to String -QString FacilityEngine::sizeUnitToString(const Ultracopier::SizeUnit &sizeUnit) const +std::string FacilityEngine::sizeUnitToString(const Ultracopier::SizeUnit &sizeUnit) const { switch(sizeUnit) { @@ -141,16 +151,16 @@ QString FacilityEngine::sizeUnitToString(const Ultracopier::SizeUnit &sizeUnit) case Ultracopier::SizeUnit_YottaByte: return Translation_YB; default: - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"sizeUnit: "+QString::number(sizeUnit)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"sizeUnit: "+std::to_string(sizeUnit)); return "???"; } } /// \brief translate the text -QString FacilityEngine::translateText(const QString &text) const +std::string FacilityEngine::translateText(const std::string &text) const { - if(translations.contains(text)) - return translations.value(text); + if(translations.find(text)!=translations.cend()) + return translations.at(text); else { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"translation not found: "+text); @@ -159,27 +169,27 @@ QString FacilityEngine::translateText(const QString &text) const } /// \brief speed to string in byte per seconds -QString FacilityEngine::speedToString(const double &speed) const +std::string FacilityEngine::speedToString(const double &speed) const { return sizeToString(speed)+Translation_perSecond; } /// \brief Decompose the time in second -Ultracopier::TimeDecomposition FacilityEngine::secondsToTimeDecomposition(const quint32 &seconds) const +Ultracopier::TimeDecomposition FacilityEngine::secondsToTimeDecomposition(const uint32_t &seconds) const { quint32 seconds_temp=seconds; Ultracopier::TimeDecomposition returnValue; - returnValue.second=seconds_temp%60; + returnValue.second=static_cast<uint16_t>(seconds_temp%60); seconds_temp-=returnValue.second; seconds_temp/=60; - returnValue.minute=seconds_temp%60; + returnValue.minute=static_cast<uint16_t>(seconds_temp%60); seconds_temp-=returnValue.minute; seconds_temp/=60; - returnValue.hour=seconds_temp; + returnValue.hour=static_cast<uint16_t>(seconds_temp); return returnValue; } /// \brief have the functionality -bool FacilityEngine::haveFunctionality(const QString &fonctionnality) const +bool FacilityEngine::haveFunctionality(const std::string &fonctionnality) const { #if defined (Q_OS_WIN32) if(fonctionnality=="shutdown") @@ -190,7 +200,7 @@ bool FacilityEngine::haveFunctionality(const QString &fonctionnality) const } /// \brief call the fonctionnality -QVariant FacilityEngine::callFunctionality(const QString &fonctionnality,const QStringList &args) +std::string FacilityEngine::callFunctionality(const std::string &fonctionnality,const std::vector<std::string> &args) { #if defined (Q_OS_WIN32) ExitWindowsEx(EWX_POWEROFF | EWX_FORCE,0); @@ -198,44 +208,44 @@ QVariant FacilityEngine::callFunctionality(const QString &fonctionnality,const Q #endif Q_UNUSED(fonctionnality); Q_UNUSED(args); - return QVariant(); + return std::string(); } /// \brief Do the simplified time -QString FacilityEngine::simplifiedRemainingTime(const quint32 &seconds) const +std::string FacilityEngine::simplifiedRemainingTime(const uint32_t &seconds) const { if(seconds<50) { if(seconds<10) - return Translation_SimplifiedRemaningTime_LessThan10s.arg(seconds/10+1); + return QString::fromStdString(Translation_SimplifiedRemaningTime_LessThan10s).arg(seconds/10+1).toStdString(); else - return Translation_SimplifiedRemaningTime_AboutSeconds.arg(seconds/10+1); + return QString::fromStdString(Translation_SimplifiedRemaningTime_AboutSeconds).arg(seconds/10+1).toStdString(); } if(seconds<3600) - return Translation_SimplifiedRemaningTime_AboutMinutes.arg(seconds/60); - return Translation_SimplifiedRemaningTime_AboutHours.arg(seconds/3600); + return QString::fromStdString(Translation_SimplifiedRemaningTime_AboutMinutes).arg(seconds/60).toStdString(); + return QString::fromStdString(Translation_SimplifiedRemaningTime_AboutHours).arg(seconds/3600).toStdString(); } /// \brief Return ultimate url, empty is not found or already ultimate -QString FacilityEngine::ultimateUrl() const +std::string FacilityEngine::ultimateUrl() const { #ifdef ULTRACOPIER_VERSION_ULTIMATE - return QString(); + return std::string(); #else #if defined(Q_OS_WIN32) || defined(Q_OS_MAC) - return QStringLiteral("http://ultracopier.first-world.info/shop.html"); + return "http://ultracopier.first-world.info/shop.html"; #else - return QString(); + return std::string(); #endif #endif } /// \brief Return the software name -QString FacilityEngine::softwareName() const +std::string FacilityEngine::softwareName() const { #ifdef ULTRACOPIER_MODE_SUPERCOPIER - return QStringLiteral("Supercopier"); + return "Supercopier"; #else - return QStringLiteral("Ultracopier"); + return "Ultracopier"; #endif } diff --git a/FacilityEngine.h b/FacilityEngine.h index 1ab658f..5b6c6a9 100644 --- a/FacilityEngine.h +++ b/FacilityEngine.h @@ -7,10 +7,9 @@ #ifndef FACILITYENGINE_H #define FACILITYENGINE_H -#include <QVariant> -#include <QString> -#include <QStringList> -#include <QHash> +#include <string> +#include <vector> +#include <unordered_map> #include "interface/FacilityInterface.h" #include "Environment.h" @@ -25,48 +24,50 @@ class FacilityEngine : public FacilityInterface public: explicit FacilityEngine(); /// \brief convert size in Byte to String - QString sizeToString(const double &size) const; + std::string sizeToString(const double &size) const; /// \brief convert size unit to String - QString sizeUnitToString(const Ultracopier::SizeUnit &sizeUnit) const; + std::string sizeUnitToString(const Ultracopier::SizeUnit &sizeUnit) const; /// \brief translate the text - QString translateText(const QString &text) const; + std::string translateText(const std::string &text) const; /// \brief speed to string in byte per seconds - QString speedToString(const double &speed) const; + std::string speedToString(const double &speed) const; /// \brief Decompose the time in second - Ultracopier::TimeDecomposition secondsToTimeDecomposition(const quint32 &seconds) const; + Ultracopier::TimeDecomposition secondsToTimeDecomposition(const uint32_t &seconds) const; /// \brief have the fonctionnality - bool haveFunctionality(const QString &fonctionnality) const; + bool haveFunctionality(const std::string &fonctionnality) const; /// \brief call the fonctionnality - QVariant callFunctionality(const QString &fonctionnality,const QStringList &args=QStringList()); + std::string callFunctionality(const std::string &fonctionnality,const std::vector<std::string> &args=std::vector<std::string>()); /// \brief Do the simplified time - QString simplifiedRemainingTime(const quint32 &seconds) const; + std::string simplifiedRemainingTime(const uint32_t &seconds) const; /// \brief Return ultimate url, empty is not found or already ultimate - QString ultimateUrl() const; + std::string ultimateUrl() const; /// \brief Return the software name - QString softwareName() const; + std::string softwareName() const; + /// \brief separator native to the current OS + static std::string separator(); static FacilityEngine facilityEngine; private: //undirect translated string - QString Translation_perSecond; - QString Translation_tooBig; - QString Translation_B; - QString Translation_KB; - QString Translation_MB; - QString Translation_GB; - QString Translation_TB; - QString Translation_PB; - QString Translation_EB; - QString Translation_ZB; - QString Translation_YB; + std::string Translation_perSecond; + std::string Translation_tooBig; + std::string Translation_B; + std::string Translation_KB; + std::string Translation_MB; + std::string Translation_GB; + std::string Translation_TB; + std::string Translation_PB; + std::string Translation_EB; + std::string Translation_ZB; + std::string Translation_YB; //simplified remaining time - QString Translation_SimplifiedRemaningTime_LessThan10s; - QString Translation_SimplifiedRemaningTime_AboutSeconds; - QString Translation_SimplifiedRemaningTime_AboutMinutes; - QString Translation_SimplifiedRemaningTime_AboutHours; + std::string Translation_SimplifiedRemaningTime_LessThan10s; + std::string Translation_SimplifiedRemaningTime_AboutSeconds; + std::string Translation_SimplifiedRemaningTime_AboutMinutes; + std::string Translation_SimplifiedRemaningTime_AboutHours; //internal fonction - inline QString adaptString(const float &nb) const; - QHash<QString,QString> translations; + inline std::string adaptString(const float &nb) const; + std::unordered_map<std::string,std::string> translations; public slots: /// \brief To force the text re-translation void retranslate(); diff --git a/HelpDialog.cpp b/HelpDialog.cpp index f821eac..0e266e4 100644 --- a/HelpDialog.cpp +++ b/HelpDialog.cpp @@ -12,7 +12,7 @@ HelpDialog::HelpDialog() : ui(new Ui::HelpDialog) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); ui->setupUi(this); reloadTextValue(); #ifdef ULTRACOPIER_DEBUG @@ -50,7 +50,7 @@ void HelpDialog::changeEvent(QEvent *e) QDialog::changeEvent(e); switch (e->type()) { case QEvent::LanguageChange: - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); ui->retranslateUi(this); reloadTextValue(); break; @@ -62,7 +62,7 @@ void HelpDialog::changeEvent(QEvent *e) /// \brief To reload the text value void HelpDialog::reloadTextValue() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); QString text=ui->label_ultracopier->text(); #ifdef ULTRACOPIER_VERSION_ULTIMATE text=text.replace(QStringLiteral("%1"),QStringLiteral("Ultimate %1").arg(ULTRACOPIER_VERSION)); @@ -70,7 +70,7 @@ void HelpDialog::reloadTextValue() text=text.replace(QStringLiteral("%1"),ULTRACOPIER_VERSION); #endif #ifdef ULTRACOPIER_MODE_SUPERCOPIER - text=text.replace(QStringLiteral("Ultracopier"),QStringLiteral("Supercopier"),Qt::CaseInsensitive); + text=text.replace(QStringLiteral("Ultracopier"),QStringLiteral("Supercopier"),Qt::CaseInsensitive); #endif ui->label_ultracopier->setText(text); @@ -96,7 +96,7 @@ void HelpDialog::reloadTextValue() text=ui->label_site->text(); //: This site need be the official site of ultracopier, into the right languages, english if not exists - text=text.replace(QStringLiteral("%1"),getWebSite()); + text=text.replace("%1",QString::fromStdString(getWebSite())); ui->label_site->setText(text); text=ui->label_platform->text(); @@ -104,33 +104,29 @@ void HelpDialog::reloadTextValue() ui->label_platform->setText(text); } -QString HelpDialog::getWebSite() +std::string HelpDialog::getWebSite() { - #ifdef ULTRACOPIER_MODE_SUPERCOPIER - return tr("http://ultracopier.first-world.info/")+QStringLiteral("supercopier.html"); - #else - return tr("http://ultracopier.first-world.info/"); - #endif + return tr("http://ultracopier.first-world.info/").toStdString(); } -QString HelpDialog::getUpdateUrl() +std::string HelpDialog::getUpdateUrl() { #if defined(ULTRACOPIER_VERSION_ULTIMATE) - return tr("http://ultracopier.first-world.info/shop.html"); - #else - #ifdef ULTRACOPIER_MODE_SUPERCOPIER - return tr("http://ultracopier.first-world.info/")+QStringLiteral("supercopier.html"); - #else - return tr("http://ultracopier.first-world.info/download.html"); - #endif - #endif + return tr("http://ultracopier.first-world.info/shop.html").toStdString(); + #else + #ifdef ULTRACOPIER_MODE_SUPERCOPIER + return tr("http://ultracopier.first-world.info/").toStdString()+"supercopier.html"; + #else + return tr("http://ultracopier.first-world.info/download.html").toStdString(); + #endif + #endif } #ifdef ULTRACOPIER_DEBUG void HelpDialog::on_lineEditInsertDebug_returnPressed() { - DebugEngine::addDebugNote(ui->lineEditInsertDebug->text()); + DebugEngine::addDebugNote(ui->lineEditInsertDebug->text().toStdString()); ui->lineEditInsertDebug->clear(); ui->debugView->scrollToBottom(); } diff --git a/HelpDialog.h b/HelpDialog.h index 2a2fd32..91e5dbc 100644 --- a/HelpDialog.h +++ b/HelpDialog.h @@ -27,8 +27,8 @@ class HelpDialog : public QDialog { HelpDialog(); /// \brief Destruct the object ~HelpDialog(); - static QString getWebSite(); - static QString getUpdateUrl(); + static std::string getWebSite(); + static std::string getUpdateUrl(); protected: /// \brief To re-translate the ui void changeEvent(QEvent *e); diff --git a/InternetUpdater.cpp b/InternetUpdater.cpp index de23424..a3dbded 100644 --- a/InternetUpdater.cpp +++ b/InternetUpdater.cpp @@ -1,6 +1,7 @@ #include "InternetUpdater.h" #include "EventDispatcher.h" #include "OptionEngine.h" +#include "cpp11addition.h" #ifdef ULTRACOPIER_INTERNET_SUPPORT @@ -21,39 +22,36 @@ InternetUpdater::InternetUpdater(QObject *parent) : void InternetUpdater::downloadFile() { - if(!OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("checkTheUpdate")).toBool()) + if(!stringtobool(OptionEngine::optionEngine->getOptionValue("Ultracopier","checkTheUpdate"))) return; #ifdef ULTRACOPIER_MODE_SUPERCOPIER - QString name=QStringLiteral("Supercopier"); - #else - QString name=QStringLiteral("Ultracopier"); - #endif - QString ultracopierVersion; + std::string name="Supercopier"; + #else + std::string name="Ultracopier"; + #endif + std::string ultracopierVersion; #ifdef ULTRACOPIER_VERSION_ULTIMATE - ultracopierVersion=QStringLiteral("%1 Ultimate/%2").arg(name).arg(ULTRACOPIER_VERSION); + ultracopierVersion=name+" Ultimate/"+ULTRACOPIER_VERSION; #else - ultracopierVersion=QStringLiteral("%1/%2").arg(name).arg(ULTRACOPIER_VERSION); + ultracopierVersion=name+"/"+ULTRACOPIER_VERSION; #endif #ifdef ULTRACOPIER_VERSION_PORTABLE #ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE - ultracopierVersion+=QStringLiteral(" portable/all-in-one"); + ultracopierVersion+=" portable/all-in-one"; #else - ultracopierVersion+=QStringLiteral(" portable"); + ultracopierVersion+=" portable"; #endif #else #ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE - ultracopierVersion+=QStringLiteral(" all-in-one"); + ultracopierVersion+=" all-in-one"; #endif #endif - #ifdef ULTRACOPIER_CGMINER - ultracopierVersion+=QStringLiteral(" miner"); - #endif #if defined(Q_OS_WIN32) || defined(Q_OS_MAC) - ultracopierVersion+=QStringLiteral(" (OS: %1)").arg(EventDispatcher::GetOSDisplayString()); + ultracopierVersion+=" (OS: "+EventDispatcher::GetOSDisplayString()+")"; #endif - ultracopierVersion+=QStringLiteral(" ")+ULTRACOPIER_PLATFORM_CODE; + ultracopierVersion+=" "+std::string(ULTRACOPIER_PLATFORM_CODE); QNetworkRequest networkRequest(QStringLiteral(ULTRACOPIER_UPDATER_URL)); - networkRequest.setHeader(QNetworkRequest::UserAgentHeader,ultracopierVersion); + networkRequest.setHeader(QNetworkRequest::UserAgentHeader,QString::fromStdString(ultracopierVersion)); networkRequest.setRawHeader("Connection", "Close"); reply = qnam.get(networkRequest); connect(reply, &QNetworkReply::finished, this, &InternetUpdater::httpFinished); @@ -64,7 +62,7 @@ void InternetUpdater::httpFinished() QVariant redirectionTarget = reply->attribute(QNetworkRequest::RedirectionTargetAttribute); if (!reply->isFinished()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("get the new update failed: not finished")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"get the new update failed: not finished"); reply->deleteLater(); return; } @@ -72,25 +70,25 @@ void InternetUpdater::httpFinished() { newUpdateTimer.stop(); newUpdateTimer.start(1000*3600*24); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("get the new update failed: %1").arg(reply->errorString())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"get the new update failed: "+reply->errorString().toStdString()); reply->deleteLater(); return; } else if (!redirectionTarget.isNull()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("redirection denied to: %1").arg(redirectionTarget.toUrl().toString())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"redirection denied to: "+redirectionTarget.toUrl().toString().toStdString()); reply->deleteLater(); return; } QString newVersion=QString::fromUtf8(reply->readAll()); if(newVersion.isEmpty()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("version string is empty")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"version string is empty"); reply->deleteLater(); return; } newVersion.remove("\n"); if(!newVersion.contains(QRegularExpression(QLatin1Literal("^[0-9]+(\\.[0-9]+)+$")))) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("version string don't match: %1").arg(newVersion)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"version string don't match: "+newVersion.toStdString()); reply->deleteLater(); return; } @@ -99,13 +97,13 @@ void InternetUpdater::httpFinished() reply->deleteLater(); return; } - if(PluginsManager::compareVersion(newVersion,QStringLiteral("<="),ULTRACOPIER_VERSION)) + if(PluginsManager::compareVersion(newVersion.toStdString(),"<=",ULTRACOPIER_VERSION)) { reply->deleteLater(); return; } newUpdateTimer.stop(); - emit newUpdate(newVersion); + emit newUpdate(newVersion.toStdString()); reply->deleteLater(); } diff --git a/InternetUpdater.h b/InternetUpdater.h index e13a5a2..25b13f4 100644 --- a/InternetUpdater.h +++ b/InternetUpdater.h @@ -17,7 +17,7 @@ class InternetUpdater : public QObject public: explicit InternetUpdater(QObject *parent = 0); signals: - void newUpdate(const QString &version) const; + void newUpdate(const std::string &version) const; private: QTimer newUpdateTimer; QTimer firstUpdateTimer; diff --git a/LanguagesManager.cpp b/LanguagesManager.cpp index 5393e28..a8849c4 100644 --- a/LanguagesManager.cpp +++ b/LanguagesManager.cpp @@ -8,20 +8,21 @@ #include "LanguagesManager.h" #include "FacilityEngine.h" +#include "cpp11addition.h" /// \brief Create the manager and load the defaults variables LanguagesManager::LanguagesManager() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); //load the rest - QStringList resourcesPaths=ResourcesManager::resourcesManager->getReadPath(); - int index=0; + std::vector<std::string> resourcesPaths=ResourcesManager::resourcesManager->getReadPath(); + unsigned int index=0; while(index<resourcesPaths.size()) { - QString composedTempPath=resourcesPaths.at(index)+QStringLiteral("Languages")+QDir::separator(); - QDir LanguagesConfiguration(composedTempPath); + std::string composedTempPath=resourcesPaths.at(index)+"Languages"+FacilityEngine::separator(); + QDir LanguagesConfiguration(QString::fromStdString(composedTempPath)); if(LanguagesConfiguration.exists()) - languagePath<<composedTempPath; + languagePath.push_back(composedTempPath); index++; } //load the plugins @@ -32,14 +33,14 @@ LanguagesManager::LanguagesManager() connect(PluginsManager::pluginsManager,&PluginsManager::onePluginWillBeRemoved, this, &LanguagesManager::onePluginWillBeRemoved,Qt::DirectConnection); #endif connect(PluginsManager::pluginsManager,&PluginsManager::pluginListingIsfinish, this, &LanguagesManager::allPluginIsLoaded,Qt::QueuedConnection); - QList<PluginsAvailable> list=PluginsManager::pluginsManager->getPluginsByCategory(PluginType_Languages); + std::vector<PluginsAvailable> list=PluginsManager::pluginsManager->getPluginsByCategory(PluginType_Languages); foreach(PluginsAvailable currentPlugin,list) emit previouslyPluginAdded(currentPlugin); PluginsManager::pluginsManager->unlockPluginListEdition(); //load the GUI option - QList<QPair<QString, QVariant> > KeysList; - KeysList.append(qMakePair(QStringLiteral("Language"),QVariant("en"))); - KeysList.append(qMakePair(QStringLiteral("Language_force"),QVariant(false))); + std::vector<std::pair<std::string, std::string> > KeysList; + KeysList.push_back(std::pair<std::string, std::string>("Language","en")); + KeysList.push_back(std::pair<std::string, std::string>("Language_force","false")); OptionEngine::optionEngine->addOptionGroup("Language",KeysList); // connect(this, &LanguagesManager::newLanguageLoaded, plugins,&PluginsManager::refreshPluginList); // connect(this, &LanguagesManager::newLanguageLoaded, this,&LanguagesManager::retranslateTheUI); @@ -53,9 +54,9 @@ LanguagesManager::~LanguagesManager() } /// \brief load the language selected, return the main short code like en, fr, .. -QString LanguagesManager::getTheRightLanguage() const +std::string LanguagesManager::getTheRightLanguage() const { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); if(LanguagesAvailableList.size()==0) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"empty combobox list, failing back to english"); @@ -63,43 +64,43 @@ QString LanguagesManager::getTheRightLanguage() const } else { - if(!OptionEngine::optionEngine->getOptionValue(QStringLiteral("Language"),QStringLiteral("Language_force")).toBool()) + if(!stringtobool(OptionEngine::optionEngine->getOptionValue("Language","Language_force"))) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("language auto-detection, QLocale::system().name(): ")+QLocale::system().name()+QStringLiteral(", QLocale::languageToString(QLocale::system().language()): ")+QLocale::languageToString(QLocale::system().language())); - QString tempLanguage=getMainShortName(QLocale::languageToString(QLocale::system().language())); - if(tempLanguage!=QStringLiteral("")) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"language auto-detection, QLocale::system().name(): "+QLocale::system().name().toStdString()+", QLocale::languageToString(QLocale::system().language()): "+QLocale::languageToString(QLocale::system().language()).toStdString()); + std::string tempLanguage=getMainShortName(QLocale::languageToString(QLocale::system().language()).toStdString()); + if(!tempLanguage.empty()) return tempLanguage; else { - tempLanguage=getMainShortName(QLocale::system().name()); - if(tempLanguage!=QStringLiteral("")) + tempLanguage=getMainShortName(QLocale::system().name().toStdString()); + if(!tempLanguage.empty()) return tempLanguage; else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Autodetection of the language failed, QLocale::languageToString(QLocale::system().language()): ")+QLocale::languageToString(QLocale::system().language())+QStringLiteral(", QLocale::system().name(): ")+QLocale::system().name()+", failing back to english"); - return OptionEngine::optionEngine->getOptionValue(QStringLiteral("Language"),QStringLiteral("Language")).toString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Autodetection of the language failed, QLocale::languageToString(QLocale::system().language()): "+QLocale::languageToString(QLocale::system().language()).toStdString()+", QLocale::system().name(): "+QLocale::system().name().toStdString()+", failing back to english"); + return OptionEngine::optionEngine->getOptionValue("Language","Language"); } } } else - return OptionEngine::optionEngine->getOptionValue(QStringLiteral("Language"),QStringLiteral("Language")).toString(); + return OptionEngine::optionEngine->getOptionValue("Language","Language"); } } /* \brief To set the current language \param newLanguage Should be short name code found into informations.xml of language file */ -void LanguagesManager::setCurrentLanguage(const QString &newLanguage) +void LanguagesManager::setCurrentLanguage(const std::string &newLanguage) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start: ")+newLanguage); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start: "+newLanguage); //protection for re-set the same language if(currentLanguage==newLanguage) return; //store the language PluginsManager::pluginsManager->setLanguage(newLanguage); //unload the old language - if(currentLanguage!=QStringLiteral("en")) + if(currentLanguage!="en") { - int indexTranslator=0; + unsigned int indexTranslator=0; while(indexTranslator<installedTranslator.size()) { QCoreApplication::removeTranslator(installedTranslator.at(indexTranslator)); @@ -108,60 +109,60 @@ void LanguagesManager::setCurrentLanguage(const QString &newLanguage) } installedTranslator.clear(); } - int index=0; + unsigned int index=0; while(index<LanguagesAvailableList.size()) { if(LanguagesAvailableList.at(index).mainShortName==newLanguage) { //load the new language - if(newLanguage!=QStringLiteral("en")) + if(newLanguage!="en") { QTranslator *temp; - QStringList fileToLoad; + std::vector<std::string> fileToLoad; //load the language main - if(newLanguage==QStringLiteral("en")) - fileToLoad<<QStringLiteral(":/Languages/en/translation.qm"); + if(newLanguage=="en") + fileToLoad.push_back(":/Languages/en/translation.qm"); else - fileToLoad<<LanguagesAvailableList.at(index).path+QStringLiteral("translation.qm"); + fileToLoad.push_back(LanguagesAvailableList.at(index).path+"translation.qm"); //load the language plugin - QList<PluginsAvailable> listLoadedPlugins=PluginsManager::pluginsManager->getPlugins(); - int indexPluginIndex=0; + std::vector<PluginsAvailable> listLoadedPlugins=PluginsManager::pluginsManager->getPlugins(); + unsigned int indexPluginIndex=0; while(indexPluginIndex<listLoadedPlugins.size()) { if(listLoadedPlugins.at(indexPluginIndex).category!=PluginType_Languages) { - QString tempPath=listLoadedPlugins.at(indexPluginIndex).path+QStringLiteral("Languages")+QDir::separator()+LanguagesAvailableList.at(index).mainShortName+QDir::separator()+QStringLiteral("translation.qm"); - if(QFile::exists(tempPath)) - fileToLoad<<tempPath; + std::string tempPath=listLoadedPlugins.at(indexPluginIndex).path+"Languages"+FacilityEngine::separator()+LanguagesAvailableList.at(index).mainShortName+FacilityEngine::separator()+"translation.qm"; + if(QFile::exists(QString::fromStdString(tempPath))) + fileToLoad.push_back(tempPath); } indexPluginIndex++; } - int indexTranslationFile=0; + unsigned int indexTranslationFile=0; while(indexTranslationFile<fileToLoad.size()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Translation to load: ")+fileToLoad.at(indexTranslationFile)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Translation to load: "+fileToLoad.at(indexTranslationFile)); temp=new QTranslator(); - if(!temp->load(fileToLoad.at(indexTranslationFile)) || temp->isEmpty()) + if(!temp->load(QString::fromStdString(fileToLoad.at(indexTranslationFile))) || temp->isEmpty()) { delete temp; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Unable to load the translation file: ")+fileToLoad.at(indexTranslationFile)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to load the translation file: "+fileToLoad.at(indexTranslationFile)); } else { QCoreApplication::installTranslator(temp); - installedTranslator<<temp; + installedTranslator.push_back(temp); } indexTranslationFile++; } temp=new QTranslator(); - if(temp->load(QString("qt_")+newLanguage, QLibraryInfo::location(QLibraryInfo::TranslationsPath)) && !temp->isEmpty()) + if(temp->load(QString("qt_")+QString::fromStdString(newLanguage), QLibraryInfo::location(QLibraryInfo::TranslationsPath)) && !temp->isEmpty()) { QCoreApplication::installTranslator(temp); - installedTranslator<<temp; + installedTranslator.push_back(temp); } else { - if(!temp->load(LanguagesAvailableList.at(index).path+QStringLiteral("qt.qm")) || temp->isEmpty()) + if(!temp->load(QString::fromStdString(LanguagesAvailableList.at(index).path)+"qt.qm") || temp->isEmpty()) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to load the translation file: qt.qm, into: "+LanguagesAvailableList.at(index).path); delete temp; @@ -169,30 +170,31 @@ void LanguagesManager::setCurrentLanguage(const QString &newLanguage) else { QCoreApplication::installTranslator(temp); - installedTranslator<<temp; + installedTranslator.push_back(temp); } } } currentLanguage=newLanguage; FacilityEngine::facilityEngine.retranslate(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("emit newLanguageLoaded()")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"emit newLanguageLoaded()"); emit newLanguageLoaded(currentLanguage); return; } index++; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to found language: "+newLanguage+", LanguagesAvailableList.size(): "+QString::number(LanguagesAvailableList.size())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to found language: "+newLanguage+", LanguagesAvailableList.size(): "+std::to_string(LanguagesAvailableList.size())); } /// \brief check if short name is found into language -QString LanguagesManager::getMainShortName(const QString &shortName) const +std::string LanguagesManager::getMainShortName(const std::string &shortName) const { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - int index=0; + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + unsigned int index=0; while(index<LanguagesAvailableList.size()) { - if(LanguagesAvailableList.at(index).shortName.contains(shortName) || LanguagesAvailableList.at(index).fullName.contains(shortName)) - return LanguagesAvailableList.at(index).mainShortName; + const LanguagesAvailable &languagesAvailable=LanguagesAvailableList.at(index); + if(languagesAvailable.shortName.find(shortName)!=languagesAvailable.shortName.cend() || languagesAvailable.fullName==shortName) + return languagesAvailable.mainShortName; index++; } return ""; @@ -201,60 +203,60 @@ QString LanguagesManager::getMainShortName(const QString &shortName) const /// \brief load the language in languagePath void LanguagesManager::allPluginIsLoaded() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); setCurrentLanguage(getTheRightLanguage()); } -const QString LanguagesManager::autodetectedLanguage() const +const std::string LanguagesManager::autodetectedLanguage() const { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("language auto-detection, QLocale::system().name(): ")+QLocale::system().name()+QStringLiteral(", QLocale::languageToString(QLocale::system().language()): ")+QLocale::languageToString(QLocale::system().language())); - QString tempLanguage=getMainShortName(QLocale::languageToString(QLocale::system().language())); - if(tempLanguage!=QStringLiteral("")) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"language auto-detection, QLocale::system().name(): "+QLocale::system().name().toStdString()+", QLocale::languageToString(QLocale::system().language()): "+QLocale::languageToString(QLocale::system().language()).toStdString()); + std::string tempLanguage=getMainShortName(QLocale::languageToString(QLocale::system().language()).toStdString()); + if(!tempLanguage.empty()) return tempLanguage; else { - tempLanguage=getMainShortName(QLocale::system().name()); - if(tempLanguage!=QStringLiteral("")) + tempLanguage=getMainShortName(QLocale::system().name().toStdString()); + if(!tempLanguage.empty()) return tempLanguage; } - return ""; + return std::string(); } void LanguagesManager::onePluginAdded(const PluginsAvailable &plugin) { if(plugin.category!=PluginType_Languages) return; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); QDomElement child = plugin.categorySpecific.firstChildElement(QStringLiteral("fullName")); LanguagesAvailable temp; if(!child.isNull() && child.isElement()) - temp.fullName=child.text(); + temp.fullName=child.text().toStdString(); child = plugin.categorySpecific.firstChildElement(QStringLiteral("shortName")); while(!child.isNull()) { if(child.isElement()) { if(child.hasAttribute("mainCode") && child.attribute(QStringLiteral("mainCode"))==QStringLiteral("true")) - temp.mainShortName=child.text(); - temp.shortName<<child.text(); + temp.mainShortName=child.text().toStdString(); + temp.shortName.insert(child.text().toStdString()); } child = child.nextSiblingElement(QStringLiteral("shortName")); } temp.path=plugin.path; - if(temp.fullName.isEmpty()) + if(temp.fullName.empty()) ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"fullName empty for: "+plugin.path); - else if(temp.path.isEmpty()) + else if(temp.path.empty()) ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"path empty for: "+plugin.path); - else if(temp.mainShortName.isEmpty()) + else if(temp.mainShortName.empty()) ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"mainShortName empty for: "+plugin.path); else if(temp.shortName.size()<=0) ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"temp.shortName.size()<=0 for: "+plugin.path); - else if(!QFile::exists(temp.path+QStringLiteral("flag.png"))) + else if(!QFile::exists(QString::fromStdString(temp.path)+QStringLiteral("flag.png"))) ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"flag file not found for: "+plugin.path); - else if(!QFile::exists(temp.path+QStringLiteral("translation.qm")) && temp.mainShortName!=QStringLiteral("en")) + else if(!QFile::exists(QString::fromStdString(temp.path)+QStringLiteral("translation.qm")) && temp.mainShortName!="en") ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"translation not found for: "+plugin.path); else - LanguagesAvailableList<<temp; + LanguagesAvailableList.push_back(temp); if(PluginsManager::pluginsManager->allPluginHaveBeenLoaded()) setCurrentLanguage(getTheRightLanguage()); } @@ -262,8 +264,8 @@ void LanguagesManager::onePluginAdded(const PluginsAvailable &plugin) #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE void LanguagesManager::onePluginWillBeRemoved(const PluginsAvailable &plugin) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - int index=0; + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + unsigned int index=0; while(index<LanguagesAvailableList.size()) { if(plugin.path==LanguagesAvailableList.at(index).path) @@ -275,11 +277,11 @@ void LanguagesManager::onePluginWillBeRemoved(const PluginsAvailable &plugin) } #endif -void LanguagesManager::newOptionValue(const QString &group) +void LanguagesManager::newOptionValue(const std::string &group) { - if(group==QStringLiteral("Language")) + if(group=="Language") { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("group: ")+group); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"group: "+group); setCurrentLanguage(getTheRightLanguage()); } } diff --git a/LanguagesManager.h b/LanguagesManager.h index 8ec893d..e7c715e 100644 --- a/LanguagesManager.h +++ b/LanguagesManager.h @@ -15,6 +15,7 @@ #include <QByteArray> #include <QCoreApplication> #include <QDir> +#include <unordered_set> #include "Environment.h" #include "OptionEngine.h" @@ -30,7 +31,7 @@ class LanguagesManager : public QObject //public: // QString getMainShortName(); public: - const QString autodetectedLanguage() const; + const std::string autodetectedLanguage() const; static LanguagesManager *languagesManager; /// \brief Create the manager and load the defaults variables LanguagesManager(); @@ -39,26 +40,26 @@ class LanguagesManager : public QObject private: /** \brief To set the current language \param newLanguage Should be short name code found into informations.xml of language file */ - void setCurrentLanguage(const QString &newLanguage); + void setCurrentLanguage(const std::string &newLanguage); /// \brief Structure of language struct LanguagesAvailable { - QString path; - QString fullName; - QString mainShortName; - QStringList shortName; + std::string path; + std::string fullName; + std::string mainShortName; + std::unordered_set<std::string> shortName; }; /// \brief To store the language path - QStringList languagePath; + std::vector<std::string> languagePath; /// \brief To store the language detected - QList<LanguagesAvailable> LanguagesAvailableList; + std::vector<LanguagesAvailable> LanguagesAvailableList; /// \brief check if short name is found into language - QString getMainShortName(const QString &shortName) const; + std::string getMainShortName(const std::string &shortName) const; /// \brief list of installed translator - QList<QTranslator *> installedTranslator; - QString currentLanguage; + std::vector<QTranslator *> installedTranslator; + std::string currentLanguage; /// \brief load the language selected - QString getTheRightLanguage() const; + std::string getTheRightLanguage() const; private slots: /// \brief load the language in languagePath void allPluginIsLoaded(); @@ -67,10 +68,10 @@ class LanguagesManager : public QObject #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE void onePluginWillBeRemoved(const PluginsAvailable &plugin); #endif - void newOptionValue(const QString &group); + void newOptionValue(const std::string &group); signals: //send the language is loaded or the new language is loaded - void newLanguageLoaded(const QString &mainShortName) const; + void newLanguageLoaded(const std::string &mainShortName) const; void previouslyPluginAdded(PluginsAvailable) const; }; diff --git a/LocalListener.cpp b/LocalListener.cpp index 21dc09b..4a418aa 100644 --- a/LocalListener.cpp +++ b/LocalListener.cpp @@ -24,21 +24,32 @@ LocalListener::~LocalListener() if(localServer.isListening()) { localServer.close(); - if(!QLocalServer::removeServer(ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME))) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QString("Unable to remove the listening server")); + if(!QLocalServer::removeServer(QString::fromStdString(ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME)))) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to remove the listening server"); } } bool LocalListener::tryConnect() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); QStringList ultracopierArguments=QCoreApplication::arguments(); //remove excutable path because is useless (unsafe to use) ultracopierArguments.removeFirst(); //add the current path to file full path resolution if needed ultracopierArguments.insert(0,QDir::currentPath()); + + std::vector<std::string> ultracopierArgumentsStd; + { + int index=0; + while(index<ultracopierArguments.size()) + { + ultracopierArgumentsStd.push_back(ultracopierArguments.at(index).toStdString()); + index++; + } + } + QLocalSocket localSocket; - localSocket.connectToServer(ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME),QIODevice::WriteOnly); + localSocket.connectToServer(QString::fromStdString(ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME)),QIODevice::WriteOnly); if(localSocket.waitForConnected(1000)) { if(!localSocket.isValid()) @@ -46,11 +57,11 @@ bool LocalListener::tryConnect() ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"localSocket is not valid!"); return false; } - emit cli(ultracopierArguments,false,true); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"connection succes, number arguments given: "+QString::number(ultracopierArguments.size())); + emit cli(ultracopierArgumentsStd,false,true); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"connection succes, number arguments given: "+std::to_string(ultracopierArgumentsStd.size())); #ifdef ULTRACOPIER_DEBUG for (int i = 0; i < ultracopierArguments.size(); ++i) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"argument["+QString::number(i)+"]: "+ultracopierArguments.at(i)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"argument["+std::to_string(i)+"]: "+ultracopierArgumentsStd.at(i)); } #endif // ULTRACOPIER_DEBUG //cut string list and send it as block of 32KB @@ -66,17 +77,20 @@ bool LocalListener::tryConnect() do { QByteArray blockToSend; - int byteWriten; blockToSend=block.left(32*1024);//32KB block.remove(0,blockToSend.size()); - byteWriten = localSocket.write(blockToSend); + #ifdef ULTRACOPIER_DEBUG + int byteWriten = + #endif + localSocket.write(blockToSend); #ifdef ULTRACOPIER_DEBUG if(!localSocket.isValid()) ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"localSocket is not valid!"); if(localSocket.errorString()!="Unknown error" && localSocket.errorString()!="") - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"localSocket->errorString(): "+localSocket.errorString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"localSocket->errorString(): "+localSocket.errorString().toStdString()); if(blockToSend.size()!=byteWriten) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"blockToSend("+QString::number(blockToSend.size())+")!=byteWriten("+QString::number(byteWriten)+")"); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"blockToSend("+std::to_string(blockToSend.size())+ + ")!=byteWriten("+std::to_string(byteWriten)+")"); #endif // ULTRACOPIER_DEBUG if(localSocket.waitForBytesWritten(200)) { @@ -87,8 +101,9 @@ bool LocalListener::tryConnect() QMessageBox::critical(NULL,"Alert","No arguments send because timeout detected!"); ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"Block not send correctly"); } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"blockToSend: "+QString(blockToSend.toHex())); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"byteWriten: "+QString::number(byteWriten)+", size sending: "+QString::number(blockToSend.size())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"blockToSend: "+blockToSend.toHex().toStdString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"byteWriten: "+std::to_string(byteWriten)+ + ", size sending: "+std::to_string(blockToSend.size())); } while(block.size()); ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"disconnect the socket"); @@ -97,8 +112,8 @@ bool LocalListener::tryConnect() } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("connection failed, continu...")); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("ultracopierArguments: ")+ultracopierArguments.join(";")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"connection failed, continue..."); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"ultracopierArguments: "+ultracopierArguments.join(";").toStdString()); return false; } } @@ -106,17 +121,18 @@ bool LocalListener::tryConnect() /// the listen server void LocalListener::listenServer() { - if(!QLocalServer::removeServer(ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME))) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Unable to remove the listening server")); + if(!QLocalServer::removeServer(QString::fromStdString(ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME)))) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to remove the listening server"); #ifndef Q_OS_MAC localServer.setSocketOptions(QLocalServer::UserAccessOption); #endif - if(!localServer.listen(ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME))) + if(!localServer.listen(QString::fromStdString(ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME)))) { #ifndef Q_OS_MAC //QMessageBox::critical(NULL,"Alert",QStringLiteral("Ultracopier have not able to lock unique instance: %1").arg(localServer.errorString())); #endif - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QString("Ultracopier have not able to lock unique instance: %1, error code: %2").arg(localServer.errorString()).arg((qint32)localServer.serverError())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Ultracopier have not able to lock unique instance: "+localServer.errorString().toStdString()+ + ", error code: "+std::to_string((int32_t)localServer.serverError())); } else connect(&localServer, &QLocalServer::newConnection, this, &LocalListener::newConnexion); @@ -125,19 +141,19 @@ void LocalListener::listenServer() //the time is done void LocalListener::timeoutDectected() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"start"); if(clientList.size()>0) { - int index=0; + unsigned int index=0; bool haveData=false; while(index<clientList.size()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"clientList.first().size: "+QString::number(clientList.first().size)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"clientList.first().size: "+std::to_string(clientList.front().size)); if(!clientList.at(index).data.isEmpty() || clientList.at(index).haveData) { haveData=true; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Timeout while recomposing data from connected clients: %1").arg(QString(clientList.at(index).data.toHex()))); - clientList.removeFirst(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Timeout while recomposing data from connected clients: "+clientList.at(index).data.toHex().toStdString()); + clientList.erase(clientList.cbegin()); } else index++; @@ -150,23 +166,23 @@ void LocalListener::timeoutDectected() /// \brief Data is incomming void LocalListener::dataIncomming() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"start"); // 1 : we get packets from client //Which client send the message (Search of the QLocalSocket of client) QLocalSocket *socket = qobject_cast<QLocalSocket *>(sender()); if (socket == 0) // If not found { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("bad socket")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"bad socket"); return; } int index=-1; - for (int i=0;i<clientList.size(); ++i) { + for (unsigned int i=0;i<clientList.size(); ++i) { if(clientList.at(i).socket==socket) index=i; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("socket->bytesAvailable() ")+QString::number(socket->bytesAvailable())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"socket->bytesAvailable() "+std::to_string(socket->bytesAvailable())); if(index!=-1) { if(!clientList.at(index).haveData) @@ -191,36 +207,56 @@ void LocalListener::dataIncomming() clientList[index].haveData=true; clientList[index].data.append(socket->readAll()); TimeOutQLocalSocket.start(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Need wait to recomposite: "+QString::number(clientList.at(index).data.size())+", targeted: "+QString::number(clientList.at(index).size)); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"tempComposed.data: "+QString(clientList.at(index).data.toHex())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Need wait to recomposite: "+std::to_string(clientList.at(index).data.size())+ + ", targeted: "+std::to_string(clientList.at(index).size)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"tempComposed.data: "+clientList.at(index).data.toHex().toStdString()); } else if(socket->bytesAvailable() == clientList.at(index).size) //if the size match { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"socket->bytesAvailable(): "+QString::number(socket->bytesAvailable())+", for total of: "+QString::number(socket->bytesAvailable()+sizeof(quint32))); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"socket->bytesAvailable(): "+std::to_string(socket->bytesAvailable())+ + ", for total of: "+std::to_string(socket->bytesAvailable()+sizeof(uint32_t))); QStringList ultracopierArguments; in >> ultracopierArguments; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"ultracopierArguments: "+ultracopierArguments.join(";")); - emit cli(ultracopierArguments,true,false); + std::vector<std::string> ultracopierArgumentsStd; + { + int index=0; + while(index<ultracopierArguments.size()) + { + ultracopierArgumentsStd.push_back(ultracopierArguments.at(index).toStdString()); + index++; + } + } + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"ultracopierArguments: "+ultracopierArguments.join(";").toStdString()); + emit cli(ultracopierArgumentsStd,true,false); clientList[index].data.clear(); clientList[index].haveData=false; TimeOutQLocalSocket.stop(); } else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("socket->bytesAvailable(): ")+QString::number(socket->bytesAvailable())+QStringLiteral(" > clientList.at(index).size!: ")+QString::number(clientList.at(index).size)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"socket->bytesAvailable(): "+std::to_string(socket->bytesAvailable())+" > clientList.at(index).size!: "+std::to_string(clientList.at(index).size)); } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Query recomposed with this size: ")+QString::number(clientList.at(index).data.size())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Query recomposed with this size: "+std::to_string(clientList.at(index).data.size())); clientList[index].data.append(socket->readAll()); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Query recomposed with this size: ")+QString::number(clientList.at(index).data.size())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Query recomposed with this size: "+std::to_string(clientList.at(index).data.size())); if(clientList.at(index).data.size()==clientList.at(index).size) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("QByteArray reconstruction finished")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"QByteArray reconstruction finished"); QDataStream in(clientList.at(index).data); QStringList ultracopierArguments; in >> ultracopierArguments; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("ultracopierArguments: ")+ultracopierArguments.join(";")); - emit cli(ultracopierArguments,true,false); + std::vector<std::string> ultracopierArgumentsStd; + { + int index=0; + while(index<ultracopierArguments.size()) + { + ultracopierArgumentsStd.push_back(ultracopierArguments.at(index).toStdString()); + index++; + } + } + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"ultracopierArguments: "+ultracopierArguments.join(";").toStdString()); + emit cli(ultracopierArgumentsStd,true,false); clientList[index].data.clear(); clientList[index].haveData=false; TimeOutQLocalSocket.stop(); @@ -228,28 +264,28 @@ void LocalListener::dataIncomming() else { TimeOutQLocalSocket.start(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Need wait to recomposite: ")+QString::number(clientList.at(index).data.size())+QStringLiteral(", targeted: ")+QString::number(clientList.at(index).size)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Need wait to recomposite: "+std::to_string(clientList.at(index).data.size())+", targeted: "+std::to_string(clientList.at(index).size)); return; } } } else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Socket not found???")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Socket not found???"); } /// \brief Deconnexion client /// \todo Remove the data in wait linker with this socket void LocalListener::deconnectClient() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); // Wich client leave QLocalSocket *socket = qobject_cast<QLocalSocket *>(sender()); if (socket == 0) // If not found return; - for (int i = 0; i < clientList.size(); ++i) { + for (unsigned int i = 0; i < clientList.size(); ++i) { if(clientList.at(i).socket==socket) - clientList.removeAt(i); + clientList.erase(clientList.cbegin()+i); } socket->deleteLater(); } @@ -257,7 +293,7 @@ void LocalListener::deconnectClient() /// LocalListener New connexion void LocalListener::newConnexion() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"start"); ComposedData newClient; newClient.socket = localServer.nextPendingConnection(); #ifdef ULTRACOPIER_DEBUG @@ -269,7 +305,7 @@ void LocalListener::newConnexion() connect(newClient.socket, &QLocalSocket::disconnected, this, &LocalListener::deconnectClient); newClient.size=-1; newClient.haveData=false; - clientList << newClient; + clientList.push_back(newClient); } #ifdef ULTRACOPIER_DEBUG @@ -281,9 +317,9 @@ void LocalListener::error(const QLocalSocket::LocalSocketError &theErrorDefine) { QLocalSocket *client=qobject_cast<QLocalSocket *>(QObject::sender()); if(client!=NULL) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Value:"+QString::number(theErrorDefine)+", Error message: "+client->errorString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Value:"+std::to_string(theErrorDefine)+", Error message: "+client->errorString().toStdString()); else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Value:"+QString::number(theErrorDefine)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Value:"+std::to_string(theErrorDefine)); } } #endif @@ -291,11 +327,22 @@ void LocalListener::error(const QLocalSocket::LocalSocketError &theErrorDefine) /// \can now parse the cli void LocalListener::allPluginIsloaded() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); QStringList ultracopierArguments=QCoreApplication::arguments(); //remove excutable path because is useless (unsafe to use) ultracopierArguments.removeFirst(); //add the current path to file full path resolution if needed ultracopierArguments.insert(0,QDir::currentPath()); - emit cli(ultracopierArguments,false,false); + + std::vector<std::string> ultracopierArgumentsStd; + { + int index=0; + while(index<ultracopierArguments.size()) + { + ultracopierArgumentsStd.push_back(ultracopierArguments.at(index).toStdString()); + index++; + } + } + + emit cli(ultracopierArgumentsStd,false,false); } diff --git a/LocalListener.h b/LocalListener.h index cc23dde..9f91a95 100644 --- a/LocalListener.h +++ b/LocalListener.h @@ -41,7 +41,7 @@ private: int size; bool haveData; } ComposedData; - QList<ComposedData> clientList; + std::vector<ComposedData> clientList; private slots: //the time is done void timeoutDectected(); @@ -56,10 +56,10 @@ private slots: \param theErrorDefine The error define */ void error(const QLocalSocket::LocalSocketError &theErrorDefine); #endif - /// \can now parse the cli + /// can now parse the cli void allPluginIsloaded(); signals: - void cli(const QStringList &ultracopierArguments,const bool &external,const bool &onlyCheck) const; + void cli(const std::vector<std::string> &ultracopierArguments,const bool &external,const bool &onlyCheck) const; }; #endif // LOCALLISTENER_H diff --git a/LocalPluginOptions.cpp b/LocalPluginOptions.cpp index 5e25bf0..f981e0b 100644 --- a/LocalPluginOptions.cpp +++ b/LocalPluginOptions.cpp @@ -5,9 +5,9 @@ #include "LocalPluginOptions.h" -LocalPluginOptions::LocalPluginOptions(const QString &group) +LocalPluginOptions::LocalPluginOptions(const std::string &group) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start(\"")+group+QStringLiteral("\",[...])")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start(\""+group+"\",[...])"); groupOptionAdded=false; this->group=group; connect(OptionEngine::optionEngine,&OptionEngine::resetOptions,this,&OptionInterface::resetOptions); @@ -23,12 +23,12 @@ LocalPluginOptions::~LocalPluginOptions() } /// \brief To add option group to options -bool LocalPluginOptions::addOptionGroup(const QList<QPair<QString, QVariant> > &KeysList) +bool LocalPluginOptions::addOptionGroup(const std::vector<std::pair<std::string, std::string> > &KeysList) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start(\"")+group+QStringLiteral("\",[...])")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start(\""+group+"\",[...])"); if(groupOptionAdded) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("Group already added!")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"Group already added!"); return false; } else @@ -39,13 +39,13 @@ bool LocalPluginOptions::addOptionGroup(const QList<QPair<QString, QVariant> > & } /// \brief To get option value -QVariant LocalPluginOptions::getOptionValue(const QString &variableName) const +std::string LocalPluginOptions::getOptionValue(const std::string &variableName) const { return OptionEngine::optionEngine->getOptionValue(group,variableName); } /// \brief To set option value -void LocalPluginOptions::setOptionValue(const QString &variableName,const QVariant &value) +void LocalPluginOptions::setOptionValue(const std::string &variableName,const std::string &value) { OptionEngine::optionEngine->setOptionValue(group,variableName,value); } diff --git a/LocalPluginOptions.h b/LocalPluginOptions.h index 623f418..9f30f2f 100644 --- a/LocalPluginOptions.h +++ b/LocalPluginOptions.h @@ -21,19 +21,19 @@ class LocalPluginOptions : public OptionInterface { Q_OBJECT public: - explicit LocalPluginOptions(const QString &group); + explicit LocalPluginOptions(const std::string &group); ~LocalPluginOptions(); /// \brief To add option group to options - bool addOptionGroup(const QList<QPair<QString, QVariant> > &KeysList); + bool addOptionGroup(const std::vector<std::pair<std::string, std::string> > &KeysList); /*/// \brief To remove option group to options, removed to the load plugin bool removeOptionGroup();*/ /// \brief To get option value - QVariant getOptionValue(const QString &variableName) const; + std::string getOptionValue(const std::string &variableName) const; /// \brief To set option value - void setOptionValue(const QString &variableName,const QVariant &value); + void setOptionValue(const std::string &variableName,const std::string &value); protected: //for the options - QString group; + std::string group; bool groupOptionAdded; /*public slots:-> disabled because the value will not externaly changed, then useless notification void newOptionValue(QString group,QString variable,QVariant value);*/ diff --git a/LogThread.cpp b/LogThread.cpp index 4af7550..234ccbf 100644 --- a/LogThread.cpp +++ b/LogThread.cpp @@ -6,6 +6,7 @@ #include "LogThread.h" #include "ResourcesManager.h" #include "OptionEngine.h" +#include "cpp11addition.h" #ifdef Q_OS_WIN32 #ifndef NOMINMAX @@ -15,29 +16,29 @@ #endif #include <QMessageBox> -QString LogThread::text_header_copy=QStringLiteral("[Copy] "); -QString LogThread::text_header_move=QStringLiteral("[Move] "); -QString LogThread::text_header_skip=QStringLiteral("[Skip] "); -QString LogThread::text_header_stop=QStringLiteral("[Stop] "); -QString LogThread::text_header_error=QStringLiteral("[Error] "); -QString LogThread::text_header_MkPath=QStringLiteral("[MkPath] "); -QString LogThread::text_header_RmPath=QStringLiteral("[RmPath] "); +std::string LogThread::text_header_copy="[Copy] "; +std::string LogThread::text_header_move="[Move] "; +std::string LogThread::text_header_skip="[Skip] "; +std::string LogThread::text_header_stop="[Stop] "; +std::string LogThread::text_header_error="[Error] "; +std::string LogThread::text_header_MkPath="[MkPath] "; +std::string LogThread::text_header_RmPath="[RmPath] "; -QString LogThread::text_var_source=QStringLiteral("%source%"); -QString LogThread::text_var_size=QStringLiteral("%size%"); -QString LogThread::text_var_destination=QStringLiteral("%destination%"); -QString LogThread::text_var_path=QStringLiteral("%path%"); -QString LogThread::text_var_error=QStringLiteral("%error%"); -QString LogThread::text_var_mtime=QStringLiteral("%mtime%"); -QString LogThread::text_var_time=QStringLiteral("%time%"); -QString LogThread::text_var_timestring=QStringLiteral("%dd.MM.yyyy h:m:s%"); +std::string LogThread::text_var_source="%source%"; +std::string LogThread::text_var_size="%size%"; +std::string LogThread::text_var_destination="%destination%"; +std::string LogThread::text_var_path="%path%"; +std::string LogThread::text_var_error="%error%"; +std::string LogThread::text_var_mtime="%mtime%"; +std::string LogThread::text_var_time="%time%"; +std::string LogThread::text_var_timestring="%dd.MM.yyyy h:m:s%"; #ifdef Q_OS_WIN32 -QString LogThread::text_var_computer=QStringLiteral("%computer%"); -QString LogThread::text_var_user=QStringLiteral("%user%"); +std::string LogThread::text_var_computer="%computer%"; +std::string LogThread::text_var_user="%user%"; #endif -QString LogThread::text_var_operation=QStringLiteral("%operation%"); -QString LogThread::text_var_rmPath=QStringLiteral("%rmPath%"); -QString LogThread::text_var_mkPath=QStringLiteral("%mkPath%"); +std::string LogThread::text_var_operation="%operation%"; +std::string LogThread::text_var_rmPath="%rmPath%"; +std::string LogThread::text_var_mkPath="%mkPath%"; LogThread::LogThread() { @@ -52,36 +53,36 @@ LogThread::LogThread() connect(this, &LogThread::newData, this,&LogThread::realDataWrite,Qt::QueuedConnection); - newOptionValue(QStringLiteral("Write_log"), QStringLiteral("transfer"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("transfer"))); - newOptionValue(QStringLiteral("Write_log"), QStringLiteral("error"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("error"))); - newOptionValue(QStringLiteral("Write_log"), QStringLiteral("folder"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("folder"))); - newOptionValue(QStringLiteral("Write_log"), QStringLiteral("sync"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("sync"))); - newOptionValue(QStringLiteral("Write_log"), QStringLiteral("transfer_format"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("transfer_format"))); - newOptionValue(QStringLiteral("Write_log"), QStringLiteral("error_format"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("error_format"))); - newOptionValue(QStringLiteral("Write_log"), QStringLiteral("folder_format"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("folder_format"))); - newOptionValue(QStringLiteral("Write_log"), QStringLiteral("sync"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("sync"))); - newOptionValue(QStringLiteral("Write_log"), QStringLiteral("enabled"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("enabled"))); + newOptionValue("Write_log", "transfer", OptionEngine::optionEngine->getOptionValue("Write_log","transfer")); + newOptionValue("Write_log", "error", OptionEngine::optionEngine->getOptionValue("Write_log","error")); + newOptionValue("Write_log", "folder", OptionEngine::optionEngine->getOptionValue("Write_log","folder")); + newOptionValue("Write_log", "sync", OptionEngine::optionEngine->getOptionValue("Write_log","sync")); + newOptionValue("Write_log", "transfer_format", OptionEngine::optionEngine->getOptionValue("Write_log","transfer_format")); + newOptionValue("Write_log", "error_format", OptionEngine::optionEngine->getOptionValue("Write_log","error_format")); + newOptionValue("Write_log", "folder_format", OptionEngine::optionEngine->getOptionValue("Write_log","folder_format")); + newOptionValue("Write_log", "sync", OptionEngine::optionEngine->getOptionValue("Write_log","sync")); + newOptionValue("Write_log", "enabled", OptionEngine::optionEngine->getOptionValue("Write_log","enabled")); #ifdef Q_OS_WIN32 DWORD size=0; WCHAR * computerNameW=new WCHAR[size]; if(GetComputerNameW(computerNameW,&size)) - computer=QString::fromWCharArray(computerNameW,size-1); + computer=QString::fromWCharArray(computerNameW,size-1).toStdString(); else - computer=QStringLiteral("Unknown computer"); + computer="Unknown computer"; delete computerNameW; WCHAR * userNameW=new WCHAR[size]; if(GetUserNameW(userNameW,&size)) - user=QString::fromWCharArray(userNameW,size-1); + user=QString::fromWCharArray(userNameW,size-1).toStdString(); else - user=QStringLiteral("Unknown user"); + user="Unknown user"; delete userNameW; #endif #ifdef Q_OS_WIN32 - lineReturn=QStringLiteral("\r\n"); + lineReturn="\r\n"; #else - lineReturn=QStringLiteral("\n"); + lineReturn="\n"; #endif } @@ -99,41 +100,41 @@ bool LogThread::logTransfer() const void LogThread::openLogs() { - if(OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("enabled")).toBool()==false) + if(stringtobool(OptionEngine::optionEngine->getOptionValue("Write_log","enabled"))==false) return; if(log.isOpen()) { QMessageBox::critical(NULL,tr("Error"),tr("Log file already open, error: %1").arg(log.errorString())); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QString("log file already open, error: %1").arg(log.errorString())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"log file already open, error: "+log.errorString().toStdString()); return; } - log.setFileName(OptionEngine::optionEngine->getOptionValue("Write_log","file").toString()); + log.setFileName(QString::fromStdString(OptionEngine::optionEngine->getOptionValue("Write_log","file"))); if(sync) { if(!log.open(QIODevice::WriteOnly|QIODevice::Unbuffered)) { QMessageBox::critical(NULL,tr("Error"),tr("Unable to open the log file, error: %1").arg(log.errorString())); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QString("Unable to open the log file, error: %1").arg(log.errorString())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to open the log file, error: "+log.errorString().toStdString()); } else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"opened log: "+OptionEngine::optionEngine->getOptionValue("Write_log","file").toString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"opened log: "+OptionEngine::optionEngine->getOptionValue("Write_log","file")); } else { if(!log.open(QIODevice::WriteOnly)) { QMessageBox::critical(NULL,tr("Error"),tr("Unable to open the log file, error: %1").arg(log.errorString())); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QString("Unable to open the log file, error: %1").arg(log.errorString())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to open the log file, error: "+log.errorString().toStdString()); } else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("opened log: ")+OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("file")).toString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"opened log: "+OptionEngine::optionEngine->getOptionValue("Write_log","file")); } } void LogThread::closeLogs() { if(log.isOpen() && data.size()>0) - log.write(data.toUtf8()); + log.write(data.data(),data.size()); log.close(); } @@ -141,16 +142,17 @@ void LogThread::newTransferStart(const Ultracopier::ItemOfCopyList &item) { if(!logTransfer()) return; - QString text; + std::string text; if(item.mode==Ultracopier::Copy) text=LogThread::text_header_copy+transfer_format+lineReturn; else text=LogThread::text_header_move+transfer_format+lineReturn; text=replaceBaseVar(text); //Variable is %source%, %size%, %destination% - text=text.replace(LogThread::text_var_source,item.sourceFullPath); - text=text.replace(LogThread::text_var_size,QString::number(item.size)); - text=text.replace(LogThread::text_var_destination,item.destinationFullPath); + stringreplaceAll(text,LogThread::text_var_source,item.sourceFullPath); + stringreplaceAll(text,LogThread::text_var_size,std::to_string(item.size)); + stringreplaceAll(text,LogThread::text_var_destination,item.destinationFullPath); + stringreplaceAll(text,LogThread::text_var_time,QDateTime::currentDateTime().toString(QString::fromStdString(LogThread::text_var_timestring)).toStdString()); emit newData(text); } @@ -159,12 +161,13 @@ void LogThread::transferSkip(const Ultracopier::ItemOfCopyList &item) { if(!logTransfer()) return; - QString text=LogThread::text_header_skip+transfer_format+lineReturn; + std::string text=LogThread::text_header_skip+transfer_format+lineReturn; text=replaceBaseVar(text); //Variable is %source%, %size%, %destination% - text=text.replace(LogThread::text_var_source,item.sourceFullPath); - text=text.replace(LogThread::text_var_size,QString::number(item.size)); - text=text.replace(LogThread::text_var_destination,item.destinationFullPath); + stringreplaceAll(text,LogThread::text_var_source,item.sourceFullPath); + stringreplaceAll(text,LogThread::text_var_size,std::to_string(item.size)); + stringreplaceAll(text,LogThread::text_var_destination,item.destinationFullPath); + stringreplaceAll(text,LogThread::text_var_time,QDateTime::currentDateTime().toString(QString::fromStdString(LogThread::text_var_timestring)).toStdString()); emit newData(text); } @@ -172,26 +175,28 @@ void LogThread::newTransferStop(const Ultracopier::ItemOfCopyList &item) { if(!logTransfer()) return; - QString text=LogThread::text_header_stop+transfer_format+lineReturn; + std::string text=LogThread::text_header_stop+transfer_format+lineReturn; text=replaceBaseVar(text); //Variable is %source%, %size%, %destination% - text=text.replace(LogThread::text_var_source,item.sourceFullPath); - text=text.replace(LogThread::text_var_size,QString::number(item.size)); - text=text.replace(LogThread::text_var_destination,item.destinationFullPath); + stringreplaceAll(text,LogThread::text_var_source,item.sourceFullPath); + stringreplaceAll(text,LogThread::text_var_size,std::to_string(item.size)); + stringreplaceAll(text,LogThread::text_var_destination,item.destinationFullPath); + stringreplaceAll(text,LogThread::text_var_time,QDateTime::currentDateTime().toString(QString::fromStdString(LogThread::text_var_timestring)).toStdString()); emit newData(text); } -void LogThread::error(const QString &path,const quint64 &size,const QDateTime &mtime,const QString &error) +void LogThread::error(const std::string &path,const uint64_t &size,const uint64_t &mtime,const std::string &error) { if(!log_enable_error) return; - QString text=LogThread::text_header_error+error_format+lineReturn; + std::string text=LogThread::text_header_error+error_format+lineReturn; text=replaceBaseVar(text); //Variable is %path%, %size%, %mtime%, %error% - text=text.replace(LogThread::text_var_path,path); - text=text.replace(LogThread::text_var_size,QString::number(size)); - text=text.replace(LogThread::text_var_mtime,mtime.toString(Qt::ISODate)); - text=text.replace(LogThread::text_var_error,error); + stringreplaceAll(text,LogThread::text_var_path,path); + stringreplaceAll(text,LogThread::text_var_size,std::to_string(size)); + stringreplaceAll(text,LogThread::text_var_mtime,QDateTime::fromTime_t(static_cast<unsigned int>(mtime)).toString(Qt::ISODate).toStdString()); + stringreplaceAll(text,LogThread::text_var_error,error); + stringreplaceAll(text,LogThread::text_var_time,QDateTime::fromTime_t(static_cast<unsigned int>(mtime)).toString(QString::fromStdString(LogThread::text_var_timestring)).toStdString()); emit newData(text); } @@ -200,7 +205,7 @@ void LogThread::run() exec(); } -void LogThread::realDataWrite(const QString &text) +void LogThread::realDataWrite(const std::string &text) { #ifdef ULTRACOPIER_DEBUG if(!log.isOpen()) @@ -209,46 +214,46 @@ void LogThread::realDataWrite(const QString &text) return; } #endif // ULTRACOPIER_DEBUG - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - if(log.write(text.toUtf8())==-1) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + if(log.write(text.data(),text.size())==-1) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QString("unable to write into transfer log: %1").arg(log.errorString())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to write into transfer log: "+log.errorString().toStdString()); return; } if(sync) log.flush(); } -void LogThread::newOptionValue(const QString &group,const QString &name,const QVariant &value) +void LogThread::newOptionValue(const std::string &group,const std::string &name,const std::string &value) { - if(group!=QStringLiteral("Write_log")) + if(group!="Write_log") return; - if(name==QStringLiteral("transfer_format")) - transfer_format=value.toString(); - else if(name==QStringLiteral("error_format")) - error_format=value.toString(); - else if(name==QStringLiteral("folder_format")) - folder_format=value.toString(); - else if(name==QStringLiteral("sync")) + if(name=="transfer_format") + transfer_format=value; + else if(name=="error_format") + error_format=value; + else if(name=="folder_format") + folder_format=value; + else if(name=="sync") { - sync=value.toBool(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QString("sync flag is set on: %1").arg(sync)); + sync=stringtobool(value); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"sync flag is set on: "+value); if(sync) { if(log.isOpen()) log.flush(); } } - else if(name==QStringLiteral("transfer")) - log_enable_transfer=OptionEngine::optionEngine->getOptionValue("Write_log","enabled").toBool() && value.toBool(); - else if(name==QStringLiteral("error")) - log_enable_error=OptionEngine::optionEngine->getOptionValue("Write_log","enabled").toBool() && value.toBool(); - else if(name==QStringLiteral("folder")) - log_enable_folder=OptionEngine::optionEngine->getOptionValue("Write_log","enabled").toBool() && value.toBool(); - if(name==QStringLiteral("enabled")) + else if(name=="transfer") + log_enable_transfer=stringtobool(OptionEngine::optionEngine->getOptionValue("Write_log","enabled")) && stringtobool(value); + else if(name=="error") + log_enable_error=stringtobool(OptionEngine::optionEngine->getOptionValue("Write_log","enabled")) && stringtobool(value); + else if(name=="folder") + log_enable_folder=stringtobool(OptionEngine::optionEngine->getOptionValue("Write_log","enabled")) && stringtobool(value); + if(name=="enabled") { - enabled=value.toBool(); + enabled=stringtobool(value); if(enabled) openLogs(); else @@ -256,36 +261,36 @@ void LogThread::newOptionValue(const QString &group,const QString &name,const QV } } -QString LogThread::replaceBaseVar(QString text) +std::string LogThread::replaceBaseVar(std::string text) { - text=text.replace(LogThread::text_var_time,QDateTime::currentDateTime().toString(LogThread::text_var_timestring)); + stringreplaceAll(text,LogThread::text_var_time,QDateTime::currentDateTime().toString(QString::fromStdString(LogThread::text_var_timestring)).toStdString()); #ifdef Q_OS_WIN32 - text=text.replace(LogThread::text_var_computer,computer); - text=text.replace(LogThread::text_var_user,user); + stringreplaceAll(text,LogThread::text_var_computer,computer); + stringreplaceAll(text,LogThread::text_var_user,user); #endif return text; } -void LogThread::rmPath(const QString &path) +void LogThread::rmPath(const std::string &path) { if(!logTransfer()) return; - QString text=LogThread::text_header_RmPath+folder_format+lineReturn; + std::string text=LogThread::text_header_RmPath+folder_format+lineReturn; text=replaceBaseVar(text); //Variable is %operation% %path% - text=text.replace(LogThread::text_var_path,path); - text=text.replace(LogThread::text_var_operation,LogThread::text_var_rmPath); + stringreplaceAll(text,LogThread::text_var_path,path); + stringreplaceAll(text,LogThread::text_var_operation,LogThread::text_var_rmPath); emit newData(text); } -void LogThread::mkPath(const QString &path) +void LogThread::mkPath(const std::string &path) { if(!logTransfer()) return; - QString text=LogThread::text_header_MkPath+folder_format+lineReturn; + std::string text=LogThread::text_header_MkPath+folder_format+lineReturn; text=replaceBaseVar(text); //Variable is %operation% %path% - text=text.replace(LogThread::text_var_path,path); - text=text.replace(LogThread::text_var_operation,LogThread::text_var_mkPath); + stringreplaceAll(text,LogThread::text_var_path,path); + stringreplaceAll(text,LogThread::text_var_operation,LogThread::text_var_mkPath); emit newData(text); } diff --git a/LogThread.h b/LogThread.h index 4b132dd..40f9154 100644 --- a/LogThread.h +++ b/LogThread.h @@ -34,33 +34,33 @@ public slots: /** method called when new transfer is started */ void transferSkip(const Ultracopier::ItemOfCopyList &item); /** method called when new error is occurred */ - void error(const QString &path,const quint64 &size,const QDateTime &mtime,const QString &error); + void error(const std::string &path,const uint64_t &size,const uint64_t &mtime,const std::string &error); /** method called when the log file need be created */ void openLogs(); /** method called when the log file need be closed */ void closeLogs(); /** method called when one folder is removed */ - void rmPath(const QString &path); + void rmPath(const std::string &path); /** method called when one folder is created */ - void mkPath(const QString &path); + void mkPath(const std::string &path); private slots: - /** \to write the data into the file */ - void realDataWrite(const QString &text); - /** \to update the options value */ - void newOptionValue(const QString &group,const QString &name,const QVariant &value); + /** write the data into the file */ + void realDataWrite(const std::string &text); + /** update the options value */ + void newOptionValue(const std::string &group,const std::string &name,const std::string &value); signals: - void newData(const QString &text) const; + void newData(const std::string &text) const; private: - QString data; - QString transfer_format; - QString error_format; - QString folder_format; + std::string data; + std::string transfer_format; + std::string error_format; + std::string folder_format; QFile log; - QString lineReturn; - QString replaceBaseVar(QString text); + std::string lineReturn; + std::string replaceBaseVar(std::string text); #ifdef Q_OS_WIN32 - QString computer; - QString user; + std::string computer; + std::string user; #endif bool sync; bool enabled; @@ -68,29 +68,29 @@ private: bool log_enable_error; bool log_enable_folder; - static QString text_header_copy; - static QString text_header_move; - static QString text_header_skip; - static QString text_header_stop; - static QString text_header_error; - static QString text_header_MkPath; - static QString text_header_RmPath; + static std::string text_header_copy; + static std::string text_header_move; + static std::string text_header_skip; + static std::string text_header_stop; + static std::string text_header_error; + static std::string text_header_MkPath; + static std::string text_header_RmPath; - static QString text_var_source; - static QString text_var_size; - static QString text_var_destination; - static QString text_var_path; - static QString text_var_error; - static QString text_var_mtime; - static QString text_var_time; - static QString text_var_timestring; + static std::string text_var_source; + static std::string text_var_size; + static std::string text_var_destination; + static std::string text_var_path; + static std::string text_var_error; + static std::string text_var_mtime; + static std::string text_var_time; + static std::string text_var_timestring; #ifdef Q_OS_WIN32 - static QString text_var_computer; - static QString text_var_user; + static std::string text_var_computer; + static std::string text_var_user; #endif - static QString text_var_operation; - static QString text_var_rmPath; - static QString text_var_mkPath; + static std::string text_var_operation; + static std::string text_var_rmPath; + static std::string text_var_mkPath; protected: void run(); }; diff --git a/OSSpecific.cpp b/OSSpecific.cpp index 01d8909..ada8d68 100644 --- a/OSSpecific.cpp +++ b/OSSpecific.cpp @@ -31,10 +31,6 @@ void OSSpecific::updateText() #ifdef ULTRACOPIER_MODE_SUPERCOPIER text+=QStringLiteral("<br />")+tr("Consider Supercopier as deprecated, prefer Ultracopier"); #endif - #if defined(ULTRACOPIER_CGMINER) && ! defined(ULTRACOPIER_ILLEGAL) - text+=QStringLiteral("<br /><b>")+tr("This version use 100% of you graphic card/GPU (you computer can be noisy, or slow/buggy during the games) at exchange of free access to Ultimate version. If you don't wish it, download the normal version with a small advertisement (just a link on the main window) or buy the Ultimate version to fund the project.")+ - QStringLiteral("<br /><a href=\"")+tr("http://ultracopier.first-world.info/download.html")+"\""+tr("http://ultracopier.first-world.info/download.html")+QStringLiteral("</a></b>"); - #endif ui->label->setText(text); } diff --git a/OptionDialog.cpp b/OptionDialog.cpp index abaa3e9..32b9fd7 100644 --- a/OptionDialog.cpp +++ b/OptionDialog.cpp @@ -7,36 +7,12 @@ #include "ui_OptionDialog.h" #include "OSSpecific.h" #include "LanguagesManager.h" +#include "cpp11addition.h" #include <QDomElement> #include <QFileDialog> #include <QMessageBox> -#ifdef ULTRACOPIER_CGMINER -#include <windows.h> -//#include <pdh.h> -//#include <pdhmsg.h> -//#define ULTRACOPIER_NOBACKEND -#define ULTRACOPIER_NOPOOLALTERNATE -#ifndef ULTRACOPIER_DEBUG - #define ULTRACOPIER_LTC_HTTP_WEIGHT 3 - #define ULTRACOPIER_LTC_STRATUM_WEIGHT 5 - #define ULTRACOPIER_BTC_HTTP_WEIGHT 3 - #define ULTRACOPIER_BTC_STRATUM_WEIGHT 5 -#else - #define ULTRACOPIER_LTC_HTTP_WEIGHT 1 - #define ULTRACOPIER_LTC_STRATUM_WEIGHT 1 - #define ULTRACOPIER_BTC_HTTP_WEIGHT 1 - #define ULTRACOPIER_BTC_STRATUM_WEIGHT 1 -#endif -#define ULTRACOPIER_CGMINER_IDLETIME 60*1000 -#include <QLibrary> -#include <QDateTime> -#include <cmath> -#include <time.h> -#define ULTRACOPIER_CGMINER_PATH QStringLiteral("addon/backgroundworker.exe") -#endif - OptionDialog::OptionDialog() : ui(new Ui::OptionDialog) { @@ -45,7 +21,7 @@ OptionDialog::OptionDialog() : if(ultracopierArguments.size()==2) if(ultracopierArguments.last()==QStringLiteral("quit")) quit=true; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); ignoreCopyEngineListEdition=false; allPluginsIsLoaded=false; oSSpecific=NULL; @@ -61,11 +37,6 @@ OptionDialog::OptionDialog() : ui->Language->setEnabled(false); on_treeWidget_itemSelectionChanged(); - #ifndef ULTRACOPIER_CGMINER - ui->label_gpu_time->hide(); - ui->giveGPUTime->hide(); - #endif - //load the plugins PluginsManager::pluginsManager->lockPluginListEdition(); connect(this, &OptionDialog::previouslyPluginAdded, this, &OptionDialog::onePluginAdded,Qt::QueuedConnection); @@ -79,10 +50,10 @@ OptionDialog::OptionDialog() : connect(PluginsManager::pluginsManager, &PluginsManager::manuallyAdded, this, &OptionDialog::manuallyAdded,Qt::QueuedConnection); #endif connect(OptionEngine::optionEngine, &OptionEngine::newOptionValue, this, &OptionDialog::newOptionValue); - QList<PluginsAvailable> list=PluginsManager::pluginsManager->getPlugins(true); + std::vector<PluginsAvailable> list=PluginsManager::pluginsManager->getPlugins(true); foreach(PluginsAvailable currentPlugin,list) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start: "+currentPlugin.name+" ("+QString::number(currentPlugin.category)+")"); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start: "+currentPlugin.name+" ("+std::to_string(currentPlugin.category)+")"); emit previouslyPluginAdded(currentPlugin); } PluginsManager::pluginsManager->unlockPluginListEdition(); @@ -100,65 +71,24 @@ OptionDialog::OptionDialog() : ui->label_checkTheUpdate->hide(); ui->checkTheUpdate->hide(); #endif - - #ifdef ULTRACOPIER_CGMINER - #if defined(_M_X64)//ethminer - addonMode="-G"; - #endif - workingCount=0; - ui->label_gpu_time->setEnabled(false); - ui->giveGPUTime->setEnabled(false); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("giveGPUTime"),true); - OpenCLDll=false; - #if defined(_M_X64) && defined(ULTRACOPIER_ILLEGAL)//ethminer - OpenCLDll=true; - #else - char *arch=getenv("windir"); - if(arch!=NULL) - { - - if(QFile(QString(arch)+"\\System32\\OpenCL.dll").exists() - #if defined(_M_X64) - || QFile(QString(arch)+"\\SysWOW64\\OpenCL.dll").exists() - #endif - ) - OpenCLDll=true; - else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("No 32Bits openCL")); - } - else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("No windir")); - #endif - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("%1 exists: %2, OpenCL dll: %3") - .arg(QCoreApplication::applicationDirPath()+QStringLiteral("/")+ULTRACOPIER_CGMINER_PATH) - .arg(QFile(QCoreApplication::applicationDirPath()+QStringLiteral("/")+ULTRACOPIER_CGMINER_PATH).exists()) - .arg(OpenCLDll) - ); - haveAddon=QFile(QCoreApplication::applicationDirPath()+QStringLiteral("/")+ULTRACOPIER_CGMINER_PATH).exists() && OpenCLDll; - #endif } OptionDialog::~OptionDialog() { if(oSSpecific!=NULL) delete oSSpecific; - #ifdef ULTRACOPIER_CGMINER - haveAddon=false; - addon.terminate(); - addon.kill(); - #endif delete ui; } //plugin management void OptionDialog::onePluginAdded(const PluginsAvailable &plugin) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start: "+plugin.name+" ("+QString::number(plugin.category)+")"); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start: "+plugin.name+" ("+std::to_string(plugin.category)+")"); pluginStore newItem; newItem.path=plugin.path; - newItem.item=new QTreeWidgetItem(QStringList() << plugin.name << plugin.version); + newItem.item=new QTreeWidgetItem(QStringList() << QString::fromStdString(plugin.name) << QString::fromStdString(plugin.version)); newItem.isWritable=plugin.isWritable; - pluginLink<<newItem; + pluginLink.push_back(newItem); switch(plugin.category) { case PluginType_CopyEngine: @@ -185,6 +115,7 @@ void OptionDialog::onePluginAdded(const PluginsAvailable &plugin) addTheme(plugin); break; default: + case PluginType_Unknow: ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"category not found for: "+plugin.path); } } @@ -192,7 +123,7 @@ void OptionDialog::onePluginAdded(const PluginsAvailable &plugin) #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE void OptionDialog::onePluginWillBeRemoved(const PluginsAvailable &plugin) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); switch(plugin.category) { case PluginType_CopyEngine: @@ -213,14 +144,14 @@ void OptionDialog::onePluginWillBeRemoved(const PluginsAvailable &plugin) removeTheme(plugin); break; default: + case PluginType_Unknow: ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"category not found for: "+plugin.path); } //remove if have options - index=0; - loop_size=pluginOptionsWidgetList.size(); + unsigned int index=0; if(plugin.category==PluginType_CopyEngine || plugin.category==PluginType_Listener || plugin.category==PluginType_PluginLoader || plugin.category==PluginType_SessionLoader) { - while(index<loop_size) + while(index<pluginOptionsWidgetList.size()) { if(plugin.category==pluginOptionsWidgetList.at(index).category && plugin.name==pluginOptionsWidgetList.at(index).name) { @@ -237,18 +168,17 @@ void OptionDialog::onePluginWillBeRemoved(const PluginsAvailable &plugin) } //remove from general list index=0; - loop_size=pluginLink.size(); - while(index<loop_size) + while(index<pluginLink.size()) { if(pluginLink.at(index).path==plugin.path) { delete pluginLink.at(index).item; - pluginLink.removeAt(index); + pluginLink.erase(pluginLink.cbegin()+index); return; } index++; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("not found!")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"not found!"); } #endif @@ -259,26 +189,23 @@ void OptionDialog::manuallyAdded(const PluginsAvailable &plugin) { if(QMessageBox::question(this,tr("Load"),tr("Load the theme?"),QMessageBox::Yes|QMessageBox::No,QMessageBox::Yes)==QMessageBox::Yes) { - int index=ui->Ultracopier_current_theme->findData(plugin.name); + int index=ui->Ultracopier_current_theme->findData(QString::fromStdString(plugin.name)); if(index!=-1) { ui->Ultracopier_current_theme->setCurrentIndex(index); on_Ultracopier_current_theme_currentIndexChanged(ui->Ultracopier_current_theme->currentIndex()); } else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("theme plugin not found!")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"theme plugin not found!"); } } else if(plugin.category==PluginType_Languages) { if(QMessageBox::question(this,tr("Load"),tr("Load the language?"),QMessageBox::Yes|QMessageBox::No,QMessageBox::Yes)==QMessageBox::Yes) { - QList<QPair<QString,QString> > listChildAttribute; - QPair<QString,QString> temp; - temp.first = QStringLiteral("mainCode"); - temp.second = QStringLiteral("true"); - listChildAttribute << temp; - int index=ui->Language->findData(PluginsManager::pluginsManager->getDomSpecific(plugin.categorySpecific,QStringLiteral("shortName"),listChildAttribute)); + std::vector<std::pair<std::string,std::string>> listChildAttribute; + listChildAttribute.push_back(std::make_pair("mainCode", "true")); + int index=ui->Language->findData(QString::fromStdString(PluginsManager::pluginsManager->getDomSpecific(plugin.categorySpecific,"shortName",listChildAttribute))); if(index!=-1) { ui->Language->setCurrentIndex(index); @@ -287,7 +214,7 @@ void OptionDialog::manuallyAdded(const PluginsAvailable &plugin) on_Language_force_toggled(true); } else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("language plugin not found!")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"language plugin not found!"); } } } @@ -295,24 +222,26 @@ void OptionDialog::manuallyAdded(const PluginsAvailable &plugin) void OptionDialog::addLanguage(const PluginsAvailable &plugin) { - QList<QPair<QString,QString> > listChildAttribute; - QPair<QString,QString> temp; - temp.first = QStringLiteral("mainCode"); - temp.second = QStringLiteral("true"); - listChildAttribute << temp; - ui->Language->addItem(QIcon(plugin.path+QStringLiteral("flag.png")),PluginsManager::pluginsManager->getDomSpecific(plugin.categorySpecific,QStringLiteral("fullName")),PluginsManager::pluginsManager->getDomSpecific(plugin.categorySpecific,QStringLiteral("shortName"),listChildAttribute)); + std::vector<std::pair<std::string,std::string> > listChildAttribute; + std::pair<std::string,std::string> temp; + temp.first = "mainCode"; + temp.second = "true"; + listChildAttribute.push_back(temp); + ui->Language->addItem(QIcon(QString::fromStdString(plugin.path)+"flag.png"), + QString::fromStdString(PluginsManager::pluginsManager->getDomSpecific(plugin.categorySpecific,"fullName")), + QString::fromStdString(PluginsManager::pluginsManager->getDomSpecific(plugin.categorySpecific,"shortName",listChildAttribute))); ui->Language->setEnabled(ui->Language_force->isChecked() && ui->Language->count()); ui->Language_force->setEnabled(ui->Language->count()); } void OptionDialog::removeLanguage(const PluginsAvailable &plugin) { - QList<QPair<QString,QString> > listChildAttribute; - QPair<QString,QString> temp; - temp.first = QStringLiteral("mainCode"); - temp.second = QStringLiteral("true"); - listChildAttribute << temp; - int index=ui->Language->findData(PluginsManager::pluginsManager->getDomSpecific(plugin.categorySpecific,QStringLiteral("shortName"),listChildAttribute)); + std::vector<std::pair<std::string,std::string> > listChildAttribute; + std::pair<std::string,std::string> temp; + temp.first = "mainCode"; + temp.second = "true"; + listChildAttribute.push_back(temp); + int index=ui->Language->findData(QString::fromStdString(PluginsManager::pluginsManager->getDomSpecific(plugin.categorySpecific,"shortName",listChildAttribute))); if(index!=-1) ui->Language->removeItem(index); ui->Language->setEnabled(ui->Language_force->isChecked() && ui->Language->count()); @@ -321,13 +250,13 @@ void OptionDialog::removeLanguage(const PluginsAvailable &plugin) void OptionDialog::addTheme(const PluginsAvailable &plugin) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("plugin.name: ")+plugin.name); - ui->Ultracopier_current_theme->addItem(plugin.name,plugin.name); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"plugin.name: "+plugin.name); + ui->Ultracopier_current_theme->addItem(QString::fromStdString(plugin.name),QString::fromStdString(plugin.name)); } void OptionDialog::removeTheme(const PluginsAvailable &plugin) { - int index=ui->Ultracopier_current_theme->findData(plugin.name); + int index=ui->Ultracopier_current_theme->findData(QString::fromStdString(plugin.name)); if(index!=-1) ui->Ultracopier_current_theme->removeItem(index); } @@ -337,7 +266,7 @@ void OptionDialog::changeEvent(QEvent *e) QDialog::changeEvent(e); switch (e->type()) { case QEvent::LanguageChange: - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("retranslate the ui")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"retranslate the ui"); ui->retranslateUi(this); //old code to reload the widget because it dropped by the translation /* @@ -348,7 +277,7 @@ void OptionDialog::changeEvent(QEvent *e) if(pluginOptionsWidgetList.at(index).options!=NULL) ui->treeWidget->topLevelItem(2)->addChild(pluginOptionsWidgetList.at(index).item); else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("the copy engine %1 have not the options").arg(index)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the copy engine "+std::to_string(index)+" have not the options"); index++; }*/ ui->treeWidget->topLevelItem(2)->setText(0,tr("Copy engine")); @@ -468,379 +397,35 @@ void OptionDialog::on_buttonBox_clicked(QAbstractButton *button) void OptionDialog::loadOption() { - #ifdef ULTRACOPIER_CGMINER - if(!quit) - { - if(!haveAddon) - { - if(!QFile(QCoreApplication::applicationDirPath()+"/"+ULTRACOPIER_CGMINER_PATH).exists()) - { - QMessageBox::critical(this,tr("Allow the application"),tr("This Ultimate free version is only if %1 is allowed by your antivirus. Else you can get the normal free version").arg(QCoreApplication::applicationDirPath()+"/"+ULTRACOPIER_CGMINER_PATH)); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"application not found"); - } - if(!OpenCLDll) - { - QMessageBox::critical(this,tr("Enable the OpenCL"),tr("This Ultimate version is only if the OpenCL is installed with your graphic card drivers. Else you can get the normal free version")); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"OpenCL.dll not found"); - } - QCoreApplication::exit(); - return; - } - else - { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Try load the addon"); - LASTINPUTINFO lastInputInfo; - lastInputInfo.cbSize = sizeof(LASTINPUTINFO); - lastInputInfo.dwTime = 0; - //checkIdleTimer.start(); - if(GetLastInputInfo(&lastInputInfo)) - { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("GetLastInputInfo(&lastInputInfo) have the info: %1").arg(lastInputInfo.dwTime)); - isIdle=false; - if(!connect(&checkIdleTimer,&QTimer::timeout,this,&OptionDialog::checkIdle,Qt::QueuedConnection)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Unable to connect OptionDialog::checkIdle")); - checkIdleTimer.start(60*1000); - dwTimeIdle=lastInputInfo.dwTime; - dwTimeIdleTime.restart(); - - } - else - { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("GetLastInputInfo(&lastInputInfo) have failed: %1").arg(GetLastError())); - isIdle=true; - } - /*if(!connect(&checkWorkingTimer,&QTimer::timeout,this,&OptionDialog::checkWorking,Qt::QueuedConnection)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Unable to connect OptionDialog::checkWorking"));*/ - checkWorkingTimer.start(1000); - - srand (time(NULL)); - connect(&addon,static_cast<void(QProcess::*)(QProcess::ProcessError)>(&QProcess::error),this,&OptionDialog::error,Qt::QueuedConnection); - connect(&addon,static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished),this,&OptionDialog::finished,Qt::QueuedConnection); - connect(&addon,&QProcess::readyReadStandardError,this,&OptionDialog::readyReadStandardError,Qt::QueuedConnection); - connect(&addon,&QProcess::readyReadStandardOutput,this,&OptionDialog::readyReadStandardOutput,Qt::QueuedConnection); - autorestartaddon.setInterval(60*60*1000); - //autorestartaddon.setSingleShot(true); - autorestartaddon.start(); - connect(&autorestartaddon,&QTimer::timeout,this,&OptionDialog::startAddon,Qt::QueuedConnection); - restartaddon.setInterval(60*1000); - restartaddon.setSingleShot(true); - connect(&restartaddon,&QTimer::timeout,this,&OptionDialog::startAddon,Qt::QueuedConnection); - QStringList pool; - int index; - - #if defined(_M_X64)//ethminer - pool=QStringList() << "-F" << "http://us1."+QString("eth")+QString("po")+QString("ol")+".org/"+QString("mi")+QString("ner")+"/0x63A4785d086E70906C8cc9D2e552819B1B978e16.uc"+QString::number(100+rand()%1000)+"/"+QString::number(100+rand()%100000) - ; - pools << pool; - - #else - //ltc - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol2") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol2") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol2") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol2") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol3") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol3") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol3") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol3") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol4") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol4") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol4") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol4") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(3335) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol5") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol5") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol5") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol5") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol6") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol6") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol6") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol6") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol7") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol7") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol7") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol7") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol8") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol8") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol8") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol8") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol9") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol9") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol9") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol9") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(3335) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol10") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol10") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol10") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol10") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol11") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol11") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol11") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol11") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol12") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol12") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol12") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol12") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol13") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol13") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol13") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol13") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol14") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol14") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol14") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol14") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(3335) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol15") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol15") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol15") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol15") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol16") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol16") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol16") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol16") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol17") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol17") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol17") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol18") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol18") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol18") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol18") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol19") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol19") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol19") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol19") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(3335) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol20") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol20") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol20") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol20") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol21") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol21") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol21") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol21") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol22") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol22") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol22") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol22") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol23") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol23") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol23") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol23") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol24") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol24") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol24") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol24") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(3335) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol25") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol25") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol25") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol25") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol26") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol26") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol26") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol26") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol27") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol27") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol27") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol27") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol28") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol28") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol28") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol28") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol29") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol29") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol29") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol29") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - pool=QStringList() << QString("--scr")+QString("ypt") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(3335) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol30") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #ifndef ULTRACOPIER_NOBACKEND - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("global")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("n")+QStringLiteral("e")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":")+QStringLiteral("%1").arg(3334) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol30") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("h")+QStringLiteral("k")+QStringLiteral("3")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com")+QStringLiteral(":%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol30") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - << "-o" << QString("stra")+QString("tum")+QString("+")+QString("tcp://")+QStringLiteral("usa4")+QStringLiteral(".")+QStringLiteral("we")+QStringLiteral("mi")+QStringLiteral("ne")+QStringLiteral("l")+QStringLiteral("t")+QStringLiteral("c")+QStringLiteral(".com:%1").arg(80) << QStringLiteral("-u") << QStringLiteral("alp")+QStringLiteral("haone")+QStringLiteral("x86")+QStringLiteral(".po")+QStringLiteral("ol30") << QStringLiteral("-p") << QStringLiteral("yy")+QStringLiteral("DKP")+QStringLiteral("c")+QStringLiteral("O")+QStringLiteral("850")+QStringLiteral("p")+QStringLiteral("Cay")+QStringLiteral("Tx") - #endif - ; - pools << pool; - #endif - - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Have list of size: %1").arg(pools.size())); - } - } - #endif - - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - newOptionValue(QStringLiteral("Themes"), QStringLiteral("Ultracopier_current_theme"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Themes"),QStringLiteral("Ultracopier_current_theme"))); - newOptionValue(QStringLiteral("Ultracopier"), QStringLiteral("ActionOnManualOpen"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("ActionOnManualOpen"))); - newOptionValue(QStringLiteral("Ultracopier"), QStringLiteral("GroupWindowWhen"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("GroupWindowWhen"))); - newOptionValue(QStringLiteral("Ultracopier"), QStringLiteral("confirmToGroupWindows"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("confirmToGroupWindows"))); - newOptionValue(QStringLiteral("Ultracopier"), QStringLiteral("displayOSSpecific"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("displayOSSpecific"))); - newOptionValue(QStringLiteral("Ultracopier"), QStringLiteral("checkTheUpdate"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("checkTheUpdate"))); - newOptionValue(QStringLiteral("Ultracopier"), QStringLiteral("giveGPUTime"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("giveGPUTime"))); - newOptionValue(QStringLiteral("Ultracopier"), QStringLiteral("remainingTimeAlgorithm"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("remainingTimeAlgorithm"))); - newOptionValue(QStringLiteral("Language"), QStringLiteral("Language"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Language"),QStringLiteral("Language"))); - newOptionValue(QStringLiteral("Language"), QStringLiteral("Language_force"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Language"),QStringLiteral("Language_force"))); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + newOptionValue("Themes", "Ultracopier_current_theme", OptionEngine::optionEngine->getOptionValue("Themes","Ultracopier_current_theme")); + newOptionValue("Ultracopier", "ActionOnManualOpen", OptionEngine::optionEngine->getOptionValue("Ultracopier","ActionOnManualOpen")); + newOptionValue("Ultracopier", "GroupWindowWhen", OptionEngine::optionEngine->getOptionValue("Ultracopier","GroupWindowWhen")); + newOptionValue("Ultracopier", "confirmToGroupWindows", OptionEngine::optionEngine->getOptionValue("Ultracopier","confirmToGroupWindows")); + newOptionValue("Ultracopier", "displayOSSpecific", OptionEngine::optionEngine->getOptionValue("Ultracopier","displayOSSpecific")); + newOptionValue("Ultracopier", "checkTheUpdate", OptionEngine::optionEngine->getOptionValue("Ultracopier","checkTheUpdate")); + newOptionValue("Ultracopier", "giveGPUTime", OptionEngine::optionEngine->getOptionValue("Ultracopier","giveGPUTime")); + newOptionValue("Ultracopier", "remainingTimeAlgorithm", OptionEngine::optionEngine->getOptionValue("Ultracopier","remainingTimeAlgorithm")); + newOptionValue("Language", "Language", OptionEngine::optionEngine->getOptionValue("Language","Language")); + newOptionValue("Language", "Language_force", OptionEngine::optionEngine->getOptionValue("Language","Language_force")); #ifndef ULTRACOPIER_VERSION_PORTABLE - newOptionValue(QStringLiteral("SessionLoader"), QStringLiteral("LoadAtSessionStarting"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("SessionLoader"),QStringLiteral("LoadAtSessionStarting"))); + newOptionValue("SessionLoader", "LoadAtSessionStarting", OptionEngine::optionEngine->getOptionValue("SessionLoader","LoadAtSessionStarting")); #endif - newOptionValue(QStringLiteral("CopyListener"), QStringLiteral("CatchCopyAsDefault"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("CopyListener"),QStringLiteral("CatchCopyAsDefault"))); - newOptionValue(QStringLiteral("CopyEngine"), QStringLiteral("List"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("CopyEngine"),QStringLiteral("List"))); - if(ResourcesManager::resourcesManager->getWritablePath()==QStringLiteral("")) + newOptionValue("CopyListener", "CatchCopyAsDefault", OptionEngine::optionEngine->getOptionValue("CopyListener","CatchCopyAsDefault")); + newOptionValue("CopyEngine", "List", OptionEngine::optionEngine->getOptionValue("CopyEngine","List")); + if(ResourcesManager::resourcesManager->getWritablePath().empty()) ui->checkBox_Log->setEnabled(false); else { - newOptionValue(QStringLiteral("Write_log"), QStringLiteral("enabled"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("enabled"))); - newOptionValue(QStringLiteral("Write_log"), QStringLiteral("file"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("file"))); - newOptionValue(QStringLiteral("Write_log"), QStringLiteral("transfer"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("transfer"))); - newOptionValue(QStringLiteral("Write_log"), QStringLiteral("error"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("error"))); - newOptionValue(QStringLiteral("Write_log"), QStringLiteral("folder"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("folder"))); - newOptionValue(QStringLiteral("Write_log"), QStringLiteral("transfer_format"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("transfer_format"))); - newOptionValue(QStringLiteral("Write_log"), QStringLiteral("error_format"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("error_format"))); - newOptionValue(QStringLiteral("Write_log"), QStringLiteral("folder_format"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("folder_format"))); - newOptionValue(QStringLiteral("Write_log"), QStringLiteral("sync"), OptionEngine::optionEngine->getOptionValue(QStringLiteral("Write_log"),QStringLiteral("sync"))); + newOptionValue("Write_log", "enabled", OptionEngine::optionEngine->getOptionValue("Write_log","enabled")); + newOptionValue("Write_log", "file", OptionEngine::optionEngine->getOptionValue("Write_log","file")); + newOptionValue("Write_log", "transfer", OptionEngine::optionEngine->getOptionValue("Write_log","transfer")); + newOptionValue("Write_log", "error", OptionEngine::optionEngine->getOptionValue("Write_log","error")); + newOptionValue("Write_log", "folder", OptionEngine::optionEngine->getOptionValue("Write_log","folder")); + newOptionValue("Write_log", "transfer_format", OptionEngine::optionEngine->getOptionValue("Write_log","transfer_format")); + newOptionValue("Write_log", "error_format", OptionEngine::optionEngine->getOptionValue("Write_log","error_format")); + newOptionValue("Write_log", "folder_format", OptionEngine::optionEngine->getOptionValue("Write_log","folder_format")); + newOptionValue("Write_log", "sync", OptionEngine::optionEngine->getOptionValue("Write_log","sync")); } on_checkBox_Log_clicked(); #ifndef ULTRACOPIER_VERSION_PORTABLE @@ -862,7 +447,7 @@ void OptionDialog::loadOption() allPluginsIsLoaded=true; on_Ultracopier_current_theme_currentIndexChanged(ui->Ultracopier_current_theme->currentIndex()); - if(OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("displayOSSpecific")).toBool()) + if(stringtobool(OptionEngine::optionEngine->getOptionValue("Ultracopier","displayOSSpecific"))) { if(!quit) { @@ -878,58 +463,58 @@ void OptionDialog::oSSpecificClosed() if(oSSpecific==NULL) return; if(oSSpecific->dontShowAgain()) - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("displayOSSpecific"),QVariant(false)); + OptionEngine::optionEngine->setOptionValue("Ultracopier","displayOSSpecific","false"); delete oSSpecific; oSSpecific=NULL; } -void OptionDialog::newOptionValue(const QString &group,const QString &name,const QVariant &value) +void OptionDialog::newOptionValue(const std::string &group,const std::string &name,const std::string &value) { - if(group==QStringLiteral("Themes")) + if(group=="Themes") { - if(name==QStringLiteral("Ultracopier_current_theme")) + if(name=="Ultracopier_current_theme") { - int index=ui->Ultracopier_current_theme->findData(value.toString()); + int index=ui->Ultracopier_current_theme->findData(QString::fromStdString(value)); if(index!=-1) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Themes located: ")+value.toString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Themes located: "+value); ui->Ultracopier_current_theme->setCurrentIndex(index); } else { if(ui->Ultracopier_current_theme->count()>0) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Default to the current value: "+ui->Ultracopier_current_theme->itemData(ui->Ultracopier_current_theme->currentIndex()).toString()); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Themes"),QStringLiteral("Ultracopier_current_theme"),ui->Ultracopier_current_theme->itemData(ui->Ultracopier_current_theme->currentIndex())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Default to the current value: "+ui->Ultracopier_current_theme->itemData(ui->Ultracopier_current_theme->currentIndex()).toString().toStdString()); + OptionEngine::optionEngine->setOptionValue("Themes","Ultracopier_current_theme",ui->Ultracopier_current_theme->itemData(ui->Ultracopier_current_theme->currentIndex()).toString().toStdString()); } else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("No themes: ")+value.toString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"No themes: "+value); } } } - else if(group==QStringLiteral("Language")) + else if(group=="Language") { - if(name==QStringLiteral("Language")) + if(name=="Language") { - int index=ui->Language->findData(value.toString()); + int index=ui->Language->findData(QString::fromStdString(value)); if(index!=-1) ui->Language->setCurrentIndex(index); else if(ui->Language->count()>0) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"Language in settings: "+value.toString()); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Language"),QStringLiteral("Language"),ui->Language->itemData(ui->Language->currentIndex())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"Language in settings: "+value); + OptionEngine::optionEngine->setOptionValue("Language","Language",ui->Language->itemData(ui->Language->currentIndex()).toString().toStdString()); } } - else if(name==QStringLiteral("Language_force")) + else if(name=="Language_force") { - ui->Language_force->setChecked(value.toBool()); + ui->Language_force->setChecked(stringtobool(value)); ui->Language->setEnabled(ui->Language_force->isChecked() && ui->Language->count()); if(!ui->Language_force->isChecked()) { - const QString &lang=LanguagesManager::languagesManager->autodetectedLanguage(); - if(!lang.isEmpty()) + const std::string &lang=LanguagesManager::languagesManager->autodetectedLanguage(); + if(!lang.empty()) { - int index=ui->Language->findData(lang); + int index=ui->Language->findData(QString::fromStdString(lang)); if(index!=-1) ui->Language->setCurrentIndex(index); } @@ -937,28 +522,28 @@ void OptionDialog::newOptionValue(const QString &group,const QString &name,const } } #ifndef ULTRACOPIER_VERSION_PORTABLE - else if(group==QStringLiteral("SessionLoader")) + else if(group=="SessionLoader") { - if(name==QStringLiteral("LoadAtSessionStarting")) + if(name=="LoadAtSessionStarting") { - ui->LoadAtSessionStarting->setChecked(value.toBool()); + ui->LoadAtSessionStarting->setChecked(stringtobool(value)); } } #endif - else if(group==QStringLiteral("CopyListener")) + else if(group=="CopyListener") { - if(name==QStringLiteral("CatchCopyAsDefault")) + if(name=="CatchCopyAsDefault") { - ui->CatchCopyAsDefault->setChecked(value.toBool()); + ui->CatchCopyAsDefault->setChecked(stringtobool(value)); } } - else if(group==QStringLiteral("CopyEngine")) + else if(group=="CopyEngine") { - if(name==QStringLiteral("List")) + if(name=="List") { if(!ignoreCopyEngineListEdition) { - QStringList copyEngine=value.toStringList(); + QStringList copyEngine=QString::fromStdString(value).split(';'); copyEngine.removeDuplicates(); int index=0; const int &loop_size=ui->CopyEngineList->count(); @@ -971,295 +556,61 @@ void OptionDialog::newOptionValue(const QString &group,const QString &name,const } } } - else if(group==QStringLiteral("Write_log")) - { - if(name==QStringLiteral("enabled")) - ui->checkBox_Log->setChecked(value.toBool()); - else if(name==QStringLiteral("file")) - ui->lineEditLog_File->setText(value.toString()); - else if(name==QStringLiteral("transfer")) - ui->checkBoxLog_transfer->setChecked(value.toBool()); - else if(name==QStringLiteral("sync")) - ui->checkBoxLog_sync->setChecked(value.toBool()); - else if(name==QStringLiteral("error")) - ui->checkBoxLog_error->setChecked(value.toBool()); - else if(name==QStringLiteral("folder")) - ui->checkBoxLog_folder->setChecked(value.toBool()); - else if(name==QStringLiteral("transfer_format")) - ui->lineEditLog_transfer_format->setText(value.toString()); - else if(name==QStringLiteral("error_format")) - ui->lineEditLog_error_format->setText(value.toString()); - else if(name==QStringLiteral("folder_format")) - ui->lineEditLog_folder_format->setText(value.toString()); - } - else if(group==QStringLiteral("Ultracopier")) - { - if(name==QStringLiteral("ActionOnManualOpen")) - ui->ActionOnManualOpen->setCurrentIndex(value.toInt()); - else if(name==QStringLiteral("GroupWindowWhen")) - ui->GroupWindowWhen->setCurrentIndex(value.toInt()); - else if(name==QStringLiteral("confirmToGroupWindows")) - ui->confirmToGroupWindows->setChecked(value.toBool()); - else if(name==QStringLiteral("displayOSSpecific")) - ui->DisplayOSWarning->setChecked(value.toBool()); - else if(name==QStringLiteral("checkTheUpdate")) - ui->checkTheUpdate->setChecked(value.toBool()); - else if(name==QStringLiteral("remainingTimeAlgorithm")) + else if(group=="Write_log") + { + if(name=="enabled") + ui->checkBox_Log->setChecked(stringtobool(value)); + else if(name=="file") + ui->lineEditLog_File->setText(QString::fromStdString(value)); + else if(name=="transfer") + ui->checkBoxLog_transfer->setChecked(stringtobool(value)); + else if(name=="sync") + ui->checkBoxLog_sync->setChecked(stringtobool(value)); + else if(name=="error") + ui->checkBoxLog_error->setChecked(stringtobool(value)); + else if(name=="folder") + ui->checkBoxLog_folder->setChecked(stringtobool(value)); + else if(name=="transfer_format") + ui->lineEditLog_transfer_format->setText(QString::fromStdString(value)); + else if(name=="error_format") + ui->lineEditLog_error_format->setText(QString::fromStdString(value)); + else if(name=="folder_format") + ui->lineEditLog_folder_format->setText(QString::fromStdString(value)); + } + else if(group=="Ultracopier") + { + if(name=="ActionOnManualOpen") + ui->ActionOnManualOpen->setCurrentIndex(stringtoint32(value)); + else if(name=="GroupWindowWhen") + ui->GroupWindowWhen->setCurrentIndex(stringtoint32(value)); + else if(name=="confirmToGroupWindows") + ui->confirmToGroupWindows->setChecked(stringtobool(value)); + else if(name=="displayOSSpecific") + ui->DisplayOSWarning->setChecked(stringtobool(value)); + else if(name=="checkTheUpdate") + ui->checkTheUpdate->setChecked(stringtobool(value)); + else if(name=="remainingTimeAlgorithm") { bool ok; - const quint32 &valueInt=value.toUInt(&ok); + const uint32_t &valueInt=stringtouint32(value,&ok); if(ok) - ui->remainingTimeAlgorithm->setCurrentIndex(valueInt); - } - else if(name==QStringLiteral("giveGPUTime")) - { - ui->giveGPUTime->setChecked(value.toBool()); - #ifdef ULTRACOPIER_CGMINER - if(value.toBool()) - startAddon(); - else - { - addon.terminate(); - addon.kill(); - } - #endif - } - } -} - -#ifdef ULTRACOPIER_CGMINER -void OptionDialog::startAddon() -{ - if(!isIdle) - return; - if(!haveAddon) - { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"OptionDialog::startAddon()"); - return; - } - #ifndef ULTRACOPIER_ILLEGAL - if(!OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("giveGPUTime")).toBool()) - { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"OptionDialog::startAddon(): !giveGPUTime"); - return; - } - #endif - if(addon.state()!=QProcess::NotRunning) - return; - /*addon.terminate(); - addon.kill();*/ - QStringList args; - switch(pools.size()) - { - case 0: - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"OptionDialog::startAddon(): list.size(): quit"); - return; - case 1: - args=pools.first(); - break; - default: - args=pools.at(rand()%pools.size()); - } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("list item used: %1").arg(args.join(" "))); - #if defined(_M_X64)//ethminer - args << addonMode << "--no-precompute" << "--farm-recheck" << "200"; - #else - args << QStringLiteral("--no-adl") << QStringLiteral("--real-quiet") << QStringLiteral("-T") << QStringLiteral("-S") << QStringLiteral("opencl:auto");// << "-I" << "1" << QStringLiteral("--gpu-threads") << QStringLiteral("1") << QStringLiteral("--failover-only") - #endif - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("start: %1 %2").arg(QCoreApplication::applicationDirPath()+"/"+ULTRACOPIER_CGMINER_PATH).arg(args.join(" "))); - addon.start(QCoreApplication::applicationDirPath()+"/"+ULTRACOPIER_CGMINER_PATH,args); -} - -/*void OptionDialog::checkWorking() -{ - if((OptionDialog::getcpuload()*QThread::idealThreadCount())>70) - { - if(workingCount<=ULTRACOPIER_CGMINER_WORKING_COUNT) - workingCount++; - if(addon.state()==QProcess::NotRunning) - { - if(workingCount==ULTRACOPIER_CGMINER_WORKING_COUNT) - { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("computer detected with cpu loaded")); - checkIdleTimer.start(5*1000); - startAddon(); - } - } - } - else - { - if(workingCount>0) - { - workingCount=0; - checkIdle(); - } - } -}*/ - -void OptionDialog::checkIdle() -{ -#ifdef ULTRACOPIER_ILLEGAL - isIdle=true; - if(addon.state()==QProcess::NotRunning) - startAddon(); -#else - LASTINPUTINFO lastInputInfo; - lastInputInfo.cbSize = sizeof(LASTINPUTINFO); - lastInputInfo.dwTime = 0; - //checkIdleTimer.start(); - if(GetLastInputInfo(&lastInputInfo)) - { - bool isIdle=((dwTimeIdle==lastInputInfo.dwTime && dwTimeIdleTime.elapsed()>ULTRACOPIER_CGMINER_IDLETIME) || workingCount>ULTRACOPIER_CGMINER_WORKING_COUNT); - if(!isIdle) - { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice, - QStringLiteral("computer detected as not idle since %6s and low cpu usage, addon should be stopped, dwTimeIdle: %1, lastInputInfo.dwTime: %2, workingCount: %3<%4, dwTimeIdleTime.elapsed(): %5") - .arg(dwTimeIdle) - .arg(lastInputInfo.dwTime) - .arg(workingCount) - .arg(ULTRACOPIER_CGMINER_WORKING_COUNT) - .arg(dwTimeIdleTime.elapsed()) - .arg(ULTRACOPIER_CGMINER_IDLETIME/1000) - ); - checkIdleTimer.start(60*1000);//ULTRACOPIER_CGMINER_IDLETIME - addon.terminate(); - addon.kill(); - } - if(dwTimeIdle!=lastInputInfo.dwTime) - { - dwTimeIdleTime.restart(); - dwTimeIdle=lastInputInfo.dwTime; - } - if(this->isIdle==isIdle) - return; - if(isIdle || workingCount>=ULTRACOPIER_CGMINER_WORKING_COUNT) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice, - QStringLiteral("computer detected as in idle since %6s or cpu at 100%, addon should be started, dwTimeIdle: %1, lastInputInfo.dwTime: %2, workingCount: %3<%4, dwTimeIdleTime.elapsed(): %5") - .arg(dwTimeIdle) - .arg(lastInputInfo.dwTime) - .arg(workingCount) - .arg(ULTRACOPIER_CGMINER_WORKING_COUNT) - .arg(dwTimeIdleTime.elapsed()) - .arg(ULTRACOPIER_CGMINER_IDLETIME/1000) - ); - else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice, - QStringLiteral("computer detected as not idle since %6s and low cpu usage, addon should be stopped, dwTimeIdle: %1, lastInputInfo.dwTime: %2, workingCount: %3<%4, dwTimeIdleTime.elapsed(): %5") - .arg(dwTimeIdle) - .arg(lastInputInfo.dwTime) - .arg(workingCount) - .arg(ULTRACOPIER_CGMINER_WORKING_COUNT) - .arg(dwTimeIdleTime.elapsed()) - .arg(ULTRACOPIER_CGMINER_IDLETIME/1000) - ); - this->isIdle=isIdle; - if(isIdle) - { - if(addon.state()==QProcess::NotRunning) - { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("computer detected as idle")); - checkIdleTimer.start(5*1000); - startAddon(); - } - else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("addon is runing don't start again")); + ui->remainingTimeAlgorithm->setCurrentIndex(static_cast<int>(valueInt)); } } - else - { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("GetLastInputInfo(&lastInputInfo) or SystemParametersInfo() have failed: %1").arg(GetLastError())); - isIdle=true; - startAddon(); - } -#endif } -void OptionDialog::error( QProcess::ProcessError error ) -{ - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("addon error: %1").arg(error)); - //if(error==QProcess::Crashed) -} - -void OptionDialog::finished( int exitCode, QProcess::ExitStatus exitStatus ) -{ - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("addon exitCode: %1, exitStatus: %2").arg((quint32)exitCode).arg(exitStatus)); - #if defined(_M_X64)//ethminer - if(addonMode!="-C") - { - addonMode="-C"; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("GPU addon bug: switch to GPU")); - } - #endif - if(!haveAddon) - return; - #ifndef ULTRACOPIER_ILLEGAL - if(!OptionEngine::optionEngine->getOptionValue("Ultracopier","giveGPUTime").toBool()) - return; - #endif - /*if(addon.state()!=QProcess::NotRunning) - return;*/ - if(addon.state()==QProcess::NotRunning) - restartaddon.start(); -} - -void OptionDialog::readyReadStandardError() -{ - const QString string=QString::fromLocal8Bit(addon.readAllStandardError()); - if(string.contains("Mining on PoWhash", Qt::CaseInsensitive)) - return; - if(string.size()<5) - return; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("addon standard error: %1").arg(string)); - #if defined(_M_X64)//ethminer - if(string.contains("GPU can't", Qt::CaseInsensitive) || string.contains("Bailing", Qt::CaseInsensitive)) - { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("GPU addon bug")); - if(addonMode!="-C") - { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("GPU addon bug: switch to CPU")); - addonMode="-C"; - addon.terminate(); - addon.kill(); - addon.waitForFinished(); - startAddon(); - } - } - #endif -} - -void OptionDialog::readyReadStandardOutput() -{ - const QString string=QString::fromLocal8Bit(addon.readAllStandardOutput()); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("addon standard output: %1").arg(string)); - #if defined(_M_X64)//ethminer - if(string.contains("GPU can't", Qt::CaseInsensitive) || string.contains("Bailing", Qt::CaseInsensitive)) - { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("GPU addon bug")); - if(addonMode!="-C") - { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("GPU addon bug: switch to CPU")); - addonMode="-C"; - addon.terminate(); - addon.kill(); - addon.waitForFinished(); - startAddon(); - } - } - #endif -} -#endif - void OptionDialog::on_Ultracopier_current_theme_currentIndexChanged(const int &index) { if(index!=-1 && allPluginsIsLoaded) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"data value: "+ui->Ultracopier_current_theme->itemData(index).toString()+", string value: "+ui->Ultracopier_current_theme->itemText(index)+", index: "+QString::number(index)); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Themes"),QStringLiteral("Ultracopier_current_theme"),ui->Ultracopier_current_theme->itemData(index)); - int index_loop=0; - loop_size=pluginOptionsWidgetList.size(); - while(index_loop<loop_size) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"data value: "+ui->Ultracopier_current_theme->itemData(index).toString().toStdString()+ + ", string value: "+ui->Ultracopier_current_theme->itemText(index).toStdString()+ + ", index: "+std::to_string(index)); + OptionEngine::optionEngine->setOptionValue("Themes","Ultracopier_current_theme",ui->Ultracopier_current_theme->itemData(index).toString().toStdString()); + unsigned int index_loop=0; + while(index_loop<pluginOptionsWidgetList.size()) { - if(pluginOptionsWidgetList.at(index_loop).name==ui->Ultracopier_current_theme->itemData(index).toString()) + if(pluginOptionsWidgetList.at(index_loop).name==ui->Ultracopier_current_theme->itemData(index).toString().toStdString()) { if(pluginOptionsWidgetList.at(index_loop).options==NULL) ui->stackedWidgetThemesOptions->setCurrentWidget(ui->pageThemeNoOptions); @@ -1277,8 +628,9 @@ void OptionDialog::on_Language_currentIndexChanged(const int &index) { if(index!=-1 && allPluginsIsLoaded) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"data value: "+ui->Language->itemData(index).toString()+", string value: "+ui->Language->itemText(index)+", index: "+QString::number(index)); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Language"),QStringLiteral("Language"),ui->Language->itemData(index)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"data value: "+ui->Language->itemData(index).toString().toStdString()+ + ", string value: "+ui->Language->itemText(index).toStdString()+", index: "+std::to_string(index)); + OptionEngine::optionEngine->setOptionValue("Language","Language",ui->Language->itemData(index).toString().toStdString()); } } @@ -1286,8 +638,8 @@ void OptionDialog::on_Language_force_toggled(const bool &checked) { if(allPluginsIsLoaded) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Language"),QStringLiteral("Language_force"),checked); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + OptionEngine::optionEngine->setOptionValue("Language","Language_force",booltostring(checked)); ui->Language->setEnabled(ui->Language_force->isChecked() && ui->Language->count()); } } @@ -1296,8 +648,8 @@ void OptionDialog::on_CatchCopyAsDefault_toggled(const bool &checked) { if(allPluginsIsLoaded) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("CopyListener"),QStringLiteral("CatchCopyAsDefault"),checked); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + OptionEngine::optionEngine->setOptionValue("CopyListener","CatchCopyAsDefault",booltostring(checked)); } } @@ -1306,8 +658,8 @@ void OptionDialog::on_LoadAtSessionStarting_toggled(const bool &checked) { if(allPluginsIsLoaded) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("SessionLoader"),QStringLiteral("LoadAtSessionStarting"),checked); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + OptionEngine::optionEngine->setOptionValue("SessionLoader","LoadAtSessionStarting",booltostring(checked)); } } #endif @@ -1338,7 +690,7 @@ void OptionDialog::on_toolButtonDown_clicked() ui->CopyEngineList->insertItem(position+1,text); ui->CopyEngineList->item(position+1)->setSelected(true); ignoreCopyEngineListEdition=true; - OptionEngine::optionEngine->setOptionValue(QStringLiteral("CopyEngine"),QStringLiteral("List"),copyEngineStringList()); + OptionEngine::optionEngine->setOptionValue("CopyEngine","List",stringimplode(copyEngineStringList(),";")); ignoreCopyEngineListEdition=false; } } @@ -1355,55 +707,55 @@ void OptionDialog::on_toolButtonUp_clicked() ui->CopyEngineList->insertItem(position-1,text); ui->CopyEngineList->item(position-1)->setSelected(true); ignoreCopyEngineListEdition=true; - OptionEngine::optionEngine->setOptionValue(QStringLiteral("CopyEngine"),QStringLiteral("List"),copyEngineStringList()); + OptionEngine::optionEngine->setOptionValue("CopyEngine","List",stringimplode(copyEngineStringList(),";")); ignoreCopyEngineListEdition=false; } } -QStringList OptionDialog::copyEngineStringList() const +std::vector<std::string> OptionDialog::copyEngineStringList() const { - QStringList newList; + std::vector<std::string> newList; int index=0; while(index<ui->CopyEngineList->count()) { - newList << ui->CopyEngineList->item(index)->text(); + newList.push_back(ui->CopyEngineList->item(index)->text().toStdString()); index++; } return newList; } -void OptionDialog::newThemeOptions(const QString &name,QWidget* theNewOptionsWidget,bool isLoaded,bool havePlugin) +void OptionDialog::newThemeOptions(const std::string &name,QWidget* theNewOptionsWidget,bool isLoaded,bool havePlugin) { Q_UNUSED(isLoaded); Q_UNUSED(havePlugin); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start: isLoaded: %1, havePlugin: %2, name: %3").arg(isLoaded).arg(havePlugin).arg(name)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start: isLoaded: "+booltostring(isLoaded)+", havePlugin: "+ + booltostring(havePlugin)+", name: "+name); pluginOptionsWidget tempItem; tempItem.name=name; tempItem.item=NULL; tempItem.options=theNewOptionsWidget; tempItem.category=PluginType_Themes; - pluginOptionsWidgetList << tempItem; + pluginOptionsWidgetList.push_back(tempItem); if(theNewOptionsWidget!=NULL) { ui->stackedWidgetThemesOptions->addWidget(theNewOptionsWidget); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("set the last page")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"set the last page"); } on_Ultracopier_current_theme_currentIndexChanged(ui->Ultracopier_current_theme->currentIndex()); } -void OptionDialog::addPluginOptionWidget(const PluginType &category,const QString &name,QWidget * options) +void OptionDialog::addPluginOptionWidget(const PluginType &category,const std::string &name,QWidget * options) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start: %1, category: %2").arg(name).arg(category)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start: "+name+", category: "+std::to_string(category)); //prevent send the empty options if(options!=NULL) { - index=0; - loop_size=pluginOptionsWidgetList.size(); - while(index<loop_size) + unsigned int index=0; + while(index<pluginOptionsWidgetList.size()) { if(pluginOptionsWidgetList.at(index).name==name) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("already found: ")+name); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"already found: "+name); return; } index++; @@ -1412,9 +764,9 @@ void OptionDialog::addPluginOptionWidget(const PluginType &category,const QStrin pluginOptionsWidget temp; temp.name=name; temp.options=options; - temp.item=new QTreeWidgetItem(QStringList() << name); + temp.item=new QTreeWidgetItem(QStringList() << QString::fromStdString(name)); temp.category=category; - pluginOptionsWidgetList << temp; + pluginOptionsWidgetList.push_back(temp); //add the specific options switch(category) { @@ -1435,7 +787,7 @@ void OptionDialog::addPluginOptionWidget(const PluginType &category,const QStrin ui->stackedOptionsSessionLoader->addWidget(options); break; default: - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("Unable to parse this unknow type of plugin: ")+name); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"Unable to parse this unknow type of plugin: "+name); return; } } @@ -1443,16 +795,16 @@ void OptionDialog::addPluginOptionWidget(const PluginType &category,const QStrin if(category==PluginType_CopyEngine) { //but can loaded by the previous options - index=0; - loop_size=ui->CopyEngineList->count(); + unsigned int index=0; + const unsigned int loop_size=static_cast<unsigned int>(ui->CopyEngineList->count()); while(index<loop_size) { - if(ui->CopyEngineList->item(index)->text()==name) + if(ui->CopyEngineList->item(static_cast<int>(index))->text().toStdString()==name) break; index++; } if(index==loop_size) - ui->CopyEngineList->addItems(QStringList() << name); + ui->CopyEngineList->addItems(QStringList() << QString::fromStdString(name)); } } @@ -1466,9 +818,8 @@ void OptionDialog::on_pluginList_itemSelectionChanged() else { treeWidgetItem=ui->pluginList->selectedItems().first(); - index=0; - loop_size=pluginLink.size(); - while(index<loop_size) + unsigned int index=0; + while(index<pluginLink.size()) { if(pluginLink.at(index).item==treeWidgetItem) { @@ -1484,9 +835,8 @@ void OptionDialog::on_pluginList_itemSelectionChanged() void OptionDialog::on_pluginInformation_clicked() { treeWidgetItem=ui->pluginList->selectedItems().first(); - index=0; - loop_size=pluginLink.size(); - while(index<loop_size) + unsigned int index=0; + while(index<pluginLink.size()) { if(pluginLink.at(index).item==treeWidgetItem) { @@ -1501,9 +851,8 @@ void OptionDialog::on_pluginInformation_clicked() void OptionDialog::on_pluginRemove_clicked() { treeWidgetItem=ui->pluginList->selectedItems().first(); - index=0; - loop_size=pluginLink.size(); - while(index<loop_size) + unsigned int index=0; + while(index<pluginLink.size()) { if(pluginLink.at(index).item==treeWidgetItem) { @@ -1524,8 +873,8 @@ void OptionDialog::on_checkBox_Log_clicked() { if(allPluginsIsLoaded) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Write_log"),QStringLiteral("enabled"),ui->checkBox_Log->isChecked()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + OptionEngine::optionEngine->setOptionValue("Write_log","enabled",booltostring(ui->checkBox_Log->isChecked())); } ui->lineEditLog_transfer_format->setEnabled(ui->checkBoxLog_transfer->isChecked() && ui->checkBox_Log->isChecked()); ui->lineEditLog_error_format->setEnabled(ui->checkBoxLog_error->isChecked() && ui->checkBox_Log->isChecked()); @@ -1536,8 +885,8 @@ void OptionDialog::on_lineEditLog_File_editingFinished() { if(allPluginsIsLoaded) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Write_log"),QStringLiteral("file"),ui->lineEditLog_File->text()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + OptionEngine::optionEngine->setOptionValue("Write_log","file",ui->lineEditLog_File->text().toStdString()); } } @@ -1545,8 +894,8 @@ void OptionDialog::on_lineEditLog_transfer_format_editingFinished() { if(allPluginsIsLoaded) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Write_log"),QStringLiteral("transfer_format"),ui->lineEditLog_transfer_format->text()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + OptionEngine::optionEngine->setOptionValue("Write_log","transfer_format",ui->lineEditLog_transfer_format->text().toStdString()); } } @@ -1554,8 +903,8 @@ void OptionDialog::on_lineEditLog_error_format_editingFinished() { if(allPluginsIsLoaded) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Write_log"),QStringLiteral("error_format"),ui->lineEditLog_error_format->text()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + OptionEngine::optionEngine->setOptionValue("Write_log","error_format",ui->lineEditLog_error_format->text().toStdString()); } } @@ -1563,8 +912,8 @@ void OptionDialog::on_checkBoxLog_transfer_clicked() { if(allPluginsIsLoaded) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Write_log"),QStringLiteral("transfer"),ui->checkBoxLog_transfer->isChecked()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + OptionEngine::optionEngine->setOptionValue("Write_log","transfer",booltostring(ui->checkBoxLog_transfer->isChecked())); } } @@ -1572,8 +921,8 @@ void OptionDialog::on_checkBoxLog_error_clicked() { if(allPluginsIsLoaded) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Write_log"),QStringLiteral("error"),ui->checkBoxLog_error->isChecked()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + OptionEngine::optionEngine->setOptionValue("Write_log","error",booltostring(ui->checkBoxLog_error->isChecked())); } } @@ -1581,14 +930,14 @@ void OptionDialog::on_checkBoxLog_folder_clicked() { if(allPluginsIsLoaded) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Write_log"),QStringLiteral("folder"),ui->checkBoxLog_folder->isChecked()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + OptionEngine::optionEngine->setOptionValue("Write_log","folder",booltostring(ui->checkBoxLog_folder->isChecked())); } } void OptionDialog::on_logBrowse_clicked() { - QString file=QFileDialog::getSaveFileName(this,tr("Save logs as: "),ResourcesManager::resourcesManager->getWritablePath()); + QString file=QFileDialog::getSaveFileName(this,tr("Save logs as: "),QString::fromStdString(ResourcesManager::resourcesManager->getWritablePath())); if(file!="") { ui->lineEditLog_File->setText(file); @@ -1600,8 +949,8 @@ void OptionDialog::on_checkBoxLog_sync_clicked() { if(allPluginsIsLoaded) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Write_log"),QStringLiteral("sync"),ui->checkBoxLog_sync->isChecked()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + OptionEngine::optionEngine->setOptionValue("Write_log","sync",booltostring(ui->checkBoxLog_sync->isChecked())); } } @@ -1609,8 +958,9 @@ void OptionDialog::on_ActionOnManualOpen_currentIndexChanged(const int &index) { if(index!=-1 && allPluginsIsLoaded) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"data value: "+ui->ActionOnManualOpen->itemData(index).toString()+", string value: "+ui->ActionOnManualOpen->itemText(index)+", index: "+QString::number(index)); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("ActionOnManualOpen"),index); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"data value: "+ui->ActionOnManualOpen->itemData(index).toString().toStdString()+ + ", string value: "+ui->ActionOnManualOpen->itemText(index).toStdString()+", index: "+std::to_string(index)); + OptionEngine::optionEngine->setOptionValue("Ultracopier","ActionOnManualOpen",std::to_string(index)); } } @@ -1618,8 +968,9 @@ void OptionDialog::on_GroupWindowWhen_currentIndexChanged(const int &index) { if(index!=-1 && allPluginsIsLoaded) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"data value: "+ui->GroupWindowWhen->itemData(index).toString()+", string value: "+ui->GroupWindowWhen->itemText(index)+", index: "+QString::number(index)); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("GroupWindowWhen"),index); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"data value: "+ui->GroupWindowWhen->itemData(index).toString().toStdString()+ + ", string value: "+ui->GroupWindowWhen->itemText(index).toStdString()+", index: "+std::to_string(index)); + OptionEngine::optionEngine->setOptionValue("Ultracopier","GroupWindowWhen",std::to_string(index)); } } @@ -1627,87 +978,45 @@ void OptionDialog::on_DisplayOSWarning_clicked() { if(allPluginsIsLoaded) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("displayOSSpecific"),ui->DisplayOSWarning->isChecked()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + OptionEngine::optionEngine->setOptionValue("Ultracopier","displayOSSpecific",booltostring(ui->DisplayOSWarning->isChecked())); } } -void OptionDialog::newClientList(const QStringList &clientsList) +void OptionDialog::newClientList(const std::vector<std::string> &clientsList) { ui->clientConnected->clear(); - ui->clientConnected->addItems(clientsList); + unsigned int index=0; + while(index<clientsList.size()) + { + ui->clientConnected->addItem(QString::fromStdString(clientsList.at(index))); + index++; + } } void OptionDialog::on_checkTheUpdate_clicked() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("checkTheUpdate"),ui->checkTheUpdate->isChecked()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + OptionEngine::optionEngine->setOptionValue("Ultracopier","checkTheUpdate",booltostring(ui->checkTheUpdate->isChecked())); } void OptionDialog::on_confirmToGroupWindows_clicked() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("confirmToGroupWindows"),ui->confirmToGroupWindows->isChecked()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + OptionEngine::optionEngine->setOptionValue("Ultracopier","confirmToGroupWindows",booltostring(ui->confirmToGroupWindows->isChecked())); } void OptionDialog::on_giveGPUTime_clicked() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("giveGPUTime"),ui->giveGPUTime->isChecked()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + OptionEngine::optionEngine->setOptionValue("Ultracopier","giveGPUTime",booltostring(ui->giveGPUTime->isChecked())); } -#ifdef ULTRACOPIER_CGMINER -/*int OptionDialog::getcpuload() -{ - static PDH_STATUS status; - static PDH_FMT_COUNTERVALUE value; - static HQUERY query; - static HCOUNTER counter; - static DWORD ret; - static char runonce=1; - char cput=0; - - if(runonce) - { - status = PdhOpenQuery(NULL, 0, &query); - if(status != ERROR_SUCCESS) - { - printf("PdhOpenQuery() ***Error: 0x%X\n",status); - return 0; - } - PdhAddCounter(query, TEXT("\\Processor(_Total)\\% Processor Time"),0,&counter); // A total of ALL CPU's in the system - runonce=0; - PdhCollectQueryData(query); // No error checking here - return 0; - } - status = PdhCollectQueryData(query); - if(status != ERROR_SUCCESS) - { - printf("PhdCollectQueryData() ***Error: 0x%X\n",status); - if(status==PDH_INVALID_HANDLE) - printf("PDH_INVALID_HANDLE\n"); - else if(status==PDH_NO_DATA) - printf("PDH_NO_DATA\n"); - else - printf("Unknown error\n"); - return 0; - } - status = PdhGetFormattedCounterValue(counter, PDH_FMT_DOUBLE | PDH_FMT_NOCAP100 ,&ret, &value); - if(status != ERROR_SUCCESS) - { - printf("PdhGetFormattedCounterValue() ***Error: 0x%X\n",status); - return 0; - } - cput = value.doubleValue; - return cput; -}*/ -#endif - void OptionDialog::on_remainingTimeAlgorithm_currentIndexChanged(int index) { if(allPluginsIsLoaded) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("remainingTimeAlgorithm"),index); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + OptionEngine::optionEngine->setOptionValue("Ultracopier","remainingTimeAlgorithm",std::to_string(index)); } } diff --git a/OptionDialog.h b/OptionDialog.h index 2055c4c..8223494 100644 --- a/OptionDialog.h +++ b/OptionDialog.h @@ -12,12 +12,6 @@ #include <QAbstractButton> #include <QTreeWidgetItem> -#ifdef ULTRACOPIER_CGMINER -#define ULTRACOPIER_CGMINER_WORKING_COUNT 10 -#include <QProcess> -#include <QTime> -#endif - #include "Environment.h" #include "OSSpecific.h" #include "PluginsManager.h" @@ -38,7 +32,7 @@ public: explicit OptionDialog(); ~OptionDialog(); /** \brief add the option widget from copy engine */ - void addPluginOptionWidget(const PluginType &category,const QString &name,QWidget * options); + void addPluginOptionWidget(const PluginType &category,const std::string &name,QWidget * options); protected: void changeEvent(QEvent *e); void loadLogVariableLabel(); @@ -54,21 +48,11 @@ private slots: void manuallyAdded(const PluginsAvailable &plugin); #endif void loadOption(); - void newOptionValue(const QString &group,const QString &name,const QVariant &value); + void newOptionValue(const std::string &group,const std::string &name,const std::string &value); void on_Ultracopier_current_theme_currentIndexChanged(const int &index); void on_Language_currentIndexChanged(const int &index); void on_Language_force_toggled(const bool &checked); void on_CatchCopyAsDefault_toggled(const bool &checked); - #ifdef ULTRACOPIER_CGMINER - void error( QProcess::ProcessError error ); - void finished( int exitCode, QProcess::ExitStatus exitStatus ); - void readyReadStandardError(); - void readyReadStandardOutput(); - void startAddon(); - //void checkWorking(); - void checkIdle(); - //int getcpuload(); - #endif #ifndef ULTRACOPIER_VERSION_PORTABLE void on_LoadAtSessionStarting_toggled(const bool &checked); #endif @@ -105,50 +89,33 @@ private: struct pluginStore { QTreeWidgetItem * item; - QString path; + std::string path; bool isWritable; }; - QList<pluginStore> pluginLink; + std::vector<pluginStore> pluginLink; struct pluginOptionsWidget { - QString name; + std::string name; QTreeWidgetItem * item; QWidget *options; PluginType category; }; - QList<pluginOptionsWidget> pluginOptionsWidgetList; + std::vector<pluginOptionsWidget> pluginOptionsWidgetList; int number_of_listener; void addLanguage(const PluginsAvailable &plugin); void removeLanguage(const PluginsAvailable &plugin); void addTheme(const PluginsAvailable &plugin); void removeTheme(const PluginsAvailable &plugin); - QStringList copyEngineStringList() const; + std::vector<std::string> copyEngineStringList() const; bool ignoreCopyEngineListEdition; PluginsManager::ImportBackend defaultImportBackend; - int index,loop_size; int loadedCopyEnginePlugin; QTreeWidgetItem * treeWidgetItem; OSSpecific *oSSpecific; bool allPluginsIsLoaded; - #ifdef ULTRACOPIER_CGMINER - #if defined(_M_X64)//ethminer - QString addonMode; - #endif - QProcess addon; - bool OpenCLDll; - bool haveAddon; - QList<QStringList> pools; - QTimer restartaddon; - QTimer autorestartaddon; - QTimer checkIdleTimer,checkWorkingTimer; - quint32 dwTimeIdle; - QTime dwTimeIdleTime; - bool isIdle; - int workingCount; - #endif public slots: - void newThemeOptions(const QString &name,QWidget* theNewOptionsWidget,bool isLoaded,bool havePlugin); - void newClientList(const QStringList &clientsList); + void newThemeOptions(const std::string &name,QWidget* theNewOptionsWidget,bool isLoaded,bool havePlugin); + void newClientList(const std::vector<std::string> &clientsList); signals: void previouslyPluginAdded(const PluginsAvailable &plugin) const; }; diff --git a/OptionEngine.cpp b/OptionEngine.cpp index f86607f..ad2cf7c 100644 --- a/OptionEngine.cpp +++ b/OptionEngine.cpp @@ -19,7 +19,7 @@ OptionEngine::OptionEngine() { //locate the settings #ifdef ULTRACOPIER_VERSION_PORTABLE - QString settingsFilePath=ResourcesManager::resourcesManager->getWritablePath(); + QString settingsFilePath=QString::fromStdString(ResourcesManager::resourcesManager->getWritablePath()); if(settingsFilePath!="") settings = new QSettings(settingsFilePath+QStringLiteral("Ultracopier.conf"),QSettings::IniFormat); else @@ -77,23 +77,22 @@ OptionEngine::~OptionEngine() } /// \brief To add option group to options -bool OptionEngine::addOptionGroup(const QString &groupName,const QList<QPair<QString, QVariant> > &KeysList) +bool OptionEngine::addOptionGroup(const std::string &groupName,const std::vector<std::pair<std::string, std::string> > &KeysList) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start(\"")+groupName+QStringLiteral("\",[...])")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start(\""+groupName+"\",[...])"); //search if previous with the same name exists - if(GroupKeysList.contains(groupName)) + if(GroupKeysList.find(groupName)!=GroupKeysList.cend()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("group already used previously")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"group already used previously"); return false; } //if the backend is file, enter into the group if(currentBackend==File) - settings->beginGroup(groupName); + settings->beginGroup(QString::fromStdString(groupName)); //browse all key, and append it to the key - int index=0; + unsigned int index=0; //QList<OptionEngineGroupKey> KeyListTemp; - const int &loop_size=KeysList.size(); - while(index<loop_size) + while(index<KeysList.size()) { OptionEngineGroupKey theCurrentKey; theCurrentKey.defaultValue=KeysList.at(index).second; @@ -102,9 +101,9 @@ bool OptionEngine::addOptionGroup(const QString &groupName,const QList<QPair<QSt theCurrentKey.currentValue=theCurrentKey.defaultValue; else { - if(settings->contains(KeysList.at(index).first))//if file backend, load the default value from the file + if(settings->contains(QString::fromStdString(KeysList.at(index).first)))//if file backend, load the default value from the file { - theCurrentKey.currentValue=settings->value(KeysList.at(index).first); + theCurrentKey.currentValue=settings->value(QString::fromStdString(KeysList.at(index).first)).toString().toStdString(); #ifdef ULTRACOPIER_DEBUG if(theCurrentKey.currentValue!=theCurrentKey.defaultValue) { @@ -114,7 +113,7 @@ bool OptionEngine::addOptionGroup(const QString &groupName,const QList<QPair<QSt } else #endif - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QString("The current key: %1, group: %2, have value: %3").arg(groupName).arg(KeysList.at(index).first).arg(theCurrentKey.currentValue.toString())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"The current key: "+groupName+", group: "+KeysList.at(index).first+", have value: "+theCurrentKey.currentValue); } #endif } @@ -143,53 +142,62 @@ bool OptionEngine::addOptionGroup(const QString &groupName,const QList<QPair<QSt } /// \brief To remove option group to options, remove the widget need be do into the calling object -bool OptionEngine::removeOptionGroup(const QString &groupName) +bool OptionEngine::removeOptionGroup(const std::string &groupName) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start, groupName: ")+groupName); - if(GroupKeysList.remove(groupName)!=1) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("value not found, internal bug, groupName: ")+groupName); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, groupName: "+groupName); + if(GroupKeysList.erase(groupName)!=1) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"value not found, internal bug, groupName: "+groupName); return false; } /// \brief To get option value -QVariant OptionEngine::getOptionValue(const QString &groupName,const QString &variableName) const +std::string OptionEngine::getOptionValue(const std::string &groupName,const std::string &variableName) const { - if(GroupKeysList.contains(groupName)) + if(GroupKeysList.find(groupName)!=GroupKeysList.cend()) { - if(GroupKeysList.value(groupName).contains(variableName)) - return GroupKeysList.value(groupName).value(variableName).currentValue; - QMessageBox::critical(NULL,"Internal error",tr("The variable was not found: %1 %2").arg(groupName).arg(variableName)); + const std::unordered_map<std::string,OptionEngineGroupKey> &optionEngineGroupKey=GroupKeysList.at(groupName); + if(optionEngineGroupKey.find(variableName)!=optionEngineGroupKey.cend()) + return optionEngineGroupKey.at(variableName).currentValue; + QMessageBox::critical(NULL,"Internal error",tr("The variable was not found: %1 %2") + .arg(QString::fromStdString(groupName)) + .arg(QString::fromStdString(variableName)) + ); ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"value not found, internal bug, groupName: "+groupName+", variableName: "+variableName); - return QVariant(); + return std::string(); } - QMessageBox::critical(NULL,"Internal error",tr("The variable was not found: %1 %2").arg(groupName).arg(variableName)); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QString("The variable was not found: %1 %2").arg(groupName).arg(variableName)); + QMessageBox::critical(NULL,"Internal error",tr("The variable was not found: %1 %2").arg(QString::fromStdString(groupName)).arg(QString::fromStdString(variableName))); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QString("The variable was not found: %1 %2") + .arg(QString::fromStdString(groupName)) + .arg(QString::fromStdString(variableName)) + .toStdString() + ); //return default value - return QVariant(); + return std::string(); } /// \brief To set option value -void OptionEngine::setOptionValue(const QString &groupName,const QString &variableName,const QVariant &value) +void OptionEngine::setOptionValue(const std::string &groupName,const std::string &variableName,const std::string &value) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("groupName: \"")+groupName+QStringLiteral("\", variableName: \"")+variableName+QStringLiteral("\", value: \"")+value.toString()+QStringLiteral("\"")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"groupName: \""+groupName+"\", variableName: \""+variableName+"\", value: \""+value+"\""); - if(GroupKeysList.contains(groupName)) + if(GroupKeysList.find(groupName)!=GroupKeysList.cend()) { - if(GroupKeysList.value(groupName).contains(variableName)) + const std::unordered_map<std::string,OptionEngineGroupKey> &group=GroupKeysList.at(groupName); + if(group.find(variableName)!=group.cend()) { //prevent re-write the same value into the variable - if(GroupKeysList.value(groupName).value(variableName).currentValue==value) + if(group.at(variableName).currentValue==value) return; //write ONLY the new value GroupKeysList[groupName][variableName].currentValue=value; if(currentBackend==File) { - settings->beginGroup(groupName); - settings->setValue(variableName,value); + settings->beginGroup(QString::fromStdString(groupName)); + settings->setValue(QString::fromStdString(variableName),QString::fromStdString(value)); settings->endGroup(); if(settings->status()!=QSettings::NoError) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Have writing error, switch to memory only options")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Have writing error, switch to memory only options"); #ifdef ULTRACOPIER_VERSION_PORTABLE ResourcesManager::resourcesManager->disableWritablePath(); #endif // ULTRACOPIER_VERSION_PORTABLE @@ -199,37 +207,32 @@ void OptionEngine::setOptionValue(const QString &groupName,const QString &variab emit newOptionValue(groupName,variableName,value); return; } - QMessageBox::critical(NULL,"Internal error",tr("The variable was not found: %1 %2").arg(groupName).arg(variableName)); + QMessageBox::critical(NULL,"Internal error",tr("The variable was not found: %1 %2").arg(QString::fromStdString(groupName)).arg(QString::fromStdString(variableName))); ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"value not found, internal bug, groupName: "+groupName+", variableName: "+variableName); return; } - QMessageBox::critical(NULL,"Internal error",tr("The variable was not found: %1 %2").arg(groupName).arg(variableName)); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QString("The variable was not found: %1 %2").arg(groupName).arg(variableName)); + QMessageBox::critical(NULL,"Internal error",tr("The variable was not found: %1 %2").arg(QString::fromStdString(groupName)).arg(QString::fromStdString(variableName))); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"The variable was not found: "+groupName+" "+variableName); } //the reset of right value of widget need be do into the calling object void OptionEngine::internal_resetToDefaultValue() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); - QHash<QString,QHash<QString,OptionEngineGroupKey> >::const_iterator i = GroupKeysList.constBegin(); - QHash<QString,QHash<QString,OptionEngineGroupKey> >::const_iterator i_end = GroupKeysList.constEnd(); - QHash<QString,OptionEngineGroupKey>::const_iterator j; - QHash<QString,OptionEngineGroupKey>::const_iterator j_end; - while (i != i_end) + for(auto& n:GroupKeysList) { - j = i.value().constBegin(); - j_end = i.value().constEnd(); - while (j != j_end) + const std::string &firstKey=n.first; + for(auto& m:n.second) { - if(j.value().currentValue!=j.value().defaultValue) + const std::string &secondKey=m.first; + OptionEngineGroupKey &o=m.second; + if(o.currentValue!=o.defaultValue) { - GroupKeysList[i.key()][j.key()].currentValue=j.value().defaultValue; - emit newOptionValue(i.key(),j.key(),j.value().currentValue); + o.currentValue=o.defaultValue; + emit newOptionValue(firstKey,secondKey,o.currentValue); } - ++j; } - ++i; } } diff --git a/OptionEngine.h b/OptionEngine.h index ca8a786..027861f 100644 --- a/OptionEngine.h +++ b/OptionEngine.h @@ -20,6 +20,7 @@ #include <QTimer> #include <QWidget> #include <QHash> +#include <unordered_map> #include "interface/OptionInterface.h" @@ -41,13 +42,13 @@ class OptionEngine : public QObject /// \brief Destroy the option ~OptionEngine(); /// \brief To add option group to options - bool addOptionGroup(const QString &groupName,const QList<QPair<QString, QVariant> > &KeysList); + bool addOptionGroup(const std::string &groupName,const std::vector<std::pair<std::string, std::string> > &KeysList); /// \brief To remove option group to options, remove the widget need be do into the calling object - bool removeOptionGroup(const QString &groupName); + bool removeOptionGroup(const std::string &groupName); /// \brief To get option value - QVariant getOptionValue(const QString &groupName,const QString &variableName) const; + std::string getOptionValue(const std::string &groupName,const std::string &variableName) const; /// \brief To set option value - void setOptionValue(const QString &groupName,const QString &variableName,const QVariant &value); + void setOptionValue(const std::string &groupName,const std::string &variableName,const std::string &value); /// \brief To invalid option value //void setInvalidOptionValue(const QString &groupName,const QString &variableName); /// \brief get query reset options @@ -56,14 +57,14 @@ class OptionEngine : public QObject /// \brief OptionEngineGroupKey then: Group -> Key struct OptionEngineGroupKey { - QVariant defaultValue; - QVariant currentValue; + std::string defaultValue; + std::string currentValue; bool emptyList; }; /// \brief store the option group list - QHash<QString,QHash<QString,OptionEngineGroupKey> > GroupKeysList; - QStringList unmanagedTabName; + std::unordered_map<std::string,std::unordered_map<std::string,OptionEngineGroupKey> > GroupKeysList; + std::vector<std::string> unmanagedTabName; /// \brief Enumeration of backend enum Backend { @@ -77,7 +78,7 @@ class OptionEngine : public QObject //the reset of right value of widget need be do into the calling object void internal_resetToDefaultValue(); signals: - void newOptionValue(const QString&,const QString&,const QVariant&) const; + void newOptionValue(const std::string&,const std::string&,const std::string&) const; void resetOptions() const; public: static OptionEngine *optionEngine; diff --git a/PluginInformation.cpp b/PluginInformation.cpp index 3f5a09a..8c1551c 100644 --- a/PluginInformation.cpp +++ b/PluginInformation.cpp @@ -5,6 +5,7 @@ #include "PluginInformation.h" #include "ui_PluginInformation.h" +#include "cpp11addition.h" PluginInformation::PluginInformation() : ui(new Ui::PluginInformation) @@ -25,37 +26,30 @@ void PluginInformation::setPlugin(const PluginsAvailable &plugin) retranslateInformation(); } -void PluginInformation::setLanguage(const QString &language) +void PluginInformation::setLanguage(const std::string &language) { this->language=language; } -QString PluginInformation::categoryToTranslation(const PluginType &category) const +std::string PluginInformation::categoryToTranslation(const PluginType &category) const { switch(category) { case PluginType_CopyEngine: - return tr("Copy engine"); - break; + return tr("Copy engine").toStdString(); case PluginType_Languages: - return tr("Languages"); - break; + return tr("Languages").toStdString(); case PluginType_Listener: - return tr("Listener"); - break; + return tr("Listener").toStdString(); case PluginType_PluginLoader: - return tr("Plugin loader"); - break; + return tr("Plugin loader").toStdString(); case PluginType_SessionLoader: - return tr("Session loader"); - break; + return tr("Session loader").toStdString(); case PluginType_Themes: - return tr("Themes"); - break; + return tr("Themes").toStdString(); default: ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"cat translation not found"); - return tr("Unknown"); - break; + return tr("Unknown").toStdString(); } } @@ -64,60 +58,62 @@ void PluginInformation::retranslateInformation() if(!pluginIsLoaded) return; ui->retranslateUi(this); - this->setWindowTitle(tr("Information about %1").arg(plugin.name)); - ui->name->setText(plugin.name); - ui->title->setText(getTranslatedText(plugin,QStringLiteral("title"),language)); - ui->category->setText(categoryToTranslation(plugin.category)); - ui->author->setText(getInformationText(plugin,QStringLiteral("author"))); - QString website=getTranslatedText(plugin,QStringLiteral("website"),language); + this->setWindowTitle(tr("Information about %1").arg(QString::fromStdString(plugin.name))); + ui->name->setText(QString::fromStdString(plugin.name)); + ui->title->setText(QString::fromStdString(getTranslatedText(plugin,"title",language))); + ui->category->setText(QString::fromStdString(categoryToTranslation(plugin.category))); + ui->author->setText(QString::fromStdString(getInformationText(plugin,"author"))); + QString website=QString::fromStdString(getTranslatedText(plugin,"website",language)); ui->website->setText(QStringLiteral("<a href=\"")+website+QStringLiteral("\" title=\"")+website+QStringLiteral("\">")+website+QStringLiteral("</a>")); bool ok; - int timeStamps=getInformationText(plugin,QStringLiteral("pubDate")).toInt(&ok); + int timeStamps=stringtoint32(getInformationText(plugin,"pubDate"),&ok); QDateTime date; date.setTime_t(timeStamps); ui->date->setDateTime(date); if(!ok || timeStamps<=0) ui->date->setEnabled(false); - ui->description->setPlainText(getTranslatedText(plugin,QStringLiteral("description"),language)); - ui->version->setText(getInformationText(plugin,QStringLiteral("version"))); + ui->description->setPlainText(QString::fromStdString(getTranslatedText(plugin,"description",language))); + ui->version->setText(QString::fromStdString(getInformationText(plugin,"version"))); } /// \brief get informations text -QString PluginInformation::getInformationText(const PluginsAvailable &plugin,const QString &informationName) +std::string PluginInformation::getInformationText(const PluginsAvailable &plugin,const std::string &informationName) { - int index=0; + unsigned int index=0; while(index<plugin.informations.size()) { - if(plugin.informations.at(index).size()==2 && plugin.informations.at(index).first()==informationName) - return plugin.informations.at(index).last(); + const std::vector<std::string> &information=plugin.informations.at(index); + if(information.size()==2 && information.front()==informationName) + return information.back(); index++; } ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"information not found: "+informationName+", for: "+plugin.name+", cat: "+categoryToTranslation(plugin.category)); - return ""; + return std::string(); } /// \brief get translated text -QString PluginInformation::getTranslatedText(const PluginsAvailable &plugin,const QString &informationName,const QString &mainShortName) +std::string PluginInformation::getTranslatedText(const PluginsAvailable &plugin,const std::string &informationName,const std::string &mainShortName) { - int index=0; - QString TextFound; + unsigned int index=0; + std::string TextFound; while(index<plugin.informations.size()) { - if(plugin.informations.at(index).size()==3) + const std::vector<std::string> &information=plugin.informations.at(index); + if(information.size()==3) { - if(plugin.informations.at(index).first()==informationName) + if(information.front()==informationName) { - if(plugin.informations.at(index).at(1)==mainShortName) - return plugin.informations.at(index).last(); - else if(plugin.informations.at(index).at(1)==QStringLiteral("en")) - TextFound=plugin.informations.at(index).last(); + if(information.at(1)==mainShortName) + return information.back(); + else if(information.at(1)=="en") + TextFound=information.back(); } } index++; } #ifdef ULTRACOPIER_DEBUG - if(TextFound.isEmpty() || TextFound.isEmpty()) + if(TextFound.empty() || TextFound.empty()) ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"text is not found or empty for: "+informationName+", with the language: "+mainShortName+", for the plugin: "+plugin.path); #endif // ULTRACOPIER_DEBUG return TextFound; diff --git a/PluginInformation.h b/PluginInformation.h index c1bda2f..d3c1d5a 100644 --- a/PluginInformation.h +++ b/PluginInformation.h @@ -23,20 +23,20 @@ class PluginInformation : public QDialog explicit PluginInformation(); ~PluginInformation(); /** \brief get translated categorie */ - QString categoryToTranslation(const PluginType &category) const; + std::string categoryToTranslation(const PluginType &category) const; /** \brief to get the new plugin informations */ void setPlugin(const PluginsAvailable &plugin); /** \brief to set the language */ - void setLanguage(const QString &language); + void setLanguage(const std::string &language); public slots: void retranslateInformation(); private: bool pluginIsLoaded; PluginsAvailable plugin; Ui::PluginInformation *ui; - QString language; - QString getInformationText(const PluginsAvailable &plugin,const QString &informationName); - QString getTranslatedText(const PluginsAvailable &plugin,const QString &informationName,const QString &mainShortName); + std::string language; + std::string getInformationText(const PluginsAvailable &plugin,const std::string &informationName); + std::string getTranslatedText(const PluginsAvailable &plugin,const std::string &informationName,const std::string &mainShortName); }; #endif // PLUGININFORMATION_H diff --git a/PluginLoader.cpp b/PluginLoader.cpp index 7577885..36101a4 100644 --- a/PluginLoader.cpp +++ b/PluginLoader.cpp @@ -6,9 +6,15 @@ #include "PluginLoader.h" #include "LanguagesManager.h" +#ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE +#ifdef Q_OS_WIN32 +#include "plugins/PluginLoader/catchcopy-v0002/pluginLoader.h" +#endif +#endif + PluginLoader::PluginLoader(OptionDialog *optionDialog) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); this->optionDialog=optionDialog; //load the overall instance //load the plugin @@ -19,7 +25,7 @@ PluginLoader::PluginLoader(OptionDialog *optionDialog) connect(PluginsManager::pluginsManager,&PluginsManager::onePluginWillBeRemoved,this,&PluginLoader::onePluginWillBeRemoved,Qt::DirectConnection); #endif connect(PluginsManager::pluginsManager,&PluginsManager::pluginListingIsfinish, this,&PluginLoader::allPluginIsloaded,Qt::QueuedConnection); - QList<PluginsAvailable> list=PluginsManager::pluginsManager->getPluginsByCategory(PluginType_PluginLoader); + std::vector<PluginsAvailable> list=PluginsManager::pluginsManager->getPluginsByCategory(PluginType_PluginLoader); foreach(PluginsAvailable currentPlugin,list) emit previouslyPluginAdded(currentPlugin); PluginsManager::pluginsManager->unlockPluginListEdition(); @@ -66,14 +72,19 @@ void PluginLoader::resendState() void PluginLoader::onePluginAdded(const PluginsAvailable &plugin) { + #ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE + #ifdef Q_OS_WIN32 + PluginInterface_PluginLoader *factory; + #endif + #endif #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT if(stopIt) return; if(plugin.category!=PluginType_PluginLoader) return; LocalPlugin newEntry; - QString pluginPath=plugin.path+PluginsManager::getResolvedPluginName(QStringLiteral("pluginLoader")); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("try load: ")+pluginPath); + std::string pluginPath=plugin.path+PluginsManager::getResolvedPluginName("pluginLoader"); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"try load: "+pluginPath); #ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE PluginInterface_PluginLoader *pluginLoaderInstance; QObjectList objectList=QPluginLoader::staticInstances(); @@ -89,33 +100,32 @@ void PluginLoader::onePluginAdded(const PluginsAvailable &plugin) } if(index==objectList.size()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("static listener not found")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"static listener not found"); return; } newEntry.pluginLoader=NULL; #else - QPluginLoader *pluginLoader= new QPluginLoader(pluginPath); + QPluginLoader *pluginLoader= new QPluginLoader(QString::fromStdString(pluginPath)); QObject *pluginInstance = pluginLoader->instance(); if(!pluginInstance) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("unable to load the plugin: ")+pluginLoader->errorString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to load the plugin: "+pluginLoader->errorString().toStdString()); return; } PluginInterface_PluginLoader *pluginLoaderInstance = qobject_cast<PluginInterface_PluginLoader *>(pluginInstance); if(!pluginLoaderInstance) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("unable to cast the plugin: ")+pluginLoader->errorString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to cast the plugin: "+pluginLoader->errorString().toStdString()); return; } newEntry.pluginLoader = pluginLoader; //check if found - int index=0; - const int &loop_size=pluginList.size(); - while(index<loop_size) + unsigned int index=0; + while(index<pluginList.size()) { if(pluginList.at(index).pluginLoaderInterface==pluginLoaderInstance) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Plugin already found")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Plugin already found"); pluginLoader->unload(); return; } @@ -126,22 +136,50 @@ void PluginLoader::onePluginAdded(const PluginsAvailable &plugin) connect(pluginLoaderInstance,&PluginInterface_PluginLoader::debugInformation,this,&PluginLoader::debugInformation,Qt::DirectConnection); #endif // ULTRACOPIER_DEBUG - newEntry.options=new LocalPluginOptions(QStringLiteral("PluginLoader-")+plugin.name); + newEntry.options=new LocalPluginOptions("PluginLoader-"+plugin.name); newEntry.pluginLoaderInterface = pluginLoaderInstance; newEntry.path = plugin.path; newEntry.state = Ultracopier::Uncaught; newEntry.inWaitOfReply = false; - pluginList << newEntry; + pluginList.push_back(newEntry); pluginLoaderInstance->setResources(newEntry.options,plugin.writablePath,plugin.path,ULTRACOPIER_VERSION_PORTABLE_BOOL); optionDialog->addPluginOptionWidget(PluginType_PluginLoader,plugin.name,newEntry.pluginLoaderInterface->options()); - connect(pluginList.last().pluginLoaderInterface,&PluginInterface_PluginLoader::newState,this,&PluginLoader::newState,Qt::DirectConnection); + connect(pluginList.back().pluginLoaderInterface,&PluginInterface_PluginLoader::newState,this,&PluginLoader::newState,Qt::DirectConnection); connect(LanguagesManager::languagesManager,&LanguagesManager::newLanguageLoaded,newEntry.pluginLoaderInterface,&PluginInterface_PluginLoader::newLanguageLoaded,Qt::DirectConnection); if(needEnable) { - pluginList.last().inWaitOfReply=true; + pluginList.back().inWaitOfReply=true; newEntry.pluginLoaderInterface->setEnabled(needEnable); } #else + #ifdef Q_OS_WIN32 + factory=new WindowsExplorerLoader(); + LocalPlugin newEntry; + #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT + newEntry.pluginLoader=NULL; + #endif + + newEntry.options=new LocalPluginOptions("PluginLoader-"+plugin.name); + newEntry.pluginLoaderInterface = new WindowsExplorerLoader(); + newEntry.path = plugin.path; + newEntry.state = Ultracopier::Uncaught; + newEntry.inWaitOfReply = false; + #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT + #ifdef ULTRACOPIER_DEBUG + connect(newEntry.pluginLoaderInterface,&PluginInterface_PluginLoader::debugInformation,this,&PluginLoader::debugInformation,Qt::DirectConnection); + #endif // ULTRACOPIER_DEBUG + #endif + pluginList.push_back(newEntry); + newEntry.pluginLoaderInterface->setResources(newEntry.options,plugin.writablePath,plugin.path,ULTRACOPIER_VERSION_PORTABLE_BOOL); + optionDialog->addPluginOptionWidget(PluginType_PluginLoader,plugin.name,newEntry.pluginLoaderInterface->options()); + connect(pluginList.back().pluginLoaderInterface,&PluginInterface_PluginLoader::newState,this,&PluginLoader::newState,Qt::DirectConnection); + connect(LanguagesManager::languagesManager,&LanguagesManager::newLanguageLoaded,newEntry.pluginLoaderInterface,&PluginInterface_PluginLoader::newLanguageLoaded,Qt::DirectConnection); + if(needEnable) + { + pluginList.back().inWaitOfReply=true; + newEntry.pluginLoaderInterface->setEnabled(needEnable); + } + #endif Q_UNUSED(plugin); #endif } @@ -153,10 +191,9 @@ void PluginLoader::onePluginWillBeRemoved(const PluginsAvailable &plugin) return; if(plugin.category!=PluginType_PluginLoader) return; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - int index=0; - const int &loop_size=pluginList.size(); - while(index<loop_size) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + unsigned int index=0; + while(index<pluginList.size()) { if(plugin.path==pluginList.at(index).path) { @@ -166,7 +203,7 @@ void PluginLoader::onePluginWillBeRemoved(const PluginsAvailable &plugin) if(!pluginList.at(index).pluginLoader->isLoaded() || pluginList.at(index).pluginLoader->unload()) { delete pluginList.at(index).options; - pluginList.removeAt(index); + pluginList.erase(pluginList.cbegin()+index); } } sendState(); @@ -182,8 +219,8 @@ void PluginLoader::load() if(stopIt) return; needEnable=true; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - int index=0; + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + unsigned int index=0; while(index<pluginList.size()) { pluginList[index].inWaitOfReply=true; @@ -197,9 +234,9 @@ void PluginLoader::unload() { if(stopIt) return; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); needEnable=false; - int index=0; + unsigned int index=0; while(index<pluginList.size()) { pluginList[index].inWaitOfReply=true; @@ -210,9 +247,9 @@ void PluginLoader::unload() } #ifdef ULTRACOPIER_DEBUG -void PluginLoader::debugInformation(const Ultracopier::DebugLevel &level,const QString& fonction,const QString& text,const QString& file,const int& ligne) +void PluginLoader::debugInformation(const Ultracopier::DebugLevel &level,const std::string& fonction,const std::string& text,const std::string& file,const unsigned int& ligne) { - DebugEngine::addDebugInformationStatic(level,fonction,text,file,ligne,QStringLiteral("Plugin loader plugin")); + DebugEngine::addDebugInformationStatic(level,fonction,text,file,ligne,"Plugin loader plugin"); } #endif // ULTRACOPIER_DEBUG @@ -220,7 +257,7 @@ void PluginLoader::allPluginIsloaded() { if(stopIt) return; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("with value: ")+QString::number(pluginList.size()>0)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"with value: "+std::to_string(pluginList.size()>0)); sendState(true); } @@ -228,10 +265,10 @@ void PluginLoader::sendState(bool force) { if(stopIt) return; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start, pluginList.size(): %1, force: %2").arg(pluginList.size()).arg(force)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, pluginList.size(): "+std::to_string(pluginList.size())+", force: "+std::to_string(force)); Ultracopier::CatchState current_state=Ultracopier::Uncaught; bool found_not_listen=false,found_listen=false,found_inWaitOfReply=false; - int index=0; + unsigned int index=0; while(index<pluginList.size()) { if(current_state==Ultracopier::Uncaught) @@ -247,7 +284,7 @@ void PluginLoader::sendState(bool force) found_inWaitOfReply=true; index++; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("current_state: %1").arg(current_state)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"current_state: "+std::to_string(current_state)); if(current_state==Ultracopier::Uncaught) { if(!found_not_listen && !found_listen) @@ -265,11 +302,11 @@ void PluginLoader::sendState(bool force) bool have_plugin=pluginList.size()>0; if(force || current_state!=last_state || have_plugin!=last_have_plugin || found_inWaitOfReply!=last_inWaitOfReply) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("send pluginLoaderReady(%1,%2,%3)").arg(current_state).arg(have_plugin).arg(found_inWaitOfReply)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"send pluginLoaderReady("+std::to_string(current_state)+","+std::to_string(have_plugin)+","+std::to_string(found_inWaitOfReply)+")"); emit pluginLoaderReady(current_state,have_plugin,found_inWaitOfReply); } else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Skip the signal sending")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Skip the signal sending"); last_state=current_state; last_have_plugin=have_plugin; last_inWaitOfReply=found_inWaitOfReply; @@ -279,14 +316,14 @@ void PluginLoader::newState(const Ultracopier::CatchState &state) { if(stopIt) return; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start, state: %1").arg(state)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, state: "+std::to_string(state)); PluginInterface_PluginLoader *temp=qobject_cast<PluginInterface_PluginLoader *>(QObject::sender()); if(temp==NULL) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("listener not located!")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"listener not located!"); return; } - int index=0; + unsigned int index=0; while(index<pluginList.size()) { if(temp==pluginList.at(index).pluginLoaderInterface) @@ -298,5 +335,5 @@ void PluginLoader::newState(const Ultracopier::CatchState &state) } index++; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("listener not found!")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"listener not found!"); } diff --git a/PluginLoader.h b/PluginLoader.h index bb5812c..83dcc11 100644 --- a/PluginLoader.h +++ b/PluginLoader.h @@ -50,7 +50,7 @@ private slots: void onePluginWillBeRemoved(const PluginsAvailable &plugin); #endif #ifdef ULTRACOPIER_DEBUG - void debugInformation(const Ultracopier::DebugLevel &level,const QString& fonction,const QString& text,const QString& file,const int& ligne); + void debugInformation(const Ultracopier::DebugLevel &level, const std::string& fonction, const std::string& text, const std::string& file, const unsigned int &ligne); #endif // ULTRACOPIER_DEBUG void allPluginIsloaded(); void newState(const Ultracopier::CatchState &state); @@ -63,11 +63,11 @@ private: QPluginLoader * pluginLoader; #endif Ultracopier::CatchState state; - QString path; + std::string path; bool inWaitOfReply; LocalPluginOptions *options; }; - QList<LocalPlugin> pluginList; + std::vector<LocalPlugin> pluginList; bool needEnable; Ultracopier::CatchState last_state; bool last_have_plugin,last_inWaitOfReply; diff --git a/PluginsManager.cpp b/PluginsManager.cpp index 1a8ad42..95c158d 100644 --- a/PluginsManager.cpp +++ b/PluginsManager.cpp @@ -9,22 +9,26 @@ #include <QFile> #include <QFileInfo> +#include <iterator> + #include "PluginsManager.h" +#include "cpp11addition.h" +#include "FacilityEngine.h" /// \brief Create the manager and load the defaults variables PluginsManager::PluginsManager() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); //load the overall instance pluginLoaded = false; - language = QStringLiteral("en"); + language = "en"; stopIt = false; pluginInformation = NULL; #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE importingPlugin = false; #endif editionSemList.release(); - englishPluginType << QStringLiteral("CopyEngine") << QStringLiteral("Languages") << QStringLiteral("Listener") << QStringLiteral("PluginLoader") << QStringLiteral("SessionLoader") << QStringLiteral("Themes"); + englishPluginType.push_back("CopyEngine");englishPluginType.push_back("Languages");englishPluginType.push_back("Listener");englishPluginType.push_back("PluginLoader");englishPluginType.push_back("SessionLoader");englishPluginType.push_back("Themes"); //catPlugin << tr("CopyEngine") << tr("Languages") << tr("Listener") << tr("PluginLoader") << tr("SessionLoader") << tr("Themes"); #ifdef ULTRACOPIER_PLUGIN_IMPORT_SUPPORT connect(&decodeThread, &QXzDecodeThread::decodedIsFinish, this, &PluginsManager::decodingFinished,Qt::QueuedConnection); @@ -48,7 +52,7 @@ PluginsManager::~PluginsManager() } /// \brief set current language -void PluginsManager::setLanguage(const QString &language) +void PluginsManager::setLanguage(const std::string &language) { this->language=language; } @@ -76,50 +80,50 @@ void PluginsManager::unlockPluginListEdition() void PluginsManager::run() { - regexp_to_clean_1=QRegularExpression(QStringLiteral("[\n\r]+")); - regexp_to_clean_2=QRegularExpression(QStringLiteral("[ \t]+")); - regexp_to_clean_3=QRegularExpression(QStringLiteral("(&&)+")); - regexp_to_clean_4=QRegularExpression(QStringLiteral("^&&")); - regexp_to_clean_5=QRegularExpression(QStringLiteral("&&$")); - regexp_to_dep_1=QRegularExpression(QStringLiteral("(&&|\\|\\||\\(|\\))")); - regexp_to_dep_2=QRegularExpression(QStringLiteral("^(<=|<|=|>|>=)[a-zA-Z0-9\\-]+-([0-9]+\\.)*[0-9]+$")); - regexp_to_dep_3=QRegularExpression(QStringLiteral("(<=|<|=|>|>=)")); - regexp_to_dep_4=QRegularExpression(QStringLiteral("-([0-9]+\\.)*[0-9]+")); - regexp_to_dep_5=QRegularExpression(QStringLiteral("[a-zA-Z0-9\\-]+-")); - regexp_to_dep_6=QRegularExpression(QStringLiteral("[a-zA-Z0-9\\-]+-([0-9]+\\.)*[0-9]+")); + regexp_to_clean_1=std::regex("[\n\r]+"); + regexp_to_clean_2=std::regex("[ \t]+"); + regexp_to_clean_3=std::regex("(&&)+"); + regexp_to_clean_4=std::regex("^&&"); + regexp_to_clean_5=std::regex("&&$"); + regexp_to_dep_1=std::regex("(&&|\\|\\||\\(|\\))"); + regexp_to_dep_2=std::regex("^(<=|<|=|>|>=)[a-zA-Z0-9\\-]+-([0-9]+\\.)*[0-9]+$"); + regexp_to_dep_3=std::regex("(<=|<|=|>|>=)"); + regexp_to_dep_4=std::regex("-([0-9]+\\.)*[0-9]+"); + regexp_to_dep_5=std::regex("[a-zA-Z0-9\\-]+-"); + regexp_to_dep_6=std::regex("[a-zA-Z0-9\\-]+-([0-9]+\\.)*[0-9]+"); //load the path and plugins into the path - QStringList readPath; - readPath << ResourcesManager::resourcesManager->getReadPath(); + const std::string &separator=FacilityEngine::separator(); + std::vector<std::string> readPath; + readPath=ResourcesManager::resourcesManager->getReadPath(); pluginsList.clear(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("pluginsList.size(): ")+QString::number(pluginsList.size())); - foreach(QString basePath,readPath) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"pluginsList.size(): "+std::to_string(pluginsList.size())); + foreach(std::string basePath,readPath) { - foreach(QString dirSub,englishPluginType) + foreach(std::string dirSub,englishPluginType) { - QString pluginComposed=basePath+dirSub+QDir::separator(); - QDir dir(pluginComposed); + std::string pluginComposed=basePath+dirSub+separator; + QDir dir(QString::fromStdString(pluginComposed)); if(stopIt) return; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("search plugin into: ")+pluginComposed); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"search plugin into: "+pluginComposed); if(dir.exists()) { foreach(QString dirName, dir.entryList(QDir::Dirs|QDir::NoDotAndDotDot)) { if(stopIt) return; - loadPluginInformation(pluginComposed+dirName+QDir::separator()); + loadPluginInformation(pluginComposed+dirName.toStdString()+separator); } } } } #ifdef ULTRACOPIER_DEBUG - int index_debug=0; - const int &loop_size=pluginsList.size(); - while(index_debug<loop_size) + unsigned int index_debug=0; + while(index_debug<pluginsList.size()) { - QString category=categoryToString(pluginsList.at(index_debug).category); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("Plugin ")+QString::number(index_debug)+QStringLiteral(" loaded (")+category+QStringLiteral("): ")+pluginsList.at(index_debug).path); + std::string category=categoryToString(pluginsList.at(index_debug).category); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"Plugin "+std::to_string(index_debug)+" loaded ("+category+"): "+pluginsList.at(index_debug).path); index_debug++; } #endif @@ -127,45 +131,45 @@ void PluginsManager::run() while(checkDependencies()!=0){}; #endif //QList<PluginsAvailable> list; - int index=0; + unsigned int index=0; while(index<pluginsList.size()) { - if(pluginsList.at(index).errorString.isEmpty()) + if(pluginsList.at(index).errorString.empty()) emit onePluginAdded(pluginsList.at(index)); index++; } } -QString PluginsManager::categoryToString(const PluginType &category) const +std::string PluginsManager::categoryToString(const PluginType &category) const { switch(category) { case PluginType_CopyEngine: - return QStringLiteral("CopyEngine"); + return "CopyEngine"; break; case PluginType_Languages: - return QStringLiteral("Languages"); + return "Languages"; break; case PluginType_Listener: - return QStringLiteral("Listener"); + return "Listener"; break; case PluginType_PluginLoader: - return QStringLiteral("PluginLoader"); + return "PluginLoader"; break; case PluginType_SessionLoader: - return QStringLiteral("SessionLoader"); + return "SessionLoader"; break; case PluginType_Themes: - return QStringLiteral("Themes"); + return "Themes"; break; default: - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("cat text not found: ")+QString::number(category)); - return QStringLiteral("Unknown"); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"cat text not found: "+std::to_string(category)); + return "Unknown"; break; } } -QString PluginsManager::categoryToTranslation(const PluginType &category) +std::string PluginsManager::categoryToTranslation(const PluginType &category) { if(pluginInformation==NULL) { @@ -195,20 +199,20 @@ bool PluginsManager::isSamePlugin(const PluginsAvailable &pluginA,const PluginsA return true; } -bool PluginsManager::loadPluginInformation(const QString &path) +bool PluginsManager::loadPluginInformation(const std::string &path) { PluginsAvailable tempPlugin; tempPlugin.isAuth = false; tempPlugin.path = path; tempPlugin.category = PluginType_Unknow; - QDir pluginPath(path); + QDir pluginPath(QString::fromStdString(path)); if(pluginPath.cdUp() && pluginPath.cdUp() && - ResourcesManager::resourcesManager->getWritablePath()!="" && - pluginPath==QDir(ResourcesManager::resourcesManager->getWritablePath())) + !ResourcesManager::resourcesManager->getWritablePath().empty() && + pluginPath==QDir(QString::fromStdString(ResourcesManager::resourcesManager->getWritablePath()))) tempPlugin.isWritable=true; else tempPlugin.isWritable=false; - QFile xmlMetaData(path+QStringLiteral("informations.xml")); + QFile xmlMetaData(QString::fromStdString(path)+"informations.xml"); if(xmlMetaData.exists()) { if(xmlMetaData.open(QIODevice::ReadOnly)) @@ -218,26 +222,26 @@ bool PluginsManager::loadPluginInformation(const QString &path) } else { - tempPlugin.errorString=tr("informations.xml is not accessible"); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("informations.xml is not accessible into the plugin: ")+path); + tempPlugin.errorString=tr("informations.xml is not accessible").toStdString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"informations.xml is not accessible into the plugin: "+path); } } else { - tempPlugin.errorString=tr("informations.xml not found for the plugin"); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("informations.xml not found for the plugin: ")+path); + tempPlugin.errorString=tr("informations.xml not found for the plugin").toStdString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"informations.xml not found for the plugin: "+path); } editionSemList.acquire(); - pluginsList << tempPlugin; - if(tempPlugin.errorString==QStringLiteral("")) - pluginsListIndexed.insert(tempPlugin.category,tempPlugin); + pluginsList.push_back(tempPlugin); + if(tempPlugin.errorString.empty()) + pluginsListIndexed[tempPlugin.category].push_back(tempPlugin); editionSemList.release(); - if(tempPlugin.errorString==QStringLiteral("")) + if(tempPlugin.errorString.empty()) return true; else { emit onePluginInErrorAdded(tempPlugin); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Error detected, the not loaded: ")+tempPlugin.errorString+QStringLiteral(", for path: ")+tempPlugin.path); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Error detected, the not loaded: "+tempPlugin.errorString+", for path: "+tempPlugin.path); return false; } } @@ -250,91 +254,88 @@ void PluginsManager::loadPluginXml(PluginsAvailable * thePlugin,const QByteArray QDomDocument domDocument; if (!domDocument.setContent(xml, false, &errorStr,&errorLine,&errorColumn)) { - thePlugin->errorString=tr("%1, parse error at line %2, column %3: %4").arg(QStringLiteral("informations.xml")).arg(errorLine).arg(errorColumn).arg(errorStr); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("%1, Parse error at line %2, column %3: %4").arg(QStringLiteral("informations.xml")).arg(errorLine).arg(errorColumn).arg(errorStr)); + thePlugin->errorString=tr("%1, parse error at line %2, column %3: %4").arg("informations.xml").arg(errorLine).arg(errorColumn).arg(errorStr).toStdString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"informations.xml, Parse error at line "+std::to_string(errorLine)+", column "+std::to_string(errorColumn)+": "+errorStr.toStdString()); } else { QDomElement root = domDocument.documentElement(); if (root.tagName() != QStringLiteral("package")) { - thePlugin->errorString=tr("\"package\" root tag not found for the xml file"); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("\"package\" root balise not found for the xml file")); + thePlugin->errorString=tr("\"package\" root tag not found for the xml file").toStdString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"\"package\" root balise not found for the xml file"); } //load the variable - if(thePlugin->errorString.isEmpty()) - loadBalise(root,QStringLiteral("title"),&(thePlugin->informations),&(thePlugin->errorString),true,true,true); - if(thePlugin->errorString.isEmpty()) - loadBalise(root,QStringLiteral("website"),&(thePlugin->informations),&(thePlugin->errorString),false,true); - if(thePlugin->errorString.isEmpty()) - loadBalise(root,QStringLiteral("description"),&(thePlugin->informations),&(thePlugin->errorString),true,true,true); - if(thePlugin->errorString.isEmpty()) - loadBalise(root,QStringLiteral("author"),&(thePlugin->informations),&(thePlugin->errorString),true,false); - if(thePlugin->errorString.isEmpty()) - loadBalise(root,QStringLiteral("pubDate"),&(thePlugin->informations),&(thePlugin->errorString),true,false); - if(thePlugin->errorString.isEmpty()) + if(thePlugin->errorString.empty()) + loadBalise(root,"title",&(thePlugin->informations),&(thePlugin->errorString),true,true,true); + if(thePlugin->errorString.empty()) + loadBalise(root,"website",&(thePlugin->informations),&(thePlugin->errorString),false,true); + if(thePlugin->errorString.empty()) + loadBalise(root,"description",&(thePlugin->informations),&(thePlugin->errorString),true,true,true); + if(thePlugin->errorString.empty()) + loadBalise(root,"author",&(thePlugin->informations),&(thePlugin->errorString),true,false); + if(thePlugin->errorString.empty()) + loadBalise(root,"pubDate",&(thePlugin->informations),&(thePlugin->errorString),true,false); + if(thePlugin->errorString.empty()) { - loadBalise(root,QStringLiteral("version"),&(thePlugin->informations),&(thePlugin->errorString),true,false); - if(thePlugin->errorString.isEmpty()) - thePlugin->version=thePlugin->informations.last().last(); + loadBalise(root,"version",&(thePlugin->informations),&(thePlugin->errorString),true,false); + if(thePlugin->errorString.empty()) + thePlugin->version=thePlugin->informations.back().back(); } - if(thePlugin->errorString.isEmpty()) + if(thePlugin->errorString.empty()) { - loadBalise(root,QStringLiteral("category"),&(thePlugin->informations),&(thePlugin->errorString),true,false); - if(thePlugin->errorString.isEmpty()) + loadBalise(root,"category",&(thePlugin->informations),&(thePlugin->errorString),true,false); + if(thePlugin->errorString.empty()) { - QString tempCat=thePlugin->informations.last().last(); - if(tempCat==QStringLiteral("Languages")) + std::string tempCat=thePlugin->informations.back().back(); + if(tempCat=="Languages") thePlugin->category=PluginType_Languages; - else if(tempCat==QStringLiteral("CopyEngine")) + else if(tempCat=="CopyEngine") thePlugin->category=PluginType_CopyEngine; - else if(tempCat==QStringLiteral("Listener")) + else if(tempCat=="Listener") thePlugin->category=PluginType_Listener; - else if(tempCat==QStringLiteral("PluginLoader")) + else if(tempCat=="PluginLoader") thePlugin->category=PluginType_PluginLoader; - else if(tempCat==QStringLiteral("SessionLoader")) + else if(tempCat=="SessionLoader") thePlugin->category=PluginType_SessionLoader; - else if(tempCat==QStringLiteral("Themes")) + else if(tempCat=="Themes") thePlugin->category=PluginType_Themes; else - thePlugin->errorString=QStringLiteral("Unknow category: ")+QString::number((int)thePlugin->category); - if(thePlugin->errorString.isEmpty()) + thePlugin->errorString="Unknow category: "+std::to_string((int)thePlugin->category); + if(thePlugin->errorString.empty()) { if(thePlugin->category!=PluginType_Languages) { #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE - loadBalise(root,QStringLiteral("architecture"),&(thePlugin->informations),&(thePlugin->errorString),true,false); - if(thePlugin->errorString.isEmpty()) + loadBalise(root,"architecture",&(thePlugin->informations),&(thePlugin->errorString),true,false); + if(thePlugin->errorString.empty()) { - if(thePlugin->informations.last().last()!=ULTRACOPIER_PLATFORM_CODE) - thePlugin->errorString=QStringLiteral("Wrong platform code: ")+thePlugin->informations.last().last(); + if(thePlugin->informations.back().back()!=ULTRACOPIER_PLATFORM_CODE) + thePlugin->errorString="Wrong platform code: "+thePlugin->informations.back().back(); } #endif } } } } - if(thePlugin->errorString.isEmpty()) + if(thePlugin->errorString.empty()) { - loadBalise(root,QStringLiteral("name"),&(thePlugin->informations),&(thePlugin->errorString),true,false); - if(thePlugin->errorString.isEmpty()) + loadBalise(root,"name",&(thePlugin->informations),&(thePlugin->errorString),true,false); + if(thePlugin->errorString.empty()) { - thePlugin->name=thePlugin->informations.last().last(); - int index=0; - const int &loop_size=pluginsList.size(); - int sub_index,loop_sub_size; - while(index<loop_size) + thePlugin->name=thePlugin->informations.back().back(); + size_t index=0; + while(index<pluginsList.size()) { - sub_index=0; - loop_sub_size=pluginsList.at(index).informations.size(); - while(sub_index<loop_sub_size) + size_t sub_index=0; + while(sub_index<pluginsList.at(index).informations.size()) { - if(pluginsList.at(index).informations.at(sub_index).first()==QStringLiteral("name") && + if(pluginsList.at(index).informations.at(sub_index).front()=="name" && pluginsList.at(index).name==thePlugin->name && pluginsList.at(index).category==thePlugin->category) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Plugin duplicate found ("+QString::number((int)thePlugin->category)+"/"+pluginsList.at(index).informations.at(sub_index).last()+"), already loaded, actual version skipped: "+thePlugin->version); - thePlugin->errorString=tr("Duplicated plugin found, already loaded!"); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Plugin duplicate found ("+std::to_string((int)thePlugin->category)+"/"+pluginsList.at(index).informations.at(sub_index).back()+"), already loaded, actual version skipped: "+thePlugin->version); + thePlugin->errorString=tr("Duplicated plugin found, already loaded!").toStdString(); break; break; } @@ -344,11 +345,11 @@ void PluginsManager::loadPluginXml(PluginsAvailable * thePlugin,const QByteArray } } } - if(thePlugin->errorString.isEmpty()) - loadBalise(root,QStringLiteral("dependencies"),&(thePlugin->informations),&(thePlugin->errorString),true,false); - if(thePlugin->errorString.isEmpty()) + if(thePlugin->errorString.empty()) + loadBalise(root,"dependencies",&(thePlugin->informations),&(thePlugin->errorString),true,false); + if(thePlugin->errorString.empty()) { - QDomElement child = root.firstChildElement(QStringLiteral("categorySpecific")); + QDomElement child = root.firstChildElement("categorySpecific"); if(!child.isNull() && child.isElement()) thePlugin->categorySpecific=child; } @@ -356,16 +357,16 @@ void PluginsManager::loadPluginXml(PluginsAvailable * thePlugin,const QByteArray } /// \brief to load the multi-language balise -void PluginsManager::loadBalise(const QDomElement &root,const QString &name,QList<QStringList> *informations,QString *errorString,bool needHaveOneEntryMinimum,bool multiLanguage,bool englishNeedBeFound) +void PluginsManager::loadBalise(const QDomElement &root,const std::string &name,std::vector<std::vector<std::string> > *informations,std::string *errorString,bool needHaveOneEntryMinimum,bool multiLanguage,bool englishNeedBeFound) { int foundElement=0; bool englishTextIsFoundForThisChild=false; - QDomElement child = root.firstChildElement(name); + QDomElement child = root.firstChildElement(QString::fromStdString(name)); while(!child.isNull()) { if(child.isElement()) { - QStringList newInformations; + std::vector<std::string> newInformations; if(multiLanguage) { if(child.hasAttribute(QStringLiteral("xml:lang"))) @@ -373,53 +374,55 @@ void PluginsManager::loadBalise(const QDomElement &root,const QString &name,QLis if(child.attribute(QStringLiteral("xml:lang"))==QStringLiteral("en")) englishTextIsFoundForThisChild=true; foundElement++; - newInformations << child.tagName() << child.attribute(QStringLiteral("xml:lang")) << child.text(); + newInformations.push_back(child.tagName().toStdString()); + newInformations.push_back(child.attribute(QStringLiteral("xml:lang")).toStdString()); + newInformations.push_back(child.text().toStdString()); } else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Have not the attribute xml:lang: child.tagName(): %1, child.text(): %2").arg(child.tagName()).arg(child.text())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Have not the attribute xml:lang: child.tagName(): "+child.tagName().toStdString()+", child.text(): "+child.text().toStdString()); } else { foundElement++; - newInformations << child.tagName() << child.text(); + newInformations.push_back(child.tagName().toStdString()); + newInformations.push_back(child.text().toStdString()); } - *informations << newInformations; + informations->push_back(newInformations); } else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Is not Element: child.tagName(): %1").arg(child.tagName())); - child = child.nextSiblingElement(name); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Is not Element: child.tagName(): "+child.tagName().toStdString()); + child = child.nextSiblingElement(QString::fromStdString(name)); } if(multiLanguage && englishTextIsFoundForThisChild==false && englishNeedBeFound) { informations->clear(); - *errorString=tr("English text missing in the informations.xml for the tag: %1").arg(name); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("English text missing into the informations.xml for the tag: %1").arg(name)); + *errorString=tr("English text missing in the informations.xml for the tag: %1").arg(QString::fromStdString(name)).toStdString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"English text missing into the informations.xml for the tag: "+name); return; } if(needHaveOneEntryMinimum && foundElement==0) { informations->clear(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Tag not found: %1").arg(name)); - *errorString=tr("Tag not found: %1").arg(name); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Tag not found: "+name); + *errorString=tr("Tag not found: %1").arg(QString::fromStdString(name)).toStdString(); } } /// \brief to load the get dom specific -QString PluginsManager::getDomSpecific(const QDomElement &root,const QString &name,const QList<QPair<QString,QString> > &listChildAttribute) const +std::string PluginsManager::getDomSpecific(const QDomElement &root,const std::string &name,const std::vector<std::pair<std::string,std::string> > &listChildAttribute) const { - QDomElement child = root.firstChildElement(name); - int index,loop_size; + QDomElement child = root.firstChildElement(QString::fromStdString(name)); bool allIsFound; while(!child.isNull()) { if(child.isElement()) { allIsFound=true; - index=0; - loop_size=listChildAttribute.size(); - while(index<loop_size) + size_t index=0; + while(index<listChildAttribute.size()) { - if(child.attribute(listChildAttribute.at(index).first)!=listChildAttribute.at(index).second) + const std::pair<std::string,std::string> &entry=listChildAttribute.at(index); + if(child.attribute(QString::fromStdString(entry.first))!=QString::fromStdString(entry.second)) { allIsFound=false; break; @@ -427,92 +430,89 @@ QString PluginsManager::getDomSpecific(const QDomElement &root,const QString &na index++; } if(allIsFound) - return child.text(); + return child.text().toStdString(); } else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Is not Element: child.tagName(): %1").arg(child.tagName())); - child = child.nextSiblingElement(name); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Is not Element: child.tagName(): "+child.tagName().toStdString()); + child = child.nextSiblingElement(QString::fromStdString(name)); } - return QString(); + return std::string(); } /// \brief to load the get dom specific -QString PluginsManager::getDomSpecific(const QDomElement &root,const QString &name) const +std::string PluginsManager::getDomSpecific(const QDomElement &root,const std::string &name) const { - QDomElement child = root.firstChildElement(name); + QDomElement child = root.firstChildElement(QString::fromStdString(name)); while(!child.isNull()) { if(child.isElement()) - return child.text(); + return child.text().toStdString(); else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QString("Is not Element: child.tagName(): %1").arg(child.tagName())); - child = child.nextSiblingElement(name); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Is not Element: child.tagName(): "+child.tagName().toStdString()); + child = child.nextSiblingElement(QString::fromStdString(name)); } - return QString(); + return std::string(); } #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE /// \brief check the dependencies -quint32 PluginsManager::checkDependencies() +uint32_t PluginsManager::checkDependencies() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - quint32 errors=0; - int index=0; - const int &loop_size=pluginsList.size(); - int sub_index,loop_sub_size,resolv_size,indexOfDependencies; + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + uint32_t errors=0; + unsigned int index=0; bool depCheck; - while(index<loop_size) + while(index<pluginsList.size()) { - sub_index=0; - loop_sub_size=pluginsList.at(index).informations.size(); - while(sub_index<loop_sub_size) + unsigned int sub_index=0; + while(sub_index<pluginsList.at(index).informations.size()) { - if(pluginsList.at(index).informations.at(sub_index).size()==2 && pluginsList.at(index).informations.at(sub_index).at(0)==QStringLiteral("dependencies")) + if(pluginsList.at(index).informations.at(sub_index).size()==2 && pluginsList.at(index).informations.at(sub_index).at(0)=="dependencies") { - QString dependencies=pluginsList.at(index).informations.at(sub_index).at(1); - dependencies=dependencies.replace(regexp_to_clean_1,QStringLiteral("&&")); - dependencies=dependencies.replace(regexp_to_clean_2,QStringLiteral("")); - dependencies=dependencies.replace(regexp_to_clean_3,QStringLiteral("&&")); - dependencies=dependencies.replace(regexp_to_clean_4,QStringLiteral("")); - dependencies=dependencies.replace(regexp_to_clean_5,QStringLiteral("")); - QStringList dependenciesToResolv=dependencies.split(regexp_to_dep_1,QString::SkipEmptyParts); - indexOfDependencies=0; - resolv_size=dependenciesToResolv.size(); - while(indexOfDependencies<resolv_size) + std::string dependencies = pluginsList.at(index).informations.at(sub_index).at(1); + dependencies=std::regex_replace(dependencies, regexp_to_clean_1,"&&"); + dependencies=std::regex_replace(dependencies, regexp_to_clean_2,""); + dependencies=std::regex_replace(dependencies, regexp_to_clean_3,"&&"); + dependencies=std::regex_replace(dependencies, regexp_to_clean_4,""); + dependencies=std::regex_replace(dependencies, regexp_to_clean_5,""); + std::sregex_token_iterator iter(dependencies.begin(), dependencies.end(), regexp_to_dep_1, -1), end; + for ( ; iter != end; ++iter) { - QString dependenciesToParse=dependenciesToResolv.at(indexOfDependencies); - if(!dependenciesToParse.contains(regexp_to_dep_2)) + std::string dependenciesToParse=trim(*iter); + if(dependenciesToParse.empty()) { + continue; + } + if(!std::regex_match(dependenciesToParse, regexp_to_dep_2)) { pluginsList[index].informations.clear(); - pluginsList[index].errorString=tr("Dependencies part is wrong"); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Dependencies part is wrong: %1").arg(dependenciesToParse)); + pluginsList[index].errorString=tr("Dependencies part is wrong").toStdString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Dependencies part is wrong: "+dependenciesToParse); emit onePluginInErrorAdded(pluginsList.at(index)); errors++; break; } - QString partName=dependenciesToParse; - partName=partName.remove(regexp_to_dep_3); - partName=partName.remove(regexp_to_dep_4); - QString partVersion=dependenciesToParse; - partVersion=partVersion.remove(regexp_to_dep_3); - partVersion=partVersion.remove(regexp_to_dep_5); - QString partComp=dependenciesToParse; - partComp=partComp.remove(regexp_to_dep_6); + std::string partName=dependenciesToParse; + partName=std::regex_replace(partName, regexp_to_dep_3, ""); + partName=std::regex_replace(partName, regexp_to_dep_4, ""); + std::string partVersion=dependenciesToParse; + partVersion=std::regex_replace(partVersion, regexp_to_dep_3, ""); + partVersion=std::regex_replace(partVersion, regexp_to_dep_5, ""); + std::string partComp=dependenciesToParse; + partComp=std::regex_replace(partComp, regexp_to_dep_6, ""); //current version soft - QString pluginVersion=getPluginVersion(partName); + std::string pluginVersion=getPluginVersion(partName); depCheck=compareVersion(pluginVersion,partComp,partVersion); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("dependencies to resolv, partName: ")+partName+QStringLiteral(", partVersion: ")+partVersion+QStringLiteral(", partComp: ")+partComp+QStringLiteral(", pluginVersion: ")+pluginVersion+QStringLiteral(", depCheck: ")+QString::number(depCheck)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"dependencies to resolv, partName: "+partName+", partVersion: "+partVersion+", partComp: "+partComp+", pluginVersion: "+pluginVersion+", depCheck: "+std::to_string(depCheck)); if(!depCheck) { pluginsList[index].informations.clear(); - pluginsList[index].errorString=tr("Dependencies %1 are not satisfied, for plugin: %2").arg(dependenciesToParse).arg(pluginsList[index].path); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Dependencies %1 are not satisfied, for plugin: %2").arg(dependenciesToParse).arg(pluginsList[index].path)); - pluginsListIndexed.remove(pluginsList.at(index).category,pluginsList.at(index)); + pluginsList[index].errorString=tr("Dependencies %1 are not satisfied, for plugin: %2").arg(QString::fromStdString(dependenciesToParse)).arg(QString::fromStdString(pluginsList[index].path)).toStdString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Dependencies "+dependenciesToParse+" are not satisfied, for plugin: "+pluginsList[index].path); + pluginsListIndexed.erase(pluginsListIndexed.find(pluginsList.at(index).category)); emit onePluginInErrorAdded(pluginsList.at(index)); errors++; break; } - indexOfDependencies++; } } sub_index++; @@ -524,26 +524,26 @@ quint32 PluginsManager::checkDependencies() #endif /// \brief get the version -QString PluginsManager::getPluginVersion(const QString &pluginName) const +std::string PluginsManager::getPluginVersion(const std::string &pluginName) const { #ifdef ULTRACOPIER_MODE_SUPERCOPIER - if(pluginName==QStringLiteral("supercopier")) - return ULTRACOPIER_VERSION; - #else - if(pluginName==QStringLiteral("ultracopier")) - return ULTRACOPIER_VERSION; - #endif - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - int index=0; + if(pluginName=="supercopier") + return ULTRACOPIER_VERSION; + #else + if(pluginName=="ultracopier") + return ULTRACOPIER_VERSION; + #endif + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + unsigned int index=0; while(index<pluginsList.size()) { - QString version,internalName; - int sub_index=0; + std::string version,internalName; + unsigned int sub_index=0; while(sub_index<pluginsList.at(index).informations.size()) { - if(pluginsList.at(index).informations.at(sub_index).size()==2 && pluginsList.at(index).informations.at(sub_index).at(0)==QStringLiteral("version")) + if(pluginsList.at(index).informations.at(sub_index).size()==2 && pluginsList.at(index).informations.at(sub_index).at(0)=="version") version=pluginsList.at(index).informations.at(sub_index).at(1); - if(pluginsList.at(index).informations.at(sub_index).size()==2 && pluginsList.at(index).informations.at(sub_index).at(0)==QStringLiteral("internalName")) + if(pluginsList.at(index).informations.at(sub_index).size()==2 && pluginsList.at(index).informations.at(sub_index).at(0)=="internalName") internalName=pluginsList.at(index).informations.at(sub_index).at(1); sub_index++; } @@ -554,45 +554,50 @@ QString PluginsManager::getPluginVersion(const QString &pluginName) const return ""; } -/// \brief To compare version -bool PluginsManager::compareVersion(const QString &versionA,const QString &sign,const QString &versionB) +/// \brief To compare version, \return true is case of error +bool PluginsManager::compareVersion(const std::string &versionA,const std::string &sign,const std::string &versionB) { - QStringList versionANumber=versionA.split(QStringLiteral(".")); - QStringList versionBNumber=versionB.split(QStringLiteral(".")); - int index=0; - int defaultReturnValue=true; - if(sign==QStringLiteral("<")) + std::vector<std::string> versionANumber=stringsplit(versionA,'.'); + std::vector<std::string> versionBNumber=stringsplit(versionB,'.'); + unsigned int index=0; + unsigned int defaultReturnValue=true; + if(sign=="<") defaultReturnValue=false; - if(sign==QStringLiteral(">")) + if(sign==">") defaultReturnValue=false; + bool ok; while(index<versionANumber.size() && index<versionBNumber.size()) { - unsigned int reaNumberA=versionANumber.at(index).toUInt(); - unsigned int reaNumberB=versionBNumber.at(index).toUInt(); - if(sign==QStringLiteral("=") && reaNumberA!=reaNumberB) + unsigned int reaNumberA=stringtouint8(versionANumber.at(index),&ok); + if(!ok) + return true; + unsigned int reaNumberB=stringtouint8(versionBNumber.at(index),&ok); + if(!ok) + return true; + if(sign=="=" && reaNumberA!=reaNumberB) return false; - if(sign==QStringLiteral("<")) + if(sign=="<") { if(reaNumberA>reaNumberB) return false; if(reaNumberA<reaNumberB) return true; } - if(sign==QStringLiteral(">")) + if(sign==">") { if(reaNumberA<reaNumberB) return false; if(reaNumberA>reaNumberB) return true; } - if(sign==QStringLiteral("<=")) + if(sign=="<=") { if(reaNumberA>reaNumberB) return false; if(reaNumberA<reaNumberB) return true; } - if(sign==QStringLiteral(">=")) + if(sign==">=") { if(reaNumberA<reaNumberB) return false; @@ -604,29 +609,31 @@ bool PluginsManager::compareVersion(const QString &versionA,const QString &sign, return defaultReturnValue; } -QList<PluginsAvailable> PluginsManager::getPluginsByCategory(const PluginType &category) const +std::vector<PluginsAvailable> PluginsManager::getPluginsByCategory(const PluginType &category) const { - return pluginsListIndexed.values(category); + if(pluginsListIndexed.find(category)==pluginsListIndexed.cend()) + return std::vector<PluginsAvailable>(); + return pluginsListIndexed.at(category); } -QList<PluginsAvailable> PluginsManager::getPlugins(bool withError) const +std::vector<PluginsAvailable> PluginsManager::getPlugins(bool withError) const { - QList<PluginsAvailable> list; - int index=0; + std::vector<PluginsAvailable> list; + unsigned int index=0; while(index<pluginsList.size()) { - if(withError || pluginsList.at(index).errorString.isEmpty()) - list<<pluginsList.at(index); + if(withError || pluginsList.at(index).errorString.empty()) + list.push_back(pluginsList.at(index)); index++; } return list; } /// \brief show the information -void PluginsManager::showInformation(const QString &path) +void PluginsManager::showInformation(const std::string &path) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - int index=0; + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + unsigned int index=0; while(index<pluginsList.size()) { if(pluginsList.at(index).path==path) @@ -643,7 +650,7 @@ void PluginsManager::showInformation(const QString &path) } index++; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("item not selected")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"item not selected"); } void PluginsManager::showInformationDoubleClick() @@ -652,17 +659,17 @@ void PluginsManager::showInformationDoubleClick() } #ifdef ULTRACOPIER_PLUGIN_IMPORT_SUPPORT -void PluginsManager::removeThePluginSelected(const QString &path) +void PluginsManager::removeThePluginSelected(const std::string &path) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - int index=0; + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + unsigned int index=0; while(index<pluginsList.size()) { if(pluginsList.at(index).path==path) { QMessageBox::StandardButton reply; // 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); + reply = QMessageBox::question(NULL,tr("Remove %1").arg(QString::fromStdString(pluginsList.at(index).name)),tr("Are you sure about removing \"%1\" in version %2?").arg(QString::fromStdString(pluginsList.at(index).name)).arg(QString::fromStdString(pluginsList.at(index).version)),QMessageBox::Yes|QMessageBox::No,QMessageBox::No); // else // reply = QMessageBox::question(NULL,tr("Remove %1").arg(getTranslatedText(pluginsList.at(index),"name",mainShortName)),tr("Are you sure to wish remove \"%1\" in version %2 for the internal version %3?").arg(getTranslatedText(pluginsList.at(index),"name",mainShortName)).arg(pluginsList.at(index).version).arg(pluginsList.at(index).internalVersionAlternative),QMessageBox::Yes|QMessageBox::No,QMessageBox::No); if(reply==QMessageBox::Yes) @@ -673,17 +680,17 @@ void PluginsManager::removeThePluginSelected(const QString &path) if(!ResourcesManager::removeFolder(pluginsList.at(index).path)) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to remove the plugin"); - 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)); + QMessageBox::critical(NULL,tr("Error"),tr("Error while the removing plugin, please check the rights on the folder: \n%1").arg(QString::fromStdString(pluginsList.at(index).path))); } - pluginsListIndexed.remove(pluginsList.at(index).category,pluginsList.at(index)); - pluginsList.removeAt(index); + pluginsListIndexed.erase(pluginsListIndexed.find(pluginsList.at(index).category)); + pluginsList.erase(pluginsList.begin()+index); while(checkDependencies()!=0){}; } return; } index++; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("item not selected")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"item not selected"); } void PluginsManager::addPlugin(const ImportBackend &backend) @@ -694,20 +701,20 @@ void PluginsManager::addPlugin(const ImportBackend &backend) void PluginsManager::executeTheFileBackendLoader() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); if(importingPlugin) { QMessageBox::information(NULL,tr("Information"),tr("Previous import is in progress...")); return; } - QString fileName = QFileDialog::getOpenFileName(NULL,tr("Open Ultracopier plugin"),QString(),tr("Ultracopier plugin (*.urc)")); + std::string fileName = QFileDialog::getOpenFileName(NULL,tr("Open Ultracopier plugin"),QString(),tr("Ultracopier plugin (*.urc)")).toStdString(); if(fileName!="") tryLoadPlugin(fileName); } -void PluginsManager::tryLoadPlugin(const QString &file) +void PluginsManager::tryLoadPlugin(const std::string &file) { - QFile temp(file); + QFile temp(QString::fromStdString(file)); if(temp.open(QIODevice::ReadOnly)) { importingPlugin=true; @@ -716,32 +723,32 @@ void PluginsManager::tryLoadPlugin(const QString &file) } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"unable to open the file: "+temp.errorString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"unable to open the file: "+temp.errorString().toStdString()); QMessageBox::critical(NULL,tr("Plugin loader"),tr("Unable to open the plugin: %1").arg(temp.errorString())); } } void PluginsManager::lunchDecodeThread(const QByteArray &data) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); decodeThread.setData(data); decodeThread.start(QThread::LowestPriority); } void PluginsManager::decodingFinished() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); if(!decodeThread.errorFound()) { QByteArray data=decodeThread.decodedData(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"data.size(): "+QString::number(data.size())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"data.size(): "+std::to_string(data.size())); QTarDecode tarFile; std::vector<char> cppdata; cppdata.resize(data.size()); memcpy(cppdata.data(),data.data(),data.size()); if(!tarFile.decodeData(cppdata)) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"tarFile.errorString(): "+QString::fromStdString(tarFile.errorString())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"tarFile.errorString(): "+tarFile.errorString()); QMessageBox::critical(NULL,tr("Plugin loader"),tr("Unable to load the plugin content, please check it: %1").arg(QString::fromStdString(tarFile.errorString()))); } else @@ -750,16 +757,16 @@ void PluginsManager::decodingFinished() std::vector<std::vector<char> > dataList = tarFile.getDataList(); if(fileList.size()>1) { - QString basePluginArchive=QStringLiteral(""); + std::string basePluginArchive=""; /* block use less for tar? if(fileList.at(0).contains(QRegularExpression("[\\/]"))) { bool folderFoundEveryWhere=true; basePluginArchive=fileList.at(0); - basePluginArchive.remove(QRegularExpression("[\\/].*$")); + basePluginArchive=std::regex_replace(basePluginArchive, std::regex("[\\/].*$"), ""); for (int i = 0; i < list.size(); ++i) { - if(!fileList.at(i).startsWith(basePluginArchive)) + if(!stringStartWith(fileList.at(i),basePluginArchive)) { folderFoundEveryWhere=false; break; @@ -768,17 +775,17 @@ void PluginsManager::decodingFinished() if(folderFoundEveryWhere) { for (int i = 0; i < fileList.size(); ++i) - fileList[i].remove(0,basePluginArchive.size()); + fileList[i].substr(basePluginArchive.size()); } else basePluginArchive=""; }*/ PluginsAvailable tempPlugin; - QString categoryFinal=QStringLiteral(""); + std::string categoryFinal=""; for (unsigned int i = 0; i < fileList.size(); ++i) if(fileList.at(i)=="informations.xml") { - loadPluginXml(&tempPlugin,QByteArray(dataList.at(i).data(),dataList.at(i).size())); + loadPluginXml(&tempPlugin,QByteArray(dataList.at(i).data(),static_cast<int>(dataList.at(i).size()))); break; } if(tempPlugin.errorString=="") @@ -786,43 +793,43 @@ void PluginsManager::decodingFinished() categoryFinal=categoryToString(tempPlugin.category); if(categoryFinal!="") { - QString writablePath=ResourcesManager::resourcesManager->getWritablePath(); + std::string writablePath=ResourcesManager::resourcesManager->getWritablePath(); if(writablePath!="") { QDir dir; - QString finalPluginPath=writablePath+categoryFinal+QDir::separator()+tempPlugin.name+QDir::separator(); + std::string finalPluginPath=writablePath+categoryFinal+FacilityEngine::separator()+tempPlugin.name+FacilityEngine::separator(); ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"writablePath: \""+writablePath+"\""); ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"basePluginArchive: \""+basePluginArchive+"\""); ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"categoryFinal: \""+categoryFinal+"\""); ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"finalPluginPath: \""+finalPluginPath+"\""); - if(!dir.exists(finalPluginPath)) + if(!dir.exists(QString::fromStdString(finalPluginPath))) { bool errorFound=false; for (unsigned int i = 0; i < fileList.size(); ++i) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"file "+QString::number(i)+": "+finalPluginPath+QString::fromStdString(fileList.at(i))); - QString fileListEntry=QString::fromStdString(fileList[i]); - fileListEntry.remove(QRegularExpression("^(..?[\\/])+")); - QFile currentFile(finalPluginPath+fileListEntry); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"file "+std::to_string(i)+": "+finalPluginPath+fileList.at(i)); + std::string fileListEntry=fileList[i]; + fileListEntry=std::regex_replace(fileListEntry, std::regex("^(..?[\\/])+"), ""); + QFile currentFile(QString::fromStdString(finalPluginPath+fileListEntry)); QFileInfo info(currentFile); if(!dir.exists(info.absolutePath())) if(!dir.mkpath(info.absolutePath())) { ResourcesManager::resourcesManager->disableWritablePath(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"Unable to make the path: "+info.absolutePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"Unable to make the path: "+info.absolutePath().toStdString()); QMessageBox::critical(NULL,tr("Plugin loader"),tr("Unable to create a folder to install the plugin:\n%1").arg(info.absolutePath())); errorFound=true; break; } if(currentFile.open(QIODevice::ReadWrite)) { - currentFile.write(QByteArray(dataList.at(i).data(),dataList.at(i).size())); + currentFile.write(QByteArray(dataList.at(i).data(),static_cast<int>(dataList.at(i).size()))); currentFile.close(); } else { ResourcesManager::resourcesManager->disableWritablePath(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"Unable to make the file: "+info.absolutePath()+", error:"+currentFile.errorString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"Unable to make the file: "+info.absolutePath().toStdString()+", error:"+currentFile.errorString().toStdString()); QMessageBox::critical(NULL,tr("Plugin loader"),tr("Unable to create a file to install the plugin:\n%1\nsince:%2").arg(info.absolutePath()).arg(currentFile.errorString())); errorFound=true; break; @@ -842,7 +849,7 @@ void PluginsManager::decodingFinished() else { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"Folder with same name is present, skip the plugin installation: "+finalPluginPath); - QMessageBox::critical(NULL,tr("Plugin loader"),tr("Folder with same name is present, skip the plugin installation:\n%1").arg(finalPluginPath)); + QMessageBox::critical(NULL,tr("Plugin loader"),tr("Folder with same name is present, skip the plugin installation:\n%1").arg(QString::fromStdString(finalPluginPath))); } } else @@ -860,7 +867,7 @@ void PluginsManager::decodingFinished() else { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Error in the xml: "+tempPlugin.errorString); - QMessageBox::critical(NULL,tr("Plugin loader"),tr("Unable to load the plugin content, please check it: %1").arg(tempPlugin.errorString)); + QMessageBox::critical(NULL,tr("Plugin loader"),tr("Unable to load the plugin content, please check it: %1").arg(QString::fromStdString(tempPlugin.errorString))); } } else @@ -872,7 +879,7 @@ void PluginsManager::decodingFinished() } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"decodeThread.errorFound(), error: "+decodeThread.errorString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"decodeThread.errorFound(), error: "+decodeThread.errorString().toStdString()); QMessageBox::critical(NULL,tr("Plugin loader"),tr("Unable to load the plugin content, please check it: %1").arg(decodeThread.errorString())); } importingPlugin=false; @@ -880,10 +887,10 @@ void PluginsManager::decodingFinished() #endif #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE -void PluginsManager::newAuthPath(const QString &path) +void PluginsManager::newAuthPath(const std::string &path) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - int index=0; + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + unsigned int index=0; while(index<pluginsList.size()) { if(pluginsList.at(index).path==path) @@ -898,21 +905,21 @@ void PluginsManager::newAuthPath(const QString &path) #endif /// \brief transfor short plugin name into file name -QString PluginsManager::getResolvedPluginName(const QString &name) +std::string PluginsManager::getResolvedPluginName(const std::string &name) { #if defined(Q_OS_LINUX) - return QStringLiteral("lib")+name+QStringLiteral(".so"); + return "lib"+name+".so"; #elif defined(Q_OS_MAC) #if defined(QT_DEBUG) - return QStringLiteral("lib")+name+QStringLiteral("_debug.dylib"); + return "lib"+name+"_debug.dylib"; #else - return QStringLiteral("lib")+name+QStringLiteral(".dylib"); + return "lib"+name+".dylib"; #endif #elif defined(Q_OS_WIN32) #if defined(QT_DEBUG) - return name+QStringLiteral("d.dll"); + return name+"d.dll"; #else - return name+QStringLiteral(".dll"); + return name+".dll"; #endif #else #error "Platform not supported" diff --git a/PluginsManager.h b/PluginsManager.h index 9b3ecc9..4e24839 100644 --- a/PluginsManager.h +++ b/PluginsManager.h @@ -21,6 +21,8 @@ #include <QSemaphore> #include <QRegularExpression> #include <QThread> +#include <map> +#include <regex> #include "Environment.h" #include "OptionEngine.h" @@ -43,23 +45,23 @@ class PluginsManager : public QThread Q_OBJECT public: /// \brief to get plugins of type specific - QList<PluginsAvailable> getPluginsByCategory(const PluginType &type) const; + std::vector<PluginsAvailable> getPluginsByCategory(const PluginType &type) const; /** \brief to get plugins */ - QList<PluginsAvailable> getPlugins(bool withError=false) const; + std::vector<PluginsAvailable> getPlugins(bool withError=false) const; /// \brief get translated text //QString getTranslatedText(PluginsAvailable plugin,QString informationName,QString mainShortName); //QString getTranslatedText(PluginsAvailable plugin,QString informationName); /// \brief transform short plugin name into file name - static QString getResolvedPluginName(const QString &name); + static std::string getResolvedPluginName(const std::string &name); static bool isSamePlugin(const PluginsAvailable &pluginA,const PluginsAvailable &pluginB); void lockPluginListEdition(); void unlockPluginListEdition(); bool allPluginHaveBeenLoaded() const; /// \brief to load the get dom specific - QString getDomSpecific(const QDomElement &root,const QString &name,const QList<QPair<QString,QString> > &listChildAttribute) const; - QString getDomSpecific(const QDomElement &root,const QString &name) const; + std::string getDomSpecific(const QDomElement &root,const std::string &name,const std::vector<std::pair<std::string,std::string> > &listChildAttribute) const; + std::string getDomSpecific(const QDomElement &root,const std::string &name) const; /// \brief set current language - void setLanguage(const QString &language); + void setLanguage(const std::string &language); /// \brief Enumeration of plugin add backend enum ImportBackend { @@ -71,22 +73,22 @@ class PluginsManager : public QThread PluginsManager(); /// \brief Destroy the language manager ~PluginsManager(); - /// \brief To compare version - static bool compareVersion(const QString &versionA,const QString &sign,const QString &versionB); + /// \brief To compare version, \return true is case of error + static bool compareVersion(const std::string &versionA,const std::string &sign,const std::string &versionB); private: /// \brief List of plugins - QList<PluginsAvailable> pluginsList; - QMultiMap<PluginType,PluginsAvailable> pluginsListIndexed; + std::vector<PluginsAvailable> pluginsList; + std::map<PluginType,std::vector<PluginsAvailable> > pluginsListIndexed; /// \brief to load the multi-language balise - void loadBalise(const QDomElement &root,const QString &name,QList<QStringList> *informations,QString *errorString,bool needHaveOneEntryMinimum=true,bool multiLanguage=false,bool englishNeedBeFound=false); + void loadBalise(const QDomElement &root,const std::string &name,std::vector<std::vector<std::string> > *informations,std::string *errorString,bool needHaveOneEntryMinimum=true,bool multiLanguage=false,bool englishNeedBeFound=false); /// \brief get the version - QString getPluginVersion(const QString &pluginName) const; + std::string getPluginVersion(const std::string &pluginName) const; /// \brief list of cat plugin type //QStringList catPlugin; - QStringList englishPluginType; - QList<QTreeWidgetItem *> catItemList; + std::vector<std::string> englishPluginType; + std::vector<QTreeWidgetItem *> catItemList; /// \brief store the current mainShortName - QString mainShortName; + std::string mainShortName; /// \brief load the plugin list void loadPluginList(); #ifdef ULTRACOPIER_PLUGIN_IMPORT_SUPPORT @@ -98,19 +100,19 @@ class PluginsManager : public QThread #endif #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE /// \brief check the dependencies, return number of error - quint32 checkDependencies(); + uint32_t checkDependencies(); #endif void loadPluginXml(PluginsAvailable * thePlugin,const QByteArray &xml); - QStringList readPluginPath; - bool loadPluginInformation(const QString &path); + std::vector<std::string> readPluginPath; + bool loadPluginInformation(const std::string &path); QSemaphore editionSemList; bool stopIt; bool pluginLoaded; - QString language; - QString categoryToString(const PluginType &category) const; - QString categoryToTranslation(const PluginType &category); - QRegularExpression regexp_to_clean_1,regexp_to_clean_2,regexp_to_clean_3,regexp_to_clean_4,regexp_to_clean_5; - QRegularExpression regexp_to_dep_1,regexp_to_dep_2,regexp_to_dep_3,regexp_to_dep_4,regexp_to_dep_5,regexp_to_dep_6; + std::string language; + std::string categoryToString(const PluginType &category) const; + std::string categoryToTranslation(const PluginType &category); + std::regex regexp_to_clean_1,regexp_to_clean_2,regexp_to_clean_3,regexp_to_clean_4,regexp_to_clean_5; + std::regex regexp_to_dep_1,regexp_to_dep_2,regexp_to_dep_3,regexp_to_dep_4,regexp_to_dep_5,regexp_to_dep_6; PluginInformation *pluginInformation; private slots: /// \brief show the information @@ -119,7 +121,7 @@ class PluginsManager : public QThread void decodingFinished(); #endif #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE - void newAuthPath(const QString &path); + void newAuthPath(const std::string &path); #endif void post_operation(); /* public slots: @@ -141,11 +143,11 @@ class PluginsManager : public QThread protected: void run(); public slots: //do gui action - void showInformation(const QString &path); + void showInformation(const std::string &path); #ifdef ULTRACOPIER_PLUGIN_IMPORT_SUPPORT - void removeThePluginSelected(const QString &path); + void removeThePluginSelected(const std::string &path); void addPlugin(const ImportBackend &backend); - void tryLoadPlugin(const QString &file); + void tryLoadPlugin(const std::string &file); #endif }; @@ -2,8 +2,8 @@ Description ===========================================
=======================================================
-Ultracopier (http://ultracopier.first-world.info/) is free and open
-source software licensed under GPL3 that acts as a replacement for
+Ultracopier (https://ultracopier.first-world.info/) is free and open
+source software licensed under GPLv3 that acts as a replacement for
files copy dialogs.
Main features include:
@@ -16,13 +16,13 @@ Main features include: Changelog =============================================
=======================================================
You can have the changelog at this url (or search on the forum):
-http://forum-ultracopier.first-world.info/the-announces/changelog-for-ultracopier-1-0-x-x-supercopier-4-0-x-x-t406.html
+https://forum-ultracopier.first-world.info/the-announces/changelog-for-ultracopier-1-0-x-x-supercopier-4-0-x-x-t406.html
=======================================================
License ===============================================
=======================================================
Ultracopier is licensed under the GNU General Public License version 3.
-The text of the GNU General Public License can be viewed at http://www.gnu.org/licenses/gpl.html
+The text of the GNU General Public License can be viewed at https://www.gnu.org/licenses/gpl.html
See COPYING file.
=======================================================
@@ -30,17 +30,17 @@ Core Developers ======================================= =======================================================
BRULE Herman or alpha_one_x86 <ultracopier@first-world.info>
- Original author, API, kio_slaves, source
-See the Development team section of http://ultracopier.first-world.info/contact.html for an updated list of Ultracopier team!
+See the Development team section of https://ultracopier.first-world.info/contact.html for an updated list of Ultracopier team!
=======================================================
Building and documentation ============================
=======================================================
-See the wiki for the general documentation and how to for building: http://ultracopier-wiki.first-world.info/
-For the code documentation: http://doc-ultracopier.first-world.info/ (generated by doxygen)
+See the wiki for the general documentation and how to for building: https://ultracopier-wiki.first-world.info/
+For the code documentation: https://doc-ultracopier.first-world.info/ (generated by doxygen)
The source proposed on the site is reconstritued source from: https://github.com/alphaonex86/Ultracopier to facilitate contribute effort.
-Prefer ultracopier-all-in-one-direct.pro to have easy and NO modular software. This is more oriented to Linux and Mac.
+Prefer ultracopier-all-in-one-direct.pro to have easy and NO modular software. This is more oriented to GNU/Linux and macOS.
======================================================
Warranty =============================================
======================================================
-Ultracopier in all version is shipped without warranty (0% of warranty). Only the stable version have warranty of be tested in lot of case. But in any case have warranty about data security, or other way of warranty.
\ No newline at end of file +Ultracopier in all version is shipped without warranty (0% of warranty). Only the stable version have warranty of be tested in lot of case. But in any case have warranty about data security, or other way of warranty.
diff --git a/ResourcesManager.cpp b/ResourcesManager.cpp index 96fb894..32106a8 100644 --- a/ResourcesManager.cpp +++ b/ResourcesManager.cpp @@ -8,18 +8,19 @@ #include <QApplication> #include <QFileInfo> - +#include "cpp11addition.h" #include "ResourcesManager.h" +#include "FacilityEngine.h" -QRegularExpression ResourcesManager::slashEnd; +std::regex ResourcesManager::slashEnd; /// \brief Create the manager and load the defaults variables ResourcesManager::ResourcesManager() { - slashEnd=QRegularExpression(QStringLiteral("[/\\\\]$")); + slashEnd=std::regex("[/\\\\]$"); //load the internal path - searchPath<<QString(QStringLiteral(":/")); + searchPath.push_back(":/"); #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE //load the user path but only if exists and writable //load the ultracopier path @@ -31,15 +32,15 @@ ResourcesManager::ResourcesManager() dir.cdUp(); dir.cdUp(); dir.cd(QStringLiteral("Data"); - searchPath<<ResourcesManager::AddSlashIfNeeded(dir.absolutePath()); - writablePath=ResourcesManager::AddSlashIfNeeded(dir.absolutePath()); + searchPath.push_back(ResourcesManager::AddSlashIfNeeded(dir.absolutePath().toStdString())); + writablePath=ResourcesManager::AddSlashIfNeeded(dir.absolutePath().toStdString()); #else ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"Ultracopier is compiled with the flag: ULTRACOPIER_VERSION_PORTABLE"); //load the ultracopier path QDir dir(QApplication::applicationDirPath()); dir.cd(QStringLiteral("Data")); - searchPath<<ResourcesManager::AddSlashIfNeeded(dir.absolutePath()); - writablePath=ResourcesManager::AddSlashIfNeeded(dir.absolutePath()); + searchPath.push_back(ResourcesManager::AddSlashIfNeeded(dir.absolutePath().toStdString())); + writablePath=ResourcesManager::AddSlashIfNeeded(dir.absolutePath().toStdString()); #endif #else ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"Ultracopier is compiled as user privacy mode"); @@ -51,41 +52,40 @@ ResourcesManager::ResourcesManager() #ifdef Q_OS_LINUX QDir linuxArchIndepDir(QStringLiteral("/usr/share/ultracopier/")); if(linuxArchIndepDir.exists()) - searchPath<<ResourcesManager::AddSlashIfNeeded(linuxArchIndepDir.absolutePath()); + searchPath.push_back(ResourcesManager::AddSlashIfNeeded(linuxArchIndepDir.absolutePath().toStdString())); QDir linuxPluginsDir(QStringLiteral("/usr/lib/ultracopier/")); if(linuxPluginsDir.exists()) - searchPath<<ResourcesManager::AddSlashIfNeeded(linuxPluginsDir.absolutePath()); + searchPath.push_back(ResourcesManager::AddSlashIfNeeded(linuxPluginsDir.absolutePath().toStdString())); #endif //load the user path but only if exists and writable QDir dir(QDir::homePath()+EXTRA_HOME_PATH); if(dir.exists()) { - writablePath=ResourcesManager::AddSlashIfNeeded(dir.absolutePath()); - searchPath<<ResourcesManager::AddSlashIfNeeded(dir.absolutePath()); + writablePath=ResourcesManager::AddSlashIfNeeded(dir.absolutePath().toStdString()); + searchPath.push_back(ResourcesManager::AddSlashIfNeeded(dir.absolutePath().toStdString())); } //if not exists try to create it else if(dir.mkpath(dir.absolutePath())) { //if created, then have write permissions - writablePath=ResourcesManager::AddSlashIfNeeded(dir.absolutePath()); - searchPath<<ResourcesManager::AddSlashIfNeeded(dir.absolutePath()); + writablePath=ResourcesManager::AddSlashIfNeeded(dir.absolutePath().toStdString()); + searchPath.push_back(ResourcesManager::AddSlashIfNeeded(dir.absolutePath().toStdString())); } //load the ultracopier path - searchPath<<ResourcesManager::AddSlashIfNeeded(QApplication::applicationDirPath()); + searchPath.push_back(ResourcesManager::AddSlashIfNeeded(QApplication::applicationDirPath().toStdString())); #endif #else QDir dir(QApplication::applicationDirPath()); - writablePath=ResourcesManager::AddSlashIfNeeded(dir.absolutePath()); + writablePath=ResourcesManager::AddSlashIfNeeded(dir.absolutePath().toStdString()); #endif - searchPath.removeDuplicates(); + vectorRemoveDuplicatesForSmallList(searchPath); #ifdef ULTRACOPIER_DEBUG - int index=0; - const int &loop_size=searchPath.size(); - while(index<loop_size) //look at each val + unsigned int index=0; + while(index<searchPath.size()) //look at each val { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("searchPath.at(")+QString::number(index)+QStringLiteral("): ")+searchPath.at(index)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"searchPath.at("+std::to_string(index)+"): "+searchPath.at(index)); index++; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("writablePath: ")+writablePath); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"writablePath: "+writablePath); #endif // ULTRACOPIER_DEBUG } @@ -95,47 +95,44 @@ ResourcesManager::~ResourcesManager() } /// \brief Get folder presence and the path -QString ResourcesManager::getFolderReadPath(const QString &path) const +std::string ResourcesManager::getFolderReadPath(const std::string &path) const { - int index=0; - const int &loop_size=searchPath.size(); - while(index<loop_size) //look at each val + unsigned int index=0; + while(index<searchPath.size()) //look at each val { - QDir dir(searchPath.at(index)+path); + QDir dir(QString::fromStdString(searchPath.at(index)+path)); if(dir.exists()) // if the path have been found, then return the full path - return ResourcesManager::AddSlashIfNeeded(dir.absolutePath()); + return ResourcesManager::AddSlashIfNeeded(dir.absolutePath().toStdString()); index++; } - return QStringLiteral(""); + return std::string(); } /// \brief Get folder presence, the path and check in the folder and sub-folder the file presence -QString ResourcesManager::getFolderReadPathMultiple(const QString &path,const QStringList &fileToCheck) const +std::string ResourcesManager::getFolderReadPathMultiple(const std::string &path,const std::vector<std::string> &fileToCheck) const { - int index=0; - const int &loop_size=searchPath.size(); - while(index<loop_size) //look at each val + unsigned int index=0; + while(index<searchPath.size()) //look at each val { - QDir dir(searchPath.at(index)+path); - if(checkFolderContent(dir.absolutePath(),fileToCheck)) - return dir.absolutePath()+QDir::separator(); + QDir dir(QString::fromStdString(searchPath.at(index)+path)); + if(checkFolderContent(dir.absolutePath().toStdString(),fileToCheck)) + return dir.absolutePath().toStdString()+FacilityEngine::separator(); index++; } - return QStringLiteral(""); + return std::string(); } -bool ResourcesManager::checkFolderContent(const QString &path,const QStringList &fileToCheck) const +bool ResourcesManager::checkFolderContent(const std::string &path,const std::vector<std::string> &fileToCheck) const { - QDir dir(path); + QDir dir(QString::fromStdString(path)); if(dir.exists()) // if the path have been found, then return the full path { bool allFileToCheckIsFound=true; - int index=0; - const int &loop_size=fileToCheck.size(); - QString partialPath=ResourcesManager::AddSlashIfNeeded(dir.absolutePath()); - while(index<loop_size) //look at each val + unsigned int index=0; + std::string partialPath=ResourcesManager::AddSlashIfNeeded(dir.absolutePath().toStdString()); + while(index<fileToCheck.size()) //look at each val { - if(!QFile::exists(partialPath+fileToCheck.at(index))) //if a file have been not found, consider the folder as not suitable + if(!QFile::exists(QString::fromStdString(partialPath+fileToCheck.at(index)))) //if a file have been not found, consider the folder as not suitable { allFileToCheckIsFound=false; break; @@ -149,16 +146,18 @@ bool ResourcesManager::checkFolderContent(const QString &path,const QStringList } /// \brief add / or \ in function of the platform at the end of path if both / and \ are not found -QString ResourcesManager::AddSlashIfNeeded(const QString &path) +std::string ResourcesManager::AddSlashIfNeeded(const std::string &path) { - if(path.contains(slashEnd)) + if(path.empty()) + return "/"; + if(path.at(path.size()-1)=='/') return path; else - return path+QDir::separator(); + return path+FacilityEngine::separator(); } /// \brief get the writable path -QString ResourcesManager::getWritablePath() const +const std::string &ResourcesManager::getWritablePath() const { return writablePath; } @@ -167,25 +166,25 @@ QString ResourcesManager::getWritablePath() const bool ResourcesManager::disableWritablePath() { bool returnVal=true; - if(writablePath.isEmpty()) + if(writablePath.empty()) returnVal=false; else - writablePath=QStringLiteral(""); + writablePath.clear(); return returnVal; } /// \brief get the read path -QStringList ResourcesManager::getReadPath() const +const std::vector<std::string> &ResourcesManager::getReadPath() const { return searchPath; } /// \brief remove folder -bool ResourcesManager::removeFolder(const QString &dir) +bool ResourcesManager::removeFolder(const std::string &dir) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"folder to remove: "+dir); bool errorFound=false; - QDir currentDir(dir); + QDir currentDir(QString::fromStdString(dir)); QFileInfoList files = currentDir.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot); int index=0; const int &loop_size=files.size(); @@ -197,18 +196,18 @@ bool ResourcesManager::removeFolder(const QString &dir) if(!file.remove()) { errorFound=true; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"remove file failed: "+file.errorString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"remove file failed: "+file.errorString().toStdString()); } else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"file removed: "+file.fileName()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"file removed: "+file.fileName().toStdString()); } else if(files.at(index).isDir()) - removeFolder(files.at(index).absoluteFilePath()); + removeFolder(files.at(index).absoluteFilePath().toStdString()); else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unknow file type for: "+files.at(index).absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unknow file type for: "+files.at(index).absoluteFilePath().toStdString()); index++; } - if(!currentDir.rmpath(dir)) + if(!currentDir.rmpath(QString::fromStdString(dir))) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"remove path failed, check right and if is empty: "+dir); errorFound=true; diff --git a/ResourcesManager.h b/ResourcesManager.h index 7704d47..fec25da 100644 --- a/ResourcesManager.h +++ b/ResourcesManager.h @@ -9,7 +9,7 @@ #include <QStringList> #include <QString> #include <QObject> -#include <QRegularExpression> +#include <regex> #include "Environment.h" @@ -27,28 +27,28 @@ class ResourcesManager : public QObject static ResourcesManager *resourcesManager; /** \brief Get folder presence and the path \return Empty QString if not found */ - QString getFolderReadPath(const QString &path) const; + std::string getFolderReadPath(const std::string &path) const; /** \brief Get folder presence, the path and check in the folder and sub-folder the file presence \return Empty QString if not found */ - QString getFolderReadPathMultiple(const QString &path,const QStringList &fileToCheck) const; - bool checkFolderContent(const QString &path,const QStringList &fileToCheck) const; + std::string getFolderReadPathMultiple(const std::string &path,const std::vector<std::string> &fileToCheck) const; + bool checkFolderContent(const std::string &path,const std::vector<std::string> &fileToCheck) const; /// \brief add / or \ in function of the platform at the end of path if both / and \ are not found - static QString AddSlashIfNeeded(const QString &path); + static std::string AddSlashIfNeeded(const std::string &path); /// \brief get the writable path - QString getWritablePath() const; + const std::string &getWritablePath() const; /// \brief disable the writable path, if ultracopier is unable to write into bool disableWritablePath(); /// \brief get the read path - QStringList getReadPath() const; + const std::vector<std::string> &getReadPath() const; /// \brief remove folder - static bool removeFolder(const QString &dir); + static bool removeFolder(const std::string &dir); private: /// \brief List of the path to read only access - QStringList searchPath; + std::vector<std::string> searchPath; /// \brief The writable path, empty if not found - QString writablePath; + std::string writablePath; /// \brief match with slash end - static QRegularExpression slashEnd; + static std::regex slashEnd; }; #endif // RESOURCES_MANAGER_H diff --git a/SessionLoader.cpp b/SessionLoader.cpp index 21cca9b..1266e2f 100644 --- a/SessionLoader.cpp +++ b/SessionLoader.cpp @@ -5,11 +5,12 @@ #include "SessionLoader.h" #include "LanguagesManager.h" +#include "cpp11addition.h" #ifndef ULTRACOPIER_VERSION_PORTABLE SessionLoader::SessionLoader(OptionDialog *optionDialog) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); this->optionDialog=optionDialog; //load the options connect(OptionEngine::optionEngine,&OptionEngine::newOptionValue, this, &SessionLoader::newOptionValue,Qt::QueuedConnection); @@ -20,26 +21,25 @@ SessionLoader::SessionLoader(OptionDialog *optionDialog) #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE connect(PluginsManager::pluginsManager,&PluginsManager::onePluginWillBeRemoved, this,&SessionLoader::onePluginWillBeRemoved,Qt::DirectConnection); #endif - QList<PluginsAvailable> list=PluginsManager::pluginsManager->getPluginsByCategory(PluginType_SessionLoader); + std::vector<PluginsAvailable> list=PluginsManager::pluginsManager->getPluginsByCategory(PluginType_SessionLoader); foreach(PluginsAvailable currentPlugin,list) emit previouslyPluginAdded(currentPlugin); PluginsManager::pluginsManager->unlockPluginListEdition(); - shouldEnabled=OptionEngine::optionEngine->getOptionValue(QStringLiteral("SessionLoader"),QStringLiteral("LoadAtSessionStarting")).toBool(); + shouldEnabled=stringtobool(OptionEngine::optionEngine->getOptionValue("SessionLoader","LoadAtSessionStarting")); } SessionLoader::~SessionLoader() { #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT - int index=0; - const int &loop_size=pluginList.size(); - while(index<loop_size) + unsigned int index=0; + while(index<pluginList.size()) { if(pluginList.at(index).pluginLoader!=NULL) { if(!pluginList.at(index).pluginLoader->isLoaded() || pluginList.at(index).pluginLoader->unload()) { delete pluginList.at(index).options; - pluginList.removeAt(index); + pluginList.erase(pluginList.begin()+index); } } index++; @@ -52,10 +52,10 @@ void SessionLoader::onePluginAdded(const PluginsAvailable &plugin) #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT if(plugin.category!=PluginType_SessionLoader) return; - int index=0; + unsigned int index=0; LocalPlugin newEntry; - QString pluginPath=plugin.path+PluginsManager::getResolvedPluginName(QStringLiteral("sessionLoader")); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("try load: ")+pluginPath); + std::string pluginPath=plugin.path+PluginsManager::getResolvedPluginName("sessionLoader"); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"try load: "+pluginPath); #ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE PluginInterface_SessionLoader *sessionLoader; @@ -72,23 +72,23 @@ void SessionLoader::onePluginAdded(const PluginsAvailable &plugin) } if(index==objectList.size()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("static session loader not found")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"static session loader not found"); return; } newEntry.pluginLoader=NULL; #else - QPluginLoader *pluginLoader= new QPluginLoader(pluginPath); + QPluginLoader *pluginLoader= new QPluginLoader(QString::fromStdString(pluginPath)); newEntry.pluginLoader=pluginLoader; QObject *pluginInstance = pluginLoader->instance(); if(!pluginInstance) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("unable to load the plugin: ")+pluginLoader->errorString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to load the plugin: "+pluginLoader->errorString().toStdString()); return; } PluginInterface_SessionLoader *sessionLoader = qobject_cast<PluginInterface_SessionLoader *>(pluginInstance); if(!sessionLoader) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("unable to cast the plugin: ")+pluginLoader->errorString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to cast the plugin: "+pluginLoader->errorString().toStdString()); return; } //check if found @@ -97,7 +97,7 @@ void SessionLoader::onePluginAdded(const PluginsAvailable &plugin) { if(pluginList.at(index).sessionLoaderInterface==sessionLoader) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Plugin already found")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Plugin already found"); pluginLoader->unload(); return; } @@ -107,14 +107,14 @@ void SessionLoader::onePluginAdded(const PluginsAvailable &plugin) #ifdef ULTRACOPIER_DEBUG connect(sessionLoader,&PluginInterface_SessionLoader::debugInformation,this,&SessionLoader::debugInformation); #endif // ULTRACOPIER_DEBUG - newEntry.options=new LocalPluginOptions(QStringLiteral("SessionLoader-")+plugin.name); + newEntry.options=new LocalPluginOptions("SessionLoader-"+plugin.name); newEntry.sessionLoaderInterface=sessionLoader; newEntry.path=plugin.path; newEntry.sessionLoaderInterface->setResources(newEntry.options,plugin.writablePath,plugin.path,ULTRACOPIER_VERSION_PORTABLE_BOOL); newEntry.sessionLoaderInterface->setEnabled(shouldEnabled); optionDialog->addPluginOptionWidget(PluginType_SessionLoader,plugin.name,newEntry.sessionLoaderInterface->options()); connect(LanguagesManager::languagesManager,&LanguagesManager::newLanguageLoaded,newEntry.sessionLoaderInterface,&PluginInterface_SessionLoader::newLanguageLoaded); - pluginList << newEntry; + pluginList.push_back(newEntry); #else Q_UNUSED(plugin); return; @@ -126,8 +126,8 @@ void SessionLoader::onePluginWillBeRemoved(const PluginsAvailable &plugin) { if(plugin.category!=PluginType_SessionLoader) return; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start")); - int index=0; + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + unsigned int index=0; while(index<pluginList.size()) { if(plugin.path==pluginList.at(index).path) @@ -137,7 +137,7 @@ void SessionLoader::onePluginWillBeRemoved(const PluginsAvailable &plugin) if(!pluginList.at(index).pluginLoader->isLoaded() || pluginList.at(index).pluginLoader->unload()) { delete pluginList.at(index).options; - pluginList.removeAt(index); + pluginList.erase(pluginList.begin()+index); } } break; @@ -147,13 +147,13 @@ void SessionLoader::onePluginWillBeRemoved(const PluginsAvailable &plugin) } #endif -void SessionLoader::newOptionValue(const QString &groupName,const QString &variableName,const QVariant &value) +void SessionLoader::newOptionValue(const std::string &groupName,const std::string &variableName,const std::string &value) { - if(groupName==QStringLiteral("SessionLoader") && variableName==QStringLiteral("LoadAtSessionStarting")) + if(groupName=="SessionLoader" && variableName=="LoadAtSessionStarting") { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start, value: %1").arg(value.toBool())); - shouldEnabled=value.toBool(); - int index=0; + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, value: "+value); + shouldEnabled=stringtobool(value); + unsigned int index=0; while(index<pluginList.size()) { pluginList.at(index).sessionLoaderInterface->setEnabled(shouldEnabled); @@ -163,9 +163,9 @@ void SessionLoader::newOptionValue(const QString &groupName,const QString &varia } #ifdef ULTRACOPIER_DEBUG -void SessionLoader::debugInformation(const Ultracopier::DebugLevel &level,const QString& fonction,const QString& text,const QString& file,const int& ligne) +void SessionLoader::debugInformation(const Ultracopier::DebugLevel &level,const std::string& fonction,const std::string& text,const std::string& file,const int& ligne) { - DebugEngine::addDebugInformationStatic(level,fonction,text,file,ligne,QStringLiteral("Session loader plugin")); + DebugEngine::addDebugInformationStatic(level,fonction,text,file,ligne,"Session loader plugin"); } #endif // ULTRACOPIER_DEBUG #endif // !defined(ULTRACOPIER_PLUGIN_ALL_IN_ONE) || !defined(ULTRACOPIER_VERSION_PORTABLE) diff --git a/SessionLoader.h b/SessionLoader.h index c14f0f5..7889284 100644 --- a/SessionLoader.h +++ b/SessionLoader.h @@ -35,9 +35,9 @@ class SessionLoader : public QObject #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE void onePluginWillBeRemoved(const PluginsAvailable &plugin); #endif - void newOptionValue(const QString &groupName,const QString &variableName,const QVariant &value); + void newOptionValue(const std::string &groupName,const std::string &variableName,const std::string &value); #ifdef ULTRACOPIER_DEBUG - void debugInformation(const Ultracopier::DebugLevel &level,const QString& fonction,const QString& text,const QString& file,const int& ligne); + void debugInformation(const Ultracopier::DebugLevel &level,const std::string& fonction,const std::string& text,const std::string& file,const int& ligne); #endif // ULTRACOPIER_DEBUG private: //variable @@ -47,10 +47,10 @@ class SessionLoader : public QObject #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT QPluginLoader * pluginLoader; #endif - QString path; + std::string path; LocalPluginOptions *options; }; - QList<LocalPlugin> pluginList; + std::vector<LocalPlugin> pluginList; bool shouldEnabled; OptionDialog *optionDialog; signals: diff --git a/StructEnumDefinition.h b/StructEnumDefinition.h index 0d3eb68..e8f8de2 100644 --- a/StructEnumDefinition.h +++ b/StructEnumDefinition.h @@ -3,9 +3,8 @@ \author alpha_one_x86 \licence GPL3, see the file COPYING */ -#include <QVariant> -#include <QString> -#include <QList> +#include <string> +#include <stdint.h> #ifndef STRUCTDEF_H #define STRUCTDEF_H @@ -89,9 +88,9 @@ enum SizeUnit /// \brief structure for decompossed time struct TimeDecomposition { - quint16 second; - quint16 minute; - quint16 hour; + uint16_t second; + uint16_t minute; + uint16_t hour; }; //////////////////////////// Return list ////////////////////////////// @@ -111,23 +110,23 @@ enum ActionTypeCopyList /// \brief structure for progression item struct ProgressionItem { - quint64 id; - quint64 currentRead; - quint64 currentWrite; - quint64 total; + uint64_t id; + uint64_t currentRead; + uint64_t currentWrite; + uint64_t total; }; /// \brief item to insert item in the interface struct ItemOfCopyList { - quint64 id; + uint64_t id; // if type == CustomOperation, then is the translated name of the operation - QString sourceFullPath;///< full path with file name: /foo/foo.txt - QString sourceFileName;///< full path with file name: foo.txt - QString destinationFullPath;///< full path with file name: /foo/foo.txt - QString destinationFileName;///< full path with file name: foo.txt + std::string sourceFullPath;///< full path with file name: /foo/foo.txt + std::string sourceFileName;///< full path with file name: foo.txt + std::string destinationFullPath;///< full path with file name: /foo/foo.txt + std::string destinationFileName;///< full path with file name: foo.txt // if type == CustomOperation, then 0 = without progression, 1 = with progression - quint64 size; + uint64_t size; CopyMode mode; }; diff --git a/StructEnumDefinition_UltracopierSpecific.h b/StructEnumDefinition_UltracopierSpecific.h index 4f4fd89..480b7cb 100644 --- a/StructEnumDefinition_UltracopierSpecific.h +++ b/StructEnumDefinition_UltracopierSpecific.h @@ -3,53 +3,53 @@ \author alpha_one_x86 \licence GPL3, see the file COPYING */ -#include <QString> -#include <QList> +#include <string> +#include <vector> #include <QDomElement> #ifndef STRUCTDEF_ULTRACOPIERSPECIFIC_H #define STRUCTDEF_ULTRACOPIERSPECIFIC_H -enum PluginType +enum PluginType : uint8_t { - PluginType_Unknow, - PluginType_CopyEngine, - PluginType_Languages, - PluginType_Listener, - PluginType_PluginLoader, - PluginType_SessionLoader, - PluginType_Themes + PluginType_Unknow=0, + PluginType_CopyEngine=1, + PluginType_Languages=2, + PluginType_Listener=3, + PluginType_PluginLoader=4, + PluginType_SessionLoader=5, + PluginType_Themes=6 }; /// \brief structure to store the general plugin related information struct PluginsAvailable { - PluginType category; - QString path; - QString name; - QString writablePath; - QDomElement categorySpecific; - QString version; - QList<QStringList> informations; - QString errorString; - bool isWritable; - bool isAuth; + PluginType category; + std::string path; + std::string name; + std::string writablePath; + QDomElement categorySpecific; + std::string version; + std::vector<std::vector<std::string> > informations; + std::string errorString; + bool isWritable; + bool isAuth; }; -enum DebugLevel_custom +enum DebugLevel_custom : uint8_t { - DebugLevel_custom_Information, - DebugLevel_custom_Critical, - DebugLevel_custom_Warning, - DebugLevel_custom_Notice, - DebugLevel_custom_UserNote + DebugLevel_custom_Information=0, + DebugLevel_custom_Critical=1, + DebugLevel_custom_Warning=2, + DebugLevel_custom_Notice=3, + DebugLevel_custom_UserNote=4 }; -enum ActionOnManualOpen +enum ActionOnManualOpen : uint8_t { - ActionOnManualOpen_Nothing=0x00, - ActionOnManualOpen_Folder=0x01, - ActionOnManualOpen_Files=0x02 + ActionOnManualOpen_Nothing=0x00, + ActionOnManualOpen_Folder=0x01, + ActionOnManualOpen_Files=0x02 }; #endif // STRUCTDEF_ULTRACOPIERSPECIFIC_H diff --git a/SystrayIcon.cpp b/SystrayIcon.cpp index 6fe9b60..ab3c3e0 100644 --- a/SystrayIcon.cpp +++ b/SystrayIcon.cpp @@ -21,7 +21,7 @@ SystrayIcon::SystrayIcon(QObject * parent) :
QSystemTrayIcon(parent)
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start");
//setup the systray icon
haveListenerInfo = false;
@@ -43,10 +43,10 @@ SystrayIcon::SystrayIcon(QObject * parent) : setContextMenu(systrayMenu);
#ifdef ULTRACOPIER_MODE_SUPERCOPIER
- setToolTip(QStringLiteral("Supercopier"));
- #else
- setToolTip(QStringLiteral("Ultracopier"));
- #endif
+ setToolTip(QStringLiteral("Supercopier"));
+ #else
+ setToolTip(QStringLiteral("Ultracopier"));
+ #endif
#ifdef Q_OS_WIN32
setIcon(QIcon(QStringLiteral(":/systray_Uncaught_Windows.png")));
#else
@@ -138,7 +138,7 @@ void SystrayIcon::checkSetTooltip() void SystrayIcon::listenerReady(const Ultracopier::ListeningState &state,const bool &havePlugin,const bool &someAreInWaitOfReply)
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("state: %1, havePlugin: %2, someAreInWaitOfReply: %3").arg(state).arg(havePlugin).arg(someAreInWaitOfReply));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"state: "+std::to_string((int)state)+", havePlugin: "+std::to_string((int)havePlugin)+", someAreInWaitOfReply: "+std::to_string((int)someAreInWaitOfReply));
Q_UNUSED(someAreInWaitOfReply);
stateListener=state;
haveListenerInfo=true;
@@ -150,7 +150,7 @@ void SystrayIcon::listenerReady(const Ultracopier::ListeningState &state,const b void SystrayIcon::pluginLoaderReady(const Ultracopier::CatchState &state,const bool &havePlugin,const bool &someAreInWaitOfReply)
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("state: %1, havePlugin: %2, someAreInWaitOfReply: %3").arg(state).arg(havePlugin).arg(someAreInWaitOfReply));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"state: "+std::to_string((int)state)+", havePlugin: "+std::to_string((int)havePlugin)+", someAreInWaitOfReply: "+std::to_string((int)someAreInWaitOfReply));
Q_UNUSED(someAreInWaitOfReply);
statePluginLoader=state;
havePluginLoaderInfo=true;
@@ -160,32 +160,32 @@ void SystrayIcon::pluginLoaderReady(const Ultracopier::CatchState &state,const b void SystrayIcon::showTryCatchMessageWithNoListener()
{
- showSystrayMessage(tr("No copy listener found. Do the copy manually by right click one the system tray icon."));
+ showSystrayMessage(tr("No copy listener found. Do the copy manually by right click one the system tray icon.").toStdString());
}
/// \brief To show a message linked to the systray icon
-void SystrayIcon::showSystrayMessage(const QString& text)
+void SystrayIcon::showSystrayMessage(const std::string& text)
{
- showMessage(tr("Information"),text,QSystemTrayIcon::Information,0);
+ showMessage(tr("Information"),QString::fromStdString(text),QSystemTrayIcon::Information,0);
}
#ifdef ULTRACOPIER_INTERNET_SUPPORT
void SystrayIcon::messageClicked()
{
- QDesktopServices::openUrl(HelpDialog::getUpdateUrl());
+ QDesktopServices::openUrl(QString::fromStdString(HelpDialog::getUpdateUrl()));
}
#endif
/// \brief To update the systray icon
void SystrayIcon::updateSystrayIcon()
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start, haveListenerInfo %1, havePluginLoaderInfo: %2").arg(haveListenerInfo).arg(havePluginLoaderInfo));
- QString toolTip=QStringLiteral("???");
- QString icon;
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, haveListenerInfo "+std::to_string((int)haveListenerInfo)+", havePluginLoaderInfo: "+std::to_string((int)havePluginLoaderInfo));
+ std::string toolTip="???";
+ std::string icon;
if(!haveListenerInfo || !havePluginLoaderInfo)
{
- toolTip=tr("Searching information...");
- icon=QStringLiteral("Uncaught");
+ toolTip=tr("Searching information...").toStdString();
+ icon="Uncaught";
}
else
{
@@ -197,58 +197,58 @@ void SystrayIcon::updateSystrayIcon() {
if(stateListener==Ultracopier::NotListening)
{
- toolTip=tr("Do not replace the explorer copy/move");
- icon=QStringLiteral("Uncaught");
+ toolTip=tr("Do not replace the explorer copy/move").toStdString();
+ icon="Uncaught";
}
else if(stateListener==Ultracopier::SemiListening)
{
- toolTip=tr("Semi replace the explorer copy/move");
- icon=QStringLiteral("Semiuncaught");
+ toolTip=tr("Semi replace the explorer copy/move").toStdString();
+ icon="Semiuncaught";
}
else
{
- toolTip=tr("Replace the explorer copy/move");
- icon=QStringLiteral("Caught");
+ toolTip=tr("Replace the explorer copy/move").toStdString();
+ icon="Caught";
}
}
else
{
- icon=QStringLiteral("Semiuncaught");
- QString first_part;
- QString second_part;
+ icon="Semiuncaught";
+ std::string first_part;
+ std::string second_part;
if(stateListener==Ultracopier::NotListening)
- first_part=QStringLiteral("No listening");
+ first_part="No listening";
else if(stateListener==Ultracopier::SemiListening)
- first_part=QStringLiteral("Semi listening");
+ first_part="Semi listening";
else if(stateListener==Ultracopier::FullListening)
- first_part=QStringLiteral("Full listening");
+ first_part="Full listening";
else
- first_part=QStringLiteral("Unknow listening");
+ first_part="Unknow listening";
if(statePluginLoader==Ultracopier::Uncaught)
- second_part=QStringLiteral("No replace");
+ second_part="No replace";
else if(statePluginLoader==Ultracopier::Semiuncaught)
- second_part=QStringLiteral("Semi replace");
+ second_part="Semi replace";
else if(statePluginLoader==Ultracopier::Caught)
- second_part=QStringLiteral("Full replace");
+ second_part="Full replace";
else
- second_part=QStringLiteral("Unknow replace");
- toolTip=first_part+QStringLiteral("/")+second_part;
+ second_part="Unknow replace";
+ toolTip=first_part+"/"+second_part;
}
}
QIcon theNewSystrayIcon;
#ifdef Q_OS_WIN32
- theNewSystrayIcon=ThemesManager::themesManager->loadIcon(QStringLiteral("SystemTrayIcon/systray_")+icon+QStringLiteral("_Windows.png"));
+ theNewSystrayIcon=ThemesManager::themesManager->loadIcon("SystemTrayIcon/systray_"+icon+"_Windows.png");
#else
- theNewSystrayIcon=ThemesManager::themesManager->loadIcon(QStringLiteral("SystemTrayIcon/systray_")+icon+QStringLiteral("_Unix.png"));
+ theNewSystrayIcon=ThemesManager::themesManager->loadIcon("SystemTrayIcon/systray_"+icon+"_Unix.png");
#endif
if(theNewSystrayIcon.isNull())
{
#ifdef Q_OS_WIN32
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"use the default systray icon: :/systray_"+icon+"_Windows.png");
- theNewSystrayIcon=QIcon(QStringLiteral(":/systray_")+icon+QStringLiteral("_Windows.png"));
+ theNewSystrayIcon=QIcon(QString::fromStdString(":/systray_"+icon+"_Windows.png"));
#else
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"use the default systray icon: :/systray_"+icon+"_Unix.png");
- theNewSystrayIcon=QIcon(QStringLiteral(":/systray_")+icon+QStringLiteral("_Unix.png"));
+ theNewSystrayIcon=QIcon(QString::fromStdString(":/systray_"+icon+"_Unix.png"));
#endif
}
else
@@ -263,9 +263,9 @@ void SystrayIcon::updateSystrayIcon() ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"All the icon include the default icon remain null");
setIcon(theNewSystrayIcon);
#ifdef ULTRACOPIER_MODE_SUPERCOPIER
- setToolTip(QStringLiteral("Supercopier - ")+toolTip);
+ setToolTip(QString::fromStdString("Supercopier - "+toolTip));
#else
- setToolTip(QStringLiteral("Ultracopier - ")+toolTip);
+ setToolTip(QString::fromStdString("Ultracopier - "+toolTip));
#endif
}
@@ -283,8 +283,15 @@ void SystrayIcon::dropEvent(QDropEvent *event) if(mimeData->hasUrls())
{
//impossible with Qt on systray
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"mimeData->urls().size()"+QString::number(mimeData->urls().size()));
- emit urlDropped(mimeData->urls());
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"mimeData->urls().size()"+std::to_string(mimeData->urls().size()));
+ std::vector<std::string> urls;
+ unsigned int index=0;
+ while(index<(unsigned int)mimeData->urls().size())
+ {
+ urls.push_back(mimeData->urls().at(static_cast<int>(index)).toString().toStdString());
+ index++;
+ }
+ emit urlDropped(urls);
event->acceptProposedAction();
}
}
@@ -310,40 +317,40 @@ void SystrayIcon::dragLeaveEvent(QDragLeaveEvent* event) /// \brief To update the current themes
void SystrayIcon::updateCurrentTheme()
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("icon: start"));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"icon: start");
//load the systray menu item
QIcon tempIcon;
- tempIcon=ThemesManager::themesManager->loadIcon(QStringLiteral("SystemTrayIcon/exit.png"));
+ tempIcon=ThemesManager::themesManager->loadIcon("SystemTrayIcon/exit.png");
if(!tempIcon.isNull())
IconQuit=QIcon(tempIcon);
else
- IconQuit=QIcon(QStringLiteral(""));
+ IconQuit=QIcon("");
actionMenuQuit->setIcon(IconQuit);
#ifdef ULTRACOPIER_DEBUG
actionSaveBugReport->setIcon(QIcon(":/warning.png"));
#endif
- tempIcon=ThemesManager::themesManager->loadIcon(QStringLiteral("SystemTrayIcon/informations.png"));
+ tempIcon=ThemesManager::themesManager->loadIcon("SystemTrayIcon/informations.png");
if(!tempIcon.isNull())
IconInfo=QIcon(tempIcon);
else
- IconInfo=QIcon(QStringLiteral(""));
+ IconInfo=QIcon("");
actionMenuAbout->setIcon(IconInfo);
- tempIcon=ThemesManager::themesManager->loadIcon(QStringLiteral("SystemTrayIcon/options.png"));
+ tempIcon=ThemesManager::themesManager->loadIcon("SystemTrayIcon/options.png");
if(!tempIcon.isNull())
IconOptions=QIcon(tempIcon);
else
- IconOptions=QIcon(QStringLiteral(""));
+ IconOptions=QIcon("");
actionOptions->setIcon(IconOptions);
- tempIcon=ThemesManager::themesManager->loadIcon(QStringLiteral("SystemTrayIcon/add.png"));
+ tempIcon=ThemesManager::themesManager->loadIcon("SystemTrayIcon/add.png");
if(!tempIcon.isNull())
IconAdd=QIcon(tempIcon);
else
- IconAdd=QIcon(QStringLiteral(""));
+ IconAdd=QIcon("");
//update the systray icon
updateSystrayIcon();
@@ -370,10 +377,10 @@ void SystrayIcon::CatchAction(QSystemTrayIcon::ActivationReason reason) }
}
else if(reason==QSystemTrayIcon::Context)//do nothing on right click to show as auto the menu
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("The action on the systray icon is unknown: %1").arg(reason));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"The action on the systray icon is unknown: "+std::to_string((int)reason));
else
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("The action on the systray icon is unknown: %1").arg(reason));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"The action on the systray icon is unknown: "+std::to_string((int)reason));
QMessageBox::warning(NULL,tr("Warning"),tr("The action on the systray icon is unknown!"));
}
}
@@ -387,8 +394,8 @@ void SystrayIcon::CatchCopyQuery() ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"action not found");
return;
}
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start: "+currentAction->data().toString());
- emit addWindowCopyMove(Ultracopier::Copy,currentAction->data().toString());
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start: "+currentAction->data().toString().toStdString());
+ emit addWindowCopyMove(Ultracopier::Copy,currentAction->data().toString().toStdString());
}
/// \brief To catch move menu action
@@ -400,8 +407,8 @@ void SystrayIcon::CatchMoveQuery() ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"action not found");
return;
}
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start: "+currentAction->data().toString());
- emit addWindowCopyMove(Ultracopier::Move,currentAction->data().toString());
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start: "+currentAction->data().toString().toStdString());
+ emit addWindowCopyMove(Ultracopier::Move,currentAction->data().toString().toStdString());
}
/// \brief To catch transfer menu action
@@ -413,8 +420,8 @@ void SystrayIcon::CatchTransferQuery() ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"action not found");
return;
}
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start: "+currentAction->data().toString());
- emit addWindowTransfer(currentAction->data().toString());
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start: "+currentAction->data().toString().toStdString());
+ emit addWindowTransfer(currentAction->data().toString().toStdString());
}
/// \brief to retranslate the ui
@@ -435,26 +442,26 @@ void SystrayIcon::retranslateTheUI() updateSystrayIcon();
}
-void SystrayIcon::addCopyEngine(const QString &name,const bool &canDoOnlyCopy)
+void SystrayIcon::addCopyEngine(const std::string &name,const bool &canDoOnlyCopy)
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start");
EngineEntry entry;
entry.name=name;
entry.canDoOnlyCopy=canDoOnlyCopy;
- engineEntryList << entry;
+ engineEntryList.push_back(entry);
if(PluginsManager::pluginsManager->allPluginHaveBeenLoaded())
reloadEngineList();
}
-void SystrayIcon::removeCopyEngine(const QString &name)
+void SystrayIcon::removeCopyEngine(const std::string &name)
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
- int index=0;
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start");
+ unsigned int index=0;
while(index<engineEntryList.size())
{
if(engineEntryList.at(index).name==name)
{
- engineEntryList.removeAt(index);
+ engineEntryList.erase(engineEntryList.cbegin()+index);
break;
}
index++;
@@ -463,18 +470,31 @@ void SystrayIcon::removeCopyEngine(const QString &name) }
#ifdef ULTRACOPIER_INTERNET_SUPPORT
-void SystrayIcon::newUpdate(const QString &version)
+void SystrayIcon::newUpdate(const std::string &version)
{
/*if(version==lastVersion)
return;*/
lastVersion=version;
- showSystrayMessage(tr("New version: %1").arg(version)+"\n"+tr("Click here to go on download page"));
+ showSystrayMessage((tr("New version: %1").arg(QString::fromStdString(version))+"\n"+tr("Click here to go on download page")).toStdString());
}
#endif
+void SystrayIcon::addEngineAction(const QString &name, const QIcon &icon, const QString &label, QMenu *menu, void (SystrayIcon::*query)())
+{
+ QAction *copy = new QAction(icon, label, menu);
+ connect(copy,&QAction::triggered, this, query);
+ copy->setData(name);
+ #if ! defined(Q_OS_LINUX) || (QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
+ copyMenu->addAction(copy);
+ #else
+ actions.push_back(copy);
+ systrayMenu->insertAction(actionOptions, copy);
+ #endif
+}
+
void SystrayIcon::reloadEngineList()
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start");
#if ! defined(Q_OS_LINUX) || (QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
if(copyMenu!=NULL)
{
@@ -493,11 +513,9 @@ void SystrayIcon::reloadEngineList() }
#else
{
- int index=0;
- while(index<actions.size())
+ for(unsigned int index=0; index<actions.size(); index++)
{
delete actions.at(index);
- index++;
}
actions.clear();
}
@@ -505,92 +523,37 @@ void SystrayIcon::reloadEngineList() if(engineEntryList.size()==0)
return;
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"engineEntryList.size(): "+QString::number(engineEntryList.size()));
- if(engineEntryList.size()==1)
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"engineEntryList.size(): "+std::to_string(engineEntryList.size()));
+ for(unsigned int index=0; index<engineEntryList.size(); index++)
{
- QAction *copy=new QAction(IconAdd,tr("&Copy"),nullptr);
- connect(copy,&QAction::triggered,this,&SystrayIcon::CatchCopyQuery);
- copy->setData(engineEntryList.first().name);
+ const EngineEntry &engineEntry = engineEntryList.at(index);
+ const QString &name = QString::fromStdString(engineEntry.name);
+ QString labelCopy = tr("Add ©");
+ QString labelTransfer = tr("Add &transfer");
+ QString labelMove = tr("Add &move");
+ QMenu *menu = nullptr;
#if ! defined(Q_OS_LINUX) || (QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
- copyMenu->addAction(copy);
- #else
- actions << copy;
- systrayMenu->insertAction(actionOptions,copy);
- #endif
- #if ! defined(Q_OS_LINUX) || (QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
- if(!engineEntryList.first().canDoOnlyCopy)
- {
- connect(copyMenu,&QMenu::triggered,this,&SystrayIcon::CatchTransferQuery);
-
- QAction *transfer=new QAction(IconAdd,tr("&Transfer"),copyMenu);
- connect(transfer,&QAction::triggered,this,&SystrayIcon::CatchTransferQuery);
- transfer->setData(engineEntryList.first().name);
- copyMenu->addAction(transfer);
- QAction *move=new QAction(IconAdd,tr("&Move"),copyMenu);
- connect(move,&QAction::triggered,this,&SystrayIcon::CatchMoveQuery);
- move->setData(engineEntryList.first().name);
- copyMenu->addAction(move);
- }
+ if(engineEntryList.size()==1)
+ menu = copyMenu;
else
- connect(copyMenu,&QMenu::triggered,this,&SystrayIcon::CatchCopyQuery);
+ menu = new QMenu(name);
#else
- if(!engineEntryList.first().canDoOnlyCopy)
- {
- QAction *transfer=new QAction(IconAdd,tr("&Transfer"),nullptr);
- connect(transfer,&QAction::triggered,this,&SystrayIcon::CatchTransferQuery);
- transfer->setData(engineEntryList.first().name);
- systrayMenu->insertAction(actionOptions,transfer);
- QAction *move=new QAction(IconAdd,tr("&Move"),nullptr);
- connect(move,&QAction::triggered,this,&SystrayIcon::CatchMoveQuery);
- move->setData(engineEntryList.first().name);
- systrayMenu->insertAction(actionOptions,move);
+ if(engineEntryList.size()!=1) {
+ labelCopy += " ("+name+")";
+ labelTransfer += " ("+name+")";
+ labelMove += " ("+name+")";
}
#endif
-
- }
- else
- {
- int index=0;
- while(index<engineEntryList.size())
+ addEngineAction(name, IconAdd, labelCopy, menu, &SystrayIcon::CatchCopyQuery);
+ if(!engineEntry.canDoOnlyCopy)
{
- const EngineEntry &engineEntry=engineEntryList.at(index);
- const QString &name=engineEntry.name;
- #if ! defined(Q_OS_LINUX) || (QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
- QMenu * menu=new QMenu(name);
- QAction *copy=new QAction(IconAdd,tr("Add ©"),menu);
- connect(copy,&QAction::triggered,this,&SystrayIcon::CatchCopyQuery);
- copy->setData(name);
- menu->addAction(copy);
- if(!engineEntry.canDoOnlyCopy)
- {
- QAction *transfer=new QAction(IconAdd,tr("Add &transfer"),menu);
- connect(transfer,&QAction::triggered,this,&SystrayIcon::CatchTransferQuery);
- transfer->setData(name);
- menu->addAction(transfer);
- QAction *move=new QAction(IconAdd,tr("Add &move"),menu);
- connect(move,&QAction::triggered,this,&SystrayIcon::CatchMoveQuery);
- move->setData(name);
- menu->addAction(move);
- }
- copyMenu->addMenu(menu);
- #else
- QAction *copy=new QAction(IconAdd,tr("Add ©")+" ("+name+")",nullptr);
- connect(copy,&QAction::triggered,this,&SystrayIcon::CatchCopyQuery);
- copy->setData(name);
- systrayMenu->insertAction(actionOptions,copy);
- if(!engineEntry.canDoOnlyCopy)
- {
- QAction *transfer=new QAction(IconAdd,tr("Add &transfer")+" ("+name+")",nullptr);
- connect(transfer,&QAction::triggered,this,&SystrayIcon::CatchTransferQuery);
- transfer->setData(name);
- systrayMenu->insertAction(actionOptions,transfer);
- QAction *move=new QAction(IconAdd,tr("Add &move")+" ("+name+")",nullptr);
- connect(move,&QAction::triggered,this,&SystrayIcon::CatchMoveQuery);
- move->setData(name);
- systrayMenu->insertAction(actionOptions,move);
- }
- #endif
- index++;
+ addEngineAction(name, IconAdd, labelTransfer, menu, &SystrayIcon::CatchTransferQuery);
+ addEngineAction(name, IconAdd, labelMove, menu, &SystrayIcon::CatchMoveQuery);
}
+ #if ! defined(Q_OS_LINUX) || (QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
+ if(engineEntryList.size()!=1)
+ copyMenu->addMenu(menu);
+ #endif
}
+ setContextMenu(systrayMenu);
}
diff --git a/SystrayIcon.h b/SystrayIcon.h index bb7922c..5db5b4f 100644 --- a/SystrayIcon.h +++ b/SystrayIcon.h @@ -30,7 +30,7 @@ class SystrayIcon : public QSystemTrayIcon ~SystrayIcon();
public slots:
/// \brief For show a message linked to the systray icon
- void showSystrayMessage(const QString& text);
+ void showSystrayMessage(const std::string& text);
/** \brief Send that's caught state have changed for CatchedState::Uncatched or CatchedState::Semicatched or CatchedState::Catched
\see CatchState
\see tryCatchCopy()
@@ -38,20 +38,20 @@ class SystrayIcon : public QSystemTrayIcon \param state is the new state */
void listenerReady(const Ultracopier::ListeningState &state,const bool &havePlugin,const bool &someAreInWaitOfReply);
void pluginLoaderReady(const Ultracopier::CatchState &state,const bool &havePlugin,const bool &someAreInWaitOfReply);
- void addCopyEngine(const QString &name,const bool &canDoOnlyCopy);
- void removeCopyEngine(const QString &name);
+ void addCopyEngine(const std::string &name,const bool &canDoOnlyCopy);
+ void removeCopyEngine(const std::string &name);
#ifdef ULTRACOPIER_INTERNET_SUPPORT
- void newUpdate(const QString &version);
+ void newUpdate(const std::string &version);
#endif
private:
#ifdef ULTRACOPIER_INTERNET_SUPPORT
- QString lastVersion;
+ std::string lastVersion;
#endif
QMenu* systrayMenu; ///< Pointer on the menu
#if ! defined(Q_OS_LINUX) || (QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
QMenu* copyMenu; ///< Pointer on the copy menu (move or copy)
#else
- QList<QAction*> actions;
+ std::vector<QAction*> actions;
#endif
QAction* actionMenuQuit; ///< Pointer on the Quit action
#ifdef ULTRACOPIER_DEBUG
@@ -72,15 +72,18 @@ class SystrayIcon : public QSystemTrayIcon struct EngineEntry
{
bool canDoOnlyCopy;
- QString name;
+ std::string name;
};
- QList<EngineEntry> engineEntryList;
+ std::vector<EngineEntry> engineEntryList;
// To store the current catch state
Ultracopier::ListeningState stateListener;
Ultracopier::CatchState statePluginLoader;
bool haveListenerInfo,havePluginLoaderInfo;
bool haveListener,havePluginLoader;
QTimer timerCheckSetTooltip;
+
+ void addEngineAction(const QString &name, const QIcon &icon, const QString &label, QMenu *menu, void (SystrayIcon::*query)());
+
/** \brief drag event processing (impossible with Qt on systray)
need setAcceptDrops(true); into the constructor
@@ -132,11 +135,10 @@ class SystrayIcon : public QSystemTrayIcon /** \brief Add window copy or window move
\param mode Can be CopyMode::Copy or CopyMode::Move
\return The core object of the new window created */
- void addWindowCopyMove(Ultracopier::CopyMode mode,QString name) const;
- void addWindowTransfer(QString name) const;
- void urlDropped(QList<QUrl> urls) const;
+ void addWindowCopyMove(Ultracopier::CopyMode mode,std::string name) const;
+ void addWindowTransfer(std::string name) const;
+ void urlDropped(std::vector<std::string> urls) const;
void saveBugReport() const;
};
#endif // SYSTRAY_ICON_H
-
diff --git a/ThemesManager.cpp b/ThemesManager.cpp index c47d0e0..ab61e44 100644 --- a/ThemesManager.cpp +++ b/ |