[chronojump] Fixed encoder laterality



commit a9468a1873c56e61da5ae69f8c1581646753f278
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Jul 18 05:53:17 2013 +0200

    Fixed encoder laterality

 po/POTFILES.in     |    1 +
 src/gui/encoder.cs |    4 ++--
 src/sqlite/main.cs |   24 +++++++++++++++++++++++-
 3 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index e75c68c..03695a7 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -51,6 +51,7 @@ src/report.cs
 src/runType.cs
 src/server.cs
 src/serverPing.cs
+src/sqlite/main.cs
 src/sqlite/country.cs
 src/sqlite/personSession.cs
 src/sqlite/server.cs
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 24a4d03..248beb0 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -2165,9 +2165,9 @@ Log.WriteLine(str);
                combo_encoder_eccon.Changed += new EventHandler (on_combo_encoder_eccon_changed);
                
                //create combo laterality
-               string [] comboLateralityOptions = { "Both", "Right", "Left" };
+               string [] comboLateralityOptions = { "RL", "R", "L" };
                string [] comboLateralityOptionsTranslated = { 
-                       Catalog.GetString("Both"), Catalog.GetString("Right"), Catalog.GetString("Left") };
+                       Catalog.GetString("RL"), Catalog.GetString("R"), Catalog.GetString("L") };
                encoderLateralityTranslation = new String [comboLateralityOptions.Length];
                for(int j=0; j < 3 ; j++)
                        encoderLateralityTranslation[j] = 
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 0fc164d..06bb96c 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -25,6 +25,8 @@ using System.Collections; //ArrayList
 using Mono.Data.Sqlite;
 using System.Diagnostics;      //for launching other process
 
+using Mono.Unix;
+
 
 class Sqlite
 {
@@ -72,7 +74,7 @@ class Sqlite
         * Important, change this if there's any update to database
         * Important2: if database version get numbers higher than 1, check if the comparisons with 
currentVersion works ok
         */
-       static string lastChronojumpDatabaseVersion = "0.97";
+       static string lastChronojumpDatabaseVersion = "0.98";
 
        public Sqlite() {
        }
@@ -1314,6 +1316,25 @@ class Sqlite
 
                                currentVersion = "0.97";
                        }
+                       if(currentVersion == "0.97") {
+                               dbcon.Open();
+                               
+                               Update(true, Constants.EncoderTable, "laterality", "both", "RL", "", "");
+                               Update(true, Constants.EncoderTable, "laterality", "Both", "RL", "", "");
+                               Update(true, Constants.EncoderTable, "laterality", Catalog.GetString("Both"), 
"RL", "", "");
+                               Update(true, Constants.EncoderTable, "laterality", "right", "R", "", "");
+                               Update(true, Constants.EncoderTable, "laterality", "Right", "R", "", "");
+                               Update(true, Constants.EncoderTable, "laterality", 
Catalog.GetString("Right"), "R", "", "");
+                               Update(true, Constants.EncoderTable, "laterality", "left", "L", "", "");
+                               Update(true, Constants.EncoderTable, "laterality", "Left", "L", "", "");
+                               Update(true, Constants.EncoderTable, "laterality", Catalog.GetString("Left"), 
"L", "", "");
+                               Log.WriteLine("Fixed encoder laterality");
+                               
+                               SqlitePreferences.Update ("databaseVersion", "0.98", true); 
+                               dbcon.Close();
+
+                               currentVersion = "0.98";
+                       }
                }
 
                //if changes are made here, remember to change also in CreateTables()
@@ -1453,6 +1474,7 @@ class Sqlite
                SqliteCountry.initialize();
                
                //changes [from - to - desc]
+               //0.97 - 0.98 Converted DB to 0.98 Fixed encoder laterality
                //0.96 - 0.97 Converted DB to 0.97 Added inertialmomentum in preferences
                //0.95 - 0.96 Converted DB to 0.96 Encoder signal future3 three modes
                //0.94 - 0.95 Converted DB to 0.95 Added encoder1RMMethod


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