From 56c53e918847aa3035e408f9472b4c7bebeb3781 Mon Sep 17 00:00:00 2001 From: Xavier Michelon Date: Thu, 28 Sep 2023 12:39:24 +0200 Subject: [PATCH] fix(GODT-2932): fix syncing not being reported in GUI. --- internal/frontend/bridge-gui/bridge-gui/UserList.cpp | 6 +++--- .../frontend/bridge-gui/bridgepp/bridgepp/User/User.cpp | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/internal/frontend/bridge-gui/bridge-gui/UserList.cpp b/internal/frontend/bridge-gui/bridge-gui/UserList.cpp index 059d0b1e..b8a9946b 100644 --- a/internal/frontend/bridge-gui/bridge-gui/UserList.cpp +++ b/internal/frontend/bridge-gui/bridge-gui/UserList.cpp @@ -262,7 +262,7 @@ void UserList::onUsedBytesChanged(QString const &userID, qint64 usedBytes) { void UserList::onSyncStarted(QString const &userID) { int const index = this->rowOfUserID(userID); if (index < 0) { - app().log().error(QString("Received onSyncStarted event for unknown userID %1").arg(userID)); + app().log().error(QString("Received syncStarted event for unknown userID %1").arg(userID)); return; } users_[index]->setIsSyncing(true); @@ -275,7 +275,7 @@ void UserList::onSyncStarted(QString const &userID) { void UserList::onSyncFinished(QString const &userID) { int const index = this->rowOfUserID(userID); if (index < 0) { - app().log().error(QString("Received onSyncFinished event for unknown userID %1").arg(userID)); + app().log().error(QString("Received syncFinished event for unknown userID %1").arg(userID)); return; } users_[index]->setIsSyncing(false); @@ -293,7 +293,7 @@ void UserList::onSyncProgress(QString const &userID, double progress, float elap Q_UNUSED(remainingMs) int const index = this->rowOfUserID(userID); if (index < 0) { - app().log().error(QString("Received onSyncFinished event for unknown userID %1").arg(userID)); + app().log().error(QString("Received syncProgress event for unknown userID %1").arg(userID)); return; } users_[index]->setSyncProgress(progress); diff --git a/internal/frontend/bridge-gui/bridgepp/bridgepp/User/User.cpp b/internal/frontend/bridge-gui/bridgepp/bridgepp/User/User.cpp index 0059f46a..85b0b7f4 100644 --- a/internal/frontend/bridge-gui/bridgepp/bridgepp/User/User.cpp +++ b/internal/frontend/bridge-gui/bridgepp/bridgepp/User/User.cpp @@ -325,6 +325,10 @@ float User::syncProgress() const { /// \param[in] progress The progress ratio. //**************************************************************************************************************************************************** void User::setSyncProgress(float progress) { + // In some cases, we may have missed the syncStarted event because it was sent by bridge before the userChanged event, + // so we force the state to 'syncing' (GODT-2932). + this->setIsSyncing(true); + if (qAbs(syncProgress_ - progress) < 0.00001) { return; }