[chronojump] exportFiles progressbar with inheritance and removed re.cs from POTFILES.in



commit ca051391ce73aa781b8aef3747999f6dbc54edb4
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Mar 24 17:10:27 2021 +0100

    exportFiles progressbar with inheritance and removed re.cs from POTFILES.in

 po/POTFILES.in                 |  1 -
 src/exportFiles/exportFiles.cs | 12 ++++++++++--
 src/exportFiles/fs.cs          | 10 +++++++---
 src/exportFiles/re.cs          |  7 ++-----
 4 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index e4c42d4b..79d4537f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -56,7 +56,6 @@ src/execute/reactionTime.cs
 src/execute/run.cs
 src/exportFiles/exportFiles.cs
 src/exportFiles/fs.cs
-src/exportFiles/re.cs
 src/exportSession.cs
 src/forceSensor.cs
 src/gui/app1/chronojump.cs
diff --git a/src/exportFiles/exportFiles.cs b/src/exportFiles/exportFiles.cs
index ceb1068d..5c309973 100644
--- a/src/exportFiles/exportFiles.cs
+++ b/src/exportFiles/exportFiles.cs
@@ -176,7 +176,7 @@ public abstract class ExportFiles
                        progressbar.Text = messageToProgressbar;
                        progressbar.Pulse();
                } else {
-                       setProgressBarTextAndFraction(fileCount);
+                       setProgressBarTextAndFractionPrepare (fileCount);
                }
 
                Thread.Sleep (100);
@@ -184,5 +184,13 @@ public abstract class ExportFiles
                return true;
        }
 
-       protected abstract void setProgressBarTextAndFraction (int fileCount);
+       protected abstract void setProgressBarTextAndFractionPrepare (int fileCount);
+
+       //forceSensor inherits different
+       protected virtual void setProgressBarTextAndFractionDo (int current, int total)
+       {
+               progressbar.Text = string.Format(Catalog.GetString("Exporting {0}/{1}"),
+                               current, total);
+               progressbar.Fraction = UtilAll.DivideSafeFraction(current, total);
+       }
 }
diff --git a/src/exportFiles/fs.cs b/src/exportFiles/fs.cs
index e19057cd..fefa41e9 100644
--- a/src/exportFiles/fs.cs
+++ b/src/exportFiles/fs.cs
@@ -388,11 +388,15 @@ public class ForceSensorExport : ExportFiles
                return true;
        }
 
-       protected override void setProgressBarTextAndFraction (int fileCount)
+       protected override void setProgressBarTextAndFractionPrepare (int fileCount)
+       {
+               setProgressBarTextAndFractionDo (fileCount, totalRepsToExport);
+       }
+       protected override void setProgressBarTextAndFractionDo (int current, int total)
        {
                progressbar.Text = string.Format(Catalog.GetString("Exporting repetition {0}/{1}"),
-                               fileCount, totalRepsToExport);
-               progressbar.Fraction = UtilAll.DivideSafeFraction(fileCount, totalRepsToExport);
+                               current, total);
+               progressbar.Fraction = UtilAll.DivideSafeFraction(current, total);
        }
 }
 
diff --git a/src/exportFiles/re.cs b/src/exportFiles/re.cs
index 65aadc5a..b86ecee0 100644
--- a/src/exportFiles/re.cs
+++ b/src/exportFiles/re.cs
@@ -23,7 +23,6 @@ using System.IO;                      //Directory, ...
 using System.Collections;              //ArrayList
 using System.Collections.Generic;      //List<T>
 using System.Threading;
-using Mono.Unix;
 
 public class RunEncoderExport : ExportFiles
 {
@@ -234,10 +233,8 @@ public class RunEncoderExport : ExportFiles
                return true;
        }
 
-       protected override void setProgressBarTextAndFraction (int fileCount)
+       protected override void setProgressBarTextAndFractionPrepare (int fileCount)
        {
-               progressbar.Text = string.Format(Catalog.GetString("Exporting {0}/{1}"),
-                               fileCount, re_l.Count);
-               progressbar.Fraction = UtilAll.DivideSafeFraction(fileCount, re_l.Count);
+               setProgressBarTextAndFractionDo (fileCount, re_l.Count);
        }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]