Skip to content

Commit

Permalink
Merge pull request #734 from haiwen/fix-transfer-percentage-update
Browse files Browse the repository at this point in the history
fix repo tranfer percentage updating
  • Loading branch information
killing committed Oct 16, 2015
2 parents c735ba1 + e3ef7eb commit 96b8e97
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion scripts/install-deps-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion src/rpc/local-repo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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 {
Expand Down
6 changes: 5 additions & 1 deletion src/rpc/rpc-client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions src/ui/repo-tree-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 96b8e97

Please sign in to comment.