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
path: root/src
diff options
context:
space:
mode:
authorKlaas Freitag <freitag@owncloud.com>2013-11-27 19:48:10 +0400
committerKlaas Freitag <freitag@owncloud.com>2013-11-27 19:48:16 +0400
commit23007613a90a65e8997e9e6350e15b6c49655326 (patch)
tree5c0a7d93023ccc46f876cbbd7337c7387deec677 /src
parent0fc51704f5ba8b4145260c205de296e6bd1a4b36 (diff)
Fix progress bar in new propagator.
Diffstat (limited to 'src')
-rw-r--r--src/mirall/accountsettings.cpp2
-rw-r--r--src/mirall/csyncthread.cpp20
-rw-r--r--src/mirall/csyncthread.h4
-rw-r--r--src/mirall/owncloudgui.cpp2
-rw-r--r--src/mirall/owncloudpropagator.cpp19
-rw-r--r--src/mirall/protocolwidget.cpp3
6 files changed, 28 insertions, 22 deletions
diff --git a/src/mirall/accountsettings.cpp b/src/mirall/accountsettings.cpp
index 4c88214ee..eb254c53b 100644
--- a/src/mirall/accountsettings.cpp
+++ b/src/mirall/accountsettings.cpp
@@ -602,7 +602,7 @@ void AccountSettings::slotSetProgress(const QString& folder, const Progress::Inf
qDebug() << "================================> INVALID Progress for folder " << folder;
return;
}
- if( (progress.kind == Progress::StartSync || progress.kind == Progress::EndSync)
+ if( (progress.kind == Progress::StartSync)
&& progress.overall_file_count == 0 ) {
// do not show progress if nothing is transmitted.
return;
diff --git a/src/mirall/csyncthread.cpp b/src/mirall/csyncthread.cpp
index 0e99126c8..27ad29711 100644
--- a/src/mirall/csyncthread.cpp
+++ b/src/mirall/csyncthread.cpp
@@ -285,6 +285,8 @@ int CSyncThread::treewalkFile( TREE_WALK_FILE *file, bool remote )
case CSYNC_INSTRUCTION_NEW:
case CSYNC_INSTRUCTION_SYNC:
case CSYNC_INSTRUCTION_CONFLICT:
+ case CSYNC_INSTRUCTION_RENAME:
+ case CSYNC_INSTRUCTION_REMOVE:
_progressInfo.overall_file_count++;
_progressInfo.overall_transmission_size += file->size;
//fall trough
@@ -314,7 +316,7 @@ int CSyncThread::treewalkFile( TREE_WALK_FILE *file, bool remote )
break;
case CSYNC_INSTRUCTION_REMOVE:
dir = !remote ? SyncFileItem::Down : SyncFileItem::Up;
- break;
+ break;
case CSYNC_INSTRUCTION_CONFLICT:
case CSYNC_INSTRUCTION_IGNORE:
case CSYNC_INSTRUCTION_ERROR:
@@ -617,6 +619,7 @@ void CSyncThread::slotProgress(Progress::Kind kind, const SyncFileItem& item, qu
if( kind == Progress::StartSync ) {
QMutexLocker lock(&_mutex);
_currentFileNo = 0;
+ _lastOverallBytes = 0;
}
if( kind == Progress::StartDelete ||
kind == Progress::StartDownload ||
@@ -626,16 +629,23 @@ void CSyncThread::slotProgress(Progress::Kind kind, const SyncFileItem& item, qu
_currentFileNo += 1;
}
- Progress::Info pInfo = _progressInfo;
+ if( kind == Progress::EndUpload ||
+ kind == Progress::EndDownload ||
+ kind == Progress::EndRename ||
+ kind == Progress::EndDelete ) {
+ QMutexLocker lock(&_mutex);
+ _lastOverallBytes += total;
+ curr = 0;
+ }
+ Progress::Info pInfo(_progressInfo);
pInfo.kind = kind;
pInfo.current_file = item._file;
pInfo.file_size = total;
pInfo.current_file_bytes = curr;
pInfo.current_file_no = _currentFileNo;
- pInfo.overall_current_bytes += curr;
- pInfo.timestamp = QDateTime::currentDateTime();
-
+ pInfo.timestamp = QDateTime::currentDateTime();
+ pInfo.overall_current_bytes = _lastOverallBytes + curr;
// Connect to something in folder!
emit transmissionProgress( pInfo );
}
diff --git a/src/mirall/csyncthread.h b/src/mirall/csyncthread.h
index 0737b494b..9e82ebb89 100644
--- a/src/mirall/csyncthread.h
+++ b/src/mirall/csyncthread.h
@@ -115,7 +115,9 @@ private:
Progress::Info _progressInfo;
int _downloadLimit;
int _uploadLimit;
- int _currentFileNo;
+ qint64 _currentFileNo;
+ qint64 _overallFileCount;
+ quint64 _lastOverallBytes;
QAtomicInt _abortRequested;
diff --git a/src/mirall/owncloudgui.cpp b/src/mirall/owncloudgui.cpp
index ebee6ce6e..5c5749079 100644
--- a/src/mirall/owncloudgui.cpp
+++ b/src/mirall/owncloudgui.cpp
@@ -160,8 +160,6 @@ void ownCloudGui::startupConnected( bool connected, const QStringList& fails )
folderMan->setSyncEnabled(true);
_tray->setIcon( Theme::instance()->syncStateIcon( SyncResult::NotYetStarted, true ) );
_tray->show();
- } else {
- int cnt = folderMan->map().size();
}
_startupFails = fails; // store that for the settings dialog once it appears.
diff --git a/src/mirall/owncloudpropagator.cpp b/src/mirall/owncloudpropagator.cpp
index 05036e8fa..b577c3941 100644
--- a/src/mirall/owncloudpropagator.cpp
+++ b/src/mirall/owncloudpropagator.cpp
@@ -59,7 +59,7 @@ struct ScopedPointerHelpers {
#define DECLARE_JOB(NAME) \
class NAME : public PropagateItemJob { \
- /* Q_OBJECT */ \
+ /* Q_OBJECT */ \
public: \
NAME(OwncloudPropagator* propagator,const SyncFileItem& item) \
: PropagateItemJob(propagator, item) {} \
@@ -185,7 +185,7 @@ void PropagateLocalRemove::start()
_propagator->_journal->deleteFileRecord(_item._originalFile);
_propagator->_journal->commit("Local remove");
done(SyncFileItem::Success);
- emit progress(Progress::EndDelete, _item, 0, _item._size);
+ emit progress(Progress::EndDelete, _item, _item._size, _item._size);
}
DECLARE_JOB(PropagateLocalMkdir)
@@ -216,7 +216,7 @@ void PropagateRemoteRemove::start()
_propagator->_journal->deleteFileRecord(_item._originalFile, _item._isDirectory);
_propagator->_journal->commit("Remote Remove");
done(SyncFileItem::Success);
- emit progress(Progress::EndDelete, _item, 0, _item._size);
+ emit progress(Progress::EndDelete, _item, _item._size, _item._size);
}
DECLARE_JOB(PropagateRemoteMkdir)
@@ -443,7 +443,7 @@ void PropagateUploadFile::start()
- emit progress(Progress::EndUpload, _item, 0, _item._size);
+ emit progress(Progress::EndUpload, _item, _item._size, _item._size);
done(SyncFileItem::Success);
return;
@@ -825,7 +825,7 @@ void PropagateDownloadFile::start()
_propagator->_journal->setFileRecord(SyncJournalFileRecord(_item, fn));
_propagator->_journal->setDownloadInfo(_item._file, SyncJournalDb::DownloadInfo());
_propagator->_journal->commit("download file start2");
- emit progress(Progress::EndDownload, _item, 0, _item._size);
+ emit progress(Progress::EndDownload, _item, _item._size, _item._size);
done(isConflict ? SyncFileItem::Conflict : SyncFileItem::Success);
}
@@ -851,7 +851,7 @@ void PropagateLocalRename::start()
_propagator->_journal->setFileRecord(record);
_propagator->_journal->commit("localRename");
- emit progress(Progress::EndRename, _item, 0, _item._size);
+ emit progress(Progress::EndRename, _item, _item._size, _item._size);
done(SyncFileItem::Success);
}
@@ -860,9 +860,6 @@ DECLARE_JOB(PropagateRemoteRename)
void PropagateRemoteRename::start()
{
-
- emit progress(Progress::StartRename, _item, 0, _item._size);
-
if (_item._file == _item._renameTarget) {
if (!_item._isDirectory) {
// The parents has been renamed already so there is nothing more to do.
@@ -894,7 +891,7 @@ void PropagateRemoteRename::start()
}
updateMTimeAndETag(uri2.data(), _item._modtime);
- emit progress(Progress::EndRename, _item, 0, _item._size);
+ emit progress(Progress::EndRename, _item, _item._size, _item._size);
}
@@ -905,8 +902,6 @@ void PropagateRemoteRename::start()
_propagator->_journal->setFileRecord(record);
_propagator->_journal->commit("Remote Rename");
done(SyncFileItem::Success);
- emit progress(Progress::EndRename, _item, 0, _item._size);
-
}
bool PropagateItemJob::updateErrorFromSession(int neon_code, ne_request* req, int ignoreHttpCode)
diff --git a/src/mirall/protocolwidget.cpp b/src/mirall/protocolwidget.cpp
index aab8887c7..b69a8cb58 100644
--- a/src/mirall/protocolwidget.cpp
+++ b/src/mirall/protocolwidget.cpp
@@ -245,7 +245,8 @@ void ProtocolWidget::slotProgressInfo( const QString& folder, const Progress::In
}
// Ingore other events than finishing an individual up- or download.
- if( !(progress.kind == Progress::EndDownload || progress.kind == Progress::EndUpload || progress.kind == Progress::EndDelete)) {
+ if( !(progress.kind == Progress::EndDownload || progress.kind == Progress::EndUpload
+ || progress.kind == Progress::EndDelete || progress.kind == Progress::EndRename)) {
return;
}