fix(GODT-2932): fix syncing not being reported in GUI.

This commit is contained in:
Xavier Michelon 2023-09-28 12:39:24 +02:00
parent bb67d95669
commit 56c53e9188
2 changed files with 7 additions and 3 deletions

View File

@ -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);

View File

@ -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;
}