Example #1
0
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;
    }
    Progress::Info pInfo;
    CSyncThread *thread = static_cast<CSyncThread*>(userdata);

    pInfo.kind                  = thread->csyncToProgressKind( progress->kind );
    pInfo.current_file          = QUrl::fromEncoded( progress->path ).toString();
    pInfo.file_size             = progress->file_size;
    pInfo.current_file_bytes    = progress->curr_bytes;

    pInfo.overall_file_count    = progress->overall_file_count;
    pInfo.current_file_no       = progress->current_file_no;
    pInfo.overall_transmission_size = progress->overall_transmission_size;
    pInfo.overall_current_bytes = progress->current_overall_bytes;
    pInfo.timestamp = QDateTime::currentDateTime();

    // Connect to something in folder!
    thread->transmissionProgress( pInfo );

}
Example #2
0
void csyncthread_updater_progress_callback(CSYNC_PROGRESS *progress, void *userdata)
{
    Progress::Info pInfo;
    if (progress->kind == CSYNC_NOTIFY_START_LOCAL_UPDATE) {
        pInfo.kind = Progress::StartLocalUpdate;
    } else if (progress->kind == CSYNC_NOTIFY_FINISHED_LOCAL_UPDATE) {
        pInfo.kind = Progress::EndLocalUpdate;
    } else if (progress->kind == CSYNC_NOTIFY_START_REMOTE_UPDATE) {
        pInfo.kind = Progress::StartRemoteUpdate;
    } else if (progress->kind == CSYNC_NOTIFY_FINISHED_REMOTE_UPDATE) {
        pInfo.kind = Progress::EndRemoteUpdate;
    } else {
        return; // FIXME, but most progress stuff should come from the new propagator
    }
    pInfo.timestamp = QDateTime::currentDateTime();
    CSyncThread *self = static_cast<CSyncThread*>(userdata);
    emit self->transmissionProgress( pInfo );
}