Explorar o código

Not showing an estimated time left till the end of an operation for the first few seconds

Source commit: ed403af1b8be760bed96a98b445aef91d46e2e56
Martin Prikryl %!s(int64=7) %!d(string=hai) anos
pai
achega
fa935a16cf
Modificáronse 3 ficheiros con 16 adicións e 5 borrados
  1. 14 5
      source/forms/Progress.cpp
  2. 1 0
      source/resource/TextsWin.h
  3. 1 0
      source/resource/TextsWin1.rc

+ 14 - 5
source/forms/Progress.cpp

@@ -324,16 +324,25 @@ void __fastcall TProgressForm::UpdateControls()
     StartTimeLabel->Caption = FData.StartTime.TimeString();
     if (FData.TotalSizeSet)
     {
-      TDateTime TimeLeft;
-      if (SynchronizeProgress != NULL)
+      UnicodeString TimeLeftCaption;
+      if (SecondsBetween(FData.StartTime, Now()) >= 3)
       {
-        TimeLeft = SynchronizeProgress->TimeLeft(&FData);
+        TDateTime TimeLeft;
+        if (SynchronizeProgress != NULL)
+        {
+          TimeLeft = SynchronizeProgress->TimeLeft(&FData);
+        }
+        else
+        {
+          TimeLeft = FData.TotalTimeLeft();
+        }
+        TimeLeftCaption = FormatDateTimeSpan(Configuration->TimeFormat, TimeLeft);
       }
       else
       {
-        TimeLeft = FData.TotalTimeLeft();
+        TimeLeftCaption = LoadStr(PROGRESS_TIME_LEFT_CALCULATING);
       }
-      TimeLeftLabel->Caption = FormatDateTimeSpan(Configuration->TimeFormat, TimeLeft);
+      TimeLeftLabel->Caption = TimeLeftCaption;
     }
     TimeElapsedLabel->Caption = FormatDateTimeSpan(Configuration->TimeFormat, FData.TimeElapsed());
     BytesTransferredLabel->Caption = FormatBytes(FData.TotalTransferred);

+ 1 - 0
source/resource/TextsWin.h

@@ -611,6 +611,7 @@
 #define LOGIN_PUBLIC_KEY_FILTER 6009
 #define SYNCHRONIZE_CHECKLIST_CAPTION 6010
 #define EDITOR_READONLY         6011
+#define PROGRESS_TIME_LEFT_CALCULATING 6012
 
 // 2xxx is reserved for TextsFileZilla.h
 

+ 1 - 0
source/resource/TextsWin1.rc

@@ -614,6 +614,7 @@ BEGIN
         LOGIN_PUBLIC_KEY_FILTER, "PuTTY Private Key Files (*.ppk)|*.ppk|All Private Key Files (*.ppk;*.pem;*.key;id_*)|*.ppk;*.pem;*.key;id_*|All Files (*.*)|*.*"
         SYNCHRONIZE_CHECKLIST_CAPTION, "Synchronization checklist"
         EDITOR_READONLY, "Read-only"
+        PROGRESS_TIME_LEFT_CALCULATING, "Calculating"
 
         WIN_VARIABLE_STRINGS, "WIN_VARIABLE"
         WINSCP_COPYRIGHT, "Copyright © 2000-2018 Martin Prikryl"