summaryrefslogtreecommitdiffstats
path: root/filewidget.cpp
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 /filewidget.cpp
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 'filewidget.cpp')
-rw-r--r--filewidget.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/filewidget.cpp b/filewidget.cpp
index ab4f240..f1d8873 100644
--- a/filewidget.cpp
+++ b/filewidget.cpp
@@ -704,11 +704,12 @@ void FileWidget::setCopyProgress(qint64 bytes){
mCopyProgress->setValue(val);
}
-void FileWidget::setCopySummary(qint64 bytes, qint64 elapsed){
- QHash<QString,QString> jobs = mFileCopier->jobs();
- float rate = bytes / (elapsed / 1000) / 1024 / 1024.0;
- QString sum = QString("%1 file(s), @ %2 MB/s").arg(QString::number(jobs.count() + 1)).arg(QString::number(rate, 'f', 2));
- mCopyProgress->setSummary(sum);
+void FileWidget::setCopySummary(qint64 bytes, qint64 elapsed, int total, int copying){
+ if(elapsed != 0){
+ float rate = bytes * 8 / (elapsed / 1000.0) / 1024 / 1024.0;
+ QString sum = QString("%1/%2 file(s), @ %3 MB/s").arg(QString::number(copying+1)).arg(QString::number(total)).arg(QString::number(rate, 'f', 2));
+ mCopyProgress->setSummary(sum);
+ }
}
void FileWidget::copyFiles(QString destDir){