[Pkg-owncloud-commits] [owncloud-client] 147/333: Remove Progress::Kind

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu Apr 17 23:16:45 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 62e95e540b471c76adedb84286ad9732de7b7442
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Fri Mar 14 18:43:23 2014 +0100

    Remove Progress::Kind
    
    It's not really used,  one need to  look at the instruction of the items
    being processed to see what happens
---
 src/mirall/application.cpp      |  1 -
 src/mirall/csyncthread.cpp      | 29 ++++-------------------------
 src/mirall/csyncthread.h        |  2 +-
 src/mirall/folder.cpp           |  6 +++---
 src/mirall/folder.h             |  2 +-
 src/mirall/progressdispatcher.h | 26 --------------------------
 src/owncloudcmd/owncloudcmd.cpp | 16 ++--------------
 7 files changed, 11 insertions(+), 71 deletions(-)

diff --git a/src/mirall/application.cpp b/src/mirall/application.cpp
index 036f907..4c92425 100644
--- a/src/mirall/application.cpp
+++ b/src/mirall/application.cpp
@@ -118,7 +118,6 @@ Application::Application(int &argc, char **argv) :
 
     setQuitOnLastWindowClosed(false);
 
-    qRegisterMetaType<Progress::Kind>("Progress::Kind");
     qRegisterMetaType<Progress::Info>("Progress::Info");
 
     MirallConfigFile cfg;
diff --git a/src/mirall/csyncthread.cpp b/src/mirall/csyncthread.cpp
index defadcc..7204c9b 100644
--- a/src/mirall/csyncthread.cpp
+++ b/src/mirall/csyncthread.cpp
@@ -66,7 +66,6 @@ CSyncThread::CSyncThread(CSYNC *ctx, const QString& localPath, const QString& re
     qRegisterMetaType<SyncFileItem>("SyncFileItem");
     qRegisterMetaType<SyncFileItem::Status>("SyncFileItem::Status");
     qRegisterMetaType<Progress::Info>("Progress::Info");
-    qRegisterMetaType<Progress::Kind>("Progress::Kind");
 
     _thread.start();
 }
@@ -407,24 +406,6 @@ void CSyncThread::handleSyncError(CSYNC *ctx, const char *state) {
     _thread.quit();
 }
 
-void csyncthread_updater_progress_callback(CSYNC_PROGRESS *progress, void *userdata)
-{
-    Progress::Kind kind;
-    if (progress->kind == CSYNC_NOTIFY_START_LOCAL_UPDATE) {
-        kind = Progress::StartLocalUpdate;
-    } else if (progress->kind == CSYNC_NOTIFY_FINISHED_LOCAL_UPDATE) {
-        kind = Progress::EndLocalUpdate;
-    } else if (progress->kind == CSYNC_NOTIFY_START_REMOTE_UPDATE) {
-        kind = Progress::StartRemoteUpdate;
-    } else if (progress->kind == CSYNC_NOTIFY_FINISHED_REMOTE_UPDATE) {
-        kind = Progress::EndRemoteUpdate;
-    } else {
-        return; // FIXME, but most progress stuff should come from the new propagator
-    }
-    CSyncThread *self = static_cast<CSyncThread*>(userdata);
-    emit self->transmissionProgress( kind, self->_progressInfo );
-}
-
 void CSyncThread::startSync()
 {
     if (!_syncMutex.tryLock()) {
@@ -505,8 +486,6 @@ void CSyncThread::startSync()
 
     _syncTime.start();
 
-    // Only used for the updater progress as we use the new propagator right now which does its own thing
-    csync_set_progress_callback(_csync_ctx, csyncthread_updater_progress_callback);
 
     qDebug() << "#### Update start #################################################### >>";
 
@@ -550,7 +529,8 @@ void CSyncThread::slotUpdateFinished(int updateResult)
         it->_file = adjustRenamedPath(it->_file);
     }
 
-    emit transmissionProgress(Progress::StartSync, _progressInfo);
+    // To announce the beginning of the sync
+    emit transmissionProgress(_progressInfo);
 
     if (!_hasFiles && !_syncedItems.isEmpty()) {
         qDebug() << Q_FUNC_INFO << "All the files are going to be removed, asking the user";
@@ -632,7 +612,7 @@ void CSyncThread::slotJobCompleted(const SyncFileItem &item)
         emit csyncError(item._errorString);
     }
 
-    emit transmissionProgress(Progress::Context, _progressInfo);
+    emit transmissionProgress(_progressInfo);
 }
 
 void CSyncThread::slotFinished()
@@ -647,7 +627,6 @@ void CSyncThread::slotFinished()
     csync_commit(_csync_ctx);
 
     qDebug() << "CSync run took " << _syncTime.elapsed() << " Milliseconds";
-    emit transmissionProgress(Progress::EndSync, _progressInfo);
     emit finished();
     _propagator.reset(0);
     _syncMutex.unlock();
@@ -657,7 +636,7 @@ void CSyncThread::slotFinished()
 void CSyncThread::slotProgress(const SyncFileItem& item, quint64 current)
 {
     _progressInfo.setProgressItem(item, current);
-    emit transmissionProgress(Progress::Context, _progressInfo);
+    emit transmissionProgress(_progressInfo);
 }
 
 
diff --git a/src/mirall/csyncthread.h b/src/mirall/csyncthread.h
index 5eed4cb..bcbe5f3 100644
--- a/src/mirall/csyncthread.h
+++ b/src/mirall/csyncthread.h
@@ -70,7 +70,7 @@ signals:
     // after sync is done
     void treeWalkResult(const SyncFileItemVector&);
 
-    void transmissionProgress( const Progress::Kind, const Progress::Info& progress );
+    void transmissionProgress( const Progress::Info& progress );
 
     void csyncStateDbFile( const QString& );
     void wipeDb();
diff --git a/src/mirall/folder.cpp b/src/mirall/folder.cpp
index 775c6e1..86f5e00 100644
--- a/src/mirall/folder.cpp
+++ b/src/mirall/folder.cpp
@@ -610,7 +610,7 @@ void Folder::startSync(const QStringList &pathList)
     //blocking connection so the message box happens in this thread, but block the csync thread.
     connect(_csync, SIGNAL(aboutToRemoveAllFiles(SyncFileItem::Direction,bool*)),
                     SLOT(slotAboutToRemoveAllFiles(SyncFileItem::Direction,bool*)), Qt::BlockingQueuedConnection);
-    connect(_csync, SIGNAL(transmissionProgress(Progress::Kind,Progress::Info)), this, SLOT(slotTransmissionProgress(Progress::Kind,Progress::Info)));
+    connect(_csync, SIGNAL(transmissionProgress(Progress::Info)), this, SLOT(slotTransmissionProgress(Progress::Info)));
 
     QMetaObject::invokeMethod(_csync, "startSync", Qt::QueuedConnection);
 
@@ -676,7 +676,7 @@ void Folder::slotCSyncFinished()
 
 // 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(Progress::Kind kind, const Progress::Info &pi)
+void Folder::slotTransmissionProgress(const Progress::Info &pi)
 {
     if (!pi._lastCompletedItem.isEmpty()
             && Progress::isWarningKind(pi._lastCompletedItem._status)) {
@@ -685,7 +685,7 @@ void Folder::slotTransmissionProgress(Progress::Kind kind, const Progress::Info
     }
 
     // remember problems happening to set the correct Sync status in slot slotCSyncFinished.
-    if( kind == Progress::StartSync ) {
+    if( pi._completedFileCount ) {
         _syncResult.setWarnCount(0);
     }
     ProgressDispatcher::instance()->setProgressInfo(alias(), pi);
diff --git a/src/mirall/folder.h b/src/mirall/folder.h
index 75ec585..a076726 100644
--- a/src/mirall/folder.h
+++ b/src/mirall/folder.h
@@ -174,7 +174,7 @@ private slots:
     void slotCsyncUnavailable();
     void slotCSyncFinished();
 
-    void slotTransmissionProgress(Progress::Kind kind, const Progress::Info& pi);
+    void slotTransmissionProgress(const Progress::Info& pi);
 
     void slotPollTimerTimeout();
     void etagRetreived(const QString &);
diff --git a/src/mirall/progressdispatcher.h b/src/mirall/progressdispatcher.h
index 7267277..6b52d98 100644
--- a/src/mirall/progressdispatcher.h
+++ b/src/mirall/progressdispatcher.h
@@ -74,32 +74,6 @@ namespace Progress
         }
     };
 
-
-    enum Kind {
-        Invalid,
-        StartSync,
-        Download,
-        Upload,
-        Context,
-        Inactive,
-        StartDownload,
-        StartUpload,
-        EndDownload,
-        EndUpload,
-        EndSync,
-        StartDelete,
-        EndDelete,
-        StartRename,
-        EndRename,
-        SoftError,
-        NormalError,
-        FatalError,
-        StartLocalUpdate,
-        EndLocalUpdate,
-        StartRemoteUpdate,
-        EndRemoteUpdate
-    };
-
     QString asActionString( const SyncFileItem& item );
     QString asResultString(  const SyncFileItem& item );
 
diff --git a/src/owncloudcmd/owncloudcmd.cpp b/src/owncloudcmd/owncloudcmd.cpp
index 98090a7..a09056c 100644
--- a/src/owncloudcmd/owncloudcmd.cpp
+++ b/src/owncloudcmd/owncloudcmd.cpp
@@ -37,19 +37,7 @@ class OwncloudCmd : public QObject {
 public:
     OwncloudCmd() : QObject() { }
 public slots:
-    void transmissionProgressSlot(Progress::Kind pI) {
-        static QElapsedTimer localTimer;
-        static QElapsedTimer remoteTimer;
-        if (pI == Progress::StartLocalUpdate) {
-            localTimer.start();
-        } else if (pI == Progress::EndLocalUpdate) {
-            // There is also localTimer.nsecsElapsed()
-            qDebug() << "Local Update took" << localTimer.elapsed() << "msec";
-        } else if (pI == Progress::StartRemoteUpdate) {
-            remoteTimer.start();
-        } else if (pI == Progress::EndRemoteUpdate) {
-            qDebug() << "Remote Update took" << remoteTimer.elapsed() << "msec";
-        }
+    void transmissionProgressSlot() {
     }
 };
 
@@ -222,7 +210,7 @@ int main(int argc, char **argv) {
     SyncJournalDb db(options.source_dir);
     CSyncThread csyncthread(_csync_ctx, options.source_dir, QUrl(options.target_url).path(), folder, &db);
     QObject::connect(&csyncthread, SIGNAL(finished()), &app, SLOT(quit()));
-    QObject::connect(&csyncthread, SIGNAL(transmissionProgress(Progress::Kind,Progress::Info)), &owncloudCmd, SLOT(transmissionProgressSlot(Progress::Kind)));
+    QObject::connect(&csyncthread, SIGNAL(transmissionProgress(Progress::Info)), &owncloudCmd, SLOT(transmissionProgressSlot()));
     csyncthread.startSync();
 
     app.exec();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list