Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kamm <kamm@incasoftware.de>2015-01-30 11:17:15 +0300
committerChristian Kamm <kamm@incasoftware.de>2015-04-22 11:45:41 +0300
commit7d68c628dbb496c855e77e186835be129abfc897 (patch)
tree6f71e25f28c988e786fdd7424c45ded819a345dd /src/libsync/progressdispatcher.h
parent509b83e73e49deca1e7e054ae6d240935f03359c (diff)
Time estimation: Use a consistent check for size dependence. #2328
Diffstat (limited to 'src/libsync/progressdispatcher.h')
-rw-r--r--src/libsync/progressdispatcher.h27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/libsync/progressdispatcher.h b/src/libsync/progressdispatcher.h
index f2864388d..f4e657b35 100644
--- a/src/libsync/progressdispatcher.h
+++ b/src/libsync/progressdispatcher.h
@@ -32,9 +32,12 @@ namespace OCC {
namespace Progress
{
/** Return true is the size need to be taken in account in the total amount of time */
- inline bool isSizeDependent(csync_instructions_e instruction) {
- return instruction == CSYNC_INSTRUCTION_CONFLICT || instruction == CSYNC_INSTRUCTION_SYNC
- || instruction == CSYNC_INSTRUCTION_NEW;
+ static inline bool isSizeDependent(const SyncFileItem & item)
+ {
+ return ! item._isDirectory && (
+ item._instruction == CSYNC_INSTRUCTION_CONFLICT
+ || item._instruction == CSYNC_INSTRUCTION_SYNC
+ || item._instruction == CSYNC_INSTRUCTION_NEW);
}
@@ -50,7 +53,13 @@ namespace Progress
quint64 _completedSize;
// Should this be in a separate file?
struct EtaEstimate {
- EtaEstimate() : _startedTime(QDateTime::currentMSecsSinceEpoch()), _agvEtaMSecs(0),_effectivProgressPerSec(0),_sampleCount(1) {}
+ EtaEstimate()
+ : _startedTime(QDateTime::currentMSecsSinceEpoch())
+ , _agvEtaMSecs(0)
+ , _effectivProgressPerSec(0)
+ , _sampleCount(1)
+ {
+ }
static const int MAX_AVG_DIVIDER=60;
static const int INITAL_WAIT_TIME=5;
@@ -115,11 +124,9 @@ namespace Progress
void setProgressComplete(const SyncFileItem &item) {
_currentItems.remove(item._file);
_completedFileCount += item._affectedItems;
- if (!item._isDirectory) {
- if (Progress::isSizeDependent(item._instruction)) {
- _completedSize += item._size;
- }
- }
+ if (Progress::isSizeDependent(item)) {
+ _completedSize += item._size;
+ }
_lastCompletedItem = item;
this->updateEstimation();
}
@@ -142,7 +149,7 @@ namespace Progress
quint64 completedSize() const {
quint64 r = _completedSize;
foreach(const ProgressItem &i, _currentItems) {
- if (!i._item._isDirectory)
+ if (Progress::isSizeDependent(i._item))
r += i._completedSize;
}
return r;