diff options
author | kh1 <karsten.heimrich@digia.com> | 2013-10-08 16:09:01 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@digia.com> | 2013-10-09 12:08:09 +0200 |
commit | c8de51cadbc5855ca1e77d038d7f09bf60d059ee (patch) | |
tree | 59f51e9e81122a5f033206cb0438669ef2ee5928 /src/libs/installer/extractarchiveoperation_p.h | |
parent | 1d090c2899925d03435dc8a160b431b2e57739b9 (diff) |
Connect extract operation to progress calculation.
Ignore senders which are sending 100% more then once, got that from
7z lib at the extracting step.
Task-number: QTIFW-11
Task-number: QTIFW-141
Change-Id: I7750f9e49d5705df91e6c79c7ee2b0530e156e84
Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
Diffstat (limited to 'src/libs/installer/extractarchiveoperation_p.h')
-rw-r--r-- | src/libs/installer/extractarchiveoperation_p.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/libs/installer/extractarchiveoperation_p.h b/src/libs/installer/extractarchiveoperation_p.h index 4e0632830..c7284d9c2 100644 --- a/src/libs/installer/extractarchiveoperation_p.h +++ b/src/libs/installer/extractarchiveoperation_p.h @@ -71,9 +71,12 @@ public: ExtractArchiveOperation *const op = m_op;//dynamic_cast< ExtractArchiveOperation* >(parent()); Q_ASSERT(op != 0); + int removedCounter = 0; foreach (const QString &file, m_files) { + removedCounter++; const QFileInfo fi(file); - emit outputTextChanged(file); + emit currentFileChanged(file); + emit progressChanged(double(removedCounter) / m_files.count()); if (fi.isFile() || fi.isSymLink()) { op->deleteFileNowOrLater(fi.absoluteFilePath()); } else if (fi.isDir()) { @@ -85,7 +88,8 @@ public: } Q_SIGNALS: - void outputTextChanged(const QString &filename); + void currentFileChanged(const QString &filename); + void progressChanged(double); private: QStringList m_files; @@ -105,7 +109,8 @@ public: Callback() : state(S_OK), createBackups(true) {} Q_SIGNALS: - void progressChanged(const QString &filename); + void currentFileChanged(const QString &filename); + void progressChanged(double progress); public Q_SLOTS: void statusChanged(QInstaller::PackageManagerCore::Status status) @@ -130,7 +135,7 @@ public Q_SLOTS: protected: void setCurrentFile(const QString &filename) { - emit progressChanged(QDir::toNativeSeparators(filename)); + emit currentFileChanged(QDir::toNativeSeparators(filename)); } static QString generateBackupName(const QString &fn) @@ -161,8 +166,9 @@ protected: return true; } - HRESULT setCompleted(quint64 /*completed*/, quint64 /*total*/) + HRESULT setCompleted(quint64 completed, quint64 total) { + emit progressChanged(double(completed) / total); return state; } }; |