Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Goetz <markus@woboq.com>2014-02-19 13:51:04 +0400
committerMarkus Goetz <markus@woboq.com>2014-02-19 13:51:04 +0400
commit63083a558bb695a97c7f56f011dc6cb50eb8ade2 (patch)
tree8d9c9d05b616ee8c19e0473e724e0d22f94ee465 /src/owncloudcmd
parentfcc0e89044c5e5b8584671b62a33a74167189879 (diff)
OwncloudCmd: Print update phase duration values
Diffstat (limited to 'src/owncloudcmd')
-rw-r--r--src/owncloudcmd/owncloudcmd.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/owncloudcmd/owncloudcmd.cpp b/src/owncloudcmd/owncloudcmd.cpp
index d8e53a6da..e4d710340 100644
--- a/src/owncloudcmd/owncloudcmd.cpp
+++ b/src/owncloudcmd/owncloudcmd.cpp
@@ -30,6 +30,29 @@
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 echo, int verify, void*)
{
std::cout << "** Authentication required: \n" << prompt << std::endl;
@@ -44,6 +67,7 @@ struct CmdOptions {
QString target_url;
QString config_directory;
QString proxy;
+ bool silent;
};
void help()
@@ -56,6 +80,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;
@@ -97,6 +122,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();
}
@@ -126,7 +153,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("-");
@@ -174,9 +201,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(), &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();