summaryrefslogtreecommitdiff
path: root/plugins-alternative/CopyEngine/Rsync/scanFileOrFolder.h
diff options
context:
space:
mode:
authorThomas Preud'homme <robotux@celest.fr>2013-03-21 11:01:59 +0100
committerThomas Preud'homme <robotux@celest.fr>2013-03-21 11:01:59 +0100
commite297dbd8052ef4e66f069e2dd1865ae7fa8af28e (patch)
tree342fea0a2f6f33b8b62dad2d1729f8209da1a1ba /plugins-alternative/CopyEngine/Rsync/scanFileOrFolder.h
parent8f9f382e1c97cab2e72e97495650c73ac4b97314 (diff)
Imported Upstream version 0.3.1.0
Diffstat (limited to 'plugins-alternative/CopyEngine/Rsync/scanFileOrFolder.h')
-rw-r--r--plugins-alternative/CopyEngine/Rsync/scanFileOrFolder.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/plugins-alternative/CopyEngine/Rsync/scanFileOrFolder.h b/plugins-alternative/CopyEngine/Rsync/scanFileOrFolder.h
new file mode 100644
index 0000000..2109df2
--- /dev/null
+++ b/plugins-alternative/CopyEngine/Rsync/scanFileOrFolder.h
@@ -0,0 +1,91 @@
+/** \file scanFileOrFolder.h
+\brief Thread changed to list recursively the folder
+\author alpha_one_x86
+\version 0.3
+\date 2011 */
+
+#include <QThread>
+#include <QStringList>
+#include <QString>
+#include <QList>
+#include <QFileInfo>
+#include <QDir>
+#include <QSemaphore>
+#include <QEventLoop>
+#include <QCoreApplication>
+#include <QMutexLocker>
+
+#include "Environment.h"
+
+#ifndef SCANFILEORFOLDER_H
+#define SCANFILEORFOLDER_H
+
+/// \brief Thread changed to list recursively the folder
+class scanFileOrFolder : public QThread
+{
+ Q_OBJECT
+public:
+ explicit scanFileOrFolder(CopyMode mode);
+ ~scanFileOrFolder();
+ /// \brief to the a folder listing
+ void stop();
+ /// \brief to get if is finished
+ bool isFinished();
+ /// \brief set action if Folder are same or exists
+ void setFolderExistsAction(FolderExistsAction action,QString newName="");
+ /// \brief set action if error
+ void setFolderErrorAction(FileErrorAction action);
+ /// \brief set if need check if the destination exists
+ void setCheckDestinationFolderExists(const bool checkDestinationFolderExists);
+ void setRenamingRules(QString firstRenamingRule,QString otherRenamingRule);
+ /// \brief set rsync
+ void setRsync(const bool rsync);
+signals:
+ void fileTransfer(const QFileInfo &source,const QFileInfo &destination,const CopyMode &mode);
+ /// \brief To debug source
+ void debugInformation(const DebugLevel &level,const QString &fonction,const QString &text,const QString &file,const int &ligne);
+ void folderAlreadyExists(const QFileInfo &source,const QFileInfo &destination,const bool &isSame);
+ void errorOnFolder(const QFileInfo &fileInfo,const QString &errorString);
+ void finishedTheListing();
+
+ void newFolderListing(const QString &path);
+ void addToMkPath(const QString& folder);
+ void addToRmPath(const QString& folder,const int& inodeToRemove);
+ void addToRmForRsync(const QString& inode);
+public slots:
+ void addToList(const QStringList& sources,const QString& destination);
+ void setFilters(QList<Filters_rules> include,QList<Filters_rules> exclude);
+protected:
+ void run();
+private:
+ QStringList sources;
+ QString destination;
+ volatile bool stopIt;
+ void listFolder(const QString& source,const QString& destination,const QString& sourceSuffixPath,QString destinationSuffixPath);
+ volatile bool stopped;
+ QSemaphore waitOneAction;
+ FolderExistsAction folderExistsAction;
+ FileErrorAction fileErrorAction;
+ volatile bool checkDestinationExists;
+ QString newName;
+ QRegExp folder_isolation;
+ QString prefix;
+ QString suffix;
+ CopyMode mode;
+ bool rsync;
+ QList<Filters_rules> include,exclude;
+ QList<Filters_rules> include_send,exclude_send;
+ bool reloadTheNewFilters;
+ bool haveFilters;
+ QMutex filtersMutex;
+ QString firstRenamingRule;
+ QString otherRenamingRule;
+ /** 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);
+};
+
+#endif // SCANFILEORFOLDER_H