[chronojump] CutByTriggers on preferences. DB: 1.44



commit c93c0b0e822fad5752b4cdeb0e9cf0d7e254b9fa
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sat Apr 29 01:42:47 2017 +0200

    CutByTriggers on preferences. DB: 1.44

 glade/preferences_win.glade |   46 +++++++++++++++++++++++++++++++++++++++++++
 src/gui/preferences.cs      |   18 ++++++++++++++++
 src/preferences.cs          |    1 +
 src/sqlite/main.cs          |   11 +++++++++-
 src/sqlite/preferences.cs   |    3 ++
 5 files changed, 78 insertions(+), 1 deletions(-)
---
diff --git a/glade/preferences_win.glade b/glade/preferences_win.glade
index a467079..ed38d73 100644
--- a/glade/preferences_win.glade
+++ b/glade/preferences_win.glade
@@ -2452,6 +2452,52 @@ It starts before and arrives there with some speed.</property>
                             <property name="position">4</property>
                           </packing>
                         </child>
+                        <child>
+                          <widget class="GtkHBox" id="hbox29">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">10</property>
+                            <child>
+                              <widget class="GtkCheckButton" id="check_encoder_capture_cut_by_triggers">
+                                <property name="label" translatable="yes">Cut sets into repetitions using 
triggers</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="draw_indicator">True</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkButton" id="button_encoder_capture_cut_by_triggers_help">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">True</property>
+                                <signal name="clicked" 
handler="on_button_encoder_capture_cut_by_triggers_help_clicked" swapped="no"/>
+                                <child>
+                                  <widget class="GtkImage" id="image_encoder_capture_cut_by_triggers_help">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="stock">gtk-missing-image</property>
+                                  </widget>
+                                </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">5</property>
+                          </packing>
+                        </child>
                       </widget>
                     </child>
                   </widget>
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 01f5aeb..7779ebc 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -116,6 +116,8 @@ public class PreferencesWindow
        [Widget] Gtk.RadioButton radio_encoder_auto_save_curve_all;
        [Widget] Gtk.RadioButton radio_encoder_auto_save_curve_none;
        [Widget] Gtk.CheckButton check_show_start_and_duration;
+       [Widget] Gtk.CheckButton check_encoder_capture_cut_by_triggers;
+       [Widget] Gtk.Image image_encoder_capture_cut_by_triggers_help;
        
        //encoder other tab
        [Widget] Gtk.CheckButton checkbutton_encoder_propulsive;
@@ -368,6 +370,9 @@ public class PreferencesWindow
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_run_multiple.png");
                PreferencesWindowBox.image_races_intervallic.Pixbuf = pixbuf;
 
+               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_info.png");
+               PreferencesWindowBox.image_encoder_capture_cut_by_triggers_help.Pixbuf = pixbuf;
+
                if(menu_mode == Constants.Menuitem_modes.RUNSSIMPLE)
                        PreferencesWindowBox.notebook_races_double_contacts.CurrentPage = 0;
                else if(menu_mode == Constants.Menuitem_modes.RUNSINTERVALLIC)
@@ -431,6 +436,7 @@ public class PreferencesWindow
                        PreferencesWindowBox.radio_encoder_auto_save_curve_none.Active = true;
        
                PreferencesWindowBox.check_show_start_and_duration.Active = 
preferences.encoderShowStartAndDuration;
+               PreferencesWindowBox.check_encoder_capture_cut_by_triggers.Active = 
preferences.encoderCaptureCutByTriggers;
 
 
                //encoder other -->
@@ -476,6 +482,14 @@ public class PreferencesWindow
                PreferencesWindowBox.preferences_win.Show ();
                return PreferencesWindowBox;
        }
+
+       private void on_button_encoder_capture_cut_by_triggers_help_clicked (object o, EventArgs args)
+       {
+               new DialogMessage(Constants.MessageTypes.WARNING,
+                               "If active, repetitions will be cut from set using triggers." + "\n" +
+                               "Triggers will be produced by a button connected to the Chronopic." + "\n\n" +
+                               "This will be only used on gravitatory (not on inertial).");
+       }
        
        private void createComboEncoderCaptureMainVariable(string v) {
                combo_main_variable = ComboBox.NewText ();
@@ -1462,6 +1476,10 @@ public class PreferencesWindow
                                preferences.encoderShowStartAndDuration,
                                PreferencesWindowBox.check_show_start_and_duration.Active);
                
+               preferences.encoderCaptureCutByTriggers = preferencesChange(
+                               "encoderCaptureCutByTriggers",
+                               preferences.encoderCaptureCutByTriggers,
+                               PreferencesWindowBox.check_encoder_capture_cut_by_triggers.Active);
 
                //---- end of encoder capture
                
diff --git a/src/preferences.cs b/src/preferences.cs
index 00115eb..c55be0a 100644
--- a/src/preferences.cs
+++ b/src/preferences.cs
@@ -65,6 +65,7 @@ public class Preferences
        public int encoderCaptureCheckFullyExtendedValue;
        public Constants.EncoderAutoSaveCurve encoderAutoSaveCurve;
        public bool encoderShowStartAndDuration;
+       public bool encoderCaptureCutByTriggers;
        
        //encoder other
        public bool encoderPropulsive;
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 1e0a7a3..30487e7 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -125,7 +125,7 @@ class Sqlite
        /*
         * Important, change this if there's any update to database
         */
-       static string lastChronojumpDatabaseVersion = "1.43";
+       static string lastChronojumpDatabaseVersion = "1.44";
 
        public Sqlite() {
        }
@@ -2210,6 +2210,14 @@ class Sqlite
 
                                currentVersion = updateVersion("1.43");
                        }
+                       if(currentVersion == "1.43")
+                       {
+                               LogB.SQL("Added encoderCaptureCutByTriggers to preferences");
+
+                               SqlitePreferences.Insert ("encoderCaptureCutByTriggers", "False");
+
+                               currentVersion = updateVersion("1.44");
+                       }
 
 
                        // --- add more updates here
@@ -2391,6 +2399,7 @@ class Sqlite
                SqlitePreferences.initializeTable(lastChronojumpDatabaseVersion, creatingBlankDatabase);
 
                //changes [from - to - desc]
+               //1.43 - 1.44 Converted DB to 1.44 Added encoderCaptureCutByTriggers to preferences
                //1.42 - 1.43 Converted DB to 1.43 Added exercise params of last capture for next Chronojump 
start
                //1.41 - 1.42 Converted DB to 1.42 Created and default values for ForceSensorRFD
                //1.40 - 1.41 Converted DB to 1.41 Updated preferences maximized: from true/false to 
no/yes/undecorated
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index 0ed21af..435cc3f 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -110,6 +110,7 @@ class SqlitePreferences : Sqlite
                                Insert ("encoderCaptureCheckFullyExtended", "True", dbcmdTr);
                                Insert ("encoderCaptureCheckFullyExtendedValue", "4", dbcmdTr);
                                Insert ("encoderShowStartAndDuration", "False", dbcmdTr);
+                               Insert ("encoderCaptureCutByTriggers", "False", dbcmdTr);
                                Insert ("encoderPropulsive", "True", dbcmdTr);
                                Insert ("encoderSmoothEccCon", "0.6", dbcmdTr);
                                Insert ("encoderSmoothCon", "0.7", dbcmdTr);
@@ -284,6 +285,8 @@ class SqlitePreferences : Sqlite
                                        Enum.Parse(typeof(Constants.EncoderAutoSaveCurve), 
reader[1].ToString()); 
                        else if(reader[0].ToString() == "encoderShowStartAndDuration")
                                preferences.encoderShowStartAndDuration = reader[1].ToString() == "True";
+                       else if(reader[0].ToString() == "encoderCaptureCutByTriggers")
+                               preferences.encoderCaptureCutByTriggers = reader[1].ToString() == "True";
                        //encoder other
                        else if(reader[0].ToString() == "encoderPropulsive")
                                preferences.encoderPropulsive = reader[1].ToString() == "True";


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