[chronojump] DB:2.02 preferences: restTimeMinutes, restTimeSeconds: all rest times on preferences window



commit a39063387f7446dc3d345540eac4f07047c8f426
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Nov 6 18:17:35 2020 +0100

    DB:2.02 preferences: restTimeMinutes, restTimeSeconds: all rest times on preferences window

 glade/app1.glade            | 247 ++++++--------------------------------------
 glade/preferences_win.glade | 172 +++++++++++++++++++++++++++++-
 src/gui/app1/chronojump.cs  |  62 ++---------
 src/gui/app1/icons.cs       |   2 -
 src/gui/preferences.cs      |  69 ++++++++++++-
 src/preferences.cs          |   2 +
 src/sqlite/main.cs          |  14 ++-
 src/sqlite/preferences.cs   |  18 ++++
 8 files changed, 309 insertions(+), 277 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 4f736a62..2774dcdb 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -2479,208 +2479,6 @@
                                                             <property name="position">1</property>
                                                             </packing>
                                                             </child>
-                                                            <child>
-                                                            <widget class="GtkHBox" id="hbox_rest_time">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="spacing">2</property>
-                                                            <child>
-                                                            <widget class="GtkVBox" id="vbox189">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <child>
-                                                            <widget class="GtkButton" id="button_rest_show">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">True</property>
-                                                            <property name="receives_default">True</property>
-                                                            <property name="tooltip" 
translatable="yes">Manage rest time</property>
-                                                            <signal name="clicked" 
handler="on_button_rest_show_clicked" swapped="no"/>
-                                                            <child>
-                                                            <widget class="GtkImage" id="image_rest">
-                                                            <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">0</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="GtkLabel" id="label_rest">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="xalign">0</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="position">1</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
-                                                            <widget class="GtkVBox" id="vbox_rest_time_set">
-                                                            <property name="can_focus">False</property>
-                                                            <property name="spacing">4</property>
-                                                            <child>
-                                                            <widget class="GtkCheckButton" 
id="checkbutton_rest">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">True</property>
-                                                            <property 
name="receives_default">False</property>
-                                                            <property name="tooltip" 
translatable="yes">Highlight rest</property>
-                                                            <property name="active">True</property>
-                                                            <property name="draw_indicator">True</property>
-                                                            <signal name="clicked" 
handler="on_checkbutton_rest_clicked" swapped="no"/>
-                                                            <child>
-                                                            <widget class="GtkLabel" id="label261">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="xalign">0</property>
-                                                            <property name="label" 
translatable="yes">Highlight rest</property>
-                                                            <property name="ellipsize">end</property>
-                                                            <property name="width_chars">16</property>
-                                                            </widget>
-                                                            </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="hbox_rest_time_values">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="tooltip" 
translatable="yes">Highlight longer resting times than this value</property>
-                                                            <property name="spacing">4</property>
-                                                            <child>
-                                                            <widget class="GtkHBox" id="hbox125">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="spacing">2</property>
-                                                            <child>
-                                                            <widget class="GtkSpinButton" 
id="spinbutton_rest_minutes">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">True</property>
-                                                            <property name="max_length">2</property>
-                                                            <property name="invisible_char">●</property>
-                                                            <property name="width_chars">2</property>
-                                                            <property name="xalign">1</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">2 0 60 1 10 
0</property>
-                                                            <property name="climb_rate">1</property>
-                                                            <property name="numeric">True</property>
-                                                            <signal name="value_changed" 
handler="on_spinbutton_rest_time_value_changed" swapped="no"/>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
-                                                            <widget class="GtkLabel" id="label253">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="label">m</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">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
-                                                            <widget class="GtkHBox" id="hbox129">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="spacing">2</property>
-                                                            <child>
-                                                            <widget class="GtkSpinButton" 
id="spinbutton_rest_seconds">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">True</property>
-                                                            <property name="max_length">2</property>
-                                                            <property name="invisible_char">●</property>
-                                                            <property name="width_chars">2</property>
-                                                            <property name="xalign">1</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">0 0 60 1 10 
0</property>
-                                                            <property name="climb_rate">1</property>
-                                                            <property name="numeric">True</property>
-                                                            <signal name="value_changed" 
handler="on_spinbutton_rest_time_value_changed" swapped="no"/>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
-                                                            <widget class="GtkLabel" id="label260">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="label">s</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">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">2</property>
-                                                            </packing>
-                                                            </child>
-                                                            </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>
@@ -2707,9 +2505,6 @@
                                                     <property name="position">1</property>
                                                   </packing>
                                                 </child>
-                                                <child>
-                                                  <placeholder/>
-                                                </child>
                                               </widget>
                                             </child>
                                           </widget>
@@ -25071,6 +24866,15 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -28026,6 +27830,18 @@ Concentric</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">6</property>
                                                             <child>
+                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="pack_type">end</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_capturing">
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">4</property>
@@ -28062,18 +27878,6 @@ Concentric</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
-                                                            <property name="can_focus">False</property>
-                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="pack_type">end</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_no_capturing">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -36180,6 +35984,15 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/glade/preferences_win.glade b/glade/preferences_win.glade
index eaf2f7b9..fad6a425 100644
--- a/glade/preferences_win.glade
+++ b/glade/preferences_win.glade
@@ -550,6 +550,172 @@
                                 <property name="position">3</property>
                               </packing>
                             </child>
+                            <child>
+                              <widget class="GtkHBox" id="hbox73">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="spacing">6</property>
+                                <child>
+                                  <widget class="GtkCheckButton" id="check_rest_time">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">False</property>
+                                    <property name="active">True</property>
+                                    <property name="draw_indicator">True</property>
+                                    <signal name="toggled" handler="on_check_rest_time_toggled" 
swapped="no"/>
+                                    <child>
+                                      <widget class="GtkHBox" id="hbox75">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="spacing">2</property>
+                                        <child>
+                                          <widget class="GtkImage" id="image_rest">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="stock">gtk-missing-image</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="label112">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">Hightlight rest 
time</property>
+                                          </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">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkHBox" id="hbox_rest_time_values">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="tooltip" translatable="yes">Highlight longer resting 
times than this value</property>
+                                    <property name="spacing">4</property>
+                                    <child>
+                                      <widget class="GtkHBox" id="hbox125">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="spacing">2</property>
+                                        <child>
+                                          <widget class="GtkSpinButton" id="spinbutton_rest_minutes">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="max_length">2</property>
+                                            <property name="invisible_char">●</property>
+                                            <property name="width_chars">2</property>
+                                            <property name="xalign">1</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">2 0 60 1 10 0</property>
+                                            <property name="climb_rate">1</property>
+                                            <property name="numeric">True</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="label253">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="label">m</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">0</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkHBox" id="hbox129">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="spacing">2</property>
+                                        <child>
+                                          <widget class="GtkSpinButton" id="spinbutton_rest_seconds">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="max_length">2</property>
+                                            <property name="invisible_char">●</property>
+                                            <property name="width_chars">2</property>
+                                            <property name="xalign">1</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">0 0 60 1 10 0</property>
+                                            <property name="climb_rate">1</property>
+                                            <property name="numeric">True</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="label260">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="label">s</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">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">4</property>
+                              </packing>
+                            </child>
                           </widget>
                           <packing>
                             <property name="expand">False</property>
@@ -638,6 +804,9 @@
                                     <property name="n_columns">2</property>
                                     <property name="column_spacing">20</property>
                                     <property name="row_spacing">16</property>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
                                     <child>
                                       <widget class="GtkCheckButton" id="check_appearance_person_photo">
                                         <property name="label" translatable="yes">Show persons 
photo</property>
@@ -882,9 +1051,6 @@
                                         <property name="bottom_attach">3</property>
                                       </packing>
                                     </child>
-                                    <child>
-                                      <placeholder/>
-                                    </child>
                                     <child>
                                       <widget class="GtkHBox" id="hbox57">
                                         <property name="visible">True</property>
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 781443c8..b62850ac 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -201,13 +201,6 @@ public partial class ChronoJumpWindow
        //menu person
        [Widget] Gtk.Button button_persons_up;
        [Widget] Gtk.Button button_persons_down;
-       [Widget] Gtk.CheckButton checkbutton_rest;
-       [Widget] Gtk.Label label_rest;
-       [Widget] Gtk.HBox hbox_rest_time;
-       [Widget] Gtk.HBox hbox_rest_time_values;
-       [Widget] Gtk.VBox vbox_rest_time_set;
-       [Widget] Gtk.SpinButton spinbutton_rest_minutes;
-       [Widget] Gtk.SpinButton spinbutton_rest_seconds;
 
        //tests
        [Widget] Gtk.Button button_contacts_exercise;
@@ -696,7 +689,6 @@ public partial class ChronoJumpWindow
                videoCaptureInitialize();
 
                initializeRestTimeLabels();
-               label_rest.Text = get_configured_rest_time_as_string();
                restTime = new RestTime();
                updatingRestTimes = true;
                GLib.Timeout.Add(1000, new GLib.TimeoutHandler(updateRestTimes)); //each s, better than 5s 
for don't have problems sorting data on treeview
@@ -963,6 +955,9 @@ public partial class ChronoJumpWindow
                report.preferences = preferences;
                report.Progversion = progVersion;
 
+               if(myTreeViewPersons != null)
+                       myTreeViewPersons.RestSecondsMark = get_configured_rest_time_in_seconds();
+
                LogB.Information ( Catalog.GetString ("Preferences loaded") );
        }
 
@@ -2866,6 +2861,9 @@ public partial class ChronoJumpWindow
                Config.UseSystemColor = preferences.colorBackgroundOsColor;
                doLabelsContrast(configChronojump.PersonWinHide);
 
+               if(myTreeViewPersons != null)
+                       myTreeViewPersons.RestSecondsMark = get_configured_rest_time_in_seconds();
+
                //TODO: only if personWinHide changed
                initialize_menu_or_menu_tiny();
 
@@ -4407,50 +4405,14 @@ public partial class ChronoJumpWindow
                return true;
        }
 
-       private void on_button_rest_show_clicked(object o, EventArgs args)
-       {
-               label_rest.Visible = vbox_rest_time_set.Visible;
-               vbox_rest_time_set.Visible = ! vbox_rest_time_set.Visible;
-       }
-
-       private void on_checkbutton_rest_clicked(object o, EventArgs args)
-       {
-               Pixbuf pixbuf;
-               if(checkbutton_rest.Active) {
-                       hbox_rest_time_values.Sensitive = true;
-                       myTreeViewPersons.RestSecondsMark = get_configured_rest_time_in_seconds();
-                       label_rest.Text = get_configured_rest_time_as_string();
-
-                       pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_rest.png");
-                       image_rest.Pixbuf = pixbuf;
-               } else {
-                       hbox_rest_time_values.Sensitive = false;
-                       myTreeViewPersons.RestSecondsMark = 0;
-                       label_rest.Text = "";
-
-                       pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_rest_inactive.png");
-                       image_rest.Pixbuf = pixbuf;
-               }
-       }
-
-       private void on_spinbutton_rest_time_value_changed(object o, EventArgs args)
-       {
-               myTreeViewPersons.RestSecondsMark = get_configured_rest_time_in_seconds();
-               if(checkbutton_rest.Active)
-                       label_rest.Text = get_configured_rest_time_as_string();
-       }
-
        private int get_configured_rest_time_in_seconds()
        {
-               return 60 * Convert.ToInt32(spinbutton_rest_minutes.Value) + 
Convert.ToInt32(spinbutton_rest_seconds.Value);
-       }
-
-       private string get_configured_rest_time_as_string()
-       {
-               return Convert.ToInt32(spinbutton_rest_minutes.Value).ToString() + "m " + 
Convert.ToInt32(spinbutton_rest_seconds.Value).ToString() + "s";
+               if(preferences.restTimeMinutes < 0)
+                       return 0;
+               else
+                       return 60 * preferences.restTimeMinutes + preferences.restTimeSeconds;
        }
 
-
        /* ---------------------------------------------------------
         * ----------------  JUMPS RJ EXECUTION  ------------------
         *  --------------------------------------------------------
@@ -7405,7 +7367,7 @@ LogB.Debug("mc finished 5");
                {
                        frame_persons_top.Sensitive = false;
                        //treeview_persons is shown (person can be changed)
-                       hbox_rest_time.Sensitive = false;
+
                        vbox_persons_bottom.Sensitive = false;
                } else
                        frame_persons.Sensitive = false;
@@ -7459,8 +7421,6 @@ LogB.Debug("mc finished 5");
                //check this is sensitive (because on cont was unsensitive)
                if(! frame_persons_top.Sensitive)
                        frame_persons_top.Sensitive = true;
-               if(! hbox_rest_time.Sensitive)
-                       hbox_rest_time.Sensitive = true;
                if(! vbox_persons_bottom.Sensitive)
                        vbox_persons_bottom.Sensitive = true;
 
diff --git a/src/gui/app1/icons.cs b/src/gui/app1/icons.cs
index 6db6e90c..b40d87db 100644
--- a/src/gui/app1/icons.cs
+++ b/src/gui/app1/icons.cs
@@ -52,7 +52,6 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image image_contacts_session_overview;
        [Widget] Gtk.Image image_encoder_session_overview;
        [Widget] Gtk.Image image_contacts_recalculate;
-       [Widget] Gtk.Image image_rest;
        [Widget] Gtk.Image image_all_persons_events;
        [Widget] Gtk.Image image_all_persons_events_h;
        [Widget] Gtk.Image image_person_delete;
@@ -475,7 +474,6 @@ public partial class ChronoJumpWindow
                //image_persons_open_plus_2.Pixbuf = pixbuf;
 
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_rest.png");
-               image_rest.Pixbuf = pixbuf;
                image_encoder_rhythm_rest.Pixbuf = pixbuf;
                image_contacts_rest_time_dark_blue.Pixbuf = pixbuf;
                image_encoder_rest_time_dark_blue.Pixbuf = pixbuf;
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 8277b7f1..bbb239f7 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -74,6 +74,11 @@ public class PreferencesWindow
        [Widget] Gtk.RadioButton radio_font_courier;
        [Widget] Gtk.RadioButton radio_font_helvetica;
        [Widget] Gtk.Label label_radio_font_needs_restart;
+       [Widget] Gtk.CheckButton check_rest_time;
+       [Widget] Gtk.Image image_rest;
+       [Widget] Gtk.HBox hbox_rest_time_values;
+       [Widget] Gtk.SpinButton spinbutton_rest_minutes;
+       [Widget] Gtk.SpinButton spinbutton_rest_seconds;
 
        [Widget] Gtk.RadioButton radio_color_custom;
        [Widget] Gtk.RadioButton radio_color_chronojump_blue;
@@ -282,7 +287,8 @@ public class PreferencesWindow
        private WebcamFfmpegSupportedModes wfsm;
 
 
-       PreferencesWindow () {
+       PreferencesWindow ()
+       {
                Glade.XML gladeXML;
                gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "preferences_win.glade", 
"preferences_win", "chronojump");
                gladeXML.Autoconnect(this);
@@ -344,7 +350,11 @@ public class PreferencesWindow
                PreferencesWindowBox.createComboLanguage();
                Pixbuf pixbuf;
 
-               //appearence tab
+               //appearance tab
+
+               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_rest.png");
+               PreferencesWindowBox.image_rest.Pixbuf = pixbuf;
+
                if(preferences.maximized == Preferences.MaximizedTypes.NO)
                {
                        PreferencesWindowBox.check_appearance_maximized.Active = false;
@@ -411,6 +421,18 @@ public class PreferencesWindow
                else
                        PreferencesWindowBox.radio_font_helvetica.Active = true;
 
+               PreferencesWindowBox.check_rest_time.Active = (preferences.restTimeMinutes >= 0);
+               PreferencesWindowBox.on_check_rest_time_toggled (new object (), new EventArgs ());
+
+               if(preferences.restTimeMinutes >= 0)
+               {
+                       PreferencesWindowBox.spinbutton_rest_minutes.Value = preferences.restTimeMinutes;
+                       PreferencesWindowBox.spinbutton_rest_seconds.Value = preferences.restTimeSeconds;
+               } else { //min == -1 means no restTime
+                       PreferencesWindowBox.spinbutton_rest_minutes.Value = 2;
+                       PreferencesWindowBox.spinbutton_rest_seconds.Value = 0;
+               }
+
                //multimedia tab
                if(preferences.volumeOn)  
                        PreferencesWindowBox.checkbutton_volume.Active = true; 
@@ -854,6 +876,21 @@ public class PreferencesWindow
                label_radio_font_needs_restart.Visible = true;
        }
 
+       private void on_check_rest_time_toggled (object o, EventArgs args)
+       {
+               Pixbuf pixbuf;
+               if(check_rest_time.Active)
+               {
+                       hbox_rest_time_values.Visible = true;
+                       pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_rest.png");
+               } else
+               {
+                       hbox_rest_time_values.Visible = false;
+                       pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_rest_inactive.png");
+               }
+               PreferencesWindowBox.image_rest.Pixbuf = pixbuf;
+       }
+
        private void on_radio_encoder_capture_show_all_bars_toggled (object o, EventArgs args)
        {
                spin_encoder_capture_show_only_some_bars.Sensitive = false;
@@ -1757,6 +1794,34 @@ public class PreferencesWindow
                        preferences.fontType = Preferences.FontTypes.Courier;
                }
 
+               //rest time change start ---->
+               bool changeRestTime = false;
+               int minutes = (int) PreferencesWindowBox.spinbutton_rest_minutes.Value;
+               int seconds = (int) PreferencesWindowBox.spinbutton_rest_seconds.Value;
+
+               //if we had some time selected previously and now we selected no rest time
+               if(preferences.restTimeMinutes >= 0 && ! PreferencesWindowBox.check_rest_time.Active)
+               {
+                       changeRestTime = true;
+                       minutes = -1;
+                       seconds = 0;
+               } else
+               {
+                       if(preferences.restTimeMinutes != minutes)
+                               changeRestTime = true;
+                       if(preferences.restTimeSeconds != seconds)
+                               changeRestTime = true;
+               }
+
+               if(changeRestTime)
+               {
+                               SqlitePreferences.Update(SqlitePreferences.RestTimeMinutes, 
minutes.ToString(), true);
+                               preferences.restTimeMinutes = minutes;
+                               SqlitePreferences.Update(SqlitePreferences.RestTimeSeconds, 
seconds.ToString(), true);
+                               preferences.restTimeSeconds = seconds;
+               }
+               //<---- rest time change end
+
                if( preferences.digitsNumber != Convert.ToInt32(UtilGtk.ComboGetActive(combo_decimals)) ) {
                        SqlitePreferences.Update("digitsNumber", UtilGtk.ComboGetActive(combo_decimals), 
true);
                        preferences.digitsNumber = Convert.ToInt32(UtilGtk.ComboGetActive(combo_decimals));
diff --git a/src/preferences.cs b/src/preferences.cs
index d3da8943..5ce59728 100644
--- a/src/preferences.cs
+++ b/src/preferences.cs
@@ -42,6 +42,8 @@ public class Preferences
        public bool logoAnimatedShow;
        public enum FontTypes { Courier, Helvetica};
        public FontTypes fontType;
+       public int restTimeMinutes; //-1 deactivated minutes and seconds
+       public int restTimeSeconds;
 
        public string GetFontTypeWithSize(int size) {
                return string.Format("{0} {1}", fontType, size);
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index c3fc5bc1..24e046b7 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 = "2.01";
+       static string lastChronojumpDatabaseVersion = "2.02";
 
        public Sqlite()
        {
@@ -2785,6 +2785,14 @@ class Sqlite
 
                                currentVersion = updateVersion("2.01");
                        }
+                       if(currentVersion == "2.01")
+                       {
+                               LogB.SQL("Inserted into preferences: restTimeMinutes, restTimeSeconds");
+                               SqlitePreferences.Insert (SqlitePreferences.RestTimeMinutes, "2");
+                               SqlitePreferences.Insert (SqlitePreferences.RestTimeSeconds, "0");
+
+                               currentVersion = updateVersion("2.02");
+                       }
 
                        /*
                        if(currentVersion == "1.79")
@@ -3000,7 +3008,9 @@ class Sqlite
 //just testing: 1.79 - 1.80 Converted DB to 1.80 Created table ForceSensorElasticBandGlue and moved 
stiffnessString records there
 
 
-               //1.93 - 2.00 Converted DB to 2.00 Inserted into preferences: fontsOnGraphs
+               //2.01 - 2.02 Converted DB to 2.02 Inserted into preferences: restTimeMinutes, 
restTimeSeconds")
+               //2.00 - 2.01 Converted DB to 2.01 RunEncoderExercise ALTER TABLE: added column segmentMeters
+               //1.99 - 2.00 Converted DB to 2.00 Inserted into preferences: fontsOnGraphs
                //1.98 - 1.99 Converted DB to 1.99 Updated 3L3R tracks fixedValue (just affected description)
                //1.97 - 1.98 Converted DB to 1.98 Inserted into preferences: colorBackgroundOsColor
                //1.96 - 1.97 Converted DB to 1.97 Inserted into preferences: loadLastSessionAtStart, 
lastSessionID, loadLastModAtStart, lastMode
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index af886fe1..c83cc57d 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -33,6 +33,8 @@ class SqlitePreferences : Sqlite
        public const string ColorBackgroundOsColor = "colorBackgroundOsColor";
        public const string LogoAnimatedShow = "logoAnimatedShow";
        public const string FontsOnGraphs = "fontsOnGraphs";
+       public const string RestTimeMinutes = "restTimeMinutes";
+       public const string RestTimeSeconds = "restTimeSeconds";
 
        //contacts
        public const string JumpsFVProfileOnlyBestInWeight = "jumpsFVProfileOnlyBestInWeight";
@@ -136,6 +138,8 @@ class SqlitePreferences : Sqlite
                                Insert (ColorBackground, "#0e1e46", dbcmdTr);
                                Insert (ColorBackgroundOsColor, "False", dbcmdTr);
                                Insert (FontsOnGraphs, Preferences.FontTypes.Helvetica.ToString(), dbcmdTr);
+                               Insert (RestTimeMinutes, "2", dbcmdTr);
+                               Insert (RestTimeSeconds, "0", dbcmdTr);
                                Insert (UnitsStr, Preferences.UnitsEnum.METRIC.ToString(), dbcmdTr);
                                Insert (EncoderCaptureInfinite, "False", dbcmdTr);
                                Insert ("encoderCaptureShowOnlyBars", "True", dbcmdTr);
@@ -424,6 +428,20 @@ class SqlitePreferences : Sqlite
                        else if(reader[0].ToString() == FontsOnGraphs)
                                preferences.fontType = (Preferences.FontTypes)
                                        Enum.Parse(typeof(Preferences.FontTypes), reader[1].ToString());
+                       else if(reader[0].ToString() == RestTimeMinutes)
+                       {
+                               if(Util.IsNumber(reader[1].ToString(), false))
+                                       preferences.restTimeMinutes = Convert.ToInt32(reader[1].ToString());
+                               else
+                                       preferences.restTimeMinutes = 0;
+                       }
+                       else if(reader[0].ToString() == RestTimeSeconds)
+                       {
+                               if(Util.IsNumber(reader[1].ToString(), false))
+                                       preferences.restTimeSeconds = Convert.ToInt32(reader[1].ToString());
+                               else
+                                       preferences.restTimeSeconds = 0;
+                       }
                        else if(reader[0].ToString() == UnitsStr)
                                preferences.units = (Preferences.UnitsEnum)
                                        Enum.Parse(typeof(Preferences.UnitsEnum), reader[1].ToString());


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