summaryrefslogtreecommitdiffstats
path: root/filecopier.h
diff options
context:
space:
mode:
Diffstat (limited to 'filecopier.h')
-rw-r--r--filecopier.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/filecopier.h b/filecopier.h
new file mode 100644
index 0000000..8ffdd4d
--- /dev/null
+++ b/filecopier.h
@@ -0,0 +1,29 @@
+#ifndef FILECOPIER_H
+#define FILECOPIER_H
+
+#include <QThread>
+#include <QMutex>
+#include <QHash>
+
+class FileCopier : public QThread {
+ Q_OBJECT
+ public:
+ FileCopier(QObject *parent = 0);
+ void addJob(const QString &source, const QString &dest);
+ QHash<QString, QString> jobs();
+ virtual void run();
+ void cancel();
+
+ signals:
+ void newFile(const QString &source, qint64 size);
+ void success(bool s, QString source);
+ void bytesRead(qint64 bytes);
+
+ private:
+ QHash<QString, QString> mJobs;
+ QMutex mAddJobMutex;
+ QMutex mCancelMutex;
+ bool mCancel;
+};
+
+#endif // FILECOPIER_H