summaryrefslogtreecommitdiffstats
path: root/filecopier.h
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2016-12-03 00:00:16 +0100
committerArno <arno@disconnect.de>2016-12-03 00:00:16 +0100
commit0432c09d7889009beb9557e0546d0c4f240bb37e (patch)
treeb401ce1815e4e33e4ef79b9a69727f70a80e6e1b /filecopier.h
parentc8d8c71460c7e7d403c9dba1addc850a361d3e9c (diff)
downloadShemovCleaner-0432c09d7889009beb9557e0546d0c4f240bb37e.tar.gz
ShemovCleaner-0432c09d7889009beb9557e0546d0c4f240bb37e.tar.bz2
ShemovCleaner-0432c09d7889009beb9557e0546d0c4f240bb37e.zip
Actually use Copy Files to...
Create a FileCopier and show a custom, non-modal progress dialog when we're copying files. Turns out that a QProgressDialog always shows when it's created. This is by design, so I had to implement one that fits my needs. Also, a buffer size of 32K (as used in MKVMerger) is way too small to max out the available bandwidth, so I set it to an (arbitrary) value of 16MB.
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