1
0
Эх сурвалжийг харах

Estimated Time left was zero at the beginning of big synchronizations

Source commit: e20dedae88820ff1267e5eed62c6da58373f7ccd
Martin Prikryl 7 жил өмнө
parent
commit
768ba11a3c

+ 6 - 0
source/core/FileOperationProgress.cpp

@@ -866,6 +866,12 @@ __int64 __fastcall TFileOperationProgressType::GetTotalTransferred()
   return FPersistence.TotalTransferred;
 }
 //---------------------------------------------------------------------------
+__int64 __fastcall TFileOperationProgressType::GetOperationTransferred() const
+{
+  TGuard Guard(FSection);
+  return FPersistence.TotalTransferred - FTotalTransferBase + FTotalSkipped;
+}
+//---------------------------------------------------------------------------
 __int64 __fastcall TFileOperationProgressType::GetTotalSize()
 {
   TGuard Guard(FSection);

+ 2 - 0
source/core/FileOperationProgress.h

@@ -85,6 +85,7 @@ private:
   TCriticalSection * FUserSelectionsSection;
 
   __int64 __fastcall GetTotalTransferred();
+  __int64 __fastcall GetOperationTransferred() const;
   __int64 __fastcall GetTotalSize();
   unsigned long __fastcall GetCPSLimit();
   TBatchOverwrite __fastcall GetBatchOverwrite();
@@ -133,6 +134,7 @@ public:
   __property TDateTime StartTime = { read = GetStartTime };
   // bytes transferred
   __property __int64 TotalTransferred = { read = GetTotalTransferred };
+  __property __int64 OperationTransferred = { read = GetOperationTransferred };
   __property __int64 TotalSize = { read = GetTotalSize };
   __property int FilesFinishedSuccessfully = { read = FFilesFinishedSuccessfully };
 

+ 1 - 21
source/core/RemoteFiles.cpp

@@ -2935,19 +2935,7 @@ __int64 TSynchronizeProgress::ItemSize(const TSynchronizeChecklist::TItem * Chec
 //---------------------------------------------------------------------------
 void TSynchronizeProgress::ItemProcessed(const TSynchronizeChecklist::TItem * ChecklistItem)
 {
-  DebugAssert(FChecklist->Item[FCurrentItem] == ChecklistItem);
   FProcessedSize += ItemSize(ChecklistItem);
-
-  do
-  {
-    FCurrentItem++;
-  }
-  while ((FCurrentItem < FChecklist->Count) && !FChecklist->Item[FCurrentItem]->Checked);
-
-  if (FCurrentItem >= FChecklist->Count)
-  {
-    FCurrentItem = -1;
-  }
 }
 //---------------------------------------------------------------------------
 __int64 TSynchronizeProgress::GetProcessed(const TFileOperationProgressType * CurrentItemOperationProgress) const
@@ -2959,7 +2947,6 @@ __int64 TSynchronizeProgress::GetProcessed(const TFileOperationProgressType * Cu
   if (FTotalSize < 0)
   {
     FTotalSize = 0;
-    FCurrentItem = -1;
 
     for (int Index = 0; Index < FChecklist->Count; Index++)
     {
@@ -2967,19 +2954,12 @@ __int64 TSynchronizeProgress::GetProcessed(const TFileOperationProgressType * Cu
       if (ChecklistItem->Checked)
       {
         FTotalSize += ItemSize(ChecklistItem);
-        if (FCurrentItem < 0)
-        {
-          FCurrentItem = Index;
-        }
       }
     }
   }
 
-  DebugAssert(FCurrentItem >= 0);
-  __int64 CurrentItemSize = ItemSize(FChecklist->Item[FCurrentItem]);
   // For (single-item-)delete operation, this should return 0
-  int CurrentItemProgress = CurrentItemOperationProgress->OverallProgress();
-  __int64 CurrentItemProcessedSize = (CurrentItemSize * CurrentItemProgress) / 100;
+  __int64 CurrentItemProcessedSize = CurrentItemOperationProgress->OperationTransferred;
   return (FProcessedSize + CurrentItemProcessedSize);
 }
 //---------------------------------------------------------------------------

+ 0 - 1
source/core/RemoteFiles.h

@@ -531,7 +531,6 @@ public:
 private:
   const TSynchronizeChecklist * FChecklist;
   mutable __int64 FTotalSize;
-  mutable int FCurrentItem;
   __int64 FProcessedSize;
 
   __int64 ItemSize(const TSynchronizeChecklist::TItem * ChecklistItem) const;