[Pkg-owncloud-commits] [owncloud-client] 11/332: made the code a little cleaner
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 fae3e46a599dd5c05ebb0347013e33d1a5e2f027
Author: Eran <etherpulse at gmail.com>
Date: Tue May 20 16:56:39 2014 +0300
made the code a little cleaner
---
src/mirall/accountsettings.cpp | 2 +-
src/mirall/utility.cpp | 26 +++++++++++++-------------
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/mirall/accountsettings.cpp b/src/mirall/accountsettings.cpp
index faf1c2a..5645a42 100644
--- a/src/mirall/accountsettings.cpp
+++ b/src/mirall/accountsettings.cpp
@@ -616,7 +616,7 @@ void AccountSettings::slotSetProgress(const QString& folder, const Progress::Inf
QString s1 = Utility::octetsToString( curItemProgress );
QString s2 = Utility::octetsToString( curItem._size );
//: Example text: "uploading foobar.png (1MB of 2MB)"
- fileProgressString = tr("%1 %2 (%3 of %4) time left %5 , at a rate of %6")
+ 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::octetsToString(progress.getFileEstimate(curItem).getEstimatedBandwidth()) );
diff --git a/src/mirall/utility.cpp b/src/mirall/utility.cpp
index 4557edf..2c06f77 100644
--- a/src/mirall/utility.cpp
+++ b/src/mirall/utility.cpp
@@ -465,33 +465,33 @@ QString Utility::timeToDescriptiveString(quint64 msecs)
- return timeToDescriptiveString(timeMapping, msecs, 1);
+ return timeToDescriptiveString(timeMapping, msecs, 2);
}
QString Utility::timeToDescriptiveString(QList<QPair<QString,quint32> > &timeMapping, quint64 msecs, quint8 precision)
{
quint64 secs = msecs / 1000;
QString retStr = "0 seconds"; // default value in case theres no actual time in msecs.
- qint64 values[6];
- int idx = 0;
+ QList<quint64> values;
+ bool timeStartFound = false;
- for(QList<QPair<QString,quint32> >::Iterator itr = timeMapping.begin(); itr != timeMapping.end() && idx <= precision; itr++) {
+ for(QList<QPair<QString,quint32> >::Iterator itr = timeMapping.begin(); itr != timeMapping.end() && precision > 0; itr++) {
quint64 result = secs / itr->second;
- if(idx == 0) {
+ if(!timeStartFound) {
if(result == 0 ) {
continue;
- } else {
- retStr = itr->first;
- retStr.prepend(" ");
- }
+ }
+ retStr = QString(" ").append(itr->first);
+ timeStartFound= true;
}
secs -= result * itr->second;
- values[idx++] = result;
+ values.append(result);
+ precision--;
}
- for(idx--; idx >= 0; idx--) {
- retStr = retStr.prepend("%1").arg(values[idx], 2, 10, QChar('0'));
- if(0 < idx) {
+ 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(":");
}
}
--
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