[chronojump] DB:1.86 Preferences: RunEncoderMinAccel, and pref gui done



commit 01ce57fd979fe320b90bf201b601f2dc5337beec
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Feb 6 11:43:39 2020 +0100

    DB:1.86 Preferences: RunEncoderMinAccel, and pref gui done

 glade/preferences_win.glade | 187 +++++++++++++++++++++++++++++++++++++++++---
 src/gui/preferences.cs      |  16 ++++
 src/preferences.cs          |   3 +
 src/sqlite/main.cs          |  11 ++-
 src/sqlite/preferences.cs   |  12 +++
 5 files changed, 218 insertions(+), 11 deletions(-)
---
diff --git a/glade/preferences_win.glade b/glade/preferences_win.glade
index 55771b10..3ff3adca 100644
--- a/glade/preferences_win.glade
+++ b/glade/preferences_win.glade
@@ -2977,7 +2977,7 @@ Capture</property>
                                           <widget class="GtkHBox" id="hbox3">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
-                                            <property name="spacing">10</property>
+                                            <property name="spacing">6</property>
                                             <child>
                                               <widget class="GtkLabel" id="label13">
                                                 <property name="visible">True</property>
@@ -3443,7 +3443,7 @@ Other</property>
                                                     <property 
name="secondary_icon_activatable">False</property>
                                                     <property name="primary_icon_sensitive">True</property>
                                                     <property name="secondary_icon_sensitive">True</property>
-                                                    <property name="adjustment">0.10000000000000001 
0.10000000000000001 10 0.01 0.10000000000000001 0</property>
+                                                    <property name="adjustment">1 0.10000000000000001 10 
0.01 0.10000000000000001 0</property>
                                                     <property name="climb_rate">1</property>
                                                     <property name="digits">1</property>
                                                     <property name="snap_to_ticks">True</property>
@@ -3882,6 +3882,175 @@ Other</property>
                 <property name="type">tab</property>
               </packing>
             </child>
+            <child>
+              <widget class="GtkVBox" id="vbox42">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="border_width">16</property>
+                <property name="spacing">20</property>
+                <child>
+                  <widget class="GtkFrame" id="frame15">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label_xalign">0</property>
+                    <property name="shadow_type">none</property>
+                    <child>
+                      <widget class="GtkAlignment" id="alignment25">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="left_padding">12</property>
+                        <child>
+                          <widget class="GtkVBox" id="vbox43">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="border_width">8</property>
+                            <child>
+                              <widget class="GtkHBox" id="hbox60">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="spacing">20</property>
+                                <child>
+                                  <widget class="GtkHBox" id="hbox_force_sensor_acceleration_start">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="spacing">6</property>
+                                    <child>
+                                      <widget class="GtkLabel" id="label_force_sensor_acceleration">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="label" translatable="yes">Minimum 
acceleration</property>
+                                      </widget>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">True</property>
+                                        <property name="position">0</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkSpinButton" id="spin_force_sensor_acceleration">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="invisible_char">●</property>
+                                        <property name="invisible_char_set">True</property>
+                                        <property name="primary_icon_activatable">False</property>
+                                        <property name="secondary_icon_activatable">False</property>
+                                        <property name="primary_icon_sensitive">True</property>
+                                        <property name="secondary_icon_sensitive">True</property>
+                                        <property name="adjustment">10 1 99 0.10000000000000001 1 
0</property>
+                                        <property name="climb_rate">1</property>
+                                        <property name="digits">1</property>
+                                        <property name="numeric">True</property>
+                                      </widget>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">False</property>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkLabel" id="label124">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="xalign">0</property>
+                                        <property name="label">m/s^2</property>
+                                      </widget>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">False</property>
+                                        <property name="position">2</property>
+                                      </packing>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkHBox" id="hbox61">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="spacing">6</property>
+                                    <child>
+                                      <widget class="GtkLabel" id="label125">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="xalign">0</property>
+                                        <property name="label" translatable="yes">Recommended:</property>
+                                      </widget>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">False</property>
+                                        <property name="position">0</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkLabel" id="label126">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="xalign">0</property>
+                                        <property name="label">10 m/s^2</property>
+                                      </widget>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">False</property>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                              </widget>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label122">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Detection</property>
+                        <property name="use_markup">True</property>
+                      </widget>
+                      <packing>
+                        <property name="type">label_item</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="position">7</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="label123">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Race analyzer</property>
+              </widget>
+              <packing>
+                <property name="position">7</property>
+                <property name="tab_fill">False</property>
+                <property name="type">tab</property>
+              </packing>
+            </child>
             <child>
               <widget class="GtkVBox" id="vbox5">
                 <property name="visible">True</property>
@@ -3972,7 +4141,6 @@ Other</property>
                                       <widget class="GtkHBox" id="hbox40">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="spacing">4</property>
                                         <child>
                                           <widget class="GtkLabel" id="label68">
                                             <property name="visible">True</property>
@@ -4038,7 +4206,6 @@ Other</property>
                                       <widget class="GtkHBox" id="hbox_not_recommended_when_not_on_windows">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="spacing">4</property>
                                         <child>
                                           <widget class="GtkLabel" id="label74">
                                             <property name="visible">True</property>
@@ -5080,7 +5247,7 @@ Other</property>
                 </child>
               </widget>
               <packing>
-                <property name="position">7</property>
+                <property name="position">8</property>
               </packing>
             </child>
             <child>
@@ -5091,7 +5258,7 @@ Other</property>
                 <property name="label" translatable="yes">Multimedia</property>
               </widget>
               <packing>
-                <property name="position">7</property>
+                <property name="position">8</property>
                 <property name="tab_fill">False</property>
                 <property name="type">tab</property>
               </packing>
@@ -5473,7 +5640,7 @@ Other</property>
                 </child>
               </widget>
               <packing>
-                <property name="position">8</property>
+                <property name="position">9</property>
               </packing>
             </child>
             <child>
@@ -5484,7 +5651,7 @@ Other</property>
                 <property name="label" translatable="yes">Language</property>
               </widget>
               <packing>
-                <property name="position">8</property>
+                <property name="position">9</property>
                 <property name="tab_fill">False</property>
                 <property name="type">tab</property>
               </packing>
@@ -5952,7 +6119,7 @@ version:</property>
                 </child>
               </widget>
               <packing>
-                <property name="position">9</property>
+                <property name="position">10</property>
               </packing>
             </child>
             <child>
@@ -5963,7 +6130,7 @@ version:</property>
                 <property name="label" translatable="yes">Advanced</property>
               </widget>
               <packing>
-                <property name="position">9</property>
+                <property name="position">10</property>
                 <property name="tab_fill">False</property>
                 <property name="type">tab</property>
               </packing>
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 77c8f3e6..6306d242 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -151,6 +151,9 @@ public class PreferencesWindow
        [Widget] Gtk.SpinButton spin_force_sensor_not_elastic_con_min_force;
        [Widget] Gtk.SpinButton spin_force_sensor_graphs_line_width;
 
+       //runEncoder tab
+       [Widget] Gtk.SpinButton spin_force_sensor_acceleration;
+
        //multimedia tab
        [Widget] Gtk.CheckButton checkbutton_volume;
        [Widget] Gtk.Table table_gstreamer;
@@ -245,6 +248,7 @@ public class PreferencesWindow
        const int ENCODERCAPTUREPAGE = 4;
        const int ENCODEROTHERPAGE = 5;
        const int FORCESENSORPAGE = 6;
+       const int RUNENCODERPAGE = 7;
 
        static private WebcamDeviceList wd_list;
        private WebcamFfmpegSupportedModes wfsm;
@@ -298,6 +302,8 @@ public class PreferencesWindow
                }
                if(menu_mode != Constants.Menuitem_modes.FORCESENSOR)
                        PreferencesWindowBox.notebook.GetNthPage(FORCESENSORPAGE).Hide();
+               if(menu_mode != Constants.Menuitem_modes.RUNSENCODER)
+                       PreferencesWindowBox.notebook.GetNthPage(RUNENCODERPAGE).Hide();
 
                PreferencesWindowBox.preferences = preferences;
 
@@ -597,6 +603,9 @@ public class PreferencesWindow
 
                PreferencesWindowBox.spin_force_sensor_graphs_line_width.Value = 
preferences.forceSensorGraphsLineWidth;
 
+               //runEncoder -->
+               PreferencesWindowBox.spin_force_sensor_acceleration.Value = preferences.runEncoderMinAccel;
+
                //language -->
                if(preferences.language == "")
                        PreferencesWindowBox.radio_language_detected.Active = true;
@@ -1986,6 +1995,13 @@ public class PreferencesWindow
                                preferences.forceSensorGraphsLineWidth,
                                Convert.ToInt32(spin_force_sensor_graphs_line_width.Value));
 
+               //runEncoder ----
+
+               preferences.runEncoderMinAccel = Preferences.PreferencesChange(
+                               SqlitePreferences.RunEncoderMinAccel,
+                               preferences.runEncoderMinAccel,
+                               Convert.ToDouble(spin_force_sensor_acceleration.Value));
+
                //multimedia ----
                if( preferences.volumeOn != PreferencesWindowBox.checkbutton_volume.Active ) {
                        SqlitePreferences.Update("volumeOn", 
PreferencesWindowBox.checkbutton_volume.Active.ToString(), true);
diff --git a/src/preferences.cs b/src/preferences.cs
index c5281a55..6b712094 100644
--- a/src/preferences.cs
+++ b/src/preferences.cs
@@ -96,6 +96,9 @@ public class Preferences
        public int forceSensorNotElasticConMinForce;
        public int forceSensorGraphsLineWidth;
 
+       //runEncoder
+       public double runEncoderMinAccel;
+
        //advanced tab
        public bool askDeletion;
        public int digitsNumber;
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index b47b93f4..0b8e85c5 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -129,7 +129,7 @@ class Sqlite
        /*
         * Important, change this if there's any update to database
         */
-       static string lastChronojumpDatabaseVersion = "1.85";
+       static string lastChronojumpDatabaseVersion = "1.86";
 
        public Sqlite() {
        }
@@ -2620,6 +2620,14 @@ class Sqlite
 
                                currentVersion = updateVersion("1.85");
                        }
+                       if(currentVersion == "1.85")
+                       {
+                               LogB.SQL("Inserted into preferences: RunEncoderMinAccel");
+
+                               SqlitePreferences.Insert (SqlitePreferences.RunEncoderMinAccel, "10.0");
+
+                               currentVersion = updateVersion("1.86");
+                       }
 
                        /*
                        if(currentVersion == "1.79")
@@ -2832,6 +2840,7 @@ class Sqlite
                //changes [from - to - desc]
 //just testing: 1.79 - 1.80 Converted DB to 1.80 Created table ForceSensorElasticBandGlue and moved 
stiffnessString records there
 //
+               //1.85 - 1.86 Converted DB to 1.86 Inserted into preferences: RunEncoderMinAccel
                //1.84 - 1.85 Converted DB to 1.85 Inserted 5 vars into preferences: 
EncoderCaptureMainVariable...
                //1.83 - 1.84 Converted DB to 1.84 Inserted into preferences: forceSensorMIFDuration 
Mode/Seconds/Percent
                //1.82 - 1.83 Converted DB to 1.83 Added missing agility_t_test image
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index 2897745b..8d2eae0b 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -79,6 +79,10 @@ class SqlitePreferences : Sqlite
        public const string ForceSensorMIFDurationSeconds = "forceSensorMIFDurationSeconds";
        public const string ForceSensorMIFDurationPercent = "forceSensorMIFDurationPercent";
 
+       //runEncoder
+       public const string RunEncoderMinAccel = "runEncoderMinAccel";
+
+
        protected internal static new void createTable()
        {
                dbcmd.CommandText = 
@@ -227,6 +231,9 @@ class SqlitePreferences : Sqlite
                                Insert (ForceSensorMIFDurationSeconds, "2", dbcmdTr);
                                Insert (ForceSensorMIFDurationPercent, "5", dbcmdTr);
 
+                               //runEncoder
+                               Insert (RunEncoderMinAccel, "10.0", dbcmdTr);
+
                                //multimedia
                                Insert ("videoDevice", "", dbcmdTr); //first
                                Insert ("videoDevicePixelFormat", "", dbcmdTr);
@@ -554,6 +561,11 @@ class SqlitePreferences : Sqlite
                                preferences.forceSensorMIFDurationPercent = Convert.ToInt32(
                                                reader[1].ToString());
 
+                       //runEncoder
+                       else if(reader[0].ToString() == RunEncoderMinAccel)
+                               preferences.runEncoderMinAccel = Convert.ToDouble(
+                                               Util.ChangeDecimalSeparator(reader[1].ToString()));
+
                        //advanced tab
                        else if(reader[0].ToString() == "digitsNumber")
                                preferences.digitsNumber = Convert.ToInt32(reader[1].ToString());


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