[Pkg-owncloud-commits] [owncloud-client] 12/332: chaned the design a little
Sandro Knauß
hefee-guest at moszumanska.debian.org
Thu Aug 14 21:06:32 UTC 2014
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 ba5e955ccb3d22b55783931055aff331a43a01cf
Author: Eran <etherpulse at gmail.com>
Date: Sun May 25 22:43:41 2014 +0300
chaned the design a little
---
src/mirall/accountsettings.cpp | 6 +++---
src/mirall/owncloudgui.cpp | 4 ++--
src/mirall/utility.cpp | 49 +++++++++++++++++++++++-------------------
src/mirall/utility.h | 7 +++---
4 files changed, 36 insertions(+), 30 deletions(-)
diff --git a/src/mirall/accountsettings.cpp b/src/mirall/accountsettings.cpp
index 5645a42..04ad7b2 100644
--- a/src/mirall/accountsettings.cpp
+++ b/src/mirall/accountsettings.cpp
@@ -615,10 +615,10 @@ void AccountSettings::slotSetProgress(const QString& folder, const Progress::Inf
if (Progress::isSizeDependent(curItem._instruction)) {
QString s1 = Utility::octetsToString( curItemProgress );
QString s2 = Utility::octetsToString( curItem._size );
- //: Example text: "uploading foobar.png (1MB of 2MB)"
+ //: Example text: "uploading foobar.png (1MB of 2MB) time left 2 minutes ar a rate of 24Kb"
fileProgressString = tr("%1 %2 (%3 of %4) time left %5 at a rate of %6")
.arg(kindString, itemFileName, s1, s2,
- Utility::timeToDescriptiveString(progress.getFileEstimate(curItem).getEtaEstimate()),
+ Utility::timeToDescriptiveString(progress.getFileEstimate(curItem).getEtaEstimate(), 3, " ", true),
Utility::octetsToString(progress.getFileEstimate(curItem).getEstimatedBandwidth()) );
} else {
//: Example text: "uploading foobar.png"
@@ -634,7 +634,7 @@ void AccountSettings::slotSetProgress(const QString& folder, const Progress::Inf
QString overallSyncString = tr("%1 of %2, file %3 of %4\nTime left %5")
.arg(s1, s2)
.arg(currentFile).arg(progress._totalFileCount)
- .arg( Utility::timeToDescriptiveString(progress.totalEstimate().getEtaEstimate()) );
+ .arg( Utility::timeToDescriptiveString(progress.totalEstimate().getEtaEstimate(), 3, " ", true) );
item->setData( overallSyncString, FolderStatusDelegate::SyncProgressOverallString );
diff --git a/src/mirall/owncloudgui.cpp b/src/mirall/owncloudgui.cpp
index 7004de0..259bb01 100644
--- a/src/mirall/owncloudgui.cpp
+++ b/src/mirall/owncloudgui.cpp
@@ -408,11 +408,11 @@ void ownCloudGui::slotUpdateProgress(const QString &folder, const Progress::Info
quint64 currentFile = progress._completedFileCount + progress._currentItems.count();
_actionStatus->setText( tr("Syncing %1 of %2 (%3 left)")
.arg( currentFile ).arg( progress._totalFileCount )
- .arg( Utility::timeToDescriptiveString(progress.totalEstimate().getEtaEstimate()) ) );
+ .arg( Utility::timeToDescriptiveString(progress.totalEstimate().getEtaEstimate(), 1, ":",false) ) );
} else {
_actionStatus->setText( tr("Syncing %1 (%2 left)")
.arg( totalSizeStr )
- .arg( Utility::timeToDescriptiveString(progress.totalEstimate().getEtaEstimate()) ) );
+ .arg( Utility::timeToDescriptiveString(progress.totalEstimate().getEtaEstimate(), 1, ":",false) ) );
}
diff --git a/src/mirall/utility.cpp b/src/mirall/utility.cpp
index 2c06f77..9706132 100644
--- a/src/mirall/utility.cpp
+++ b/src/mirall/utility.cpp
@@ -452,27 +452,27 @@ qint64 Utility::qDateTimeToTime_t(const QDateTime& t)
return t.toMSecsSinceEpoch() / 1000;
}
-QString Utility::timeToDescriptiveString(quint64 msecs)
-{
- //TODO change to initializers list when possible.
- static QList<QPair<QString,quint32> > timeMapping = QList<QPair<QString,quint32> >() <<
- QPair<QString,quint32>("years",86400*365) <<
- QPair<QString,quint32>("months",86400*30) <<
- QPair<QString,quint32>("days",86400) <<
- QPair<QString,quint32>("hours",3600) <<
- QPair<QString,quint32>("minutes",60) <<
- QPair<QString,quint32>("seconds",1);
-
-
+//TODO change to initializers list when possible.
+static QList<QPair<QString,quint32> > timeMapping = QList<QPair<QString,quint32> >() <<
+ QPair<QString,quint32>("years",86400*365) <<
+ QPair<QString,quint32>("months",86400*30) <<
+ QPair<QString,quint32>("days",86400) <<
+ QPair<QString,quint32>("hours",3600) <<
+ QPair<QString,quint32>("minutes",60) <<
+ QPair<QString,quint32>("seconds",1);
- return timeToDescriptiveString(timeMapping, msecs, 2);
+
+QString Utility::timeToDescriptiveString(quint64 msecs, quint8 precision, QString separator, bool specific)
+{
+ return timeToDescriptiveString(timeMapping, msecs, precision, separator, specific);
}
-QString Utility::timeToDescriptiveString(QList<QPair<QString,quint32> > &timeMapping, quint64 msecs, quint8 precision)
+
+QString Utility::timeToDescriptiveString(QList<QPair<QString,quint32> > &timeMapping, quint64 msecs, quint8 precision, QString separator, bool specific)
{
quint64 secs = msecs / 1000;
QString retStr = "0 seconds"; // default value in case theres no actual time in msecs.
- QList<quint64> values;
+ QList<QPair<QString,quint32> > values;
bool timeStartFound = false;
for(QList<QPair<QString,quint32> >::Iterator itr = timeMapping.begin(); itr != timeMapping.end() && precision > 0; itr++) {
@@ -480,20 +480,25 @@ QString Utility::timeToDescriptiveString(QList<QPair<QString,quint32> > &timeMap
if(!timeStartFound) {
if(result == 0 ) {
continue;
- }
- retStr = QString(" ").append(itr->first);
+ }
+ retStr = "";
timeStartFound= true;
}
secs -= result * itr->second;
- values.append(result);
+ values.append(QPair<QString,quint32>(itr->first,result));
precision--;
}
- for(QList<quint64>::Iterator itr = values.end()-1; itr >= values.begin(); itr--) {
- retStr = retStr.prepend("%1").arg(itr.i->t(), 2, 10, QChar('0'));
- if(itr > values.begin()) {
- retStr.prepend(":");
+ for(QList<QPair<QString,quint32> >::Iterator itr = values.begin(); itr < values.end(); itr++) {
+ retStr = retStr.append("%1").arg(itr->second, 2, 10, QChar('0'));
+ if(specific || itr == values.end()-1) {
+ retStr.append(" ").append(itr->first);
+ }
+ if(itr < values.end()-1) {
+ retStr.append(separator);
}
+
+
}
return retStr;
diff --git a/src/mirall/utility.h b/src/mirall/utility.h
index 0ef07f7..2e21d79 100644
--- a/src/mirall/utility.h
+++ b/src/mirall/utility.h
@@ -62,15 +62,16 @@ namespace Utility
qint64 qDateTimeToTime_t(const QDateTime &t);
- QString timeToDescriptiveString(quint64 msecs);
+
/**
* @brief Convert milliseconds to HMS string.
* @param quint64 msecs the milliseconds to convert to string.
* @param uint precision the amount of sub dviving scale to include in the result.
* @return an HMS representation of the milliseconds value.
*/
- QString timeToDescriptiveString(QList<QPair<QString,quint32> > &timeMapping, quint64 msecs, quint8 precision);
-
+ QString timeToDescriptiveString(QList<QPair<QString,quint32> > &timeMapping, quint64 msecs, quint8 precision, QString separator, bool specific);
+ QString timeToDescriptiveString(quint64 msecs, quint8 precision, QString separator, bool specific);
+
// convinience OS detection methods
bool isWindows();
bool isMac();
--
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