[chronojump] DB: 1.55, person photo can be disabled



commit 2df89bb2b3cf75d92b8258e2ae8daf59eb4c2852
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sat Feb 10 15:56:33 2018 +0100

    DB: 1.55, person photo can be disabled

 glade/app1.glade             |  106 ++++++++++++++++++++++++++++++++++++++++-
 src/gui/chronojump.cs        |   16 ++++--
 src/gui/chronojumpIcons.cs   |    7 +++
 src/gui/chronojumpPersons.cs |   24 +++++++++-
 src/gui/networks.cs          |    4 ++
 src/preferences.cs           |    1 +
 src/sqlite/main.cs           |   11 ++++-
 src/sqlite/preferences.cs    |    3 +
 8 files changed, 160 insertions(+), 12 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index c269c5e..8d1dcb1 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -519,6 +519,15 @@
                         <signal name="toggled" handler="on_menuitem_view_persons_on_top_toggled" 
swapped="no"/>
                       </widget>
                     </child>
+                    <child>
+                      <widget class="GtkCheckMenuItem" id="menuitem_view_persons_show_photo">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Show persons photo</property>
+                        <property name="use_underline">True</property>
+                        <signal name="toggled" handler="on_menuitem_view_persons_show_photo_toggled" 
swapped="no"/>
+                      </widget>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -1574,6 +1583,9 @@
                                                             <placeholder/>
                                                             </child>
                                                             <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkLabel" 
id="label_start_selector_jumps">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -2798,7 +2810,92 @@ EncoderInertialCapture</property>
                                                     <property name="can_focus">False</property>
                                                     <property name="spacing">6</property>
                                                     <child>
-                                                      <widget class="GtkHBox" 
id="hbox_persons_bottom_person">
+                                                      <widget class="GtkHBox" 
id="hbox_persons_bottom_no_photo">
+                                                        <property name="can_focus">False</property>
+                                                        <property name="spacing">2</property>
+                                                        <child>
+                                                          <widget class="GtkButton" 
id="button_edit_current_person_h">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="tooltip" translatable="yes">Edit 
selected person
+&lt;Control&gt;p</property>
+                                                            <property name="relief">half</property>
+                                                            <signal name="clicked" 
handler="on_edit_current_person_clicked_from_main_gui" swapped="no"/>
+                                                            <accelerator key="p" signal="clicked" 
modifiers="GDK_CONTROL_MASK"/>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_edit_current_person_h">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property 
name="stock">gtk-missing-image</property>
+                                                            <property name="icon-size">2</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="GtkButton" 
id="button_show_all_person_events_h">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="tooltip" translatable="yes">Show 
all tests of this person</property>
+                                                            <property name="relief">half</property>
+                                                            <signal name="clicked" 
handler="on_show_all_person_events_activate" swapped="no"/>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_all_persons_events_h">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property 
name="stock">gtk-missing-image</property>
+                                                            <property name="icon-size">2</property>
+                                                            </widget>
+                                                            </child>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                          </packing>
+                                                        </child>
+                                                        <child>
+                                                          <widget class="GtkButton" 
id="button_delete_current_person_h">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="can_default">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="tooltip" 
translatable="yes">Delete person</property>
+                                                            <property name="relief">half</property>
+                                                            <signal name="clicked" 
handler="on_delete_current_person_from_session_clicked" swapped="no"/>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_person_delete_h">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="icon-size">2</property>
+                                                            </widget>
+                                                            </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">0</property>
+                                                      </packing>
+                                                    </child>
+                                                    <child>
+                                                      <widget class="GtkHBox" id="hbox_persons_bottom_photo">
                                                         <property name="visible">True</property>
                                                         <property name="can_focus">False</property>
                                                         <property name="spacing">3</property>
@@ -2931,7 +3028,7 @@ EncoderInertialCapture</property>
                                                       <packing>
                                                         <property name="expand">True</property>
                                                         <property name="fill">True</property>
-                                                        <property name="position">0</property>
+                                                        <property name="position">1</property>
                                                       </packing>
                                                     </child>
                                                     <child>
@@ -3133,7 +3230,7 @@ EncoderInertialCapture</property>
                                                       <packing>
                                                         <property name="expand">False</property>
                                                         <property name="fill">False</property>
-                                                        <property name="position">1</property>
+                                                        <property name="position">2</property>
                                                       </packing>
                                                     </child>
                                                   </widget>
@@ -22811,6 +22908,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index c8222e4..f5c6981 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -301,7 +301,8 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Frame frame_persons;
        [Widget] Gtk.Frame frame_persons_top;
        [Widget] Gtk.VBox vbox_persons_bottom;
-       [Widget] Gtk.HBox hbox_persons_bottom_person;
+       [Widget] Gtk.HBox hbox_persons_bottom_photo;
+       [Widget] Gtk.HBox hbox_persons_bottom_no_photo;
        [Widget] Gtk.Button button_recuperate_person;
        [Widget] Gtk.Button button_recuperate_persons_from_session;
        [Widget] Gtk.Button button_person_add_single;
@@ -333,7 +334,6 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image image_jump_reactive_repair;
        [Widget] Gtk.Image image_run_interval_repair;
        [Widget] Gtk.Image image_pulse_repair;
-       [Widget] Gtk.Image image_person_delete;
        [Widget] Gtk.Image image_delete_last_test;
        [Widget] Gtk.Image image_jump_delete;
        [Widget] Gtk.Image image_jump_reactive_delete;
@@ -2299,7 +2299,8 @@ public partial class ChronoJumpWindow
 
                        //for sure, jumpsExists is false, because we create a new session
 
-                       hbox_persons_bottom_person.Sensitive = false;
+                       hbox_persons_bottom_photo.Sensitive = false;
+                       hbox_persons_bottom_no_photo.Sensitive = false;
                
                        //update report
                        report.SessionID = currentSession.UniqueID;
@@ -2472,7 +2473,8 @@ public partial class ChronoJumpWindow
                sensitiveGuiYesSession();
                definedSession = true;
                
-               hbox_persons_bottom_person.Sensitive = false;
+               hbox_persons_bottom_photo.Sensitive = false;
+               hbox_persons_bottom_no_photo.Sensitive = false;
 
                //if there are persons
                if(foundPersons) {
@@ -7013,7 +7015,8 @@ LogB.Debug("X");
                button_persons_up.Sensitive = option;
                button_persons_down.Sensitive = option;
 
-               hbox_persons_bottom_person.Sensitive = option;
+               hbox_persons_bottom_photo.Sensitive = option;
+               hbox_persons_bottom_no_photo.Sensitive = option;
        }
 
        private void sensitiveGuiNoSession () 
@@ -7032,7 +7035,8 @@ LogB.Debug("X");
                button_recuperate_persons_from_session.Sensitive = false;
                button_person_add_single.Sensitive = false;
                button_person_add_multiple.Sensitive = false;
-               hbox_persons_bottom_person.Sensitive = false;
+               hbox_persons_bottom_photo.Sensitive = false;
+               hbox_persons_bottom_no_photo.Sensitive = false;
        
                button_contacts_person_change.Sensitive = false;
                button_encoder_person_change.Sensitive = false;
diff --git a/src/gui/chronojumpIcons.cs b/src/gui/chronojumpIcons.cs
index 4947b12..9faf787 100644
--- a/src/gui/chronojumpIcons.cs
+++ b/src/gui/chronojumpIcons.cs
@@ -47,10 +47,14 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image image_person;
        [Widget] Gtk.Image image_person1;
        [Widget] Gtk.Image image_edit_current_person;
+       [Widget] Gtk.Image image_edit_current_person_h;
        //[Widget] Gtk.Image image_persons_up;
        //[Widget] Gtk.Image image_persons_down;
        [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;
+       [Widget] Gtk.Image image_person_delete_h;
        [Widget] Gtk.Image image_chronopic_connect_contacts;
        [Widget] Gtk.Image image_chronopic_connect_encoder;
        [Widget] Gtk.Image image_button_execute;
@@ -273,6 +277,7 @@ public partial class ChronoJumpWindow
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_edit.png");
                image_encoder_exercise_edit.Pixbuf = pixbuf;
                image_edit_current_person.Pixbuf = pixbuf;
+               image_edit_current_person_h.Pixbuf = pixbuf;
                image_session_edit.Pixbuf = pixbuf;
 
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_close.png");
@@ -302,6 +307,7 @@ public partial class ChronoJumpWindow
 
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_visibility.png");
                image_all_persons_events.Pixbuf = pixbuf;
+               image_all_persons_events_h.Pixbuf = pixbuf;
 
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "inertial_rolled.png");
                image_inertial_rolled.Pixbuf = pixbuf;
@@ -420,6 +426,7 @@ public partial class ChronoJumpWindow
                
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "stock_delete.png");
                image_person_delete.Pixbuf = pixbuf;
+               image_person_delete_h.Pixbuf = pixbuf;
                image_delete_last_test.Pixbuf = pixbuf;
                image_jump_delete.Pixbuf = pixbuf;
                image_jump_reactive_delete.Pixbuf = pixbuf;
diff --git a/src/gui/chronojumpPersons.cs b/src/gui/chronojumpPersons.cs
index 08c69d3..ff77489 100644
--- a/src/gui/chronojumpPersons.cs
+++ b/src/gui/chronojumpPersons.cs
@@ -27,8 +27,9 @@ using Glade;
 public partial class ChronoJumpWindow
 {
        [Widget] Gtk.CheckMenuItem menuitem_view_persons_on_top;
+       [Widget] Gtk.CheckMenuItem menuitem_view_persons_show_photo;
 
-       private void on_menuitem_view_persons_on_top_toggled(object o, EventArgs args)
+       private void on_menuitem_view_persons_on_top_toggled (object o, EventArgs args)
        {
                bool personsOnTop = menuitem_view_persons_on_top.Active;
                LogB.Information("Toggled: " + personsOnTop.ToString());
@@ -38,10 +39,29 @@ public partial class ChronoJumpWindow
                showPersonsOnTop(personsOnTop);
        }
 
-       private void showPersonsOnTop(bool onTop)
+       private void showPersonsOnTop (bool onTop)
        {
                notebook_session_person.Visible = ! onTop;
                hbox_top_person.Visible = onTop;
                hbox_top_person_encoder.Visible = onTop;
        }
+
+
+       private void on_menuitem_view_persons_show_photo_toggled (object o, EventArgs args)
+       {
+               bool showPhoto = menuitem_view_persons_show_photo.Active;
+
+               SqlitePreferences.Update("personPhoto", showPhoto.ToString(), false);
+               preferences.personPhoto = showPhoto;
+               showPersonsPhoto(showPhoto);
+       }
+
+       private void showPersonsPhoto (bool showPhoto)
+       {
+               if(! menuitem_view_persons_on_top.Active)
+               {
+                       hbox_persons_bottom_photo.Visible = showPhoto;
+                       hbox_persons_bottom_no_photo.Visible = ! showPhoto;
+               }
+       }
 }
diff --git a/src/gui/networks.cs b/src/gui/networks.cs
index acb99a8..7e5290d 100644
--- a/src/gui/networks.cs
+++ b/src/gui/networks.cs
@@ -320,6 +320,10 @@ public partial class ChronoJumpWindow
                showPersonsOnTop(configChronojump.PersonWinHide);
                menuitem_view_persons_on_top.Active = configChronojump.PersonWinHide;
 
+               showPersonsPhoto(preferences.personPhoto);
+               menuitem_view_persons_show_photo.Active = preferences.personPhoto;
+
+
                if(configChronojump.EncoderAnalyzeHide) {
                        hbox_encoder_sup_capture_analyze_two_buttons.Visible = false;
                }
diff --git a/src/preferences.cs b/src/preferences.cs
index c489261..69e209f 100644
--- a/src/preferences.cs
+++ b/src/preferences.cs
@@ -31,6 +31,7 @@ public class Preferences
        public enum MaximizedTypes { NO, YES, YESUNDECORATED};
        public MaximizedTypes maximized;
        public bool personWinHide;
+       public bool personPhoto;
        public bool encoderCaptureShowOnlyBars;
 
        public bool showPower;
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 4f1d5a0..aa7c5b6 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.54";
+       static string lastChronojumpDatabaseVersion = "1.55";
 
        public Sqlite() {
        }
@@ -2321,6 +2321,14 @@ class Sqlite
 
                                currentVersion = updateVersion("1.54");
                        }
+                       if(currentVersion == "1.54")
+                       {
+                               LogB.SQL("Added preferences: personPhoto");
+
+                               SqlitePreferences.Insert ("personPhoto", "True");
+
+                               currentVersion = updateVersion("1.55");
+                       }
 
 
 
@@ -2504,6 +2512,7 @@ class Sqlite
                SqlitePreferences.initializeTable(lastChronojumpDatabaseVersion, creatingBlankDatabase);
 
                //changes [from - to - desc]
+               //1.54 - 1.55 Converted DB to 1.55 Added preferences: personPhoto
                //1.53 - 1.54 Converted DB to 1.54 Added encoderRhythm variables: repOrPhases, repSeconds
                //1.52 - 1.53 Converted DB to 1.53 Added encoderRhtyhm active variable
                //1.51 - 1.52 Converted DB to 1.52 Added encoderRhtyhm stuff
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index 67ad5f0..0ee3add 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -78,6 +78,7 @@ class SqlitePreferences : Sqlite
                                //appearance
                                Insert ("maximized", Preferences.MaximizedTypes.NO.ToString(), dbcmdTr);
                                Insert ("personWinHide", "False", dbcmdTr);
+                               Insert ("personPhoto", "True", dbcmdTr);
                                Insert ("encoderCaptureShowOnlyBars", "False", dbcmdTr);
                                Insert ("digitsNumber", "3", dbcmdTr);
                                Insert ("showPower", "True", dbcmdTr);
@@ -277,6 +278,8 @@ class SqlitePreferences : Sqlite
                                        Enum.Parse(typeof(Preferences.MaximizedTypes), reader[1].ToString());
                        else if(reader[0].ToString() == "personWinHide")
                                preferences.personWinHide = reader[1].ToString() == "True";
+                       else if(reader[0].ToString() == "personPhoto")
+                               preferences.personPhoto = reader[1].ToString() == "True";
                        else if(reader[0].ToString() == "encoderCaptureShowOnlyBars")
                                preferences.encoderCaptureShowOnlyBars = reader[1].ToString() == "True";
                        else if(reader[0].ToString() == "showPower")


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