[chronojump] DB:1.46 logs can be muted on preferences (advanced tab)



commit 3caa67795bf9a720255510c165b168ce141208f4
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed May 24 11:35:09 2017 +0200

    DB:1.46 logs can be muted on preferences (advanced tab)

 glade/preferences_win.glade |   88 ++++++++++++++++++++++++++++++++++++++++++-
 src/gui/chronojump.cs       |    2 +
 src/gui/encoder.cs          |    3 +
 src/gui/preferences.cs      |   14 ++++++-
 src/preferences.cs          |    7 ++-
 src/sqlite/main.cs          |   14 +++++-
 src/sqlite/preferences.cs   |   12 ++++--
 7 files changed, 127 insertions(+), 13 deletions(-)
---
diff --git a/glade/preferences_win.glade b/glade/preferences_win.glade
index 11e74b4..2a8b5db 100644
--- a/glade/preferences_win.glade
+++ b/glade/preferences_win.glade
@@ -4849,12 +4849,12 @@ sensor</property>
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="border_width">8</property>
-                <property name="spacing">30</property>
+                <property name="spacing">20</property>
                 <child>
                   <widget class="GtkVBox" id="vbox19">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="spacing">20</property>
+                    <property name="spacing">10</property>
                     <child>
                       <widget class="GtkCheckButton" id="checkbutton_ask_deletion">
                         <property name="label" translatable="yes">Ask for confirm test deletion</property>
@@ -4912,6 +4912,90 @@ sensor</property>
                         <property name="position">1</property>
                       </packing>
                     </child>
+                    <child>
+                      <widget class="GtkCheckButton" id="checkbutton_mute_logs">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="has_tooltip">True</property>
+                        <property name="tooltip" translatable="yes">Do not print debug messages</property>
+                        <property name="use_underline">True</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <child>
+                          <widget class="GtkHBox" id="hbox34">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">6</property>
+                            <child>
+                              <widget class="GtkLabel" id="label96">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Mute logs</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkHBox" id="hbox35">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="spacing">2</property>
+                                <child>
+                                  <widget class="GtkLabel" id="label106">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="label">(</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkLabel" id="label100">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="label" translatable="yes">default: False</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="label107">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="label">)</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
+                                    <property name="position">2</property>
+                                  </packing>
+                                </child>
+                              </widget>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
                   </widget>
                   <packing>
                     <property name="expand">False</property>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 3ea97f3..0e1520d 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -731,6 +731,7 @@ public partial class ChronoJumpWindow
        private void loadPreferences () 
        {
                preferences = Preferences.LoadAllFromSqlite();
+               LogB.Mute = preferences.muteLogs;
 
                LogB.Information (string.Format(Catalog.GetString("Chronojump database version file: {0}"), 
                                        preferences.databaseVersion));
@@ -2721,6 +2722,7 @@ public partial class ChronoJumpWindow
        private void on_preferences_accepted (object o, EventArgs args) 
        {
                preferences = preferencesWin.GetPreferences;
+               LogB.Mute = preferences.muteLogs;
                rfdList = preferencesWin.GetRFDList;
                impulse = preferencesWin.GetImpulse;
 
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 5655740..9dfd1d5 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -5965,6 +5965,9 @@ public partial class ChronoJumpWindow
 
                                        if(action == encoderActions.CURVES_AC)
                                        {
+                                               //1) unMute logs if preferences.muteLogs == true
+                                               LogB.Mute = preferences.muteLogs;
+
                                                //1) save the triggers now that we have an 
encoderSignalUniqueID
                                                
eCapture.SaveTriggers(Convert.ToInt32(encoderSignalUniqueID)); //dbcon is closed
                                                showTriggersAndTab();
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index da97774..5cf9984 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -200,6 +200,7 @@ public class PreferencesWindow
        //advanced tab
        [Widget] Gtk.ComboBox combo_decimals;
        [Widget] Gtk.CheckButton checkbutton_ask_deletion;
+       [Widget] Gtk.CheckButton checkbutton_mute_logs;
        [Widget] Gtk.RadioButton radio_export_latin;
        [Widget] Gtk.RadioButton radio_export_non_latin;
        [Widget] Gtk.Label label_advanced_feedback;
@@ -344,11 +345,15 @@ public class PreferencesWindow
                        PreferencesWindowBox.hbox_indexes.Hide();
                }
 
-               if(preferences.askDeletion)  
+               if(preferences.askDeletion)
                        PreferencesWindowBox.checkbutton_ask_deletion.Active = true; 
                else 
                        PreferencesWindowBox.checkbutton_ask_deletion.Active = false; 
-               
+
+               if(preferences.muteLogs)
+                       PreferencesWindowBox.checkbutton_mute_logs.Active = true;
+               else
+                       PreferencesWindowBox.checkbutton_mute_logs.Active = false;
 
                if(preferences.weightStatsPercent)  
                        PreferencesWindowBox.radio_weight_percent.Active = true; 
@@ -1418,6 +1423,11 @@ public class PreferencesWindow
                        preferences.askDeletion = PreferencesWindowBox.checkbutton_ask_deletion.Active;
                }
 
+               if( preferences.muteLogs != PreferencesWindowBox.checkbutton_mute_logs.Active ) {
+                       SqlitePreferences.Update("muteLogs", 
PreferencesWindowBox.checkbutton_mute_logs.Active.ToString(), true);
+                       preferences.muteLogs = PreferencesWindowBox.checkbutton_mute_logs.Active;
+               }
+
                if( preferences.weightStatsPercent != PreferencesWindowBox.radio_weight_percent.Active ) {
                        SqlitePreferences.Update("weightStatsPercent", 
PreferencesWindowBox.radio_weight_percent.Active.ToString(), true);
                        preferences.weightStatsPercent = PreferencesWindowBox.radio_weight_percent.Active;
diff --git a/src/preferences.cs b/src/preferences.cs
index c55be0a..6f2eb31 100644
--- a/src/preferences.cs
+++ b/src/preferences.cs
@@ -33,14 +33,12 @@ public class Preferences
        public bool personWinHide;
        public bool encoderCaptureShowOnlyBars;
 
-       public int digitsNumber;
        public bool showPower;
        public bool showStiffness;
        public bool showInitialSpeed;
        public bool showAngle;
        public bool showQIndex;
        public bool showDjIndex;
-       public bool askDeletion;
        public bool weightStatsPercent;         //AKA weightPercentPreferred
        public bool heightPreferred;
        public bool metersSecondsPreferred;
@@ -78,6 +76,11 @@ public class Preferences
        public bool RGraphsTranslate;
        public bool useHeightsOnJumpIndexes;
 
+       //advanced tab
+       public bool askDeletion;
+       public int digitsNumber;
+       public bool muteLogs;
+
        /*
         * these are NOT sent to preferences window
         */
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 1fda14d..a11732c 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.45";
+       static string lastChronojumpDatabaseVersion = "1.46";
 
        public Sqlite() {
        }
@@ -143,7 +143,7 @@ class Sqlite
        //because lots of similar transactions have to be done
        public static void Open()
        {
-               Console.WriteLine("SQL going to open, status: " + dbcon.State.ToString());
+               LogB.Information("SQL going to open, status: " + dbcon.State.ToString());
                if(dbcon.State == System.Data.ConnectionState.Closed)
                {
                        LogB.SQLon();
@@ -2218,7 +2218,6 @@ class Sqlite
 
                                currentVersion = updateVersion("1.44");
                        }
-
                        if(currentVersion == "1.44")
                        {
                                LogB.SQL("Added ForceSensorImpulse value");
@@ -2227,6 +2226,14 @@ class Sqlite
 
                                currentVersion = updateVersion("1.45");
                        }
+                       if(currentVersion == "1.45")
+                       {
+                               LogB.SQL("Added muteLogs at preferences");
+
+                               SqlitePreferences.Insert ("muteLogs", "False");
+
+                               currentVersion = updateVersion("1.46");
+                       }
 
 
                        // --- add more updates here
@@ -2408,6 +2415,7 @@ class Sqlite
                SqlitePreferences.initializeTable(lastChronojumpDatabaseVersion, creatingBlankDatabase);
 
                //changes [from - to - desc]
+               //1.45 - 1.46 Converted DB to 1.46 Added muteLogs at preferences
                //1.44 - 1.45 Converted DB to 1.45 Added ForceSensorImpulse value
                //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
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index 435cc3f..94e0ccf 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -143,6 +143,7 @@ class SqlitePreferences : Sqlite
                                Insert ("useHeightsOnJumpIndexes", "True", dbcmdTr);
                                Insert ("encoderAutoSaveCurve", 
Constants.EncoderAutoSaveCurve.BEST.ToString(), dbcmdTr); 
                                Insert ("email", "", dbcmdTr);
+                               Insert ("muteLogs", "False", dbcmdTr);
                                
                                //removed on 1.37
                                //Insert ("encoderConfiguration", new 
EncoderConfiguration().ToStringOutput(EncoderConfiguration.Outputs.SQL), dbcmdTr);
@@ -242,8 +243,6 @@ class SqlitePreferences : Sqlite
                                preferences.personWinHide = reader[1].ToString() == "True";
                        else if(reader[0].ToString() == "encoderCaptureShowOnlyBars")
                                preferences.encoderCaptureShowOnlyBars = reader[1].ToString() == "True";
-                       else if(reader[0].ToString() == "digitsNumber")
-                               preferences.digitsNumber = Convert.ToInt32(reader[1].ToString());
                        else if(reader[0].ToString() == "showPower")
                                preferences.showPower = reader[1].ToString() == "True";
                        else if(reader[0].ToString() == "showStiffness")
@@ -256,8 +255,6 @@ class SqlitePreferences : Sqlite
                                preferences.showQIndex = reader[1].ToString() == "True";
                        else if(reader[0].ToString() == "showDjIndex")
                                preferences.showDjIndex = reader[1].ToString() == "True";
-                       else if(reader[0].ToString() == "askDeletion")
-                               preferences.askDeletion = reader[1].ToString() == "True";
                        else if(reader[0].ToString() == "weightStatsPercent")
                                preferences.weightStatsPercent = reader[1].ToString() == "True";
                        else if(reader[0].ToString() == "heightPreferred")
@@ -337,6 +334,13 @@ class SqlitePreferences : Sqlite
                                preferences.thresholdRuns = Convert.ToInt32(reader[1].ToString());
                        else if(reader[0].ToString() == "thresholdOther")
                                preferences.thresholdOther = Convert.ToInt32(reader[1].ToString());
+                       //advanced tab
+                       else if(reader[0].ToString() == "digitsNumber")
+                               preferences.digitsNumber = Convert.ToInt32(reader[1].ToString());
+                       else if(reader[0].ToString() == "askDeletion")
+                               preferences.askDeletion = reader[1].ToString() == "True";
+                       else if(reader[0].ToString() == "muteLogs")
+                               preferences.muteLogs = reader[1].ToString() == "True";
 
                        else if(reader[0].ToString() == "machineID")
                                preferences.machineID = reader[1].ToString();


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