summaryrefslogtreecommitdiff
path: root/plugins/CopyEngine/Ultracopier/CopyEngineFactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/CopyEngine/Ultracopier/CopyEngineFactory.cpp')
-rw-r--r--plugins/CopyEngine/Ultracopier/CopyEngineFactory.cpp262
1 files changed, 135 insertions, 127 deletions
diff --git a/plugins/CopyEngine/Ultracopier/CopyEngineFactory.cpp b/plugins/CopyEngine/Ultracopier/CopyEngineFactory.cpp
index d4d4bb6..6507ce2 100644
--- a/plugins/CopyEngine/Ultracopier/CopyEngineFactory.cpp
+++ b/plugins/CopyEngine/Ultracopier/CopyEngineFactory.cpp
@@ -8,6 +8,7 @@
#include <cmath>
#include <QStorageInfo>
+#include "../../../cpp11addition.h"
#include "CopyEngineFactory.h"
// The cmath header from MSVC does not contain round()
@@ -32,6 +33,7 @@ CopyEngineFactory::CopyEngineFactory() :
qRegisterMetaType<QList<Diskspace> >("QList<Diskspace>");
qRegisterMetaType<QFileInfo>("QFileInfo");
qRegisterMetaType<Ultracopier::CopyMode>("Ultracopier::CopyMode");
+ qRegisterMetaType<std::vector<Filters_rules> >("std::vector<Filters_rules>");
tempWidget=new QWidget();
ui->setupUi(tempWidget);
@@ -138,14 +140,14 @@ PluginInterface_CopyEngine * CopyEngineFactory::getInstance()
realObject->setInodeThreads(ui->inodeThreads->value());
realObject->setRenameTheOriginalDestination(ui->renameTheOriginalDestination->isChecked());
realObject->setCheckDiskSpace(ui->checkDiskSpace->isChecked());
- realObject->setDefaultDestinationFolder(ui->defaultDestinationFolder->text());
+ realObject->setDefaultDestinationFolder(ui->defaultDestinationFolder->text().toStdString());
realObject->setCopyListOrder(ui->copyListOrder->isChecked());
return newTransferEngine;
}
-void CopyEngineFactory::setResources(OptionInterface * options,const QString &writePath,const QString &pluginPath,FacilityInterface * facilityInterface,const bool &portableVersion)
+void CopyEngineFactory::setResources(OptionInterface * options,const std::string &writePath,const std::string &pluginPath,FacilityInterface * facilityInterface,const bool &portableVersion)
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start, writePath: ")+writePath+QStringLiteral(", pluginPath:")+pluginPath);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, writePath: "+writePath+", pluginPath:"+pluginPath);
this->facilityEngine=facilityInterface;
Q_UNUSED(portableVersion);
#ifndef ULTRACOPIER_PLUGIN_DEBUG
@@ -157,23 +159,23 @@ void CopyEngineFactory::setResources(OptionInterface * options,const QString &wr
#endif
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,COMPILERINFO);
#if defined (ULTRACOPIER_PLUGIN_CHECKLISTTYPE)
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("CHECK LIST TYPE set"));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"CHECK LIST TYPE set");
#else
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("CHECK LIST TYPE not set"));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"CHECK LIST TYPE not set");
#endif
if(options!=NULL)
{
//load the options
- QList<QPair<QString, QVariant> > KeysList;
- KeysList.append(qMakePair(QStringLiteral("doRightTransfer"),QVariant(true)));
+ std::vector<std::pair<std::string, std::string> > KeysList;
+ KeysList.push_back(std::pair<std::string, std::string>("doRightTransfer","true"));
#ifndef Q_OS_LINUX
- KeysList.append(qMakePair(QStringLiteral("keepDate"),QVariant(false)));
+ KeysList.push_back(std::pair<std::string, std::string>("keepDate","false"));
#else
- KeysList.append(qMakePair(QStringLiteral("keepDate"),QVariant(true)));
+ KeysList.push_back(std::pair<std::string, std::string>("keepDate","true"));
#endif
- KeysList.append(qMakePair(QStringLiteral("blockSize"),QVariant(ULTRACOPIER_PLUGIN_DEFAULT_BLOCK_SIZE)));
- quint32 sequentialBuffer=ULTRACOPIER_PLUGIN_DEFAULT_BLOCK_SIZE*ULTRACOPIER_PLUGIN_DEFAULT_SEQUENTIAL_NUMBER_OF_BLOCK;
- quint32 parallelBuffer=ULTRACOPIER_PLUGIN_DEFAULT_BLOCK_SIZE*ULTRACOPIER_PLUGIN_DEFAULT_PARALLEL_NUMBER_OF_BLOCK;
+ KeysList.push_back(std::pair<std::string, std::string>("blockSize",std::to_string(ULTRACOPIER_PLUGIN_DEFAULT_BLOCK_SIZE)));
+ uint32_t sequentialBuffer=ULTRACOPIER_PLUGIN_DEFAULT_BLOCK_SIZE*ULTRACOPIER_PLUGIN_DEFAULT_SEQUENTIAL_NUMBER_OF_BLOCK;
+ uint32_t parallelBuffer=ULTRACOPIER_PLUGIN_DEFAULT_BLOCK_SIZE*ULTRACOPIER_PLUGIN_DEFAULT_PARALLEL_NUMBER_OF_BLOCK;
//to prevent swap and other bad effect, only under windows and unix for now
#if defined(Q_OS_WIN32) or (defined(Q_OS_LINUX) and defined(_SC_PHYS_PAGES))
size_t max_memory=getTotalSystemMemory()/1024;
@@ -184,95 +186,95 @@ void CopyEngineFactory::setResources(OptionInterface * options,const QString &wr
if(parallelBuffer>(max_memory/100))
parallelBuffer=max_memory/100;
}
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("detected memory: %1MB").arg(max_memory/1024));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("detected memory: %1MB").arg(max_memory/1024).toStdString());
#endif
- KeysList.append(qMakePair(QStringLiteral("sequentialBuffer"),QVariant(sequentialBuffer)));
- KeysList.append(qMakePair(QStringLiteral("parallelBuffer"),QVariant(parallelBuffer)));
- KeysList.append(qMakePair(QStringLiteral("parallelizeIfSmallerThan"),QVariant(128)));//128KB, better for modern hardware: Multiple queue en linux, SSD, ...
- KeysList.append(qMakePair(QStringLiteral("autoStart"),QVariant(true)));
+ KeysList.push_back(std::pair<std::string, std::string>("sequentialBuffer",std::to_string(sequentialBuffer)));
+ KeysList.push_back(std::pair<std::string, std::string>("parallelBuffer",std::to_string(parallelBuffer)));
+ KeysList.push_back(std::pair<std::string, std::string>("parallelizeIfSmallerThan",std::to_string(128)));//128KB, better for modern hardware: Multiple queue en linux, SSD, ...
+ KeysList.push_back(std::pair<std::string, std::string>("autoStart","true"));
#ifdef ULTRACOPIER_PLUGIN_RSYNC
- KeysList.append(qMakePair(QStringLiteral("rsync"),QVariant(true)));
+ KeysList.push_back(std::pair<std::string, std::string>("rsync","true"));
#endif
- KeysList.append(qMakePair(QStringLiteral("folderError"),QVariant(0)));
- KeysList.append(qMakePair(QStringLiteral("folderCollision"),QVariant(0)));
- KeysList.append(qMakePair(QStringLiteral("fileError"),QVariant(2)));
- KeysList.append(qMakePair(QStringLiteral("fileCollision"),QVariant(0)));
- KeysList.append(qMakePair(QStringLiteral("transferAlgorithm"),QVariant(0)));
- KeysList.append(qMakePair(QStringLiteral("checkDestinationFolder"),QVariant(true)));
- KeysList.append(qMakePair(QStringLiteral("includeStrings"),QVariant(QStringList())));
- KeysList.append(qMakePair(QStringLiteral("includeOptions"),QVariant(QStringList())));
- KeysList.append(qMakePair(QStringLiteral("excludeStrings"),QVariant(QStringList())));
- KeysList.append(qMakePair(QStringLiteral("excludeOptions"),QVariant(QStringList())));
- KeysList.append(qMakePair(QStringLiteral("doChecksum"),QVariant(false)));
- KeysList.append(qMakePair(QStringLiteral("checksumIgnoreIfImpossible"),QVariant(true)));
- KeysList.append(qMakePair(QStringLiteral("checksumOnlyOnError"),QVariant(true)));
- KeysList.append(qMakePair(QStringLiteral("osBuffer"),QVariant(false)));
- KeysList.append(qMakePair(QStringLiteral("firstRenamingRule"),QVariant("")));
- KeysList.append(qMakePair(QStringLiteral("otherRenamingRule"),QVariant("")));
- KeysList.append(qMakePair(QStringLiteral("osBufferLimited"),QVariant(false)));
- KeysList.append(qMakePair(QStringLiteral("osBufferLimit"),QVariant(512)));
- KeysList.append(qMakePair(QStringLiteral("deletePartiallyTransferredFiles"),QVariant(true)));
- KeysList.append(qMakePair(QStringLiteral("moveTheWholeFolder"),QVariant(true)));
- KeysList.append(qMakePair(QStringLiteral("followTheStrictOrder"),QVariant(false)));
- KeysList.append(qMakePair(QStringLiteral("renameTheOriginalDestination"),QVariant(false)));
- KeysList.append(qMakePair(QStringLiteral("checkDiskSpace"),QVariant(true)));
- KeysList.append(qMakePair(QStringLiteral("defaultDestinationFolder"),QVariant(QString())));
- KeysList.append(qMakePair(QStringLiteral("inodeThreads"),QVariant(1)));
- KeysList.append(qMakePair(QStringLiteral("copyListOrder"),QVariant(false)));
+ KeysList.push_back(std::pair<std::string, std::string>("folderError",std::to_string(0)));
+ KeysList.push_back(std::pair<std::string, std::string>("folderCollision",std::to_string(0)));
+ KeysList.push_back(std::pair<std::string, std::string>("fileError",std::to_string(2)));
+ KeysList.push_back(std::pair<std::string, std::string>("fileCollision",std::to_string(0)));
+ KeysList.push_back(std::pair<std::string, std::string>("transferAlgorithm",std::to_string(0)));
+ KeysList.push_back(std::pair<std::string, std::string>("checkDestinationFolder","true"));
+ KeysList.push_back(std::pair<std::string, std::string>("includeStrings",""));
+ KeysList.push_back(std::pair<std::string, std::string>("includeOptions",""));
+ KeysList.push_back(std::pair<std::string, std::string>("excludeStrings",""));
+ KeysList.push_back(std::pair<std::string, std::string>("excludeOptions",""));
+ KeysList.push_back(std::pair<std::string, std::string>("doChecksum","false"));
+ KeysList.push_back(std::pair<std::string, std::string>("checksumIgnoreIfImpossible","true"));
+ KeysList.push_back(std::pair<std::string, std::string>("checksumOnlyOnError","true"));
+ KeysList.push_back(std::pair<std::string, std::string>("osBuffer","false"));
+ KeysList.push_back(std::pair<std::string, std::string>("firstRenamingRule",""));
+ KeysList.push_back(std::pair<std::string, std::string>("otherRenamingRule",""));
+ KeysList.push_back(std::pair<std::string, std::string>("osBufferLimited","false"));
+ KeysList.push_back(std::pair<std::string, std::string>("osBufferLimit",std::to_string(512)));
+ KeysList.push_back(std::pair<std::string, std::string>("deletePartiallyTransferredFiles","true"));
+ KeysList.push_back(std::pair<std::string, std::string>("moveTheWholeFolder","true"));
+ KeysList.push_back(std::pair<std::string, std::string>("followTheStrictOrder","false"));
+ KeysList.push_back(std::pair<std::string, std::string>("renameTheOriginalDestination","false"));
+ KeysList.push_back(std::pair<std::string, std::string>("checkDiskSpace","true"));
+ KeysList.push_back(std::pair<std::string, std::string>("defaultDestinationFolder",""));
+ KeysList.push_back(std::pair<std::string, std::string>("inodeThreads",std::to_string(1)));
+ KeysList.push_back(std::pair<std::string, std::string>("copyListOrder","false"));
options->addOptionGroup(KeysList);
#if ! defined (Q_CC_GNU)
ui->keepDate->setEnabled(false);
ui->keepDate->setToolTip(QStringLiteral("Not supported with this compiler"));
#endif
- ui->doRightTransfer->setChecked(options->getOptionValue(QStringLiteral("doRightTransfer")).toBool());
- ui->keepDate->setChecked(options->getOptionValue(QStringLiteral("keepDate")).toBool());
- ui->blockSize->setValue(options->getOptionValue(QStringLiteral("blockSize")).toUInt());//keep before sequentialBuffer and parallelBuffer
- ui->autoStart->setChecked(options->getOptionValue(QStringLiteral("autoStart")).toBool());
+ ui->doRightTransfer->setChecked(stringtobool(options->getOptionValue("doRightTransfer")));
+ ui->keepDate->setChecked(stringtobool(options->getOptionValue("keepDate")));
+ ui->blockSize->setValue(stringtouint32(options->getOptionValue("blockSize")));//keep before sequentialBuffer and parallelBuffer
+ ui->autoStart->setChecked(stringtobool(options->getOptionValue("autoStart")));
#ifdef ULTRACOPIER_PLUGIN_RSYNC
- ui->rsync->setChecked(options->getOptionValue(QStringLiteral("rsync")).toBool());
+ ui->rsync->setChecked(stringtobool(options->getOptionValue("rsync")));
#else
ui->label_rsync->setVisible(false);
ui->rsync->setVisible(false);
#endif
- ui->comboBoxFolderError->setCurrentIndex(options->getOptionValue(QStringLiteral("folderError")).toUInt());
- ui->comboBoxFolderCollision->setCurrentIndex(options->getOptionValue(QStringLiteral("folderCollision")).toUInt());
- ui->comboBoxFileError->setCurrentIndex(options->getOptionValue(QStringLiteral("fileError")).toUInt());
- ui->comboBoxFileCollision->setCurrentIndex(options->getOptionValue(QStringLiteral("fileCollision")).toUInt());
- ui->transferAlgorithm->setCurrentIndex(options->getOptionValue(QStringLiteral("transferAlgorithm")).toUInt());
- ui->checkBoxDestinationFolderExists->setChecked(options->getOptionValue(QStringLiteral("checkDestinationFolder")).toBool());
- ui->parallelizeIfSmallerThan->setValue(options->getOptionValue(QStringLiteral("parallelizeIfSmallerThan")).toUInt());
- ui->sequentialBuffer->setValue(options->getOptionValue(QStringLiteral("sequentialBuffer")).toUInt());
- ui->parallelBuffer->setValue(options->getOptionValue(QStringLiteral("parallelBuffer")).toUInt());
+ ui->comboBoxFolderError->setCurrentIndex(stringtouint32(options->getOptionValue("folderError")));
+ ui->comboBoxFolderCollision->setCurrentIndex(stringtouint32(options->getOptionValue("folderCollision")));
+ ui->comboBoxFileError->setCurrentIndex(stringtouint32(options->getOptionValue("fileError")));
+ ui->comboBoxFileCollision->setCurrentIndex(stringtouint32(options->getOptionValue("fileCollision")));
+ ui->transferAlgorithm->setCurrentIndex(stringtouint32(options->getOptionValue("transferAlgorithm")));
+ ui->checkBoxDestinationFolderExists->setChecked(stringtobool(options->getOptionValue("checkDestinationFolder")));
+ ui->parallelizeIfSmallerThan->setValue(stringtouint32(options->getOptionValue("parallelizeIfSmallerThan")));
+ ui->sequentialBuffer->setValue(stringtouint32(options->getOptionValue("sequentialBuffer")));
+ ui->parallelBuffer->setValue(stringtouint32(options->getOptionValue("parallelBuffer")));
ui->sequentialBuffer->setSingleStep(ui->blockSize->value());
ui->parallelBuffer->setSingleStep(ui->blockSize->value());
- ui->deletePartiallyTransferredFiles->setChecked(options->getOptionValue(QStringLiteral("deletePartiallyTransferredFiles")).toBool());
- ui->moveTheWholeFolder->setChecked(options->getOptionValue(QStringLiteral("moveTheWholeFolder")).toBool());
- ui->followTheStrictOrder->setChecked(options->getOptionValue(QStringLiteral("followTheStrictOrder")).toBool());
- ui->inodeThreads->setValue(options->getOptionValue(QStringLiteral("inodeThreads")).toUInt());
- ui->renameTheOriginalDestination->setChecked(options->getOptionValue(QStringLiteral("renameTheOriginalDestination")).toBool());
- ui->checkDiskSpace->setChecked(options->getOptionValue(QStringLiteral("checkDiskSpace")).toBool());
- ui->defaultDestinationFolder->setText(options->getOptionValue(QStringLiteral("defaultDestinationFolder")).toString());
-
- ui->doChecksum->setChecked(options->getOptionValue(QStringLiteral("doChecksum")).toBool());
- ui->checksumIgnoreIfImpossible->setChecked(options->getOptionValue(QStringLiteral("checksumIgnoreIfImpossible")).toBool());
- ui->checksumOnlyOnError->setChecked(options->getOptionValue(QStringLiteral("checksumOnlyOnError")).toBool());
-
- ui->osBuffer->setChecked(options->getOptionValue(QStringLiteral("osBuffer")).toBool());
- ui->osBufferLimited->setChecked(options->getOptionValue(QStringLiteral("osBufferLimited")).toBool());
- ui->osBufferLimit->setValue(options->getOptionValue(QStringLiteral("osBufferLimit")).toUInt());
- //ui->autoStart->setChecked(options->getOptionValue(QStringLiteral("autoStart")).toBool());//moved from options(), wrong previous place
- includeStrings=options->getOptionValue(QStringLiteral("includeStrings")).toStringList();
- includeOptions=options->getOptionValue(QStringLiteral("includeOptions")).toStringList();
- excludeStrings=options->getOptionValue(QStringLiteral("excludeStrings")).toStringList();
- excludeOptions=options->getOptionValue(QStringLiteral("excludeOptions")).toStringList();
+ ui->deletePartiallyTransferredFiles->setChecked(stringtobool(options->getOptionValue("deletePartiallyTransferredFiles")));
+ ui->moveTheWholeFolder->setChecked(stringtobool(options->getOptionValue("moveTheWholeFolder")));
+ ui->followTheStrictOrder->setChecked(stringtobool(options->getOptionValue("followTheStrictOrder")));
+ ui->inodeThreads->setValue(stringtouint32(options->getOptionValue("inodeThreads")));
+ ui->renameTheOriginalDestination->setChecked(stringtobool(options->getOptionValue("renameTheOriginalDestination")));
+ ui->checkDiskSpace->setChecked(stringtobool(options->getOptionValue("checkDiskSpace")));
+ ui->defaultDestinationFolder->setText(QString::fromStdString(options->getOptionValue("defaultDestinationFolder")));
+
+ ui->doChecksum->setChecked(stringtobool(options->getOptionValue("doChecksum")));
+ ui->checksumIgnoreIfImpossible->setChecked(stringtobool(options->getOptionValue("checksumIgnoreIfImpossible")));
+ ui->checksumOnlyOnError->setChecked(stringtobool(options->getOptionValue("checksumOnlyOnError")));
+
+ ui->osBuffer->setChecked(stringtobool(options->getOptionValue("osBuffer")));
+ ui->osBufferLimited->setChecked(stringtobool(options->getOptionValue("osBufferLimited")));
+ ui->osBufferLimit->setValue(stringtouint32(options->getOptionValue("osBufferLimit")));
+ //ui->autoStart->setChecked(options->getOptionValue("autoStart").toBool());//moved from options(), wrong previous place
+ includeStrings=stringtostringlist(options->getOptionValue("includeStrings"));
+ includeOptions=stringtostringlist(options->getOptionValue("includeOptions"));
+ excludeStrings=stringtostringlist(options->getOptionValue("excludeStrings"));
+ excludeOptions=stringtostringlist(options->getOptionValue("excludeOptions"));
filters->setFilters(includeStrings,includeOptions,excludeStrings,excludeOptions);
- firstRenamingRule=options->getOptionValue(QStringLiteral("firstRenamingRule")).toString();
- otherRenamingRule=options->getOptionValue(QStringLiteral("otherRenamingRule")).toString();
+ firstRenamingRule=options->getOptionValue("firstRenamingRule");
+ otherRenamingRule=options->getOptionValue("otherRenamingRule");
renamingRules->setRenamingRules(firstRenamingRule,otherRenamingRule);
ui->checksumOnlyOnError->setEnabled(ui->doChecksum->isChecked());
ui->checksumIgnoreIfImpossible->setEnabled(ui->doChecksum->isChecked());
- ui->copyListOrder->setChecked(options->getOptionValue(QStringLiteral("copyListOrder")).toBool());
+ ui->copyListOrder->setChecked(stringtobool(options->getOptionValue("copyListOrder")));
updateBufferCheckbox();
optionsEngine=options;
@@ -281,14 +283,18 @@ void CopyEngineFactory::setResources(OptionInterface * options,const QString &wr
}
}
-QStringList CopyEngineFactory::supportedProtocolsForTheSource() const
+std::vector<std::string> CopyEngineFactory::supportedProtocolsForTheSource() const
{
- return QStringList() << QStringLiteral("file");
+ std::vector<std::string> l;
+ l.push_back("file");
+ return l;
}
-QStringList CopyEngineFactory::supportedProtocolsForTheDestination() const
+std::vector<std::string> CopyEngineFactory::supportedProtocolsForTheDestination() const
{
- return QStringList() << QStringLiteral("file");
+ std::vector<std::string> l;
+ l.push_back("file");
+ return l;
}
Ultracopier::CopyType CopyEngineFactory::getCopyType()
@@ -319,21 +325,21 @@ void CopyEngineFactory::setDoRightTransfer(bool doRightTransfer)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("doRightTransfer"),doRightTransfer);
+ optionsEngine->setOptionValue("doRightTransfer",booltostring(doRightTransfer));
}
void CopyEngineFactory::setKeepDate(bool keepDate)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("keepDate"),keepDate);
+ optionsEngine->setOptionValue("keepDate",booltostring(keepDate));
}
void CopyEngineFactory::setBlockSize(int blockSize)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("blockSize"),blockSize);
+ optionsEngine->setOptionValue("blockSize",std::to_string(blockSize));
updatedBlockSize();
}
@@ -344,7 +350,7 @@ void CopyEngineFactory::setParallelBuffer(int parallelBuffer)
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
parallelBuffer=round((float)parallelBuffer/(float)ui->blockSize->value())*ui->blockSize->value();
ui->parallelBuffer->setValue(parallelBuffer);
- optionsEngine->setOptionValue(QStringLiteral("parallelBuffer"),parallelBuffer);
+ optionsEngine->setOptionValue("parallelBuffer",std::to_string(parallelBuffer));
}
}
@@ -352,10 +358,10 @@ void CopyEngineFactory::setSequentialBuffer(int sequentialBuffer)
{
if(optionsEngine!=NULL)
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("the value have changed"));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
sequentialBuffer=round((float)sequentialBuffer/(float)ui->blockSize->value())*ui->blockSize->value();
ui->sequentialBuffer->setValue(sequentialBuffer);
- optionsEngine->setOptionValue(QStringLiteral("sequentialBuffer"),sequentialBuffer);
+ optionsEngine->setOptionValue("sequentialBuffer",std::to_string(sequentialBuffer));
}
}
@@ -364,7 +370,7 @@ void CopyEngineFactory::setParallelizeIfSmallerThan(int parallelizeIfSmallerThan
if(optionsEngine!=NULL)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
- optionsEngine->setOptionValue(QStringLiteral("parallelizeIfSmallerThan"),parallelizeIfSmallerThan);
+ optionsEngine->setOptionValue("parallelizeIfSmallerThan",std::to_string(parallelizeIfSmallerThan));
}
}
@@ -372,35 +378,35 @@ void CopyEngineFactory::setAutoStart(bool autoStart)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("autoStart"),autoStart);
+ optionsEngine->setOptionValue("autoStart",booltostring(autoStart));
}
void CopyEngineFactory::setFolderCollision(int index)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("folderCollision"),index);
+ optionsEngine->setOptionValue("folderCollision",std::to_string(index));
}
void CopyEngineFactory::setFolderError(int index)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("folderError"),index);
+ optionsEngine->setOptionValue("folderError",std::to_string(index));
}
void CopyEngineFactory::setTransferAlgorithm(int index)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("transferAlgorithm"),index);
+ optionsEngine->setOptionValue("transferAlgorithm",std::to_string(index));
}
void CopyEngineFactory::setCheckDestinationFolder()
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("checkDestinationFolder"),ui->checkBoxDestinationFolderExists->isChecked());
+ optionsEngine->setOptionValue("checkDestinationFolder",booltostring(ui->checkBoxDestinationFolderExists->isChecked()));
}
void CopyEngineFactory::newLanguageLoaded()
@@ -445,21 +451,21 @@ void CopyEngineFactory::doChecksum_toggled(bool doChecksum)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("doChecksum"),doChecksum);
+ optionsEngine->setOptionValue("doChecksum",booltostring(doChecksum));
}
void CopyEngineFactory::checksumOnlyOnError_toggled(bool checksumOnlyOnError)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("checksumOnlyOnError"),checksumOnlyOnError);
+ optionsEngine->setOptionValue("checksumOnlyOnError",booltostring(checksumOnlyOnError));
}
void CopyEngineFactory::osBuffer_toggled(bool osBuffer)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("osBuffer"),osBuffer);
+ optionsEngine->setOptionValue("osBuffer",booltostring(osBuffer));
ui->osBufferLimit->setEnabled(ui->osBuffer->isChecked() && ui->osBufferLimited->isChecked());
}
@@ -467,7 +473,7 @@ void CopyEngineFactory::osBufferLimited_toggled(bool osBufferLimited)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("osBufferLimited"),osBufferLimited);
+ optionsEngine->setOptionValue("osBufferLimited",booltostring(osBufferLimited));
ui->osBufferLimit->setEnabled(ui->osBuffer->isChecked() && ui->osBufferLimited->isChecked());
}
@@ -475,7 +481,7 @@ void CopyEngineFactory::osBufferLimit_editingFinished()
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the spinbox have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("osBufferLimit"),ui->osBufferLimit->value());
+ optionsEngine->setOptionValue("osBufferLimit",std::to_string(ui->osBufferLimit->value()));
}
void CopyEngineFactory::showFilterDialog()
@@ -489,31 +495,31 @@ void CopyEngineFactory::showFilterDialog()
filters->exec();
}
-void CopyEngineFactory::sendNewFilters(const QStringList &includeStrings,const QStringList &includeOptions,const QStringList &excludeStrings,const QStringList &excludeOptions)
+void CopyEngineFactory::sendNewFilters(const std::vector<std::string> &includeStrings,const std::vector<std::string> &includeOptions,const std::vector<std::string> &excludeStrings,const std::vector<std::string> &excludeOptions)
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("new filter"));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"new filter");
this->includeStrings=includeStrings;
this->includeOptions=includeOptions;
this->excludeStrings=excludeStrings;
this->excludeOptions=excludeOptions;
if(optionsEngine!=NULL)
{
- optionsEngine->setOptionValue(QStringLiteral("includeStrings"),includeStrings);
- optionsEngine->setOptionValue(QStringLiteral("includeOptions"),includeOptions);
- optionsEngine->setOptionValue(QStringLiteral("excludeStrings"),excludeStrings);
- optionsEngine->setOptionValue(QStringLiteral("excludeOptions"),excludeOptions);
+ optionsEngine->setOptionValue("includeStrings",stringlisttostring(includeStrings));
+ optionsEngine->setOptionValue("includeOptions",stringlisttostring(includeOptions));
+ optionsEngine->setOptionValue("excludeStrings",stringlisttostring(excludeStrings));
+ optionsEngine->setOptionValue("excludeOptions",stringlisttostring(excludeOptions));
}
}
-void CopyEngineFactory::sendNewRenamingRules(const QString &firstRenamingRule,const QString &otherRenamingRule)
+void CopyEngineFactory::sendNewRenamingRules(const std::string &firstRenamingRule,const std::string &otherRenamingRule)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"new filter");
this->firstRenamingRule=firstRenamingRule;
this->otherRenamingRule=otherRenamingRule;
if(optionsEngine!=NULL)
{
- optionsEngine->setOptionValue(QStringLiteral("firstRenamingRule"),firstRenamingRule);
- optionsEngine->setOptionValue(QStringLiteral("otherRenamingRule"),otherRenamingRule);
+ optionsEngine->setOptionValue("firstRenamingRule",firstRenamingRule);
+ optionsEngine->setOptionValue("otherRenamingRule",otherRenamingRule);
}
}
@@ -538,12 +544,12 @@ void CopyEngineFactory::checksumIgnoreIfImpossible_toggled(bool checksumIgnoreIf
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("checksumIgnoreIfImpossible"),checksumIgnoreIfImpossible);
+ optionsEngine->setOptionValue("checksumIgnoreIfImpossible",booltostring(checksumIgnoreIfImpossible));
}
void CopyEngineFactory::setFileCollision(int index)
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("action index: %1").arg(index));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"action index: "+std::to_string(index));
if(optionsEngine==NULL)
return;
switch(index)
@@ -555,7 +561,7 @@ void CopyEngineFactory::setFileCollision(int index)
case 4:
case 5:
case 6:
- optionsEngine->setOptionValue(QStringLiteral("fileCollision"),index);
+ optionsEngine->setOptionValue("fileCollision",std::to_string(index));
break;
default:
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Error, unknow index, ignored");
@@ -565,7 +571,7 @@ void CopyEngineFactory::setFileCollision(int index)
void CopyEngineFactory::setFileError(int index)
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("action index: %1").arg(index));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"action index: "+std::to_string(index));
if(optionsEngine==NULL)
return;
switch(index)
@@ -573,7 +579,7 @@ void CopyEngineFactory::setFileError(int index)
case 0:
case 1:
case 2:
- optionsEngine->setOptionValue(QStringLiteral("fileError"),index);
+ optionsEngine->setOptionValue("fileError",std::to_string(index));
break;
default:
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Error, unknow index, ignored");
@@ -597,26 +603,28 @@ void CopyEngineFactory::deletePartiallyTransferredFiles(bool checked)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("deletePartiallyTransferredFiles"),checked);
+ optionsEngine->setOptionValue("deletePartiallyTransferredFiles",booltostring(checked));
}
void CopyEngineFactory::renameTheOriginalDestination(bool checked)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("renameTheOriginalDestination"),checked);
+ optionsEngine->setOptionValue("renameTheOriginalDestination",booltostring(checked));
}
void CopyEngineFactory::checkDiskSpace(bool checked)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("checkDiskSpace"),checked);
+ optionsEngine->setOptionValue("checkDiskSpace",booltostring(checked));
}
void CopyEngineFactory::defaultDestinationFolderBrowse()
{
- QString destination = QFileDialog::getExistingDirectory(ui->defaultDestinationFolder,facilityEngine->translateText(QStringLiteral("Select destination directory")),QStringLiteral(""),QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
+ QString destination = QFileDialog::getExistingDirectory(ui->defaultDestinationFolder,
+ QString::fromStdString(facilityEngine->translateText("Select destination directory")),
+ "",QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
if(destination.isEmpty())
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"Canceled by the user");
@@ -625,35 +633,35 @@ void CopyEngineFactory::defaultDestinationFolderBrowse()
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
ui->defaultDestinationFolder->setText(destination);
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("defaultDestinationFolder"),destination);
+ optionsEngine->setOptionValue("defaultDestinationFolder",destination.toStdString());
}
void CopyEngineFactory::defaultDestinationFolder()
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("defaultDestinationFolder"),ui->defaultDestinationFolder->text());
+ optionsEngine->setOptionValue("defaultDestinationFolder",ui->defaultDestinationFolder->text().toStdString());
}
void CopyEngineFactory::followTheStrictOrder(bool checked)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("followTheStrictOrder"),checked);
+ optionsEngine->setOptionValue("followTheStrictOrder",booltostring(checked));
}
void CopyEngineFactory::moveTheWholeFolder(bool checked)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("moveTheWholeFolder"),checked);
+ optionsEngine->setOptionValue("moveTheWholeFolder",booltostring(checked));
}
void CopyEngineFactory::on_inodeThreads_editingFinished()
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the spinbox have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("inodeThreads"),ui->inodeThreads->value());
+ optionsEngine->setOptionValue("inodeThreads",std::to_string(ui->inodeThreads->value()));
}
#ifdef Q_OS_WIN32
@@ -680,7 +688,7 @@ void CopyEngineFactory::setRsync(bool rsync)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue("rsync",rsync);
+ optionsEngine->setOptionValue("rsync",std::to_string(rsync));
}
#endif
@@ -688,5 +696,5 @@ void CopyEngineFactory::copyListOrder(bool checked)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed");
if(optionsEngine!=NULL)
- optionsEngine->setOptionValue(QStringLiteral("copyListOrder"),checked);
+ optionsEngine->setOptionValue("copyListOrder",booltostring(checked));
}