From 0432c09d7889009beb9557e0546d0c4f240bb37e Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 3 Dec 2016 00:00:16 +0100 Subject: 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. --- filecopier.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 filecopier.h (limited to 'filecopier.h') 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 +#include +#include + +class FileCopier : public QThread { + Q_OBJECT + public: + FileCopier(QObject *parent = 0); + void addJob(const QString &source, const QString &dest); + QHash 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 mJobs; + QMutex mAddJobMutex; + QMutex mCancelMutex; + bool mCancel; +}; + +#endif // FILECOPIER_H -- cgit v1.2.3-70-g09d2