From a7b388dc4a6e3bedd2972d698ad3f3de2b462951 Mon Sep 17 00:00:00 2001 From: Shuai Lin Date: Fri, 16 Oct 2015 14:32:54 +0800 Subject: [PATCH 1/2] fix repo tranfer percentage updating --- src/rpc/local-repo.h | 6 +++++- src/rpc/rpc-client.cpp | 6 +++++- src/ui/repo-tree-model.cpp | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/rpc/local-repo.h b/src/rpc/local-repo.h index ba9b33bc6..637d8a0f9 100644 --- a/src/rpc/local-repo.h +++ b/src/rpc/local-repo.h @@ -39,6 +39,8 @@ class LocalRepo { SyncState sync_state; QString sync_state_str; QString sync_error_str; + int transfer_percentage; + int transfer_rate; LocalRepo() : encrypted(false), @@ -61,7 +63,9 @@ class LocalRepo { && auto_sync == rhs.auto_sync && sync_state == rhs.sync_state && sync_state_str == rhs.sync_state_str - && sync_error_str == rhs.sync_error_str; + && sync_error_str == rhs.sync_error_str + && transfer_rate == rhs.transfer_rate + && transfer_percentage == rhs.transfer_percentage; } bool operator!=(const LocalRepo& rhs) const { diff --git a/src/rpc/rpc-client.cpp b/src/rpc/rpc-client.cpp index 7dc2492d8..0a7c299ac 100644 --- a/src/rpc/rpc-client.cpp +++ b/src/rpc/rpc-client.cpp @@ -364,6 +364,10 @@ void SeafileRpcClient::getSyncStatus(LocalRepo &repo) repo.setSyncInfo(state, g_strcmp0(state, "error") == 0 ? err : NULL); + if (repo.sync_state == LocalRepo::SYNC_STATE_ING) { + getRepoTransferInfo(repo.id, &repo.transfer_rate, &repo.transfer_percentage); + } + g_free (state); g_free (err); g_object_unref(task); @@ -868,7 +872,7 @@ int SeafileRpcClient::markFileLockState(const QString &repo_id, return 0; } -int SeafileRpcClient::generateMagicAndRandomKey(int enc_version, +int SeafileRpcClient::generateMagicAndRandomKey(int enc_version, const QString &repo_id, const QString &passwd, QString *magic, diff --git a/src/ui/repo-tree-model.cpp b/src/ui/repo-tree-model.cpp index 09334327d..0a784f23c 100644 --- a/src/ui/repo-tree-model.cpp +++ b/src/ui/repo-tree-model.cpp @@ -331,6 +331,9 @@ void RepoTreeModel::refreshRepoItem(RepoItem *item, void *data) LocalRepo local_repo; seafApplet->rpcClient()->getLocalRepo(item->repo().id, &local_repo); if (local_repo != item->localRepo()) { + // if (local_repo.isValid()) { + // printf("local repo of %s changed\n", local_repo.name.toUtf8().data()); + // } item->setLocalRepo(local_repo); QModelIndex index = indexFromItem(item); emit dataChanged(index,index); From e3ef7ebe2bad3878c5a7fca8133d98cf76eabef6 Mon Sep 17 00:00:00 2001 From: Shuai Lin Date: Fri, 16 Oct 2015 14:42:26 +0800 Subject: [PATCH 2/2] fix travis ci build for qt5 --- scripts/install-deps-linux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install-deps-linux.sh b/scripts/install-deps-linux.sh index cd79b138a..a48087c54 100755 --- a/scripts/install-deps-linux.sh +++ b/scripts/install-deps-linux.sh @@ -40,7 +40,7 @@ sudo apt-get update -qq sudo apt-get install -y valac uuid-dev libevent-dev re2c libjansson-dev cmake cmake-data libqt4-dev if [ ! -z "$USE_QT5" ]; then - sudo add-apt-repository -y ppa:beineri/opt-qt541 + sudo add-apt-repository -y ppa:beineri/opt-qt542 sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test sudo apt-get update -qq sudo apt-get install -y gcc-4.8 g++-4.8