[Pkg-owncloud-commits] [owncloud-client] 227/470: Folder info layout adjustments #3403
Sandro Knauß
hefee-guest at moszumanska.debian.org
Thu May 12 16:25:06 UTC 2016
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit c5fbde412c7f0728881e2e1c7448d8e444597a52
Author: Christian Kamm <mail at ckamm.de>
Date: Thu Jan 21 09:56:01 2016 +0100
Folder info layout adjustments #3403
* Remove duplicate remote path
* Use thin progress bar
* Move bandwidth and file info to tooltip
* Shorten overall progress message
This also fixes #4562 by making the layout not dependent on the
width of the displayed text.
---
src/gui/folderstatusdelegate.cpp | 42 +++++++++++-----------------------------
src/gui/folderstatusmodel.cpp | 19 +++++++++++-------
2 files changed, 23 insertions(+), 38 deletions(-)
diff --git a/src/gui/folderstatusdelegate.cpp b/src/gui/folderstatusdelegate.cpp
index f47960c..c9b3b56 100644
--- a/src/gui/folderstatusdelegate.cpp
+++ b/src/gui/folderstatusdelegate.cpp
@@ -237,17 +237,12 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
const bool showProgess = !overallString.isEmpty() || !itemString.isEmpty();
if(!showProgess) {
painter->setFont(subFont);
- QString elidedRemotePathText;
-
- if (remotePath.isEmpty() || remotePath == QLatin1String("/")) {
- elidedRemotePathText = subFm.elidedText(tr("Syncing selected files in your account with"),
- Qt::ElideRight, remotePathRect.width());
- } else {
- elidedRemotePathText = subFm.elidedText(tr("Remote path: %1").arg(remotePath),
- Qt::ElideMiddle, remotePathRect.width());
- }
+ QString elidedRemotePathText = subFm.elidedText(
+ tr("Synchronizing with local folder"),
+ Qt::ElideRight, remotePathRect.width());
painter->drawText(QStyle::visualRect(option.direction, option.rect, remotePathRect),
textAlign, elidedRemotePathText);
+
QString elidedPathText = subFm.elidedText(pathText, Qt::ElideMiddle, localPathRect.width());
painter->drawText(QStyle::visualRect(option.direction, option.rect, localPathRect),
textAlign, elidedPathText);
@@ -288,21 +283,17 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
// Sync File Progress Bar: Show it if syncFile is not empty.
if (showProgess) {
int fileNameTextHeight = subFm.boundingRect(tr("File")).height();
- int barHeight = qMax(fileNameTextHeight, aliasFm.height()+4);
+ int barHeight = 7; // same height as quota bar
int overallWidth = option.rect.right() - aliasMargin - optionsButtonVisualRect.width() - nextToIcon;
painter->save();
- // Sizes-Text
- QRect octetRect = progressFm.boundingRect(QRect(), 0, overallString );
- int progressTextWidth = octetRect.width() + 5;
-
// Overall Progress Bar.
QRect pBRect;
pBRect.setTop( remotePathRect.top() );
pBRect.setLeft( nextToIcon );
pBRect.setHeight(barHeight);
- pBRect.setWidth( overallWidth - progressTextWidth - 2 * margin );
+ pBRect.setWidth( overallWidth - 2 * margin );
QStyleOptionProgressBarV2 pBarOpt;
@@ -317,27 +308,16 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
// Overall Progress Text
QRect overallProgressRect;
- overallProgressRect.setTop( pBRect.top() );
- overallProgressRect.setHeight( pBRect.height() );
- overallProgressRect.setLeft( pBRect.right()+margin);
- overallProgressRect.setWidth( progressTextWidth );
+ overallProgressRect.setTop( pBRect.bottom() + margin );
+ overallProgressRect.setHeight( fileNameTextHeight );
+ overallProgressRect.setLeft( pBRect.left() );
+ overallProgressRect.setWidth( pBRect.width() );
painter->setFont(progressFont);
painter->drawText(QStyle::visualRect(option.direction, option.rect, overallProgressRect),
- Qt::AlignRight | Qt::AlignVCenter, overallString);
+ Qt::AlignLeft | Qt::AlignVCenter, overallString);
// painter->drawRect(overallProgressRect);
- // Individual File Progress
- QRect fileRect;
- fileRect.setTop( pBRect.bottom() + margin);
- fileRect.setLeft(pBRect.left());
- fileRect.setWidth(overallWidth);
- fileRect.setHeight(fileNameTextHeight);
- QString elidedText = progressFm.elidedText(itemString, Qt::ElideLeft, fileRect.width());
-
- painter->drawText(QStyle::visualRect(option.direction, option.rect, fileRect),
- Qt::AlignLeft | Qt::AlignVCenter, elidedText);
-
painter->restore();
}
diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp
index b808cf8..f482b17 100644
--- a/src/gui/folderstatusmodel.cpp
+++ b/src/gui/folderstatusmodel.cpp
@@ -195,6 +195,9 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
case FolderStatusDelegate::FolderAccountConnected : return accountConnected;
case Qt::ToolTipRole: {
QString toolTip;
+ if (!progress.isNull()) {
+ return progress._progressString;
+ }
if ( accountConnected )
toolTip = Theme::instance()->statusHeaderText(f->syncResult().status());
else
@@ -803,10 +806,12 @@ void FolderStatusModel::slotSetProgress(const ProgressInfo &progress)
auto *pi = &_folders[folderIndex]._progress;
QVector<int> roles;
- roles << FolderStatusDelegate::SyncProgressItemString << FolderStatusDelegate::WarningCount;
+ roles << FolderStatusDelegate::SyncProgressItemString
+ << FolderStatusDelegate::WarningCount
+ << Qt::ToolTipRole;
if (!progress._currentDiscoveredFolder.isEmpty()) {
- pi->_progressString = tr("Checking for changes in '%1'").arg(progress._currentDiscoveredFolder);
+ pi->_overallSyncString = tr("Checking for changes in '%1'").arg(progress._currentDiscoveredFolder);
emit dataChanged(index(folderIndex), index(folderIndex), roles);
return;
}
@@ -911,11 +916,11 @@ void FolderStatusModel::slotSetProgress(const ProgressInfo &progress)
if (totalSize > 0) {
QString s1 = Utility::octetsToString( completedSize );
QString s2 = Utility::octetsToString( totalSize );
- //: Example text: "12 MB of 345 MB, file 6 of 7\nTotal time left 12 minutes"
- overallSyncString = tr("%1 of %2, file %3 of %4\nTotal time left %5")
+ //: Example text: "5 minutes left, 12 MB of 345 MB, file 6 of 7"
+ overallSyncString = tr("%5 left, %1 of %2, file %3 of %4")
.arg(s1, s2)
.arg(currentFile).arg(totalFileCount)
- .arg( Utility::durationToDescriptiveString2(progress.totalProgress().estimatedEta) );
+ .arg( Utility::durationToDescriptiveString1(progress.totalProgress().estimatedEta) );
} 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);
@@ -963,10 +968,10 @@ void FolderStatusModel::slotFolderSyncStateChange(Folder *f)
message = tr("Waiting for %n other folder(s)...", "", pos);
}
_folders[folderIndex]._progress = SubFolderInfo::Progress();
- _folders[folderIndex]._progress._progressString = message;
+ _folders[folderIndex]._progress._overallSyncString = message;
} else if (state == SyncResult::SyncPrepare) {
_folders[folderIndex]._progress = SubFolderInfo::Progress();
- _folders[folderIndex]._progress._progressString = tr("Preparing to sync...");
+ _folders[folderIndex]._progress._overallSyncString = tr("Preparing to sync...");
} else if (state == SyncResult::Problem || state == SyncResult::Success) {
// Reset the progress info after a sync.
_folders[folderIndex]._progress = SubFolderInfo::Progress();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list