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/progresscoordinator.cpp | |
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/progresscoordinator.cpp')
-rw-r--r-- | src/libs/installer/progresscoordinator.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/libs/installer/progresscoordinator.cpp b/src/libs/installer/progresscoordinator.cpp index 7ba2b0912..e55f4b8bb 100644 --- a/src/libs/installer/progresscoordinator.cpp +++ b/src/libs/installer/progresscoordinator.cpp @@ -103,6 +103,14 @@ void ProgressCoordinator::registerPartProgress(QObject *sender, const char *sign Q_ASSERT(isConnected); } + +/*! + This slot gets the progress changed signals from different tasks. The values 0 and 1 are handled as + special values. + + 0 - is just ignored, so you can use a timer which gives the progress, e.g. like a downloader does. + 1 - means the task is finished, even if there comes another 1 from that task, so it will be ignored. +*/ void ProgressCoordinator::partProgressChanged(double fraction) { if (fraction < 0 || fraction > 1) { @@ -110,6 +118,16 @@ void ProgressCoordinator::partProgressChanged(double fraction) return; } + // no fraction no change + if (fraction == 0) + return; + + // ignore senders sending 100% multiple times + if (fraction == 1 && m_senderPendingCalculatedPercentageHash.contains(sender()) + && m_senderPendingCalculatedPercentageHash.value(sender()) == 0) { + return; + } + double partProgressSize = m_senderPartProgressSizeHash.value(sender(), 0); if (partProgressSize == 0) { qWarning() << "It seems that this sender was not registered in the right way:" << sender(); @@ -176,7 +194,7 @@ void ProgressCoordinator::partProgressChanged(double fraction) m_currentCompletePercentage = newCurrentCompletePercentage; - if (fraction == 1 || fraction == 0) { + if (fraction == 1) { m_currentBasePercentage = m_currentBasePercentage + pendingCalculatedPartPercentage; m_senderPendingCalculatedPercentageHash.insert(sender(), 0); } else { |