From bd56579c7d9de94c17287adefa118290e6b7ba33 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Fri, 23 Feb 2018 23:49:48 +0000 Subject: New upstream version 1.4.0.3 --- .../Ultracopier/CopyEngine-collision-and-error.cpp | 107 ++-- plugins/CopyEngine/Ultracopier/CopyEngine.cpp | 153 ++--- plugins/CopyEngine/Ultracopier/CopyEngine.h | 111 ++-- plugins/CopyEngine/Ultracopier/CopyEngine.pro | 165 +++--- .../CopyEngine/Ultracopier/CopyEngineFactory.cpp | 262 ++++----- plugins/CopyEngine/Ultracopier/CopyEngineFactory.h | 15 +- plugins/CopyEngine/Ultracopier/DebugDialog.cpp | 18 +- plugins/CopyEngine/Ultracopier/DebugDialog.h | 4 +- plugins/CopyEngine/Ultracopier/DiskSpace.cpp | 8 +- plugins/CopyEngine/Ultracopier/DiskSpace.h | 3 +- plugins/CopyEngine/Ultracopier/DriveManagement.cpp | 70 +-- plugins/CopyEngine/Ultracopier/DriveManagement.h | 14 +- plugins/CopyEngine/Ultracopier/FileErrorDialog.cpp | 8 +- plugins/CopyEngine/Ultracopier/FileErrorDialog.h | 2 +- .../CopyEngine/Ultracopier/FileExistsDialog.cpp | 36 +- plugins/CopyEngine/Ultracopier/FileExistsDialog.h | 10 +- .../CopyEngine/Ultracopier/FileIsSameDialog.cpp | 34 +- plugins/CopyEngine/Ultracopier/FileIsSameDialog.h | 10 +- plugins/CopyEngine/Ultracopier/FilterRules.cpp | 12 +- plugins/CopyEngine/Ultracopier/FilterRules.h | 48 +- plugins/CopyEngine/Ultracopier/Filters.cpp | 171 +++--- plugins/CopyEngine/Ultracopier/Filters.h | 12 +- .../CopyEngine/Ultracopier/FolderExistsDialog.cpp | 36 +- .../CopyEngine/Ultracopier/FolderExistsDialog.h | 12 +- .../Ultracopier/Languages/ar/translation.ts | 248 ++++----- .../Ultracopier/Languages/de/translation.ts | 252 +++++---- .../Ultracopier/Languages/el/translation.ts | 248 ++++----- .../Ultracopier/Languages/en/translation.ts | 248 ++++----- .../Ultracopier/Languages/es/translation.ts | 264 +++++---- .../Ultracopier/Languages/fr/translation.ts | 292 +++++----- .../Ultracopier/Languages/hi/translation.ts | 248 ++++----- .../Ultracopier/Languages/hu/translation.ts | 256 +++++---- .../Ultracopier/Languages/id/translation.ts | 248 ++++----- .../Ultracopier/Languages/it/translation.ts | 268 +++++---- .../Ultracopier/Languages/ja/translation.ts | 248 ++++----- .../Ultracopier/Languages/ko/translation.ts | 252 +++++---- .../Ultracopier/Languages/nl/translation.ts | 248 ++++----- .../Ultracopier/Languages/no/translation.ts | 248 ++++----- .../Ultracopier/Languages/pl/translation.ts | 248 ++++----- .../Ultracopier/Languages/pt/translation.ts | 248 ++++----- .../Ultracopier/Languages/ru/translation.ts | 252 +++++---- .../Ultracopier/Languages/th/translation.ts | 248 ++++----- .../Ultracopier/Languages/tr/translation.ts | 248 ++++----- .../Ultracopier/Languages/zh/translation.ts | 248 ++++----- plugins/CopyEngine/Ultracopier/ListThread.cpp | 617 +++++++++++---------- plugins/CopyEngine/Ultracopier/ListThread.h | 169 +++--- .../Ultracopier/ListThread_InodeAction.cpp | 16 +- plugins/CopyEngine/Ultracopier/MkPath.cpp | 87 +-- plugins/CopyEngine/Ultracopier/MkPath.h | 16 +- plugins/CopyEngine/Ultracopier/ReadThread.cpp | 112 ++-- plugins/CopyEngine/Ultracopier/ReadThread.h | 18 +- plugins/CopyEngine/Ultracopier/RenamingRules.cpp | 22 +- plugins/CopyEngine/Ultracopier/RenamingRules.h | 8 +- .../CopyEngine/Ultracopier/ScanFileOrFolder.cpp | 259 ++++----- plugins/CopyEngine/Ultracopier/ScanFileOrFolder.h | 46 +- .../Ultracopier/StructEnumDefinition_CopyEngine.h | 14 +- plugins/CopyEngine/Ultracopier/TransferThread.cpp | 462 +++++++-------- plugins/CopyEngine/Ultracopier/TransferThread.h | 54 +- plugins/CopyEngine/Ultracopier/WriteThread.cpp | 159 +++--- plugins/CopyEngine/Ultracopier/WriteThread.h | 16 +- plugins/CopyEngine/Ultracopier/documentation.dox | 2 +- plugins/CopyEngine/Ultracopier/informations.xml | 2 +- 62 files changed, 4235 insertions(+), 4225 deletions(-) (limited to 'plugins/CopyEngine/Ultracopier') diff --git a/plugins/CopyEngine/Ultracopier/CopyEngine-collision-and-error.cpp b/plugins/CopyEngine/Ultracopier/CopyEngine-collision-and-error.cpp index 5315c84..16c36ae 100644 --- a/plugins/CopyEngine/Ultracopier/CopyEngine-collision-and-error.cpp +++ b/plugins/CopyEngine/Ultracopier/CopyEngine-collision-and-error.cpp @@ -14,7 +14,7 @@ void CopyEngine::fileAlreadyExistsSlot(QFileInfo source,QFileInfo destination,bo } /// \note Can be call without queue because all call will be serialized -void CopyEngine::errorOnFileSlot(QFileInfo fileInfo,QString errorString,TransferThread * thread,const ErrorType &errorType) +void CopyEngine::errorOnFileSlot(QFileInfo fileInfo,std::string errorString,TransferThread * thread,const ErrorType &errorType) { errorOnFile(fileInfo,errorString,thread,errorType); } @@ -26,13 +26,13 @@ void CopyEngine::folderAlreadyExistsSlot(QFileInfo source,QFileInfo destination, } /// \note Can be call without queue because all call will be serialized -void CopyEngine::errorOnFolderSlot(QFileInfo fileInfo,QString errorString,ScanFileOrFolder * thread,ErrorType errorType) +void CopyEngine::errorOnFolderSlot(QFileInfo fileInfo,std::string errorString,ScanFileOrFolder * thread,ErrorType errorType) { errorOnFolder(fileInfo,errorString,thread,errorType); } //mkpath event -void CopyEngine::mkPathErrorOnFolderSlot(QFileInfo folder,QString error,ErrorType errorType) +void CopyEngine::mkPathErrorOnFolderSlot(QFileInfo folder,std::string error,ErrorType errorType) { mkPathErrorOnFolder(folder,error,errorType); } @@ -50,7 +50,7 @@ void CopyEngine::fileAlreadyExists(QFileInfo source,QFileInfo destination,bool i //load the action if(isSame) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"file is same: "+source.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"file is same: "+source.absoluteFilePath().toStdString()); FileExistsAction tempFileExistsAction=alwaysDoThisActionForFileExists; if(tempFileExistsAction==FileExists_Overwrite || tempFileExistsAction==FileExists_OverwriteIfNewer || tempFileExistsAction==FileExists_OverwriteIfNotSame || tempFileExistsAction==FileExists_OverwriteIfOlder) tempFileExistsAction=FileExists_NotSet; @@ -69,7 +69,7 @@ void CopyEngine::fileAlreadyExists(QFileInfo source,QFileInfo destination,bool i newItem.isSame=isSame; newItem.transfer=thread; newItem.scan=NULL; - alreadyExistsQueue << newItem; + alreadyExistsQueue.push_back(newItem); return; } dialogIsOpen=true; @@ -79,7 +79,7 @@ void CopyEngine::fileAlreadyExists(QFileInfo source,QFileInfo destination,bool i dialog.exec();/// \bug crash when external close FileExistsAction newAction=dialog.getAction(); emit isInPause(false); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"close dialog: "+QString::number(newAction)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"close dialog: "+std::to_string(newAction)); if(newAction==FileExists_Cancel) { emit cancelAll(); @@ -114,7 +114,7 @@ void CopyEngine::fileAlreadyExists(QFileInfo source,QFileInfo destination,bool i } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"file already exists: "+source.absoluteFilePath()+", destination: "+destination.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"file already exists: "+source.absoluteFilePath().toStdString()+", destination: "+destination.absoluteFilePath().toStdString()); FileExistsAction tempFileExistsAction=alwaysDoThisActionForFileExists; switch(tempFileExistsAction) { @@ -124,7 +124,7 @@ void CopyEngine::fileAlreadyExists(QFileInfo source,QFileInfo destination,bool i case FileExists_OverwriteIfNewer: case FileExists_OverwriteIfOlder: case FileExists_OverwriteIfNotSame: - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"always do this action: "+QString::number(tempFileExistsAction)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"always do this action: "+std::to_string(tempFileExistsAction)); thread->setFileExistsAction(tempFileExistsAction); break; default: @@ -133,6 +133,7 @@ void CopyEngine::fileAlreadyExists(QFileInfo source,QFileInfo destination,bool i ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("dialog open, put in queue: %1 %2") .arg(source.absoluteFilePath()) .arg(destination.absoluteFilePath()) + .toStdString() ); alreadyExistsQueueItem newItem; newItem.source=source; @@ -140,7 +141,7 @@ void CopyEngine::fileAlreadyExists(QFileInfo source,QFileInfo destination,bool i newItem.isSame=isSame; newItem.transfer=thread; newItem.scan=NULL; - alreadyExistsQueue << newItem; + alreadyExistsQueue.push_back(newItem); return; } dialogIsOpen=true; @@ -150,7 +151,7 @@ void CopyEngine::fileAlreadyExists(QFileInfo source,QFileInfo destination,bool i dialog.exec();/// \bug crash when external close FileExistsAction newAction=dialog.getAction(); emit isInPause(false); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"close dialog: "+QString::number(newAction)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"close dialog: "+std::to_string(newAction)); if(newAction==FileExists_Cancel) { emit cancelAll(); @@ -201,7 +202,7 @@ void CopyEngine::fileAlreadyExists(QFileInfo source,QFileInfo destination,bool i ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"stop"); } -void CopyEngine::haveNeedPutAtBottom(bool needPutAtBottom, const QFileInfo &fileInfo, const QString &errorString,TransferThread *thread,const ErrorType &errorType) +void CopyEngine::haveNeedPutAtBottom(bool needPutAtBottom, const QFileInfo &fileInfo, const std::string &errorString,TransferThread *thread,const ErrorType &errorType) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); if(!needPutAtBottom) @@ -217,12 +218,12 @@ void CopyEngine::haveNeedPutAtBottom(bool needPutAtBottom, const QFileInfo &file newItem.scan=NULL; newItem.transfer=thread; newItem.errorType=errorType; - errorQueue << newItem; + errorQueue.push_back(newItem); showOneNewDialog(); } } -void CopyEngine::missingDiskSpace(QList list) +void CopyEngine::missingDiskSpace(std::vector list) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"show dialog"); DiskSpace dialog(facilityEngine,list,interface); @@ -230,7 +231,7 @@ void CopyEngine::missingDiskSpace(QList list) dialog.exec();/// \bug crash when external close bool ok=dialog.getAction(); emit isInPause(false); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"cancel: "+QString::number(ok)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"cancel: "+std::to_string(ok)); if(!ok) emit cancelAll(); else @@ -238,11 +239,11 @@ void CopyEngine::missingDiskSpace(QList list) } /// \note Can be call without queue because all call will be serialized -void CopyEngine::errorOnFile(QFileInfo fileInfo,QString errorString,TransferThread * thread,const ErrorType &errorType,bool isCalledByShowOneNewDialog) +void CopyEngine::errorOnFile(QFileInfo fileInfo,std::string errorString,TransferThread * thread,const ErrorType &errorType,bool isCalledByShowOneNewDialog) { if(stopIt) return; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"file have error: "+fileInfo.absoluteFilePath()+", error: "+errorString); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"file have error: "+fileInfo.absoluteFilePath().toStdString()+", error: "+errorString); if(thread==NULL) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"unable to locate the thread"); @@ -274,18 +275,18 @@ void CopyEngine::errorOnFile(QFileInfo fileInfo,QString errorString,TransferThre newItem.scan=NULL; newItem.transfer=thread; newItem.errorType=errorType; - errorQueue << newItem; + errorQueue.push_back(newItem); return; } dialogIsOpen=true; ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"show dialog"); - emit error(fileInfo.absoluteFilePath(),fileInfo.size(),fileInfo.lastModified(),errorString); + emit error(fileInfo.absoluteFilePath().toStdString(),fileInfo.size(),fileInfo.lastModified().toMSecsSinceEpoch()/1000,errorString); FileErrorDialog dialog(interface,fileInfo,errorString,errorType); emit isInPause(true); dialog.exec();/// \bug crash when external close FileErrorAction newAction=dialog.getAction(); emit isInPause(false); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"close dialog: "+QString::number(newAction)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"close dialog: "+std::to_string(newAction)); if(newAction==FileError_Cancel) { emit cancelAll(); @@ -337,7 +338,7 @@ void CopyEngine::folderAlreadyExists(QFileInfo source,QFileInfo destination,bool { if(stopIt) return; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"folder already exists: "+source.absoluteFilePath()+", destination: "+destination.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"folder already exists: "+source.absoluteFilePath().toStdString()+", destination: "+destination.absoluteFilePath().toStdString()); if(thread==NULL) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"unable to locate the thread"); @@ -361,7 +362,7 @@ void CopyEngine::folderAlreadyExists(QFileInfo source,QFileInfo destination,bool newItem.isSame=isSame; newItem.transfer=NULL; newItem.scan=thread; - alreadyExistsQueue << newItem; + alreadyExistsQueue.push_back(newItem); return; } dialogIsOpen=true; @@ -369,7 +370,7 @@ void CopyEngine::folderAlreadyExists(QFileInfo source,QFileInfo destination,bool FolderExistsDialog dialog(interface,source,isSame,destination,firstRenamingRule,otherRenamingRule); dialog.exec();/// \bug crash when external close FolderExistsAction newAction=dialog.getAction(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"close dialog: "+QString::number(newAction)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"close dialog: "+std::to_string(newAction)); if(newAction==FolderExists_Cancel) { emit cancelAll(); @@ -391,11 +392,11 @@ void CopyEngine::folderAlreadyExists(QFileInfo source,QFileInfo destination,bool /// \note Can be call without queue because all call will be serialized /// \todo all this part -void CopyEngine::errorOnFolder(QFileInfo fileInfo, QString errorString, ScanFileOrFolder * thread, ErrorType errorType, bool isCalledByShowOneNewDialog) +void CopyEngine::errorOnFolder(QFileInfo fileInfo, std::string errorString, ScanFileOrFolder * thread, ErrorType errorType, bool isCalledByShowOneNewDialog) { if(stopIt) return; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"file have error: "+fileInfo.absoluteFilePath()+", error: "+errorString); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"file have error: "+fileInfo.absoluteFilePath().toStdString()+", error: "+errorString); if(thread==NULL) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"unable to locate the thread"); @@ -421,16 +422,16 @@ void CopyEngine::errorOnFolder(QFileInfo fileInfo, QString errorString, ScanFile newItem.scan=thread; newItem.transfer=NULL; newItem.errorType=errorType; - errorQueue << newItem; + errorQueue.push_back(newItem); return; } dialogIsOpen=true; ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"show dialog"); - emit error(fileInfo.absoluteFilePath(),fileInfo.size(),fileInfo.lastModified(),errorString); + emit error(fileInfo.absoluteFilePath().toStdString(),fileInfo.size(),fileInfo.lastModified().toMSecsSinceEpoch()/1000,errorString); FileErrorDialog dialog(interface,fileInfo,errorString,errorType); dialog.exec();/// \bug crash when external close FileErrorAction newAction=dialog.getAction(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"close dialog: "+QString::number(newAction)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"close dialog: "+std::to_string(newAction)); if(newAction==FileError_Cancel) { emit cancelAll(); @@ -454,11 +455,11 @@ void CopyEngine::errorOnFolder(QFileInfo fileInfo, QString errorString, ScanFile // ----------------------------------------------------- //mkpath event -void CopyEngine::mkPathErrorOnFolder(QFileInfo folder,QString errorString,const ErrorType &errorType,bool isCalledByShowOneNewDialog) +void CopyEngine::mkPathErrorOnFolder(QFileInfo folder,std::string errorString,const ErrorType &errorType,bool isCalledByShowOneNewDialog) { if(stopIt) return; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"file have error: "+folder.absoluteFilePath()+", error: "+errorString); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"file have error: "+folder.absoluteFilePath().toStdString()+", error: "+errorString); //load the always action FileErrorAction tempFileErrorAction=alwaysDoThisActionForFolderError; switch(tempFileErrorAction) @@ -480,16 +481,16 @@ void CopyEngine::mkPathErrorOnFolder(QFileInfo folder,QString errorString,const newItem.scan=NULL; newItem.transfer=NULL; newItem.errorType=errorType; - errorQueue << newItem; + errorQueue.push_back(newItem); return; } dialogIsOpen=true; ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"show dialog"); - emit error(folder.absoluteFilePath(),folder.size(),folder.lastModified(),errorString); + emit error(folder.absoluteFilePath().toStdString(),folder.size(),folder.lastModified().toMSecsSinceEpoch()/1000,errorString); FileErrorDialog dialog(interface,folder,errorString,errorType); dialog.exec();/// \bug crash when external close FileErrorAction newAction=dialog.getAction(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"close dialog: "+QString::number(newAction)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"close dialog: "+std::to_string(newAction)); if(newAction==FileError_Cancel) { emit cancelAll(); @@ -510,7 +511,7 @@ void CopyEngine::mkPathErrorOnFolder(QFileInfo folder,QString errorString,const listThread->mkPathQueue.retry(); break; default: - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unknow switch case: "+QString::number(newAction)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unknow switch case: "+std::to_string(newAction)); break; } if(!isCalledByShowOneNewDialog) @@ -526,42 +527,42 @@ void CopyEngine::showOneNewDialog() { if(stopIt) return; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"alreadyExistsQueue.size(): "+QString::number(alreadyExistsQueue.size())); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"errorQueue.size(): "+QString::number(errorQueue.size())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"alreadyExistsQueue.size(): "+std::to_string(alreadyExistsQueue.size())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"errorQueue.size(): "+std::to_string(errorQueue.size())); int loop_size=alreadyExistsQueue.size(); while(loop_size>0) { - if(alreadyExistsQueue.first().transfer!=NULL) + if(alreadyExistsQueue.front().transfer!=NULL) { - fileAlreadyExists(alreadyExistsQueue.first().source, - alreadyExistsQueue.first().destination, - alreadyExistsQueue.first().isSame, - alreadyExistsQueue.first().transfer, + fileAlreadyExists(alreadyExistsQueue.front().source, + alreadyExistsQueue.front().destination, + alreadyExistsQueue.front().isSame, + alreadyExistsQueue.front().transfer, true); } - else if(alreadyExistsQueue.first().scan!=NULL) - folderAlreadyExists(alreadyExistsQueue.first().source, - alreadyExistsQueue.first().destination, - alreadyExistsQueue.first().isSame, - alreadyExistsQueue.first().scan, + else if(alreadyExistsQueue.front().scan!=NULL) + folderAlreadyExists(alreadyExistsQueue.front().source, + alreadyExistsQueue.front().destination, + alreadyExistsQueue.front().isSame, + alreadyExistsQueue.front().scan, true); else ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"bug, no thread actived"); - alreadyExistsQueue.removeFirst(); + alreadyExistsQueue.erase(alreadyExistsQueue.cbegin()); loop_size--; } loop_size=errorQueue.size(); while(errorQueue.size()>0 && loop_size>0) { - if(errorQueue.first().transfer!=NULL) - errorOnFile(errorQueue.first().inode,errorQueue.first().errorString,errorQueue.first().transfer,errorQueue.first().errorType,true); - else if(errorQueue.first().scan!=NULL) - errorOnFolder(errorQueue.first().inode,errorQueue.first().errorString,errorQueue.first().scan,errorQueue.first().errorType,true); - else if(errorQueue.first().mkPath) - mkPathErrorOnFolder(errorQueue.first().inode,errorQueue.first().errorString,errorQueue.first().errorType,true); + if(errorQueue.front().transfer!=NULL) + errorOnFile(errorQueue.front().inode,errorQueue.front().errorString,errorQueue.front().transfer,errorQueue.front().errorType,true); + else if(errorQueue.front().scan!=NULL) + errorOnFolder(errorQueue.front().inode,errorQueue.front().errorString,errorQueue.front().scan,errorQueue.front().errorType,true); + else if(errorQueue.front().mkPath) + mkPathErrorOnFolder(errorQueue.front().inode,errorQueue.front().errorString,errorQueue.front().errorType,true); else ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"bug, no thread actived"); - errorQueue.removeFirst(); + errorQueue.erase(errorQueue.cbegin()); loop_size--; } } diff --git a/plugins/CopyEngine/Ultracopier/CopyEngine.cpp b/plugins/CopyEngine/Ultracopier/CopyEngine.cpp index f9e16f4..f3d6e04 100644 --- a/plugins/CopyEngine/Ultracopier/CopyEngine.cpp +++ b/plugins/CopyEngine/Ultracopier/CopyEngine.cpp @@ -208,7 +208,7 @@ void CopyEngine::connectTheSignalsSlots() } #ifdef ULTRACOPIER_PLUGIN_DEBUG_WINDOW -void CopyEngine::updateTheDebugInfo(const QStringList &newList, const QStringList &newList2, const int &numberOfInodeOperation) +void CopyEngine::updateTheDebugInfo(const std::vector &newList, const std::vector &newList2, const int &numberOfInodeOperation) { debugDialogWindow.setTransferThreadList(newList); debugDialogWindow.setTransferList(newList2); @@ -333,7 +333,7 @@ bool CopyEngine::getOptionsEngine(QWidget * tempWidget) ui->comboBoxFolderError->setCurrentIndex(1); break; default: - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Error, unknow index, ignored: "+QString::number(alwaysDoThisActionForFolderError)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Error, unknow index, ignored: "+std::to_string(alwaysDoThisActionForFolderError)); ui->comboBoxFolderError->setCurrentIndex(0); break; } @@ -411,31 +411,31 @@ void CopyEngine::setInterfacePointer(QWidget * interface) emit send_sendNewRenamingRules(firstRenamingRule,otherRenamingRule); } -bool CopyEngine::haveSameSource(const QStringList &sources) +bool CopyEngine::haveSameSource(const std::vector &sources) { return listThread->haveSameSource(sources); } -bool CopyEngine::haveSameDestination(const QString &destination) +bool CopyEngine::haveSameDestination(const std::string &destination) { return listThread->haveSameDestination(destination); } -bool CopyEngine::newCopy(const QStringList &sources) +bool CopyEngine::newCopy(const std::vector &sources) { if(forcedMode && mode!=Ultracopier::Copy) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"The engine is forced to move, you can't copy with it"); - QMessageBox::critical(NULL,facilityEngine->translateText(QStringLiteral("Internal error")),tr("The engine is forced to move, you can't copy with it")); + QMessageBox::critical(NULL,QString::fromStdString(facilityEngine->translateText("Internal error")),tr("The engine is forced to move, you can't copy with it")); return false; } ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); - QString destination; - if(!defaultDestinationFolder.isEmpty() && QDir(defaultDestinationFolder).exists()) + std::string destination; + if(!defaultDestinationFolder.empty() && QDir(QString::fromStdString(defaultDestinationFolder)).exists()) destination = defaultDestinationFolder; else destination = askDestination(); - if(destination.isEmpty()) + if(destination.empty()) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"Canceled by the user"); return false; @@ -443,32 +443,32 @@ bool CopyEngine::newCopy(const QStringList &sources) return listThread->newCopy(sources,destination); } -bool CopyEngine::newCopy(const QStringList &sources,const QString &destination) +bool CopyEngine::newCopy(const std::vector &sources,const std::string &destination) { if(forcedMode && mode!=Ultracopier::Copy) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"The engine is forced to move, you can't copy with it"); - QMessageBox::critical(NULL,facilityEngine->translateText(QStringLiteral("Internal error")),tr("The engine is forced to move, you can't copy with it")); + QMessageBox::critical(NULL,QString::fromStdString(facilityEngine->translateText("Internal error")),tr("The engine is forced to move, you can't copy with it")); return false; } return listThread->newCopy(sources,destination); } -bool CopyEngine::newMove(const QStringList &sources) +bool CopyEngine::newMove(const std::vector &sources) { if(forcedMode && mode!=Ultracopier::Move) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"The engine is forced to copy, you can't move with it"); - QMessageBox::critical(NULL,facilityEngine->translateText(QStringLiteral("Internal error")),tr("The engine is forced to copy, you can't move with it")); + QMessageBox::critical(NULL,QString::fromStdString(facilityEngine->translateText("Internal error")),tr("The engine is forced to copy, you can't move with it")); return false; } ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); - QString destination; + std::string destination; if(!ui->defaultDestinationFolder->text().isEmpty() && QDir(ui->defaultDestinationFolder->text()).exists()) - destination = ui->defaultDestinationFolder->text(); + destination = ui->defaultDestinationFolder->text().toStdString(); else destination = askDestination(); - if(destination.isEmpty()) + if(destination.empty()) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"Canceled by the user"); return false; @@ -476,12 +476,12 @@ bool CopyEngine::newMove(const QStringList &sources) return listThread->newMove(sources,destination); } -bool CopyEngine::newMove(const QStringList &sources,const QString &destination) +bool CopyEngine::newMove(const std::vector &sources,const std::string &destination) { if(forcedMode && mode!=Ultracopier::Move) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"The engine is forced to copy, you can't move with it"); - QMessageBox::critical(NULL,facilityEngine->translateText(QStringLiteral("Internal error")),tr("The engine is forced to copy, you can't move with it")); + QMessageBox::critical(NULL,QString::fromStdString(facilityEngine->translateText("Internal error")),tr("The engine is forced to copy, you can't move with it")); return false; } return listThread->newMove(sources,destination); @@ -489,37 +489,39 @@ bool CopyEngine::newMove(const QStringList &sources,const QString &destination) void CopyEngine::defaultDestinationFolderBrowse() { - QString destination = askDestination(); - if(destination.isEmpty()) + std::string destination = askDestination(); + if(destination.empty()) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"Canceled by the user"); return; } ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"the value have changed"); if(uiIsInstalled) - ui->defaultDestinationFolder->setText(destination); + ui->defaultDestinationFolder->setText(QString::fromStdString(destination)); } -QString CopyEngine::askDestination() +std::string CopyEngine::askDestination() { - QString destination = listThread->getUniqueDestinationFolder(); - if(!destination.isEmpty()) + std::string destination = listThread->getUniqueDestinationFolder(); + if(!destination.empty()) { - QMessageBox::StandardButton button=QMessageBox::question(interface,tr("Destination"),tr("Use the actual destination \"%1\"?").arg(destination),QMessageBox::Yes | QMessageBox::No,QMessageBox::Yes); + QMessageBox::StandardButton button=QMessageBox::question(interface,tr("Destination"),tr("Use the actual destination \"%1\"?") + .arg(QString::fromStdString(destination)), + QMessageBox::Yes | QMessageBox::No,QMessageBox::Yes); if(button==QMessageBox::Yes) return destination; } - destination=QFileDialog::getExistingDirectory(interface,facilityEngine->translateText(QStringLiteral("Select destination directory")),QStringLiteral(""),QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); + destination=QFileDialog::getExistingDirectory(interface,QString::fromStdString(facilityEngine->translateText("Select destination directory")),QStringLiteral(""),QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks).toStdString(); return destination; } -void CopyEngine::newTransferList(const QString &file) +void CopyEngine::newTransferList(const std::string &file) { emit signal_importTransferList(file); } //because direct access to list thread into the main thread can't be do -quint64 CopyEngine::realByteTransfered() +uint64_t CopyEngine::realByteTransfered() { return size_for_speed; } @@ -605,7 +607,7 @@ void CopyEngine::updateBufferCheckbox() ui->osBufferLimit->setEnabled(ui->osBuffer->isChecked() && ui->osBufferLimited->isChecked()); } -void CopyEngine::set_setFilters(QStringList includeStrings,QStringList includeOptions,QStringList excludeStrings,QStringList excludeOptions) +void CopyEngine::set_setFilters(std::vector includeStrings,std::vector includeOptions,std::vector excludeStrings,std::vector excludeOptions) { if(filters!=NULL) { @@ -618,20 +620,24 @@ void CopyEngine::set_setFilters(QStringList includeStrings,QStringList includeOp this->excludeOptions=excludeOptions; } -void CopyEngine::setRenamingRules(QString firstRenamingRule,QString otherRenamingRule) +void CopyEngine::setRenamingRules(std::string firstRenamingRule,std::string otherRenamingRule) { sendNewRenamingRules(firstRenamingRule,otherRenamingRule); } bool CopyEngine::userAddFolder(const Ultracopier::CopyMode &mode) { - QString source = QFileDialog::getExistingDirectory(interface,facilityEngine->translateText(QStringLiteral("Select source directory")),QStringLiteral(""),QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); - if(source.isEmpty() || source.isNull() || source=="") + std::string source = QFileDialog::getExistingDirectory(interface,QString::fromStdString(facilityEngine->translateText("Select source directory")), + QStringLiteral(""), + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks).toStdString(); + if(source.empty() || source=="") return false; + std::vector sources; + sources.push_back(source); if(mode==Ultracopier::Copy) - return newCopy(QStringList() << source); + return newCopy(sources); else - return newMove(QStringList() << source); + return newMove(sources); } bool CopyEngine::userAddFile(const Ultracopier::CopyMode &mode) @@ -639,15 +645,24 @@ bool CopyEngine::userAddFile(const Ultracopier::CopyMode &mode) ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); QStringList sources = QFileDialog::getOpenFileNames( interface, - facilityEngine->translateText(QStringLiteral("Select one or more files to open")), + QString::fromStdString(facilityEngine->translateText("Select one or more files to open")), QStringLiteral(""), - facilityEngine->translateText(QStringLiteral("All files"))+QStringLiteral(" (*)")); - if(sources.isEmpty()) + QString::fromStdString(facilityEngine->translateText("All files"))+QStringLiteral(" (*)")); + + std::vector sourcesstd; + unsigned int index=0; + while(index<(unsigned int)sources.size()) + { + sourcesstd.push_back(sources.at(index).toStdString()); + index++; + } + + if(sourcesstd.empty()) return false; if(mode==Ultracopier::Copy) - return newCopy(sources); + return newCopy(sourcesstd); else - return newMove(sources); + return newMove(sourcesstd); } void CopyEngine::pause() @@ -660,7 +675,7 @@ void CopyEngine::resume() emit signal_resume(); } -void CopyEngine::skip(const quint64 &id) +void CopyEngine::skip(const uint64_t &id) { emit signal_skip(id); } @@ -674,27 +689,27 @@ void CopyEngine::cancel() emit tryCancel(); } -void CopyEngine::removeItems(const QList &ids) +void CopyEngine::removeItems(const std::vector &ids) { emit signal_removeItems(ids); } -void CopyEngine::moveItemsOnTop(const QList &ids) +void CopyEngine::moveItemsOnTop(const std::vector &ids) { emit signal_moveItemsOnTop(ids); } -void CopyEngine::moveItemsUp(const QList &ids) +void CopyEngine::moveItemsUp(const std::vector &ids) { emit signal_moveItemsUp(ids); } -void CopyEngine::moveItemsDown(const QList &ids) +void CopyEngine::moveItemsDown(const std::vector &ids) { emit signal_moveItemsDown(ids); } -void CopyEngine::moveItemsOnBottom(const QList &ids) +void CopyEngine::moveItemsOnBottom(const std::vector &ids) { emit signal_moveItemsOnBottom(ids); } @@ -713,8 +728,8 @@ void CopyEngine::forceMode(const Ultracopier::CopyMode &mode) #endif if(forcedMode) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Mode forced previously")); - QMessageBox::critical(NULL,facilityEngine->translateText(QStringLiteral("Internal error")),tr("The mode has been forced previously. This is an internal error, please report it")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Mode forced previously"); + QMessageBox::critical(NULL,QString::fromStdString(facilityEngine->translateText("Internal error")),tr("The mode has been forced previously. This is an internal error, please report it")); return; } #ifdef ULTRACOPIER_PLUGIN_RSYNC @@ -722,9 +737,9 @@ void CopyEngine::forceMode(const Ultracopier::CopyMode &mode) rsync=false; #endif if(mode==Ultracopier::Copy) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Force mode to copy")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Force mode to copy"); else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Force mode to move")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Force mode to move"); #ifdef ULTRACOPIER_PLUGIN_RSYNC if(uiIsInstalled) ui->rsync->setEnabled(mode==Ultracopier::Copy); @@ -736,33 +751,33 @@ void CopyEngine::forceMode(const Ultracopier::CopyMode &mode) void CopyEngine::exportTransferList() { - QString fileName = QFileDialog::getSaveFileName(interface,facilityEngine->translateText(QStringLiteral("Save transfer list")),QStringLiteral("transfer-list.lst"),facilityEngine->translateText(QStringLiteral("Transfer list"))+QStringLiteral(" (*.lst)")); - if(fileName.isEmpty()) + std::string fileName = QFileDialog::getSaveFileName(interface,QString::fromStdString(facilityEngine->translateText("Save transfer list")),QStringLiteral("transfer-list.lst"),QString::fromStdString(facilityEngine->translateText("Transfer list"))+QStringLiteral(" (*.lst)")).toStdString(); + if(fileName.empty()) return; emit signal_exportTransferList(fileName); } void CopyEngine::importTransferList() { - QString fileName = QFileDialog::getOpenFileName(interface,facilityEngine->translateText(QStringLiteral("Open transfer list")),QStringLiteral("transfer-list.lst"),facilityEngine->translateText(QStringLiteral("Transfer list"))+QStringLiteral(" (*.lst)")); - if(fileName.isEmpty()) + std::string fileName = QFileDialog::getOpenFileName(interface,QString::fromStdString(facilityEngine->translateText("Open transfer list")),QStringLiteral("transfer-list.lst"),QString::fromStdString(facilityEngine->translateText("Transfer list"))+QStringLiteral(" (*.lst)")).toStdString(); + if(fileName.empty()) return; emit signal_importTransferList(fileName); } -void CopyEngine::warningTransferList(const QString &warning) +void CopyEngine::warningTransferList(const std::string &warning) { - QMessageBox::warning(interface,facilityEngine->translateText(QStringLiteral("Error")),warning); + QMessageBox::warning(interface,QString::fromStdString(facilityEngine->translateText("Error")),QString::fromStdString(warning)); } -void CopyEngine::errorTransferList(const QString &error) +void CopyEngine::errorTransferList(const std::string &error) { - QMessageBox::critical(interface,facilityEngine->translateText(QStringLiteral("Error")),error); + QMessageBox::critical(interface,QString::fromStdString(facilityEngine->translateText("Error")),QString::fromStdString(error)); } -bool CopyEngine::setSpeedLimitation(const qint64 &speedLimitation) +bool CopyEngine::setSpeedLimitation(const int64_t &speedLimitation) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"maxSpeed: "+QString::number(speedLimitation)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"maxSpeed: "+std::to_string(speedLimitation)); maxSpeed=speedLimitation; emit send_speedLimitation(speedLimitation); return true; @@ -770,7 +785,7 @@ bool CopyEngine::setSpeedLimitation(const qint64 &speedLimitation) void CopyEngine::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(uiIsInstalled) if(index!=ui->comboBoxFileCollision->currentIndex()) ui->comboBoxFileCollision->setCurrentIndex(index); @@ -807,7 +822,7 @@ void CopyEngine::setFileCollision(int index) void CopyEngine::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(uiIsInstalled) if(index!=ui->comboBoxFileError->currentIndex()) ui->comboBoxFileError->setCurrentIndex(index); @@ -832,7 +847,7 @@ void CopyEngine::setFileError(int index) void CopyEngine::setTransferAlgorithm(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(uiIsInstalled) if(index!=ui->transferAlgorithm->currentIndex()) ui->transferAlgorithm->setCurrentIndex(index); @@ -977,7 +992,7 @@ void CopyEngine::setAutoStart(const bool autoStart) /// \brief set rsync void CopyEngine::setRsync(const bool rsync) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"set rsync: "+QString::number(rsync)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"set rsync: "+std::to_string(rsync)); this->rsync=rsync; if(uiIsInstalled) { @@ -1155,9 +1170,9 @@ void CopyEngine::sendNewFilters() emit send_setFilters(filters->getInclude(),filters->getExclude()); } -void CopyEngine::sendNewRenamingRules(QString firstRenamingRule,QString otherRenamingRule) +void CopyEngine::sendNewRenamingRules(std::string firstRenamingRule,std::string otherRenamingRule) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("new filter")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"new filter"); this->firstRenamingRule=firstRenamingRule; this->otherRenamingRule=otherRenamingRule; emit send_sendNewRenamingRules(firstRenamingRule,otherRenamingRule); @@ -1216,11 +1231,11 @@ void CopyEngine::setCheckDiskSpace(const bool &checkDiskSpace) listThread->setCheckDiskSpace(checkDiskSpace); } -void CopyEngine::setDefaultDestinationFolder(const QString &defaultDestinationFolder) +void CopyEngine::setDefaultDestinationFolder(const std::string &defaultDestinationFolder) { this->defaultDestinationFolder=defaultDestinationFolder; if(uiIsInstalled) - ui->defaultDestinationFolder->setText(defaultDestinationFolder); + ui->defaultDestinationFolder->setText(QString::fromStdString(defaultDestinationFolder)); } void CopyEngine::setCopyListOrder(const bool &order) @@ -1231,8 +1246,8 @@ void CopyEngine::setCopyListOrder(const bool &order) void CopyEngine::exportErrorIntoTransferList() { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"exportErrorIntoTransferList"); - QString fileName = QFileDialog::getSaveFileName(interface,facilityEngine->translateText(QStringLiteral("Save transfer list")),QStringLiteral("transfer-list.lst"),facilityEngine->translateText(QStringLiteral("Transfer list"))+QStringLiteral(" (*.lst)")); - if(fileName.isEmpty()) + std::string fileName = QFileDialog::getSaveFileName(interface,QString::fromStdString(facilityEngine->translateText("Save transfer list")),QStringLiteral("transfer-list.lst"),QString::fromStdString(facilityEngine->translateText("Transfer list"))+QStringLiteral(" (*.lst)")).toStdString(); + if(fileName.empty()) return; emit signal_exportErrorIntoTransferList(fileName); } diff --git a/plugins/CopyEngine/Ultracopier/CopyEngine.h b/plugins/CopyEngine/Ultracopier/CopyEngine.h index d38fd4e..e5311d8 100644 --- a/plugins/CopyEngine/Ultracopier/CopyEngine.h +++ b/plugins/CopyEngine/Ultracopier/CopyEngine.h @@ -6,7 +6,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -55,7 +56,7 @@ private: Filters * filters; RenamingRules * renamingRules; FacilityInterface * facilityEngine; - quint32 maxSpeed; + uint32_t maxSpeed; bool doRightTransfer; bool keepDate; int blockSize; @@ -79,7 +80,7 @@ private: TransferAlgorithm transferAlgorithm; bool dialogIsOpen; volatile bool stopIt; - QString defaultDestinationFolder; + std::string defaultDestinationFolder; /// \brief error queue struct errorQueueItem { @@ -88,10 +89,10 @@ private: bool mkPath; bool rmPath; QFileInfo inode; - QString errorString; + std::string errorString; ErrorType errorType; }; - QList errorQueue; + std::vector errorQueue; /// \brief already exists queue struct alreadyExistsQueueItem { @@ -101,8 +102,8 @@ private: QFileInfo destination; bool isSame; }; - QList alreadyExistsQueue; - quint64 size_for_speed;//because direct access to list thread into the main thread can't be do + std::vector alreadyExistsQueue; + uint64_t size_for_speed;//because direct access to list thread into the main thread can't be do Ultracopier::CopyMode mode; bool forcedMode; @@ -113,9 +114,9 @@ private: bool osBufferLimited; bool checkDiskSpace; unsigned int osBufferLimit; - QStringList includeStrings,includeOptions,excludeStrings,excludeOptions; - QString firstRenamingRule; - QString otherRenamingRule; + std::vector includeStrings,includeOptions,excludeStrings,excludeOptions; + std::string firstRenamingRule; + std::string otherRenamingRule; //send action done timer QTimer timerActionDone; @@ -126,7 +127,7 @@ private: int putAtBottom;//to keep how many automatic put at bottom have been used private slots: #ifdef ULTRACOPIER_PLUGIN_DEBUG_WINDOW - void updateTheDebugInfo(const QStringList &newList, const QStringList &newList2, const int &numberOfInodeOperation); + void updateTheDebugInfo(const std::vector &newList, const std::vector &newList2, const int &numberOfInodeOperation); #endif /************* External call ********************/ @@ -134,25 +135,25 @@ private slots: /// \note Can be call without queue because all call will be serialized void fileAlreadyExistsSlot(QFileInfo source,QFileInfo destination,bool isSame,TransferThread * thread); /// \note Can be call without queue because all call will be serialized - void errorOnFileSlot(QFileInfo fileInfo, QString errorString, TransferThread * thread, const ErrorType &errorType); + void errorOnFileSlot(QFileInfo fileInfo, std::string errorString, TransferThread * thread, const ErrorType &errorType); /// \note Can be call without queue because all call will be serialized void folderAlreadyExistsSlot(QFileInfo source,QFileInfo destination,bool isSame,ScanFileOrFolder * thread); /// \note Can be call without queue because all call will be serialized - void errorOnFolderSlot(QFileInfo fileInfo, QString errorString, ScanFileOrFolder * thread, ErrorType errorType); + void errorOnFolderSlot(QFileInfo fileInfo, std::string errorString, ScanFileOrFolder * thread, ErrorType errorType); //mkpath event - void mkPathErrorOnFolderSlot(QFileInfo, QString, ErrorType errorType); + void mkPathErrorOnFolderSlot(QFileInfo, std::string, ErrorType errorType); //dialog message /// \note Can be call without queue because all call will be serialized void fileAlreadyExists(QFileInfo source,QFileInfo destination,bool isSame,TransferThread * thread,bool isCalledByShowOneNewDialog=false); /// \note Can be call without queue because all call will be serialized - void errorOnFile(QFileInfo fileInfo, QString errorString, TransferThread * thread, const ErrorType &errorType, bool isCalledByShowOneNewDialog=false); + void errorOnFile(QFileInfo fileInfo, std::string errorString, TransferThread * thread, const ErrorType &errorType, bool isCalledByShowOneNewDialog=false); /// \note Can be call without queue because all call will be serialized void folderAlreadyExists(QFileInfo source,QFileInfo destination,bool isSame,ScanFileOrFolder * thread,bool isCalledByShowOneNewDialog=false); /// \note Can be call without queue because all call will be serialized - void errorOnFolder(QFileInfo fileInfo,QString errorString,ScanFileOrFolder * thread, ErrorType errorType,bool isCalledByShowOneNewDialog=false); + void errorOnFolder(QFileInfo fileInfo, std::string errorString, ScanFileOrFolder * thread, ErrorType errorType, bool isCalledByShowOneNewDialog=false); //mkpath event - void mkPathErrorOnFolder(QFileInfo, QString, const ErrorType &errorType, bool isCalledByShowOneNewDialog=false); + void mkPathErrorOnFolder(QFileInfo, std::string, const ErrorType &errorType, bool isCalledByShowOneNewDialog=false); //show one new dialog if needed void showOneNewDialog(); @@ -165,14 +166,14 @@ private slots: void osBufferLimited_toggled(bool); void osBufferLimit_editingFinished(); void showFilterDialog(); - void sendNewRenamingRules(QString firstRenamingRule,QString otherRenamingRule); + void sendNewRenamingRules(std::string firstRenamingRule,std::string otherRenamingRule); void showRenamingRules(); void get_realBytesTransfered(quint64 realBytesTransfered); void newActionInProgess(Ultracopier::EngineActionInProgress); void updatedBlockSize(); void updateBufferCheckbox(); - void haveNeedPutAtBottom(bool needPutAtBottom, const QFileInfo &fileInfo, const QString &errorString, TransferThread *thread, const ErrorType &errorType); - void missingDiskSpace(QList list); + void haveNeedPutAtBottom(bool needPutAtBottom, const QFileInfo &fileInfo, const std::string &errorString, TransferThread *thread, const ErrorType &errorType); + void missingDiskSpace(std::vector list); void exportErrorIntoTransferList(); public: /** \brief to send the options panel @@ -186,37 +187,37 @@ public: /** \brief compare the current sources of the copy, with the passed arguments * \param sources the sources list to compares with the current sources list * \return true if have same sources, else false (or empty) */ - bool haveSameSource(const QStringList &sources); + bool haveSameSource(const std::vector &sources); /** \brief compare the current destination of the copy, with the passed arguments * \param destination the destination to compares with the current destination * \return true if have same destination, else false (or empty) */ - bool haveSameDestination(const QString &destination); + bool haveSameDestination(const std::string &destination); //external soft like file browser have send copy/move list to do /** \brief send copy without destination, ask the destination * \param sources the sources list to copy * \return true if the copy have been accepted */ - bool newCopy(const QStringList &sources); + bool newCopy(const std::vector &sources); /** \brief send copy with destination * \param sources the sources list to copy * \param destination the destination to copy * \return true if the copy have been accepted */ - bool newCopy(const QStringList &sources,const QString &destination); + bool newCopy(const std::vector &sources,const std::string &destination); /** \brief send move without destination, ask the destination * \param sources the sources list to move * \return true if the move have been accepted */ - bool newMove(const QStringList &sources); + bool newMove(const std::vector &sources); /** \brief send move without destination, ask the destination * \param sources the sources list to move * \param destination the destination to move * \return true if the move have been accepted */ - bool newMove(const QStringList &sources,const QString &destination); + bool newMove(const std::vector &sources,const std::string &destination); /** \brief send the new transfer list * \param file the transfer list */ - void newTransferList(const QString &file); + void newTransferList(const std::string &file); /** \brief to get byte read, use by Ultracopier for the speed calculation * real size transfered to right speed calculation */ - quint64 realByteTransfered(); + uint64_t realByteTransfered(); /** \brief support speed limitation */ bool supportSpeedLimitation() const; @@ -233,16 +234,16 @@ public: void set_osBuffer(bool osBuffer); void set_osBufferLimited(bool osBufferLimited); void set_osBufferLimit(unsigned int osBufferLimit); - void set_setFilters(QStringList includeStrings,QStringList includeOptions,QStringList excludeStrings,QStringList excludeOptions); - void setRenamingRules(QString firstRenamingRule,QString otherRenamingRule); + void set_setFilters(std::vector includeStrings,std::vector includeOptions,std::vector excludeStrings,std::vector excludeOptions); + void setRenamingRules(std::string firstRenamingRule,std::string otherRenamingRule); #ifdef ULTRACOPIER_PLUGIN_RSYNC void setRsync(const bool rsync); #endif void setCheckDiskSpace(const bool &checkDiskSpace); - void setDefaultDestinationFolder(const QString &defaultDestinationFolder); + void setDefaultDestinationFolder(const std::string &defaultDestinationFolder); void setCopyListOrder(const bool &order); void defaultDestinationFolderBrowse(); - QString askDestination(); + std::string askDestination(); public slots: //user ask ask to add folder (add it with interface ask source/destination) /** \brief add folder called on the interface @@ -258,25 +259,25 @@ public slots: void resume(); /** \brief skip one transfer entry * \param id id of the file to remove */ - void skip(const quint64 &id); + void skip(const uint64_t &id); /// \brief cancel all the transfer void cancel(); //edit the transfer list /** \brief remove the selected item * \param ids ids is the id list of the selected items */ - void removeItems(const QList &ids); + void removeItems(const std::vector &ids); /** \brief move on top of the list the selected item * \param ids ids is the id list of the selected items */ - void moveItemsOnTop(const QList &ids); + void moveItemsOnTop(const std::vector &ids); /** \brief move up the list the selected item * \param ids ids is the id list of the selected items */ - void moveItemsUp(const QList &ids); + void moveItemsUp(const std::vector &ids); /** \brief move down the list the selected item * \param ids ids is the id list of the selected items */ - void moveItemsDown(const QList &ids); + void moveItemsDown(const std::vector &ids); /** \brief move on bottom of the list the selected item * \param ids ids is the id list of the selected items */ - void moveItemsOnBottom(const QList &ids); + void moveItemsOnBottom(const std::vector &ids); /** \brief give the forced mode, to export/import transfer list */ void forceMode(const Ultracopier::CopyMode &mode); @@ -287,7 +288,7 @@ public slots: /** \brief to set the speed limitation * -1 if not able, 0 if disabled */ - bool setSpeedLimitation(const qint64 &speedLimitation); + bool setSpeedLimitation(const int64_t &speedLimitation); // specific to this copy engine @@ -325,25 +326,25 @@ public slots: private slots: void setComboBoxFolderCollision(FolderExistsAction action,bool changeComboBox=true); void setComboBoxFolderError(FileErrorAction action,bool changeComboBox=true); - void warningTransferList(const QString &warning); - void errorTransferList(const QString &error); + void warningTransferList(const std::string &warning); + void errorTransferList(const std::string &error); signals: //action on the copy void signal_pause() const; void signal_resume() const; - void signal_skip(const quint64 &id) const; + void signal_skip(const uint64_t &id) const; //edit the transfer list - void signal_removeItems(const QList &ids) const; - void signal_moveItemsOnTop(const QList &ids) const; - void signal_moveItemsUp(const QList &ids) const; - void signal_moveItemsDown(const QList &ids) const; - void signal_moveItemsOnBottom(const QList &ids) const; + void signal_removeItems(const std::vector &ids) const; + void signal_moveItemsOnTop(const std::vector &ids) const; + void signal_moveItemsUp(const std::vector &ids) const; + void signal_moveItemsDown(const std::vector &ids) const; + void signal_moveItemsOnBottom(const std::vector &ids) const; void signal_forceMode(const Ultracopier::CopyMode &mode) const; - void signal_exportTransferList(const QString &fileName) const; - void signal_importTransferList(const QString &fileName) const; - void signal_exportErrorIntoTransferList(const QString &fileName) const; + void signal_exportTransferList(const std::string &fileName) const; + void signal_importTransferList(const std::string &fileName) const; + void signal_exportErrorIntoTransferList(const std::string &fileName) const; //action void signal_setTransferAlgorithm(TransferAlgorithm transferAlgorithm) const; @@ -353,21 +354,21 @@ signals: //internal cancel void tryCancel() const; - void getNeedPutAtBottom(const QFileInfo &fileInfo,const QString &errorString,TransferThread * thread,const ErrorType &errorType) const; + void getNeedPutAtBottom(const QFileInfo &fileInfo,const std::string &errorString,TransferThread * thread,const ErrorType &errorType) const; #ifdef ULTRACOPIER_PLUGIN_DEBUG /// \brief To debug source - void debugInformation(const Ultracopier::DebugLevel &level,QString fonction,QString text,QString file,int ligne) const; + void debugInformation(const Ultracopier::DebugLevel &level,std::string fonction,std::string text,std::string file,int ligne) const; #endif //other signals void queryOneNewDialog() const; - void send_speedLimitation(const qint64 &speedLimitation) const; + void send_speedLimitation(const uint64_t &speedLimitation) const; void send_blockSize(const int &blockSize) const; void send_osBufferLimit(const unsigned int &osBufferLimit) const; - void send_setFilters(const QList &include,const QList &exclude) const; - void send_sendNewRenamingRules(QString firstRenamingRule,QString otherRenamingRule) const; + void send_setFilters(const std::vector &include,const std::vector &exclude) const; + void send_sendNewRenamingRules(std::string firstRenamingRule,std::string otherRenamingRule) const; void send_parallelBuffer(const int ¶llelBuffer) const; void send_sequentialBuffer(const int &sequentialBuffer) const; void send_parallelizeIfSmallerThan(const int ¶llelizeIfSmallerThan) const; diff --git a/plugins/CopyEngine/Ultracopier/CopyEngine.pro b/plugins/CopyEngine/Ultracopier/CopyEngine.pro index 42078af..112e999 100644 --- a/plugins/CopyEngine/Ultracopier/CopyEngine.pro +++ b/plugins/CopyEngine/Ultracopier/CopyEngine.pro @@ -2,7 +2,7 @@ CONFIG += c++11 QMAKE_CXXFLAGS+="-std=c++0x -Wall -Wextra" mac:QMAKE_CXXFLAGS+="-stdlib=libc++" -QT += widgets +QT += widgets xml DEFINES += UNICODE _UNICODE TEMPLATE = lib CONFIG += plugin @@ -11,91 +11,96 @@ win32 { } HEADERS = \ - ../Ultracopier/StructEnumDefinition.h \ - ../Ultracopier/StructEnumDefinition_CopyEngine.h \ - ../Ultracopier/DebugEngineMacro.h \ - ../Ultracopier/Variable.h \ - ../Ultracopier/TransferThread.h \ - ../Ultracopier/ReadThread.h \ - ../Ultracopier/WriteThread.h \ - ../Ultracopier/MkPath.h \ - ../Ultracopier/AvancedQFile.h \ - ../Ultracopier/ListThread.h \ - ../../../interface/PluginInterface_CopyEngine.h \ - ../../../interface/OptionInterface.h \ - ../../../interface/FacilityInterface.h \ - ../Ultracopier/Filters.h \ - ../Ultracopier/FilterRules.h \ - ../Ultracopier/RenamingRules.h \ - ../Ultracopier/DriveManagement.h \ - ../Ultracopier/CopyEngine.h \ - ../Ultracopier/DebugDialog.h \ - ../Ultracopier/CopyEngineFactory.h \ - ../Ultracopier/FileErrorDialog.h \ - ../Ultracopier/FileExistsDialog.h \ - ../Ultracopier/FileIsSameDialog.h \ - ../Ultracopier/FolderExistsDialog.h \ - ../Ultracopier/ScanFileOrFolder.h \ - ../Ultracopier/DiskSpace.h + $$PWD/StructEnumDefinition.h \ + $$PWD/StructEnumDefinition_CopyEngine.h \ + $$PWD/DebugEngineMacro.h \ + $$PWD/Variable.h \ + $$PWD/TransferThread.h \ + $$PWD/ReadThread.h \ + $$PWD/WriteThread.h \ + $$PWD/MkPath.h \ + $$PWD/AvancedQFile.h \ + $$PWD/ListThread.h \ + $$PWD/../../../interface/PluginInterface_CopyEngine.h \ + $$PWD/../../../interface/OptionInterface.h \ + $$PWD/../../../interface/FacilityInterface.h \ + $$PWD/../../../cpp11addition.h \ + $$PWD/Filters.h \ + $$PWD/FilterRules.h \ + $$PWD/RenamingRules.h \ + $$PWD/DriveManagement.h \ + $$PWD/CopyEngine.h \ + $$PWD/DebugDialog.h \ + $$PWD/CopyEngineFactory.h \ + $$PWD/FileErrorDialog.h \ + $$PWD/FileExistsDialog.h \ + $$PWD/FileIsSameDialog.h \ + $$PWD/FolderExistsDialog.h \ + $$PWD/ScanFileOrFolder.h \ + $$PWD/DiskSpace.h SOURCES = \ - ../Ultracopier/TransferThread.cpp \ - ../Ultracopier/ReadThread.cpp \ - ../Ultracopier/WriteThread.cpp \ - ../Ultracopier/MkPath.cpp \ - ../Ultracopier/AvancedQFile.cpp \ - ../Ultracopier/ListThread.cpp \ - ../Ultracopier/Filters.cpp \ - ../Ultracopier/FilterRules.cpp \ - ../Ultracopier/RenamingRules.cpp \ - ../Ultracopier/ListThread_InodeAction.cpp \ - ../Ultracopier/DriveManagement.cpp \ - ../Ultracopier/CopyEngine-collision-and-error.cpp \ - ../Ultracopier/CopyEngine.cpp \ - ../Ultracopier/DebugDialog.cpp \ - ../Ultracopier/CopyEngineFactory.cpp \ - ../Ultracopier/FileErrorDialog.cpp \ - ../Ultracopier/FileExistsDialog.cpp \ - ../Ultracopier/FileIsSameDialog.cpp \ - ../Ultracopier/FolderExistsDialog.cpp \ - ../Ultracopier/ScanFileOrFolder.cpp \ - ../Ultracopier/DiskSpace.cpp + $$PWD/TransferThread.cpp \ + $$PWD/ReadThread.cpp \ + $$PWD/WriteThread.cpp \ + $$PWD/MkPath.cpp \ + $$PWD/AvancedQFile.cpp \ + $$PWD/ListThread.cpp \ + $$PWD/../../../cpp11addition.cpp \ + $$PWD/../../../cpp11additionstringtointcpp.cpp \ + $$PWD/Filters.cpp \ + $$PWD/FilterRules.cpp \ + $$PWD/RenamingRules.cpp \ + $$PWD/ListThread_InodeAction.cpp \ + $$PWD/DriveManagement.cpp \ + $$PWD/CopyEngine-collision-and-error.cpp \ + $$PWD/CopyEngine.cpp \ + $$PWD/DebugDialog.cpp \ + $$PWD/CopyEngineFactory.cpp \ + $$PWD/FileErrorDialog.cpp \ + $$PWD/FileExistsDialog.cpp \ + $$PWD/FileIsSameDialog.cpp \ + $$PWD/FolderExistsDialog.cpp \ + $$PWD/ScanFileOrFolder.cpp \ + $$PWD/DiskSpace.cpp TARGET = $$qtLibraryTarget(copyEngine) -TRANSLATIONS += ../Ultracopier/Languages/ar/translation.ts \ - ../Ultracopier/Languages/de/translation.ts \ - ../Ultracopier/Languages/el/translation.ts \ - ../Ultracopier/Languages/en/translation.ts \ - ../Ultracopier/Languages/es/translation.ts \ - ../Ultracopier/Languages/fr/translation.ts \ - ../Ultracopier/Languages/hi/translation.ts \ - ../Ultracopier/Languages/hu/translation.ts \ - ../Ultracopier/Languages/id/translation.ts \ - ../Ultracopier/Languages/it/translation.ts \ - ../Ultracopier/Languages/ja/translation.ts \ - ../Ultracopier/Languages/ko/translation.ts \ - ../Ultracopier/Languages/nl/translation.ts \ - ../Ultracopier/Languages/no/translation.ts \ - ../Ultracopier/Languages/pl/translation.ts \ - ../Ultracopier/Languages/pt/translation.ts \ - ../Ultracopier/Languages/ru/translation.ts \ - ../Ultracopier/Languages/th/translation.ts \ - ../Ultracopier/Languages/tr/translation.ts \ - ../Ultracopier/Languages/zh/translation.ts +TRANSLATIONS += \ + $$PWD/Languages/ar/translation.ts \ + $$PWD/Languages/de/translation.ts \ + $$PWD/Languages/el/translation.ts \ + $$PWD/Languages/en/translation.ts \ + $$PWD/Languages/es/translation.ts \ + $$PWD/Languages/fr/translation.ts \ + $$PWD/Languages/hi/translation.ts \ + $$PWD/Languages/hu/translation.ts \ + $$PWD/Languages/id/translation.ts \ + $$PWD/Languages/it/translation.ts \ + $$PWD/Languages/ja/translation.ts \ + $$PWD/Languages/ko/translation.ts \ + $$PWD/Languages/nl/translation.ts \ + $$PWD/Languages/no/translation.ts \ + $$PWD/Languages/pl/translation.ts \ + $$PWD/Languages/pt/translation.ts \ + $$PWD/Languages/ru/translation.ts \ + $$PWD/Languages/th/translation.ts \ + $$PWD/Languages/tr/translation.ts \ + $$PWD/Languages/zh/translation.ts FORMS += \ - ../Ultracopier/fileErrorDialog.ui \ - ../Ultracopier/fileExistsDialog.ui \ - ../Ultracopier/fileIsSameDialog.ui \ - ../Ultracopier/debugDialog.ui \ - ../Ultracopier/folderExistsDialog.ui \ - ../Ultracopier/Filters.ui \ - ../Ultracopier/FilterRules.ui \ - ../Ultracopier/RenamingRules.ui \ - ../Ultracopier/copyEngineOptions.ui \ - ../Ultracopier/DiskSpace.ui + $$PWD/fileErrorDialog.ui \ + $$PWD/fileExistsDialog.ui \ + $$PWD/fileIsSameDialog.ui \ + $$PWD/debugDialog.ui \ + $$PWD/folderExistsDialog.ui \ + $$PWD/Filters.ui \ + $$PWD/FilterRules.ui \ + $$PWD/RenamingRules.ui \ + $$PWD/copyEngineOptions.ui \ + $$PWD/DiskSpace.ui -OTHER_FILES += informations.xml +OTHER_FILES += \ + $$PWD/informations.xml !CONFIG(static) { RESOURCES += \ - ../Ultracopier/copyEngineResources.qrc + $$PWD/copyEngineResources.qrc } 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 #include +#include "../../../cpp11addition.h" #include "CopyEngineFactory.h" // The cmath header from MSVC does not contain round() @@ -32,6 +33,7 @@ CopyEngineFactory::CopyEngineFactory() : qRegisterMetaType >("QList"); qRegisterMetaType("QFileInfo"); qRegisterMetaType("Ultracopier::CopyMode"); + qRegisterMetaType >("std::vector"); 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 > KeysList; - KeysList.append(qMakePair(QStringLiteral("doRightTransfer"),QVariant(true))); + std::vector > KeysList; + KeysList.push_back(std::pair("doRightTransfer","true")); #ifndef Q_OS_LINUX - KeysList.append(qMakePair(QStringLiteral("keepDate"),QVariant(false))); + KeysList.push_back(std::pair("keepDate","false")); #else - KeysList.append(qMakePair(QStringLiteral("keepDate"),QVariant(true))); + KeysList.push_back(std::pair("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("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("sequentialBuffer",std::to_string(sequentialBuffer))); + KeysList.push_back(std::pair("parallelBuffer",std::to_string(parallelBuffer))); + KeysList.push_back(std::pair("parallelizeIfSmallerThan",std::to_string(128)));//128KB, better for modern hardware: Multiple queue en linux, SSD, ... + KeysList.push_back(std::pair("autoStart","true")); #ifdef ULTRACOPIER_PLUGIN_RSYNC - KeysList.append(qMakePair(QStringLiteral("rsync"),QVariant(true))); + KeysList.push_back(std::pair("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("folderError",std::to_string(0))); + KeysList.push_back(std::pair("folderCollision",std::to_string(0))); + KeysList.push_back(std::pair("fileError",std::to_string(2))); + KeysList.push_back(std::pair("fileCollision",std::to_string(0))); + KeysList.push_back(std::pair("transferAlgorithm",std::to_string(0))); + KeysList.push_back(std::pair("checkDestinationFolder","true")); + KeysList.push_back(std::pair("includeStrings","")); + KeysList.push_back(std::pair("includeOptions","")); + KeysList.push_back(std::pair("excludeStrings","")); + KeysList.push_back(std::pair("excludeOptions","")); + KeysList.push_back(std::pair("doChecksum","false")); + KeysList.push_back(std::pair("checksumIgnoreIfImpossible","true")); + KeysList.push_back(std::pair("checksumOnlyOnError","true")); + KeysList.push_back(std::pair("osBuffer","false")); + KeysList.push_back(std::pair("firstRenamingRule","")); + KeysList.push_back(std::pair("otherRenamingRule","")); + KeysList.push_back(std::pair("osBufferLimited","false")); + KeysList.push_back(std::pair("osBufferLimit",std::to_string(512))); + KeysList.push_back(std::pair("deletePartiallyTransferredFiles","true")); + KeysList.push_back(std::pair("moveTheWholeFolder","true")); + KeysList.push_back(std::pair("followTheStrictOrder","false")); + KeysList.push_back(std::pair("renameTheOriginalDestination","false")); + KeysList.push_back(std::pair("checkDiskSpace","true")); + KeysList.push_back(std::pair("defaultDestinationFolder","")); + KeysList.push_back(std::pair("inodeThreads",std::to_string(1))); + KeysList.push_back(std::pair("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 CopyEngineFactory::supportedProtocolsForTheSource() const { - return QStringList() << QStringLiteral("file"); + std::vector l; + l.push_back("file"); + return l; } -QStringList CopyEngineFactory::supportedProtocolsForTheDestination() const +std::vector CopyEngineFactory::supportedProtocolsForTheDestination() const { - return QStringList() << QStringLiteral("file"); + std::vector 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 &includeStrings,const std::vector &includeOptions,const std::vector &excludeStrings,const std::vector &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)); } diff --git a/plugins/CopyEngine/Ultracopier/CopyEngineFactory.h b/plugins/CopyEngine/Ultracopier/CopyEngineFactory.h index 548588f..59c4208 100644 --- a/plugins/CopyEngine/Ultracopier/CopyEngineFactory.h +++ b/plugins/CopyEngine/Ultracopier/CopyEngineFactory.h @@ -52,7 +52,7 @@ public: /// \brief to return the instance of the copy engine PluginInterface_CopyEngine * getInstance(); /// \brief set the resources, to store options, to have facilityInterface - void setResources(OptionInterface * options,const QString &writePath,const QString &pluginPath,FacilityInterface * facilityInterface,const bool &portableVersion); + void setResources(OptionInterface * options,const std::string &writePath,const std::string &pluginPath,FacilityInterface * facilityInterface,const bool &portableVersion); //get mode allowed /// \brief define if can copy file, folder or both Ultracopier::CopyType getCopyType(); @@ -61,9 +61,9 @@ public: /// \brief define if can only copy, or copy and move bool canDoOnlyCopy() const; /// \brief to get the supported protocols for the source - QStringList supportedProtocolsForTheSource() const; + std::vector supportedProtocolsForTheSource() const; /// \brief to get the supported protocols for the destination - QStringList supportedProtocolsForTheDestination() const; + std::vector supportedProtocolsForTheDestination() const; /// \brief to get the options of the copy engine QWidget * options(); @@ -77,8 +77,8 @@ private: RenamingRules *renamingRules; QStorageInfo storageInfo; QTimer lunchInitFunction; - QStringList includeStrings,includeOptions,excludeStrings,excludeOptions; - QString firstRenamingRule,otherRenamingRule; + std::vector includeStrings,includeOptions,excludeStrings,excludeOptions; + std::string firstRenamingRule,otherRenamingRule; #if defined(Q_OS_WIN32) || (defined(Q_OS_LINUX) && defined(_SC_PHYS_PAGES)) static size_t getTotalSystemMemory(); @@ -100,14 +100,15 @@ private slots: void setTransferAlgorithm(int index); void setCheckDestinationFolder(); void showFilterDialog(); - void sendNewFilters(const QStringList &includeStrings,const QStringList &includeOptions,const QStringList &excludeStrings,const QStringList &excludeOptions); + void sendNewFilters(const std::vector &includeStrings,const std::vector &includeOptions, + const std::vector &excludeStrings,const std::vector &excludeOptions); void doChecksum_toggled(bool); void checksumOnlyOnError_toggled(bool); void osBuffer_toggled(bool); void osBufferLimited_toggled(bool); void osBufferLimit_editingFinished(); void checksumIgnoreIfImpossible_toggled(bool); - void sendNewRenamingRules(const QString &firstRenamingRule, const QString &otherRenamingRule); + void sendNewRenamingRules(const std::string &firstRenamingRule, const std::string &otherRenamingRule); void showRenamingRules(); void updateBufferCheckbox(); void setFileCollision(int index); diff --git a/plugins/CopyEngine/Ultracopier/DebugDialog.cpp b/plugins/CopyEngine/Ultracopier/DebugDialog.cpp index a20f054..0b3fec4 100644 --- a/plugins/CopyEngine/Ultracopier/DebugDialog.cpp +++ b/plugins/CopyEngine/Ultracopier/DebugDialog.cpp @@ -19,10 +19,15 @@ DebugDialog::~DebugDialog() delete ui; } -void DebugDialog::setTransferList(const QStringList &list) +void DebugDialog::setTransferList(const std::vector &list) { ui->tranferList->clear(); - ui->tranferList->addItems(list); + unsigned int index=0; + while(indextranferList->addItem(QString::fromStdString(list.at(index))); + index++; + } } void DebugDialog::setActiveTransfer(const int &activeTransfer) @@ -35,10 +40,15 @@ void DebugDialog::setInodeUsage(const int &inodeUsage) ui->spinBoxNumberOfInode->setValue(inodeUsage); } -void DebugDialog::setTransferThreadList(const QStringList &list) +void DebugDialog::setTransferThreadList(const std::vector &list) { ui->transferThreadList->clear(); - ui->transferThreadList->addItems(list); + unsigned int index=0; + while(indextransferThreadList->addItem(QString::fromStdString(list.at(index))); + index++; + } } #endif diff --git a/plugins/CopyEngine/Ultracopier/DebugDialog.h b/plugins/CopyEngine/Ultracopier/DebugDialog.h index d2b1d6b..c84cfaa 100644 --- a/plugins/CopyEngine/Ultracopier/DebugDialog.h +++ b/plugins/CopyEngine/Ultracopier/DebugDialog.h @@ -23,9 +23,9 @@ public: explicit DebugDialog(QWidget *parent = 0); ~DebugDialog(); /// \brief to set the transfer list, limited in result to not slow down the application - void setTransferList(const QStringList &list); + void setTransferList(const std::vector &list); /// \brief show the transfer thread, it show be a thread pool in normal time - void setTransferThreadList(const QStringList &list); + void setTransferThreadList(const std::vector &list); /// \brief show how many transfer is active void setActiveTransfer(const int &activeTransfer); /// \brief show many many inode is manipulated diff --git a/plugins/CopyEngine/Ultracopier/DiskSpace.cpp b/plugins/CopyEngine/Ultracopier/DiskSpace.cpp index 2b8fec7..e9b996d 100644 --- a/plugins/CopyEngine/Ultracopier/DiskSpace.cpp +++ b/plugins/CopyEngine/Ultracopier/DiskSpace.cpp @@ -2,7 +2,7 @@ #include "ui_DiskSpace.h" #include "StructEnumDefinition_CopyEngine.h" -DiskSpace::DiskSpace(FacilityInterface * facilityEngine,QList list,QWidget *parent) : +DiskSpace::DiskSpace(FacilityInterface * facilityEngine,std::vector list,QWidget *parent) : QDialog(parent), ui(new Ui::DiskSpace) { @@ -21,9 +21,9 @@ DiskSpace::DiskSpace(FacilityInterface * facilityEngine,QList list,QW while(indexsizeToString(list.at(index).freeSpace)) - .arg(facilityEngine->sizeToString(list.at(index).requiredSpace)); + .arg(QString::fromStdString(list.at(index).drive)) + .arg(QString::fromStdString(facilityEngine->sizeToString(list.at(index).freeSpace))) + .arg(QString::fromStdString(facilityEngine->sizeToString(list.at(index).requiredSpace))); drives+=QStringLiteral("
"); index++; } diff --git a/plugins/CopyEngine/Ultracopier/DiskSpace.h b/plugins/CopyEngine/Ultracopier/DiskSpace.h index 7d52b52..5a923ab 100644 --- a/plugins/CopyEngine/Ultracopier/DiskSpace.h +++ b/plugins/CopyEngine/Ultracopier/DiskSpace.h @@ -2,6 +2,7 @@ #define DISKSPACE_H #include +#include #include "../../../interface/PluginInterface_CopyEngine.h" #include "StructEnumDefinition_CopyEngine.h" @@ -14,7 +15,7 @@ class DiskSpace : public QDialog Q_OBJECT public: - explicit DiskSpace(FacilityInterface * facilityEngine,QList list,QWidget *parent = 0); + explicit DiskSpace(FacilityInterface * facilityEngine,std::vector list,QWidget *parent = 0); ~DiskSpace(); bool getAction() const; private slots: diff --git a/plugins/CopyEngine/Ultracopier/DriveManagement.cpp b/plugins/CopyEngine/Ultracopier/DriveManagement.cpp index 221b4e8..8deaf3c 100644 --- a/plugins/CopyEngine/Ultracopier/DriveManagement.cpp +++ b/plugins/CopyEngine/Ultracopier/DriveManagement.cpp @@ -4,75 +4,77 @@ #include #include +#include "../../../cpp11addition.h" + DriveManagement::DriveManagement() { tryUpdate(); #ifdef Q_OS_WIN32 - reg1=QRegularExpression(QStringLiteral("^(\\\\\\\\|//)[^\\\\\\\\/]+(\\\\|/)[^\\\\\\\\/]+")); - reg2=QRegularExpression(QStringLiteral("^((\\\\\\\\|//)[^\\\\\\\\/]+(\\\\|/)[^\\\\\\\\/]+).*$")); - reg3=QRegularExpression(QStringLiteral("^[a-zA-Z]:[\\\\/]")); - reg4=QRegularExpression(QStringLiteral("^([a-zA-Z]:[\\\\/]).*$")); + reg1=std::regex("^(\\\\\\\\|//)[^\\\\\\\\/]+(\\\\|/)[^\\\\\\\\/]+"); + reg2=std::regex("^((\\\\\\\\|//)[^\\\\\\\\/]+(\\\\|/)[^\\\\\\\\/]+).*$"); + reg3=std::regex("^[a-zA-Z]:[\\\\/]"); + reg4=std::regex("^([a-zA-Z]:[\\\\/]).*$"); #endif /// \warn ULTRACOPIER_DEBUGCONSOLE() don't work here because the sinal slot is not connected! } //get drive of an file or folder -QString DriveManagement::getDrive(const QString &fileOrFolder) const +std::string DriveManagement::getDrive(const std::string &fileOrFolder) const { - const QString &inode=QDir::toNativeSeparators(fileOrFolder); + const std::string &inode=QDir::toNativeSeparators(QString::fromStdString(fileOrFolder)).toStdString(); int size=mountSysPoint.size(); for (int i = 0; i < size; ++i) { - if(inode.startsWith(mountSysPoint.at(i))) - return QDir::toNativeSeparators(mountSysPoint.at(i)); + if(stringStartWith(inode,mountSysPoint.at(i))) + return QDir::toNativeSeparators(QString::fromStdString(mountSysPoint.at(i))).toStdString(); } #ifdef Q_OS_WIN32 - if(fileOrFolder.contains(reg1)) + if(std::regex_match(fileOrFolder,reg1)) { - QString returnString=fileOrFolder; - returnString.replace(reg2,QStringLiteral("\\1")); + std::string returnString=fileOrFolder; + std::regex_replace(returnString,reg2,"$1"); return returnString; } //due to lack of WMI support into mingw, the new drive event is never called, this is a workaround - if(fileOrFolder.contains(reg3)) + if(std::regex_match(fileOrFolder,reg3)) { - QString returnString=fileOrFolder; - returnString.replace(reg4,QStringLiteral("\\1")); - return QDir::toNativeSeparators(returnString).toUpper(); + std::string returnString=fileOrFolder; + std::regex_replace(returnString,reg4,"$1"); + return QDir::toNativeSeparators(QString::fromStdString(returnString)).toUpper().toStdString(); } #endif //if unable to locate the right mount point - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("unable to locate the right mount point for: %1, mount point: %2").arg(fileOrFolder).arg(mountSysPoint.join(";"))); - return QString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"unable to locate the right mount point for: "+fileOrFolder+", mount point: "+stringimplode(mountSysPoint,";")); + return std::string(); } -QByteArray DriveManagement::getDriveType(const QString &drive) const +QByteArray DriveManagement::getDriveType(const std::string &drive) const { - int index=mountSysPoint.indexOf(drive); + int index=vectorindexOf(mountSysPoint,drive); if(index!=-1) return driveType.at(index); return QByteArray(); } -bool DriveManagement::isSameDrive(const QString &file1,const QString &file2) const +bool DriveManagement::isSameDrive(const std::string &file1,const std::string &file2) const { if(mountSysPoint.size()==0) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("no mount point found")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"no mount point found"); return false; } - const QString &drive1=getDrive(file1); - if(drive1.isEmpty()) + const std::string &drive1=getDrive(file1); + if(drive1.empty()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("drive for the file1 not found: %1").arg(file1)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"drive for the file1 not found: "+file1); return false; } - const QString &drive2=getDrive(file2); - if(drive2.isEmpty()) + const std::string &drive2=getDrive(file2); + if(drive2.empty()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("drive for the file2 not found: %1").arg(file2)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"drive for the file2 not found: "+file2); return false; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("%1 is egal to %2?").arg(drive1).arg(drive2)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,drive1+" is egal to "+drive2); if(drive1==drive2) return true; else @@ -87,15 +89,15 @@ void DriveManagement::tryUpdate() int index=0; while(index driveType; + std::vector mountSysPoint; + std::vector driveType; #ifdef Q_OS_WIN32 - QRegularExpression reg1,reg2,reg3,reg4; + std::regex reg1,reg2,reg3,reg4; #endif signals: /// \brief To debug source - void debugInformation(const Ultracopier::DebugLevel &level,const QString &fonction,const QString &text,const QString &file,const int &ligne) const; + void debugInformation(const Ultracopier::DebugLevel &level,const std::string &fonction,const std::string &text,const std::string &file,const int &ligne) const; }; #endif // DRIVEMANAGEMENT_H diff --git a/plugins/CopyEngine/Ultracopier/FileErrorDialog.cpp b/plugins/CopyEngine/Ultracopier/FileErrorDialog.cpp index 736cfeb..d88fb90 100644 --- a/plugins/CopyEngine/Ultracopier/FileErrorDialog.cpp +++ b/plugins/CopyEngine/Ultracopier/FileErrorDialog.cpp @@ -6,7 +6,7 @@ bool FileErrorDialog::isInAdmin=false; -FileErrorDialog::FileErrorDialog(QWidget *parent, QFileInfo fileInfo, QString errorString, const ErrorType &errorType) : +FileErrorDialog::FileErrorDialog(QWidget *parent, QFileInfo fileInfo, std::string errorString, const ErrorType &errorType) : QDialog(parent), ui(new Ui::fileErrorDialog) { @@ -19,10 +19,10 @@ FileErrorDialog::FileErrorDialog(QWidget *parent, QFileInfo fileInfo, QString er ui->setupUi(this); action=FileError_Cancel; - ui->label_error->setText(errorString); + ui->label_error->setText(QString::fromStdString(errorString)); if(fileInfo.exists()) { - ui->label_content_file_name->setText(TransferThread::resolvedName(fileInfo)); + ui->label_content_file_name->setText(QString::fromStdString(TransferThread::resolvedName(fileInfo))); if(ui->label_content_file_name->text().isEmpty()) { ui->label_content_file_name->setText(fileInfo.absoluteFilePath()); @@ -63,7 +63,7 @@ FileErrorDialog::FileErrorDialog(QWidget *parent, QFileInfo fileInfo, QString er } else { - ui->label_content_file_name->setText(TransferThread::resolvedName(fileInfo)); + ui->label_content_file_name->setText(QString::fromStdString(TransferThread::resolvedName(fileInfo))); if(ui->label_content_file_name->text().isEmpty()) { ui->label_content_file_name->setText(fileInfo.absoluteFilePath()); diff --git a/plugins/CopyEngine/Ultracopier/FileErrorDialog.h b/plugins/CopyEngine/Ultracopier/FileErrorDialog.h index 09a481e..133a8b0 100644 --- a/plugins/CopyEngine/Ultracopier/FileErrorDialog.h +++ b/plugins/CopyEngine/Ultracopier/FileErrorDialog.h @@ -25,7 +25,7 @@ class FileErrorDialog : public QDialog Q_OBJECT public: /// \brief create the object and pass all the informations to it - explicit FileErrorDialog(QWidget *parent,QFileInfo fileInfo,QString errorString,const ErrorType &errorType); + explicit FileErrorDialog(QWidget *parent,QFileInfo fileInfo,std::string errorString,const ErrorType &errorType); ~FileErrorDialog(); /// \brief return the the always checkbox is checked bool getAlways(); diff --git a/plugins/CopyEngine/Ultracopier/FileExistsDialog.cpp b/plugins/CopyEngine/Ultracopier/FileExistsDialog.cpp index 0e3ca78..91df1f8 100644 --- a/plugins/CopyEngine/Ultracopier/FileExistsDialog.cpp +++ b/plugins/CopyEngine/Ultracopier/FileExistsDialog.cpp @@ -2,11 +2,17 @@ #include "ui_fileExistsDialog.h" #include "TransferThread.h" +#ifdef Q_OS_WIN32 +#define CURRENTSEPARATOR "\\" +#else +#define CURRENTSEPARATOR "/" +#endif + #include #include #include -FileExistsDialog::FileExistsDialog(QWidget *parent,QFileInfo source,QFileInfo destination,QString firstRenamingRule,QString otherRenamingRule) : +FileExistsDialog::FileExistsDialog(QWidget *parent, QFileInfo source, QFileInfo destination, std::string firstRenamingRule, std::string otherRenamingRule) : QDialog(parent), ui(new Ui::fileExistsDialog) { @@ -21,20 +27,20 @@ FileExistsDialog::FileExistsDialog(QWidget *parent,QFileInfo source,QFileInfo de action=FileExists_Cancel; destinationInfo=destination; oldName=TransferThread::resolvedName(destination); - ui->lineEditNewName->setText(oldName); - ui->lineEditNewName->setPlaceholderText(oldName); + ui->lineEditNewName->setText(QString::fromStdString(oldName)); + ui->lineEditNewName->setPlaceholderText(QString::fromStdString(oldName)); ui->Overwrite->addAction(ui->actionOverwrite_if_newer); ui->Overwrite->addAction(ui->actionOverwrite_if_not_same_modification_date); ui->label_content_source_size->setText(QString::number(source.size())); ui->label_content_source_modified->setText(source.lastModified().toString()); - ui->label_content_source_file_name->setText(TransferThread::resolvedName(source)); + ui->label_content_source_file_name->setText(QString::fromStdString(TransferThread::resolvedName(source))); QString folder=source.absolutePath(); if(folder.size()>80) folder=folder.mid(0,38)+"..."+folder.mid(folder.size()-38); ui->label_content_source_folder->setText(folder); ui->label_content_destination_size->setText(QString::number(destination.size())); ui->label_content_destination_modified->setText(destination.lastModified().toString()); - ui->label_content_destination_file_name->setText(TransferThread::resolvedName(destination)); + ui->label_content_destination_file_name->setText(QString::fromStdString(TransferThread::resolvedName(destination))); folder=destination.absolutePath(); if(folder.size()>80) folder=folder.mid(0,38)+"..."+folder.mid(folder.size()-38); @@ -98,19 +104,19 @@ void FileExistsDialog::changeEvent(QEvent *e) } } -QString FileExistsDialog::getNewName() +std::string FileExistsDialog::getNewName() { - if(oldName==ui->lineEditNewName->text() || ui->checkBoxAlways->isChecked()) + if(oldName==ui->lineEditNewName->text().toStdString() || ui->checkBoxAlways->isChecked()) return oldName; else - return ui->lineEditNewName->text(); + return ui->lineEditNewName->text().toStdString(); } void FileExistsDialog::on_SuggestNewName_clicked() { QFileInfo destinationInfo=this->destinationInfo; QString absolutePath=destinationInfo.absolutePath(); - QString fileName=TransferThread::resolvedName(destinationInfo); + QString fileName=QString::fromStdString(TransferThread::resolvedName(destinationInfo)); QString suffix=""; QString destination; QString newFileName; @@ -127,26 +133,26 @@ void FileExistsDialog::on_SuggestNewName_clicked() { if(num==1) { - if(firstRenamingRule==QStringLiteral("")) + if(firstRenamingRule.empty()) newFileName=tr("%1 - copy").arg(fileName); else { - newFileName=firstRenamingRule; + newFileName=QString::fromStdString(firstRenamingRule); newFileName.replace("%name%",fileName); } } else { - if(otherRenamingRule=="") + if(otherRenamingRule.empty()) newFileName=tr("%1 - copy (%2)").arg(fileName).arg(num); else { - newFileName=otherRenamingRule; + newFileName=QString::fromStdString(otherRenamingRule); newFileName.replace(QStringLiteral("%name%"),fileName); newFileName.replace(QStringLiteral("%number%"),QString::number(num)); } } - destination=absolutePath+QDir::separator()+newFileName+suffix; + destination=absolutePath+CURRENTSEPARATOR+newFileName+suffix; destinationInfo.setFile(destination); num++; } @@ -202,7 +208,7 @@ bool FileExistsDialog::getAlways() void FileExistsDialog::updateRenameButton() { - ui->Rename->setEnabled(ui->checkBoxAlways->isChecked() || (!ui->lineEditNewName->text().contains(QRegularExpression("[/\\\\\\*]")) && oldName!=ui->lineEditNewName->text() && !ui->lineEditNewName->text().isEmpty())); + ui->Rename->setEnabled(ui->checkBoxAlways->isChecked() || (!ui->lineEditNewName->text().contains(QRegularExpression("[/\\\\\\*]")) && oldName!=ui->lineEditNewName->text().toStdString() && !ui->lineEditNewName->text().isEmpty())); } void FileExistsDialog::on_checkBoxAlways_toggled(bool checked) diff --git a/plugins/CopyEngine/Ultracopier/FileExistsDialog.h b/plugins/CopyEngine/Ultracopier/FileExistsDialog.h index c637e3b..05ff7e0 100644 --- a/plugins/CopyEngine/Ultracopier/FileExistsDialog.h +++ b/plugins/CopyEngine/Ultracopier/FileExistsDialog.h @@ -24,14 +24,14 @@ class FileExistsDialog : public QDialog Q_OBJECT public: /// \brief create the object and pass all the informations to it - explicit FileExistsDialog(QWidget *parent,QFileInfo source,QFileInfo destination,QString firstRenamingRule,QString otherRenamingRule); + explicit FileExistsDialog(QWidget *parent,QFileInfo source,QFileInfo destination,std::string firstRenamingRule,std::string otherRenamingRule); ~FileExistsDialog(); /// \brief return the the always checkbox is checked bool getAlways(); /// \brief return the action clicked FileExistsAction getAction(); /// \brief return the new rename is case in manual renaming - QString getNewName(); + std::string getNewName(); protected: void changeEvent(QEvent *e); private slots: @@ -51,10 +51,10 @@ private slots: private: Ui::fileExistsDialog *ui; FileExistsAction action; - QString oldName; + std::string oldName; QFileInfo destinationInfo; - QString firstRenamingRule; - QString otherRenamingRule; + std::string firstRenamingRule; + std::string otherRenamingRule; }; #endif // FILEEXISTSDIALOG_H diff --git a/plugins/CopyEngine/Ultracopier/FileIsSameDialog.cpp b/plugins/CopyEngine/Ultracopier/FileIsSameDialog.cpp index 7f3d565..3bee3ae 100644 --- a/plugins/CopyEngine/Ultracopier/FileIsSameDialog.cpp +++ b/plugins/CopyEngine/Ultracopier/FileIsSameDialog.cpp @@ -2,11 +2,17 @@ #include "ui_fileIsSameDialog.h" #include "TransferThread.h" +#ifdef Q_OS_WIN32 +#define CURRENTSEPARATOR "\\" +#else +#define CURRENTSEPARATOR "/" +#endif + #include #include #include -FileIsSameDialog::FileIsSameDialog(QWidget *parent,QFileInfo fileInfo,QString firstRenamingRule,QString otherRenamingRule) : +FileIsSameDialog::FileIsSameDialog(QWidget *parent, QFileInfo fileInfo, std::string firstRenamingRule, std::string otherRenamingRule) : QDialog(parent), ui(new Ui::fileIsSameDialog) { @@ -21,11 +27,11 @@ FileIsSameDialog::FileIsSameDialog(QWidget *parent,QFileInfo fileInfo,QString fi action=FileExists_Cancel; oldName=TransferThread::resolvedName(fileInfo); destinationInfo=fileInfo; - ui->lineEditNewName->setText(oldName); - ui->lineEditNewName->setPlaceholderText(oldName); + ui->lineEditNewName->setText(QString::fromStdString(oldName)); + ui->lineEditNewName->setPlaceholderText(QString::fromStdString(oldName)); ui->label_content_size->setText(QString::number(fileInfo.size())); ui->label_content_modified->setText(fileInfo.lastModified().toString()); - ui->label_content_file_name->setText(TransferThread::resolvedName(fileInfo)); + ui->label_content_file_name->setText(QString::fromStdString(TransferThread::resolvedName(fileInfo))); QString folder=fileInfo.absolutePath(); if(folder.size()>80) folder=folder.mid(0,38)+"..."+folder.mid(folder.size()-38); @@ -72,19 +78,19 @@ void FileIsSameDialog::changeEvent(QEvent *e) } } -QString FileIsSameDialog::getNewName() +std::string FileIsSameDialog::getNewName() { - if(oldName==ui->lineEditNewName->text() || ui->checkBoxAlways->isChecked()) + if(oldName==ui->lineEditNewName->text().toStdString() || ui->checkBoxAlways->isChecked()) return oldName; else - return ui->lineEditNewName->text(); + return ui->lineEditNewName->text().toStdString(); } void FileIsSameDialog::on_SuggestNewName_clicked() { QFileInfo destinationInfo=this->destinationInfo; QString absolutePath=destinationInfo.absolutePath(); - QString fileName=TransferThread::resolvedName(destinationInfo); + QString fileName=QString::fromStdString(TransferThread::resolvedName(destinationInfo)); QString suffix=""; QString destination; QString newFileName; @@ -101,26 +107,26 @@ void FileIsSameDialog::on_SuggestNewName_clicked() { if(num==1) { - if(firstRenamingRule=="") + if(firstRenamingRule.empty()) newFileName=tr("%1 - copy").arg(fileName); else { - newFileName=firstRenamingRule; + newFileName=QString::fromStdString(firstRenamingRule); newFileName.replace(QStringLiteral("%name%"),fileName); } } else { - if(otherRenamingRule=="") + if(otherRenamingRule.empty()) newFileName=tr("%1 - copy (%2)").arg(fileName).arg(num); else { - newFileName=otherRenamingRule; + newFileName=QString::fromStdString(otherRenamingRule); newFileName.replace(QStringLiteral("%name%"),fileName); newFileName.replace(QStringLiteral("%number%"),QString::number(num)); } } - destination=absolutePath+QDir::separator()+newFileName+suffix; + destination=absolutePath+CURRENTSEPARATOR+newFileName+suffix; destinationInfo.setFile(destination); num++; } @@ -158,7 +164,7 @@ bool FileIsSameDialog::getAlways() void FileIsSameDialog::updateRenameButton() { - ui->Rename->setEnabled(ui->checkBoxAlways->isChecked() || (!ui->lineEditNewName->text().contains(QRegularExpression("[/\\\\\\*]")) && oldName!=ui->lineEditNewName->text() && !ui->lineEditNewName->text().isEmpty())); + ui->Rename->setEnabled(ui->checkBoxAlways->isChecked() || (!ui->lineEditNewName->text().contains(QRegularExpression("[/\\\\\\*]")) && oldName!=ui->lineEditNewName->text().toStdString() && !ui->lineEditNewName->text().isEmpty())); } void FileIsSameDialog::on_lineEditNewName_textChanged(const QString &arg1) diff --git a/plugins/CopyEngine/Ultracopier/FileIsSameDialog.h b/plugins/CopyEngine/Ultracopier/FileIsSameDialog.h index c9be99c..5dc0067 100644 --- a/plugins/CopyEngine/Ultracopier/FileIsSameDialog.h +++ b/plugins/CopyEngine/Ultracopier/FileIsSameDialog.h @@ -24,14 +24,14 @@ class FileIsSameDialog : public QDialog Q_OBJECT public: /// \brief create the object and pass all the informations to it - explicit FileIsSameDialog(QWidget *parent,QFileInfo fileInfo,QString firstRenamingRule,QString otherRenamingRule); + explicit FileIsSameDialog(QWidget *parent,QFileInfo fileInfo,std::string firstRenamingRule,std::string otherRenamingRule); ~FileIsSameDialog(); /// \brief return the the always checkbox is checked bool getAlways(); /// \brief return the action clicked FileExistsAction getAction(); /// \brief return the new rename is case in manual renaming - QString getNewName(); + std::string getNewName(); protected: void changeEvent(QEvent *e); private slots: @@ -47,10 +47,10 @@ private slots: private: Ui::fileIsSameDialog *ui; FileExistsAction action; - QString oldName; + std::string oldName; QFileInfo destinationInfo; - QString firstRenamingRule; - QString otherRenamingRule; + std::string firstRenamingRule; + std::string otherRenamingRule; }; diff --git a/plugins/CopyEngine/Ultracopier/FilterRules.cpp b/plugins/CopyEngine/Ultracopier/FilterRules.cpp index 5d1827e..0f6bf2c 100644 --- a/plugins/CopyEngine/Ultracopier/FilterRules.cpp +++ b/plugins/CopyEngine/Ultracopier/FilterRules.cpp @@ -22,9 +22,9 @@ bool FilterRules::getIsValid() return isValid && haveBeenValided; } -QString FilterRules::get_search_text() +std::string FilterRules::get_search_text() { - return ui->search->text(); + return ui->search->text().toStdString(); } SearchType FilterRules::get_search_type() @@ -60,9 +60,9 @@ bool FilterRules::get_need_match_all() return ui->need_match_all->isChecked(); } -void FilterRules::set_search_text(QString search_text) +void FilterRules::set_search_text(std::string search_text) { - ui->search->setText(search_text); + ui->search->setText(QString::fromStdString(search_text)); } void FilterRules::set_search_type(SearchType search_type) @@ -102,7 +102,7 @@ void FilterRules::set_need_match_all(bool need_match_all) ui->need_match_all->setChecked(need_match_all); } -void FilterRules::on_search_textChanged(const QString &arg1) +void FilterRules::on_search_textChanged(const std::string &arg1) { Q_UNUSED(arg1); updateChecking(); @@ -159,7 +159,7 @@ void FilterRules::on_isValid_clicked() updateChecking(); } -void FilterRules::on_testString_textChanged(const QString &arg1) +void FilterRules::on_testString_textChanged(const std::string &arg1) { Q_UNUSED(arg1); updateChecking(); diff --git a/plugins/CopyEngine/Ultracopier/FilterRules.h b/plugins/CopyEngine/Ultracopier/FilterRules.h index f06f0cb..0838792 100644 --- a/plugins/CopyEngine/Ultracopier/FilterRules.h +++ b/plugins/CopyEngine/Ultracopier/FilterRules.h @@ -14,33 +14,33 @@ class FilterRules; /** All the filter rules to include/exclude some file during the listing */ class FilterRules : public QDialog { - Q_OBJECT - + Q_OBJECT + public: - explicit FilterRules(QWidget *parent = 0); - ~FilterRules(); - bool getIsValid(); - QString get_search_text(); - SearchType get_search_type(); - ApplyOn get_apply_on(); - bool get_need_match_all(); - void set_search_text(QString search_text); - void set_search_type(SearchType search_type); - void set_apply_on(ApplyOn apply_on); - void set_need_match_all(bool need_match_all); + explicit FilterRules(QWidget *parent = 0); + ~FilterRules(); + bool getIsValid(); + std::string get_search_text(); + SearchType get_search_type(); + ApplyOn get_apply_on(); + bool get_need_match_all(); + void set_search_text(std::string search_text); + void set_search_type(SearchType search_type); + void set_apply_on(ApplyOn apply_on); + void set_need_match_all(bool need_match_all); private slots: - void on_search_textChanged(const QString &arg1); - void on_isValid_clicked(); - void on_testString_textChanged(const QString &arg1); - void on_matched_clicked(); - void on_search_type_currentIndexChanged(int index); - void on_need_match_all_clicked(); - void on_buttonBox_clicked(QAbstractButton *button); + void on_search_textChanged(const std::string &arg1); + void on_isValid_clicked(); + void on_testString_textChanged(const std::string &arg1); + void on_matched_clicked(); + void on_search_type_currentIndexChanged(int index); + void on_need_match_all_clicked(); + void on_buttonBox_clicked(QAbstractButton *button); private: - Ui::FilterRules *ui; - void updateChecking(); - bool isValid; - bool haveBeenValided; + Ui::FilterRules *ui; + void updateChecking(); + bool isValid; + bool haveBeenValided; }; #endif // FILTERRULES_H diff --git a/plugins/CopyEngine/Ultracopier/Filters.cpp b/plugins/CopyEngine/Ultracopier/Filters.cpp index 3bb81d1..c7b1526 100644 --- a/plugins/CopyEngine/Ultracopier/Filters.cpp +++ b/plugins/CopyEngine/Ultracopier/Filters.cpp @@ -1,5 +1,6 @@ #include "Filters.h" #include "ui_Filters.h" +#include "../../../cpp11addition.h" #include @@ -15,35 +16,35 @@ Filters::~Filters() delete ui; } -void Filters::setFilters(QStringList includeStrings,QStringList includeOptions,QStringList excludeStrings,QStringList excludeOptions) +void Filters::setFilters(std::vector includeStrings,std::vector includeOptions,std::vector excludeStrings,std::vector excludeOptions) { if(includeStrings.size()!=includeOptions.size() || excludeStrings.size()!=excludeOptions.size()) return; Filters_rules new_item; include.clear(); - int index=0; - while(index options=stringsplit(includeOptions.at(index),';'); new_item.need_match_all=false; new_item.search_type=SearchType_rawText; new_item.apply_on=ApplyOn_fileAndFolder; - if(options.contains(QStringLiteral("SearchType_simpleRegex"))) + if(vectorcontainsAtLeastOne(options,std::string("SearchType_simpleRegex"))) new_item.search_type=SearchType_simpleRegex; - if(options.contains(QStringLiteral("SearchType_perlRegex"))) + if(vectorcontainsAtLeastOne(options,std::string("SearchType_perlRegex"))) new_item.search_type=SearchType_perlRegex; - if(options.contains(QStringLiteral("ApplyOn_file"))) + if(vectorcontainsAtLeastOne(options,std::string("ApplyOn_file"))) new_item.apply_on=ApplyOn_file; - if(options.contains(QStringLiteral("ApplyOn_folder"))) + if(vectorcontainsAtLeastOne(options,std::string("ApplyOn_folder"))) new_item.apply_on=ApplyOn_folder; - if(options.contains(QStringLiteral("need_match_all"))) + if(vectorcontainsAtLeastOne(options,std::string("need_match_all"))) new_item.need_match_all=true; if(convertToRegex(new_item)) - include << new_item; + include.push_back(new_item); index++; } @@ -53,24 +54,24 @@ void Filters::setFilters(QStringList includeStrings,QStringList includeOptions,Q while(index options=stringsplit(excludeOptions.at(index),';'); new_item.need_match_all=false; new_item.search_type=SearchType_rawText; new_item.apply_on=ApplyOn_fileAndFolder; - if(options.contains(QStringLiteral("SearchType_simpleRegex"))) + if(vectorcontainsAtLeastOne(options,std::string("SearchType_simpleRegex"))) new_item.search_type=SearchType_simpleRegex; - if(options.contains(QStringLiteral("SearchType_perlRegex"))) + if(vectorcontainsAtLeastOne(options,std::string("SearchType_perlRegex"))) new_item.search_type=SearchType_perlRegex; - if(options.contains(QStringLiteral("ApplyOn_file"))) + if(vectorcontainsAtLeastOne(options,std::string("ApplyOn_file"))) new_item.apply_on=ApplyOn_file; - if(options.contains(QStringLiteral("ApplyOn_folder"))) + if(vectorcontainsAtLeastOne(options,std::string("ApplyOn_folder"))) new_item.apply_on=ApplyOn_folder; - if(options.contains(QStringLiteral("need_match_all"))) + if(vectorcontainsAtLeastOne(options,std::string("need_match_all"))) new_item.need_match_all=true; if(convertToRegex(new_item)) - exclude << new_item; + exclude.push_back(new_item); index++; } @@ -81,21 +82,21 @@ void Filters::setFilters(QStringList includeStrings,QStringList includeOptions,Q void Filters::reShowAll() { ui->inclusion->clear(); - int index=0; - while(index optionsToShow; switch(include.at(index).search_type) { case SearchType_rawText: - optionsToShow << tr("Raw text"); + optionsToShow.push_back(tr("Raw text").toStdString()); break; case SearchType_simpleRegex: - optionsToShow << tr("Simplified regex"); + optionsToShow.push_back(tr("Simplified regex").toStdString()); break; case SearchType_perlRegex: - optionsToShow << tr("Perl's regex"); + optionsToShow.push_back(tr("Perl's regex").toStdString()); break; default: break; @@ -103,37 +104,37 @@ void Filters::reShowAll() switch(include.at(index).apply_on) { case ApplyOn_file: - optionsToShow << tr("Only on file"); + optionsToShow.push_back(tr("Only on file").toStdString()); break; case ApplyOn_folder: - optionsToShow << tr("Only on folder"); + optionsToShow.push_back(tr("Only on folder").toStdString()); break; default: break; } if(include.at(index).need_match_all) - optionsToShow << tr("Full match"); - entryShow+=optionsToShow.join(QStringLiteral(",")); + optionsToShow.push_back(tr("Full match").toStdString()); + entryShow+=stringimplode(optionsToShow,","); entryShow+=")"; - ui->inclusion->addItem(new QListWidgetItem(entryShow)); + ui->inclusion->addItem(new QListWidgetItem(QString::fromStdString(entryShow))); index++; } ui->exclusion->clear(); index=0; - while(index optionsToShow; switch(exclude.at(index).search_type) { case SearchType_rawText: - optionsToShow << tr("Raw text"); + optionsToShow.push_back(tr("Raw text").toStdString()); break; case SearchType_simpleRegex: - optionsToShow << tr("Simplified regex"); + optionsToShow.push_back(tr("Simplified regex").toStdString()); break; case SearchType_perlRegex: - optionsToShow << tr("Perl's regex"); + optionsToShow.push_back(tr("Perl's regex").toStdString()); break; default: break; @@ -141,29 +142,29 @@ void Filters::reShowAll() switch(exclude.at(index).apply_on) { case ApplyOn_file: - optionsToShow << tr("Only on file"); + optionsToShow.push_back(tr("Only on file").toStdString()); break; case ApplyOn_folder: - optionsToShow << tr("Only on folder"); + optionsToShow.push_back(tr("Only on folder").toStdString()); break; default: break; } if(exclude.at(index).need_match_all) - optionsToShow << tr("Full match"); - entryShow+=optionsToShow.join(QStringLiteral(",")); + optionsToShow.push_back(tr("Full match").toStdString()); + entryShow+=stringimplode(optionsToShow,","); entryShow+=")"; - ui->exclusion->addItem(new QListWidgetItem(entryShow)); + ui->exclusion->addItem(new QListWidgetItem(QString::fromStdString(entryShow))); index++; } } -QList Filters::getInclude() const +std::vector Filters::getInclude() const { return include; } -QList Filters::getExclude() const +std::vector Filters::getExclude() const { return exclude; } @@ -176,23 +177,23 @@ void Filters::newLanguageLoaded() void Filters::updateFilters() { - QStringList includeStrings,includeOptions,excludeStrings,excludeOptions; - int index=0; - while(index includeStrings,includeOptions,excludeStrings,excludeOptions; + unsigned int index=0; + while(index<(unsigned int)include.size()) { - includeStrings< optionsToShow; switch(include.at(index).search_type) { case SearchType_rawText: - optionsToShow << QStringLiteral("SearchType_rawText"); + optionsToShow.push_back("SearchType_rawText"); break; case SearchType_simpleRegex: - optionsToShow << QStringLiteral("SearchType_simpleRegex"); + optionsToShow.push_back("SearchType_simpleRegex"); break; case SearchType_perlRegex: - optionsToShow << QStringLiteral("SearchType_perlRegex"); + optionsToShow.push_back("SearchType_perlRegex"); break; default: break; @@ -200,38 +201,38 @@ void Filters::updateFilters() switch(include.at(index).apply_on) { case ApplyOn_file: - optionsToShow << QStringLiteral("ApplyOn_file"); + optionsToShow.push_back("ApplyOn_file"); break; case ApplyOn_fileAndFolder: - optionsToShow << QStringLiteral("ApplyOn_fileAndFolder"); + optionsToShow.push_back("ApplyOn_fileAndFolder"); break; case ApplyOn_folder: - optionsToShow << QStringLiteral("ApplyOn_folder"); + optionsToShow.push_back("ApplyOn_folder"); break; default: break; } if(include.at(index).need_match_all) - optionsToShow << tr("Full match"); - includeOptions< optionsToShow; switch(exclude.at(index).search_type) { case SearchType_rawText: - optionsToShow << QStringLiteral("SearchType_rawText"); + optionsToShow.push_back("SearchType_rawText"); break; case SearchType_simpleRegex: - optionsToShow << QStringLiteral("SearchType_simpleRegex"); + optionsToShow.push_back("SearchType_simpleRegex"); break; case SearchType_perlRegex: - optionsToShow << QStringLiteral("SearchType_perlRegex"); + optionsToShow.push_back("SearchType_perlRegex"); break; default: break; @@ -239,20 +240,20 @@ void Filters::updateFilters() switch(exclude.at(index).apply_on) { case ApplyOn_file: - optionsToShow << QStringLiteral("ApplyOn_file"); + optionsToShow.push_back("ApplyOn_file"); break; case ApplyOn_fileAndFolder: - optionsToShow << QStringLiteral("ApplyOn_fileAndFolder"); + optionsToShow.push_back("ApplyOn_fileAndFolder"); break; case ApplyOn_folder: - optionsToShow << QStringLiteral("ApplyOn_folder"); + optionsToShow.push_back("ApplyOn_folder"); break; default: break; } if(exclude.at(index).need_match_all) - optionsToShow << tr("Full match"); - excludeOptions<exclusion->item(index)->isSelected()) { delete ui->exclusion->item(index); - exclude.removeAt(index); + exclude.erase(exclude.cbegin()+index); removedEntry=true; } else @@ -334,7 +337,7 @@ void Filters::on_remove_inclusion_clicked() if(ui->inclusion->item(index)->isSelected()) { delete ui->inclusion->item(index); - include.removeAt(index); + include.erase(include.cbegin()+index); removedEntry=true; } else @@ -358,7 +361,7 @@ void Filters::on_add_exclusion_clicked() new_item.need_match_all=dialog.get_need_match_all(); new_item.search_text=dialog.get_search_text(); new_item.search_type=dialog.get_search_type(); - exclude << new_item; + exclude.push_back(new_item); reShowAll(); updateFilters(); } @@ -382,7 +385,7 @@ void Filters::on_add_inclusion_clicked() new_item.search_text=dialog.get_search_text(); new_item.search_type=dialog.get_search_type(); if(convertToRegex(new_item)) - include << new_item; + include.push_back(new_item); reShowAll(); updateFilters(); } @@ -409,7 +412,7 @@ void Filters::on_edit_exclusion_clicked() exclude[index].search_text=dialog.get_search_text(); exclude[index].search_type=dialog.get_search_type(); if(!convertToRegex(exclude[index])) - exclude.removeAt(index); + exclude.erase(exclude.cbegin()+index); editedEntry=true; } } @@ -443,7 +446,7 @@ void Filters::on_edit_inclusion_clicked() exclude[index].search_text=dialog.get_search_text(); exclude[index].search_type=dialog.get_search_type(); if(!convertToRegex(exclude[index])) - exclude.removeAt(index); + exclude.erase(exclude.cbegin()+index); editedEntry=true; } } diff --git a/plugins/CopyEngine/Ultracopier/Filters.h b/plugins/CopyEngine/Ultracopier/Filters.h index 337f8cb..6645afc 100644 --- a/plugins/CopyEngine/Ultracopier/Filters.h +++ b/plugins/CopyEngine/Ultracopier/Filters.h @@ -18,19 +18,19 @@ class Filters : public QDialog public: explicit Filters(QWidget *parent = 0); ~Filters(); - void setFilters(QStringList includeStrings,QStringList includeOptions,QStringList excludeStrings,QStringList excludeOptions); + void setFilters(std::vector includeStrings, std::vector includeOptions, std::vector excludeStrings, std::vector excludeOptions); void reShowAll(); - QList getInclude() const; - QList getExclude() const; + std::vector getInclude() const; + std::vector getExclude() const; void newLanguageLoaded(); private: Ui::Filters *ui; - QList include; - QList exclude; + std::vector include; + std::vector exclude; void updateFilters(); bool convertToRegex(Filters_rules &item); signals: - void sendNewFilters(const QStringList &includeStrings,const QStringList &includeOptions,const QStringList &excludeStrings,const QStringList &excludeOptions) const; + void sendNewFilters(const std::vector &includeStrings,const std::vector &includeOptions,const std::vector &excludeStrings,const std::vector &excludeOptions) const; void haveNewFilters() const; private slots: void on_remove_exclusion_clicked(); diff --git a/plugins/CopyEngine/Ultracopier/FolderExistsDialog.cpp b/plugins/CopyEngine/Ultracopier/FolderExistsDialog.cpp index ac1e74e..d05a715 100644 --- a/plugins/CopyEngine/Ultracopier/FolderExistsDialog.cpp +++ b/plugins/CopyEngine/Ultracopier/FolderExistsDialog.cpp @@ -2,11 +2,17 @@ #include "ui_folderExistsDialog.h" #include "TransferThread.h" +#ifdef Q_OS_WIN32 +#define CURRENTSEPARATOR "\\" +#else +#define CURRENTSEPARATOR "/" +#endif + #include #include #include -FolderExistsDialog::FolderExistsDialog(QWidget *parent,QFileInfo source,bool isSame,QFileInfo destination,QString firstRenamingRule,QString otherRenamingRule) : +FolderExistsDialog::FolderExistsDialog(QWidget *parent, QFileInfo source, bool isSame, QFileInfo destination, std::string firstRenamingRule, std::string otherRenamingRule) : QDialog(parent), ui(new Ui::folderExistsDialog) { @@ -20,8 +26,8 @@ FolderExistsDialog::FolderExistsDialog(QWidget *parent,QFileInfo source,bool isS ui->setupUi(this); action=FolderExists_Cancel; oldName=TransferThread::resolvedName(destination); - ui->lineEditNewName->setText(oldName); - ui->lineEditNewName->setPlaceholderText(oldName); + ui->lineEditNewName->setText(QString::fromStdString(oldName)); + ui->lineEditNewName->setPlaceholderText(QString::fromStdString(oldName)); ui->label_content_source_modified->setText(source.lastModified().toString()); ui->label_content_source_folder_name->setText(source.fileName()); QString folder=source.absolutePath(); @@ -83,20 +89,20 @@ void FolderExistsDialog::changeEvent(QEvent *e) } } -QString FolderExistsDialog::getNewName() +std::string FolderExistsDialog::getNewName() { - if(oldName==ui->lineEditNewName->text() || ui->checkBoxAlways->isChecked()) + if(oldName==ui->lineEditNewName->text().toStdString() || ui->checkBoxAlways->isChecked()) return ""; else - return ui->lineEditNewName->text(); + return ui->lineEditNewName->text().toStdString(); } void FolderExistsDialog::on_SuggestNewName_clicked() { QFileInfo destinationInfo=this->destinationInfo; QString absolutePath=destinationInfo.absolutePath(); - QString fileName=TransferThread::resolvedName(destinationInfo); - QString suffix=QStringLiteral(""); + QString fileName=QString::fromStdString(TransferThread::resolvedName(destinationInfo)); + QString suffix; QString destination; QString newFileName; //resolv the suffix @@ -112,26 +118,26 @@ void FolderExistsDialog::on_SuggestNewName_clicked() { if(num==1) { - if(firstRenamingRule.isEmpty()) + if(firstRenamingRule.empty()) newFileName=tr("%1 - copy").arg(fileName); else { - newFileName=firstRenamingRule; + newFileName=QString::fromStdString(firstRenamingRule); newFileName.replace(QStringLiteral("%name%"),fileName); } } else { - if(otherRenamingRule.isEmpty()) + if(otherRenamingRule.empty()) newFileName=tr("%1 - copy (%2)").arg(fileName).arg(num); else { - newFileName=otherRenamingRule; + newFileName=QString::fromStdString(otherRenamingRule); newFileName.replace(QStringLiteral("%name%"),fileName); newFileName.replace(QStringLiteral("%number%"),QString::number(num)); } } - destination=absolutePath+QDir::separator()+newFileName+suffix; + destination=absolutePath+CURRENTSEPARATOR+newFileName+suffix; destinationInfo.setFile(destination); num++; } @@ -187,7 +193,7 @@ void FolderExistsDialog::on_lineEditNewName_returnPressed() QMessageBox::warning(this,tr("Error"),tr("Try rename with using special characters")); } -void FolderExistsDialog::on_lineEditNewName_textChanged(const QString &arg1) +void FolderExistsDialog::on_lineEditNewName_textChanged(const std::string &arg1) { Q_UNUSED(arg1); updateRenameButton(); @@ -195,5 +201,5 @@ void FolderExistsDialog::on_lineEditNewName_textChanged(const QString &arg1) void FolderExistsDialog::updateRenameButton() { - ui->Rename->setEnabled(ui->checkBoxAlways->isChecked() || (!ui->lineEditNewName->text().contains(QRegularExpression("[/\\\\\\*]")) && oldName!=ui->lineEditNewName->text() && !ui->lineEditNewName->text().isEmpty())); + ui->Rename->setEnabled(ui->checkBoxAlways->isChecked() || (!ui->lineEditNewName->text().contains(QRegularExpression("[/\\\\\\*]")) && oldName!=ui->lineEditNewName->text().toStdString() && !ui->lineEditNewName->text().isEmpty())); } diff --git a/plugins/CopyEngine/Ultracopier/FolderExistsDialog.h b/plugins/CopyEngine/Ultracopier/FolderExistsDialog.h index c043f65..a3bcf67 100644 --- a/plugins/CopyEngine/Ultracopier/FolderExistsDialog.h +++ b/plugins/CopyEngine/Ultracopier/FolderExistsDialog.h @@ -25,14 +25,14 @@ class FolderExistsDialog : public QDialog public: /// \brief create the object and pass all the informations to it - explicit FolderExistsDialog(QWidget *parent,QFileInfo source,bool isSame,QFileInfo destination,QString firstRenamingRule,QString otherRenamingRule); + explicit FolderExistsDialog(QWidget *parent,QFileInfo source,bool isSame,QFileInfo destination,std::string firstRenamingRule,std::string otherRenamingRule); ~FolderExistsDialog(); /// \brief return the the always checkbox is checked bool getAlways(); /// \brief return the action clicked FolderExistsAction getAction(); /// \brief return the new rename is case in manual renaming - QString getNewName(); + std::string getNewName(); protected: void changeEvent(QEvent *e); private slots: @@ -44,13 +44,13 @@ private slots: void on_Merge_clicked(); void on_lineEditNewName_editingFinished(); void on_lineEditNewName_returnPressed(); - void on_lineEditNewName_textChanged(const QString &arg1); + void on_lineEditNewName_textChanged(const std::string &arg1); private: Ui::folderExistsDialog *ui; FolderExistsAction action; - QString oldName; - QString firstRenamingRule; - QString otherRenamingRule; + std::string oldName; + std::string firstRenamingRule; + std::string otherRenamingRule; QFileInfo destinationInfo; }; diff --git a/plugins/CopyEngine/Ultracopier/Languages/ar/translation.ts b/plugins/CopyEngine/Ultracopier/Languages/ar/translation.ts index 3362659..a00b0cd 100644 --- a/plugins/CopyEngine/Ultracopier/Languages/ar/translation.ts +++ b/plugins/CopyEngine/Ultracopier/Languages/ar/translation.ts @@ -61,84 +61,84 @@ - + The mode has been forced previously. This is an internal error, please report it - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - + Options error - + Options engine is not loaded. Unable to access the filters @@ -146,85 +146,85 @@ CopyEngineFactory - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - - + + Options error - + Options engine is not loaded. Unable to access the filters - + Options engine is not loaded, can't access to the filters @@ -273,22 +273,22 @@ FileExistsDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -296,22 +296,22 @@ FileIsSameDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -417,40 +417,40 @@ - - + + Raw text - - + + Simplified regex - - + + Perl's regex - - + + Only on file - - + + Only on folder - - - - + + + + Full match @@ -458,27 +458,27 @@ FolderExistsDialog - + Folder already exists - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -486,49 +486,49 @@ ListThread - - + + Unable do to move or copy item into wrong forced mode: %1 - - + + Unable to save the transfer list: %1 - + Problem reading file, or file-size is 0 - + Wrong header: "%1" - + The transfer list is in mixed mode, but this instance is not in this mode - + The transfer list is in copy mode, but this instance is not in this mode - + The transfer list is in move mode, but this instance is not in this mode - + Some errors have been found during the line parsing - + Unable to open the transfer list: %1 @@ -556,13 +556,13 @@ - + Unable to move the folder - + Unable to remove @@ -649,39 +649,39 @@ ScanFileOrFolder - + Blacklisted folder - - + + %1 - copy - - + + %1 - copy (%2) - + This is not a folder - + The folder does exists - + The folder is not readable - + Problem with name encoding @@ -689,101 +689,101 @@ TransferThread - - - - + + + + File not found - - + + Wrong modification date or unable to get it, you can disable time transfer to do it - - + + Internal error: Already opening - + Drive %1 - + Unknown folder - + root - + %1 - copy - + %1 - copy (%2) - - + + The source file doesn't exist - - + + Unable to do the folder - + The source doesn't exist - + Another file exists at same place - + The checksums do not match - + Internal error: The destination is not closed - + Internal error: The size transfered doesn't match - + Internal error: The buffer is not empty - - - + + + Unable to change the date - + Try rename with using special characters @@ -796,17 +796,17 @@ - + Internal error, please report it! - + Unable to read the source file: - + File truncated during read, possible data change diff --git a/plugins/CopyEngine/Ultracopier/Languages/de/translation.ts b/plugins/CopyEngine/Ultracopier/Languages/de/translation.ts index 2952152..cad2890 100644 --- a/plugins/CopyEngine/Ultracopier/Languages/de/translation.ts +++ b/plugins/CopyEngine/Ultracopier/Languages/de/translation.ts @@ -62,84 +62,84 @@ Aktuelles Ziel: "%1" benutzen? - + The mode has been forced previously. This is an internal error, please report it Der Modus wurde vorher erzwungen. Interner Fehler - Bitte bei mir melden! - - - - + + + + Ask Fragen - - - - + + + + Skip Überspringen - + Merge Fusionieren - - + + Rename Umbenennen - + Put at the end Ans Ende verschieben - + Overwrite Überschreiben - + Overwrite if different Überschreiben, falls verschieden - + Overwrite if newer Überschreiben, falls neuer - + Overwrite if older Überschreiben, falls älter - + Automatic Automatisch - + Sequential Sequentiell - + Parallel Parallel - + Options error Fehlerhafte Optionen - + Options engine is not loaded. Unable to access the filters Optionen nicht geladen - Kein Zugriff auf Filter @@ -147,85 +147,85 @@ CopyEngineFactory - - - - + + + + Ask Fragen - - - - + + + + Skip Überspringen - + Merge Fusionieren - - + + Rename Umbenennen - + Put at the end Ans Ende verschieben - + Overwrite Überschreiben - + Overwrite if different Überschreiben, falls verschieden - + Overwrite if newer Überschreiben, falls neuer - + Overwrite if older Überschreiben, falls älter - + Automatic Automatisch - + Sequential Sequentiell - + Parallel Parallel - - + + Options error Fehlerhafte Optionen - + Options engine is not loaded. Unable to access the filters Option nicht geladen - Kein Zugriff auf Filter - + Options engine is not loaded, can't access to the filters Option nicht geladen - Kann nicht auf Filter zugreifen @@ -274,22 +274,22 @@ FileExistsDialog - + %1 - copy %1 - Kopie - + %1 - copy (%2) %1 - Kopie (%2) - + Error Fehler - + Try rename with using special characters Versuche Umbenennung mit Sonderzeichen @@ -297,22 +297,22 @@ FileIsSameDialog - + %1 - copy %1 - kopieren - + %1 - copy (%2) %1 - kopieren (%2) - + Error Fehler - + Try rename with using special characters Versuche Umbenennung mit Sonderzeichen @@ -418,40 +418,40 @@ Keiner = Alle einschließen - - + + Raw text Roh-Text - - + + Simplified regex Vereinfachte RegEx - - + + Perl's regex Perls RegEx - - + + Only on file Nur auf Datei - - + + Only on folder Nur auf Ordner - - - - + + + + Full match Volle Übereinstimmung @@ -459,27 +459,27 @@ FolderExistsDialog - + Folder already exists Ordner existiert bereits - + %1 - copy %1 - Kopie - + %1 - copy (%2) %1 - Kopie (%2) - + Error Fehler - + Try rename with using special characters Versuche Umbenennung mit Sonderzeichen @@ -487,49 +487,49 @@ ListThread - - + + Unable do to move or copy item into wrong forced mode: %1 Falscher Modus: %1 - Kann Element nicht verschieben oder kopieren - - + + Unable to save the transfer list: %1 Konnte die Transferliste: %1 nicht speichern - + Problem reading file, or file-size is 0 Lesefehler, oder Dateigröße=0 - + Wrong header: "%1" Falscher Header: "%1" - + The transfer list is in mixed mode, but this instance is not in this mode Die Transferliste ist im gemischten Modus, aber diese Instanz ist nicht im selben Modus - + The transfer list is in copy mode, but this instance is not in this mode Die Transferliste ist im Kopiermodus, aber diese Instanz ist nicht im selben Modus - + The transfer list is in move mode, but this instance is not in this mode Die Transferliste ist im Verschiebe-Modus, aber diese Instanz ist nicht im selben Modus - + Some errors have been found during the line parsing Bei der Zeilenanalyse sind Fehler aufgetreten - + Unable to open the transfer list: %1 Transferliste: %1 kann nicht geöffnet werden @@ -557,13 +557,13 @@ Kann den Ordner nicht endgültig verschieben - + Unable to move the folder Kann den Ordner nicht verschieben - + Unable to remove Kann nicht löschen @@ -650,39 +650,39 @@ ScanFileOrFolder - + Blacklisted folder Ordner der schwarzen Liste - - + + %1 - copy %1 - Kopie - - + + %1 - copy (%2) %1 - Kopie (%2) - + This is not a folder Dies ist kein Ordner - + The folder does exists Ordner existiert bereits - + The folder is not readable Der Ordner kann nicht gelesen werden - + Problem with name encoding Problem mit der Namen-Encodierung @@ -690,101 +690,101 @@ TransferThread - - - - + + + + File not found Datei nicht gefunden - - + + Wrong modification date or unable to get it, you can disable time transfer to do it - - + + Internal error: Already opening Interner Fehler: Bereits geöffnet - + Drive %1 Laufwerk %1 - + Unknown folder Unbekannter Ordner - + root Stammverzeichnis - + %1 - copy %1 - Kopie - + %1 - copy (%2) %1 - Kopie (%2) - + The source doesn't exist Quelle existiert nicht - - - + + + Unable to change the date - - + + The source file doesn't exist Quelldatei existiert nicht - + The checksums do not match Prüfsummen sind verschieden - + Internal error: The size transfered doesn't match Interner Fehler: Ubertragene Größe ungleich - - + + Unable to do the folder Ordner kann nicht erstellt werden - + Try rename with using special characters Versuche Umbenennung mit Sonderzeichen - + Another file exists at same place Andere Datei befindet sich am selben Ort - + Internal error: The destination is not closed Interner Fehler: Ziel ist nicht geschlossen - + Internal error: The buffer is not empty Interner Fehler: Puffer ist nicht leer @@ -797,17 +797,17 @@ Pfad-Auflösungsfehler (leerer Pfad) - + Internal error, please report it! Interner Fehler - Bitte bei mir melden! - + Unable to read the source file: Quelldatei kann nicht gelesen werden: - + File truncated during read, possible data change Datenabbruch beim Lesen, Daten wurden möglicherweise verändert @@ -1000,10 +1000,6 @@ Use this folder when destination is not set - - Use this folder when destination is empty - Benutze diesen Ordner wenn Ziel nicht benannt - Browse diff --git a/plugins/CopyEngine/Ultracopier/Languages/el/translation.ts b/plugins/CopyEngine/Ultracopier/Languages/el/translation.ts index 3362659..a00b0cd 100644 --- a/plugins/CopyEngine/Ultracopier/Languages/el/translation.ts +++ b/plugins/CopyEngine/Ultracopier/Languages/el/translation.ts @@ -61,84 +61,84 @@ - + The mode has been forced previously. This is an internal error, please report it - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - + Options error - + Options engine is not loaded. Unable to access the filters @@ -146,85 +146,85 @@ CopyEngineFactory - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - - + + Options error - + Options engine is not loaded. Unable to access the filters - + Options engine is not loaded, can't access to the filters @@ -273,22 +273,22 @@ FileExistsDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -296,22 +296,22 @@ FileIsSameDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -417,40 +417,40 @@ - - + + Raw text - - + + Simplified regex - - + + Perl's regex - - + + Only on file - - + + Only on folder - - - - + + + + Full match @@ -458,27 +458,27 @@ FolderExistsDialog - + Folder already exists - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -486,49 +486,49 @@ ListThread - - + + Unable do to move or copy item into wrong forced mode: %1 - - + + Unable to save the transfer list: %1 - + Problem reading file, or file-size is 0 - + Wrong header: "%1" - + The transfer list is in mixed mode, but this instance is not in this mode - + The transfer list is in copy mode, but this instance is not in this mode - + The transfer list is in move mode, but this instance is not in this mode - + Some errors have been found during the line parsing - + Unable to open the transfer list: %1 @@ -556,13 +556,13 @@ - + Unable to move the folder - + Unable to remove @@ -649,39 +649,39 @@ ScanFileOrFolder - + Blacklisted folder - - + + %1 - copy - - + + %1 - copy (%2) - + This is not a folder - + The folder does exists - + The folder is not readable - + Problem with name encoding @@ -689,101 +689,101 @@ TransferThread - - - - + + + + File not found - - + + Wrong modification date or unable to get it, you can disable time transfer to do it - - + + Internal error: Already opening - + Drive %1 - + Unknown folder - + root - + %1 - copy - + %1 - copy (%2) - - + + The source file doesn't exist - - + + Unable to do the folder - + The source doesn't exist - + Another file exists at same place - + The checksums do not match - + Internal error: The destination is not closed - + Internal error: The size transfered doesn't match - + Internal error: The buffer is not empty - - - + + + Unable to change the date - + Try rename with using special characters @@ -796,17 +796,17 @@ - + Internal error, please report it! - + Unable to read the source file: - + File truncated during read, possible data change diff --git a/plugins/CopyEngine/Ultracopier/Languages/en/translation.ts b/plugins/CopyEngine/Ultracopier/Languages/en/translation.ts index a6b1027..2c9ce27 100644 --- a/plugins/CopyEngine/Ultracopier/Languages/en/translation.ts +++ b/plugins/CopyEngine/Ultracopier/Languages/en/translation.ts @@ -61,84 +61,84 @@ - + The mode has been forced previously. This is an internal error, please report it - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - + Options error - + Options engine is not loaded. Unable to access the filters @@ -146,85 +146,85 @@ CopyEngineFactory - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - - + + Options error - + Options engine is not loaded. Unable to access the filters - + Options engine is not loaded, can't access to the filters @@ -273,22 +273,22 @@ FileExistsDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -296,22 +296,22 @@ FileIsSameDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -417,40 +417,40 @@ - - + + Raw text - - + + Simplified regex - - + + Perl's regex - - + + Only on file - - + + Only on folder - - - - + + + + Full match @@ -458,27 +458,27 @@ FolderExistsDialog - + Folder already exists - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -486,49 +486,49 @@ ListThread - - + + Unable do to move or copy item into wrong forced mode: %1 - - + + Unable to save the transfer list: %1 - + Problem reading file, or file-size is 0 - + Wrong header: "%1" - + The transfer list is in mixed mode, but this instance is not in this mode - + The transfer list is in copy mode, but this instance is not in this mode - + The transfer list is in move mode, but this instance is not in this mode - + Some errors have been found during the line parsing - + Unable to open the transfer list: %1 @@ -556,13 +556,13 @@ - + Unable to move the folder - + Unable to remove @@ -649,39 +649,39 @@ ScanFileOrFolder - + Blacklisted folder - - + + %1 - copy - - + + %1 - copy (%2) - + This is not a folder - + The folder does exists - + The folder is not readable - + Problem with name encoding @@ -689,101 +689,101 @@ TransferThread - - - - + + + + File not found - - + + Wrong modification date or unable to get it, you can disable time transfer to do it - - + + Internal error: Already opening - + Drive %1 - + Unknown folder - + root - + %1 - copy - + %1 - copy (%2) - - + + The source file doesn't exist - - + + Unable to do the folder - + The source doesn't exist - + Another file exists at same place - + The checksums do not match - + Internal error: The destination is not closed - + Internal error: The size transfered doesn't match - + Internal error: The buffer is not empty - - - + + + Unable to change the date - + Try rename with using special characters @@ -796,17 +796,17 @@ - + Internal error, please report it! - + Unable to read the source file: - + File truncated during read, possible data change diff --git a/plugins/CopyEngine/Ultracopier/Languages/es/translation.ts b/plugins/CopyEngine/Ultracopier/Languages/es/translation.ts index d2a294f..9cb6abe 100644 --- a/plugins/CopyEngine/Ultracopier/Languages/es/translation.ts +++ b/plugins/CopyEngine/Ultracopier/Languages/es/translation.ts @@ -61,84 +61,84 @@ Utilice el destino "%1" actual? - + The mode has been forced previously. This is an internal error, please report it El modo se ha visto obligado previamente. Este es un error interno, por favor repórtelo - - - - + + + + Ask Pedir - - - - + + + + Skip Omitir - + Merge Unir - - + + Rename Cambiar el nombre - + Put at the end Ponga al final - + Overwrite Sobrescribir - + Overwrite if different Sobrescribir si es diferente - + Overwrite if newer Sobrescribir si nuevo - + Overwrite if older Sobrescribir si es mayor - + Automatic Automático - + Sequential Secuencial - + Parallel Paralelo - + Options error error Opciones - + Options engine is not loaded. Unable to access the filters Opciones del motor no está cargado. No es posible acceder a los filtros @@ -146,85 +146,85 @@ CopyEngineFactory - - - - + + + + Ask Pedir - - - - + + + + Skip Omitir - + Merge Unir - - + + Rename Cambiar el nombre - + Put at the end Ponga al final - + Overwrite Sobrescribir - + Overwrite if different Sobrescribir si es diferente - + Overwrite if newer Sobrescribir si nuevo - + Overwrite if older Sobrescribir si es mayor - + Automatic Automático - + Sequential Secuencial - + Parallel Paralelo - - + + Options error error Opciones - + Options engine is not loaded. Unable to access the filters Opciones del motor no está cargado. No es posible acceder a los filtros - + Options engine is not loaded, can't access to the filters Opciones del motor no está cargado, no se puede acceder a los filtros @@ -273,22 +273,22 @@ FileExistsDialog - + %1 - copy %1 - copia - + %1 - copy (%2) %1 - copia (%2) - + Error Error - + Try rename with using special characters Trate de cambiar el nombre con el uso de caracteres especiales @@ -296,22 +296,22 @@ FileIsSameDialog - + %1 - copy %1 - copia - + %1 - copy (%2) %1 - copia (%2) - + Error Error - + Try rename with using special characters Trate de cambiar el nombre con el uso de caracteres especiales @@ -417,40 +417,40 @@ Ninguno = Incluya todos los - - + + Raw text texto Fuente - - + + Simplified regex Simplificado regex - - + + Perl's regex Perl's regex - - + + Only on file Sólo en el archivo - - + + Only on folder Sólo en la carpeta - - - - + + + + Full match Partido completo @@ -458,27 +458,27 @@ FolderExistsDialog - + Folder already exists Carpeta ya existe - + %1 - copy %1 - copia - + %1 - copy (%2) %1 - copia (%2) - + Error Error - + Try rename with using special characters Trate de cambiar el nombre con el uso de caracteres especiales @@ -486,59 +486,55 @@ ListThread - - + + Unable do to move or copy item into wrong forced mode: %1 No se puede hacer para mover o copiar elemento en modo incorrecto obligado: %1 - - + + Unable to save the transfer list: %1 No se puede guardar la lista de transferencias: %1 - + Problem reading file, or file-size is 0 Problema al leer el archivo o archivos de tamaño es 0 - + Wrong header: "%1" Encabezado incorrecto: "%1" - + The transfer list is in mixed mode, but this instance is not in this mode La lista de transferencia está en modo mixto, pero este caso no es de este modo - + The transfer list is in copy mode, but this instance is not in this mode La lista de transferencia está en el modo de copia, pero esta instancia no está en este modo - + The transfer list is in move mode, but this instance is not in this mode La lista de transferencia es el modo de desplazamiento, pero esta instancia no está en este modo - + Some errors have been found during the line parsing Algunos errores han sido encontrados durante el análisis de línea - + Unable to open the transfer list: %1 No se puede abrir la lista de transferencias: %1 MkPath - - Unable to get time - No es posible obtener el tiempo - Unable to create the folder @@ -560,17 +556,13 @@ No se puede hacer el movimiento final real de la carpeta - + Unable to move the folder No se puede mover la carpeta - - Unable to set the access-right - No se puede establecer el acceso a la derecha - - + Unable to remove No se puede eliminar @@ -657,43 +649,39 @@ ScanFileOrFolder - + Blacklisted folder Carpeta de la lista negra - - + + %1 - copy %1 - copia - - + + %1 - copy (%2) %1 - copia (%2) - + This is not a folder Esto no es una carpeta - + The folder does exists La carpeta no existe - The folder not exists - La carpeta no existe - - - + The folder is not readable La carpeta no se puede leer - + Problem with name encoding Problema con codificación de nombres @@ -701,101 +689,101 @@ TransferThread - - - - + + + + File not found Archivo no encontrado - - + + Wrong modification date or unable to get it, you can disable time transfer to do it - - + + Internal error: Already opening Error interno: Ya la apertura - + Drive %1 Drive %1 - + Unknown folder Desconocido carpeta - + root raíz - + %1 - copy %1 - copia - + %1 - copy (%2) %1 - copia (%2) - + The source doesn't exist La fuente no existe - - - + + + Unable to change the date - - + + The source file doesn't exist El archivo de origen no existe - + The checksums do not match Las sumas de comprobación no coinciden - + Internal error: The size transfered doesn't match Error interno: El tamaño transferido no coincide - - + + Unable to do the folder Incapaz de hacer la carpeta - + Try rename with using special characters Trate de cambiar el nombre con el uso de caracteres especiales - + Another file exists at same place Otro archivo existe en el mismo lugar - + Internal error: The destination is not closed Error interno: El destino no está cerrado - + Internal error: The buffer is not empty Error interno: El buffer no está vacío @@ -808,17 +796,17 @@ Error de resolución de ruta (camino vacío) - + Internal error, please report it! Error interno, por favor informe de ello! - + Unable to read the source file: No se puede leer el archivo de origen: - + File truncated during read, possible data change Archivo truncado durante lectura, posible cambio de datos @@ -1011,10 +999,6 @@ Use this folder when destination is not set - - Use this folder when destination is empty - Utilice esta carpeta al destino está vacía - Browse diff --git a/plugins/CopyEngine/Ultracopier/Languages/fr/translation.ts b/plugins/CopyEngine/Ultracopier/Languages/fr/translation.ts index 8ed7524..13ac433 100644 --- a/plugins/CopyEngine/Ultracopier/Languages/fr/translation.ts +++ b/plugins/CopyEngine/Ultracopier/Languages/fr/translation.ts @@ -61,84 +61,84 @@ Utiliser la destination actuelle "%1"? - + The mode has been forced previously. This is an internal error, please report it Le mode a été forcé. C'est une erreur interne, merci de la repporter - - - - + + + + Ask Demander - - - - + + + + Skip Passer - + Merge Fusionner - - + + Rename Renommer - + Put at the end Mettre à la fin - + Overwrite Écraser - + Overwrite if different Écraser si différent - + Overwrite if newer Écraser si plus récent - + Overwrite if older Écraser si plus vieux - + Automatic Automatique - + Sequential Séquentiel - + Parallel Parallèle - + Options error Erreur d'options - + Options engine is not loaded. Unable to access the filters Le moteur d'options n'est pas chargé. Impossible d'accédé aux filtres @@ -146,85 +146,85 @@ CopyEngineFactory - - - - + + + + Ask Demander - - - - + + + + Skip Passer - + Merge Fusionner - - + + Rename Renommer - + Put at the end Mettre à la fin - + Overwrite Écraser - + Overwrite if different Écraser si différent - + Overwrite if newer Écraser si plus récent - + Overwrite if older Écraser si plus vieux - + Automatic Automatique - + Sequential Séquentiel - + Parallel Parallèle - - + + Options error Erreur d'options - + Options engine is not loaded. Unable to access the filters Le moteur d'options n'est pas chargé. Impossible d'accédé aux filtres - + Options engine is not loaded, can't access to the filters Moteur d'options non chargé, impossible d'accéder aux filtres @@ -273,56 +273,48 @@ FileExistsDialog - + %1 - copy %1 - copie - + %1 - copy (%2) %1 - copie (%2) - + Error Erreur - + Try rename with using special characters Essaie de renommage avec caratéres interdits - - Try rename with unauthorized characters - Essaie de renommage avec caratéres interdits - FileIsSameDialog - + %1 - copy %1 - copie - + %1 - copy (%2) %1 - copie (%2) - + Error Erreur - + Try rename with using special characters Essaie de renommage avec caratéres interdits - - Try rename with unauthorized characters - Essaie de renommage avec caratéres interdits - FilterRules @@ -425,40 +417,40 @@ Aucun = tout inclure - - + + Raw text Texte brute - - + + Simplified regex Regex simplifié - - + + Perl's regex Regex perl - - + + Only on file Appliquer sur fichier - - + + Only on folder Appliquer sur dossier - - - - + + + + Full match Correspondance totale @@ -466,95 +458,83 @@ FolderExistsDialog - + Folder already exists Dossier déjà existant - + %1 - copy %1 - copie - + %1 - copy (%2) %1 - copie (%2) - + Error Erreur - + Try rename with using special characters Essaie de renommage avec caratéres interdits - - Try rename with unauthorized characters - Essaie de renommage avec caratéres interdits - - - Try rename with unauthorized charateres - Tentative de renommage de des caratéres non autorisés - ListThread - - + + Unable do to move or copy item into wrong forced mode: %1 Impossible de faire un déplacement ou une copie dans le mauvais mode forcé: %1 - - + + Unable to save the transfer list: %1 Impossible de sauvegarder la liste de transfert: %1 - + Problem reading file, or file-size is 0 Problem durant la lecture, ou taille de fichier est 0 - + Wrong header: "%1" Mauvais en-tête: "%1" - + The transfer list is in mixed mode, but this instance is not in this mode La liste de transfert est en mode mixte, mais l'instance n'est pas dans ce mode - + The transfer list is in copy mode, but this instance is not in this mode La liste de transfert est en mode copie, mais l'instance n'est pas dans ce mode - + The transfer list is in move mode, but this instance is not in this mode La liste de transfert est en mode déplacement, mais l'instance n'est pas dans ce mode - + Some errors have been found during the line parsing Certaine erreur ont été trouvé durant l'analise de la line - + Unable to open the transfer list: %1 Impossible d'ouvrir la list de transfert: %1 MkPath - - Unable to get time - Impossible d'obtenir l'heure - Unable to create the folder @@ -576,21 +556,13 @@ Impossible de faire le déplacement final du dossier - + Unable to move the folder Impossible de déplacer le dossier - - Unable to set time - Impossible de définir l'heure - - - Unable to set the access-right - Impossible de définir les droits d'accés - - + Unable to remove Impossible de supprimer @@ -682,43 +654,39 @@ ScanFileOrFolder - + Blacklisted folder Dossier banis - - + + %1 - copy %1 - copie - - + + %1 - copy (%2) %1 - copie (%2) - + This is not a folder N'est pas un dossier - + The folder does exists Le répertoire n'existe pas - The folder not exists - Le répertoire n'existe pas - - - + The folder is not readable Le répertoire n'est pas lisible - + Problem with name encoding Problém d'encodage @@ -726,105 +694,101 @@ TransferThread - - - - + + + + File not found Fichier non trouvé - + Drive %1 Lecteur %1 - Try rename with unauthorized characters - Essaie de renommage avec caratéres interdits - - - + Unknown folder Dossier inconnu - + root racine - + %1 - copy %1 - copie - + %1 - copy (%2) %1 - copie (%2) - + The source doesn't exist La source n'existe pas - - + + The source file doesn't exist Le fichier source n'existe pas - + The checksums do not match Les sommes de controle ne correspondent pas - + Internal error: The size transfered doesn't match Erreur interne: La taille transféré ne corresponds pas - - + + Unable to do the folder Impossible de créer le dossier - + Try rename with using special characters Essaie de renommage avec caratéres interdits - - + + Wrong modification date or unable to get it, you can disable time transfer to do it Mauvaise date de modification ou impossible de l'avoir, vous pouvez désactivé le transfert de celui-ci - - + + Internal error: Already opening Erreur interne: Déjà ouvert - + Another file exists at same place Un autre fichier exists à la même place - + Internal error: The destination is not closed Erreur interne: La destination n'est pas fermé - + Internal error: The buffer is not empty Erreur interne: Le buffer n'est pas vide - - - + + + Unable to change the date Impossible de changer la date @@ -837,17 +801,17 @@ Erreur de résolution de chemain (chemain vide) - + Internal error, please report it! Erreur interne, merci de la reporter! - + Unable to read the source file: Impossible de lire le fichier source: - + File truncated during read, possible data change Fichier rétréci pendant la lecture, possible changement de données @@ -1040,10 +1004,6 @@ Use this folder when destination is not set Utiliser ce dossier quand la destination n'est pas défini - - Use this folder when destination is empty - Utiliser ce dossier quand la destination est vide - Browse @@ -1229,10 +1189,6 @@ File name Nom de fichier - - The source and destination is identical - La source et la destination sont identique - The source and destination are same diff --git a/plugins/CopyEngine/Ultracopier/Languages/hi/translation.ts b/plugins/CopyEngine/Ultracopier/Languages/hi/translation.ts index 3362659..a00b0cd 100644 --- a/plugins/CopyEngine/Ultracopier/Languages/hi/translation.ts +++ b/plugins/CopyEngine/Ultracopier/Languages/hi/translation.ts @@ -61,84 +61,84 @@ - + The mode has been forced previously. This is an internal error, please report it - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - + Options error - + Options engine is not loaded. Unable to access the filters @@ -146,85 +146,85 @@ CopyEngineFactory - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - - + + Options error - + Options engine is not loaded. Unable to access the filters - + Options engine is not loaded, can't access to the filters @@ -273,22 +273,22 @@ FileExistsDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -296,22 +296,22 @@ FileIsSameDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -417,40 +417,40 @@ - - + + Raw text - - + + Simplified regex - - + + Perl's regex - - + + Only on file - - + + Only on folder - - - - + + + + Full match @@ -458,27 +458,27 @@ FolderExistsDialog - + Folder already exists - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -486,49 +486,49 @@ ListThread - - + + Unable do to move or copy item into wrong forced mode: %1 - - + + Unable to save the transfer list: %1 - + Problem reading file, or file-size is 0 - + Wrong header: "%1" - + The transfer list is in mixed mode, but this instance is not in this mode - + The transfer list is in copy mode, but this instance is not in this mode - + The transfer list is in move mode, but this instance is not in this mode - + Some errors have been found during the line parsing - + Unable to open the transfer list: %1 @@ -556,13 +556,13 @@ - + Unable to move the folder - + Unable to remove @@ -649,39 +649,39 @@ ScanFileOrFolder - + Blacklisted folder - - + + %1 - copy - - + + %1 - copy (%2) - + This is not a folder - + The folder does exists - + The folder is not readable - + Problem with name encoding @@ -689,101 +689,101 @@ TransferThread - - - - + + + + File not found - - + + Wrong modification date or unable to get it, you can disable time transfer to do it - - + + Internal error: Already opening - + Drive %1 - + Unknown folder - + root - + %1 - copy - + %1 - copy (%2) - - + + The source file doesn't exist - - + + Unable to do the folder - + The source doesn't exist - + Another file exists at same place - + The checksums do not match - + Internal error: The destination is not closed - + Internal error: The size transfered doesn't match - + Internal error: The buffer is not empty - - - + + + Unable to change the date - + Try rename with using special characters @@ -796,17 +796,17 @@ - + Internal error, please report it! - + Unable to read the source file: - + File truncated during read, possible data change diff --git a/plugins/CopyEngine/Ultracopier/Languages/hu/translation.ts b/plugins/CopyEngine/Ultracopier/Languages/hu/translation.ts index beff862..eaa968d 100644 --- a/plugins/CopyEngine/Ultracopier/Languages/hu/translation.ts +++ b/plugins/CopyEngine/Ultracopier/Languages/hu/translation.ts @@ -61,84 +61,84 @@ Használja a jelenlegi célt: "%1"? - + The mode has been forced previously. This is an internal error, please report it Ezt a módot már korábban kényszerítették. Belső hiba történt, kérlek jelentsd be - - - - + + + + Ask Kérdezzen rá - - - - + + + + Skip Kihagy - + Merge Összeolvaszt - - + + Rename Nevezze át - + Put at the end Helyezze a végére - + Overwrite Felülír - + Overwrite if different Felülír, ha különbözik - + Overwrite if newer Felülír, ha újabb - + Overwrite if older Felülír, ha régebbi - + Automatic Automatikus - + Sequential Szekvenciális - + Parallel Párhuzamos - + Options error Beállítási hiba - + Options engine is not loaded. Unable to access the filters A beállítási motor nincs betöltve. A szűrők elérése nem lehetséges @@ -146,85 +146,85 @@ CopyEngineFactory - - - - + + + + Ask Kérdezzen rá - - - - + + + + Skip Kihagy - + Merge Összeolvaszt - - + + Rename Nevezze át - + Put at the end Helyezze a végére - + Overwrite Felülír - + Overwrite if different Felülír, ha különbözik - + Overwrite if newer Felülír, ha újabb - + Overwrite if older Felülír, ha régebbi - + Automatic Automatikus - + Sequential Szekvenciális - + Parallel Párhuzamos - - + + Options error Beállítási hiba - + Options engine is not loaded. Unable to access the filters A beállítási motor nincs betöltve. A szűrők elérése nem lehetséges - + Options engine is not loaded, can't access to the filters A beállítási motor nincs betöltve, a szűrők elérése nem lehetséges @@ -273,22 +273,22 @@ FileExistsDialog - + %1 - copy %1 - másolás - + %1 - copy (%2) %1 - másolás (%2) - + Error Hiba - + Try rename with using special characters Átnevezés speciális karakterek használatával @@ -296,22 +296,22 @@ FileIsSameDialog - + %1 - copy %1 - másolás - + %1 - copy (%2) %1 - másolás (%2) - + Error Hiba - + Try rename with using special characters Átnevezés speciális karakterek használatával @@ -417,40 +417,40 @@ Nincs = Mindet használ - - + + Raw text Nyers szöveg - - + + Simplified regex Egyszerűsített regex - - + + Perl's regex Perl regex - - + + Only on file Csak fájlon - - + + Only on folder Csak mappán - - - - + + + + Full match Teljes egyezés @@ -458,27 +458,27 @@ FolderExistsDialog - + Folder already exists Mappa már létezik - + %1 - copy %1 - másolás - + %1 - copy (%2) %1 - másolás (%2) - + Error Hiba - + Try rename with using special characters Átnevezés speciális karakterek használatával @@ -486,49 +486,49 @@ ListThread - - + + Unable do to move or copy item into wrong forced mode: %1 Elem másolása vagy mozgatás nem lehetséges a hibás kényszerített módban: %1 - - + + Unable to save the transfer list: %1 Átviteli lista mentése nem lehetséges: %1 - + Problem reading file, or file-size is 0 Hiba a fájl olvasásánál vagy a fálméret 0 - + Wrong header: "%1" Hibás fejléc: "%1" - + The transfer list is in mixed mode, but this instance is not in this mode Az átviteli lista kevert módban van, de ez a példány nincs - + The transfer list is in copy mode, but this instance is not in this mode Az átviteli lista másolás módban van, de ez a példány nincs - + The transfer list is in move mode, but this instance is not in this mode Az átviteli lista mozgatás módban van, de ez a példány nincs - + Some errors have been found during the line parsing Néhány hiba történt a sorelemzés során - + Unable to open the transfer list: %1 Az átviteli lista megnyitása nem lehetséges: %1 @@ -556,17 +556,13 @@ - + Unable to move the folder - - Unable to set the access-right - Jogok beállítása nem lehetséges - - + Unable to remove Eltávolítás nem lehetséges @@ -653,39 +649,39 @@ ScanFileOrFolder - + Blacklisted folder Feketelistás mappa - - + + %1 - copy %1 - másolás - - + + %1 - copy (%2) %1 - másolás (%2) - + This is not a folder Ez nem mappa - + The folder does exists A mappa létezik - + The folder is not readable A mappa nem olvasható - + Problem with name encoding Probléma a névkódolással @@ -693,101 +689,101 @@ TransferThread - - - - + + + + File not found Fájl nem található - + Drive %1 %1 meghajtó - + Unknown folder Ismeretlen mappa - + root gyökér - + %1 - copy %1 - másolás - + %1 - copy (%2) %1 - másolás (%2) - + The source doesn't exist A forrás nem létezik - - + + Unable to do the folder Mappaművelet nem lehetséges - + Try rename with using special characters Átnevezés speciális karakterek használatával - - + + Wrong modification date or unable to get it, you can disable time transfer to do it - - + + Internal error: Already opening - - + + The source file doesn't exist A forrásfájl nem létezik - + Another file exists at same place Egy másik fájl létezik ugyanazon a helyen - + The checksums do not match A checksumok nem egyeznek meg - + Internal error: The destination is not closed Belső hiba: a cél nincs bezárva - + Internal error: The size transfered doesn't match Belső hiba: az átvitt méret nem egyezik meg - + Internal error: The buffer is not empty Belső hiba: a puffer nem üres - - - + + + Unable to change the date @@ -800,17 +796,17 @@ Útvonal feloldási hiba (Üres útvonal) - + Internal error, please report it! Belső hiba, kérlek jelentsd! - + Unable to read the source file: A forrásfájl olvasása nem lehetséges: - + File truncated during read, possible data change Fájl megsérült az olvasás közben, valószínűleg adatváltozás @@ -1003,10 +999,6 @@ Use this folder when destination is not set - - Use this folder when destination is empty - Használja ezt a mappát, ha a cél üres - Browse diff --git a/plugins/CopyEngine/Ultracopier/Languages/id/translation.ts b/plugins/CopyEngine/Ultracopier/Languages/id/translation.ts index 3362659..a00b0cd 100644 --- a/plugins/CopyEngine/Ultracopier/Languages/id/translation.ts +++ b/plugins/CopyEngine/Ultracopier/Languages/id/translation.ts @@ -61,84 +61,84 @@ - + The mode has been forced previously. This is an internal error, please report it - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - + Options error - + Options engine is not loaded. Unable to access the filters @@ -146,85 +146,85 @@ CopyEngineFactory - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - - + + Options error - + Options engine is not loaded. Unable to access the filters - + Options engine is not loaded, can't access to the filters @@ -273,22 +273,22 @@ FileExistsDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -296,22 +296,22 @@ FileIsSameDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -417,40 +417,40 @@ - - + + Raw text - - + + Simplified regex - - + + Perl's regex - - + + Only on file - - + + Only on folder - - - - + + + + Full match @@ -458,27 +458,27 @@ FolderExistsDialog - + Folder already exists - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -486,49 +486,49 @@ ListThread - - + + Unable do to move or copy item into wrong forced mode: %1 - - + + Unable to save the transfer list: %1 - + Problem reading file, or file-size is 0 - + Wrong header: "%1" - + The transfer list is in mixed mode, but this instance is not in this mode - + The transfer list is in copy mode, but this instance is not in this mode - + The transfer list is in move mode, but this instance is not in this mode - + Some errors have been found during the line parsing - + Unable to open the transfer list: %1 @@ -556,13 +556,13 @@ - + Unable to move the folder - + Unable to remove @@ -649,39 +649,39 @@ ScanFileOrFolder - + Blacklisted folder - - + + %1 - copy - - + + %1 - copy (%2) - + This is not a folder - + The folder does exists - + The folder is not readable - + Problem with name encoding @@ -689,101 +689,101 @@ TransferThread - - - - + + + + File not found - - + + Wrong modification date or unable to get it, you can disable time transfer to do it - - + + Internal error: Already opening - + Drive %1 - + Unknown folder - + root - + %1 - copy - + %1 - copy (%2) - - + + The source file doesn't exist - - + + Unable to do the folder - + The source doesn't exist - + Another file exists at same place - + The checksums do not match - + Internal error: The destination is not closed - + Internal error: The size transfered doesn't match - + Internal error: The buffer is not empty - - - + + + Unable to change the date - + Try rename with using special characters @@ -796,17 +796,17 @@ - + Internal error, please report it! - + Unable to read the source file: - + File truncated during read, possible data change diff --git a/plugins/CopyEngine/Ultracopier/Languages/it/translation.ts b/plugins/CopyEngine/Ultracopier/Languages/it/translation.ts index 0bbc22f..8a95cd4 100644 --- a/plugins/CopyEngine/Ultracopier/Languages/it/translation.ts +++ b/plugins/CopyEngine/Ultracopier/Languages/it/translation.ts @@ -61,84 +61,84 @@ - + The mode has been forced previously. This is an internal error, please report it - - - - + + + + Ask Chiedi - - - - + + + + Skip Salta - + Merge Unisci - - + + Rename Rinomina - + Put at the end Metti in coda - + Overwrite Sovrascrivi - + Overwrite if different Sovrascrivi se differente - + Overwrite if newer Sovrascrivi se più recente - + Overwrite if older Sovrascrivi se meno recente - + Automatic Automatico - + Sequential Sequenziale - + Parallel Parallelo - + Options error Opzioni di errore - + Options engine is not loaded. Unable to access the filters @@ -146,85 +146,85 @@ CopyEngineFactory - - - - + + + + Ask Chiedi - - - - + + + + Skip Salta - + Merge Unisci - - + + Rename Rinomina - + Put at the end Metti in coda - + Overwrite Sovrascrivi - + Overwrite if different Sovrascrivi se differente - + Overwrite if newer Sovrascrivi se più recente - + Overwrite if older Sovrascrivi se meno recente - + Automatic Automatico - + Sequential Sequenziale - + Parallel Parallelo - - + + Options error Opzioni di errore - + Options engine is not loaded. Unable to access the filters - + Options engine is not loaded, can't access to the filters Le opzioni del motore per la copia non vengono caricate, impossibile accedere ai filtri @@ -273,22 +273,22 @@ FileExistsDialog - + %1 - copy %1 - copia - + %1 - copy (%2) %1 - copia (%2) - + Error Errore - + Try rename with using special characters @@ -296,22 +296,22 @@ FileIsSameDialog - + %1 - copy %1 - copia - + %1 - copy (%2) %1 - copia (%2) - + Error Errore - + Try rename with using special characters @@ -419,41 +419,41 @@ Nessuno = Tutti inclusi - - + + Raw text Testo raw - - + + Simplified regex Regex semplificato - - + + Perl's regex Regex in Perl - - + + Only on file Solo su file - - + + Only on folder o cartella al singolare? Solo su cartelle - - - - + + + + Full match Corrispondenza completa @@ -461,92 +461,84 @@ FolderExistsDialog - + Folder already exists Cartella già presente - + %1 - copy %1 - copia - + %1 - copy (%2) %1 - copia (%2) - + Error Errore - + Try rename with using special characters - - Try rename with unauthorized charateres - Provare a rinominare con caratteri non consentiti - ListThread - - + + Unable do to move or copy item into wrong forced mode: %1 Impossibile spostare o copiare elementi in modalità forzata anomala: %1 - - + + Unable to save the transfer list: %1 Impossibile salvare la lista dei trasferimenti: %1 - + Problem reading file, or file-size is 0 - + Wrong header: "%1" Header si riferisce all'intestazione? Intestazione sbagliata: "%1" - + The transfer list is in mixed mode, but this instance is not in this mode La lista dei trasferimenti è in modalità mista, ma questa istanza non è in questa modalità - + The transfer list is in copy mode, but this instance is not in this mode La lista dei trasferimenti è in modalità di copia, ma questa istanza non è in questa modalità - + The transfer list is in move mode, but this instance is not in this mode La lista dei trasferimenti è in modalità di spostamento, ma questa istanza non è in questa modalità - + Some errors have been found during the line parsing - + Unable to open the transfer list: %1 Impossibile aprire la lista dei trasferimenti: %1 MkPath - - Unable to get time - Impossibile ottenere l'ora - Unable to create the folder @@ -568,17 +560,13 @@ - + Unable to move the folder - - Unable to set time - Impossibile impostare l'ora - - + Unable to remove Impossibile eliminare @@ -671,43 +659,39 @@ ScanFileOrFolder - + Blacklisted folder - - + + %1 - copy %1 - copia - - + + %1 - copy (%2) %1 - copia (%2) - + This is not a folder Questa non è una cartella - + The folder does exists - The folder not exists - La cartella non esiste - - - + The folder is not readable La cartella non è leggibile - + Problem with name encoding Problema con la codifica del nome @@ -715,101 +699,101 @@ TransferThread - - - - + + + + File not found File non trovato - - + + Wrong modification date or unable to get it, you can disable time transfer to do it - - + + Internal error: Already opening - + Drive %1 Unità %1 - + Unknown folder - + root root - + %1 - copy %1 - copia - + %1 - copy (%2) %1 - copia (%2) - - + + The source file doesn't exist - - + + Unable to do the folder Impossibile creare la cartella - + Try rename with using special characters - + The source doesn't exist - + Another file exists at same place Nello stesso percorso è presente un altro file - + The checksums do not match - + Internal error: The destination is not closed Errore interno: la cartella di destinazione non è chiusa - + Internal error: The size transfered doesn't match - + Internal error: The buffer is not empty Errore interno: il buffer non è vuoto - - - + + + Unable to change the date Impossibile cambiare la data @@ -822,17 +806,17 @@ - + Internal error, please report it! Errore interno, pregasi di segnalarlo! - + Unable to read the source file: Impossibile leggere il file di origine: - + File truncated during read, possible data change @@ -1025,10 +1009,6 @@ Use this folder when destination is not set - - Use this folder when destination is empty - Usare questa cartella quando la cartella di destinazione è vuota - Browse diff --git a/plugins/CopyEngine/Ultracopier/Languages/ja/translation.ts b/plugins/CopyEngine/Ultracopier/Languages/ja/translation.ts index 25bb8d3..5c68ad9 100644 --- a/plugins/CopyEngine/Ultracopier/Languages/ja/translation.ts +++ b/plugins/CopyEngine/Ultracopier/Languages/ja/translation.ts @@ -61,84 +61,84 @@ - + The mode has been forced previously. This is an internal error, please report it - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - + Options error - + Options engine is not loaded. Unable to access the filters @@ -146,85 +146,85 @@ CopyEngineFactory - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - - + + Options error - + Options engine is not loaded. Unable to access the filters - + Options engine is not loaded, can't access to the filters @@ -273,22 +273,22 @@ FileExistsDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -296,22 +296,22 @@ FileIsSameDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -417,40 +417,40 @@ - - + + Raw text - - + + Simplified regex - - + + Perl's regex - - + + Only on file - - + + Only on folder - - - - + + + + Full match @@ -458,27 +458,27 @@ FolderExistsDialog - + Folder already exists - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -486,49 +486,49 @@ ListThread - - + + Unable do to move or copy item into wrong forced mode: %1 - - + + Unable to save the transfer list: %1 - + Problem reading file, or file-size is 0 - + Wrong header: "%1" - + The transfer list is in mixed mode, but this instance is not in this mode - + The transfer list is in copy mode, but this instance is not in this mode - + The transfer list is in move mode, but this instance is not in this mode - + Some errors have been found during the line parsing - + Unable to open the transfer list: %1 @@ -556,13 +556,13 @@ - + Unable to move the folder - + Unable to remove @@ -649,39 +649,39 @@ ScanFileOrFolder - + Blacklisted folder - - + + %1 - copy - - + + %1 - copy (%2) - + This is not a folder - + The folder does exists - + The folder is not readable - + Problem with name encoding @@ -689,101 +689,101 @@ TransferThread - - - - + + + + File not found - - + + Wrong modification date or unable to get it, you can disable time transfer to do it - - + + Internal error: Already opening - + Drive %1 - + Unknown folder - + root - + %1 - copy - + %1 - copy (%2) - - + + The source file doesn't exist - - + + Unable to do the folder - + The source doesn't exist - + Another file exists at same place - + The checksums do not match - + Internal error: The destination is not closed - + Internal error: The size transfered doesn't match - + Internal error: The buffer is not empty - - - + + + Unable to change the date - + Try rename with using special characters @@ -796,17 +796,17 @@ - + Internal error, please report it! - + Unable to read the source file: - + File truncated during read, possible data change diff --git a/plugins/CopyEngine/Ultracopier/Languages/ko/translation.ts b/plugins/CopyEngine/Ultracopier/Languages/ko/translation.ts index deeeead..ea7d584 100644 --- a/plugins/CopyEngine/Ultracopier/Languages/ko/translation.ts +++ b/plugins/CopyEngine/Ultracopier/Languages/ko/translation.ts @@ -61,84 +61,84 @@ - + The mode has been forced previously. This is an internal error, please report it - - - - + + + + Ask 확인 - - - - + + + + Skip 건너뛰기 - + Merge 합치기 - - + + Rename 이름 바꾸기 - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer 더 최신이면 덮어씌우기 - + Overwrite if older - + Automatic - + Sequential - + Parallel - + Options error - + Options engine is not loaded. Unable to access the filters @@ -146,85 +146,85 @@ CopyEngineFactory - - - - + + + + Ask 확인 - - - - + + + + Skip 건너뛰기 - + Merge 합치기 - - + + Rename 이름 바꾸기 - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer 더 최신이면 덮어씌우기 - + Overwrite if older - + Automatic - + Sequential - + Parallel - - + + Options error - + Options engine is not loaded. Unable to access the filters - + Options engine is not loaded, can't access to the filters @@ -273,22 +273,22 @@ FileExistsDialog - + %1 - copy - + %1 - copy (%2) - + Error 오류 - + Try rename with using special characters @@ -296,22 +296,22 @@ FileIsSameDialog - + %1 - copy - + %1 - copy (%2) - + Error 오류 - + Try rename with using special characters @@ -417,40 +417,40 @@ - - + + Raw text - - + + Simplified regex - - + + Perl's regex - - + + Only on file - - + + Only on folder - - - - + + + + Full match @@ -458,27 +458,27 @@ FolderExistsDialog - + Folder already exists - + %1 - copy - + %1 - copy (%2) - + Error 오류 - + Try rename with using special characters @@ -486,49 +486,49 @@ ListThread - - + + Unable do to move or copy item into wrong forced mode: %1 - - + + Unable to save the transfer list: %1 - + Problem reading file, or file-size is 0 - + Wrong header: "%1" - + The transfer list is in mixed mode, but this instance is not in this mode - + The transfer list is in copy mode, but this instance is not in this mode - + The transfer list is in move mode, but this instance is not in this mode - + Some errors have been found during the line parsing - + Unable to open the transfer list: %1 @@ -556,13 +556,13 @@ - + Unable to move the folder - + Unable to remove @@ -649,43 +649,39 @@ ScanFileOrFolder - + Blacklisted folder - - + + %1 - copy - - + + %1 - copy (%2) - + This is not a folder - + The folder does exists - The folder not exists - 폴더가 존재하지 않습니다 - - - + The folder is not readable 폴더를 읽을 수 없습니다 - + Problem with name encoding @@ -693,101 +689,101 @@ TransferThread - - - - + + + + File not found - - + + Wrong modification date or unable to get it, you can disable time transfer to do it - - + + Internal error: Already opening - + Drive %1 - + Unknown folder - + root - + %1 - copy - + %1 - copy (%2) - - + + The source file doesn't exist - - + + Unable to do the folder - + The source doesn't exist - + Another file exists at same place - + The checksums do not match - + Internal error: The destination is not closed - + Internal error: The size transfered doesn't match - + Internal error: The buffer is not empty - - - + + + Unable to change the date - + Try rename with using special characters @@ -800,17 +796,17 @@ - + Internal error, please report it! - + Unable to read the source file: 원본 파일 읽기 불가: - + File truncated during read, possible data change diff --git a/plugins/CopyEngine/Ultracopier/Languages/nl/translation.ts b/plugins/CopyEngine/Ultracopier/Languages/nl/translation.ts index 3362659..a00b0cd 100644 --- a/plugins/CopyEngine/Ultracopier/Languages/nl/translation.ts +++ b/plugins/CopyEngine/Ultracopier/Languages/nl/translation.ts @@ -61,84 +61,84 @@ - + The mode has been forced previously. This is an internal error, please report it - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - + Options error - + Options engine is not loaded. Unable to access the filters @@ -146,85 +146,85 @@ CopyEngineFactory - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - - + + Options error - + Options engine is not loaded. Unable to access the filters - + Options engine is not loaded, can't access to the filters @@ -273,22 +273,22 @@ FileExistsDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -296,22 +296,22 @@ FileIsSameDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -417,40 +417,40 @@ - - + + Raw text - - + + Simplified regex - - + + Perl's regex - - + + Only on file - - + + Only on folder - - - - + + + + Full match @@ -458,27 +458,27 @@ FolderExistsDialog - + Folder already exists - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -486,49 +486,49 @@ ListThread - - + + Unable do to move or copy item into wrong forced mode: %1 - - + + Unable to save the transfer list: %1 - + Problem reading file, or file-size is 0 - + Wrong header: "%1" - + The transfer list is in mixed mode, but this instance is not in this mode - + The transfer list is in copy mode, but this instance is not in this mode - + The transfer list is in move mode, but this instance is not in this mode - + Some errors have been found during the line parsing - + Unable to open the transfer list: %1 @@ -556,13 +556,13 @@ - + Unable to move the folder - + Unable to remove @@ -649,39 +649,39 @@ ScanFileOrFolder - + Blacklisted folder - - + + %1 - copy - - + + %1 - copy (%2) - + This is not a folder - + The folder does exists - + The folder is not readable - + Problem with name encoding @@ -689,101 +689,101 @@ TransferThread - - - - + + + + File not found - - + + Wrong modification date or unable to get it, you can disable time transfer to do it - - + + Internal error: Already opening - + Drive %1 - + Unknown folder - + root - + %1 - copy - + %1 - copy (%2) - - + + The source file doesn't exist - - + + Unable to do the folder - + The source doesn't exist - + Another file exists at same place - + The checksums do not match - + Internal error: The destination is not closed - + Internal error: The size transfered doesn't match - + Internal error: The buffer is not empty - - - + + + Unable to change the date - + Try rename with using special characters @@ -796,17 +796,17 @@ - + Internal error, please report it! - + Unable to read the source file: - + File truncated during read, possible data change diff --git a/plugins/CopyEngine/Ultracopier/Languages/no/translation.ts b/plugins/CopyEngine/Ultracopier/Languages/no/translation.ts index 3362659..a00b0cd 100644 --- a/plugins/CopyEngine/Ultracopier/Languages/no/translation.ts +++ b/plugins/CopyEngine/Ultracopier/Languages/no/translation.ts @@ -61,84 +61,84 @@ - + The mode has been forced previously. This is an internal error, please report it - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - + Options error - + Options engine is not loaded. Unable to access the filters @@ -146,85 +146,85 @@ CopyEngineFactory - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - - + + Options error - + Options engine is not loaded. Unable to access the filters - + Options engine is not loaded, can't access to the filters @@ -273,22 +273,22 @@ FileExistsDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -296,22 +296,22 @@ FileIsSameDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -417,40 +417,40 @@ - - + + Raw text - - + + Simplified regex - - + + Perl's regex - - + + Only on file - - + + Only on folder - - - - + + + + Full match @@ -458,27 +458,27 @@ FolderExistsDialog - + Folder already exists - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -486,49 +486,49 @@ ListThread - - + + Unable do to move or copy item into wrong forced mode: %1 - - + + Unable to save the transfer list: %1 - + Problem reading file, or file-size is 0 - + Wrong header: "%1" - + The transfer list is in mixed mode, but this instance is not in this mode - + The transfer list is in copy mode, but this instance is not in this mode - + The transfer list is in move mode, but this instance is not in this mode - + Some errors have been found during the line parsing - + Unable to open the transfer list: %1 @@ -556,13 +556,13 @@ - + Unable to move the folder - + Unable to remove @@ -649,39 +649,39 @@ ScanFileOrFolder - + Blacklisted folder - - + + %1 - copy - - + + %1 - copy (%2) - + This is not a folder - + The folder does exists - + The folder is not readable - + Problem with name encoding @@ -689,101 +689,101 @@ TransferThread - - - - + + + + File not found - - + + Wrong modification date or unable to get it, you can disable time transfer to do it - - + + Internal error: Already opening - + Drive %1 - + Unknown folder - + root - + %1 - copy - + %1 - copy (%2) - - + + The source file doesn't exist - - + + Unable to do the folder - + The source doesn't exist - + Another file exists at same place - + The checksums do not match - + Internal error: The destination is not closed - + Internal error: The size transfered doesn't match - + Internal error: The buffer is not empty - - - + + + Unable to change the date - + Try rename with using special characters @@ -796,17 +796,17 @@ - + Internal error, please report it! - + Unable to read the source file: - + File truncated during read, possible data change diff --git a/plugins/CopyEngine/Ultracopier/Languages/pl/translation.ts b/plugins/CopyEngine/Ultracopier/Languages/pl/translation.ts index 3362659..a00b0cd 100644 --- a/plugins/CopyEngine/Ultracopier/Languages/pl/translation.ts +++ b/plugins/CopyEngine/Ultracopier/Languages/pl/translation.ts @@ -61,84 +61,84 @@ - + The mode has been forced previously. This is an internal error, please report it - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - + Options error - + Options engine is not loaded. Unable to access the filters @@ -146,85 +146,85 @@ CopyEngineFactory - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - - + + Options error - + Options engine is not loaded. Unable to access the filters - + Options engine is not loaded, can't access to the filters @@ -273,22 +273,22 @@ FileExistsDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -296,22 +296,22 @@ FileIsSameDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -417,40 +417,40 @@ - - + + Raw text - - + + Simplified regex - - + + Perl's regex - - + + Only on file - - + + Only on folder - - - - + + + + Full match @@ -458,27 +458,27 @@ FolderExistsDialog - + Folder already exists - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -486,49 +486,49 @@ ListThread - - + + Unable do to move or copy item into wrong forced mode: %1 - - + + Unable to save the transfer list: %1 - + Problem reading file, or file-size is 0 - + Wrong header: "%1" - + The transfer list is in mixed mode, but this instance is not in this mode - + The transfer list is in copy mode, but this instance is not in this mode - + The transfer list is in move mode, but this instance is not in this mode - + Some errors have been found during the line parsing - + Unable to open the transfer list: %1 @@ -556,13 +556,13 @@ - + Unable to move the folder - + Unable to remove @@ -649,39 +649,39 @@ ScanFileOrFolder - + Blacklisted folder - - + + %1 - copy - - + + %1 - copy (%2) - + This is not a folder - + The folder does exists - + The folder is not readable - + Problem with name encoding @@ -689,101 +689,101 @@ TransferThread - - - - + + + + File not found - - + + Wrong modification date or unable to get it, you can disable time transfer to do it - - + + Internal error: Already opening - + Drive %1 - + Unknown folder - + root - + %1 - copy - + %1 - copy (%2) - - + + The source file doesn't exist - - + + Unable to do the folder - + The source doesn't exist - + Another file exists at same place - + The checksums do not match - + Internal error: The destination is not closed - + Internal error: The size transfered doesn't match - + Internal error: The buffer is not empty - - - + + + Unable to change the date - + Try rename with using special characters @@ -796,17 +796,17 @@ - + Internal error, please report it! - + Unable to read the source file: - + File truncated during read, possible data change diff --git a/plugins/CopyEngine/Ultracopier/Languages/pt/translation.ts b/plugins/CopyEngine/Ultracopier/Languages/pt/translation.ts index 3362659..a00b0cd 100644 --- a/plugins/CopyEngine/Ultracopier/Languages/pt/translation.ts +++ b/plugins/CopyEngine/Ultracopier/Languages/pt/translation.ts @@ -61,84 +61,84 @@ - + The mode has been forced previously. This is an internal error, please report it - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - + Options error - + Options engine is not loaded. Unable to access the filters @@ -146,85 +146,85 @@ CopyEngineFactory - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - - + + Options error - + Options engine is not loaded. Unable to access the filters - + Options engine is not loaded, can't access to the filters @@ -273,22 +273,22 @@ FileExistsDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -296,22 +296,22 @@ FileIsSameDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -417,40 +417,40 @@ - - + + Raw text - - + + Simplified regex - - + + Perl's regex - - + + Only on file - - + + Only on folder - - - - + + + + Full match @@ -458,27 +458,27 @@ FolderExistsDialog - + Folder already exists - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -486,49 +486,49 @@ ListThread - - + + Unable do to move or copy item into wrong forced mode: %1 - - + + Unable to save the transfer list: %1 - + Problem reading file, or file-size is 0 - + Wrong header: "%1" - + The transfer list is in mixed mode, but this instance is not in this mode - + The transfer list is in copy mode, but this instance is not in this mode - + The transfer list is in move mode, but this instance is not in this mode - + Some errors have been found during the line parsing - + Unable to open the transfer list: %1 @@ -556,13 +556,13 @@ - + Unable to move the folder - + Unable to remove @@ -649,39 +649,39 @@ ScanFileOrFolder - + Blacklisted folder - - + + %1 - copy - - + + %1 - copy (%2) - + This is not a folder - + The folder does exists - + The folder is not readable - + Problem with name encoding @@ -689,101 +689,101 @@ TransferThread - - - - + + + + File not found - - + + Wrong modification date or unable to get it, you can disable time transfer to do it - - + + Internal error: Already opening - + Drive %1 - + Unknown folder - + root - + %1 - copy - + %1 - copy (%2) - - + + The source file doesn't exist - - + + Unable to do the folder - + The source doesn't exist - + Another file exists at same place - + The checksums do not match - + Internal error: The destination is not closed - + Internal error: The size transfered doesn't match - + Internal error: The buffer is not empty - - - + + + Unable to change the date - + Try rename with using special characters @@ -796,17 +796,17 @@ - + Internal error, please report it! - + Unable to read the source file: - + File truncated during read, possible data change diff --git a/plugins/CopyEngine/Ultracopier/Languages/ru/translation.ts b/plugins/CopyEngine/Ultracopier/Languages/ru/translation.ts index f53fff3..abaf3bb 100644 --- a/plugins/CopyEngine/Ultracopier/Languages/ru/translation.ts +++ b/plugins/CopyEngine/Ultracopier/Languages/ru/translation.ts @@ -61,84 +61,84 @@ - + The mode has been forced previously. This is an internal error, please report it - - - - + + + + Ask просить - - - - + + + + Skip пропускать - + Merge слияние - - + + Rename переименовать - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer Заменить, если новее - + Overwrite if older - + Automatic - + Sequential - + Parallel - + Options error Опции ошибке - + Options engine is not loaded. Unable to access the filters @@ -146,85 +146,85 @@ CopyEngineFactory - - - - + + + + Ask просить - - - - + + + + Skip пропускать - + Merge слияние - - + + Rename переименовать - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer Заменить, если новее - + Overwrite if older - + Automatic - + Sequential - + Parallel - - + + Options error Опции ошибке - + Options engine is not loaded. Unable to access the filters - + Options engine is not loaded, can't access to the filters Параметры двигателя не загружается, не может получить доступ к фильтрам @@ -273,22 +273,22 @@ FileExistsDialog - + %1 - copy %1 - копия - + %1 - copy (%2) %1 - копия (%2) - + Error ошибка - + Try rename with using special characters @@ -296,22 +296,22 @@ FileIsSameDialog - + %1 - copy %1 - копия - + %1 - copy (%2) %1 - копия (%2) - + Error ошибка - + Try rename with using special characters @@ -417,40 +417,40 @@ Ни = Включить все - - + + Raw text Сырой текст - - + + Simplified regex Упрощенная регулярных выражений - - + + Perl's regex Perl's regex - - + + Only on file Только на файл - - + + Only on folder Только на папку - - - - + + + + Full match Полный матч @@ -458,27 +458,27 @@ FolderExistsDialog - + Folder already exists Папка уже существует - + %1 - copy %1 - копия - + %1 - copy (%2) %1 - копия (%2) - + Error ошибка - + Try rename with using special characters @@ -486,49 +486,49 @@ ListThread - - + + Unable do to move or copy item into wrong forced mode: %1 Невозможно сделать, чтобы скопировать или переместить элемент в неправильном форсированном режиме: %1 - - + + Unable to save the transfer list: %1 Невозможно сохранить трансфер: %1 - + Problem reading file, or file-size is 0 - + Wrong header: "%1" Неправильный заголовок: "%1" - + The transfer list is in mixed mode, but this instance is not in this mode Трансфер в смешанном режиме, но этот экземпляр не в этом режиме - + The transfer list is in copy mode, but this instance is not in this mode Передача списка в режиме копирования, но этот экземпляр не в этом режиме - + The transfer list is in move mode, but this instance is not in this mode Трансфер в режим перемещения, но этот экземпляр не в этом режиме - + Some errors have been found during the line parsing - + Unable to open the transfer list: %1 Не удается открыть трансфер: %1 @@ -556,13 +556,13 @@ - + Unable to move the folder - + Unable to remove @@ -649,43 +649,39 @@ ScanFileOrFolder - + Blacklisted folder - - + + %1 - copy %1 - копия - - + + %1 - copy (%2) %1 - копия (%2) - + This is not a folder - + The folder does exists - The folder not exists - Папка не существует - - - + The folder is not readable Папки не читается - + Problem with name encoding @@ -693,101 +689,101 @@ TransferThread - - - - + + + + File not found - - + + Wrong modification date or unable to get it, you can disable time transfer to do it - - + + Internal error: Already opening - + Drive %1 - + Unknown folder - + root - + %1 - copy %1 - копия - + %1 - copy (%2) %1 - копия (%2) - - + + The source file doesn't exist - - + + Unable to do the folder - + The source doesn't exist - + Another file exists at same place - + The checksums do not match - + Internal error: The destination is not closed - + Internal error: The size transfered doesn't match - + Internal error: The buffer is not empty - - - + + + Unable to change the date - + Try rename with using special characters @@ -800,17 +796,17 @@ - + Internal error, please report it! - + Unable to read the source file: Невозможно прочитать исходный файл: - + File truncated during read, possible data change diff --git a/plugins/CopyEngine/Ultracopier/Languages/th/translation.ts b/plugins/CopyEngine/Ultracopier/Languages/th/translation.ts index 3362659..a00b0cd 100644 --- a/plugins/CopyEngine/Ultracopier/Languages/th/translation.ts +++ b/plugins/CopyEngine/Ultracopier/Languages/th/translation.ts @@ -61,84 +61,84 @@ - + The mode has been forced previously. This is an internal error, please report it - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - + Options error - + Options engine is not loaded. Unable to access the filters @@ -146,85 +146,85 @@ CopyEngineFactory - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - - + + Options error - + Options engine is not loaded. Unable to access the filters - + Options engine is not loaded, can't access to the filters @@ -273,22 +273,22 @@ FileExistsDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -296,22 +296,22 @@ FileIsSameDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -417,40 +417,40 @@ - - + + Raw text - - + + Simplified regex - - + + Perl's regex - - + + Only on file - - + + Only on folder - - - - + + + + Full match @@ -458,27 +458,27 @@ FolderExistsDialog - + Folder already exists - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -486,49 +486,49 @@ ListThread - - + + Unable do to move or copy item into wrong forced mode: %1 - - + + Unable to save the transfer list: %1 - + Problem reading file, or file-size is 0 - + Wrong header: "%1" - + The transfer list is in mixed mode, but this instance is not in this mode - + The transfer list is in copy mode, but this instance is not in this mode - + The transfer list is in move mode, but this instance is not in this mode - + Some errors have been found during the line parsing - + Unable to open the transfer list: %1 @@ -556,13 +556,13 @@ - + Unable to move the folder - + Unable to remove @@ -649,39 +649,39 @@ ScanFileOrFolder - + Blacklisted folder - - + + %1 - copy - - + + %1 - copy (%2) - + This is not a folder - + The folder does exists - + The folder is not readable - + Problem with name encoding @@ -689,101 +689,101 @@ TransferThread - - - - + + + + File not found - - + + Wrong modification date or unable to get it, you can disable time transfer to do it - - + + Internal error: Already opening - + Drive %1 - + Unknown folder - + root - + %1 - copy - + %1 - copy (%2) - - + + The source file doesn't exist - - + + Unable to do the folder - + The source doesn't exist - + Another file exists at same place - + The checksums do not match - + Internal error: The destination is not closed - + Internal error: The size transfered doesn't match - + Internal error: The buffer is not empty - - - + + + Unable to change the date - + Try rename with using special characters @@ -796,17 +796,17 @@ - + Internal error, please report it! - + Unable to read the source file: - + File truncated during read, possible data change diff --git a/plugins/CopyEngine/Ultracopier/Languages/tr/translation.ts b/plugins/CopyEngine/Ultracopier/Languages/tr/translation.ts index 3362659..a00b0cd 100644 --- a/plugins/CopyEngine/Ultracopier/Languages/tr/translation.ts +++ b/plugins/CopyEngine/Ultracopier/Languages/tr/translation.ts @@ -61,84 +61,84 @@ - + The mode has been forced previously. This is an internal error, please report it - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - + Options error - + Options engine is not loaded. Unable to access the filters @@ -146,85 +146,85 @@ CopyEngineFactory - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - - + + Options error - + Options engine is not loaded. Unable to access the filters - + Options engine is not loaded, can't access to the filters @@ -273,22 +273,22 @@ FileExistsDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -296,22 +296,22 @@ FileIsSameDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -417,40 +417,40 @@ - - + + Raw text - - + + Simplified regex - - + + Perl's regex - - + + Only on file - - + + Only on folder - - - - + + + + Full match @@ -458,27 +458,27 @@ FolderExistsDialog - + Folder already exists - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -486,49 +486,49 @@ ListThread - - + + Unable do to move or copy item into wrong forced mode: %1 - - + + Unable to save the transfer list: %1 - + Problem reading file, or file-size is 0 - + Wrong header: "%1" - + The transfer list is in mixed mode, but this instance is not in this mode - + The transfer list is in copy mode, but this instance is not in this mode - + The transfer list is in move mode, but this instance is not in this mode - + Some errors have been found during the line parsing - + Unable to open the transfer list: %1 @@ -556,13 +556,13 @@ - + Unable to move the folder - + Unable to remove @@ -649,39 +649,39 @@ ScanFileOrFolder - + Blacklisted folder - - + + %1 - copy - - + + %1 - copy (%2) - + This is not a folder - + The folder does exists - + The folder is not readable - + Problem with name encoding @@ -689,101 +689,101 @@ TransferThread - - - - + + + + File not found - - + + Wrong modification date or unable to get it, you can disable time transfer to do it - - + + Internal error: Already opening - + Drive %1 - + Unknown folder - + root - + %1 - copy - + %1 - copy (%2) - - + + The source file doesn't exist - - + + Unable to do the folder - + The source doesn't exist - + Another file exists at same place - + The checksums do not match - + Internal error: The destination is not closed - + Internal error: The size transfered doesn't match - + Internal error: The buffer is not empty - - - + + + Unable to change the date - + Try rename with using special characters @@ -796,17 +796,17 @@ - + Internal error, please report it! - + Unable to read the source file: - + File truncated during read, possible data change diff --git a/plugins/CopyEngine/Ultracopier/Languages/zh/translation.ts b/plugins/CopyEngine/Ultracopier/Languages/zh/translation.ts index 25bb8d3..5c68ad9 100644 --- a/plugins/CopyEngine/Ultracopier/Languages/zh/translation.ts +++ b/plugins/CopyEngine/Ultracopier/Languages/zh/translation.ts @@ -61,84 +61,84 @@ - + The mode has been forced previously. This is an internal error, please report it - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - + Options error - + Options engine is not loaded. Unable to access the filters @@ -146,85 +146,85 @@ CopyEngineFactory - - - - + + + + Ask - - - - + + + + Skip - + Merge - - + + Rename - + Put at the end - + Overwrite - + Overwrite if different - + Overwrite if newer - + Overwrite if older - + Automatic - + Sequential - + Parallel - - + + Options error - + Options engine is not loaded. Unable to access the filters - + Options engine is not loaded, can't access to the filters @@ -273,22 +273,22 @@ FileExistsDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -296,22 +296,22 @@ FileIsSameDialog - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -417,40 +417,40 @@ - - + + Raw text - - + + Simplified regex - - + + Perl's regex - - + + Only on file - - + + Only on folder - - - - + + + + Full match @@ -458,27 +458,27 @@ FolderExistsDialog - + Folder already exists - + %1 - copy - + %1 - copy (%2) - + Error - + Try rename with using special characters @@ -486,49 +486,49 @@ ListThread - - + + Unable do to move or copy item into wrong forced mode: %1 - - + + Unable to save the transfer list: %1 - + Problem reading file, or file-size is 0 - + Wrong header: "%1" - + The transfer list is in mixed mode, but this instance is not in this mode - + The transfer list is in copy mode, but this instance is not in this mode - + The transfer list is in move mode, but this instance is not in this mode - + Some errors have been found during the line parsing - + Unable to open the transfer list: %1 @@ -556,13 +556,13 @@ - + Unable to move the folder - + Unable to remove @@ -649,39 +649,39 @@ ScanFileOrFolder - + Blacklisted folder - - + + %1 - copy - - + + %1 - copy (%2) - + This is not a folder - + The folder does exists - + The folder is not readable - + Problem with name encoding @@ -689,101 +689,101 @@ TransferThread - - - - + + + + File not found - - + + Wrong modification date or unable to get it, you can disable time transfer to do it - - + + Internal error: Already opening - + Drive %1 - + Unknown folder - + root - + %1 - copy - + %1 - copy (%2) - - + + The source file doesn't exist - - + + Unable to do the folder - + The source doesn't exist - + Another file exists at same place - + The checksums do not match - + Internal error: The destination is not closed - + Internal error: The size transfered doesn't match - + Internal error: The buffer is not empty - - - + + + Unable to change the date - + Try rename with using special characters @@ -796,17 +796,17 @@ - + Internal error, please report it! - + Unable to read the source file: - + File truncated during read, possible data change diff --git a/plugins/CopyEngine/Ultracopier/ListThread.cpp b/plugins/CopyEngine/Ultracopier/ListThread.cpp index 48e06db..4b9cde5 100644 --- a/plugins/CopyEngine/Ultracopier/ListThread.cpp +++ b/plugins/CopyEngine/Ultracopier/ListThread.cpp @@ -1,6 +1,7 @@ #include "ListThread.h" #include #include +#include "../../../cpp11addition.h" ListThread::ListThread(FacilityInterface * facilityInterface) { @@ -78,12 +79,12 @@ void ListThread::transferInodeIsClosed() { numberOfInodeOperation--; #ifdef ULTRACOPIER_PLUGIN_DEBUG_SCHEDULER - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("numberOfInodeOperation: %1").arg(numberOfInodeOperation)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"numberOfInodeOperation: "+std::to_string(numberOfInodeOperation)); #endif TransferThread *temp_transfer_thread=qobject_cast(QObject::sender()); if(temp_transfer_thread==NULL) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("transfer thread not located!")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"transfer thread not located!"); return; } bool isFound=false; @@ -92,7 +93,7 @@ void ListThread::transferInodeIsClosed() #endif if(temp_transfer_thread->getStat()!=TransferStat_Idle) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("transfer thread not idle!")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"transfer thread not idle!"); return; } int int_for_internal_loop=0; @@ -101,17 +102,17 @@ void ListThread::transferInodeIsClosed() { if(actionToDoListTransfer.at(int_for_internal_loop).id==temp_transfer_thread->transferId) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[%1] have finish, put at idle; for id: %2").arg(int_for_internal_loop).arg(temp_transfer_thread->transferId)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[%1] have finish, put at idle; for id: %2").arg(int_for_internal_loop).arg(temp_transfer_thread->transferId).toStdString()); Ultracopier::ReturnActionOnCopyList newAction; newAction.type=Ultracopier::RemoveItem; newAction.userAction.moveAt=0; newAction.addAction=actionToDoTransferToItemOfCopyList(actionToDoListTransfer.at(int_for_internal_loop)); newAction.userAction.position=int_for_internal_loop; - actionDone << newAction; + actionDone.push_back(newAction); /// \todo check if item is at the right thread - actionToDoListTransfer.removeAt(int_for_internal_loop); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("actionToDoListTransfer.size(): %1, actionToDoListInode: %2, actionToDoListInode_afterTheTransfer: %3").arg(actionToDoListTransfer.size()).arg(actionToDoListInode.size()).arg(actionToDoListInode_afterTheTransfer.size())); - if(actionToDoListTransfer.isEmpty() && actionToDoListInode.isEmpty() && actionToDoListInode_afterTheTransfer.isEmpty()) + actionToDoListTransfer.erase(actionToDoListTransfer.cbegin()+int_for_internal_loop); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("actionToDoListTransfer.size(): %1, actionToDoListInode: %2, actionToDoListInode_afterTheTransfer: %3").arg(actionToDoListTransfer.size()).arg(actionToDoListInode.size()).arg(actionToDoListInode_afterTheTransfer.size()).toStdString()); + if(actionToDoListTransfer.empty() && actionToDoListInode.empty() && actionToDoListInode_afterTheTransfer.empty()) updateTheStatus(); //add the current size of file, to general size because it's finish @@ -119,7 +120,7 @@ void ListThread::transferInodeIsClosed() if(copiedSize>(qint64)temp_transfer_thread->transferSize) { oversize=copiedSize-temp_transfer_thread->transferSize; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("add oversize of: %1").arg(oversize)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"add oversize of: "+std::to_string(oversize)); bytesToTransfer+=oversize; bytesTransfered+=oversize; } @@ -127,7 +128,7 @@ void ListThread::transferInodeIsClosed() if(temp_transfer_thread->haveStartTime) { - timeToTransfer << QPair(temp_transfer_thread->transferSize,temp_transfer_thread->startTransferTime.elapsed()); + timeToTransfer.push_back(std::pair(temp_transfer_thread->transferSize,temp_transfer_thread->startTransferTime.elapsed())); temp_transfer_thread->haveStartTime=false; } temp_transfer_thread->transferId=0; @@ -136,10 +137,10 @@ void ListThread::transferInodeIsClosed() countLocalParse++; #endif isFound=true; - if(actionToDoListTransfer.isEmpty()) + if(actionToDoListTransfer.empty()) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"actionToDoListTransfer==0"); - actionToDoListInode << actionToDoListInode_afterTheTransfer; + actionToDoListInode.insert(actionToDoListInode.cbegin(),actionToDoListInode_afterTheTransfer.cbegin(),actionToDoListInode_afterTheTransfer.cend()); actionToDoListInode_afterTheTransfer.clear(); doNewActions_inode_manipulation(); } @@ -151,14 +152,14 @@ void ListThread::transferInodeIsClosed() deleteTransferThread(); else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("unable to found item into the todo list, id: %1, index: %2").arg(temp_transfer_thread->transferId).arg(int_for_internal_loop)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("unable to found item into the todo list, id: %1, index: %2").arg(temp_transfer_thread->transferId).arg(int_for_internal_loop).toStdString()); temp_transfer_thread->transferId=0; temp_transfer_thread->transferSize=0; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("countLocalParse: %1, actionToDoList.size(): %2").arg(countLocalParse).arg(actionToDoListTransfer.size())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("countLocalParse: %1, actionToDoList.size(): %2").arg(countLocalParse).arg(actionToDoListTransfer.size()).toStdString()); #ifdef ULTRACOPIER_PLUGIN_DEBUG if(countLocalParse!=1) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("countLocalParse != 1")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"countLocalParse != 1"); #endif doNewActions_inode_manipulation(); } @@ -170,29 +171,30 @@ void ListThread::transferPutAtBottom() TransferThread *transfer=qobject_cast(QObject::sender()); if(transfer==NULL) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("transfer thread not located!")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"transfer thread not located!"); return; } bool isFound=false; #ifdef ULTRACOPIER_PLUGIN_DEBUG int countLocalParse=0; #endif - int indexAction=0; + unsigned int indexAction=0; while(indexActiontransferId) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Put at the end: %1").arg(transfer->transferId)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Put at the end: "+std::to_string(transfer->transferId)); //push for interface at the end Ultracopier::ReturnActionOnCopyList newAction; newAction.type=Ultracopier::MoveItem; newAction.addAction.id=transfer->transferId; newAction.userAction.position=actionToDoListTransfer.size()-1; - actionDone << newAction; + actionDone.push_back(newAction); //do the wait stat actionToDoListTransfer[indexAction].isRunning=false; //move at the end - actionToDoListTransfer.move(indexAction,actionToDoListTransfer.size()-1); + actionToDoListTransfer.push_back(actionToDoListTransfer.at(indexAction)); + actionToDoListTransfer.erase(actionToDoListTransfer.cbegin()+indexAction); //reset the thread list stat transfer->transferId=0; transfer->transferSize=0; @@ -206,14 +208,14 @@ void ListThread::transferPutAtBottom() } if(!isFound) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("unable to found item into the todo list, id: %1, index: %2").arg(transfer->transferId)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("unable to found item into the todo list, id: %1, index: %2").arg(transfer->transferId).toStdString()); transfer->transferId=0; transfer->transferSize=0; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("countLocalParse: %1").arg(countLocalParse)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"countLocalParse: "+std::to_string(countLocalParse)); #ifdef ULTRACOPIER_PLUGIN_DEBUG if(countLocalParse!=1) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("countLocalParse != 1")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"countLocalParse != 1"); #endif transfer->skip(); } @@ -272,7 +274,7 @@ void ListThread::setAutoStart(const bool autoStart) /// \brief set rsync void ListThread::setRsync(const bool rsync) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"set rsync: "+QString::number(rsync)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"set rsync: "+std::to_string(rsync)); this->rsync=rsync; int index=0; int loop_sub_size_transfer_thread_search=transferThreadList.size(); @@ -281,7 +283,7 @@ void ListThread::setRsync(const bool rsync) transferThreadList.at(index)->setRsync(rsync); index++; } - for(int i=0;isetRsync(rsync); } #endif @@ -290,7 +292,7 @@ void ListThread::setRsync(const bool rsync) void ListThread::setCheckDestinationFolderExists(const bool checkDestinationFolderExists) { this->checkDestinationFolderExists=checkDestinationFolderExists; - for(int i=0;isetCheckDestinationFolderExists(checkDestinationFolderExists && alwaysDoThisActionForFolderExists!=FolderExists_Merge); } @@ -302,7 +304,7 @@ void ListThread::fileTransfer(const QFileInfo &sourceFileInfo,const QFileInfo &d } // -> add thread safe, by Qt::BlockingQueuedConnection -bool ListThread::haveSameSource(const QStringList &sources) +bool ListThread::haveSameSource(const std::vector &sources) { if(stopIt) return false; @@ -311,12 +313,12 @@ bool ListThread::haveSameSource(const QStringList &sources) ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"sourceDriveMultiple"); return false; } - if(sourceDrive.isEmpty()) + if(sourceDrive.empty()) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"sourceDrive.isEmpty()"); return true; } - int index=0; + unsigned int index=0; while(index add thread safe, by Qt::BlockingQueuedConnection -bool ListThread::haveSameDestination(const QString &destination) +bool ListThread::haveSameDestination(const std::string &destination) { if(stopIt) return false; @@ -340,7 +342,7 @@ bool ListThread::haveSameDestination(const QString &destination) ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"destinationDriveMultiple"); return false; } - if(destinationDrive.isEmpty()) + if(destinationDrive.empty()) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"destinationDrive.isEmpty()"); return true; @@ -355,52 +357,52 @@ bool ListThread::haveSameDestination(const QString &destination) } /// \return empty if multiple or no destination -QString ListThread::getUniqueDestinationFolder() const +std::string ListThread::getUniqueDestinationFolder() const { if(stopIt) - return QString(); + return std::string(); if(destinationFolderMultiple) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"destinationDriveMultiple"); - return QString(); + return std::string(); } return destinationFolder; } ScanFileOrFolder * ListThread::newScanThread(Ultracopier::CopyMode mode) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start with: ")+QString::number(mode)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start with: "+std::to_string(mode)); //create new thread because is auto-detroyed - scanFileOrFolderThreadsPool << new ScanFileOrFolder(mode); - connect(scanFileOrFolderThreadsPool.last(),&ScanFileOrFolder::finishedTheListing, this,&ListThread::scanThreadHaveFinishSlot, Qt::QueuedConnection); - connect(scanFileOrFolderThreadsPool.last(),&ScanFileOrFolder::fileTransfer, this,&ListThread::fileTransfer, Qt::QueuedConnection); + scanFileOrFolderThreadsPool.push_back(new ScanFileOrFolder(mode)); + connect(scanFileOrFolderThreadsPool.back(),&ScanFileOrFolder::finishedTheListing, this,&ListThread::scanThreadHaveFinishSlot, Qt::QueuedConnection); + connect(scanFileOrFolderThreadsPool.back(),&ScanFileOrFolder::fileTransfer, this,&ListThread::fileTransfer, Qt::QueuedConnection); #ifdef ULTRACOPIER_PLUGIN_DEBUG - connect(scanFileOrFolderThreadsPool.last(),&ScanFileOrFolder::debugInformation, this,&ListThread::debugInformation, Qt::QueuedConnection); + connect(scanFileOrFolderThreadsPool.back(),&ScanFileOrFolder::debugInformation, this,&ListThread::debugInformation, Qt::QueuedConnection); #endif - connect(scanFileOrFolderThreadsPool.last(),&ScanFileOrFolder::newFolderListing, this,&ListThread::newFolderListing); - connect(scanFileOrFolderThreadsPool.last(),&ScanFileOrFolder::addToMovePath, this,&ListThread::addToMovePath, Qt::QueuedConnection); - connect(scanFileOrFolderThreadsPool.last(),&ScanFileOrFolder::addToRealMove, this,&ListThread::addToRealMove, Qt::QueuedConnection); - connect(scanFileOrFolderThreadsPool.last(),&ScanFileOrFolder::addToMkPath, this,&ListThread::addToMkPath, Qt::QueuedConnection); + connect(scanFileOrFolderThreadsPool.back(),&ScanFileOrFolder::newFolderListing, this,&ListThread::newFolderListing); + connect(scanFileOrFolderThreadsPool.back(),&ScanFileOrFolder::addToMovePath, this,&ListThread::addToMovePath, Qt::QueuedConnection); + connect(scanFileOrFolderThreadsPool.back(),&ScanFileOrFolder::addToRealMove, this,&ListThread::addToRealMove, Qt::QueuedConnection); + connect(scanFileOrFolderThreadsPool.back(),&ScanFileOrFolder::addToMkPath, this,&ListThread::addToMkPath, Qt::QueuedConnection); #ifdef ULTRACOPIER_PLUGIN_RSYNC - connect(scanFileOrFolderThreadsPool.last(),&ScanFileOrFolder::addToRmForRsync, this,&ListThread::addToRmForRsync, Qt::QueuedConnection); + connect(scanFileOrFolderThreadsPool.back(),&ScanFileOrFolder::addToRmForRsync, this,&ListThread::addToRmForRsync, Qt::QueuedConnection); #endif - connect(scanFileOrFolderThreadsPool.last(),&ScanFileOrFolder::errorOnFolder, this,&ListThread::errorOnFolder, Qt::QueuedConnection); - connect(scanFileOrFolderThreadsPool.last(),&ScanFileOrFolder::folderAlreadyExists, this,&ListThread::folderAlreadyExists, Qt::QueuedConnection); + connect(scanFileOrFolderThreadsPool.back(),&ScanFileOrFolder::errorOnFolder, this,&ListThread::errorOnFolder, Qt::QueuedConnection); + connect(scanFileOrFolderThreadsPool.back(),&ScanFileOrFolder::folderAlreadyExists, this,&ListThread::folderAlreadyExists, Qt::QueuedConnection); - connect(this,&ListThread::send_updateMount, scanFileOrFolderThreadsPool.last(),&ScanFileOrFolder::set_updateMount, Qt::QueuedConnection); + connect(this,&ListThread::send_updateMount, scanFileOrFolderThreadsPool.back(),&ScanFileOrFolder::set_updateMount, Qt::QueuedConnection); - scanFileOrFolderThreadsPool.last()->setFilters(include,exclude); - scanFileOrFolderThreadsPool.last()->setCheckDestinationFolderExists(checkDestinationFolderExists && alwaysDoThisActionForFolderExists!=FolderExists_Merge); - scanFileOrFolderThreadsPool.last()->setMoveTheWholeFolder(moveTheWholeFolder); + scanFileOrFolderThreadsPool.back()->setFilters(include,exclude); + scanFileOrFolderThreadsPool.back()->setCheckDestinationFolderExists(checkDestinationFolderExists && alwaysDoThisActionForFolderExists!=FolderExists_Merge); + scanFileOrFolderThreadsPool.back()->setMoveTheWholeFolder(moveTheWholeFolder); #ifdef ULTRACOPIER_PLUGIN_RSYNC - scanFileOrFolderThreadsPool.last()->setRsync(rsync); + scanFileOrFolderThreadsPool.back()->setRsync(rsync); #endif if(scanFileOrFolderThreadsPool.size()==1) updateTheStatus(); - scanFileOrFolderThreadsPool.last()->setRenamingRules(firstRenamingRule,otherRenamingRule); - return scanFileOrFolderThreadsPool.last(); + scanFileOrFolderThreadsPool.back()->setRenamingRules(firstRenamingRule,otherRenamingRule); + return scanFileOrFolderThreadsPool.back(); } void ListThread::scanThreadHaveFinishSlot() @@ -410,7 +412,7 @@ void ListThread::scanThreadHaveFinishSlot() void ListThread::scanThreadHaveFinish(bool skipFirstRemove) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("listing thread have finish, skipFirstRemove: ")+QString::number(skipFirstRemove)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"listing thread have finish, skipFirstRemove: "+std::to_string(skipFirstRemove)); if(!skipFirstRemove) { ScanFileOrFolder * senderThread = qobject_cast(QObject::sender()); @@ -418,21 +420,21 @@ void ListThread::scanThreadHaveFinish(bool skipFirstRemove) ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"sender pointer null (plugin copy engine)"); else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start the next thread, scanFileOrFolderThreadsPool.size(): ")+QString::number(scanFileOrFolderThreadsPool.size())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start the next thread, scanFileOrFolderThreadsPool.size(): "+std::to_string(scanFileOrFolderThreadsPool.size())); delete senderThread; - scanFileOrFolderThreadsPool.removeOne(senderThread); - if(scanFileOrFolderThreadsPool.isEmpty()) + vectorremoveOne(scanFileOrFolderThreadsPool,senderThread); + if(scanFileOrFolderThreadsPool.empty()) updateTheStatus(); } } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start the next thread, scanFileOrFolderThreadsPool.size(): ")+QString::number(scanFileOrFolderThreadsPool.size())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start the next thread, scanFileOrFolderThreadsPool.size(): "+std::to_string(scanFileOrFolderThreadsPool.size())); if(scanFileOrFolderThreadsPool.size()>0) { //then start the next listing threads - if(scanFileOrFolderThreadsPool.first()->isFinished()) + if(scanFileOrFolderThreadsPool.front()->isFinished()) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Start listing thread"); - scanFileOrFolderThreadsPool.first()->start(); + scanFileOrFolderThreadsPool.front()->start(); } else ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"The listing thread is already running"); @@ -472,9 +474,9 @@ void ListThread::startGeneralTransfer() } // -> add thread safe, by Qt::BlockingQueuedConnection -bool ListThread::newCopy(const QStringList &sources,const QString &destination) +bool ListThread::newCopy(const std::vector &sources,const std::string &destination) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start: ")+sources.join(";")+QStringLiteral(", destination: ")+destination); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start: "+stringimplode(sources,";")+", destination: "+destination); ScanFileOrFolder * scanFileOrFolderThread = newScanThread(Ultracopier::Copy); if(scanFileOrFolderThread==NULL) { @@ -488,7 +490,7 @@ bool ListThread::newCopy(const QStringList &sources,const QString &destination) } // -> add thread safe, by Qt::BlockingQueuedConnection -bool ListThread::newMove(const QStringList &sources,const QString &destination) +bool ListThread::newMove(const std::vector &sources,const std::string &destination) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); ScanFileOrFolder * scanFileOrFolderThread = newScanThread(Ultracopier::Move); @@ -503,17 +505,17 @@ bool ListThread::newMove(const QStringList &sources,const QString &destination) return true; } -void ListThread::detectDrivesOfCurrentTransfer(const QStringList &sources,const QString &destination) +void ListThread::detectDrivesOfCurrentTransfer(const std::vector &sources,const std::string &destination) { /* code to detect volume/mount point to group by windows */ if(!sourceDriveMultiple) { - int index=0; + unsigned int index=0; while(index ListThread::getReturnPairQuint64ToCopyEngine() const +std::pair ListThread::getReturnPairQuint64ToCopyEngine() const { return returnPairQuint64ToCopyEngine; } @@ -701,12 +703,12 @@ void ListThread::resume() emit isInPause(false); } -void ListThread::skip(const quint64 &id) +void ListThread::skip(const uint64_t &id) { skipInternal(id); } -bool ListThread::skipInternal(const quint64 &id) +bool ListThread::skipInternal(const uint64_t &id) { int index=0; int loop_sub_size_transfer_thread_search=transferThreadList.size(); @@ -714,7 +716,7 @@ bool ListThread::skipInternal(const quint64 &id) { if(transferThreadList.at(index)->transferId==id) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("skip one transfer: %1").arg(id)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"skip one transfer: "+std::to_string(id)); transferThreadList.at(index)->skip(); return true; } @@ -726,22 +728,22 @@ bool ListThread::skipInternal(const quint64 &id) { if(actionToDoListTransfer.at(int_for_internal_loop).id==id) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[%1] remove at not running, for id: %2").arg(int_for_internal_loop).arg(id)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[%1] remove at not running, for id: %2").arg(int_for_internal_loop).arg(id).toStdString()); Ultracopier::ReturnActionOnCopyList newAction; newAction.type=Ultracopier::RemoveItem; newAction.userAction.moveAt=1; newAction.addAction=actionToDoTransferToItemOfCopyList(actionToDoListTransfer.at(int_for_internal_loop)); newAction.userAction.position=int_for_internal_loop; - actionDone << newAction; - actionToDoListTransfer.removeAt(int_for_internal_loop); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("actionToDoListTransfer.size(): %1, actionToDoListInode: %2, actionToDoListInode_afterTheTransfer: %3").arg(actionToDoListTransfer.size()).arg(actionToDoListInode.size()).arg(actionToDoListInode_afterTheTransfer.size())); - if(actionToDoListTransfer.isEmpty() && actionToDoListInode.isEmpty() && actionToDoListInode_afterTheTransfer.isEmpty()) + actionDone.push_back(newAction); + actionToDoListTransfer.erase(actionToDoListTransfer.cbegin()+int_for_internal_loop); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("actionToDoListTransfer.size(): %1, actionToDoListInode: %2, actionToDoListInode_afterTheTransfer: %3").arg(actionToDoListTransfer.size()).arg(actionToDoListInode.size()).arg(actionToDoListInode_afterTheTransfer.size()).toStdString()); + if(actionToDoListTransfer.empty() && actionToDoListInode.empty() && actionToDoListInode_afterTheTransfer.empty()) updateTheStatus(); return true; } int_for_internal_loop++; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("skip transfer not found: %1").arg(id)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"skip transfer not found: "+std::to_string(id)); return false; } @@ -796,7 +798,7 @@ void ListThread::checkIfReadyToCancel() return; delete transferThreadList.at(index);//->deleteLayer(); transferThreadList[index]=NULL; - transferThreadList.removeAt(index); + transferThreadList.erase(transferThreadList.cbegin()+index); loop_size=transferThreadList.size(); index--; } @@ -814,10 +816,10 @@ void ListThread::checkIfReadyToCancel() } //speedLimitation in KB/s -bool ListThread::setSpeedLimitation(const qint64 &speedLimitation) +bool ListThread::setSpeedLimitation(const int64_t &speedLimitation) { #ifdef ULTRACOPIER_PLUGIN_SPEED_SUPPORT - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("maxSpeed in KB/s: ")+QString::number(speedLimitation)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"maxSpeed in KB/s: "+std::to_string(speedLimitation)); if(speedLimitation>1024*1024) { @@ -881,6 +883,7 @@ bool ListThread::setSpeedLimitation(const qint64 &speedLimitation) .arg(multiForBigSpeed) .arg(newInterval) .arg(maxSpeed) + .toStdString() ); clockForTheCopySpeed->setInterval(newInterval); @@ -933,7 +936,7 @@ void ListThread::updateTheStatus() updateTheStatus_action_in_progress=Ultracopier::Copying; else updateTheStatus_action_in_progress=Ultracopier::Idle; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("emit actionInProgess(")+QString::number(updateTheStatus_action_in_progress)+QStringLiteral(")")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"emit actionInProgess("+std::to_string(updateTheStatus_action_in_progress)+")"); emit actionInProgess(updateTheStatus_action_in_progress); } @@ -951,20 +954,20 @@ void ListThread::setAlwaysFileExistsAction(const FileExistsAction &alwaysDoThisA } //mk path to do -quint64 ListThread::addToMkPath(const QFileInfo& source,const QFileInfo& destination, const int& inode) +uint64_t ListThread::addToMkPath(const QFileInfo& source,const QFileInfo& destination, const int& inode) { if(stopIt) return 0; if(inode!=0 && (!keepDate && !doRightTransfer)) return 0; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("source: %1, destination: %2").arg(source.absoluteFilePath()).arg(destination.absoluteFilePath())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("source: %1, destination: %2").arg(source.absoluteFilePath()).arg(destination.absoluteFilePath()).toStdString()); ActionToDoInode temp; temp.type = ActionType_MkPath; temp.id = generateIdNumber(); temp.source = source; temp.destination= destination; temp.isRunning = false; - actionToDoListInode << temp; + actionToDoListInode.push_back(temp); return temp.id; } @@ -973,7 +976,7 @@ void ListThread::addToMovePath(const QFileInfo& source, const QFileInfo &destina { if(stopIt) return; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("source: %1, destination: %2, inodeToRemove: %3").arg(source.absoluteFilePath()).arg(destination.absoluteFilePath()).arg(inodeToRemove)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("source: %1, destination: %2, inodeToRemove: %3").arg(source.absoluteFilePath()).arg(destination.absoluteFilePath()).arg(inodeToRemove).toStdString()); ActionToDoInode temp; temp.type = ActionType_MovePath; temp.id = generateIdNumber(); @@ -981,14 +984,14 @@ void ListThread::addToMovePath(const QFileInfo& source, const QFileInfo &destina temp.source = source; temp.destination= destination; temp.isRunning = false; - actionToDoListInode << temp; + actionToDoListInode.push_back(temp); } void ListThread::addToRealMove(const QFileInfo& source,const QFileInfo& destination) { if(stopIt) return; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("source: %1, destination: %2").arg(source.absoluteFilePath()).arg(destination.absoluteFilePath())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("source: %1, destination: %2").arg(source.absoluteFilePath()).arg(destination.absoluteFilePath()).toStdString()); ActionToDoInode temp; temp.type = ActionType_RealMove; temp.id = generateIdNumber(); @@ -996,32 +999,32 @@ void ListThread::addToRealMove(const QFileInfo& source,const QFileInfo& destinat temp.source = source; temp.destination= destination; temp.isRunning = false; - actionToDoListInode << temp; + actionToDoListInode.push_back(temp); } #ifdef ULTRACOPIER_PLUGIN_RSYNC //rsync rm void ListThread::addToRmForRsync(const QFileInfo& destination) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"inode: "+destination.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"inode: "+destination.absoluteFilePath().toStdString()); ActionToDoInode temp; temp.type = ActionType_RmSync; temp.id = generateIdNumber(); temp.destination= destination; temp.isRunning = false; - actionToDoListInode << temp; + actionToDoListInode.push_back(temp); } #endif //send action done void ListThread::sendActionDone() { - if(!actionDone.isEmpty()) + if(!actionDone.empty()) { emit newActionOnList(actionDone); actionDone.clear(); } - if(!timeToTransfer.isEmpty()) + if(!timeToTransfer.empty()) { emit doneTime(timeToTransfer); timeToTransfer.clear(); @@ -1031,7 +1034,7 @@ void ListThread::sendActionDone() //send progression void ListThread::sendProgression() { - if(actionToDoListTransfer.isEmpty()) + if(actionToDoListTransfer.empty()) return; oversize=0; currentProgression=0; @@ -1060,12 +1063,12 @@ void ListThread::sendProgression() //the current size copied totalSize=temp_transfer_thread->transferSize+localOverSize; - QPair progression=temp_transfer_thread->progression(); + std::pair progression=temp_transfer_thread->progression(); tempItem.currentRead=progression.first; tempItem.currentWrite=progression.second; tempItem.id=temp_transfer_thread->transferId; tempItem.total=totalSize; - progressionList << tempItem; + progressionList.push_back(tempItem); //add the oversize to the general progression oversize+=localOverSize; @@ -1099,14 +1102,14 @@ void ListThread::syncTransferList_internal() Ultracopier::ReturnActionOnCopyList newAction; newAction.type = Ultracopier::PreOperation; newAction.addAction.id = item.id; - newAction.addAction.sourceFullPath = item.source.absoluteFilePath(); - newAction.addAction.sourceFileName = item.source.fileName(); - newAction.addAction.destinationFullPath = item.destination.absoluteFilePath(); - newAction.addAction.destinationFileName = item.destination.fileName(); + newAction.addAction.sourceFullPath = item.source.absoluteFilePath().toStdString(); + newAction.addAction.sourceFileName = item.source.fileName().toStdString(); + newAction.addAction.destinationFullPath = item.destination.absoluteFilePath().toStdString(); + newAction.addAction.destinationFileName = item.destination.fileName().toStdString(); newAction.addAction.size = item.size; newAction.addAction.mode = item.mode; - actionDone << newAction; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("id: %1, size: %2, name: %3, size2: %4").arg(item.id).arg(item.size).arg(item.source.absoluteFilePath()).arg(newAction.addAction.size)); + actionDone.push_back(newAction); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("id: %1, size: %2, name: %3, size2: %4").arg(item.id).arg(item.size).arg(item.source.absoluteFilePath()).arg(newAction.addAction.size).toStdString()); if(item.isRunning) { for(int_for_internal_loop=0; int_for_internal_loopgetStat()!=TransferStat_PreOperation) { Ultracopier::ReturnActionOnCopyList newAction; @@ -1139,7 +1142,7 @@ void ListThread::syncTransferList_internal() break; } newAction.addAction.id = item.id; - actionDone << newAction; + actionDone.push_back(newAction); } } } @@ -1147,7 +1150,7 @@ void ListThread::syncTransferList_internal() } //add file transfer to do -quint64 ListThread::addToTransfer(const QFileInfo& source,const QFileInfo& destination,const Ultracopier::CopyMode& mode) +uint64_t ListThread::addToTransfer(const QFileInfo& source,const QFileInfo& destination,const Ultracopier::CopyMode& mode) { if(stopIt) return 0; @@ -1156,20 +1159,20 @@ quint64 ListThread::addToTransfer(const QFileInfo& source,const QFileInfo& desti quint64 size=0; if(!source.isSymLink()) size=source.size(); - const QString &drive=driveManagement.getDrive(destination.absoluteFilePath()); - if(drive.isEmpty()) + const std::string &drive=driveManagement.getDrive(destination.absoluteFilePath().toStdString()); + if(drive.empty()) abort(); - if(mode!=Ultracopier::Move || drive!=driveManagement.getDrive(source.absoluteFilePath())) + if(mode!=Ultracopier::Move || drive!=driveManagement.getDrive(source.absoluteFilePath().toStdString())) { - if(requiredSpace.contains(drive)) + if(requiredSpace.find(drive)!=requiredSpace.cend()) { requiredSpace[drive]+=size; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("space needed add: %1, space needed: %2, on: %3").arg(size).arg(requiredSpace.value(drive)).arg(drive)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("space needed add: %1, space needed: %2, on: %3").arg(size).arg(requiredSpace.at(drive)).arg(QString::fromStdString(drive)).toStdString()); } else { requiredSpace[drive]=size; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("set space %1 needed, on: %2").arg(size).arg(drive)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("set space %1 needed, on: %2").arg(size).arg(QString::fromStdString(drive)).toStdString()); } } bytesToTransfer+= size; @@ -1180,13 +1183,13 @@ quint64 ListThread::addToTransfer(const QFileInfo& source,const QFileInfo& desti temp.destination= destination; temp.mode = mode; temp.isRunning = false; - actionToDoListTransfer << temp; + actionToDoListTransfer.push_back(temp); //push the new transfer to interface Ultracopier::ReturnActionOnCopyList newAction; newAction.type = Ultracopier::AddingItem; newAction.addAction=actionToDoTransferToItemOfCopyList(temp); - actionDone << newAction; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("source: %1, destination: %2, add entry: %3, size: %4, size2: %5, isSymLink: %6").arg(source.absoluteFilePath()).arg(destination.absoluteFilePath()).arg(temp.id).arg(temp.size).arg(size).arg(source.isSymLink())); + actionDone.push_back(newAction); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("source: %1, destination: %2, add entry: %3, size: %4, size2: %5, isSymLink: %6").arg(source.absoluteFilePath()).arg(destination.absoluteFilePath()).arg(temp.id).arg(temp.size).arg(size).arg(source.isSymLink()).toStdString()); return temp.id; } @@ -1194,17 +1197,17 @@ Ultracopier::ItemOfCopyList ListThread::actionToDoTransferToItemOfCopyList(const { Ultracopier::ItemOfCopyList itemOfCopyList; itemOfCopyList.id = actionToDoTransfer.id; - itemOfCopyList.sourceFullPath = actionToDoTransfer.source.absoluteFilePath(); - itemOfCopyList.sourceFileName = actionToDoTransfer.source.fileName(); - itemOfCopyList.destinationFullPath = actionToDoTransfer.destination.absoluteFilePath(); - itemOfCopyList.destinationFileName = actionToDoTransfer.destination.fileName(); + itemOfCopyList.sourceFullPath = actionToDoTransfer.source.absoluteFilePath().toStdString(); + itemOfCopyList.sourceFileName = actionToDoTransfer.source.fileName().toStdString(); + itemOfCopyList.destinationFullPath = actionToDoTransfer.destination.absoluteFilePath().toStdString(); + itemOfCopyList.destinationFileName = actionToDoTransfer.destination.fileName().toStdString(); itemOfCopyList.size = actionToDoTransfer.size; itemOfCopyList.mode = actionToDoTransfer.mode; return itemOfCopyList; } //generate id number -quint64 ListThread::generateIdNumber() +uint64_t ListThread::generateIdNumber() { idIncrementNumber++; if(idIncrementNumber>(((quint64)1024*1024)*1024*1024*2)) @@ -1213,14 +1216,14 @@ quint64 ListThread::generateIdNumber() } //warning the first entry is accessible will copy -void ListThread::removeItems(const QList &ids) +void ListThread::removeItems(const std::vector &ids) { - for(int i=0;i ids) +void ListThread::moveItemsOnTop(std::vector ids) { if(actionToDoListTransfer.size()<=1) { @@ -1230,21 +1233,22 @@ void ListThread::moveItemsOnTop(QList ids) ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); //do list operation int indexToMove=0; - const int &loop_size=actionToDoListTransfer.size(); - for (int i=0; i ids) } //move up -void ListThread::moveItemsUp(QList ids) +void ListThread::moveItemsUp(std::vector ids) { if(actionToDoListTransfer.size()<=1) { @@ -1264,25 +1268,27 @@ void ListThread::moveItemsUp(QList ids) //do list operation int lastGoodPositionReal=0; bool haveGoodPosition=false; - const int &loop_size=actionToDoListTransfer.size(); - for (int i=0; i ids) } //move down -void ListThread::moveItemsDown(QList ids) +void ListThread::moveItemsDown(std::vector ids) { if(actionToDoListTransfer.size()<=1) { @@ -1311,25 +1317,28 @@ void ListThread::moveItemsDown(QList ids) int lastGoodPositionReal=0; bool haveGoodPosition=false; for (int i=actionToDoListTransfer.size()-1; i>=0; --i) { - if(ids.contains(actionToDoListTransfer.at(i).id)) + if(vectorcontainsAtLeastOne(ids,actionToDoListTransfer.at(i).id)) { if(haveGoodPosition) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("move item ")+QString::number(i)+QStringLiteral(" to ")+QString::number(i+1)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"move item "+std::to_string(i)+" to "+std::to_string(i+1)); Ultracopier::ReturnActionOnCopyList newAction; newAction.type=Ultracopier::MoveItem; newAction.addAction.id=actionToDoListTransfer.at(i).id; newAction.userAction.moveAt=lastGoodPositionReal; newAction.userAction.position=i; - actionDone << newAction; - actionToDoListTransfer.swap(i,lastGoodPositionReal); + actionDone.push_back(newAction); + ActionToDoTransfer temp1=actionToDoListTransfer.at(i); + ActionToDoTransfer temp2=actionToDoListTransfer.at(lastGoodPositionReal); + actionToDoListTransfer[i]=temp2; + actionToDoListTransfer[lastGoodPositionReal]=temp1; } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Try move up false, item ")+QString::number(i)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Try move up false, item "+std::to_string(i)); } - ids.removeOne(actionToDoListTransfer.at(i).id); - if(ids.isEmpty()) + vectorremoveOne(ids,actionToDoListTransfer.at(i).id); + if(ids.empty()) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"stop with return"); return; @@ -1346,7 +1355,7 @@ void ListThread::moveItemsDown(QList ids) } //put on bottom -void ListThread::moveItemsOnBottom(QList ids) +void ListThread::moveItemsOnBottom(std::vector ids) { if(actionToDoListTransfer.size()<=1) { @@ -1357,20 +1366,22 @@ void ListThread::moveItemsOnBottom(QList ids) //do list operation int lastGoodPositionReal=actionToDoListTransfer.size()-1; for (int i=lastGoodPositionReal; i>=0; --i) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Check action on item ")+QString::number(i)); - if(ids.contains(actionToDoListTransfer.at(i).id)) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Check action on item "+std::to_string(i)); + if(vectorcontainsAtLeastOne(ids,actionToDoListTransfer.at(i).id)) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("move item ")+QString::number(i)+QStringLiteral(" to ")+QString::number(lastGoodPositionReal)); - ids.removeOne(actionToDoListTransfer.at(i).id); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"move item "+std::to_string(i)+" to "+std::to_string(lastGoodPositionReal)); + vectorremoveOne(ids,actionToDoListTransfer.at(i).id); Ultracopier::ReturnActionOnCopyList newAction; newAction.type=Ultracopier::MoveItem; newAction.addAction.id=actionToDoListTransfer.at(i).id; newAction.userAction.moveAt=lastGoodPositionReal; newAction.userAction.position=i; - actionDone << newAction; - actionToDoListTransfer.move(i,lastGoodPositionReal); + actionDone.push_back(newAction); + ActionToDoTransfer temp=actionToDoListTransfer.at(i); + actionToDoListTransfer.erase(actionToDoListTransfer.cbegin()+i); + actionToDoListTransfer.insert(actionToDoListTransfer.cbegin()+lastGoodPositionReal,temp); lastGoodPositionReal--; - if(ids.isEmpty()) + if(ids.empty()) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"stop with return"); return; @@ -1389,17 +1400,17 @@ void ListThread::forceMode(const Ultracopier::CopyMode &mode) setRsync(false); #endif if(mode==Ultracopier::Copy) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Force mode to copy")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Force mode to copy"); else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Force mode to move")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Force mode to move"); this->mode=mode; forcedMode=true; } -void ListThread::exportTransferList(const QString &fileName) +void ListThread::exportTransferList(const std::string &fileName) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); - QFile transferFile(fileName); + QFile transferFile(QString::fromStdString(fileName)); if(transferFile.open(QIODevice::WriteOnly|QIODevice::Truncate)) { transferFile.write(QStringLiteral("Ultracopier;Transfer-list;").toUtf8()); @@ -1443,38 +1454,38 @@ void ListThread::exportTransferList(const QString &fileName) } if(haveError) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Unable do to move or copy item into wrong forced mode: %1").arg(transferFile.errorString())); - emit errorTransferList(tr("Unable do to move or copy item into wrong forced mode: %1").arg(transferFile.errorString())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Unable do to move or copy item into wrong forced mode: %1").arg(transferFile.errorString()).toStdString()); + emit errorTransferList(tr("Unable do to move or copy item into wrong forced mode: %1").arg(transferFile.errorString()).toStdString()); } transferFile.close(); } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Unable to save the transfer list: %1").arg(transferFile.errorString())); - emit errorTransferList(tr("Unable to save the transfer list: %1").arg(transferFile.errorString())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Unable to save the transfer list: %1").arg(transferFile.errorString()).toStdString()); + emit errorTransferList(tr("Unable to save the transfer list: %1").arg(transferFile.errorString()).toStdString()); return; } } -void ListThread::importTransferList(const QString &fileName) +void ListThread::importTransferList(const std::string &fileName) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); - QFile transferFile(fileName); + QFile transferFile(QString::fromStdString(fileName)); if(transferFile.open(QIODevice::ReadOnly)) { - QString content; + std::string content; QByteArray data=transferFile.readLine(64); if(data.size()<=0) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Problem reading file, or file-size is 0")); - emit errorTransferList(tr("Problem reading file, or file-size is 0")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Problem reading file, or file-size is 0"); + emit errorTransferList(tr("Problem reading file, or file-size is 0").toStdString()); return; } - content=QString::fromUtf8(data); + content=QString::fromUtf8(data).toStdString(); if(content!="Ultracopier;Transfer-list;Transfer;Ultracopier\n" && content!="Ultracopier;Transfer-list;Copy;Ultracopier\n" && content!="Ultracopier;Transfer-list;Move;Ultracopier\n") { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Wrong header: \"%1\"").arg(content)); - emit errorTransferList(tr("Wrong header: \"%1\"").arg(content)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Wrong header: "+content); + emit errorTransferList(tr("Wrong header: \"%1\"").arg(QString::fromStdString(content)).toStdString()); return; } bool transferListMixedMode=false; @@ -1482,8 +1493,8 @@ void ListThread::importTransferList(const QString &fileName) { if(forcedMode) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("The transfer list is in mixed mode, but this instance is not")); - emit errorTransferList(tr("The transfer list is in mixed mode, but this instance is not in this mode")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"The transfer list is in mixed mode, but this instance is not"); + emit errorTransferList(tr("The transfer list is in mixed mode, but this instance is not in this mode").toStdString()); return; } else @@ -1491,14 +1502,14 @@ void ListThread::importTransferList(const QString &fileName) } if(content=="Ultracopier;Transfer-list;Copy;Ultracopier\n" && (forcedMode && mode==Ultracopier::Move)) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("The transfer list is in copy mode, but this instance is not: forcedMode: %1, mode: %2").arg(forcedMode).arg(mode)); - emit errorTransferList(tr("The transfer list is in copy mode, but this instance is not in this mode")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("The transfer list is in copy mode, but this instance is not: forcedMode: %1, mode: %2").arg(forcedMode).arg(mode).toStdString()); + emit errorTransferList(tr("The transfer list is in copy mode, but this instance is not in this mode").toStdString()); return; } if(content=="Ultracopier;Transfer-list;Move;Ultracopier\n" && (forcedMode && mode==Ultracopier::Copy)) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("The transfer list is in move mode, but this instance is not: forcedMode: %1, mode: %2").arg(forcedMode).arg(mode)); - emit errorTransferList(tr("The transfer list is in move mode, but this instance is not in this mode")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("The transfer list is in move mode, but this instance is not: forcedMode: %1, mode: %2").arg(forcedMode).arg(mode).toStdString()); + emit errorTransferList(tr("The transfer list is in move mode, but this instance is not in this mode").toStdString()); return; } @@ -1511,42 +1522,49 @@ void ListThread::importTransferList(const QString &fileName) emit actionInProgess(updateTheStatus_action_in_progress); bool errorFound=false; - QRegularExpression correctLine; + std::regex correctLine; if(transferListMixedMode) - correctLine=QRegularExpression(QStringLiteral("^(Copy|Move);[^;]+;[^;]+[\n\r]*$")); + correctLine=std::regex("^(Copy|Move);[^;]+;[^;]+[\n\r]*$"); else - correctLine=QRegularExpression(QStringLiteral("^[^;]+;[^;]+[\n\r]*$")); - QStringList args; + correctLine=std::regex("^[^;]+;[^;]+[\n\r]*$"); + std::vector args; Ultracopier::CopyMode tempMode; do { data=transferFile.readLine(65535*2); if(data.size()>0) { - content=QString::fromUtf8(data); + content=std::string(data.constData(),data.size()); //do the import here - if(content.contains(correctLine)) + if(std::regex_match(content,correctLine)) { - content.remove(QStringLiteral("\n")); - args=content.split(QStringLiteral(";")); + stringreplaceAll(content,"\n",""); + args=stringsplit(content,';'); if(forcedMode) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("New data to import in forced mode: %2,%3").arg(args.at(0)).arg(args.at(1))); - addToTransfer(QFileInfo(args.at(0)),QFileInfo(args.at(1)),mode); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("New data to import in forced mode: %2,%3") + .arg(QString::fromStdString(args.at(0))) + .arg(QString::fromStdString(args.at(1))) + .toStdString()); + addToTransfer(QFileInfo(QString::fromStdString(args.at(0))),QFileInfo(QString::fromStdString(args.at(1))),mode); } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("New data to import: %1,%2,%3").arg(args.at(0)).arg(args.at(1)).arg(args.at(2))); - if(args.at(0)==QStringLiteral("Copy")) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("New data to import: %1,%2,%3") + .arg(QString::fromStdString(args.at(0))) + .arg(QString::fromStdString(args.at(1))) + .arg(QString::fromStdString(args.at(2))) + .toStdString()); + if(args.at(0)=="Copy") tempMode=Ultracopier::Copy; else tempMode=Ultracopier::Move; - addToTransfer(QFileInfo(args.at(1)),QFileInfo(args.at(2)),tempMode); + addToTransfer(QFileInfo(QString::fromStdString(args.at(1))),QFileInfo(QString::fromStdString(args.at(2))),tempMode); } } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Wrong line syntax: %1").arg(content)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Wrong line syntax: "+content); errorFound=true; } } @@ -1554,15 +1572,15 @@ void ListThread::importTransferList(const QString &fileName) while(data.size()>0); transferFile.close(); if(errorFound) - emit warningTransferList(tr("Some errors have been found during the line parsing")); + emit warningTransferList(tr("Some errors have been found during the line parsing").toStdString()); updateTheStatus();//->sendActionDone(); into this autoStartAndCheckSpace(); } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Unable to open the transfer list: %1").arg(transferFile.errorString())); - emit errorTransferList(tr("Unable to open the transfer list: %1").arg(transferFile.errorString())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Unable to open the transfer list: %1").arg(transferFile.errorString()).toStdString()); + emit errorTransferList(tr("Unable to open the transfer list: %1").arg(transferFile.errorString()).toStdString()); return; } } @@ -1587,15 +1605,14 @@ bool ListThread::needMoreSpace() const { if(!checkDiskSpace) return false; - QList diskspace_list; - QHashIterator i(requiredSpace); - while (i.hasNext()) { - i.next(); + std::vector diskspace_list; + for( auto& spaceDrive : requiredSpace ) { + const QString &drive=QString::fromStdString(spaceDrive.first); #ifdef Q_OS_WIN32 - if(i.key()!="A:\\" && i.key()!="A:/" && i.key()!="A:" && i.key()!="A" && i.key()!="a:\\" && i.key()!="a:/" && i.key()!="a:" && i.key()!="a") + if(spaceDrive.first!="A:\\" && spaceDrive.first!="A:/" && spaceDrive.first!="A:" && spaceDrive.first!="A" && spaceDrive.first!="a:\\" && spaceDrive.first!="a:/" && spaceDrive.first!="a:" && spaceDrive.first!="a") { #endif - QStorageInfo storageInfo(i.key()); + QStorageInfo storageInfo(drive); storageInfo.refresh(); const qint64 &availableSpace=storageInfo.bytesAvailable(); #ifdef ULTRACOPIER_PLUGIN_DEBUG @@ -1607,40 +1624,40 @@ bool ListThread::needMoreSpace() const (availableSpace==0 && storageInfo.bytesTotal()==0) ) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("availableSpace: %1, space needed: %2, on: %3, bytesFree: %4").arg(availableSpace).arg(i.value()).arg(i.key()).arg(bytesFree)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("availableSpace: %1, space needed: %2, on: %3, bytesFree: %4").arg(availableSpace).arg(spaceDrive.second).arg(drive).arg(bytesFree).toStdString()); } - else if(i.value()>(quint64)availableSpace) + else if(spaceDrive.second>(quint64)availableSpace) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("availableSpace: %1, space needed: %2, on: %3, bytesFree: %4").arg(availableSpace).arg(i.value()).arg(i.key()).arg(bytesFree)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("availableSpace: %1, space needed: %2, on: %3, bytesFree: %4").arg(availableSpace).arg(spaceDrive.second).arg(drive).arg(bytesFree).toStdString()); #ifdef Q_OS_WIN32 - //if(i.key().contains(QRegularExpression("^[a-zA-Z]:[\\\\/]"))) - if(i.key().contains(QRegularExpression("^[a-zA-Z]:"))) + //if(drive.contains(QRegularExpression("^[a-zA-Z]:[\\\\/]"))) + if(drive.contains(QRegularExpression("^[a-zA-Z]:"))) #endif { Diskspace diskspace; - diskspace.drive=i.key(); + diskspace.drive=spaceDrive.first; diskspace.freeSpace=availableSpace; - diskspace.requiredSpace=i.value(); - diskspace_list << diskspace; + diskspace.requiredSpace=spaceDrive.second; + diskspace_list.push_back(diskspace); } #ifdef Q_OS_WIN32 else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("not local drive")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"not local drive"); #endif } #ifdef Q_OS_WIN32 } #endif } - if(!diskspace_list.isEmpty()) + if(!diskspace_list.empty()) emit missingDiskSpace(diskspace_list); - return ! diskspace_list.isEmpty(); + return ! diskspace_list.empty(); } //do new actions void ListThread::doNewActions_start_transfer() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("actionToDoListTransfer.size(): %1, numberOfTranferRuning: %2").arg(actionToDoListTransfer.size()).arg(getNumberOfTranferRuning())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("actionToDoListTransfer.size(): %1, numberOfTranferRuning: %2").arg(actionToDoListTransfer.size()).arg(getNumberOfTranferRuning()).toStdString()); if(stopIt || putInPause) return; int numberOfTranferRuning=getNumberOfTranferRuning(); @@ -1682,7 +1699,7 @@ void ListThread::doNewActions_start_transfer() } int_for_loop++; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("numberOfTranferRuning: ")+QString::number(numberOfTranferRuning)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"numberOfTranferRuning: "+std::to_string(numberOfTranferRuning)); } /** \brief lunch the pre-op or inode op @@ -1694,7 +1711,7 @@ void ListThread::doNewActions_start_transfer() void ListThread::doNewActions_inode_manipulation() { #ifdef ULTRACOPIER_PLUGIN_DEBUG_SCHEDULER - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("actionToDoList.size(): %1").arg(actionToDoListTransfer.size())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"actionToDoList.size(): "+std::to_string(actionToDoListTransfer.size())); #endif if(stopIt) checkIfReadyToCancel(); @@ -1746,11 +1763,11 @@ void ListThread::doNewActions_inode_manipulation() currentTransferThread=transferThreadList.at(int_for_transfer_thread_search); if(currentTransferThread->getStat()==TransferStat_Idle && currentTransferThread->transferId==0) // /!\ important! { - QString drive=driveManagement.getDrive(actionToDoListTransfer.at(int_for_internal_loop).destination.absoluteFilePath()); - if(requiredSpace.contains(drive) && (actionToDoListTransfer.at(int_for_internal_loop).mode!=Ultracopier::Move || drive!=driveManagement.getDrive(actionToDoListTransfer.at(int_for_internal_loop).source.absoluteFilePath()))) + std::string drive=driveManagement.getDrive(actionToDoListTransfer.at(int_for_internal_loop).destination.absoluteFilePath().toStdString()); + if(requiredSpace.find(drive)!=requiredSpace.cend() && (actionToDoListTransfer.at(int_for_internal_loop).mode!=Ultracopier::Move || drive!=driveManagement.getDrive(actionToDoListTransfer.at(int_for_internal_loop).source.absoluteFilePath().toStdString()))) { requiredSpace[drive]-=actionToDoListTransfer.at(int_for_internal_loop).size; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("space needed removed: %1, space needed: %2, on: %3").arg(actionToDoListTransfer.at(int_for_internal_loop).size).arg(requiredSpace.value(drive)).arg(drive)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("space needed removed: %1, space needed: %2, on: %3").arg(actionToDoListTransfer.at(int_for_internal_loop).size).arg(requiredSpace.at(drive)).arg(QString::fromStdString(drive)).toStdString()); } currentTransferThread->transferId=currentActionToDoTransfer.id; currentTransferThread->transferSize=currentActionToDoTransfer.size; @@ -1761,28 +1778,28 @@ void ListThread::doNewActions_inode_manipulation() currentActionToDoTransfer.mode )) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[%1] id: %2 is idle, but seam busy at set name: %3").arg(int_for_loop).arg(currentTransferThread->transferId).arg(currentActionToDoTransfer.destination.absoluteFilePath())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[%1] id: %2 is idle, but seam busy at set name: %3").arg(int_for_loop).arg(currentTransferThread->transferId).arg(currentActionToDoTransfer.destination.absoluteFilePath()).toStdString()); break; } currentActionToDoTransfer.isRunning=true; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[%1] id: %2 is idle, use it for %3").arg(int_for_loop).arg(currentTransferThread->transferId).arg(currentActionToDoTransfer.destination.absoluteFilePath())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[%1] id: %2 is idle, use it for %3").arg(int_for_loop).arg(currentTransferThread->transferId).arg(currentActionToDoTransfer.destination.absoluteFilePath()).toStdString()); /// \note wrong position? Else write why it's here Ultracopier::ReturnActionOnCopyList newAction; newAction.type = Ultracopier::PreOperation; newAction.addAction.id = currentActionToDoTransfer.id; - newAction.addAction.sourceFullPath = currentActionToDoTransfer.source.absoluteFilePath(); - newAction.addAction.sourceFileName = currentActionToDoTransfer.source.fileName(); - newAction.addAction.destinationFullPath = currentActionToDoTransfer.destination.absoluteFilePath(); - newAction.addAction.destinationFileName = currentActionToDoTransfer.destination.fileName(); + newAction.addAction.sourceFullPath = currentActionToDoTransfer.source.absoluteFilePath().toStdString(); + newAction.addAction.sourceFileName = currentActionToDoTransfer.source.fileName().toStdString(); + newAction.addAction.destinationFullPath = currentActionToDoTransfer.destination.absoluteFilePath().toStdString(); + newAction.addAction.destinationFileName = currentActionToDoTransfer.destination.fileName().toStdString(); newAction.addAction.size = currentActionToDoTransfer.size; newAction.addAction.mode = currentActionToDoTransfer.mode; - actionDone << newAction; + actionDone.push_back(newAction); int_for_transfer_thread_search++; numberOfInodeOperation++; #ifdef ULTRACOPIER_PLUGIN_DEBUG_SCHEDULER - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("numberOfInodeOperation: %1").arg(numberOfInodeOperation)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"numberOfInodeOperation: "+std::to_string(numberOfInodeOperation)); #endif break; } @@ -1797,7 +1814,7 @@ void ListThread::doNewActions_inode_manipulation() break; } #ifdef ULTRACOPIER_PLUGIN_DEBUG_SCHEDULER - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("numberOfInodeOperation: %1").arg(numberOfInodeOperation)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"numberOfInodeOperation: "+std::to_string(numberOfInodeOperation)); #endif if(numberOfInodeOperation>=inodeThreads) break; @@ -1820,7 +1837,7 @@ void ListThread::doNewActions_inode_manipulation() //error checking if(actionToDoListInode_count>inodeThreads) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("The index have been detected as out of max range: %1>%2").arg(actionToDoListInode_count).arg(inodeThreads)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("The index have been detected as out of max range: %1>%2").arg(actionToDoListInode_count).arg(inodeThreads).toStdString()); return; } } @@ -1832,7 +1849,7 @@ void ListThread::restartTransferIfItCan() TransferThread *transfer=qobject_cast(QObject::sender()); if(transfer==NULL) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("transfer thread not located!")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"transfer thread not located!"); return; } int numberOfTranferRuning=getNumberOfTranferRuning(); @@ -1844,7 +1861,7 @@ void ListThread::restartTransferIfItCan() /// \brief update the transfer stat void ListThread::newTransferStat(const TransferStat &stat,const quint64 &id) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("TransferStat: %1").arg(stat)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"TransferStat: "+std::to_string(stat)); Ultracopier::ReturnActionOnCopyList newAction; switch(stat) { @@ -1872,7 +1889,7 @@ void ListThread::newTransferStat(const TransferStat &stat,const quint64 &id) break; } newAction.addAction.id = id; - actionDone << newAction; + actionDone.push_back(newAction); } void ListThread::set_osBufferLimit(const unsigned int &osBufferLimit) @@ -1887,12 +1904,12 @@ void ListThread::set_osBufferLimit(const unsigned int &osBufferLimit) } } -void ListThread::set_setFilters(const QList &include,const QList &exclude) +void ListThread::set_setFilters(const std::vector &include,const std::vector &exclude) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("include.size(): %1, exclude.size(): %2").arg(include.size()).arg(exclude.size())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("include.size(): %1, exclude.size(): %2").arg(include.size()).arg(exclude.size()).toStdString()); this->include=include; this->exclude=exclude; - int index=0; + unsigned int index=0; while(indexsetFilters(include,exclude); @@ -1900,7 +1917,7 @@ void ListThread::set_setFilters(const QList &include,const QList< } } -void ListThread::set_sendNewRenamingRules(const QString &firstRenamingRule,const QString &otherRenamingRule) +void ListThread::set_sendNewRenamingRules(const std::string &firstRenamingRule,const std::string &otherRenamingRule) { this->firstRenamingRule=firstRenamingRule; this->otherRenamingRule=otherRenamingRule; @@ -1924,15 +1941,15 @@ void ListThread::mkPathFirstFolderFinish() if(actionToDoListInode.at(int_for_loop).type==ActionType_MkPath) { //to send to the log - emit mkPath(actionToDoListInode.at(int_for_loop).destination.absoluteFilePath()); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("stop mkpath: %1").arg(actionToDoListInode.at(int_for_loop).destination.absoluteFilePath())); - actionToDoListInode.removeAt(int_for_loop); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("actionToDoListTransfer.size(): %1, actionToDoListInode: %2, actionToDoListInode_afterTheTransfer: %3").arg(actionToDoListTransfer.size()).arg(actionToDoListInode.size()).arg(actionToDoListInode_afterTheTransfer.size())); - if(actionToDoListTransfer.isEmpty() && actionToDoListInode.isEmpty() && actionToDoListInode_afterTheTransfer.isEmpty()) + emit mkPath(actionToDoListInode.at(int_for_loop).destination.absoluteFilePath().toStdString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("stop mkpath: %1").arg(actionToDoListInode.at(int_for_loop).destination.absoluteFilePath()).toStdString()); + actionToDoListInode.erase(actionToDoListInode.cbegin()+int_for_loop); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("actionToDoListTransfer.size(): %1, actionToDoListInode: %2, actionToDoListInode_afterTheTransfer: %3").arg(actionToDoListTransfer.size()).arg(actionToDoListInode.size()).arg(actionToDoListInode_afterTheTransfer.size()).toStdString()); + if(actionToDoListTransfer.empty() && actionToDoListInode.empty() && actionToDoListInode_afterTheTransfer.empty()) updateTheStatus(); numberOfInodeOperation--; #ifdef ULTRACOPIER_PLUGIN_DEBUG_SCHEDULER - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("numberOfInodeOperation: %1").arg(numberOfInodeOperation)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"numberOfInodeOperation: "+std::to_string(numberOfInodeOperation)); #endif doNewActions_inode_manipulation(); return; @@ -1946,19 +1963,19 @@ void ListThread::mkPathFirstFolderFinish() //to send to the log #ifdef ULTRACOPIER_PLUGIN_RSYNC if(actionToDoListInode.at(int_for_loop).type!=ActionType_RmSync) - emit mkPath(actionToDoListInode.at(int_for_loop).destination.absoluteFilePath()); + emit mkPath(actionToDoListInode.at(int_for_loop).destination.absoluteFilePath().toStdString()); #else - emit mkPath(actionToDoListInode.at(int_for_loop).destination.absoluteFilePath()); + emit mkPath(actionToDoListInode.at(int_for_loop).destination.absoluteFilePath().toStdString()); #endif - emit rmPath(actionToDoListInode.at(int_for_loop).source.absoluteFilePath()); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("stop mkpath: %1").arg(actionToDoListInode.at(int_for_loop).destination.absoluteFilePath())); - actionToDoListInode.removeAt(int_for_loop); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("actionToDoListTransfer.size(): %1, actionToDoListInode: %2, actionToDoListInode_afterTheTransfer: %3").arg(actionToDoListTransfer.size()).arg(actionToDoListInode.size()).arg(actionToDoListInode_afterTheTransfer.size())); - if(actionToDoListTransfer.isEmpty() && actionToDoListInode.isEmpty() && actionToDoListInode_afterTheTransfer.isEmpty()) + emit rmPath(actionToDoListInode.at(int_for_loop).source.absoluteFilePath().toStdString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("stop mkpath: %1").arg(actionToDoListInode.at(int_for_loop).destination.absoluteFilePath()).toStdString()); + actionToDoListInode.erase(actionToDoListInode.cbegin()+int_for_loop); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("actionToDoListTransfer.size(): %1, actionToDoListInode: %2, actionToDoListInode_afterTheTransfer: %3").arg(actionToDoListTransfer.size()).arg(actionToDoListInode.size()).arg(actionToDoListInode_afterTheTransfer.size()).toStdString()); + if(actionToDoListTransfer.empty() && actionToDoListInode.empty() && actionToDoListInode_afterTheTransfer.empty()) updateTheStatus(); numberOfInodeOperation--; #ifdef ULTRACOPIER_PLUGIN_DEBUG_SCHEDULER - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("numberOfInodeOperation: %1").arg(numberOfInodeOperation)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"numberOfInodeOperation: "+std::to_string(numberOfInodeOperation)); #endif doNewActions_inode_manipulation(); return; @@ -1974,7 +1991,7 @@ void ListThread::mkPathFirstFolderFinish() void ListThread::timedUpdateDebugDialog() { - QStringList newList; + std::vector newList; int index=0; int loop_sub_size_transfer_thread_search=transferThreadList.size(); while(indexgetStat()); break; } - newList << QStringLiteral("%1) (%3,%4) %2") + newList.push_back(QStringLiteral("%1) (%3,%4) %2") .arg(index) .arg(stat) .arg(transferThreadList.at(index)->readingLetter()) - .arg(transferThreadList.at(index)->writingLetter()); + .arg(transferThreadList.at(index)->writingLetter()) + .toStdString() + ); index++; } - QStringList newList2; + std::vector newList2; index=0; const int &loop_size=actionToDoListTransfer.size(); while(index((inodeThreads+ULTRACOPIER_PLUGIN_MAXPARALLELTRANFER)*2+1)) { - newList2 << QStringLiteral("..."); + newList2.push_back("..."); break; } index++; @@ -2042,7 +2063,7 @@ void ListThread::fileAlreadyExists(const QFileInfo &source,const QFileInfo &dest } /// \note Can be call without queue because all call will be serialized -void ListThread::errorOnFile(const QFileInfo &fileInfo, const QString &errorString, const ErrorType &errorType) +void ListThread::errorOnFile(const QFileInfo &fileInfo, const std::string &errorString, const ErrorType &errorType) { TransferThread * transferThread=qobject_cast(sender()); if(transferThread==NULL) @@ -2055,7 +2076,7 @@ void ListThread::errorOnFile(const QFileInfo &fileInfo, const QString &errorStri errorLogEntry.destination=transferThread->getDestinationInode(); errorLogEntry.mode=transferThread->getMode(); errorLogEntry.error=errorString; - errorLog << errorLogEntry; + errorLog.push_back(errorLogEntry); emit errorToRetry(transferThread->getSourcePath(),transferThread->getDestinationPath(),errorString); emit send_errorOnFile(fileInfo,errorString,transferThread,errorType); } @@ -2068,7 +2089,7 @@ void ListThread::folderAlreadyExists(const QFileInfo &source,const QFileInfo &de /// \note Can be call without queue because all call will be serialized /// \todo all this part -void ListThread::errorOnFolder(const QFileInfo &fileInfo,const QString &errorString,const ErrorType &errorType) +void ListThread::errorOnFolder(const QFileInfo &fileInfo,const std::string &errorString,const ErrorType &errorType) { emit send_errorOnFolder(fileInfo,errorString,qobject_cast(sender()),errorType); } @@ -2083,7 +2104,7 @@ void ListThread::run() exec(); } -void ListThread::getNeedPutAtBottom(const QFileInfo &fileInfo, const QString &errorString, TransferThread *thread, const ErrorType &errorType) +void ListThread::getNeedPutAtBottom(const QFileInfo &fileInfo, const std::string &errorString, TransferThread *thread, const ErrorType &errorType) { if(actionToDoListTransfer.empty()) { @@ -2115,25 +2136,25 @@ void ListThread::createTransferThread() { if(stopIt) return; - if(transferThreadList.size()>=inodeThreads) + if(transferThreadList.size()>=(unsigned int)inodeThreads) return; - transferThreadList << new TransferThread(); - TransferThread * last=transferThreadList.last(); + transferThreadList.push_back(new TransferThread()); + TransferThread * last=transferThreadList.back(); last->transferId=0; last->transferSize=0; last->setRightTransfer(doRightTransfer); last->setKeepDate(keepDate); #ifdef ULTRACOPIER_PLUGIN_SPEED_SUPPORT if(!last->setBlockSize(blockSizeAfterSpeedLimitation)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("unable to set the block size: ")+QString::number(blockSizeAfterSpeedLimitation)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to set the block size: "+std::to_string(blockSizeAfterSpeedLimitation)); #else if(!last->setBlockSize(blockSize)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("unable to set the block size: ")+QString::number(blockSize)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to set the block size: "+std::to_string(blockSize)); #endif if(!last->setSequentialBuffer(sequentialBuffer)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("unable to set the sequentialBuffer: ")+QString::number(sequentialBuffer)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to set the sequentialBuffer: "+std::to_string(sequentialBuffer)); if(!last->setBlockSize(parallelBuffer)) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("unable to set the parallelBuffer: ")+QString::number(parallelBuffer)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to set the parallelBuffer: "+std::to_string(parallelBuffer)); last->setAlwaysFileExistsAction(alwaysDoThisActionForFileExists); #ifdef ULTRACOPIER_PLUGIN_SPEED_SUPPORT last->setMultiForBigSpeed(multiForBigSpeed); @@ -2180,9 +2201,9 @@ void ListThread::createTransferThread() #ifdef ULTRACOPIER_PLUGIN_DEBUG last->setId(transferThreadList.size()-1); #endif - if(transferThreadList.size()>=inodeThreads) + if(transferThreadList.size()>=(unsigned int)inodeThreads) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("create the last of the ")+QString::number(inodeThreads)+QStringLiteral(" transferThread")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"create the last of the "+std::to_string(inodeThreads)+" transferThread"); return; } if(stopIt) @@ -2204,25 +2225,25 @@ void ListThread::deleteTransferThread() transferThreadList.at(index)->stop(); delete transferThreadList.at(index);//->deleteLayer(); transferThreadList[index]=NULL; - transferThreadList.removeAt(index); + transferThreadList.erase(transferThreadList.cbegin()+index); loop_size--; } else index++; } if(loop_size==inodeThreads) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("inodeThreads is lowered to the right value: ")+QString::number(inodeThreads)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"inodeThreads is lowered to the right value: "+std::to_string(inodeThreads)); } } void ListThread::setTransferAlgorithm(const TransferAlgorithm &transferAlgorithm) { if(transferAlgorithm==TransferAlgorithm_Sequential) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("transferAlgorithm==TransferAlgorithm_Sequential")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"transferAlgorithm==TransferAlgorithm_Sequential"); else if(transferAlgorithm==TransferAlgorithm_Automatic) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("transferAlgorithm==TransferAlgorithm_Automatic")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"transferAlgorithm==TransferAlgorithm_Automatic"); else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("transferAlgorithm==TransferAlgorithm_Parallel")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"transferAlgorithm==TransferAlgorithm_Parallel"); emit send_setTransferAlgorithm(transferAlgorithm); } @@ -2230,10 +2251,10 @@ void ListThread::setParallelBuffer(int parallelBuffer) { if(parallelBuffer<1 || parallelBuffer>ULTRACOPIER_PLUGIN_MAX_PARALLEL_NUMBER_OF_BLOCK) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("wrong number of block: ")+QString::number(parallelBuffer)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"wrong number of block: "+std::to_string(parallelBuffer)); return; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("in number of block: ")+QString::number(parallelBuffer)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"in number of block: "+std::to_string(parallelBuffer)); this->parallelBuffer=parallelBuffer; emit send_parallelBuffer(parallelBuffer); } @@ -2242,23 +2263,23 @@ void ListThread::setSequentialBuffer(int sequentialBuffer) { if(sequentialBuffer<1 || sequentialBuffer>ULTRACOPIER_PLUGIN_MAX_SEQUENTIAL_NUMBER_OF_BLOCK) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("wrong number of block: ")+QString::number(sequentialBuffer)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"wrong number of block: "+std::to_string(sequentialBuffer)); return; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("in number of block: ")+QString::number(sequentialBuffer)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"in number of block: "+std::to_string(sequentialBuffer)); this->sequentialBuffer=sequentialBuffer; emit send_sequentialBuffer(sequentialBuffer); } void ListThread::setParallelizeIfSmallerThan(const unsigned int ¶llelizeIfSmallerThan) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("parallelizeIfSmallerThan in Bytes: ")+QString::number(parallelizeIfSmallerThan)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"parallelizeIfSmallerThan in Bytes: "+std::to_string(parallelizeIfSmallerThan)); this->parallelizeIfSmallerThan=parallelizeIfSmallerThan; } void ListThread::setMoveTheWholeFolder(const bool &moveTheWholeFolder) { - for(int i=0;isetMoveTheWholeFolder(moveTheWholeFolder); this->moveTheWholeFolder=moveTheWholeFolder; } @@ -2284,10 +2305,10 @@ void ListThread::setInodeThreads(const int &inodeThreads) { if(inodeThreads<1 || inodeThreads>32) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("inodeThreads is out of ranges: ")+QString::number(inodeThreads)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"inodeThreads is out of ranges: "+std::to_string(inodeThreads)); return; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("inodeThreads: ")+QString::number(inodeThreads)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"inodeThreads: "+std::to_string(inodeThreads)); this->inodeThreads=inodeThreads; createTransferThread(); deleteTransferThread(); @@ -2295,7 +2316,7 @@ void ListThread::setInodeThreads(const int &inodeThreads) void ListThread::setRenameTheOriginalDestination(const bool &renameTheOriginalDestination) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("renameTheOriginalDestination: ")+QString::number(renameTheOriginalDestination)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"renameTheOriginalDestination: "+std::to_string(renameTheOriginalDestination)); this->renameTheOriginalDestination=renameTheOriginalDestination; int index=0; int loop_sub_size_transfer_thread_search=transferThreadList.size(); @@ -2314,14 +2335,14 @@ void ListThread::setCheckDiskSpace(const bool &checkDiskSpace) void ListThread::setCopyListOrder(const bool &order) { this->copyListOrder=order; - for(int i=0;isetCopyListOrder(this->copyListOrder); } -void ListThread::exportErrorIntoTransferList(const QString &fileName) +void ListThread::exportErrorIntoTransferList(const std::string &fileName) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); - QFile transferFile(fileName); + QFile transferFile(QString::fromStdString(fileName)); if(transferFile.open(QIODevice::WriteOnly|QIODevice::Truncate)) { transferFile.write(QStringLiteral("Ultracopier;Transfer-list;").toUtf8()); @@ -2365,15 +2386,15 @@ void ListThread::exportErrorIntoTransferList(const QString &fileName) } if(haveError) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Unable do to move or copy item into wrong forced mode: %1").arg(transferFile.errorString())); - emit errorTransferList(tr("Unable do to move or copy item into wrong forced mode: %1").arg(transferFile.errorString())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable do to move or copy item into wrong forced mode: "+transferFile.errorString().toStdString()); + emit errorTransferList(tr("Unable do to move or copy item into wrong forced mode: %1").arg(transferFile.errorString()).toStdString()); } transferFile.close(); } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Unable to save the transfer list: %1").arg(transferFile.errorString())); - emit errorTransferList(tr("Unable to save the transfer list: %1").arg(transferFile.errorString())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to save the transfer list: "+transferFile.errorString().toStdString()); + emit errorTransferList(tr("Unable to save the transfer list: %1").arg(transferFile.errorString()).toStdString()); return; } } diff --git a/plugins/CopyEngine/Ultracopier/ListThread.h b/plugins/CopyEngine/Ultracopier/ListThread.h index a778604..48e7142 100644 --- a/plugins/CopyEngine/Ultracopier/ListThread.h +++ b/plugins/CopyEngine/Ultracopier/ListThread.h @@ -8,8 +8,9 @@ #include #include -#include -#include +#include +#include +#include #include #include #include @@ -35,24 +36,24 @@ public: /** \brief compare the current sources of the copy, with the passed arguments * \param sources the sources list to compares with the current sources list * \return true if have same sources, else false (or empty) */ - bool haveSameSource(const QStringList &sources); + bool haveSameSource(const std::vector &sources); /** \brief compare the current destination of the copy, with the passed arguments * \param destination the destination to compares with the current destination * \return true if have same destination, else false (or empty) */ - bool haveSameDestination(const QString &destination); + bool haveSameDestination(const std::string &destination); /// \return empty if multiple or no destination - QString getUniqueDestinationFolder() const; + std::string getUniqueDestinationFolder() const; //external soft like file browser have send copy/move list to do /** \brief send copy with destination * \param sources the sources list to copy * \param destination the destination to copy * \return true if the copy have been accepted */ - bool newCopy(const QStringList &sources,const QString &destination); + bool newCopy(const std::vector &sources,const std::string &destination); /** \brief send move without destination, ask the destination * \param sources the sources list to move * \param destination the destination to move * \return true if the move have been accepted */ - bool newMove(const QStringList &sources,const QString &destination); + bool newMove(const std::vector &sources,const std::string &destination); /** \brief to set drives detected * specific to this copy engine */ /// \brief to set the collision action @@ -63,41 +64,41 @@ public: /// \brief to store one action to do struct ActionToDoTransfer { - quint64 id; - qint64 size;///< Used to set: used in case of transfer or remainingInode for drop folder + uint64_t id; + uint64_t size;///< Used to set: used in case of transfer or remainingInode for drop folder QFileInfo source;///< Used to set: source for transfer, folder to create, folder to drop QFileInfo destination; Ultracopier::CopyMode mode; bool isRunning;///< store if the action si running //TransferThread * transfer; // -> see transferThreadList }; - QList actionToDoListTransfer; + std::vector actionToDoListTransfer; /// \brief to store one action to do struct ActionToDoInode { ActionType type;///< \see ActionType - quint64 id; - qint64 size;///< Used to set: used in case of transfer or remainingInode for drop folder + uint64_t id; + int64_t size;///< Used to set: used in case of transfer or remainingInode for drop folder QFileInfo source;///< Keep to copy the right/date, to remove (for move) QFileInfo destination;///< Used to set: folder to create, folder to drop bool isRunning;///< store if the action si running }; - QList actionToDoListInode; - QList actionToDoListInode_afterTheTransfer; + std::vector actionToDoListInode; + std::vector actionToDoListInode_afterTheTransfer; int numberOfInodeOperation; struct ErrorLogEntry { QFileInfo source; QFileInfo destination; - QString error; + std::string error; Ultracopier::CopyMode mode; }; - QList errorLog; + std::vector errorLog; //dir operation thread queue MkPath mkPathQueue; //to get the return value from copyEngine bool getReturnBoolToCopyEngine() const; - QPair getReturnPairQuint64ToCopyEngine() const; + std::pair getReturnPairQuint64ToCopyEngine() const; Ultracopier::ItemOfCopyList getReturnItemOfCopyListToCopyEngine() const; void set_doChecksum(bool doChecksum); @@ -114,41 +115,41 @@ public slots: void resume(); /** \brief skip one transfer entry * \param id id of the file to remove */ - void skip(const quint64 &id); + void skip(const uint64_t &id); /** \brief skip as interanl one transfer entry * \param id id of the file to remove */ - bool skipInternal(const quint64 &id); + bool skipInternal(const uint64_t &id); /// \brief cancel all the transfer void cancel(); //edit the transfer list /** \brief remove the selected item * \param ids ids is the id list of the selected items */ - void removeItems(const QList &ids); + void removeItems(const std::vector &ids); /** \brief move on top of the list the selected item * \param ids ids is the id list of the selected items */ - void moveItemsOnTop(QList ids); + void moveItemsOnTop(std::vector ids); /** \brief move up the list the selected item * \param ids ids is the id list of the selected items */ - void moveItemsUp(QList ids); + void moveItemsUp(std::vector ids); /** \brief move down the list the selected item * \param ids ids is the id list of the selected items */ - void moveItemsDown(QList ids); + void moveItemsDown(std::vector ids); /** \brief move on bottom of the list the selected item * \param ids ids is the id list of the selected items */ - void moveItemsOnBottom(QList ids); + void moveItemsOnBottom(std::vector ids); /** \brief give the forced mode, to export/import transfer list */ void forceMode(const Ultracopier::CopyMode &mode); /// \brief export the transfer list into a file - void exportTransferList(const QString &fileName); + void exportTransferList(const std::string &fileName); /// \brief import the transfer list into a file - void importTransferList(const QString &fileName); + void importTransferList(const std::string &fileName); /// \brief set the folder local collision void setFolderCollision(const FolderExistsAction &alwaysDoThisActionForFolderExists); /** \brief to set the speed limitation * -1 if not able, 0 if disabled */ - bool setSpeedLimitation(const qint64 &speedLimitation); + bool setSpeedLimitation(const int64_t &speedLimitation); /// \brief set the copy info and options before runing void setRightTransfer(const bool doRightTransfer); /// \brief set keep date @@ -176,14 +177,14 @@ public slots: void doNewActions_inode_manipulation(); /// \brief restart transfer if it can void restartTransferIfItCan(); - void getNeedPutAtBottom(const QFileInfo &fileInfo, const QString &errorString, TransferThread *thread,const ErrorType &errorType); + void getNeedPutAtBottom(const QFileInfo &fileInfo, const std::string &errorString, TransferThread *thread,const ErrorType &errorType); /// \brief update the transfer stat void newTransferStat(const TransferStat &stat,const quint64 &id); void set_osBufferLimit(const unsigned int &osBufferLimit); - void set_setFilters(const QList &include,const QList &exclude); - void set_sendNewRenamingRules(const QString &firstRenamingRule,const QString &otherRenamingRule); + void set_setFilters(const std::vector &include,const std::vector &exclude); + void set_sendNewRenamingRules(const std::string &firstRenamingRule,const std::string &otherRenamingRule); void set_updateMount(); //send action done @@ -202,32 +203,32 @@ public slots: void setRenameTheOriginalDestination(const bool &renameTheOriginalDestination); void setCheckDiskSpace(const bool &checkDiskSpace); void setCopyListOrder(const bool &order); - void exportErrorIntoTransferList(const QString &fileName); + void exportErrorIntoTransferList(const std::string &fileName); private: QSemaphore mkpathTransfer; - QString sourceDrive; + std::string sourceDrive; bool sourceDriveMultiple; - QString destinationDrive; - QString destinationFolder; + std::string destinationDrive; + std::string destinationFolder; bool destinationDriveMultiple; bool destinationFolderMultiple; DriveManagement driveManagement; bool stopIt; - QList scanFileOrFolderThreadsPool; + std::vector scanFileOrFolderThreadsPool; int numberOfTransferIntoToDoList; - QList transferThreadList; + std::vector transferThreadList; ScanFileOrFolder * newScanThread(Ultracopier::CopyMode mode); - quint64 bytesToTransfer; - quint64 bytesTransfered; + uint64_t bytesToTransfer; + uint64_t bytesTransfered; bool autoStart; #ifdef ULTRACOPIER_PLUGIN_RSYNC bool rsync; #endif bool putInPause; - QList actionDone;///< to action to send to the interface - quint64 idIncrementNumber;///< to store the last id returned - qint64 actualRealByteTransfered; + std::vector actionDone;///< to action to send to the interface + uint64_t idIncrementNumber;///< to store the last id returned + int64_t actualRealByteTransfered; int maxSpeed;///< in KB/s, assume as 0KB/s as default like every where FolderExistsAction alwaysDoThisActionForFolderExists; bool checkDestinationFolderExists; @@ -246,15 +247,15 @@ private: bool renameTheOriginalDestination; bool checkDiskSpace; bool copyListOrder; - QHash requiredSpace; - QList > timeToTransfer; + std::unordered_map requiredSpace; + std::vector > timeToTransfer; unsigned int putAtBottom; unsigned int osBufferLimit; - QList include,exclude; + std::vector include,exclude; Ultracopier::CopyMode mode; bool forcedMode; - QString firstRenamingRule; - QString otherRenamingRule; + std::string firstRenamingRule; + std::string otherRenamingRule; #ifdef ULTRACOPIER_PLUGIN_SPEED_SUPPORT int multiForBigSpeed; #endif @@ -267,34 +268,34 @@ private: inline static Ultracopier::ItemOfCopyList actionToDoTransferToItemOfCopyList(const ActionToDoTransfer &actionToDoTransfer); //add file transfer to do - quint64 addToTransfer(const QFileInfo& source,const QFileInfo& destination,const Ultracopier::CopyMode& mode); + uint64_t addToTransfer(const QFileInfo& source,const QFileInfo& destination,const Ultracopier::CopyMode& mode); //generate id number - quint64 generateIdNumber(); + uint64_t generateIdNumber(); //warning the first entry is accessible will copy - bool removeSingleItem(const quint64 &id); + bool removeSingleItem(const uint64_t &id); //put on top - bool moveOnTopItem(const quint64 &id); + bool moveOnTopItem(const uint64_t &id); //move up - bool moveUpItem(const quint64 &id); + bool moveUpItem(const uint64_t &id); //move down - bool moveDownItem(const quint64 &id); + bool moveDownItem(const uint64_t &id); //put on bottom - bool moveOnBottomItem(const quint64 &id); + bool moveOnBottomItem(const uint64_t &id); //general transfer void startGeneralTransfer(); //debug windows if needed #ifdef ULTRACOPIER_PLUGIN_DEBUG_WINDOW QTimer timerUpdateDebugDialog; #endif - void detectDrivesOfCurrentTransfer(const QStringList &sources,const QString &destination); + void detectDrivesOfCurrentTransfer(const std::vector &sources,const std::string &destination); FacilityInterface * facilityInterface; QSemaphore waitConstructor,waitCancel; int actionToDoListTransfer_count,actionToDoListInode_count; bool doTransfer,doInode; - qint64 oversize;//used as temp variable - qint64 currentProgression; - qint64 copiedSize,totalSize,localOverSize; - QList progressionList; + int64_t oversize;//used as temp variable + int64_t currentProgression; + int64_t copiedSize,totalSize,localOverSize; + std::vector progressionList; //memory variable for transfer thread creation bool doRightTransfer; bool keepDate; @@ -302,12 +303,12 @@ private: #ifdef ULTRACOPIER_PLUGIN_SPEED_SUPPORT int blockSizeAfterSpeedLimitation;//in Bytes #endif - QStringList drives; + std::vector drives; FileExistsAction alwaysDoThisActionForFileExists; //to return value to the copyEngine bool returnBoolToCopyEngine; - QPair returnPairQuint64ToCopyEngine; - QList returnListItemOfCopyListToCopyEngine; + std::pair returnPairQuint64ToCopyEngine; + std::vector returnListItemOfCopyListToCopyEngine; Ultracopier::ItemOfCopyList returnItemOfCopyListToCopyEngine; Ultracopier::ProgressionItem tempItem; @@ -335,18 +336,18 @@ private slots: /// \note Can be call without queue because all call will be serialized void fileAlreadyExists(const QFileInfo &source,const QFileInfo &destination,const bool &isSame); /// \note Can be call without queue because all call will be serialized - void errorOnFile(const QFileInfo &fileInfo,const QString &errorString, const ErrorType &errorType); + void errorOnFile(const QFileInfo &fileInfo,const std::string &errorString, const ErrorType &errorType); /// \note Can be call without queue because all call will be serialized void folderAlreadyExists(const QFileInfo &source,const QFileInfo &destination,const bool &isSame); /// \note Can be call without queue because all call will be serialized - void errorOnFolder(const QFileInfo &fileInfo, const QString &errorString, const ErrorType &errorType); + void errorOnFolder(const QFileInfo &fileInfo, const std::string &errorString, const ErrorType &errorType); //to run the thread void run(); /// \to create transfer thread void createTransferThread(); void deleteTransferThread(); //mk path to do - quint64 addToMkPath(const QFileInfo& source, const QFileInfo& destination, const int &inode); + uint64_t addToMkPath(const QFileInfo& source, const QFileInfo& destination, const int &inode); //add rm path to do void addToMovePath(const QFileInfo& source,const QFileInfo& destination, const int& inodeToRemove); //add to real move @@ -363,69 +364,69 @@ signals: //send information about the copy void actionInProgess(const Ultracopier::EngineActionInProgress &) const; //should update interface information on this event - void newActionOnList(const QList &) const;///very important, need be temporized to group the modification to do and not flood the interface + void newActionOnList(const std::vector &) const;///very important, need be temporized to group the modification to do and not flood the interface void syncReady() const; - void doneTime(const QList >&) const; + void doneTime(const std::vector >&) const; /** \brief to get the progression for a specific file * \param id the id of the transfer, id send during population the transfer list * first = current transfered byte, second = byte to transfer */ - void pushFileProgression(const QList &progressionList) const; + void pushFileProgression(const std::vector &progressionList) const; //get information about the copy /** \brief to get the general progression * first = current transfered byte, second = byte to transfer */ - void pushGeneralProgression(const quint64 &,const quint64 &) const; + void pushGeneralProgression(const uint64_t &,const uint64_t &) const; - void newFolderListing(const QString &path) const; + void newFolderListing(const std::string &path) const; void isInPause(const bool &) const; //when can be deleted void canBeDeleted() const; - void haveNeedPutAtBottom(bool needPutAtBottom,const QFileInfo &fileInfo,const QString &errorString,TransferThread * thread,const ErrorType &errorType) const; + void haveNeedPutAtBottom(bool needPutAtBottom,const QFileInfo &fileInfo,const std::string &errorString,TransferThread * thread,const ErrorType &errorType) const; //send error occurred - void error(const QString &path,const quint64 &size,const QDateTime &mtime,const QString &error) const; - void errorToRetry(const QString &source,const QString &destination,const QString &error) const; + void error(const std::string &path,const uint64_t &size,const uint64_t &mtime,const std::string &error) const; + void errorToRetry(const std::string &source,const std::string &destination,const std::string &error) const; //for the extra logging - void rmPath(const QString &path) const; - void mkPath(const QString &path) const; + void rmPath(const std::string &path) const; + void mkPath(const std::string &path) const; /// \brief To debug source #ifdef ULTRACOPIER_PLUGIN_DEBUG - void debugInformation(const Ultracopier::DebugLevel &level,const QString &fonction,const QString &text,const QString &file,const int &ligne) const; + void debugInformation(const Ultracopier::DebugLevel &level,const std::string &fonction,const std::string &text,const std::string &file,const int &ligne) const; #endif #ifdef ULTRACOPIER_PLUGIN_DEBUG_WINDOW - void updateTheDebugInfo(const QStringList &,const QStringList&,const int &) const; + void updateTheDebugInfo(const std::vector &,const std::vector&,const int &) const; #endif //other signal /// \note Can be call without queue because all call will be serialized void send_fileAlreadyExists(const QFileInfo &source,const QFileInfo &destination,const bool &isSame,TransferThread * thread) const; /// \note Can be call without queue because all call will be serialized - void send_errorOnFile(const QFileInfo &fileInfo,const QString &errorString,TransferThread * thread, const ErrorType &errorType) const; + void send_errorOnFile(const QFileInfo &fileInfo,const std::string &errorString,TransferThread * thread, const ErrorType &errorType) const; /// \note Can be call without queue because all call will be serialized void send_folderAlreadyExists(const QFileInfo &source,const QFileInfo &destination,const bool &isSame,ScanFileOrFolder * thread) const; /// \note Can be call without queue because all call will be serialized - void send_errorOnFolder(const QFileInfo &fileInfo,const QString &errorString,ScanFileOrFolder * thread, const ErrorType &errorType) const; + void send_errorOnFolder(const QFileInfo &fileInfo,const std::string &errorString,ScanFileOrFolder * thread, const ErrorType &errorType) const; //send the progression void send_syncTransferList() const; //mkpath error event - void mkPathErrorOnFolder(const QFileInfo &fileInfo,const QString &errorString,const ErrorType &errorType) const; + void mkPathErrorOnFolder(const QFileInfo &fileInfo,const std::string &errorString,const ErrorType &errorType) const; //to close void tryCancel() const; //to ask new transfer thread void askNewTransferThread() const; - void warningTransferList(const QString &warning) const; - void errorTransferList(const QString &error) const; - void send_sendNewRenamingRules(const QString &firstRenamingRule,const QString &otherRenamingRule) const; - void send_realBytesTransfered(const quint64 &) const; + void warningTransferList(const std::string &warning) const; + void errorTransferList(const std::string &error) const; + void send_sendNewRenamingRules(const std::string &firstRenamingRule,const std::string &otherRenamingRule) const; + void send_realBytesTransfered(const uint64_t &) const; void send_setTransferAlgorithm(TransferAlgorithm transferAlgorithm) const; void send_parallelBuffer(const int ¶llelBuffer) const; void send_sequentialBuffer(const int &sequentialBuffer) const; void send_parallelizeIfSmallerThan(const int ¶llelizeIfSmallerThan) const; void send_updateMount(); - void missingDiskSpace(QList list) const; + void missingDiskSpace(std::vector list) const; }; #endif // LISTTHREAD_H diff --git a/plugins/CopyEngine/Ultracopier/ListThread_InodeAction.cpp b/plugins/CopyEngine/Ultracopier/ListThread_InodeAction.cpp index b47fbdf..12421f2 100644 --- a/plugins/CopyEngine/Ultracopier/ListThread_InodeAction.cpp +++ b/plugins/CopyEngine/Ultracopier/ListThread_InodeAction.cpp @@ -9,7 +9,7 @@ ActionToDoInode& currentActionToDoInode=actionToDoListInode[int_for_internal_loo switch(currentActionToDoInode.type) { case ActionType_RealMove: - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("launch real move, source: %1, destination: %2").arg(currentActionToDoInode.source.absoluteFilePath()).arg(currentActionToDoInode.destination.absoluteFilePath())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("launch real move, source: %1, destination: %2").arg(currentActionToDoInode.source.absoluteFilePath()).arg(currentActionToDoInode.destination.absoluteFilePath()).toStdString()); mkPathQueue.addPath(currentActionToDoInode.source.absoluteFilePath(),currentActionToDoInode.destination.absoluteFilePath(),currentActionToDoInode.type); currentActionToDoInode.isRunning=true; numberOfInodeOperation++; @@ -17,7 +17,7 @@ switch(currentActionToDoInode.type) return; break; case ActionType_MkPath: - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("launch mkpath, source: %1, destination: %2").arg(currentActionToDoInode.source.absoluteFilePath()).arg(currentActionToDoInode.destination.absoluteFilePath())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("launch mkpath, source: %1, destination: %2").arg(currentActionToDoInode.source.absoluteFilePath()).arg(currentActionToDoInode.destination.absoluteFilePath()).toStdString()); mkPathQueue.addPath(currentActionToDoInode.source.absoluteFilePath(),currentActionToDoInode.destination.absoluteFilePath(),currentActionToDoInode.type); currentActionToDoInode.isRunning=true; numberOfInodeOperation++; @@ -26,7 +26,7 @@ switch(currentActionToDoInode.type) break; #ifdef ULTRACOPIER_PLUGIN_RSYNC case ActionType_RmSync: - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QString("launch rmsync, destination: %1").arg(currentActionToDoInode.destination.absoluteFilePath())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QString("launch rmsync, destination: %1").arg(currentActionToDoInode.destination.absoluteFilePath()).toStdString()); mkPathQueue.addPath(currentActionToDoInode.destination.absoluteFilePath(),currentActionToDoInode.destination.absoluteFilePath(),currentActionToDoInode.type); currentActionToDoInode.isRunning=true; numberOfInodeOperation++; @@ -36,9 +36,9 @@ switch(currentActionToDoInode.type) #endif case ActionType_MovePath: //then empty (no file), can try remove it - if(currentActionToDoInode.size==0 || actionToDoListTransfer.isEmpty())//don't put afterTheTransfer because actionToDoListInode_afterTheTransfer -> already afterTheTransfer + if(currentActionToDoInode.size==0 || actionToDoListTransfer.empty())//don't put afterTheTransfer because actionToDoListInode_afterTheTransfer -> already afterTheTransfer { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("launch rmpath: %1").arg(currentActionToDoInode.source.absoluteFilePath())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("launch rmpath: %1").arg(currentActionToDoInode.source.absoluteFilePath()).toStdString()); mkPathQueue.addPath(currentActionToDoInode.source.absoluteFilePath(),currentActionToDoInode.destination.absoluteFilePath(),currentActionToDoInode.type); currentActionToDoInode.isRunning=true; numberOfInodeOperation++; @@ -48,8 +48,8 @@ switch(currentActionToDoInode.type) else //have do the destination, put the remove to after { currentActionToDoInode.size=0; - actionToDoListInode_afterTheTransfer << currentActionToDoInode; - actionToDoListInode.removeAt(int_for_internal_loop); + actionToDoListInode_afterTheTransfer.push_back(currentActionToDoInode); + actionToDoListInode.erase(actionToDoListInode.cbegin()+int_for_internal_loop); int_for_internal_loop--; actionToDoListInode_count--; if(numberOfInodeOperation>=inodeThreads) @@ -57,7 +57,7 @@ switch(currentActionToDoInode.type) } break; default: - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("Wrong type at inode action")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Wrong type at inode action"); return; } diff --git a/plugins/CopyEngine/Ultracopier/MkPath.cpp b/plugins/CopyEngine/Ultracopier/MkPath.cpp index 15c423f..52d67af 100644 --- a/plugins/CopyEngine/Ultracopier/MkPath.cpp +++ b/plugins/CopyEngine/Ultracopier/MkPath.cpp @@ -9,7 +9,7 @@ #endif #endif -QString MkPath::text_slash=QLatin1Literal("/"); +std::string MkPath::text_slash="/"; MkPath::MkPath() { @@ -22,7 +22,7 @@ MkPath::MkPath() start(); #ifdef Q_OS_WIN32 #ifndef ULTRACOPIER_PLUGIN_SET_TIME_UNIX_WAY - regRead=QRegularExpression(QStringLiteral("^[a-z]:")); + regRead=std::regex("^[a-z]:"); #endif #endif } @@ -36,7 +36,7 @@ MkPath::~MkPath() void MkPath::addPath(const QFileInfo& source, const QFileInfo& destination, const ActionType &actionType) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("source: %1, destination: %2").arg(source.absoluteFilePath()).arg(destination.absoluteFilePath())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("source: %1, destination: %2").arg(source.absoluteFilePath()).arg(destination.absoluteFilePath()).toStdString()); if(stopIt) return; emit internalStartAddPath(source,destination,actionType); @@ -67,7 +67,7 @@ void MkPath::internalDoThisPath() { if(waitAction || pathList.isEmpty()) return; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("source: %1, destination: %2, move: %3").arg(pathList.first().source.absoluteFilePath()).arg(pathList.first().destination.absoluteFilePath()).arg(pathList.first().actionType)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("source: %1, destination: %2, move: %3").arg(pathList.first().source.absoluteFilePath()).arg(pathList.first().destination.absoluteFilePath()).arg(pathList.first().actionType).toStdString()); #ifdef ULTRACOPIER_PLUGIN_RSYNC if(pathList.first().actionType==ActionType_RmSync) { @@ -79,8 +79,8 @@ void MkPath::internalDoThisPath() if(stopIt) return; waitAction=true; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to remove the inode: "+pathList.first().destination.absoluteFilePath()+", error: "+removedFile.errorString()); - emit errorOnFolder(pathList.first().destination,removedFile.errorString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to remove the inode: "+pathList.first().destination.absoluteFilePath().toStdString()+", error: "+removedFile.errorString().toStdString()); + emit errorOnFolder(pathList.first().destination,removedFile.errorString().toStdString()); return; } } @@ -89,8 +89,8 @@ void MkPath::internalDoThisPath() if(stopIt) return; waitAction=true; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to remove the inode: "+pathList.first().destination.absoluteFilePath()); - emit errorOnFolder(pathList.first().destination,tr("Unable to remove")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to remove the inode: "+pathList.first().destination.absoluteFilePath().toStdString()); + emit errorOnFolder(pathList.first().destination,tr("Unable to remove").toStdString()); return; } pathList.removeFirst(); @@ -104,12 +104,12 @@ void MkPath::internalDoThisPath() { if(!pathList.first().source.exists()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"the sources not exists: "+pathList.first().source.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"the sources not exists: "+pathList.first().source.absoluteFilePath().toStdString()); doTheDateTransfer=false; } else if(maxTime>=pathList.first().source.lastModified()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"the sources is older to copy the time: "+pathList.first().source.absoluteFilePath()+": "+maxTime.toString("dd.MM.yyyy hh:mm:ss.zzz")+">="+pathList.first().source.lastModified().toString("dd.MM.yyyy hh:mm:ss.zzz")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"the sources is older to copy the time: "+pathList.first().source.absoluteFilePath().toStdString()+": "+maxTime.toString("dd.MM.yyyy hh:mm:ss.zzz").toStdString()+">="+pathList.first().source.lastModified().toString("dd.MM.yyyy hh:mm:ss.zzz").toStdString()); doTheDateTransfer=false; } else @@ -138,8 +138,8 @@ void MkPath::internalDoThisPath() if(stopIt) return; waitAction=true; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to make the folder: "+pathList.first().destination.absoluteFilePath()); - emit errorOnFolder(pathList.first().destination,tr("Unable to create the folder")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to make the folder: "+pathList.first().destination.absoluteFilePath().toStdString()); + emit errorOnFolder(pathList.first().destination,tr("Unable to create the folder").toStdString()); return; } } @@ -151,36 +151,36 @@ void MkPath::internalDoThisPath() if(stopIt) return; waitAction=true; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"The source folder don't exists: "+pathList.first().source.absoluteFilePath()); - emit errorOnFolder(pathList.first().destination,tr("The source folder don't exists")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"The source folder don't exists: "+pathList.first().source.absoluteFilePath().toStdString()); + emit errorOnFolder(pathList.first().destination,tr("The source folder don't exists").toStdString()); return; } if(!pathList.first().source.isDir())//it's really an error? { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"The source is not a folder: "+pathList.first().source.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"The source is not a folder: "+pathList.first().source.absoluteFilePath().toStdString()); /*if(stopIt) return; waitAction=true; emit errorOnFolder(pathList.first().destination,tr("The source is not a folder")); return;*/ } - if(pathList.first().destination.absoluteFilePath().startsWith(pathList.first().source.absoluteFilePath()+text_slash)) + if(pathList.first().destination.absoluteFilePath().startsWith(pathList.first().source.absoluteFilePath()+QString::fromStdString(text_slash))) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"move into it self: "+pathList.first().destination.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"move into it self: "+pathList.first().destination.absoluteFilePath().toStdString()); int random=rand(); - QFileInfo tempFolder=pathList.first().source.absolutePath()+text_slash+QString::number(random); + QFileInfo tempFolder=pathList.first().source.absolutePath()+QString::fromStdString(text_slash)+QString::number(random); while(tempFolder.exists()) { random=rand(); - tempFolder=pathList.first().source.absolutePath()+text_slash+QString::number(random); + tempFolder=pathList.first().source.absolutePath()+QString::fromStdString(text_slash)+QString::number(random); } if(!dir.rename(pathList.first().source.absoluteFilePath(),tempFolder.absoluteFilePath())) { if(stopIt) return; waitAction=true; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to temporary rename the folder: "+pathList.first().destination.absoluteFilePath()); - emit errorOnFolder(pathList.first().destination,tr("Unable to temporary rename the folder")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to temporary rename the folder: "+pathList.first().destination.absoluteFilePath().toStdString()); + emit errorOnFolder(pathList.first().destination,tr("Unable to temporary rename the folder").toStdString()); return; } /* http://doc.qt.io/qt-5/qdir.html#rename @@ -202,8 +202,8 @@ void MkPath::internalDoThisPath() if(stopIt) return; waitAction=true; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to do the final real move the folder: "+pathList.first().destination.absoluteFilePath()); - emit errorOnFolder(pathList.first().destination,tr("Unable to do the final real move the folder")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to do the final real move the folder: "+pathList.first().destination.absoluteFilePath().toStdString()); + emit errorOnFolder(pathList.first().destination,tr("Unable to do the final real move the folder").toStdString()); return; } } @@ -228,8 +228,9 @@ void MkPath::internalDoThisPath() if(stopIt) return; waitAction=true; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to make the folder: from: "+pathList.first().source.absoluteFilePath()+", soruce exists: "+QString::number(QDir(pathList.first().source.absoluteFilePath()).exists())+", to: "+pathList.first().destination.absoluteFilePath()+", destination exist: "+QString::number(QDir(pathList.first().destination.absoluteFilePath()).exists())); - emit errorOnFolder(pathList.first().destination,tr("Unable to move the folder")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to make the folder: from: "+pathList.first().source.absoluteFilePath().toStdString()+", soruce exists: "+std::to_string(QDir(pathList.first().source.absoluteFilePath()).exists())+", to: "+pathList.first().destination.absoluteFilePath().toStdString() + +", destination exist: "+std::to_string(QDir(pathList.first().destination.absoluteFilePath()).exists())); + emit errorOnFolder(pathList.first().destination,tr("Unable to move the folder").toStdString()); return; } } @@ -238,11 +239,11 @@ void MkPath::internalDoThisPath() if(!writeFileDateTime(pathList.first().destination)) { if(!pathList.first().destination.exists()) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to set destination folder time (not exists): "+pathList.first().destination.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to set destination folder time (not exists): "+pathList.first().destination.absoluteFilePath().toStdString()); else if(!pathList.first().destination.isDir()) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to set destination folder time (not a dir): "+pathList.first().destination.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to set destination folder time (not a dir): "+pathList.first().destination.absoluteFilePath().toStdString()); else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to set destination folder time: "+pathList.first().destination.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to set destination folder time: "+pathList.first().destination.absoluteFilePath().toStdString()); /*if(stopIt) return; waitAction=true; @@ -256,7 +257,7 @@ void MkPath::internalDoThisPath() QFile destination(pathList.first().destination.absoluteFilePath()); if(!destination.setPermissions(source.permissions())) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to set the right: "+pathList.first().destination.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to set the right: "+pathList.first().destination.absoluteFilePath().toStdString()); /*if(stopIt) return; waitAction=true; @@ -271,8 +272,8 @@ void MkPath::internalDoThisPath() if(stopIt) return; waitAction=true; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to remove the source folder: "+pathList.first().destination.absoluteFilePath()); - emit errorOnFolder(pathList.first().source,tr("Unable to remove")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Unable to remove the source folder: "+pathList.first().destination.absoluteFilePath().toStdString()); + emit errorOnFolder(pathList.first().source,tr("Unable to remove").toStdString()); return; } } @@ -283,7 +284,7 @@ void MkPath::internalDoThisPath() void MkPath::internalAddPath(const QFileInfo& source, const QFileInfo& destination, const ActionType &actionType) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("source: %1, destination: %2").arg(source.absoluteFilePath()).arg(destination.absoluteFilePath())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("source: %1, destination: %2").arg(source.absoluteFilePath()).arg(destination.absoluteFilePath()).toStdString()); Item tempPath; tempPath.source=source; tempPath.destination=destination; @@ -351,24 +352,24 @@ bool MkPath::rmpath(const QDir &dir QFile file(fileInfo.absoluteFilePath()); if(!file.remove()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to remove a file: "+fileInfo.absoluteFilePath()+", due to: "+file.errorString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to remove a file: "+fileInfo.absoluteFilePath().toStdString()+", due to: "+file.errorString().toStdString()); allHaveWork=false; } } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"found a file: "+fileInfo.fileName()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"found a file: "+fileInfo.fileName().toStdString()); allHaveWork=false; } } } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"found a file: "+fileInfo.fileName()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"found a file: "+fileInfo.fileName().toStdString()); allHaveWork=false; } #else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"found a file: "+fileInfo.fileName()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"found a file: "+fileInfo.fileName().toStdString()); allHaveWork=false; #endif } @@ -383,14 +384,14 @@ bool MkPath::rmpath(const QDir &dir return false; allHaveWork=dir.rmdir(dir.absolutePath()); if(!allHaveWork) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to remove the folder: "+dir.absolutePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to remove the folder: "+dir.absolutePath().toStdString()); return allHaveWork; } //fonction to edit the file date time bool MkPath::readFileDateTime(const QFileInfo &source) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"readFileDateTime("+source.absoluteFilePath()+")"); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"readFileDateTime("+source.absoluteFilePath().toStdString()+")"); /** Why not do it with Qt? Because it not support setModificationTime(), and get the time with Qt, that's mean use local time where in C is UTC time */ #ifdef Q_OS_UNIX #ifdef Q_OS_LINUX @@ -433,14 +434,14 @@ bool MkPath::readFileDateTime(const QFileInfo &source) return true; #else wchar_t filePath[65535]; - if(source.absoluteFilePath().contains(regRead)) + if(std::regex_match(source.absoluteFilePath().toStdString(),regRead)) filePath[QDir::toNativeSeparators(QStringLiteral("\\\\?\\")+source.absoluteFilePath()).toWCharArray(filePath)]=L'\0'; else filePath[QDir::toNativeSeparators(source.absoluteFilePath()).toWCharArray(filePath)]=L'\0'; HANDLE hFileSouce = CreateFileW(filePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY | FILE_FLAG_BACKUP_SEMANTICS, NULL); if(hFileSouce == INVALID_HANDLE_VALUE) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"open failed to read: "+QString::fromWCharArray(filePath)+", error: "+QString::number(GetLastError())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"open failed to read: "+QString::fromWCharArray(filePath).toStdString()+", error: "+std::to_string(GetLastError())); return false; } FILETIME ftCreate, ftAccess, ftWrite; @@ -468,7 +469,7 @@ bool MkPath::readFileDateTime(const QFileInfo &source) bool MkPath::writeFileDateTime(const QFileInfo &destination) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"writeFileDateTime("+destination.absoluteFilePath()+")"); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"writeFileDateTime("+destination.absoluteFilePath().toStdString()+")"); /** Why not do it with Qt? Because it not support setModificationTime(), and get the time with Qt, that's mean use local time where in C is UTC time */ #ifdef Q_OS_UNIX #ifdef Q_OS_LINUX @@ -482,14 +483,14 @@ bool MkPath::writeFileDateTime(const QFileInfo &destination) return utime(destination.toLatin1().data(),&butime)==0; #else wchar_t filePath[65535]; - if(destination.absoluteFilePath().contains(regRead)) + if(std::regex_match(destination.absoluteFilePath().toStdString(),regRead)) filePath[QDir::toNativeSeparators(QStringLiteral("\\\\?\\")+destination.absoluteFilePath()).toWCharArray(filePath)]=L'\0'; else filePath[QDir::toNativeSeparators(destination.absoluteFilePath()).toWCharArray(filePath)]=L'\0'; HANDLE hFileDestination = CreateFileW(filePath, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); if(hFileDestination == INVALID_HANDLE_VALUE) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"open failed to write: "+QString::fromWCharArray(filePath)+", error: "+QString::number(GetLastError())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"open failed to write: "+QString::fromWCharArray(filePath).toStdString()+", error: "+std::to_string(GetLastError())); return false; } FILETIME ftCreate, ftAccess, ftWrite; diff --git a/plugins/CopyEngine/Ultracopier/MkPath.h b/plugins/CopyEngine/Ultracopier/MkPath.h index 9182462..2bbebcc 100644 --- a/plugins/CopyEngine/Ultracopier/MkPath.h +++ b/plugins/CopyEngine/Ultracopier/MkPath.h @@ -8,9 +8,9 @@ #include #include -#include +#include #include -#include +#include #include #include @@ -44,13 +44,13 @@ public: void setRightTransfer(const bool doRightTransfer); void setKeepDate(const bool keepDate); signals: - void errorOnFolder(const QFileInfo &,const QString &,const ErrorType &errorType=ErrorType_FolderWithRety) const; + void errorOnFolder(const QFileInfo &,const std::string &,const ErrorType &errorType=ErrorType_FolderWithRety) const; void firstFolderFinish(); void internalStartAddPath(const QFileInfo& source,const QFileInfo& destination, const ActionType &actionType) const; void internalStartDoThisPath() const; void internalStartSkip() const; void internalStartRetry() const; - void debugInformation(const Ultracopier::DebugLevel &level,const QString &fonction,const QString &text,const QString &file,const int &ligne) const; + void debugInformation(const Ultracopier::DebugLevel &level,const std::string &fonction,const std::string &text,const std::string &file,const int &ligne) const; public slots: /// \brief skip after creation error void skip(); @@ -81,16 +81,16 @@ private: #ifdef ULTRACOPIER_PLUGIN_SET_TIME_UNIX_WAY utimbuf butime; #else - quint32 ftCreateL, ftAccessL, ftWriteL; - quint32 ftCreateH, ftAccessH, ftWriteH; - QRegularExpression regRead; + uint64_t ftCreateL, ftAccessL, ftWriteL; + uint64_t ftCreateH, ftAccessH, ftWriteH; + std::regex regRead; #endif #endif #endif //fonction to edit the file date time bool readFileDateTime(const QFileInfo &source); bool writeFileDateTime(const QFileInfo &destination); - static QString text_slash; + static std::string text_slash; private slots: void internalDoThisPath(); void internalAddPath(const QFileInfo& source, const QFileInfo& destination,const ActionType &actionType); diff --git a/plugins/CopyEngine/Ultracopier/ReadThread.cpp b/plugins/CopyEngine/Ultracopier/ReadThread.cpp index 37c83f4..e843d9b 100644 --- a/plugins/CopyEngine/Ultracopier/ReadThread.cpp +++ b/plugins/CopyEngine/Ultracopier/ReadThread.cpp @@ -51,29 +51,29 @@ void ReadThread::open(const QFileInfo &file, const Ultracopier::CopyMode &mode) { if(!isRunning()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] the thread not running to open destination: ")+file.absoluteFilePath()); - errorString_internal=tr("Internal error, please report it!"); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] the thread not running to open destination: "+file.absoluteFilePath().toStdString()); + errorString_internal=tr("Internal error, please report it!").toStdString(); emit error(); } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] open source: ")+file.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] open source: "+file.absoluteFilePath().toStdString()); if(this->file.isOpen()) { if(file.absoluteFilePath()==this->file.fileName()) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] Try reopen already opened same file: ")+file.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] Try reopen already opened same file: "+file.absoluteFilePath().toStdString()); else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] previous file is already open: ")+file.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+"] previous file is already open: "+file.absoluteFilePath().toStdString()); emit internalStartClose(); isOpen.acquire(); isOpen.release(); } if(isInReadLoop) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] previous file is already readding: ")+file.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+"] previous file is already readding: "+file.absoluteFilePath().toStdString()); return; } if(tryStartRead) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] previous file is already try read: ")+file.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+"] previous file is already try read: "+file.absoluteFilePath().toStdString()); return; } stopIt=false; @@ -84,14 +84,14 @@ void ReadThread::open(const QFileInfo &file, const Ultracopier::CopyMode &mode) emit internalStartOpen(); } -QString ReadThread::errorString() const +std::string ReadThread::errorString() const { return errorString_internal; } void ReadThread::stop() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] stop()")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] stop()"); stopIt=true; pauseMutex.release(); pauseMutex.release(); @@ -104,7 +104,7 @@ void ReadThread::stop() void ReadThread::pause() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] try put read thread in pause")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] try put read thread in pause"); if(stopIt) return; pauseMutex.tryAcquire(pauseMutex.available()); @@ -115,7 +115,7 @@ void ReadThread::resume() { if(putInPause) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start"); putInPause=false; stopIt=false; } @@ -123,21 +123,21 @@ void ReadThread::resume() return; if(!file.isOpen()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] file is not open")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] file is not open"); return; } pauseMutex.release(); } -bool ReadThread::seek(const qint64 &position) +bool ReadThread::seek(const int64_t &position) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start with: ")+QString::number(position)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start with: "+std::to_string(position)); if(position>file.size()) return false; return file.seek(position); } -qint64 ReadThread::size() const +int64_t ReadThread::size() const { return file.size(); } @@ -166,7 +166,7 @@ void ReadThread::checkSum() #endif if(putInPause) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("[")+QString::number(id)+QStringLiteral("] read put in pause")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"["+std::to_string(id)+"] read put in pause"); if(stopIt) return; pauseMutex.acquire(); @@ -181,16 +181,16 @@ void ReadThread::checkSum() //can be smaller than min block size to do correct speed limitation if(blockArray.size()>ULTRACOPIER_PLUGIN_MAX_BLOCK_SIZE*1024) { - errorString_internal=tr("Internal error reading the source file:block size out of range"); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("Internal error reading the source file:block size out of range")); + errorString_internal=tr("Internal error reading the source file:block size out of range").toStdString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] Internal error reading the source file:block size out of range"); emit error(); isInReadLoop=false; return; } if(file.error()!=QFile::NoError) { - errorString_internal=tr("Unable to read the source file: ")+file.errorString()+QStringLiteral(" (")+QString::number(file.error())+QStringLiteral(")"); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("file.error()!=QFile::NoError: %1, error: %2").arg(QString::number(file.error())).arg(errorString_internal)); + errorString_internal=tr("Unable to read the source file: ").toStdString()+file.errorString().toStdString()+" ("+std::to_string(file.error())+")"; + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("file.error()!=QFile::NoError: %1, error: ").arg(QString::number(file.error())).toStdString()+errorString_internal); emit error(); isInReadLoop=false; return; @@ -230,8 +230,8 @@ void ReadThread::checkSum() while(sizeReaden>0 && !stopIt); if(lastGoodPosition>file.size()) { - errorString_internal=tr("File truncated during the read, possible data change"); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("Source truncated during the read: %1 (%2)").arg(file.errorString()).arg(QString::number(file.error()))); + errorString_internal=tr("File truncated during the read, possible data change").toStdString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("Source truncated during the read: %1 (%2)").arg(file.errorString()).arg(QString::number(file.error())).toStdString()); emit error(); isInReadLoop=false; return; @@ -243,7 +243,7 @@ void ReadThread::checkSum() return; } emit checksumFinish(hash.result()); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] stop the read")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] stop the read"); } bool ReadThread::internalOpenSlot() @@ -253,7 +253,7 @@ bool ReadThread::internalOpenSlot() bool ReadThread::internalOpen(bool resetLastGoodPosition) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] internalOpen source: ")+file.fileName()+QStringLiteral(", open in write because move: ")+QString::number(mode==Ultracopier::Move)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] internalOpen source: "+file.fileName().toStdString()+", open in write because move: "+std::to_string(mode==Ultracopier::Move)); if(stopIt) { emit closed(); @@ -265,7 +265,7 @@ bool ReadThread::internalOpen(bool resetLastGoodPosition) #endif if(file.isOpen()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] this file is already open: ")+file.fileName()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] this file is already open: "+file.fileName().toStdString()); #ifdef ULTRACOPIER_PLUGIN_DEBUG stat=Idle; #endif @@ -293,15 +293,15 @@ bool ReadThread::internalOpen(bool resetLastGoodPosition) return false; } size_at_open=file.size(); - mtime_at_open=QFileInfo(file).lastModified(); + mtime_at_open=QFileInfo(file).lastModified().toMSecsSinceEpoch()/1000; putInPause=false; if(resetLastGoodPosition) lastGoodPosition=0; if(!seek(lastGoodPosition)) { file.close(); - errorString_internal=file.errorString(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("Unable to seek after open: %1, error: %2").arg(file.fileName()).arg(errorString_internal)); + errorString_internal=file.errorString().toStdString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("Unable to seek after open: %1, error: %2").arg(file.fileName()).toStdString()+errorString_internal); emit error(); #ifdef ULTRACOPIER_PLUGIN_DEBUG stat=Idle; @@ -317,8 +317,8 @@ bool ReadThread::internalOpen(bool resetLastGoodPosition) } else { - errorString_internal=file.errorString(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("Unable to open: %1, error: %2").arg(file.fileName()).arg(errorString_internal)); + errorString_internal=file.errorString().toStdString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("Unable to open: %1, error: ").arg(file.fileName()).toStdString()+errorString_internal); emit error(); #ifdef ULTRACOPIER_PLUGIN_DEBUG stat=Idle; @@ -341,7 +341,7 @@ void ReadThread::internalRead() } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] stopIt == true, then quit")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] stopIt == true, then quit"); isInReadLoop=false; internalClose(); return; @@ -353,7 +353,7 @@ void ReadThread::internalRead() int sizeReaden=0; if(!file.isOpen()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] is not open!")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] is not open!"); isInReadLoop=false; return; } @@ -361,14 +361,14 @@ void ReadThread::internalRead() #ifdef ULTRACOPIER_PLUGIN_SPEED_SUPPORT numberOfBlockCopied=0; #endif - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start the copy")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start the copy"); emit readIsStarted(); #ifdef ULTRACOPIER_PLUGIN_DEBUG stat=Idle; #endif if(stopIt) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] stopIt == true, then quit")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] stopIt == true, then quit"); isInReadLoop=false; internalClose(); return; @@ -378,10 +378,10 @@ void ReadThread::internalRead() //read one block if(putInPause) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("[")+QString::number(id)+QStringLiteral("] read put in pause")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"["+std::to_string(id)+"] read put in pause"); if(stopIt) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] stopIt == true, then quit")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] stopIt == true, then quit"); isInReadLoop=false; internalClose(); return; @@ -389,7 +389,7 @@ void ReadThread::internalRead() pauseMutex.acquire(); if(stopIt) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] stopIt == true, then quit")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] stopIt == true, then quit"); isInReadLoop=false; internalClose(); return; @@ -405,8 +405,8 @@ void ReadThread::internalRead() if(file.error()!=QFile::NoError) { - errorString_internal=tr("Unable to read the source file: ")+file.errorString()+QStringLiteral(" (")+QString::number(file.error())+QStringLiteral(")"); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("file.error()!=QFile::NoError: %1, error: %2").arg(QString::number(file.error())).arg(errorString_internal)); + errorString_internal=tr("Unable to read the source file: ").toStdString()+file.errorString().toStdString()+" ("+std::to_string(file.error())+")"; + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("file.error()!=QFile::NoError: %1, error: ").arg(QString::number(file.error())).toStdString()+errorString_internal); isInReadLoop=false; emit error(); return; @@ -421,7 +421,7 @@ void ReadThread::internalRead() { if(!stopIt) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] stopped because the write is stopped: ")+QString::number(lastGoodPosition)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] stopped because the write is stopped: "+std::to_string(lastGoodPosition)); stopIt=true; } } @@ -432,7 +432,7 @@ void ReadThread::internalRead() if(stopIt) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] stopIt == true, then quit")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] stopIt == true, then quit"); isInReadLoop=false; internalClose();//need re-open the destination and then the source return; @@ -453,8 +453,8 @@ void ReadThread::internalRead() while(sizeReaden>0 && !stopIt); if(lastGoodPosition>file.size()) { - errorString_internal=tr("File truncated during the read, possible data change"); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("Source truncated during the read: %1 (%2)").arg(file.errorString()).arg(QString::number(file.error()))); + errorString_internal=tr("File truncated during the read, possible data change").toStdString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("Source truncated during the read: %1 (%2)").arg(file.errorString()).arg(QString::number(file.error())).toStdString()); isInReadLoop=false; emit error(); return; @@ -466,19 +466,19 @@ void ReadThread::internalRead() return; } emit readIsStopped();//will product by signal connection writeThread->endIsDetected(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] stop the read")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] stop the read"); } void ReadThread::startRead() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start"); if(tryStartRead) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] already in try start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] already in try start"); return; } if(isInReadLoop) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] double event dropped")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] double event dropped"); else { tryStartRead=true; @@ -527,7 +527,7 @@ bool ReadThread::setBlockSize(const int blockSize) } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("block size out of range: ")+QString::number(blockSize)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"block size out of range: "+std::to_string(blockSize)); return false; } } @@ -582,7 +582,7 @@ void ReadThread::startCheckSum() emit internalStartChecksum(); } -qint64 ReadThread::getLastGoodPosition() const +int64_t ReadThread::getLastGoodPosition() const { /*if(lastGoodPosition>file.size()) { @@ -596,10 +596,10 @@ qint64 ReadThread::getLastGoodPosition() const //reopen after an error void ReadThread::reopen() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start"); if(isInReadLoop) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] try reopen where read is not finish")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] try reopen where read is not finish"); return; } stopIt=true; @@ -608,16 +608,16 @@ void ReadThread::reopen() bool ReadThread::internalReopen() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start"); stopIt=false; if(file.isOpen()) { file.close(); isOpen.release(); } - if(size_at_open!=file.size() && mtime_at_open!=QFileInfo(file).lastModified()) + if(size_at_open!=file.size() && mtime_at_open!=(uint64_t)QFileInfo(file).lastModified().toMSecsSinceEpoch()/1000) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] source file have changed since the last open, restart all")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] source file have changed since the last open, restart all"); //fix this function like the close function if(internalOpen(true)) { @@ -656,7 +656,7 @@ void ReadThread::setId(int id) void ReadThread::seekToZeroAndWait() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start"); stopIt=true; seekToZero=true; emit checkIfIsWait(); @@ -664,7 +664,7 @@ void ReadThread::seekToZeroAndWait() void ReadThread::isInWait() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start"); if(seekToZero) { stopIt=false; diff --git a/plugins/CopyEngine/Ultracopier/ReadThread.h b/plugins/CopyEngine/Ultracopier/ReadThread.h index f00ae79..f817e35 100644 --- a/plugins/CopyEngine/Ultracopier/ReadThread.h +++ b/plugins/CopyEngine/Ultracopier/ReadThread.h @@ -31,7 +31,7 @@ public: /// \brief open with the name and copy mode void open(const QFileInfo &file, const Ultracopier::CopyMode &mode); /// \brief return the error string - QString errorString() const; + std::string errorString() const; //QByteArray read(qint64 position,qint64 maxSize); /// \brief stop the copy void stop(); @@ -40,9 +40,9 @@ public: /// \brief resume the copy void resume(); /// \brief get the size of the source file - qint64 size() const; + int64_t size() const; /// \brief get the last good position - qint64 getLastGoodPosition() const; + int64_t getLastGoodPosition() const; /// \brief start the reading of the source file void startRead(); #ifdef ULTRACOPIER_PLUGIN_SPEED_SUPPORT @@ -107,14 +107,14 @@ signals: void internalStartRead() const; void internalStartClose() const; /// \brief To debug source - void debugInformation(const Ultracopier::DebugLevel &level,QString fonction,QString text,QString file,int ligne) const; + void debugInformation(const Ultracopier::DebugLevel &level,std::string fonction,std::string text,std::string file,int ligne) const; private: - QString errorString_internal; + std::string errorString_internal; AvancedQFile file; volatile bool stopIt; Ultracopier::CopyMode mode; - qint64 lastGoodPosition; + int64_t lastGoodPosition; volatile int blockSize;//in Bytes #ifdef ULTRACOPIER_PLUGIN_SPEED_SUPPORT QSemaphore waitNewClockForSpeed; @@ -129,11 +129,11 @@ private: volatile bool isInReadLoop; volatile bool seekToZero; volatile bool tryStartRead; - qint64 size_at_open; - QDateTime mtime_at_open; + int64_t size_at_open; + uint64_t mtime_at_open; bool fakeMode; //internal function - bool seek(const qint64 &position);/// \todo search if is use full + bool seek(const int64_t &position);/// \todo search if is use full private slots: bool internalOpen(bool resetLastGoodPosition=true); bool internalOpenSlot(); diff --git a/plugins/CopyEngine/Ultracopier/RenamingRules.cpp b/plugins/CopyEngine/Ultracopier/RenamingRules.cpp index 848d7fb..4ae23b8 100644 --- a/plugins/CopyEngine/Ultracopier/RenamingRules.cpp +++ b/plugins/CopyEngine/Ultracopier/RenamingRules.cpp @@ -9,7 +9,7 @@ RenamingRules::RenamingRules(QWidget *parent) : { ui->setupUi(this); connectUI(); - setRenamingRules(QStringLiteral(""),QStringLiteral("")); + setRenamingRules("",""); } RenamingRules::~RenamingRules() @@ -23,22 +23,22 @@ void RenamingRules::on_buttonBox_clicked(QAbstractButton *button) reject(); if(ui->buttonBox->buttonRole(button)==QDialogButtonBox::ResetRole) { - setRenamingRules(QStringLiteral(""),QStringLiteral("")); + setRenamingRules("",""); emit sendNewRenamingRules(firstRenamingRule,otherRenamingRule); } } -void RenamingRules::setRenamingRules(QString firstRenamingRule,QString otherRenamingRule) +void RenamingRules::setRenamingRules(std::string firstRenamingRule,std::string otherRenamingRule) { disconnectUI(); this->firstRenamingRule=firstRenamingRule; this->otherRenamingRule=otherRenamingRule; - if(!firstRenamingRule.isEmpty()) - ui->firstRenamingRule->setText(firstRenamingRule); + if(!firstRenamingRule.empty()) + ui->firstRenamingRule->setText(QString::fromStdString(firstRenamingRule)); else ui->firstRenamingRule->setText(tr("%1 - copy").arg(QStringLiteral("%name%"))); - if(!otherRenamingRule.isEmpty()) - ui->otherRenamingRule->setText(otherRenamingRule); + if(!otherRenamingRule.empty()) + ui->otherRenamingRule->setText(QString::fromStdString(otherRenamingRule)); else ui->otherRenamingRule->setText(tr("%1 - copy (%2)").arg(QStringLiteral("%name%")).arg(QStringLiteral("%number%"))); connectUI(); @@ -61,9 +61,9 @@ void RenamingRules::firstRenamingRule_haveChanged() QString newValue=ui->firstRenamingRule->text(); if(newValue==tr("%1 - copy").arg(QStringLiteral("%name%"))) newValue=QStringLiteral(""); - if(newValue==firstRenamingRule) + if(newValue.toStdString()==firstRenamingRule) return; - firstRenamingRule=newValue; + firstRenamingRule=newValue.toStdString(); emit sendNewRenamingRules(firstRenamingRule,otherRenamingRule); } @@ -72,9 +72,9 @@ void RenamingRules::otherRenamingRule_haveChanged() QString newValue=ui->otherRenamingRule->text(); if(newValue==tr("%1 - copy (%2)").arg(QStringLiteral("%name%")).arg(QStringLiteral("%number%"))) newValue=QStringLiteral(""); - if(newValue==otherRenamingRule) + if(newValue.toStdString()==otherRenamingRule) return; - otherRenamingRule=newValue; + otherRenamingRule=newValue.toStdString(); emit sendNewRenamingRules(firstRenamingRule,otherRenamingRule); } diff --git a/plugins/CopyEngine/Ultracopier/RenamingRules.h b/plugins/CopyEngine/Ultracopier/RenamingRules.h index c802cef..b2e9d02 100644 --- a/plugins/CopyEngine/Ultracopier/RenamingRules.h +++ b/plugins/CopyEngine/Ultracopier/RenamingRules.h @@ -15,20 +15,20 @@ class RenamingRules : public QDialog public: explicit RenamingRules(QWidget *parent = 0); ~RenamingRules(); - void setRenamingRules(QString firstRenamingRule,QString otherRenamingRule); + void setRenamingRules(std::string firstRenamingRule, std::string otherRenamingRule); void newLanguageLoaded(); private: Ui::RenamingRules *ui; void connectUI(); void disconnectUI(); - QString firstRenamingRule; - QString otherRenamingRule; + std::string firstRenamingRule; + std::string otherRenamingRule; private slots: void on_buttonBox_clicked(QAbstractButton *button); void firstRenamingRule_haveChanged(); void otherRenamingRule_haveChanged(); signals: - void sendNewRenamingRules(QString firstRenamingRule,QString otherRenamingRule) const; + void sendNewRenamingRules(std::string firstRenamingRule,std::string otherRenamingRule) const; }; #endif // RENAMINGRULES_H diff --git a/plugins/CopyEngine/Ultracopier/ScanFileOrFolder.cpp b/plugins/CopyEngine/Ultracopier/ScanFileOrFolder.cpp index 9c35050..736f589 100644 --- a/plugins/CopyEngine/Ultracopier/ScanFileOrFolder.cpp +++ b/plugins/CopyEngine/Ultracopier/ScanFileOrFolder.cpp @@ -2,6 +2,8 @@ #include "TransferThread.h" #include #include +#include +#include "../../../cpp11addition.h" #ifdef Q_OS_WIN32 #ifndef NOMINMAX @@ -10,9 +12,9 @@ #include #endif -QString ScanFileOrFolder::text_slash=QLatin1Literal("/"); -QString ScanFileOrFolder::text_antislash=QLatin1Literal("\\"); -QString ScanFileOrFolder::text_dot=QLatin1Literal("."); +std::string ScanFileOrFolder::text_slash="/"; +std::string ScanFileOrFolder::text_antislash="\\"; +std::string ScanFileOrFolder::text_dot="."; ScanFileOrFolder::ScanFileOrFolder(const Ultracopier::CopyMode &mode) { @@ -23,7 +25,7 @@ ScanFileOrFolder::ScanFileOrFolder(const Ultracopier::CopyMode &mode) stopped = true; stopIt = false; this->mode = mode; - folder_isolation = QRegularExpression(QStringLiteral("^(.*/)?([^/]+)/$")); + folder_isolation = std::regex("^(.*/)?([^/]+)/$"); setObjectName(QStringLiteral("ScanFileOrFolder")); #ifdef Q_OS_WIN32 QString userName; @@ -32,7 +34,7 @@ ScanFileOrFolder::ScanFileOrFolder(const Ultracopier::CopyMode &mode) if(GetUserNameW(userNameW,&size)) { userName=QString::fromWCharArray(userNameW,size-1); - blackList << QFileInfo(QStringLiteral("C:/Users/%1/AppData/Roaming/").arg(userName)).absoluteFilePath(); + blackList.push_back(QFileInfo(QStringLiteral("C:/Users/%1/AppData/Roaming/").arg(userName)).absoluteFilePath().toStdString()); } delete userNameW; #endif @@ -50,71 +52,77 @@ bool ScanFileOrFolder::isFinished() const return stopped; } -void ScanFileOrFolder::addToList(const QStringList& sources,const QString& destination) +void ScanFileOrFolder::addToList(const std::vector& sources,const std::string& destination) { stopIt=false; this->sources=parseWildcardSources(sources); this->destination=destination; - QFileInfo destinationInfo(this->destination); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("check symblink: %1").arg(destinationInfo.absoluteFilePath())); + QFileInfo destinationInfo(QString::fromStdString(this->destination)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"check symblink: "+destinationInfo.absoluteFilePath().toStdString()); while(destinationInfo.isSymLink()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("resolv destination to: %1").arg(destinationInfo.symLinkTarget())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"resolv destination to: "+destinationInfo.symLinkTarget().toStdString()); if(QFileInfo(destinationInfo.symLinkTarget()).isAbsolute()) - this->destination=destinationInfo.symLinkTarget(); + this->destination=destinationInfo.symLinkTarget().toStdString(); else - this->destination=destinationInfo.absolutePath()+text_slash+destinationInfo.symLinkTarget(); - destinationInfo.setFile(this->destination); + this->destination=destinationInfo.absolutePath().toStdString()+text_slash+destinationInfo.symLinkTarget().toStdString(); + destinationInfo.setFile(QString::fromStdString(this->destination)); } - if(sources.size()>1 || QFileInfo(destination).isDir()) + if(sources.size()>1 || QFileInfo(QString::fromStdString(destination)).isDir()) /* Disabled because the separator transformation product bug * if(!destination.endsWith(QDir::separator())) this->destination+=QDir::separator();*/ - if(!destination.endsWith(text_slash) && !destination.endsWith(text_antislash)) + if(!stringEndsWith(destination,'/') && !stringEndsWith(destination,'\\')) this->destination+=text_slash;//put unix separator because it's transformed into that's under windows too - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"addToList("+sources.join(";")+","+this->destination+")"); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"addToList("+stringimplode(sources,";")+","+this->destination+")"); } -QStringList ScanFileOrFolder::parseWildcardSources(const QStringList &sources) const +std::vector ScanFileOrFolder::parseWildcardSources(const std::vector &sources) const { - QRegularExpression splitFolder(QStringLiteral("[/\\\\]")); - QStringList returnList; - int index=0; - while(index returnList; + unsigned int index=0; + while(index<(unsigned int)sources.size()) { - if(sources.at(index).contains(QStringLiteral("*"))) + if(sources.at(index).find("*") != std::string::npos) { - QStringList toParse=sources.at(index).split(splitFolder); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("before wildcard parse: %1, toParse: %2, is valid: %3").arg(sources.at(index)).arg(toParse.join(", ")).arg(splitFolder.isValid())); - QList recomposedSource; - recomposedSource << (QStringList() << QStringLiteral("")); + std::vector toParse=stringregexsplit(sources.at(index),splitFolder); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"before wildcard parse: "+sources.at(index)+", toParse: "+stringimplode(toParse,", ")); + std::vector > recomposedSource; + { + std::vector t; + t.push_back(""); + recomposedSource.push_back(t); + } while(toParse.size()>0) { - if(toParse.first().contains('*')) + if(toParse.front().find("*") != std::string::npos) { - QString toParseFirst=toParse.first(); - if(toParseFirst.isEmpty()) + std::string toParseFirst=toParse.front(); + if(toParseFirst.empty()) toParseFirst=text_slash; - QList newRecomposedSource; - QRegularExpression toResolv=QRegularExpression(toParseFirst.replace('*',QStringLiteral("[^/\\\\]*"))); - int index_recomposedSource=0; + std::vector > newRecomposedSource; + stringreplaceAll(toParseFirst,"*","[^/\\\\]*"); + std::regex toResolv=std::regex(toParseFirst); + unsigned int index_recomposedSource=0; while(index_recomposedSource tempList=recomposedSource.at(index_recomposedSource); + tempList.push_back(fileName); + newRecomposedSource.push_back(tempList); } index_fileList++; } @@ -125,34 +133,34 @@ QStringList ScanFileOrFolder::parseWildcardSources(const QStringList &sources) c } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("add toParse: %1").arg(toParse.join(text_slash))); - int index_recomposedSource=0; + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"add toParse: "+stringimplode(toParse,text_slash)); + unsigned int index_recomposedSource=0; while(index_recomposedSource &include, const QList &exclude) +void ScanFileOrFolder::setFilters(const std::vector &include, const std::vector &exclude) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); QMutexLocker lock(&filtersMutex); @@ -160,11 +168,11 @@ void ScanFileOrFolder::setFilters(const QList &include, const QLi this->exclude_send=exclude; reloadTheNewFilters=true; haveFilters=include_send.size()>0 || exclude_send.size()>0; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("haveFilters: %1, include_send.size(): %2, exclude_send.size(): %3").arg(haveFilters).arg(include_send.size()).arg(exclude_send.size())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"haveFilters: "+std::to_string(haveFilters)+", include_send.size(): "+std::to_string(include_send.size())+", exclude_send.size(): "+std::to_string(exclude_send.size())); } //set action if Folder are same or exists -void ScanFileOrFolder::setFolderExistsAction(const FolderExistsAction &action, const QString &newName) +void ScanFileOrFolder::setFolderExistsAction(const FolderExistsAction &action, const std::string &newName) { this->newName=newName; folderExistsAction=action; @@ -187,8 +195,8 @@ void ScanFileOrFolder::stop() void ScanFileOrFolder::run() { stopped=false; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start the listing with destination: "+destination+", mode: "+QString::number(mode)); - destination=resolvDestination(destination).absoluteFilePath(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start the listing with destination: "+destination+", mode: "+std::to_string(mode)); + destination=resolvDestination(QString::fromStdString(destination)).absoluteFilePath().toStdString(); if(stopIt) { stopped=true; @@ -199,16 +207,16 @@ void ScanFileOrFolder::run() stopped=true; return; } - int sourceIndex=0; + unsigned int sourceIndex=0; while(sourceIndexinclude=this->include_send; this->exclude=this->exclude_send; } - QString fileName=fileInfo.fileName(); + std::string fileName=fileInfo.fileName().toStdString(); if(fileInfo.isDir() && !fileInfo.isSymLink()) { bool excluded=false,included=(include.size()==0); - int filters_index=0; + unsigned int filters_index=0; while(filters_indexcheckDestinationExists=checkDestinationFolderExists; } -void ScanFileOrFolder::setRenamingRules(const QString &firstRenamingRule, const QString &otherRenamingRule) +void ScanFileOrFolder::setRenamingRules(const std::string &firstRenamingRule, const std::string &otherRenamingRule) { this->firstRenamingRule=firstRenamingRule; this->otherRenamingRule=otherRenamingRule; @@ -666,7 +677,7 @@ void ScanFileOrFolder::setCopyListOrder(const bool &order) /// \brief set rsync void ScanFileOrFolder::setRsync(const bool rsync) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"set rsync: "+QString::number(rsync)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"set rsync: "+std::to_string(rsync)); this->rsync=rsync; } #endif diff --git a/plugins/CopyEngine/Ultracopier/ScanFileOrFolder.h b/plugins/CopyEngine/Ultracopier/ScanFileOrFolder.h index e9e59ce..0c625e9 100644 --- a/plugins/CopyEngine/Ultracopier/ScanFileOrFolder.h +++ b/plugins/CopyEngine/Ultracopier/ScanFileOrFolder.h @@ -4,15 +4,15 @@ \licence GPL3, see the file COPYING */ #include -#include -#include -#include #include #include #include #include #include #include +#include +#include +#include #include "Environment.h" #include "DriveManagement.h" @@ -32,12 +32,12 @@ public: /// \brief to get if is finished bool isFinished() const; /// \brief set action if Folder are same or exists - void setFolderExistsAction(const FolderExistsAction &action,const QString &newName=""); + void setFolderExistsAction(const FolderExistsAction &action, const std::string &newName=""); /// \brief set action if error void setFolderErrorAction(const FileErrorAction &action); /// \brief set if need check if the destination exists void setCheckDestinationFolderExists(const bool checkDestinationFolderExists); - void setRenamingRules(const QString &firstRenamingRule,const QString &otherRenamingRule); + void setRenamingRules(const std::string &firstRenamingRule,const std::string &otherRenamingRule); void setMoveTheWholeFolder(const bool &moveTheWholeFolder); #ifdef ULTRACOPIER_PLUGIN_RSYNC void setRsync(const bool rsync); @@ -45,12 +45,12 @@ public: signals: void fileTransfer(const QFileInfo &source,const QFileInfo &destination,const Ultracopier::CopyMode &mode) const; /// \brief To debug source - void debugInformation(const Ultracopier::DebugLevel &level,const QString &fonction,const QString &text,const QString &file,const int &ligne) const; + void debugInformation(const Ultracopier::DebugLevel &level,const std::string &fonction,const std::string &text,const std::string &file,const int &ligne) const; void folderAlreadyExists(const QFileInfo &source,const QFileInfo &destination,const bool &isSame) const; - void errorOnFolder(const QFileInfo &fileInfo,const QString &errorString,const ErrorType &errorType=ErrorType_FolderWithRety) const; + void errorOnFolder(const QFileInfo &fileInfo,const std::string &errorString,const ErrorType &errorType=ErrorType_FolderWithRety) const; void finishedTheListing() const; - void newFolderListing(const QString &path) const; + void newFolderListing(const std::string &path) const; void addToMkPath(const QFileInfo& source,const QFileInfo& destination, const int& inode) const; void addToMovePath(const QFileInfo& source,const QFileInfo& destination, const int& inodeToRemove) const; void addToRealMove(const QFileInfo& source,const QFileInfo& destination) const; @@ -58,8 +58,8 @@ signals: void addToRmForRsync(const QFileInfo& destination) const; #endif public slots: - void addToList(const QStringList& sources,const QString& destination); - void setFilters(const QList &include,const QList &exclude); + void addToList(const std::vector& sources,const std::string& destination); + void setFilters(const std::vector &include,const std::vector &exclude); void setCopyListOrder(const bool &order); void set_updateMount(); protected: @@ -67,8 +67,8 @@ protected: private: DriveManagement driveManagement; bool moveTheWholeFolder; - QStringList sources; - QString destination; + std::vector sources; + std::string destination; volatile bool stopIt; void listFolder(QFileInfo source, QFileInfo destination); bool isBlackListed(const QFileInfo &destination); @@ -78,31 +78,31 @@ private: FolderExistsAction folderExistsAction; FileErrorAction fileErrorAction; volatile bool checkDestinationExists; - QString newName; + std::string newName; bool copyListOrder; - QRegularExpression folder_isolation; + std::regex folder_isolation; #ifdef ULTRACOPIER_PLUGIN_RSYNC bool rsync; #endif Ultracopier::CopyMode mode; - QList include,exclude; - QList include_send,exclude_send; + std::vector include,exclude; + std::vector include_send,exclude_send; bool reloadTheNewFilters; bool haveFilters; QMutex filtersMutex; - QString firstRenamingRule; - QString otherRenamingRule; - QStringList blackList; + std::string firstRenamingRule; + std::string otherRenamingRule; + std::vector blackList; /** Parse the multiple wildcard source, it allow resolv multiple wildcard with Qt into their path * The string: /toto/f*a/yy*a/toto.mp3 * Will give: /toto/f1a/yy*a/toto.mp3, /toto/f2a/yy*a/toto.mp3 * Will give: /toto/f2a/yy1a/toto.mp3, /toto/f2a/yy2a/toto.mp3 */ - QStringList parseWildcardSources(const QStringList &sources) const; + std::vector parseWildcardSources(const std::vector &sources) const; - static QString text_slash; - static QString text_antislash; - static QString text_dot; + static std::string text_slash; + static std::string text_antislash; + static std::string text_dot; }; #endif // SCANFILEORFOLDER_H diff --git a/plugins/CopyEngine/Ultracopier/StructEnumDefinition_CopyEngine.h b/plugins/CopyEngine/Ultracopier/StructEnumDefinition_CopyEngine.h index 0b23c29..036803c 100644 --- a/plugins/CopyEngine/Ultracopier/StructEnumDefinition_CopyEngine.h +++ b/plugins/CopyEngine/Ultracopier/StructEnumDefinition_CopyEngine.h @@ -3,8 +3,8 @@ \author alpha_one_x86 \licence GPL3, see the file COPYING */ -#include -#include +#include +#include #ifndef STRUCTDEF_COPYENGINE_H #define STRUCTDEF_COPYENGINE_H @@ -95,11 +95,11 @@ enum ApplyOn /** to store into different way the filter rules to be exported */ struct Filters_rules { - QString search_text; + std::string search_text; SearchType search_type; ApplyOn apply_on; bool need_match_all; - QRegularExpression regex; + std::regex regex; }; /// \brief get action type @@ -116,9 +116,9 @@ enum ActionType struct Diskspace { - QString drive; - quint64 requiredSpace; - quint64 freeSpace; + std::string drive; + uint64_t requiredSpace; + uint64_t freeSpace; }; #endif // STRUCTDEF_COPYENGINE_H diff --git a/plugins/CopyEngine/Ultracopier/TransferThread.cpp b/plugins/CopyEngine/Ultracopier/TransferThread.cpp index 1ae0a9d..786a8e9 100644 --- a/plugins/CopyEngine/Ultracopier/TransferThread.cpp +++ b/plugins/CopyEngine/Ultracopier/TransferThread.cpp @@ -15,6 +15,14 @@ #endif #endif +#ifdef Q_OS_WIN32 +#define CURRENTSEPARATOR "\\" +#else +#define CURRENTSEPARATOR "/" +#endif + +#include "../../../cpp11addition.h" + TransferThread::TransferThread() : haveStartTime (false), transfer_stat (TransferStat_Idle), @@ -37,10 +45,10 @@ TransferThread::TransferThread() : readThread.setWriteThread(&writeThread); source.setCaching(false); destination.setCaching(false); - renameRegex=QRegularExpression(QStringLiteral("^(.*)(\\.[a-z0-9]+)$")); + renameRegex=std::regex("^(.*)(\\.[a-z0-9]+)$"); #ifdef Q_OS_WIN32 #ifndef ULTRACOPIER_PLUGIN_SET_TIME_UNIX_WAY - regRead=QRegularExpression(QStringLiteral("^[a-z]:")); + regRead=std::regex("^[a-z]:"); #endif #endif @@ -63,7 +71,7 @@ TransferThread::~TransferThread() void TransferThread::run() { - //ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start: ")+QString::number((qint64)QThread::currentThreadId()))); + //ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+QStringLiteral("] start: ")+QString::number((qint64)QThread::currentThreadId()))); transfer_stat = TransferStat_Idle; stopIt = false; fileExistsAction = FileExists_NotSet; @@ -118,47 +126,47 @@ void TransferThread::internalStartTheTransfer() if(mode!=Ultracopier::Move) { /// \bug can pass here because in case of direct move on same media, it return to idle stat directly - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] can't start transfert at idle")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+("] can't start transfert at idle")); } return; } if(transfer_stat==TransferStat_PostOperation) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] can't start transfert at PostOperation")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+("] can't start transfert at PostOperation")); return; } if(transfer_stat==TransferStat_Transfer) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] can't start transfert at Transfer")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+("] can't start transfert at Transfer")); return; } if(canStartTransfer) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] canStartTransfer is already set to true")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+("] canStartTransfer is already set to true")); return; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] check how start the transfer")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+("] check how start the transfer")); canStartTransfer=true; if(readIsReadyVariable && writeIsReadyVariable) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start directly the transfer")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+("] start directly the transfer")); ifCanStartTransfer(); } else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start the transfer as delayed")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+("] start the transfer as delayed")); } -bool TransferThread::setFiles(const QFileInfo& source,const qint64 &size,const QFileInfo& destination,const Ultracopier::CopyMode &mode) +bool TransferThread::setFiles(const QFileInfo& source, const int64_t &size, const QFileInfo& destination, const Ultracopier::CopyMode &mode) { if(transfer_stat!=TransferStat_Idle) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] already used, source: ")+source.absoluteFilePath()+QStringLiteral(", destination: ")+destination.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+("] already used, source: ")+source.absoluteFilePath().toStdString()+", destination: "+destination.absoluteFilePath().toStdString()); return false; } //to prevent multiple file alocation into ListThread::doNewActions_inode_manipulation() transfer_stat = TransferStat_PreOperation; //emit pushStat(stat,transferId); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start, source: ")+source.absoluteFilePath()+QStringLiteral(", destination: ")+destination.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start, source: "+source.absoluteFilePath().toStdString()+", destination: "+destination.absoluteFilePath().toStdString()); this->source = source; this->destination = destination; this->mode = mode; @@ -185,10 +193,10 @@ void TransferThread::setFileExistsAction(const FileExistsAction &action) { if(transfer_stat!=TransferStat_PreOperation) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] already used, source: ")+source.absoluteFilePath()+QStringLiteral(", destination: ")+destination.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+("] already used, source: ")+source.absoluteFilePath().toStdString()+(", destination: ")+destination.absoluteFilePath().toStdString()); return; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] action: ")+QString::number(action)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+("] action: ")+std::to_string(action)); if(action!=FileExists_Rename) fileExistsAction = action; else @@ -206,54 +214,54 @@ void TransferThread::setFileExistsAction(const FileExistsAction &action) emit internalStartPreOperation(); } -void TransferThread::setFileRename(const QString &nameForRename) +void TransferThread::setFileRename(const std::string &nameForRename) { if(transfer_stat!=TransferStat_PreOperation) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] already used, source: ")+source.absoluteFilePath()+QStringLiteral(", destination: ")+destination.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+("] already used, source: ")+source.absoluteFilePath().toStdString()+(", destination: ")+destination.absoluteFilePath().toStdString()); return; } - if(nameForRename.contains(QRegularExpression(QStringLiteral("[/\\\\\\*]")))) + if(QString::fromStdString(nameForRename).contains(QRegularExpression(QStringLiteral("[/\\\\\\*]")))) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] can't use this kind of name, internal error")); - emit errorOnFile(destination,tr("Try rename with using special characters")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+("] can't use this kind of name, internal error")); + emit errorOnFile(destination,tr("Try rename with using special characters").toStdString()); return; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] nameForRename: ")+nameForRename); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] nameForRename: "+nameForRename); if(!renameTheOriginalDestination) - destination.setFile(destination.absolutePath()+QDir::separator()+nameForRename); + destination.setFile(destination.absolutePath()+CURRENTSEPARATOR+QString::fromStdString(nameForRename)); else { QString tempDestination=destination.absoluteFilePath(); QFile destinationFile(tempDestination); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("rename %1: to: %2").arg(destination.absoluteFilePath()).arg(destination.absolutePath()+QDir::separator()+nameForRename)); - if(!destinationFile.rename(destination.absolutePath()+QDir::separator()+nameForRename)) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"["+std::to_string(id)+"] "+QStringLiteral("rename %1: to: %2").arg(destination.absoluteFilePath()).arg(destination.absolutePath()+CURRENTSEPARATOR+QString::fromStdString(nameForRename)).toStdString()); + if(!destinationFile.rename(destination.absolutePath()+CURRENTSEPARATOR+QString::fromStdString(nameForRename))) { if(!destinationFile.exists()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("source not exists %1: destination: %2, error: %3").arg(destinationFile.fileName()).arg(destinationFile.fileName()).arg(destinationFile.errorString())); - emit errorOnFile(destinationFile,tr("File not found")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("source not exists %1: destination: %2, error: %3").arg(destinationFile.fileName()).arg(destinationFile.fileName()).arg(destinationFile.errorString()).toStdString()); + emit errorOnFile(destinationFile,tr("File not found").toStdString()); return; } else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("unable to do real move %1: %2, error: %3").arg(destinationFile.fileName()).arg(destinationFile.fileName()).arg(destinationFile.errorString())); - emit errorOnFile(destinationFile,destinationFile.errorString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("unable to do real move %1: %2, error: %3").arg(destinationFile.fileName()).arg(destinationFile.fileName()).arg(destinationFile.errorString()).toStdString()); + emit errorOnFile(destinationFile,destinationFile.errorString().toStdString()); return; } if(source.absoluteFilePath()==destination.absoluteFilePath()) - source.setFile(destination.absolutePath()+QDir::separator()+nameForRename); + source.setFile(destination.absolutePath()+CURRENTSEPARATOR+QString::fromStdString(nameForRename)); destination.setFile(tempDestination); destination.refresh(); } fileExistsAction = FileExists_NotSet; resetExtraVariable(); emit internalStartPreOperation(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("destination is: %1").arg(destination.absoluteFilePath())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] destination is: "+destination.absoluteFilePath().toStdString()); } void TransferThread::setAlwaysFileExistsAction(const FileExistsAction &action) { - //ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] action to do always: ")+QString::number(action))); + //ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+QStringLiteral("] action to do always: ")+QString::number(action))); alwaysDoFileExistsAction=action; } @@ -283,39 +291,39 @@ void TransferThread::preOperation() { if(transfer_stat!=TransferStat_PreOperation) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] already used, source: ")+source.absoluteFilePath()+QStringLiteral(", destination: ")+destination.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+("] already used, source: ")+source.absoluteFilePath().toStdString()+", destination: "+destination.absoluteFilePath().toStdString()); return; } haveStartTime=true; startTransferTime.restart(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start: source: ")+source.absoluteFilePath()+QStringLiteral(", destination: ")+destination.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start: source: "+source.absoluteFilePath().toStdString()+", destination: "+destination.absoluteFilePath().toStdString()); needRemove=false; if(isSame()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] is same ")+source.absoluteFilePath()+QStringLiteral(" than ")+destination.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] is same "+source.absoluteFilePath().toStdString()+" than "+destination.absoluteFilePath().toStdString()); return; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] after is same")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] after is same"); /*Why this code? if(readError) { readError=false; return; }*/ - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] before destination exists")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] before destination exists"); if(destinationExists()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] destination exists: ")+destination.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] destination exists: "+destination.absoluteFilePath().toStdString()); return; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] after destination exists")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] after destination exists"); /*Why this code? if(readError) { readError=false; return; }*/ - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] before keep date")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] before keep date"); #ifdef Q_OS_WIN32 doTheDateTransfer=!source.isSymLink(); #else @@ -329,11 +337,11 @@ void TransferThread::preOperation() doTheDateTransfer=false; else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("the sources is older to copy the time: ")+source.absoluteFilePath()+QStringLiteral(": ")+minTime.toString(QStringLiteral("dd.MM.yyyy hh:mm:ss.zzz"))+QStringLiteral(">=")+source.lastModified().toString(QStringLiteral("dd.MM.yyyy hh:mm:ss.zzz"))); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"the sources is older to copy the time: "+source.absoluteFilePath().toStdString()+": "+minTime.toString(QStringLiteral("dd.MM.yyyy hh:mm:ss.zzz")).toStdString()+">="+source.lastModified().toString(QStringLiteral("dd.MM.yyyy hh:mm:ss.zzz")).toStdString()); doTheDateTransfer=false; if(keepDate) { - emit errorOnFile(source,tr("Wrong modification date or unable to get it, you can disable time transfer to do it")); + emit errorOnFile(source,tr("Wrong modification date or unable to get it, you can disable time transfer to do it").toStdString()); return; } } @@ -342,15 +350,15 @@ void TransferThread::preOperation() { doTheDateTransfer=readFileDateTime(source); #ifdef Q_OS_MAC - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] read the source time: ")+QString::number(butime.modtime)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] read the source time: "+std::to_string(butime.modtime)); #endif if(!doTheDateTransfer) { //will have the real error at source open - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] unable to read the source time: ")+source.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] unable to read the source time: "+source.absoluteFilePath().toStdString()); if(keepDate) { - emit errorOnFile(source,tr("Wrong modification date or unable to get it, you can disable time transfer to do it")); + emit errorOnFile(source,tr("Wrong modification date or unable to get it, you can disable time transfer to do it").toStdString()); return; } } @@ -358,7 +366,7 @@ void TransferThread::preOperation() } if(canBeMovedDirectly()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("need moved directly: %1 to %2").arg(source.absoluteFilePath()).arg(destination.absoluteFilePath())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] "+QStringLiteral("need moved directly: %1 to %2").arg(source.absoluteFilePath()).arg(destination.absoluteFilePath()).toStdString()); canBeMovedDirectlyVariable=true; readThread.fakeOpen(); writeThread.fakeOpen(); @@ -366,7 +374,7 @@ void TransferThread::preOperation() } if(canBeCopiedDirectly()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("need copied directly: %1 to %2").arg(source.absoluteFilePath()).arg(destination.absoluteFilePath())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] "+QStringLiteral("need copied directly: %1 to %2").arg(source.absoluteFilePath()).arg(destination.absoluteFilePath()).toStdString()); canBeCopiedDirectlyVariable=true; readThread.fakeOpen(); writeThread.fakeOpen(); @@ -377,14 +385,14 @@ void TransferThread::preOperation() void TransferThread::tryOpen() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start source and destination: ")+source.absoluteFilePath()+QStringLiteral(" and ")+destination.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start source and destination: "+source.absoluteFilePath().toStdString()+" and "+destination.absoluteFilePath().toStdString()); TransferAlgorithm transferAlgorithm=this->transferAlgorithm; if(transferAlgorithm==TransferAlgorithm_Automatic) { #ifdef Q_OS_LINUX - if(driveManagement.isSameDrive(destination.absoluteFilePath(),source.absoluteFilePath())) + if(driveManagement.isSameDrive(destination.absoluteFilePath().toStdString(),source.absoluteFilePath().toStdString())) { - const QByteArray &type=driveManagement.getDriveType(driveManagement.getDrive(source.absoluteFilePath())); + const QByteArray &type=driveManagement.getDriveType(driveManagement.getDrive(source.absoluteFilePath().toStdString())); if(type=="nfs" || type=="smb") transferAlgorithm=TransferAlgorithm_Parallel; else @@ -404,8 +412,8 @@ void TransferThread::tryOpen() } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("readIsOpeningVariable is true when try open")); - emit errorOnFile(source,tr("Internal error: Already opening")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] readIsOpeningVariable is true when try open"); + emit errorOnFile(source,tr("Internal error: Already opening").toStdString()); readError=true; return; } @@ -415,9 +423,9 @@ void TransferThread::tryOpen() if(!writeIsOpeningVariable) { if(transferAlgorithm==TransferAlgorithm_Sequential) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] transferAlgorithm==TransferAlgorithm_Sequential")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] transferAlgorithm==TransferAlgorithm_Sequential"); else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] transferAlgorithm==TransferAlgorithm_Parallel")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] transferAlgorithm==TransferAlgorithm_Parallel"); writeError=false; if(transferAlgorithm==TransferAlgorithm_Sequential) writeThread.open(destination.absoluteFilePath(),size,osBuffer && (!osBufferLimited || (osBufferLimited && size %4: %2, error: %3").arg(sourceFile.fileName()).arg(destinationFile.fileName()).arg(sourceFile.errorString()).arg(sourceFile.symLinkTarget())); - emit errorOnFile(sourceFile,tr("The source file doesn't exist")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("source not exists %1 -> %4: %2, error: %3").arg(sourceFile.fileName()).arg(destinationFile.fileName()).arg(sourceFile.errorString()).arg(sourceFile.symLinkTarget()).toStdString()); + emit errorOnFile(sourceFile,tr("The source file doesn't exist").toStdString()); return; } else if(destinationFile.exists() || destination.isSymLink()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("destination already exists %1 -> %4: %2, error: %3").arg(sourceFile.fileName()).arg(destinationFile.fileName()).arg(sourceFile.errorString()).arg(sourceFile.symLinkTarget())); - emit errorOnFile(sourceFile,tr("Another file exists at same place")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("destination already exists %1 -> %4: %2, error: %3").arg(sourceFile.fileName()).arg(destinationFile.fileName()).arg(sourceFile.errorString()).arg(sourceFile.symLinkTarget()).toStdString()); + emit errorOnFile(sourceFile,tr("Another file exists at same place").toStdString()); return; } else if(!dir.exists()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("destination folder not exists %1 -> %4: %2, error: %3").arg(sourceFile.fileName()).arg(destinationFile.fileName()).arg(sourceFile.errorString()).arg(sourceFile.symLinkTarget())); - emit errorOnFile(sourceFile,tr("Unable to do the folder")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("destination folder not exists %1 -> %4: %2, error: %3").arg(sourceFile.fileName()).arg(destinationFile.fileName()).arg(sourceFile.errorString()).arg(sourceFile.symLinkTarget()).toStdString()); + emit errorOnFile(sourceFile,tr("Unable to do the folder").toStdString()); return; } else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("unable to do sym link copy %1 -> %4: %2, error: %3").arg(sourceFile.fileName()).arg(destinationFile.fileName()).arg(sourceFile.errorString()).arg(sourceFile.symLinkTarget())); - emit errorOnFile(sourceFile,sourceFile.errorString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("unable to do sym link copy %1 -> %4: %2, error: %3").arg(sourceFile.fileName()).arg(destinationFile.fileName()).arg(sourceFile.errorString()).arg(sourceFile.symLinkTarget()).toStdString()); + emit errorOnFile(sourceFile,sourceFile.errorString().toStdString()); return; } readThread.fakeReadIsStarted(); @@ -843,10 +852,10 @@ bool TransferThread::canBeMovedDirectly() const { if(mode!=Ultracopier::Move) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("mode!=Ultracopier::Move")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] mode!=Ultracopier::Move"); return false; } - return source.isSymLink() || driveManagement.isSameDrive(destination.absoluteFilePath(),source.absoluteFilePath()); + return source.isSymLink() || driveManagement.isSameDrive(destination.absoluteFilePath().toStdString(),source.absoluteFilePath().toStdString()); } bool TransferThread::canBeCopiedDirectly() const @@ -858,10 +867,10 @@ void TransferThread::readIsReady() { if(readIsReadyVariable) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] double event dropped")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] double event dropped"); return; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start"); readIsReadyVariable=true; readIsOpenVariable=true; readIsClosedVariable=false; @@ -871,13 +880,13 @@ void TransferThread::readIsReady() void TransferThread::ifCanStartTransfer() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] readIsReadyVariable: ")+QString::number(readIsReadyVariable)+QStringLiteral(", writeIsReadyVariable: ")+QString::number(writeIsReadyVariable)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] readIsReadyVariable: "+std::to_string(readIsReadyVariable)+", writeIsReadyVariable: "+std::to_string(writeIsReadyVariable)); if(readIsReadyVariable && writeIsReadyVariable) { transfer_stat=TransferStat_WaitForTheTransfer; sended_state_readStopped = false; sended_state_writeStopped = false; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] stat=WaitForTheTransfer")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] stat=WaitForTheTransfer"); if(!sended_state_preOperationStopped) { sended_state_preOperationStopped=true; @@ -885,7 +894,7 @@ void TransferThread::ifCanStartTransfer() } if(canStartTransfer) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] stat=Transfer, ")+QStringLiteral("canBeMovedDirectlyVariable: %1, canBeCopiedDirectlyVariable: %2").arg(canBeMovedDirectlyVariable).arg(canBeCopiedDirectlyVariable)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] stat=Transfer, "+QStringLiteral("canBeMovedDirectlyVariable: %1, canBeCopiedDirectlyVariable: %2").arg(canBeMovedDirectlyVariable).arg(canBeCopiedDirectlyVariable).toStdString()); transfer_stat=TransferStat_Transfer; if(canBeMovedDirectlyVariable) tryMoveDirectly(); @@ -907,10 +916,10 @@ void TransferThread::writeIsReady() { if(writeIsReadyVariable) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] double event dropped")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] double event dropped"); return; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start"); writeIsReadyVariable=true; writeIsOpenVariable=true; writeIsClosedVariable=false; @@ -955,7 +964,7 @@ void TransferThread::pause() //from transfer_stat!=TransferStat_Idle because it resume at wrong order if(transfer_stat!=TransferStat_Transfer && transfer_stat!=TransferStat_PostTransfer && transfer_stat!=TransferStat_Checksum) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] wrong stat to put in pause")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] wrong stat to put in pause"); return; } haveStartTime=false; @@ -970,7 +979,7 @@ void TransferThread::resume() //from transfer_stat!=TransferStat_Idle because it resume at wrong order if(transfer_stat!=TransferStat_Transfer && transfer_stat!=TransferStat_PostTransfer && transfer_stat!=TransferStat_Checksum) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] wrong stat to put in pause")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] wrong stat to put in pause"); return; } readThread.resume(); @@ -984,34 +993,34 @@ void TransferThread::stop() haveStartTime=false; if(transfer_stat==TransferStat_Idle) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("transfer_stat==TransferStat_Idle")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"transfer_stat==TransferStat_Idle"); return; } if(remainSourceOpen()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("remainSourceOpen()")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"remainSourceOpen()"); readThread.stop(); } if(remainDestinationOpen()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("remainDestinationOpen()")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"remainDestinationOpen()"); writeThread.stop(); } if(!remainFileOpen()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("transfer_stat==TransferStat_Idle")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"transfer_stat==TransferStat_Idle"); if(needRemove && source.absoluteFilePath()!=destination.absoluteFilePath()) { if(source.exists()) QFile(destination.absoluteFilePath()).remove(); else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] try destroy the destination when the source don't exists")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+("] try destroy the destination when the source don't exists")); } transfer_stat=TransferStat_PostOperation; emit internalStartPostOperation(); } else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("transfer_stat==%1 && remainFileOpen()").arg(transfer_stat)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("transfer_stat==%1 && remainFileOpen()").arg(transfer_stat).toStdString()); } bool TransferThread::remainFileOpen() const @@ -1033,10 +1042,10 @@ void TransferThread::readIsFinish() { if(readIsFinishVariable) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] double event dropped")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+("] double event dropped")); return; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start"); readIsFinishVariable=true; canStartTransfer=false; //check here if need start checksuming or not @@ -1055,7 +1064,7 @@ void TransferThread::readIsFinish() if(!needSkip || (canBeCopiedDirectlyVariable || canBeMovedDirectlyVariable))//if skip, stop call, then readIsClosed() already call readThread.postOperation(); else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] in skip, don't start postOperation")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] in skip, don't start postOperation"); } emit pushStat(transfer_stat,transferId); } @@ -1064,10 +1073,10 @@ void TransferThread::writeIsFinish() { if(writeIsFinishVariable) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] double event dropped")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+"] double event dropped"); return; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start"); writeIsFinishVariable=true; //check here if need start checksuming or not if(real_doChecksum) @@ -1081,7 +1090,7 @@ void TransferThread::writeIsFinish() if(!needSkip || (canBeCopiedDirectlyVariable || canBeMovedDirectlyVariable))//if skip, stop call, then writeIsClosed() already call writeThread.postOperation(); else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] in skip, don't start postOperation")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] in skip, don't start postOperation"); } } @@ -1101,17 +1110,17 @@ void TransferThread::compareChecksum() { if(sourceChecksum.size()==0) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] the checksum of source is missing")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] the checksum of source is missing"); return; } if(destinationChecksum.size()==0) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] the checksum of destination is missing")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] the checksum of destination is missing"); return; } if(sourceChecksum==destinationChecksum) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] the checksum match")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] the checksum match"); readThread.postOperation(); writeThread.postOperation(); transfer_stat=TransferStat_PostTransfer; @@ -1119,9 +1128,9 @@ void TransferThread::compareChecksum() } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] the checksum not match")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+("] the checksum not match")); //emit error here, and wait to resume - emit errorOnFile(destination,tr("The checksums do not match")); + emit errorOnFile(destination,tr("The checksums do not match").toStdString()); } } @@ -1129,10 +1138,10 @@ void TransferThread::readIsClosed() { if(readIsClosedVariable) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] double event dropped")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+("] double event dropped")); return; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start"); readIsClosedVariable=true; readIsOpeningVariable=false; checkIfAllIsClosedAndDoOperations(); @@ -1142,10 +1151,10 @@ void TransferThread::writeIsClosed() { if(writeIsClosedVariable) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] double event dropped")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+"] double event dropped"); return; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start"); writeIsClosedVariable=true; writeIsOpeningVariable=false; if(stopIt && needRemove && source.absoluteFilePath()!=destination.absoluteFilePath()) @@ -1153,7 +1162,7 @@ void TransferThread::writeIsClosed() if(source.exists()) QFile(destination.absoluteFilePath()).remove(); else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] try destroy the destination when the source don't exists")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+("] try destroy the destination when the source don't exists")); } checkIfAllIsClosedAndDoOperations(); } @@ -1163,12 +1172,12 @@ bool TransferThread::checkIfAllIsClosedAndDoOperations() { if((readError || writeError) && !needSkip && !stopIt) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] resolve error before progress")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] resolve error before progress"); return false; } if(!remainFileOpen()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] emit internalStartPostOperation() to do the real post operation")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] emit internalStartPostOperation() to do the real post operation"); transfer_stat=TransferStat_PostOperation; //emit pushStat(stat,transferId); emit internalStartPostOperation(); @@ -1176,11 +1185,12 @@ bool TransferThread::checkIfAllIsClosedAndDoOperations() } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("wait self close: readIsReadyVariable: %1, readIsClosedVariable: %2, writeIsReadyVariable: %3, writeIsClosedVariable: %4") + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] "+QStringLiteral("wait self close: readIsReadyVariable: %1, readIsClosedVariable: %2, writeIsReadyVariable: %3, writeIsClosedVariable: %4") .arg(readIsReadyVariable) .arg(readIsClosedVariable) .arg(writeIsReadyVariable) .arg(writeIsClosedVariable) + .toStdString() ); return false; } @@ -1192,14 +1202,14 @@ void TransferThread::postOperation() { if(transfer_stat!=TransferStat_PostOperation) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] need be in transfer, source: ")+source.absoluteFilePath()+QStringLiteral(", destination: ")+destination.absoluteFilePath()+QStringLiteral(", stat:")+QString::number(transfer_stat)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+"] need be in transfer, source: "+source.absoluteFilePath().toStdString()+", destination: "+destination.absoluteFilePath().toStdString()+", stat:"+std::to_string(transfer_stat)); return; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start"); //all except closing if((readError || writeError) && !needSkip && !stopIt)//normally useless by checkIfAllIsFinish() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] resume after error")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] resume after error"); return; } @@ -1209,8 +1219,8 @@ void TransferThread::postOperation() { if(writeIsOpenVariable && !writeIsClosedVariable) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] can't pass in post operation if write is not closed")); - emit errorOnFile(destination,tr("Internal error: The destination is not closed")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+("] can't pass in post operation if write is not closed")); + emit errorOnFile(destination,tr("Internal error: The destination is not closed").toStdString()); needSkip=false; if(deletePartiallyTransferredFiles) needRemove=true; @@ -1220,11 +1230,12 @@ void TransferThread::postOperation() if(readThread.getLastGoodPosition()!=writeThread.getLastGoodPosition()) { writeThread.flushBuffer(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] readThread.getLastGoodPosition(%1)!=writeThread.getLastGoodPosition(%2)") + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+QString("] readThread.getLastGoodPosition(%1)!=writeThread.getLastGoodPosition(%2)") .arg(readThread.getLastGoodPosition()) .arg(writeThread.getLastGoodPosition()) + .toStdString() ); - emit errorOnFile(destination,tr("Internal error: The size transfered doesn't match")); + emit errorOnFile(destination,tr("Internal error: The size transfered doesn't match").toStdString()); needSkip=false; if(deletePartiallyTransferredFiles) needRemove=true; @@ -1234,8 +1245,8 @@ void TransferThread::postOperation() if(!writeThread.bufferIsEmpty()) { writeThread.flushBuffer(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] buffer is not empty")); - emit errorOnFile(destination,tr("Internal error: The buffer is not empty")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+("] buffer is not empty")); + emit errorOnFile(destination,tr("Internal error: The buffer is not empty").toStdString()); needSkip=false; if(deletePartiallyTransferredFiles) needRemove=true; @@ -1256,12 +1267,12 @@ void TransferThread::postOperation() if(!sourceFile.remove()) { needSkip=false; - emit errorOnFile(source,sourceFile.errorString()); + emit errorOnFile(source,sourceFile.errorString().toStdString()); return; } } else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] try remove source but destination not exists!")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+("] try remove source but destination not exists!")); } } else//do difference skip a file and skip this error case @@ -1276,14 +1287,14 @@ void TransferThread::postOperation() } } else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] try remove destination but not exists!")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] try remove destination but not exists!"); } source.setFile(QStringLiteral("")); destination.setFile(QStringLiteral("")); //don't need remove because have correctly finish (it's not in: have started) needRemove=false; needSkip=false; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] emit postOperationStopped()")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] emit postOperationStopped()"); transfer_stat=TransferStat_Idle; emit postOperationStopped(); } @@ -1299,8 +1310,8 @@ bool TransferThread::doFilePostOperation() if(!stopIt) if(/*true when the destination have been remove but not the symlink:*/!source.isSymLink()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("Unable to change the date: File not found")); - emit errorOnFile(destination,tr("Unable to change the date")+QStringLiteral(": ")+tr("File not found")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] Unable to change the date: File not found"); + emit errorOnFile(destination,tr("Unable to change the date").toStdString()+": "+tr("File not found").toStdString()); return false; } } @@ -1311,14 +1322,14 @@ bool TransferThread::doFilePostOperation() if(!writeFileDateTime(destination)) { if(!destination.isFile()) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("Unable to change the date (is not a file)")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] Unable to change the date (is not a file)"); else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("Unable to change the date")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] Unable to change the date"); /* error with virtual folder under windows */ #ifndef Q_OS_WIN32 if(keepDate) { - emit errorOnFile(destination,tr("Unable to change the date")); + emit errorOnFile(destination,tr("Unable to change the date").toStdString()); return false; } #endif @@ -1327,13 +1338,13 @@ bool TransferThread::doFilePostOperation() { #ifndef Q_OS_WIN32 destination.refresh(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] read the destination time: ")+destination.lastModified().toString()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] read the destination time: "+destination.lastModified().toString().toStdString()); if(destination.lastModified()ULTRACOPIER_PLUGIN_MAX_PARALLEL_NUMBER_OF_BLOCK) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] wrong parallelBuffer: ")+QString::number(parallelBuffer)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] wrong parallelBuffer: "+std::to_string(parallelBuffer)); return false; } else @@ -1627,7 +1638,7 @@ bool TransferThread::setSequentialBuffer(const int &sequentialBuffer) { if(sequentialBuffer<1 || sequentialBuffer>ULTRACOPIER_PLUGIN_MAX_SEQUENTIAL_NUMBER_OF_BLOCK) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] wrong sequentialBuffer: ")+QString::number(sequentialBuffer)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] wrong sequentialBuffer: "+std::to_string(sequentialBuffer)); return false; } else @@ -1641,20 +1652,20 @@ void TransferThread::setTransferAlgorithm(const TransferAlgorithm &transferAlgor { this->transferAlgorithm=transferAlgorithm; if(transferAlgorithm==TransferAlgorithm_Sequential) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("]transferAlgorithm==TransferAlgorithm_Sequential")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] transferAlgorithm==TransferAlgorithm_Sequential"); else if(transferAlgorithm==TransferAlgorithm_Automatic) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("]transferAlgorithm==TransferAlgorithm_Automatic")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] transferAlgorithm==TransferAlgorithm_Automatic"); else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("]transferAlgorithm==TransferAlgorithm_Parallel")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] transferAlgorithm==TransferAlgorithm_Parallel"); } //fonction to edit the file date time bool TransferThread::readFileDateTime(const QFileInfo &source) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] readFileDateTime(")+source.absoluteFilePath()+QStringLiteral(")")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] readFileDateTime("+source.absoluteFilePath().toStdString()+")"); if(source.lastModified()ftCreateL=ftCreate.dwLowDateTime; @@ -1733,7 +1743,7 @@ bool TransferThread::readFileDateTime(const QFileInfo &source) bool TransferThread::writeFileDateTime(const QFileInfo &destination) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] writeFileDateTime(")+destination.absoluteFilePath()+QStringLiteral(")")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] writeFileDateTime("+destination.absoluteFilePath().toStdString()+")"); /** Why not do it with Qt? Because it not support setModificationTime(), and get the time with Qt, that's mean use local time where in C is UTC time */ #ifdef Q_OS_UNIX #ifdef Q_OS_LINUX @@ -1747,14 +1757,14 @@ bool TransferThread::writeFileDateTime(const QFileInfo &destination) return utime(destination.toLatin1().data(),&butime)==0; #else wchar_t filePath[65535]; - if(destination.absoluteFilePath().contains(regRead)) + if(std::regex_match(destination.absoluteFilePath().toStdString(),regRead)) filePath[QDir::toNativeSeparators(QStringLiteral("\\\\?\\")+destination.absoluteFilePath()).toWCharArray(filePath)]=L'\0'; else filePath[QDir::toNativeSeparators(destination.absoluteFilePath()).toWCharArray(filePath)]=L'\0'; HANDLE hFileDestination = CreateFileW(filePath, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); if(hFileDestination == INVALID_HANDLE_VALUE) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] open failed to write: ")+QString::fromWCharArray(filePath)+QStringLiteral(", error: ")+QString::number(GetLastError())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] open failed to write: "+QString::fromWCharArray(filePath).toStdString()+", error: "+std::to_string(GetLastError())); return false; } FILETIME ftCreate, ftAccess, ftWrite; @@ -1767,7 +1777,7 @@ bool TransferThread::writeFileDateTime(const QFileInfo &destination) if(!SetFileTime(hFileDestination, &ftCreate, &ftAccess, &ftWrite)) { CloseHandle(hFileDestination); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] unable to set the file time")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] unable to set the file time"); return false; } CloseHandle(hFileDestination); @@ -1783,9 +1793,9 @@ bool TransferThread::writeFileDateTime(const QFileInfo &destination) //skip the copy void TransferThread::skip() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start with stat: ")+QString::number(transfer_stat)); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] readIsOpeningVariable: ")+QString::number(readIsOpeningVariable)+QStringLiteral(", readIsOpenVariable: ")+QString::number(readIsOpenVariable)+QStringLiteral(", readIsReadyVariable: ")+QString::number(readIsReadyVariable)+QStringLiteral(", readIsFinishVariable: ")+QString::number(readIsFinishVariable)+QStringLiteral(", readIsClosedVariable: ")+QString::number(readIsClosedVariable)); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] writeIsOpeningVariable: ")+QString::number(writeIsOpeningVariable)+QStringLiteral(", writeIsOpenVariable: ")+QString::number(writeIsOpenVariable)+QStringLiteral(", writeIsReadyVariable: ")+QString::number(writeIsReadyVariable)+QStringLiteral(", writeIsFinishVariable: ")+QString::number(writeIsFinishVariable)+QStringLiteral(", writeIsClosedVariable: ")+QString::number(writeIsClosedVariable)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start with stat: "+std::to_string(transfer_stat)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] readIsOpeningVariable: "+std::to_string(readIsOpeningVariable)+", readIsOpenVariable: "+std::to_string(readIsOpenVariable)+", readIsReadyVariable: "+std::to_string(readIsReadyVariable)+", readIsFinishVariable: "+std::to_string(readIsFinishVariable)+", readIsClosedVariable: "+std::to_string(readIsClosedVariable)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] writeIsOpeningVariable: "+std::to_string(writeIsOpeningVariable)+", writeIsOpenVariable: "+std::to_string(writeIsOpenVariable)+", writeIsReadyVariable: "+std::to_string(writeIsReadyVariable)+", writeIsFinishVariable: "+std::to_string(writeIsFinishVariable)+", writeIsClosedVariable: "+std::to_string(writeIsClosedVariable)); switch(transfer_stat) { case TransferStat_WaitForTheTransfer: @@ -1793,7 +1803,7 @@ void TransferThread::skip() case TransferStat_PreOperation: if(needSkip) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] skip already in progress")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] skip already in progress"); return; } needSkip=true; @@ -1815,14 +1825,14 @@ void TransferThread::skip() case TransferStat_PostTransfer: if(needSkip) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] skip already in progress")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] skip already in progress"); return; } //needRemove=true;never put that's here, can product destruction of the file needSkip=true; if(canBeMovedDirectlyVariable || canBeCopiedDirectlyVariable) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] Do the direct FS fake close, canBeMovedDirectlyVariable: ")+QString::number(canBeMovedDirectlyVariable)+QStringLiteral(", canBeCopiedDirectlyVariable: ")+QString::number(canBeCopiedDirectlyVariable)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] Do the direct FS fake close, canBeMovedDirectlyVariable: "+std::to_string(canBeMovedDirectlyVariable)+", canBeCopiedDirectlyVariable: "+std::to_string(canBeCopiedDirectlyVariable)); readThread.fakeReadIsStarted(); writeThread.fakeWriteIsStarted(); readThread.fakeReadIsStopped(); @@ -1846,7 +1856,7 @@ void TransferThread::skip() case TransferStat_Checksum: if(needSkip) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] skip already in progress")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] skip already in progress"); return; } //needRemove=true;never put that's here, can product destruction of the file @@ -1867,7 +1877,7 @@ void TransferThread::skip() case TransferStat_PostOperation: if(needSkip) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] skip already in progress")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] skip already in progress"); return; } //needRemove=true;never put that's here, can product destruction of the file @@ -1876,13 +1886,13 @@ void TransferThread::skip() emit internalStartPostOperation(); break; default: - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] can skip in this state: ")+QString::number(transfer_stat)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] can skip in this state: "+std::to_string(transfer_stat)); return; } } //return info about the copied size -qint64 TransferThread::copiedSize() +int64_t TransferThread::copiedSize() { switch(transfer_stat) { @@ -1925,7 +1935,7 @@ void TransferThread::setId(int id) writeThread.setId(id); } -QChar TransferThread::readingLetter() const +char TransferThread::readingLetter() const { switch(readThread.stat) { @@ -1949,7 +1959,7 @@ QChar TransferThread::readingLetter() const } } -QChar TransferThread::writingLetter() const +char TransferThread::writingLetter() const { switch(writeThread.stat) { @@ -2010,7 +2020,7 @@ void TransferThread::set_osBufferLimited(bool osBufferLimited) } //not copied size, because that's count to the checksum, ... -quint64 TransferThread::realByteTransfered() const +uint64_t TransferThread::realByteTransfered() const { switch(transfer_stat) { @@ -2027,16 +2037,16 @@ quint64 TransferThread::realByteTransfered() const } //first is read, second is write -QPair TransferThread::progression() const +std::pair TransferThread::progression() const { - QPair returnVar; + std::pair returnVar; switch(transfer_stat) { case TransferStat_Transfer: returnVar.first=readThread.getLastGoodPosition(); returnVar.second=writeThread.getLastGoodPosition(); /*if(returnVar.first TransferThread::progression() const returnVar.first=transferSize; returnVar.second=writeThread.getLastGoodPosition(); /*if(returnVar.first TransferThread::progression() const return returnVar; } -void TransferThread::setRenamingRules(const QString &firstRenamingRule,const QString &otherRenamingRule) +void TransferThread::setRenamingRules(const std::string &firstRenamingRule, const std::string &otherRenamingRule) { this->firstRenamingRule=firstRenamingRule; this->otherRenamingRule=otherRenamingRule; diff --git a/plugins/CopyEngine/Ultracopier/TransferThread.h b/plugins/CopyEngine/Ultracopier/TransferThread.h index 051375e..e1a3b3f 100644 --- a/plugins/CopyEngine/Ultracopier/TransferThread.h +++ b/plugins/CopyEngine/Ultracopier/TransferThread.h @@ -8,12 +8,12 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include -#include +#include #ifdef Q_OS_UNIX #include @@ -50,16 +50,16 @@ public: /// \brief to set the id void setId(int id); /// \brief get the reading letter - QChar readingLetter() const; + char readingLetter() const; /// \brief get the writing letter - QChar writingLetter() const; + char writingLetter() const; #endif /// \brief to have semaphore, and try create just one by one void setMkpathTransfer(QSemaphore *mkpathTransfer); /// \brief to store the transfer id - quint64 transferId; + uint64_t transferId; /// \brief to store the transfer size - quint64 transferSize; + uint64_t transferSize; bool haveStartTime; QTime startTransferTime; @@ -70,11 +70,11 @@ public: void set_osBufferLimited(bool osBufferLimited); //not copied size, because that's count to the checksum, ... - quint64 realByteTransfered() const; - QPair progression() const; - static QString resolvedName(const QFileInfo &inode); - QString getSourcePath() const; - QString getDestinationPath() const; + uint64_t realByteTransfered() const; + std::pair progression() const; + static std::string resolvedName(const QFileInfo &inode); + std::string getSourcePath() const; + std::string getDestinationPath() const; QFileInfo getSourceInode() const; QFileInfo getDestinationInode() const; Ultracopier::CopyMode getMode() const; @@ -90,27 +90,27 @@ signals: void postOperationStopped() const; //get dialog void fileAlreadyExists(const QFileInfo &info,const QFileInfo &info2,const bool &isSame) const; - void errorOnFile(const QFileInfo &info,const QString &string,const ErrorType &errorType=ErrorType_Normal) const; + void errorOnFile(const QFileInfo &info,const std::string &string,const ErrorType &errorType=ErrorType_Normal) const; //internal signal void internalStartPostOperation() const; void internalStartPreOperation() const; void internalStartResumeAfterErrorAndSeek() const; /// \brief To debug source - void debugInformation(const Ultracopier::DebugLevel &level,QString fonction,QString text,QString file,int ligne) const; + void debugInformation(const Ultracopier::DebugLevel &level,std::string fonction,std::string text,std::string file,int ligne) const; void tryPutAtBottom() const; //force into the right thread void internalTryStartTheTransfer() const; /// \brief update the transfer stat - void pushStat(const TransferStat &stat,const quint64 &pos) const; + void pushStat(const TransferStat &stat,const uint64_t &pos) const; public slots: /// \brief to start the transfer of data void startTheTransfer(); /// \brief to set files to transfer - bool setFiles(const QFileInfo& source,const qint64 &size,const QFileInfo& destination,const Ultracopier::CopyMode &mode); + bool setFiles(const QFileInfo& source,const int64_t &size,const QFileInfo& destination,const Ultracopier::CopyMode &mode); /// \brief to set file exists action to do void setFileExistsAction(const FileExistsAction &action); /// \brief to set the new name of the destination - void setFileRename(const QString &nameForRename); + void setFileRename(const std::string &nameForRename); /// \brief to start the transfer of data void setAlwaysFileExistsAction(const FileExistsAction &action); /// \brief set the copy info and options before runing @@ -134,7 +134,7 @@ public slots: /// \brief retry after error void retryAfterError(); /// \brief return info about the copied size - qint64 copiedSize(); + int64_t copiedSize(); /// \brief put the current file at bottom void putAtBottom(); @@ -143,7 +143,7 @@ public slots: #endif void set_osBufferLimit(const unsigned int &osBufferLimit); - void setRenamingRules(const QString &firstRenamingRule,const QString &otherRenamingRule); + void setRenamingRules(const std::string &firstRenamingRule,const std::string &otherRenamingRule); #ifdef ULTRACOPIER_PLUGIN_SPEED_SUPPORT //speed limitation void timeOfTheBlockCopyFinished(); @@ -216,7 +216,7 @@ private: bool retry; QFileInfo source; QFileInfo destination; - qint64 size; + int64_t size; FileExistsAction fileExistsAction; FileExistsAction alwaysDoFileExistsAction; bool needSkip,needRemove; @@ -230,8 +230,8 @@ private: bool osBuffer; bool osBufferLimited; unsigned int osBufferLimit; - QString firstRenamingRule; - QString otherRenamingRule; + std::string firstRenamingRule; + std::string otherRenamingRule; //error management bool writeError,writeError_source_seeked,writeError_destination_reopened; bool readError; @@ -241,7 +241,7 @@ private: int parallelBuffer; int sequentialBuffer; int parallelizeIfSmallerThan; - QRegularExpression renameRegex; + std::regex renameRegex; TransferAlgorithm transferAlgorithm; #ifdef Q_OS_UNIX utimbuf butime; @@ -250,9 +250,9 @@ private: #ifdef ULTRACOPIER_PLUGIN_SET_TIME_UNIX_WAY utimbuf butime; #else - quint32 ftCreateL, ftAccessL, ftWriteL; - quint32 ftCreateH, ftAccessH, ftWriteH; - QRegularExpression regRead; + uint32_t ftCreateL, ftAccessL, ftWriteL; + uint32_t ftCreateH, ftAccessH, ftWriteH; + std::regex regRead; #endif #endif #endif diff --git a/plugins/CopyEngine/Ultracopier/WriteThread.cpp b/plugins/CopyEngine/Ultracopier/WriteThread.cpp index 42b3551..9993961 100644 --- a/plugins/CopyEngine/Ultracopier/WriteThread.cpp +++ b/plugins/CopyEngine/Ultracopier/WriteThread.cpp @@ -63,26 +63,26 @@ void WriteThread::run() bool WriteThread::internalOpen() { //do a bug - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] internalOpen destination: ")+file.fileName()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] internalOpen destination: "+file.fileName().toStdString()); if(stopIt) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] close because stopIt is at true")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] close because stopIt is at true"); emit closed(); return false; } if(file.isOpen()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] already open! destination: ")+file.fileName()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] already open! destination: "+file.fileName().toStdString()); return false; } if(file.fileName().isEmpty()) { - errorString_internal=tr("Path resolution error (Empty path)"); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("Unable to open: %1, error: %2").arg(file.fileName()).arg(errorString_internal)); + errorString_internal=tr("Path resolution error (Empty path)").toStdString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("Unable to open: %1, error: %2").arg(file.fileName()).arg(QString::fromStdString(errorString_internal)).toStdString()); emit error(); return false; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] before the mutex")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] before the mutex"); //set to LISTBLOCKSIZE if(sequential) { @@ -98,7 +98,7 @@ bool WriteThread::internalOpen() if(writeFull.available()>numberOfBlock) writeFull.acquire(writeFull.available()-numberOfBlock); } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] after the mutex")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] after the mutex"); stopIt=false; endDetected=false; #ifdef ULTRACOPIER_PLUGIN_DEBUG @@ -111,17 +111,18 @@ bool WriteThread::internalOpen() mkpathTransfer->acquire(); if(!destinationFolder.exists(destinationInfo.absolutePath())) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("Try create the path: %1") - .arg(destinationInfo.absolutePath())); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] Try create the path: "+ + destinationInfo.absolutePath().toStdString()); if(!destinationFolder.mkpath(destinationInfo.absolutePath())) { if(!destinationFolder.exists(destinationInfo.absolutePath())) { /// \todo do real folder error here errorString_internal="mkpath error on destination"; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("Unable create the folder: %1, error: %2") + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("Unable create the folder: %1, error: %2") .arg(destinationInfo.absolutePath()) - .arg(errorString_internal)); + .arg(QString::fromStdString(errorString_internal)) + .toStdString()); emit error(); #ifdef ULTRACOPIER_PLUGIN_DEBUG stat=Idle; @@ -133,10 +134,10 @@ bool WriteThread::internalOpen() } mkpathTransfer->release(); } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] after the mkpath")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] after the mkpath"); if(stopIt) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] close because stopIt is at true")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] close because stopIt is at true"); emit closed(); return false; } @@ -151,7 +152,7 @@ bool WriteThread::internalOpen() writeFileList.insert(file.fileName(),this); if(writeFileList.count(file.fileName())>1) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] in waiting because same file is found")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] in waiting because same file is found"); return false; } } @@ -159,12 +160,12 @@ bool WriteThread::internalOpen() bool fileWasExists=file.exists(); if(file.open(flags)) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] after the open")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] after the open"); { QMutexLocker lock_mutex(&accessList); if(!theBlockList.isEmpty()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("General file corruption detected")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] General file corruption detected"); stopIt=true; file.close(); resumeNotStarted(); @@ -173,10 +174,10 @@ bool WriteThread::internalOpen() } } pauseMutex.tryAcquire(pauseMutex.available()); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] after the pause mutex")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] after the pause mutex"); if(stopIt) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] close because stopIt is at true")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] close because stopIt is at true"); file.close(); resumeNotStarted(); file.setFileName(QStringLiteral("")); @@ -188,8 +189,8 @@ bool WriteThread::internalOpen() file.close(); resumeNotStarted(); file.setFileName(QStringLiteral("")); - errorString_internal=file.errorString(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("Unable to seek after open: %1, error: %2").arg(file.fileName()).arg(errorString_internal)); + errorString_internal=file.errorString().toStdString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("Unable to seek after open: %1, error: %2").arg(file.fileName()).arg(QString::fromStdString(errorString_internal)).toStdString()); emit error(); #ifdef ULTRACOPIER_PLUGIN_DEBUG stat=Idle; @@ -198,7 +199,7 @@ bool WriteThread::internalOpen() } if(stopIt) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] close because stopIt is at true")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] close because stopIt is at true"); file.close(); resumeNotStarted(); file.setFileName(QStringLiteral("")); @@ -210,8 +211,8 @@ bool WriteThread::internalOpen() file.close(); resumeNotStarted(); file.setFileName(QStringLiteral("")); - errorString_internal=file.errorString(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("Unable to resize to %1 after open: %2, error: %3").arg(startSize).arg(file.fileName()).arg(errorString_internal)); + errorString_internal=file.errorString().toStdString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("Unable to resize to %1 after open: %2, error: %3").arg(startSize).arg(file.fileName()).arg(QString::fromStdString(errorString_internal)).toStdString()); emit error(); #ifdef ULTRACOPIER_PLUGIN_DEBUG stat=Idle; @@ -220,7 +221,7 @@ bool WriteThread::internalOpen() } if(stopIt) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] close because stopIt is at true")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] close because stopIt is at true"); file.close(); resumeNotStarted(); file.setFileName(QStringLiteral("")); @@ -228,7 +229,7 @@ bool WriteThread::internalOpen() return false; } isOpen.acquire(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] emit opened()")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] emit opened()"); emit opened(); #ifdef ULTRACOPIER_PLUGIN_DEBUG stat=Idle; @@ -241,17 +242,17 @@ bool WriteThread::internalOpen() { if(!fileWasExists && file.exists()) if(!file.remove()) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] file created but can't be removed")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] file created but can't be removed"); if(stopIt) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] close because stopIt is at true")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] close because stopIt is at true"); resumeNotStarted(); file.setFileName(QStringLiteral("")); emit closed(); return false; } - errorString_internal=file.errorString(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("Unable to open: %1, error: %2").arg(file.fileName()).arg(errorString_internal)); + errorString_internal=file.errorString().toStdString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("Unable to open: %1, error: %2").arg(file.fileName()).arg(QString::fromStdString(errorString_internal)).toStdString()); emit error(); #ifdef ULTRACOPIER_PLUGIN_DEBUG stat=Idle; @@ -260,33 +261,33 @@ bool WriteThread::internalOpen() } } -void WriteThread::open(const QFileInfo &file,const quint64 &startSize,const bool &buffer,const int &numberOfBlock,const bool &sequential) +void WriteThread::open(const QFileInfo &file,const uint64_t &startSize,const bool &buffer,const int &numberOfBlock,const bool &sequential) { if(!isRunning()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] the thread not running to open destination: ")+file.absoluteFilePath()+QStringLiteral(", numberOfBlock: ")+QString::number(numberOfBlock)); - errorString_internal=tr("Internal error, please report it!"); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] the thread not running to open destination: "+file.absoluteFilePath().toStdString()+", numberOfBlock: "+std::to_string(numberOfBlock)); + errorString_internal=tr("Internal error, please report it!").toStdString(); emit error(); return; } if(this->file.isOpen()) { if(file.absoluteFilePath()==this->file.fileName()) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] Try reopen already opened same file: ")+file.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] Try reopen already opened same file: "+file.absoluteFilePath().toStdString()); else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] previous file is already open: ")+file.absoluteFilePath()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+"] previous file is already open: "+file.absoluteFilePath().toStdString()); emit internalStartClose(); isOpen.acquire(); isOpen.release(); } if(numberOfBlock<1 || (numberOfBlock>ULTRACOPIER_PLUGIN_MAX_PARALLEL_NUMBER_OF_BLOCK && numberOfBlock>ULTRACOPIER_PLUGIN_MAX_SEQUENTIAL_NUMBER_OF_BLOCK)) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] numberOfBlock wrong, set to default")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] numberOfBlock wrong, set to default"); this->numberOfBlock=ULTRACOPIER_PLUGIN_DEFAULT_PARALLEL_NUMBER_OF_BLOCK; } else this->numberOfBlock=numberOfBlock; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("open destination: %1, sequential: %2").arg(file.absoluteFilePath()).arg(sequential)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] "+QStringLiteral("open destination: %1, sequential: %2").arg(file.absoluteFilePath()).arg(sequential).toStdString()); stopIt=false; fakeMode=false; lastGoodPosition=0; @@ -306,23 +307,23 @@ void WriteThread::endIsDetected() { if(endDetected) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] double event dropped")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] double event dropped"); return; } endDetected=true; pauseMutex.release(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start"); emit internalStartEndOfFile(); } -QString WriteThread::errorString() const +std::string WriteThread::errorString() const { return errorString_internal; } void WriteThread::stop() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] stop()")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] stop()"); needRemoveTheFile=true; stopIt=true; if(isOpen.available()>0) @@ -342,7 +343,7 @@ void WriteThread::stop() void WriteThread::flushBuffer() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start"); writeFull.release(); writeFull.acquire(); pauseMutex.release(); @@ -350,7 +351,7 @@ void WriteThread::flushBuffer() QMutexLocker lock_mutex(&accessList); theBlockList.clear(); } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] stop")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] stop"); } /// \brief buffer is empty @@ -370,15 +371,15 @@ void WriteThread::internalEndOfFile() { if(sequential) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start the write")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start the write"); emit internalStartWrite(); } else - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] buffer is not empty!")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] buffer is not empty!"); } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] writeIsStopped")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] writeIsStopped"); emit writeIsStopped(); } } @@ -416,7 +417,7 @@ void WriteThread::resumeNotStarted() QMutexLocker lock_mutex(&writeFileListMutex); #ifdef ULTRACOPIER_PLUGIN_DEBUG if(!writeFileList.contains(file.fileName())) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] file: \"")+file.fileName()+QStringLiteral("\" for similar inode is not located into the list of ")+writeFileList.size()+QStringLiteral(" items!")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+"] file: \""+file.fileName().toStdString()+"\" for similar inode is not located into the list of "+std::to_string(writeFileList.size())+" items!"); #endif writeFileList.remove(file.fileName(),this); if(writeFileList.contains(file.fileName())) @@ -430,7 +431,7 @@ void WriteThread::resumeNotStarted() void WriteThread::pause() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] try put read thread in pause")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] try put read thread in pause"); pauseMutex.tryAcquire(pauseMutex.available()); putInPause=true; return; @@ -440,7 +441,7 @@ void WriteThread::resume() { if(putInPause) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start"); putInPause=false; stopIt=false; } @@ -448,7 +449,7 @@ void WriteThread::resume() return; if(!file.isOpen()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] file is not open")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] file is not open"); return; } pauseMutex.release(); @@ -456,7 +457,7 @@ void WriteThread::resume() void WriteThread::reemitStartOpen() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] start"); emit internalStartOpen(); } @@ -464,11 +465,11 @@ void WriteThread::postOperation() { if(postOperationRequested) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,QStringLiteral("[")+QString::number(id)+QStringLiteral("] double event dropped")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"["+std::to_string(id)+"] double event dropped"); return; } postOperationRequested=true; - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start"); emit internalStartClose(); } @@ -479,7 +480,7 @@ void WriteThread::internalCloseSlot() void WriteThread::internalClose(bool emitSignal) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] close for file: ")+file.fileName()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] close for file: "+file.fileName().toStdString()); /// \note never send signal here, because it's called by the destructor #ifdef ULTRACOPIER_PLUGIN_DEBUG stat=Close; @@ -496,8 +497,8 @@ void WriteThread::internalClose(bool emitSignal) { if(emitSignal) { - errorString_internal=file.errorString(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("Unable to seek after open: %1, error: %2").arg(file.fileName()).arg(errorString_internal)); + errorString_internal=file.errorString().toStdString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("Unable to seek after open: %1, error: %2").arg(file.fileName()).arg(QString::fromStdString(errorString_internal)).toStdString()); emit error(); } else @@ -511,7 +512,7 @@ void WriteThread::internalClose(bool emitSignal) { if(!file.remove()) if(emitSignal) - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] unable to remove the destination file")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] unable to remove the destination file"); } } //here and not after, because the transferThread don't need try close if not open @@ -544,7 +545,7 @@ void WriteThread::internalClose(bool emitSignal) void WriteThread::internalReopen() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start"); QString tempFile=file.fileName(); internalClose(false); flushBuffer(); @@ -557,7 +558,7 @@ void WriteThread::internalReopen() void WriteThread::reopen() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] start")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] start"); stopIt=true; endDetected=false; emit internalStartReopen(); @@ -610,20 +611,20 @@ bool WriteThread::setBlockSize(const int blockSize) } else { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("block size out of range: ")+QString::number(blockSize)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"block size out of range: "+std::to_string(blockSize)); return false; } } /// \brief get the last good position -qint64 WriteThread::getLastGoodPosition() const +int64_t WriteThread::getLastGoodPosition() const { return lastGoodPosition; } void WriteThread::flushAndSeekToZero() { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("flushAndSeekToZero: ")+QString::number(blockSize)); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"flushAndSeekToZero: "+std::to_string(blockSize)); stopIt=true; emit internalStartFlushAndSeekToZero(); } @@ -640,8 +641,8 @@ void WriteThread::checkSum() #endif if(!file.seek(0)) { - errorString_internal=file.errorString(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("Unable to seek after open: %1, error: %2").arg(file.fileName()).arg(errorString_internal)); + errorString_internal=file.errorString().toStdString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("Unable to seek after open: %1, error: %2").arg(file.fileName()).arg(QString::fromStdString(errorString_internal)).toStdString()); emit error(); return; } @@ -650,7 +651,7 @@ void WriteThread::checkSum() { if(putInPause) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("[")+QString::number(id)+QStringLiteral("] write put in pause")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"["+std::to_string(id)+"] write put in pause"); if(stopIt) return; pauseMutex.acquire(); @@ -668,8 +669,8 @@ void WriteThread::checkSum() if(file.error()!=QFile::NoError) { - errorString_internal=tr("Unable to read the source file: ")+file.errorString()+QStringLiteral(" (")+QString::number(file.error())+QStringLiteral(")"); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("file.error()!=QFile::NoError: %1, error: %2").arg(QString::number(file.error())).arg(errorString_internal)); + errorString_internal=tr("Unable to read the source file: ").toStdString()+file.errorString().toStdString()+" ("+std::to_string(file.error())+")"; + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("file.error()!=QFile::NoError: %1, error: %2").arg(QString::number(file.error())).arg(QString::fromStdString(errorString_internal)).toStdString()); emit error(); return; } @@ -693,8 +694,8 @@ void WriteThread::checkSum() while(sizeReaden>0 && !stopIt); if(lastGoodPosition>(quint64)file.size()) { - errorString_internal=tr("File truncated during read, possible data change"); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("Source truncated during the read: %1 (%2)").arg(file.errorString()).arg(QString::number(file.error()))); + errorString_internal=tr("File truncated during read, possible data change").toStdString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("Source truncated during the read: %1 (%2)").arg(file.errorString()).arg(QString::number(file.error())).toStdString()); emit error(); return; } @@ -706,7 +707,7 @@ void WriteThread::checkSum() return; } emit checksumFinish(hash.result()); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] stop the read")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] stop the read"); } void WriteThread::internalFlushAndSeekToZero() @@ -714,8 +715,8 @@ void WriteThread::internalFlushAndSeekToZero() flushBuffer(); if(!file.seek(0)) { - errorString_internal=file.errorString(); - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("Unable to seek after open: %1, error: %2").arg(file.fileName()).arg(errorString_internal)); + errorString_internal=file.errorString().toStdString(); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("Unable to seek after open: %1, error: %2").arg(file.fileName()).arg(QString::fromStdString(errorString_internal)).toStdString()); emit error(); return; } @@ -814,7 +815,7 @@ void WriteThread::internalWrite() { if(putInPause) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("[")+QString::number(id)+QStringLiteral("] write put in pause")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"["+std::to_string(id)+"] write put in pause"); if(stopIt) return; pauseMutex.acquire(); @@ -823,7 +824,7 @@ void WriteThread::internalWrite() } if(stopIt) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] stopIt")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] stopIt"); return; } if(stopIt) @@ -899,7 +900,7 @@ void WriteThread::internalWrite() writeFull.release(); return; } - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] End detected of the file")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] End detected of the file"); return; } #ifdef ULTRACOPIER_PLUGIN_SPEED_SUPPORT @@ -941,23 +942,23 @@ void WriteThread::internalWrite() //mutex for stream this data if(lastGoodPosition==0) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("[")+QString::number(id)+QStringLiteral("] emit writeIsStarted()")); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"["+std::to_string(id)+"] emit writeIsStarted()"); emit writeIsStarted(); } if(stopIt) return; if(file.error()!=QFile::NoError) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("Error in writing: %1 (%2)").arg(file.errorString()).arg(file.error())); - errorString_internal=QStringLiteral("Error in writing: %1 (%2)").arg(file.errorString()).arg(file.error()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("Error in writing: %1 (%2)").arg(file.errorString()).arg(file.error()).toStdString()); + errorString_internal=QStringLiteral("Error in writing: %1 (%2)").arg(file.errorString()).arg(file.error()).toStdString(); stopIt=true; emit error(); return; } if(bytesWriten!=blockArray.size()) { - ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("[")+QString::number(id)+QStringLiteral("] ")+QStringLiteral("Error in writing, bytesWriten: %1, blockArray.size(): %2").arg(bytesWriten).arg(blockArray.size())); - errorString_internal=QStringLiteral("Error in writing, bytesWriten: %1, blockArray.size(): %2").arg(bytesWriten).arg(blockArray.size()); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"["+std::to_string(id)+"] "+QStringLiteral("Error in writing, bytesWriten: %1, blockArray.size(): %2").arg(bytesWriten).arg(blockArray.size()).toStdString()); + errorString_internal=QStringLiteral("Error in writing, bytesWriten: %1, blockArray.size(): %2").arg(bytesWriten).arg(blockArray.size()).toStdString(); stopIt=true; emit error(); return; diff --git a/plugins/CopyEngine/Ultracopier/WriteThread.h b/plugins/CopyEngine/Ultracopier/WriteThread.h index e540552..cadd022 100644 --- a/plugins/CopyEngine/Ultracopier/WriteThread.h +++ b/plugins/CopyEngine/Ultracopier/WriteThread.h @@ -30,9 +30,9 @@ protected: void run(); public: /// \brief open the destination to open it - void open(const QFileInfo &file,const quint64 &startSize,const bool &buffer,const int &numberOfBlock,const bool &sequential); + void open(const QFileInfo &file,const uint64_t &startSize,const bool &buffer,const int &numberOfBlock,const bool &sequential); /// \brief to return the error string - QString errorString() const; + std::string errorString() const; /// \brief to stop all void stop(); /// \brief to write data @@ -63,7 +63,7 @@ public: /// \brief set block size in KB bool setBlockSize(const int blockSize); /// \brief get the last good position - qint64 getLastGoodPosition() const; + int64_t getLastGoodPosition() const; /// \brief buffer is empty bool bufferIsEmpty(); #ifdef ULTRACOPIER_PLUGIN_SPEED_SUPPORT @@ -109,9 +109,9 @@ signals: void internalStartEndOfFile() const; void internalStartFlushAndSeekToZero() const; /// \brief To debug source - void debugInformation(const Ultracopier::DebugLevel &level,const QString &fonction,const QString &text,const QString &file,const int &ligne) const; + void debugInformation(const Ultracopier::DebugLevel &level,const std::string &fonction,const std::string &text,const std::string &file,const int &ligne) const; private: - QString errorString_internal; + std::string errorString_internal; AvancedQFile file; volatile bool stopIt; volatile bool postOperationRequested; @@ -132,12 +132,12 @@ private: QSemaphore pauseMutex; volatile bool putInPause; QList theBlockList; ///< Store the block list - quint64 lastGoodPosition; + uint64_t lastGoodPosition; QByteArray blockArray; ///< temp data for block writing, the data - qint64 bytesWriten; ///< temp data for block writing, the bytes writen + int64_t bytesWriten; ///< temp data for block writing, the bytes writen int id; volatile bool endDetected; - quint64 startSize; + uint64_t startSize; QSemaphore *mkpathTransfer; bool fakeMode; bool buffer; diff --git a/plugins/CopyEngine/Ultracopier/documentation.dox b/plugins/CopyEngine/Ultracopier/documentation.dox index 727969f..5a0fbf6 100644 --- a/plugins/CopyEngine/Ultracopier/documentation.dox +++ b/plugins/CopyEngine/Ultracopier/documentation.dox @@ -20,7 +20,7 @@ \section mainpage_downloads Downloads - You can found link on Ultracopier (Supercopier/Teracopy) project page, via git, snapshot sources, ... + You can find the link on Ultracopier project page, via git, snapshot sources, ... \section mainpage_algorithm Algorithm diff --git a/plugins/CopyEngine/Ultracopier/informations.xml b/plugins/CopyEngine/Ultracopier/informations.xml index 1a1d769..61e04e0 100644 --- a/plugins/CopyEngine/Ultracopier/informations.xml +++ b/plugins/CopyEngine/Ultracopier/informations.xml @@ -17,7 +17,7 @@ - 1.2.3.6 + 1.4.0.3 Ultracopier -- cgit v1.2.3