[Pkg-owncloud-commits] [owncloud-client] 157/333: Rename CSyncThread to SyncEngine
Sandro Knauß
hefee-guest at moszumanska.debian.org
Thu Apr 17 23:16:47 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 7b482c0e9656453aeb58b98c70618b59e3bdf6fb
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Mon Mar 17 11:34:51 2014 +0100
Rename CSyncThread to SyncEngine
CSyncThread has not been a thread for a long time now
---
src/CMakeLists.txt | 6 ++--
src/mirall/folder.cpp | 5 +--
src/mirall/folder.h | 5 +--
src/mirall/{csyncthread.cpp => syncengine.cpp} | 42 +++++++++++++-------------
src/mirall/{csyncthread.h => syncengine.h} | 6 ++--
src/owncloudcmd/owncloudcmd.cpp | 10 +++---
6 files changed, 38 insertions(+), 36 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6cd6d36..927de74 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -68,7 +68,7 @@ set(libsync_SRCS
mirall/folderwatcher.cpp
mirall/syncresult.cpp
mirall/mirallconfigfile.cpp
- mirall/csyncthread.cpp
+ mirall/syncengine.cpp
mirall/owncloudpropagator.cpp
mirall/propagatorjobs.cpp
mirall/propagator_qnam.cpp
@@ -118,7 +118,7 @@ set(libsync_HEADERS
mirall/folderman.h
mirall/folder.h
mirall/folderwatcher.h
- mirall/csyncthread.h
+ mirall/syncengine.h
mirall/owncloudpropagator.h
mirall/owncloudpropagator_p.h
mirall/propagator_qnam.h
@@ -178,7 +178,7 @@ ENDIF()
# These headers are installed for libowncloudsync to be used by 3rd party apps
set(owncloudsync_HEADERS
mirall/account.h
- mirall/csyncthread.h
+ mirall/syncengine.h
mirall/folder.h
mirall/folderman.h
mirall/folderwatcher.h
diff --git a/src/mirall/folder.cpp b/src/mirall/folder.cpp
index 86f5e00..c58b921 100644
--- a/src/mirall/folder.cpp
+++ b/src/mirall/folder.cpp
@@ -25,6 +25,7 @@
#include "mirall/syncresult.h"
#include "mirall/utility.h"
#include "mirall/clientproxy.h"
+#include "mirall/syncengine.h"
#include "creds/abstractcredentials.h"
@@ -114,7 +115,7 @@ bool Folder::init()
if( csync_init( _csync_ctx ) < 0 ) {
qDebug() << "Could not initialize csync!" << csync_get_status(_csync_ctx) << csync_get_status_string(_csync_ctx);
- QString errStr = CSyncThread::csyncErrorToString(CSYNC_STATUS(csync_get_status(_csync_ctx)));
+ QString errStr = SyncEngine::csyncErrorToString(CSYNC_STATUS(csync_get_status(_csync_ctx)));
const char *errMsg = csync_get_status_string(_csync_ctx);
if( errMsg ) {
errStr += QLatin1String("<br/>");
@@ -594,7 +595,7 @@ void Folder::startSync(const QStringList &pathList)
qDebug() << "*** Start syncing";
setIgnoredFiles();
- _csync = new CSyncThread( _csync_ctx, path(), remoteUrl().path(), _remotePath, &_journal);
+ _csync = new SyncEngine( _csync_ctx, path(), remoteUrl().path(), _remotePath, &_journal);
qRegisterMetaType<SyncFileItemVector>("SyncFileItemVector");
qRegisterMetaType<SyncFileItem::Direction>("SyncFileItem::Direction");
diff --git a/src/mirall/folder.h b/src/mirall/folder.h
index a076726..97be7e3 100644
--- a/src/mirall/folder.h
+++ b/src/mirall/folder.h
@@ -19,7 +19,6 @@
#include "mirall/syncresult.h"
#include "mirall/progressdispatcher.h"
-#include "mirall/csyncthread.h"
#include "mirall/syncjournaldb.h"
#include "mirall/clientproxy.h"
@@ -39,6 +38,8 @@ class QThread;
namespace Mirall {
+class SyncEngine;
+
class FolderWatcher;
@@ -206,7 +207,7 @@ private:
QFileSystemWatcher *_pathWatcher;
bool _enabled;
SyncResult _syncResult;
- CSyncThread *_csync;
+ SyncEngine *_csync;
QStringList _errors;
bool _csyncError;
bool _csyncUnavail;
diff --git a/src/mirall/csyncthread.cpp b/src/mirall/syncengine.cpp
similarity index 94%
rename from src/mirall/csyncthread.cpp
rename to src/mirall/syncengine.cpp
index 7204c9b..a1747dd 100644
--- a/src/mirall/csyncthread.cpp
+++ b/src/mirall/syncengine.cpp
@@ -13,7 +13,7 @@
* for more details.
*/
-#include "mirall/csyncthread.h"
+#include "mirall/syncengine.h"
#include "mirall/account.h"
#include "mirall/mirallconfigfile.h"
#include "mirall/theme.h"
@@ -54,9 +54,9 @@ void csyncLogCatcher(int /*verbosity*/,
}
/* static variables to hold the credentials */
-QMutex CSyncThread::_syncMutex;
+QMutex SyncEngine::_syncMutex;
-CSyncThread::CSyncThread(CSYNC *ctx, const QString& localPath, const QString& remoteURL, const QString& remotePath, Mirall::SyncJournalDb* journal)
+SyncEngine::SyncEngine(CSYNC *ctx, const QString& localPath, const QString& remoteURL, const QString& remotePath, Mirall::SyncJournalDb* journal)
{
_localPath = localPath;
_remotePath = remotePath;
@@ -70,7 +70,7 @@ CSyncThread::CSyncThread(CSYNC *ctx, const QString& localPath, const QString& re
_thread.start();
}
-CSyncThread::~CSyncThread()
+SyncEngine::~SyncEngine()
{
_thread.quit();
_thread.wait();
@@ -78,7 +78,7 @@ CSyncThread::~CSyncThread()
//Convert an error code from csync to a user readable string.
// Keep that function thread safe as it can be called from the sync thread or the main thread
-QString CSyncThread::csyncErrorToString(CSYNC_STATUS err)
+QString SyncEngine::csyncErrorToString(CSYNC_STATUS err)
{
QString errStr;
@@ -187,7 +187,7 @@ QString CSyncThread::csyncErrorToString(CSYNC_STATUS err)
}
-bool CSyncThread::checkBlacklisting( SyncFileItem *item )
+bool SyncEngine::checkBlacklisting( SyncFileItem *item )
{
bool re = false;
@@ -247,17 +247,17 @@ bool CSyncThread::checkBlacklisting( SyncFileItem *item )
return re;
}
-int CSyncThread::treewalkLocal( TREE_WALK_FILE* file, void *data )
+int SyncEngine::treewalkLocal( TREE_WALK_FILE* file, void *data )
{
- return static_cast<CSyncThread*>(data)->treewalkFile( file, false );
+ return static_cast<SyncEngine*>(data)->treewalkFile( file, false );
}
-int CSyncThread::treewalkRemote( TREE_WALK_FILE* file, void *data )
+int SyncEngine::treewalkRemote( TREE_WALK_FILE* file, void *data )
{
- return static_cast<CSyncThread*>(data)->treewalkFile( file, true );
+ return static_cast<SyncEngine*>(data)->treewalkFile( file, true );
}
-int CSyncThread::treewalkFile( TREE_WALK_FILE *file, bool remote )
+int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
{
if( ! file ) return -1;
SyncFileItem item;
@@ -375,7 +375,7 @@ int CSyncThread::treewalkFile( TREE_WALK_FILE *file, bool remote )
return re;
}
-void CSyncThread::handleSyncError(CSYNC *ctx, const char *state) {
+void SyncEngine::handleSyncError(CSYNC *ctx, const char *state) {
CSYNC_STATUS err = csync_get_status( ctx );
const char *errMsg = csync_get_status_string( ctx );
QString errStr = csyncErrorToString(err);
@@ -406,7 +406,7 @@ void CSyncThread::handleSyncError(CSYNC *ctx, const char *state) {
_thread.quit();
}
-void CSyncThread::startSync()
+void SyncEngine::startSync()
{
if (!_syncMutex.tryLock()) {
qDebug() << Q_FUNC_INFO << "WARNING: Another sync seems to be running. Not starting a new one.";
@@ -495,7 +495,7 @@ void CSyncThread::startSync()
QMetaObject::invokeMethod(job, "start", Qt::QueuedConnection);
}
-void CSyncThread::slotUpdateFinished(int updateResult)
+void SyncEngine::slotUpdateFinished(int updateResult)
{
if (updateResult < 0 ) {
handleSyncError(_csync_ctx, "csync_update");
@@ -566,7 +566,7 @@ void CSyncThread::slotUpdateFinished(int updateResult)
_propagator->start(_syncedItems);
}
-void CSyncThread::setNetworkLimits()
+void SyncEngine::setNetworkLimits()
{
MirallConfigFile cfg;
@@ -590,7 +590,7 @@ void CSyncThread::setNetworkLimits()
qDebug() << " N------N Network Limits changed!";
}
-void CSyncThread::slotJobCompleted(const SyncFileItem &item)
+void SyncEngine::slotJobCompleted(const SyncFileItem &item)
{
qDebug() << Q_FUNC_INFO << item._file << item._status << item._errorString;
@@ -615,7 +615,7 @@ void CSyncThread::slotJobCompleted(const SyncFileItem &item)
emit transmissionProgress(_progressInfo);
}
-void CSyncThread::slotFinished()
+void SyncEngine::slotFinished()
{
// emit the treewalk results.
if( ! _journal->postSyncCleanup( _seenFiles ) ) {
@@ -633,20 +633,20 @@ void CSyncThread::slotFinished()
_thread.quit();
}
-void CSyncThread::slotProgress(const SyncFileItem& item, quint64 current)
+void SyncEngine::slotProgress(const SyncFileItem& item, quint64 current)
{
_progressInfo.setProgressItem(item, current);
emit transmissionProgress(_progressInfo);
}
-void CSyncThread::slotAdjustTotalTransmissionSize(qint64 change)
+void SyncEngine::slotAdjustTotalTransmissionSize(qint64 change)
{
_progressInfo._totalSize += change;
}
/* Given a path on the remote, give the path as it is when the rename is done */
-QString CSyncThread::adjustRenamedPath(const QString& original)
+QString SyncEngine::adjustRenamedPath(const QString& original)
{
int slashPos = original.size();
while ((slashPos = original.lastIndexOf('/' , slashPos - 1)) > 0) {
@@ -658,7 +658,7 @@ QString CSyncThread::adjustRenamedPath(const QString& original)
return original;
}
-void CSyncThread::abort()
+void SyncEngine::abort()
{
csync_request_abort(_csync_ctx);
if(_propagator)
diff --git a/src/mirall/csyncthread.h b/src/mirall/syncengine.h
similarity index 95%
rename from src/mirall/csyncthread.h
rename to src/mirall/syncengine.h
index bcbe5f3..0853da3 100644
--- a/src/mirall/csyncthread.h
+++ b/src/mirall/syncengine.h
@@ -43,13 +43,13 @@ void csyncLogCatcher(int /*verbosity*/,
const char *buffer,
void */*userdata*/);
-class CSyncThread : public QObject
+class SyncEngine : public QObject
{
Q_OBJECT
friend void csyncthread_updater_progress_callback(CSYNC_PROGRESS *progress, void *userdata);
public:
- CSyncThread(CSYNC *, const QString &localPath, const QString &remoteURL, const QString &remotePath, SyncJournalDb *journal);
- ~CSyncThread();
+ SyncEngine(CSYNC *, const QString &localPath, const QString &remoteURL, const QString &remotePath, SyncJournalDb *journal);
+ ~SyncEngine();
static QString csyncErrorToString( CSYNC_STATUS);
diff --git a/src/owncloudcmd/owncloudcmd.cpp b/src/owncloudcmd/owncloudcmd.cpp
index a09056c..b548063 100644
--- a/src/owncloudcmd/owncloudcmd.cpp
+++ b/src/owncloudcmd/owncloudcmd.cpp
@@ -22,7 +22,7 @@
#include <neon/ne_socket.h>
-#include "csyncthread.h"
+#include "syncengine.h"
#include <syncjournaldb.h>
#include "logger.h"
#include "csync.h"
@@ -208,10 +208,10 @@ int main(int argc, char **argv) {
OwncloudCmd owncloudCmd;
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::Info)), &owncloudCmd, SLOT(transmissionProgressSlot()));
- csyncthread.startSync();
+ SyncEngine engine(_csync_ctx, options.source_dir, QUrl(options.target_url).path(), folder, &db);
+ QObject::connect(&engine, SIGNAL(finished()), &app, SLOT(quit()));
+ QObject::connect(&engine, SIGNAL(transmissionProgress(Progress::Info)), &owncloudCmd, SLOT(transmissionProgressSlot()));
+ engine.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