[chronojump] Networks contacts with Guest mode



commit 4c6468b63a9e8492b781ec15164519892123fd2e
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Aug 4 17:39:39 2022 +0200

    Networks contacts with Guest mode

 glade/app1.glade          | 65 +++++++++++++++++++++++++++++++++++++----------
 src/gui/app1/menu_tiny.cs |  2 ++
 src/gui/networks.cs       | 56 +++++++++++++++++++++++++++++++++++++---
 3 files changed, 105 insertions(+), 18 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 99c8a9a3f..74321840c 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -4706,26 +4706,63 @@ EncoderInertialCapture</property>
                                                   </packing>
                                                 </child>
                                                 <child>
-                                                  <widget class="GtkButton" 
id="button_contacts_person_change">
-                                                    <property name="width_request">80</property>
-                                                    <property name="height_request">40</property>
+                                                  <widget class="GtkHBox" id="hbox500">
                                                     <property name="visible">True</property>
-                                                    <property name="can_focus">True</property>
-                                                    <property name="receives_default">True</property>
-                                                    <property name="tooltip" 
translatable="yes">Person</property>
-                                                    <signal name="clicked" 
handler="on_button_top_person_clicked" swapped="no"/>
+                                                    <property name="can_focus">False</property>
                                                     <child>
-                                                      <widget class="GtkEventBox" 
id="eventbox_button_contacts_person_change">
+                                                      <widget class="GtkButton" 
id="button_contacts_person_change">
+                                                        <property name="width_request">80</property>
+                                                        <property name="height_request">40</property>
                                                         <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
+                                                        <property name="can_focus">True</property>
+                                                        <property name="receives_default">True</property>
+                                                        <property name="tooltip" 
translatable="yes">Person</property>
+                                                        <signal name="clicked" 
handler="on_button_top_person_clicked" swapped="no"/>
                                                         <child>
-                                                          <widget class="GtkImage" id="image_person1">
+                                                          <widget class="GtkEventBox" 
id="eventbox_button_contacts_person_change">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
+                                                            <widget class="GtkImage" id="image_person1">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property 
name="stock">gtk-missing-image</property>
+                                                            </widget>
+                                                            </child>
+                                                          </widget>
+                                                        </child>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="expand">True</property>
+                                                        <property name="fill">True</property>
+                                                        <property name="position">0</property>
+                                                      </packing>
+                                                    </child>
+                                                    <child>
+                                                      <widget class="GtkButton" 
id="button_networks_contacts_guest">
+                                                        <property name="height_request">40</property>
+                                                        <property name="can_focus">True</property>
+                                                        <property name="receives_default">True</property>
+                                                        <signal name="clicked" 
handler="on_button_networks_guest_clicked" swapped="no"/>
+                                                        <child>
+                                                          <widget class="GtkEventBox" 
id="eventbox_button_networks_contacts_guest">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label280">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">Guest</property>
+                                                            </widget>
+                                                            </child>
                                                           </widget>
                                                         </child>
                                                       </widget>
+                                                      <packing>
+                                                        <property name="expand">True</property>
+                                                        <property name="fill">True</property>
+                                                        <property name="position">1</property>
+                                                      </packing>
                                                     </child>
                                                   </widget>
                                                   <packing>
@@ -6558,6 +6595,7 @@ EncoderInertialCapture</property>
                                                           <widget class="GtkHBox" id="hbox170">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
+                                                            <property name="border_width">4</property>
                                                             <child>
                                                             <widget class="GtkHBox" 
id="hbox_contacts_device_adjust_threshold">
                                                             <property name="visible">True</property>
@@ -6650,8 +6688,8 @@ EncoderInertialCapture</property>
                                                             </child>
                                                           </widget>
                                                           <packing>
-                                                            <property name="expand">True</property>
-                                                            <property name="fill">True</property>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
                                                             <property name="position">0</property>
                                                           </packing>
                                                         </child>
@@ -31130,8 +31168,7 @@ Concentric</property>
                                                         <property name="height_request">40</property>
                                                         <property name="can_focus">True</property>
                                                         <property name="receives_default">True</property>
-                                                        <property name="tooltip" 
translatable="yes">Person</property>
-                                                        <signal name="clicked" 
handler="on_button_networks_encoder_guest_clicked" swapped="no"/>
+                                                        <signal name="clicked" 
handler="on_button_networks_guest_clicked" swapped="no"/>
                                                         <child>
                                                           <widget class="GtkEventBox" 
id="eventbox_button_networks_encoder_guest">
                                                             <property name="visible">True</property>
diff --git a/src/gui/app1/menu_tiny.cs b/src/gui/app1/menu_tiny.cs
index 377c9a510..1724e1c8f 100644
--- a/src/gui/app1/menu_tiny.cs
+++ b/src/gui/app1/menu_tiny.cs
@@ -43,6 +43,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.EventBox eventbox_button_menu_exit1;
        [Widget] Gtk.EventBox eventbox_button_contacts_person_change;
        [Widget] Gtk.EventBox eventbox_button_encoder_person_change;
+       [Widget] Gtk.EventBox eventbox_button_networks_contacts_guest;
        [Widget] Gtk.EventBox eventbox_button_networks_encoder_guest;
        [Widget] Gtk.CheckButton check_menu_session1;
        [Widget] Gtk.Button button_menu_preferences1;
@@ -155,6 +156,7 @@ public partial class ChronoJumpWindow
 
                UtilGtk.EventBoxColorBackgroundActive (eventbox_button_contacts_person_change, 
UtilGtk.YELLOW, UtilGtk.YELLOW_LIGHT);
                UtilGtk.EventBoxColorBackgroundActive (eventbox_button_encoder_person_change, UtilGtk.YELLOW, 
UtilGtk.YELLOW_LIGHT);
+               UtilGtk.EventBoxColorBackgroundActive (eventbox_button_networks_contacts_guest, 
UtilGtk.YELLOW, UtilGtk.YELLOW_LIGHT);
                UtilGtk.EventBoxColorBackgroundActive (eventbox_button_networks_encoder_guest, 
UtilGtk.YELLOW, UtilGtk.YELLOW_LIGHT);
        }
 
diff --git a/src/gui/networks.cs b/src/gui/networks.cs
index e0c1b3590..73a834004 100644
--- a/src/gui/networks.cs
+++ b/src/gui/networks.cs
@@ -64,6 +64,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image image_current_person;
        [Widget] Gtk.Button button_contacts_person_change;
        [Widget] Gtk.Button button_encoder_person_change;
+       [Widget] Gtk.Button button_networks_contacts_guest;
        [Widget] Gtk.Button button_networks_encoder_guest;
 
        //encoder exercise stuff
@@ -210,7 +211,9 @@ public partial class ChronoJumpWindow
                        configChronojump.PersonWinHide = true;
                        showPersonsOnTop(true);
 
+                       button_networks_contacts_guest.Visible = true;
                        button_networks_encoder_guest.Visible = true;
+                       button_contacts_person_change.Visible = false;
                        button_encoder_person_change.Visible = false;
 
                        if(configChronojump.CompujumpStationMode != Constants.Modes.UNDEFINED)
@@ -442,9 +445,10 @@ public partial class ChronoJumpWindow
                database_fc.Destroy();
        }
 
-       private void on_button_networks_encoder_guest_clicked (object sender, EventArgs e)
+       private void on_button_networks_guest_clicked (object sender, EventArgs e)
        {
                // 1) do not allow to click again the button
+               button_networks_contacts_guest.Visible = false;
                button_networks_encoder_guest.Visible = false;
 
                // 2) reset logout counter
@@ -475,13 +479,50 @@ public partial class ChronoJumpWindow
                label_person_change();
 
                // 6) specific guest setup
-               configNetworsEncoderAsGuest (true);
+               if (Constants.ModeIsENCODER (current_mode))
+                       configNetworksEncoderAsGuest (true);
+               else
+                       configNetworksContactsAsGuest (true);
        }
-       private void configNetworsEncoderAsGuest(bool guest)
+       private void configNetworksContactsAsGuest (bool guest)
        {
                //on guest widgets are invisible, cleaner and easier than unsensitive because during 
capture/curves sensitivity changes on some buttons
                check_contacts_networks_upload.Active = ! guest;
                check_contacts_networks_upload.Visible = ! guest;
+
+               //radio_mode_contacts_analyze_small.Visible = ! guest;
+               button_menu_preferences1.Visible = ! guest;
+               button_contacts_capture_load.Visible = ! guest;
+               button_contacts_capture_session_overview.Visible = ! guest;
+               button_delete_last_test.Visible = ! guest;
+
+               button_contacts_bells.Visible = ! guest;
+
+               //simple jumps
+               button_edit_selected_jump.Visible = ! guest;
+               button_video_play_selected_jump.Visible = ! guest;
+               button_delete_selected_jump.Visible = ! guest;
+
+               //multiple jumps
+               button_edit_selected_jump_rj.Visible = ! guest;
+               button_repair_selected_jump_rj.Visible = ! guest;
+               button_video_play_selected_jump_rj.Visible = ! guest;
+               button_delete_selected_jump_rj.Visible = ! guest;
+
+               //simple races
+               button_edit_selected_run.Visible = ! guest;
+               button_video_play_selected_run.Visible = ! guest;
+               button_delete_selected_run.Visible = ! guest;
+
+               //intervallic races
+               button_edit_selected_run_interval.Visible = ! guest;
+               button_repair_selected_run_interval.Visible = ! guest;
+               button_video_play_selected_run_interval.Visible = ! guest;
+               button_delete_selected_run_interval.Visible = ! guest;
+       }
+       private void configNetworksEncoderAsGuest(bool guest)
+       {
+               //on guest widgets are invisible, cleaner and easier than unsensitive because during 
capture/curves sensitivity changes on some buttons
                check_encoder_networks_upload.Active = ! guest;
                check_encoder_networks_upload.Visible = ! guest;
 
@@ -990,13 +1031,18 @@ public partial class ChronoJumpWindow
                        sensitiveGuiYesPerson();
 
                //it is not a guest remove guest changes
-               configNetworsEncoderAsGuest (false);
+               if (Constants.ModeIsENCODER (current_mode))
+                       configNetworksEncoderAsGuest (false);
+               else
+                       configNetworksContactsAsGuest (false);
 
                if(pChangedShowTasks)
                {
                        compujumpAutologout = new CompujumpAutologout();
 
+                       button_networks_contacts_guest.Visible = false;
                        button_networks_encoder_guest.Visible = false;
+                       button_contacts_person_change.Visible = true;
                        button_encoder_person_change.Visible = true;
 
                        /*TODO:
@@ -1384,7 +1430,9 @@ public partial class ChronoJumpWindow
                currentPerson = null;
                currentPersonSession = null;
                sensitiveGuiNoPerson ();
+               button_networks_contacts_guest.Visible = true;
                button_networks_encoder_guest.Visible = true;
+               button_contacts_person_change.Visible = false;
                button_encoder_person_change.Visible = false;
 
                //not allow to change devices if person changed. If you want to change again, go to 
preferences/advanced networksAllowChangeDevices


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