Adopt to new progress API in csync, WIP

This commit is contained in:
Klaas Freitag 2013-07-25 16:28:36 +02:00
parent a827056d28
commit 8f912ca0c5
3 changed files with 30 additions and 2 deletions

View file

@ -333,8 +333,7 @@ void CSyncThread::startSync()
}
csync_set_module_property(_csync_ctx, "bandwidth_limit_upload", &uploadLimit);
csync_set_file_progress_callback( _csync_ctx, cb_file_progress );
csync_set_overall_progress_callback( _csync_ctx, cb_overall_progress );
csync_set_progress_callback( _csync_ctx, cb_progress );
csync_set_module_property(_csync_ctx, "csync_context", _csync_ctx);
csync_set_userdata(_csync_ctx, this);
@ -406,6 +405,22 @@ void CSyncThread::startSync()
qDebug() << Q_FUNC_INFO << "Sync finished";
}
void CSyncThread::cb_progress( CSYNC_PROGRESS *progress, void *userdata )
{
if( !progress ) {
qDebug() << "No progress block in progress callback found!";
return;
}
if( !userdata ) {
qDebug() << "No thread given in progress callback!";
return;
}
QString path = QUrl::fromEncoded(progress->path).toString();
CSyncThread *thread = static_cast<CSyncThread*>(userdata);
}
void CSyncThread::cb_file_progress(const char *remote_url, enum csync_notify_type_e kind,
long long o1, long long o2, void *userdata)
{

View file

@ -54,6 +54,7 @@ signals:
void csyncUnavailable();
void treeWalkResult(const SyncFileItemVector&);
void transmissionProgress( Progress::Info progress );
void fileTransmissionProgress( Progress::Kind, const QString&, qint64, qint64);
void overallTransmissionProgress( const QString& file, int file_no, int file_cnt, qint64 o1, qint64 o2 );
void csyncStateDbFile( const QString& );
@ -72,6 +73,7 @@ private:
void *userdata);
static void cb_overall_progress(const char *file_name, int file_no,
int file_cnt, long long o1, long long o2, void *userdata);
static void cb_progress( CSYNC_PROGRESS *progress, void *userdata );
static int treewalkLocal( TREE_WALK_FILE*, void *);
static int treewalkRemote( TREE_WALK_FILE*, void *);

View file

@ -37,6 +37,17 @@ public:
};
typedef ProgressKind_s Kind;
struct ProgressInfo_s {
QString file;
Kind kind;
qint64 file_count;
qint64 current_file_no;
qint64 byte_sum;
qint64 byte_current;
};
typedef ProgressInfo_s Info;
static QString asString( Kind );
};