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:
-rw-r--r--src/gui/folder.cpp2
-rw-r--r--src/gui/owncloudgui.cpp2
-rw-r--r--src/gui/protocolwidget.cpp2
-rw-r--r--src/libsync/progressdispatcher.cpp21
-rw-r--r--src/libsync/progressdispatcher.h20
-rw-r--r--src/libsync/syncengine.cpp4
6 files changed, 35 insertions, 16 deletions
diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp
index 47c2c2944..5b8c01957 100644
--- a/src/gui/folder.cpp
+++ b/src/gui/folder.cpp
@@ -915,7 +915,7 @@ void Folder::slotFolderDiscovered(bool, QString folderName)
// and hand the result over to the progress dispatcher.
void Folder::slotTransmissionProgress(const ProgressInfo &pi)
{
- if( !pi.hasStarted() ) {
+ if( !pi.isUpdatingEstimates() ) {
// this is the beginning of a sync, set the warning level to 0
_syncResult.setWarnCount(0);
}
diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp
index d32995455..63e4e32ae 100644
--- a/src/gui/owncloudgui.cpp
+++ b/src/gui/owncloudgui.cpp
@@ -685,7 +685,7 @@ void ownCloudGui::slotUpdateProgress(const QString &folder, const ProgressInfo&
slotRebuildRecentMenus();
}
- if (progress.hasStarted()
+ if (progress.isUpdatingEstimates()
&& progress.completedFiles() >= progress.totalFiles()
&& progress._currentDiscoveredFolder.isEmpty()) {
QTimer::singleShot(2000, this, SLOT(slotDisplayIdle()));
diff --git a/src/gui/protocolwidget.cpp b/src/gui/protocolwidget.cpp
index 34e91ccff..c96fa1de3 100644
--- a/src/gui/protocolwidget.cpp
+++ b/src/gui/protocolwidget.cpp
@@ -219,7 +219,7 @@ QTreeWidgetItem* ProtocolWidget::createCompletedTreewidgetItem(const QString& fo
void ProtocolWidget::slotProgressInfo( const QString& folder, const ProgressInfo& progress )
{
- if( !progress.hasStarted() ) {
+ if( !progress.isUpdatingEstimates() ) {
// The sync is restarting, clean the old items
cleanItems(folder);
} else if (progress.completedFiles() >= progress.totalFiles()) {
diff --git a/src/libsync/progressdispatcher.cpp b/src/libsync/progressdispatcher.cpp
index 517507167..560c1ff8b 100644
--- a/src/libsync/progressdispatcher.cpp
+++ b/src/libsync/progressdispatcher.cpp
@@ -127,13 +127,30 @@ void ProgressDispatcher::setProgressInfo(const QString& folder, const ProgressIn
emit progressInfo( folder, progress );
}
-void ProgressInfo::start()
+ProgressInfo::ProgressInfo()
{
connect(&_updateEstimatesTimer, SIGNAL(timeout()), SLOT(updateEstimates()));
+ reset();
+}
+
+void ProgressInfo::reset()
+{
+ _currentItems.clear();
+ _currentDiscoveredFolder.clear();
+ _sizeProgress = Progress();
+ _fileProgress = Progress();
+ _totalSizeOfCompletedJobs = 0;
+ _maxBytesPerSecond = 100000.0;
+ _maxFilesPerSecond = 2.0;
+ _updateEstimatesTimer.stop();
+}
+
+void ProgressInfo::startEstimateUpdates()
+{
_updateEstimatesTimer.start(1000);
}
-bool ProgressInfo::hasStarted() const
+bool ProgressInfo::isUpdatingEstimates() const
{
return _updateEstimatesTimer.isActive();
}
diff --git a/src/libsync/progressdispatcher.h b/src/libsync/progressdispatcher.h
index ec555c313..7ea3f3b8f 100644
--- a/src/libsync/progressdispatcher.h
+++ b/src/libsync/progressdispatcher.h
@@ -37,27 +37,27 @@ class OWNCLOUDSYNC_EXPORT ProgressInfo : public QObject
{
Q_OBJECT
public:
- ProgressInfo()
- : _totalSizeOfCompletedJobs(0)
- , _maxFilesPerSecond(2.0)
- , _maxBytesPerSecond(100000.0)
- {}
+ ProgressInfo();
+
+ /** Resets for a new sync run.
+ */
+ void reset();
/**
* Called when propagation starts.
*
- * hasStarted() will return true afterwards.
+ * isUpdatingEstimates() will return true afterwards.
*/
- void start();
+ void startEstimateUpdates();
/**
- * Returns true when propagation has started (start() was called).
+ * Returns true when startEstimateUpdates() was called.
*
* This is used when the SyncEngine wants to indicate a new sync
* is about to start via the transmissionProgress() signal. The
- * first ProgressInfo will have hasStarted() == false.
+ * first ProgressInfo will have isUpdatingEstimates() == false.
*/
- bool hasStarted() const;
+ bool isUpdatingEstimates() const;
/**
* Increase the file and size totals by the amount indicated in item.
diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp
index 66425cb35..89c1c9d89 100644
--- a/src/libsync/syncengine.cpp
+++ b/src/libsync/syncengine.cpp
@@ -673,6 +673,8 @@ void SyncEngine::startSync()
_syncRunning = true;
_anotherSyncNeeded = false;
+ _progressInfo->reset();
+
if (!QDir(_localPath).exists()) {
// No _tr, it should only occur in non-mirall
emit csyncError("Unable to find local sync folder.");
@@ -909,7 +911,7 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult)
emit aboutToPropagate(_syncedItems);
// it's important to do this before ProgressInfo::start(), to announce start of new sync
emit transmissionProgress(*_progressInfo);
- _progressInfo->start();
+ _progressInfo->startEstimateUpdates();
// post update phase script: allow to tweak stuff by a custom script in debug mode.
if( !qgetenv("OWNCLOUD_POST_UPDATE_SCRIPT").isEmpty() ) {