summaryrefslogtreecommitdiffstats
path: root/filecopier.h
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2018-02-01 07:24:43 +0100
committerArno <arno@disconnect.de>2018-02-01 07:24:43 +0100
commitf2604b62b777d7cab001bb5b7d80ad25b586e554 (patch)
tree7b8ef0abd8b87e9e71e33d246f705415aaa11814 /filecopier.h
parentd6a44b289027db999e50a2b346327e6650a4f43c (diff)
downloadShemovCleaner-f2604b62b777d7cab001bb5b7d80ad25b586e554.tar.gz
ShemovCleaner-f2604b62b777d7cab001bb5b7d80ad25b586e554.tar.bz2
ShemovCleaner-f2604b62b777d7cab001bb5b7d80ad25b586e554.zip
Improve FileCopier
This endeavor started out quite innocently: fix the connect syntax in ProgressDialog, but it quickly became much more. Vom Höxchen aufs Stöxchen :) First I thought it would be nice to add a total count to the ProgressDialog. Then I realized that I had QElapsedTimer::restart() totally wrong. It returns the ms *since the last restart*! It doesn't reset to zero, so fix that. While testing that I noticed that the download speed was quite below average, so change the buffer size and only check if we were cancelled when the timer elapsed. But that wasn't it. Eventually I dug into my firewall rules and routings to get it right.
Diffstat (limited to 'filecopier.h')
-rw-r--r--filecopier.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/filecopier.h b/filecopier.h
index 81d8496..6a9e37f 100644
--- a/filecopier.h
+++ b/filecopier.h
@@ -10,7 +10,6 @@ class FileCopier : public QThread {
public:
FileCopier(QObject *parent = 0);
void addJob(const QString &source, const QString &dest);
- QHash<QString, QString> jobs();
virtual void run();
void cancel();
@@ -18,13 +17,16 @@ class FileCopier : public QThread {
void newFile(const QString &source, const QString & dest, qint64 size);
void success(bool s, QString source);
void bytesRead(qint64 bytes);
- void bytesReadIntval(qint64 bytes, qint64 msecs);
+ void bytesReadIntval(qint64 bytes, qint64 msecs, int total, int copied);
private:
QHash<QString, QString> mJobs;
QMutex mAddJobMutex;
QMutex mCancelMutex;
+ QMutex mCountMutex;
bool mCancel;
+ int mTotal;
+ int mCopied;
};
#endif // FILECOPIER_H