[Pkg-owncloud-commits] [owncloud-client] 03/332: Fixed Indentation and multiple concurrent files syncing case ... ..Also increased the height of folder progress bar alittle in order to accommodate the added estimation data

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu Aug 14 21:06:31 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 cd22a1846fbc6df796201498f860addf12c20760
Author: Eran <etherpulse at gmail.com>
Date:   Mon Apr 28 18:49:27 2014 +0300

    Fixed Indentation and multiple concurrent files syncing case ...
    ..Also increased the height of folder progress bar alittle in order to accommodate the added estimation data
---
 src/mirall/accountsettings.cpp   |  16 ++---
 src/mirall/folderstatusmodel.cpp |   2 +-
 src/mirall/owncloudgui.cpp       |   8 +--
 src/mirall/progressdispatcher.h  | 130 ++++++++++++++++++++-------------------
 4 files changed, 80 insertions(+), 76 deletions(-)

diff --git a/src/mirall/accountsettings.cpp b/src/mirall/accountsettings.cpp
index 1b343ee..db0f27c 100644
--- a/src/mirall/accountsettings.cpp
+++ b/src/mirall/accountsettings.cpp
@@ -616,10 +616,10 @@ 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/s")
-			.arg(kindString, itemFileName, s1, s2)
-			.arg( Utility::timeConversion(progress.currentFileEstimate().getEtaEstimate()) )
-			.arg( Utility::octetsToString(progress.currentFileEstimate().getEstimatedBandwidth()) );
+        fileProgressString = tr("%1 %2 (%3 of %4) , Time left : %5 at a rate of %6/s")
+            .arg(kindString, itemFileName, s1, s2,
+                 Utility::timeConversion(progress.getFileEstimate(curItem).getEtaEstimate()),
+                 Utility::octetsToString(progress.getFileEstimate(curItem).getEstimatedBandwidth()) );
     } else {
         //: Example text: "uploading foobar.png"
         fileProgressString = tr("%1 %2").arg(kindString, itemFileName);
@@ -632,10 +632,10 @@ void AccountSettings::slotSetProgress(const QString& folder, const Progress::Inf
     QString s1 = Utility::octetsToString( completedSize );
     QString s2 = Utility::octetsToString( progress._totalSize );
     QString overallSyncString = tr("%1 of %2, file %3 of %4\n%5")
-			.arg(s1, s2)
-            .arg(currentFile).arg(progress._totalFileCount)
-			.arg( Utility::timeConversion(progress.totalEstimate().getEtaEstimate()) );
-			//.arg( Utility::octetsToString(progress.totalEstimate().getEstimatedBandwidth()) );
+        .arg(s1, s2)
+        .arg(currentFile).arg(progress._totalFileCount)
+        .arg( Utility::timeConversion(progress.totalEstimate().getEtaEstimate()) );
+
     item->setData( overallSyncString, FolderStatusDelegate::SyncProgressOverallString );
 
     int overallPercent = 0;
diff --git a/src/mirall/folderstatusmodel.cpp b/src/mirall/folderstatusmodel.cpp
index 9918544..b94239a 100644
--- a/src/mirall/folderstatusmodel.cpp
+++ b/src/mirall/folderstatusmodel.cpp
@@ -248,7 +248,7 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
   // Sync File Progress Bar: Show it if syncFile is not empty.
   if( !overallString.isEmpty()) {
       int fileNameTextHeight = subFm.boundingRect(tr("File")).height();
-      int barHeight = qMax(fileNameTextHeight, aliasFm.height()+2); ;
+      int barHeight = qMax(fileNameTextHeight, aliasFm.height()+4); ;
       int overallWidth = option.rect.width()-2*aliasMargin;
 
       painter->save();
diff --git a/src/mirall/owncloudgui.cpp b/src/mirall/owncloudgui.cpp
index 6fe9f0b..5bf3605 100644
--- a/src/mirall/owncloudgui.cpp
+++ b/src/mirall/owncloudgui.cpp
@@ -408,10 +408,10 @@ void ownCloudGui::slotUpdateProgress(const QString &folder, const Progress::Info
     QString s1 = Utility::octetsToString( completedSize );
     QString s2 = Utility::octetsToString( progress._totalSize );
 
-	_actionStatus->setText( tr("Syncing %1 of %2 (%3 of %4) \nETA : %5 , %6/s")
-		.arg(currentFile).arg(progress._totalFileCount).arg(s1, s2)
-		.arg( Utility::timeConversion(progress.totalEstimate().getEtaEstimate()) )
-		.arg( Utility::octetsToString(progress.totalEstimate().getEstimatedBandwidth())) );
+    _actionStatus->setText( tr("Syncing %1 of %2 (%3 of %4) \nETA : %5 , %6/s")
+        .arg(currentFile).arg(progress._totalFileCount).arg(s1, s2)
+        .arg( Utility::timeConversion(progress.totalEstimate().getEtaEstimate()),
+              Utility::octetsToString(progress.totalEstimate().getEstimatedBandwidth())) );
 
     _actionRecent->setIcon( QIcon() ); // Fixme: Set a "in-progress"-item eventually.
 
diff --git a/src/mirall/progressdispatcher.h b/src/mirall/progressdispatcher.h
index 78c5592..0eead9b 100644
--- a/src/mirall/progressdispatcher.h
+++ b/src/mirall/progressdispatcher.h
@@ -36,65 +36,69 @@ namespace Progress
 
 
     struct Info {
-		Info() : _totalFileCount(0), _totalSize(0), _completedFileCount(0), _completedSize(0), _totalEtaEstimate(),_currentEtaEstimate()  {}
+        Info() : _totalFileCount(0), _totalSize(0), _completedFileCount(0), _completedSize(0) {}
 
         quint64 _totalFileCount;
         quint64 _totalSize;
         quint64 _completedFileCount;
         quint64 _completedSize;
-		struct EtaEstimate {
-			EtaEstimate() :  _startedTime(QDateTime::currentMSecsSinceEpoch()), _agvEtaMSecs(0),_effectivProgressPerSec(0) {}
-			
-			static const int AVG_DIVIDER=10;
-			
-			quint64	_startedTime ;
-			quint64	_agvEtaMSecs;
-			quint64 _effectivProgressPerSec;
-			
-			/**
-			 * reset the estiamte.
-			 */
-			void reset() {
-				_startedTime = QDateTime::currentMSecsSinceEpoch();
-				_effectivProgressPerSec = _agvEtaMSecs = 0;
-			}
-			
-			/**
-			 * update the estimated eta time with more current data.
-			 * @param quint64 completed the amount the was completed.
-			 * @param quint64 total the total amout that should be completed.
-			 */
-			void updateTime(quint64 completed, quint64 total) {
-				if(total != 0) {
-					quint64 elapsedTime = QDateTime::currentMSecsSinceEpoch() -  this->_startedTime ;
-					// (elapsedTime-1) to avoid float "rounding" issue (ie. 0.99999999999999999999....)
-					_agvEtaMSecs = _agvEtaMSecs - (_agvEtaMSecs / AVG_DIVIDER) + (elapsedTime * ((float) total / completed ) - (elapsedTime-1) );
-					_effectivProgressPerSec = ( total - completed ) / (1+this->getEtaEstimate()/1000);
-				}
-			}
-			/**
-			 * Get the eta estimate in milliseconds 
-			 * @return quint64 the estimate amount of milliseconds to end the process.
-			 */
-			quint64 getEtaEstimate() const {
-			   return _agvEtaMSecs / AVG_DIVIDER;
-	       }
-	        
+        
+        // Should this be in a separate file?
+        struct EtaEstimate {
+            EtaEstimate() :  _startedTime(QDateTime::currentMSecsSinceEpoch()), _agvEtaMSecs(0),_effectivProgressPerSec(0) {}
+            
+            static const int AVG_DIVIDER=10;
+            
+            quint64	_startedTime ;
+            quint64	_agvEtaMSecs;
+            quint64 _effectivProgressPerSec;
+            
+            /**
+             * reset the estiamte.
+             */
+            void reset() {
+                _startedTime = QDateTime::currentMSecsSinceEpoch();
+                _effectivProgressPerSec = _agvEtaMSecs = 0;
+            }
+            
+            /**
+             * update the estimated eta time with more current data.
+             * @param quint64 completed the amount the was completed.
+             * @param quint64 total the total amout that should be completed.
+             */
+            void updateTime(quint64 completed, quint64 total) {
+                if(total != 0 && completed != 0) {
+                    quint64 elapsedTime = QDateTime::currentMSecsSinceEpoch() -  this->_startedTime ;
+                    // (elapsedTime-1) to avoid float "rounding" issue (ie. 0.99999999999999999999....)
+                    _agvEtaMSecs = _agvEtaMSecs - (_agvEtaMSecs / AVG_DIVIDER) + ( ((total / completed) * elapsedTime) - (elapsedTime-1) );
+                    _effectivProgressPerSec = ( total - completed ) / (1+this->getEtaEstimate()/1000);
+                }
+            }
+            /**
+             * Get the eta estimate in milliseconds 
+             * @return quint64 the estimate amount of milliseconds to end the process.
+             */
+            quint64 getEtaEstimate() const {
+               return _agvEtaMSecs / AVG_DIVIDER;
+           }
+            
            /**
-			* Get the estimated average bandwidth usage.
-			* @return quint64 the estimated bandwidth usage in bytes.
-			*/
-		   quint64 getEstimatedBandwidth() const {
-			   return _effectivProgressPerSec;
-		   }
-		};
-		EtaEstimate _totalEtaEstimate;
-		EtaEstimate _currentEtaEstimate;
+            * Get the estimated average bandwidth usage.
+            * @return quint64 the estimated bandwidth usage in bytes.
+            */
+           quint64 getEstimatedBandwidth() const {
+               return _effectivProgressPerSec;
+           }
+        };
+        EtaEstimate _totalEtaEstimate;
+        
 
         struct ProgressItem {
             ProgressItem() : _completedSize(0) {}
             SyncFileItem _item;
             quint64 _completedSize;
+            EtaEstimate _etaEstimate;
+            
         };
         QHash<QString, ProgressItem> _currentItems;
         SyncFileItem _lastCompletedItem;
@@ -105,17 +109,17 @@ namespace Progress
                 _completedSize += item._size;
             }
             _completedFileCount++;
-            _lastCompletedItem = item;
-			_currentEtaEstimate.reset();
+            _lastCompletedItem = item;            
         }
+        
         void setProgressItem(const SyncFileItem &item, quint64 size) {
             _currentItems[item._file]._item = item;
-            _currentItems[item._file]._completedSize = size;
+            _currentItems[item._file]._completedSize = size;            
             _lastCompletedItem = SyncFileItem();
 
-			_totalEtaEstimate.updateTime(this->completedSize(),this->_totalSize);
-			_currentEtaEstimate.updateTime(size,item._size);
-		}
+            _totalEtaEstimate.updateTime(this->completedSize(),this->_totalSize);
+            _currentItems[item._file]._etaEstimate.updateTime(size,item._size);
+        }
 
         quint64 completedSize() const {
             quint64 r = _completedSize;
@@ -126,19 +130,19 @@ namespace Progress
         }
         
         /**
-		 * Get the total completion estimate structure 
-		 * @return EtaEstimate a structure containing the total completion information.
-		 */
+         * Get the total completion estimate structure 
+         * @return EtaEstimate a structure containing the total completion information.
+         */
         EtaEstimate totalEstimate() const {
-			return _totalEtaEstimate;
+            return _totalEtaEstimate;
         }
 
         /**
-		 * Get the current file completion estimate structure 
-		 * @return EtaEstimate a structure containing the current file completion information.
-		 */
-        EtaEstimate currentFileEstimate() const {
-			return _currentEtaEstimate;
+         * Get the current file completion estimate structure 
+         * @return EtaEstimate a structure containing the current file completion information.
+         */
+        EtaEstimate getFileEstimate(const SyncFileItem &item) const {
+            return _currentItems[item._file]._etaEstimate;
         }               
 
     };

-- 
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