mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Merge remote-tracking branch 'origin/master'
Conflicts: src/owncloudcmd/owncloudcmd.cpp
This commit is contained in:
commit
1be322579c
@ -446,6 +446,7 @@ endif()
|
||||
|
||||
set(owncloudcmd_NAME ${APPLICATION_EXECUTABLE}cmd)
|
||||
set(OWNCLOUDCMD_SRC owncloudcmd/owncloudcmd.cpp)
|
||||
qt_wrap_cpp(OWNCLOUDCMD_MOCS owncloudcmd/owncloudcmd.cpp)
|
||||
add_executable(${owncloudcmd_NAME} ${OWNCLOUDCMD_SRC})
|
||||
qt5_use_modules(${owncloudcmd_NAME} Network Sql)
|
||||
set_target_properties(${owncloudcmd_NAME} PROPERTIES
|
||||
|
||||
@ -635,6 +635,12 @@ void AccountSettings::slotSetProgress(const QString& folder, const Progress::Inf
|
||||
case Progress::NormalError:
|
||||
case Progress::FatalError:
|
||||
break;
|
||||
case Progress::StartLocalUpdate:
|
||||
case Progress::EndLocalUpdate:
|
||||
case Progress::StartRemoteUpdate:
|
||||
case Progress::EndRemoteUpdate:
|
||||
// FIXME could be interesting to show this to the user
|
||||
break;
|
||||
}
|
||||
|
||||
QString fileProgressString;
|
||||
|
||||
@ -415,19 +415,21 @@ void CSyncThread::handleSyncError(CSYNC *ctx, const char *state) {
|
||||
|
||||
static void updater_progress_callback(CSYNC_PROGRESS *progress, void *userdata)
|
||||
{
|
||||
static QElapsedTimer localTimer;
|
||||
static QElapsedTimer remoteTimer;
|
||||
Progress::Info pInfo;
|
||||
if (progress->kind == CSYNC_NOTIFY_START_LOCAL_UPDATE) {
|
||||
localTimer.start();
|
||||
pInfo.kind = Progress::StartLocalUpdate;
|
||||
} else if (progress->kind == CSYNC_NOTIFY_FINISHED_LOCAL_UPDATE) {
|
||||
// There is also localTimer.nsecsElapsed()
|
||||
qDebug() << "Local Update took" << localTimer.elapsed() << "msec";
|
||||
pInfo.kind = Progress::EndLocalUpdate;
|
||||
} else if (progress->kind == CSYNC_NOTIFY_START_REMOTE_UPDATE) {
|
||||
remoteTimer.start();
|
||||
pInfo.kind = Progress::StartRemoteUpdate;
|
||||
} else if (progress->kind == CSYNC_NOTIFY_FINISHED_REMOTE_UPDATE) {
|
||||
qDebug() << "Remote Update took" << remoteTimer.elapsed() << "msec";
|
||||
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 );
|
||||
}
|
||||
|
||||
void CSyncThread::startSync()
|
||||
@ -506,7 +508,7 @@ void CSyncThread::startSync()
|
||||
|
||||
// csync_set_auth_callback( _csync_ctx, getauth );
|
||||
csync_set_log_callback( csyncLogCatcher );
|
||||
csync_set_log_level( 11 );
|
||||
//csync_set_log_level( 11 ); don't set the loglevel here, it shall be done by folder.cpp or owncloudcmd.cpp
|
||||
|
||||
_syncTime.start();
|
||||
|
||||
|
||||
@ -64,6 +64,11 @@ QString Progress::asResultString( const Progress::Info& progress)
|
||||
case EndRename:
|
||||
re = QCoreApplication::translate( "progress", "Moved to %1").arg(progress.rename_target);
|
||||
break;
|
||||
case StartLocalUpdate:
|
||||
case EndLocalUpdate:
|
||||
case StartRemoteUpdate:
|
||||
case EndRemoteUpdate:
|
||||
break; // FIXME
|
||||
default:
|
||||
Q_ASSERT(false);
|
||||
}
|
||||
@ -118,6 +123,11 @@ QString Progress::asActionString( Kind kind )
|
||||
case EndRename:
|
||||
re = QCoreApplication::translate( "progress", "moved");
|
||||
break;
|
||||
case StartLocalUpdate:
|
||||
case EndLocalUpdate:
|
||||
case StartRemoteUpdate:
|
||||
case EndRemoteUpdate:
|
||||
break; // FIXME
|
||||
default:
|
||||
Q_ASSERT(false);
|
||||
}
|
||||
|
||||
@ -46,7 +46,11 @@ namespace Progress
|
||||
EndRename,
|
||||
SoftError,
|
||||
NormalError,
|
||||
FatalError
|
||||
FatalError,
|
||||
StartLocalUpdate,
|
||||
EndLocalUpdate,
|
||||
StartRemoteUpdate,
|
||||
EndRemoteUpdate
|
||||
};
|
||||
|
||||
struct Info {
|
||||
|
||||
@ -32,6 +32,28 @@
|
||||
|
||||
using namespace Mirall;
|
||||
|
||||
class OwncloudCmd : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
OwncloudCmd() : QObject() { }
|
||||
public slots:
|
||||
void transmissionProgressSlot(Progress::Info pI) {
|
||||
static QElapsedTimer localTimer;
|
||||
static QElapsedTimer remoteTimer;
|
||||
if (pI.kind == Progress::StartLocalUpdate) {
|
||||
localTimer.start();
|
||||
} else if (pI.kind == Progress::EndLocalUpdate) {
|
||||
// There is also localTimer.nsecsElapsed()
|
||||
qDebug() << "Local Update took" << localTimer.elapsed() << "msec";
|
||||
} else if (pI.kind == Progress::StartRemoteUpdate) {
|
||||
remoteTimer.start();
|
||||
} else if (pI.kind == Progress::EndRemoteUpdate) {
|
||||
qDebug() << "Remote Update took" << remoteTimer.elapsed() << "msec";
|
||||
}
|
||||
}
|
||||
};
|
||||
#include "owncloudcmd/moc_owncloudcmd.cpp"
|
||||
|
||||
|
||||
int getauth(const char* prompt, char* buf, size_t len, int, int, void*)
|
||||
{
|
||||
@ -47,6 +69,7 @@ struct CmdOptions {
|
||||
QString target_url;
|
||||
QString config_directory;
|
||||
QString proxy;
|
||||
bool silent;
|
||||
};
|
||||
|
||||
void help()
|
||||
@ -59,6 +82,7 @@ void help()
|
||||
std::cout << "uses the setting from a configured sync client." << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "Options:" << std::endl;
|
||||
std::cout << " --silent Don't be so verbose" << std::endl;
|
||||
std::cout << " --confdir = configdir: Read config from there." << std::endl;
|
||||
std::cout << " --httpproxy = proxy: Specify a http proxy to use." << std::endl;
|
||||
std::cout << " Proxy is http://server:port" << std::endl;
|
||||
@ -83,6 +107,8 @@ void parseOptions( const QStringList& app_args, CmdOptions *options )
|
||||
}
|
||||
options->target_url.append("remote.php/webdav/");
|
||||
}
|
||||
if (options->target_url.startsWith("http"))
|
||||
options->target_url.replace(0, 4, "owncloud");
|
||||
options->source_dir = args.takeLast();
|
||||
if( !QFile::exists( options->source_dir )) {
|
||||
std::cerr << "Source dir does not exists.";
|
||||
@ -100,6 +126,8 @@ void parseOptions( const QStringList& app_args, CmdOptions *options )
|
||||
options->config_directory = it.next();
|
||||
} else if( option == "--httpproxy" && !it.peekNext().startsWith("-")) {
|
||||
options->proxy = it.next();
|
||||
} else if( option == "--silent") {
|
||||
options->silent = true;
|
||||
} else {
|
||||
help();
|
||||
}
|
||||
@ -144,7 +172,7 @@ int main(int argc, char **argv) {
|
||||
qFatal("ne_sock_init failed!");
|
||||
}
|
||||
|
||||
csync_set_log_level(11);
|
||||
csync_set_log_level(options.silent ? 1 : 11);
|
||||
csync_enable_conflictcopys(_csync_ctx);
|
||||
Logger::instance()->setLogFile("-");
|
||||
|
||||
@ -192,9 +220,12 @@ int main(int argc, char **argv) {
|
||||
clientProxy.setCSyncProxy(QUrl(url), _csync_ctx);
|
||||
}
|
||||
|
||||
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(Progress::Info)));
|
||||
csyncthread.startSync();
|
||||
|
||||
app.exec();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user