mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 04:55:48 +03:00
Display more details of the sync progress in the settings dialog.
- Add margin to sync progress text. - Make use of the text in FolderStatusDelegate::FolderSyncText. Signed-off-by: Camila Ayres <hello@camilasan.com>
This commit is contained in:
parent
46f79442ae
commit
b5888f4719
2 changed files with 15 additions and 9 deletions
|
@ -320,15 +320,18 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
|||
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &progressBarOpt, painter, option.widget);
|
||||
#endif
|
||||
|
||||
// Overall Progress Text
|
||||
QRect overallProgressRect;
|
||||
overallProgressRect.setTop(progressBarRect.bottom() + margin);
|
||||
overallProgressRect.setHeight(fileNameTextHeight);
|
||||
overallProgressRect.setLeft(progressBarRect.left());
|
||||
overallProgressRect.setWidth(progressBarRect.width());
|
||||
// itemString is e.g. Syncing fileName1, filename2
|
||||
// syncText is Synchronizing files in local folders or Synchronizing virtual files in local folder
|
||||
const auto generalSyncStatus = !itemString.isEmpty() ? itemString : syncText;
|
||||
QRect generalSyncStatusRect;
|
||||
generalSyncStatusRect.setTop(progressBarRect.bottom() + margin);
|
||||
generalSyncStatusRect.setHeight(fileNameTextHeight);
|
||||
generalSyncStatusRect.setLeft(progressBarRect.left());
|
||||
generalSyncStatusRect.setWidth(progressBarRect.width());
|
||||
painter->setFont(progressFont);
|
||||
|
||||
painter->drawText(QStyle::visualRect(option.direction, option.rect, overallProgressRect), Qt::AlignLeft | Qt::AlignVCenter, overallString);
|
||||
painter->drawText(QStyle::visualRect(option.direction, option.rect, generalSyncStatusRect), Qt::AlignLeft | Qt::AlignVCenter, generalSyncStatus);
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
|
|
|
@ -270,7 +270,8 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
|
|||
return accountConnected;
|
||||
case Qt::ToolTipRole: {
|
||||
if (!progress.isNull()) {
|
||||
return progress._progressString;
|
||||
// e.g. 13 seconds left, 500 MB of 1 GB, file 3 of 6
|
||||
return progress._overallSyncString;
|
||||
}
|
||||
auto toolTip = accountConnected
|
||||
? Theme::instance()->statusHeaderText(folder->syncResult().status())
|
||||
|
@ -307,12 +308,14 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
|
|||
return Theme::instance()->folderOfflineIcon();
|
||||
}
|
||||
case FolderStatusDelegate::SyncProgressItemString:
|
||||
// e.g. Syncing fileName1, filename2
|
||||
return progress._progressString;
|
||||
case FolderStatusDelegate::WarningCount:
|
||||
return progress._warningCount;
|
||||
case FolderStatusDelegate::SyncProgressOverallPercent:
|
||||
return progress._overallPercent;
|
||||
case FolderStatusDelegate::SyncProgressOverallString:
|
||||
// 13 seconds left, 500 MB of 1 GB, file 3 of 6
|
||||
return progress._overallSyncString;
|
||||
case FolderStatusDelegate::FolderSyncText:
|
||||
if (folder->virtualFilesEnabled()) {
|
||||
|
@ -1137,7 +1140,7 @@ void FolderStatusModel::slotSetProgress(const ProgressInfo &progress)
|
|||
}
|
||||
} else if (totalFileCount > 0) {
|
||||
// Don't attempt to estimate the time left if there is no kb to transfer.
|
||||
overallSyncString = tr("file %1 of %2").arg(currentFile).arg(totalFileCount);
|
||||
overallSyncString = tr("%1 file %2 of %3").arg(kindString).arg(currentFile).arg(totalFileCount);
|
||||
}
|
||||
|
||||
pi->_overallSyncString = overallSyncString;
|
||||
|
|
Loading…
Reference in a new issue