SLOT(slotAboutToRemoveAllFiles(SyncFileItem::Direction, bool *)));
connect(_engine.data(), SIGNAL(aboutToRestoreBackup(bool *)),
SLOT(slotAboutToRestoreBackup(bool *)));
- connect(_engine.data(), SIGNAL(folderDiscovered(bool, QString)), this, SLOT(slotFolderDiscovered(bool, QString)));
connect(_engine.data(), SIGNAL(transmissionProgress(ProgressInfo)), this, SLOT(slotTransmissionProgress(ProgressInfo)));
connect(_engine.data(), SIGNAL(itemCompleted(const SyncFileItemPtr &)),
this, SLOT(slotItemCompleted(const SyncFileItemPtr &)));
emit syncFinished(_syncResult);
}
-
-void Folder::slotFolderDiscovered(bool, QString folderName)
-{
- ProgressInfo pi;
- pi._currentDiscoveredFolder = folderName;
- emit progressInfo(pi);
- ProgressDispatcher::instance()->setProgressInfo(alias(), pi);
-}
-
-
// the progress comes without a folder and the valid path set. Add that here
// and hand the result over to the progress dispatcher.
void Folder::slotTransmissionProgress(const ProgressInfo &pi)
void slotCsyncUnavailable();
- void slotFolderDiscovered(bool local, QString folderName);
-
void slotTransmissionProgress(const ProgressInfo &pi);
void slotItemCompleted(const SyncFileItemPtr &);
<< FolderStatusDelegate::WarningCount
<< Qt::ToolTipRole;
- if (!progress._currentDiscoveredFolder.isEmpty()) {
+ if (progress.status() == ProgressInfo::Discovery
+ && !progress._currentDiscoveredFolder.isEmpty()) {
pi->_overallSyncString = tr("Checking for changes in '%1'").arg(progress._currentDiscoveredFolder);
emit dataChanged(index(folderIndex), index(folderIndex), roles);
return;
}
+ if (progress.status() == ProgressInfo::Reconcile) {
+ pi->_overallSyncString = tr("Reconciling changes");
+ emit dataChanged(index(folderIndex), index(folderIndex), roles);
+ return;
+ }
+
+ // Status is Starting, Propagation or Done
+
if (!progress._lastCompletedItem.isEmpty()
&& Progress::isWarningKind(progress._lastCompletedItem._status)) {
pi->_warningCount++;
void IssuesWidget::slotProgressInfo(const QString &folder, const ProgressInfo &progress)
{
- if (!progress.isUpdatingEstimates()) {
+ if (progress.status() == ProgressInfo::Starting) {
// The sync is restarting, clean the old items
cleanItems(folder);
- } else if (progress.completedFiles() >= progress.totalFiles()) {
- //Sync completed
}
}
{
Q_UNUSED(folder);
- if (!progress._currentDiscoveredFolder.isEmpty()) {
- _actionStatus->setText(tr("Checking for changes in '%1'")
- .arg(progress._currentDiscoveredFolder));
- } else if (progress.totalSize() == 0) {
+ if (progress.status() == ProgressInfo::Discovery) {
+ if (!progress._currentDiscoveredFolder.isEmpty()) {
+ _actionStatus->setText(tr("Checking for changes in '%1'")
+ .arg(progress._currentDiscoveredFolder));
+ }
+ } else if (progress.status() == ProgressInfo::Done) {
+ QTimer::singleShot(2000, this, SLOT(slotDisplayIdle()));
+ }
+ if (progress.status() != ProgressInfo::Propagation) {
+ return;
+ }
+
+ if (progress.totalSize() == 0) {
quint64 currentFile = progress.currentFile();
quint64 totalFileCount = qMax(progress.totalFiles(), currentFile);
QString msg;
slotRebuildRecentMenus();
}
}
-
- if (progress.isUpdatingEstimates()
- && progress.completedFiles() >= progress.totalFiles()
- && progress._currentDiscoveredFolder.isEmpty()) {
- QTimer::singleShot(2000, this, SLOT(slotDisplayIdle()));
- }
}
void ownCloudGui::slotDisplayIdle()
void ProgressInfo::reset()
{
+ _status = Starting;
+
_currentItems.clear();
_currentDiscoveredFolder.clear();
_sizeProgress = Progress();
_lastCompletedItem = SyncFileItem();
}
+ProgressInfo::Status ProgressInfo::status() const
+{
+ return _status;
+}
+
void ProgressInfo::startEstimateUpdates()
{
_updateEstimatesTimer.start(1000);
*/
void reset();
+ /** Records the status of the sync run
+ */
+ enum Status {
+ /// Emitted once at start
+ Starting,
+
+ /**
+ * Emitted once without _currentDiscoveredFolder when it starts,
+ * then for each folder.
+ */
+ Discovery,
+
+ /// Emitted once when reconcile starts
+ Reconcile,
+
+ /// Emitted during propagation, with progress data
+ Propagation,
+
+ /**
+ * Emitted once when done
+ *
+ * Except when SyncEngine jumps directly to finalize() without going
+ * through slotFinished().
+ */
+ Done
+ };
+
+ Status status() const;
+
/**
* Called when propagation starts.
*
friend class ProgressInfo;
};
+ Status _status;
+
struct OWNCLOUDSYNC_EXPORT ProgressItem
{
SyncFileItem _item;
_csync_ctx->callbacks.checksum_userdata = &_checksum_hook;
_stopWatch.start();
+ _progressInfo->_status = ProgressInfo::Starting;
+ emit transmissionProgress(*_progressInfo);
qCInfo(lcEngine) << "#### Discovery start ####################################################";
+ _progressInfo->_status = ProgressInfo::Discovery;
+ emit transmissionProgress(*_progressInfo);
// Usually the discovery runs in the background: We want to avoid
// stealing too much time from other processes that the user might
discoveryJob->moveToThread(&_thread);
connect(discoveryJob, SIGNAL(finished(int)), this, SLOT(slotDiscoveryJobFinished(int)));
connect(discoveryJob, SIGNAL(folderDiscovered(bool, QString)),
- this, SIGNAL(folderDiscovered(bool, QString)));
+ this, SLOT(slotFolderDiscovered(bool, QString)));
connect(discoveryJob, SIGNAL(newBigFolder(QString, bool)),
this, SIGNAL(newBigFolder(QString, bool)));
QMetaObject::invokeMethod(discoveryJob, "start", Qt::QueuedConnection);
}
+void SyncEngine::slotFolderDiscovered(bool /*local*/, const QString &folder)
+{
+ _progressInfo->_currentDiscoveredFolder = folder;
+ emit transmissionProgress(*_progressInfo);
+}
+
void SyncEngine::slotRootEtagReceived(const QString &e)
{
if (_remoteRootEtag.isEmpty()) {
void SyncEngine::slotDiscoveryJobFinished(int discoveryResult)
{
- // To clean the progress info
- emit folderDiscovered(false, QString());
-
if (discoveryResult < 0) {
handleSyncError(_csync_ctx, "csync_update");
return;
_journal->commitIfNeededAndStartNewTransaction("Post discovery");
}
+ _progressInfo->_currentDiscoveredFolder.clear();
+ _progressInfo->_status = ProgressInfo::Reconcile;
+ emit transmissionProgress(*_progressInfo);
+
if (csync_reconcile(_csync_ctx) < 0) {
handleSyncError(_csync_ctx, "csync_reconcile");
return;
// To announce the beginning of the sync
emit aboutToPropagate(syncItems);
+
// it's important to do this before ProgressInfo::start(), to announce start of new sync
+ _progressInfo->_status = ProgressInfo::Propagation;
emit transmissionProgress(*_progressInfo);
_progressInfo->startEstimateUpdates();
// files needed propagation, but clear the lastCompletedItem
// so we don't count this twice (like Recent Files)
_progressInfo->_lastCompletedItem = SyncFileItem();
+ _progressInfo->_status = ProgressInfo::Done;
emit transmissionProgress(*_progressInfo);
finalize(success);
// During update, before reconcile
void rootEtag(QString);
- void folderDiscovered(bool local, const QString &folderUrl);
// before actual syncing (after update+reconcile) for each item
void syncItemDiscovered(const SyncFileItem &);
void seenLockedFile(const QString &fileName);
private slots:
+ void slotFolderDiscovered(bool local, const QString &folder);
void slotRootEtagReceived(const QString &);
void slotItemCompleted(const SyncFileItemPtr &item);
void slotFinished(bool success);