[chronojump] Fixed encoder import



commit 84fec455221f5253764d47cab432ef27ec2aae09
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Jan 10 23:24:26 2017 +0100

    Fixed encoder import

 src/encoder.cs                  |    6 ++++--
 src/gui/encoderConfiguration.cs |   11 ++++++++++-
 2 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/encoder.cs b/src/encoder.cs
index cdc7bd4..26b4487 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -1107,9 +1107,11 @@ public class EncoderConfigurationSQLObject
                                        if(Enum.IsDefined(typeof(Constants.EncoderGI), parts[1]))
                                                encoderGI = (Constants.EncoderGI) 
Enum.Parse(typeof(Constants.EncoderGI), parts[1]);
                                }
-                               if(parts[0] == "active" && parts[1] != "")
+
+                               //active is not needed on import, because on import it's always marked as 
active
+                               else if(parts[0] == "active" && parts[1] != "")
                                        active = (parts[1] == "True");
-                               if(parts[0] == "name" && parts[1] != "")
+                               else if(parts[0] == "name" && parts[1] != "")
                                        name = parts[1];
                                else if(parts[0] == "EncoderConfiguration")
                                {
diff --git a/src/gui/encoderConfiguration.cs b/src/gui/encoderConfiguration.cs
index 785706f..8134d68 100644
--- a/src/gui/encoderConfiguration.cs
+++ b/src/gui/encoderConfiguration.cs
@@ -641,7 +641,16 @@ public class EncoderConfigurationWindow
                                if (contents != null && contents != "")
                                {
                                        EncoderConfigurationSQLObject econfSO = new 
EncoderConfigurationSQLObject(contents);
-                                       if(econfSO.name != null && econfSO.name != "")
+                                       if(econfSO.encoderGI != encoderGI)
+                                       {
+                                               if(encoderGI == Constants.EncoderGI.GRAVITATORY)
+                                                       new DialogMessage(Constants.MessageTypes.WARNING,
+                                                                       Catalog.GetString("Imported 
configuration must be gravitatory."));
+                                               else if(encoderGI == Constants.EncoderGI.INERTIAL)
+                                                       new DialogMessage(Constants.MessageTypes.WARNING,
+                                                                       Catalog.GetString("Imported 
configuration must be inertial."));
+                                       }
+                                       else if(econfSO.name != null && econfSO.name != "")
                                        {
                                                //add more suffixes until name is unique
                                                econfSO.name = 
SqliteEncoderConfiguration.IfNameExistsAddSuffix(econfSO.name, Catalog.GetString("copy"));


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