[chronojump] Networks new feautre: guest user (no wristband, no upload, meanSpeed, invisible some widgets)
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Networks new feautre: guest user (no wristband, no upload, meanSpeed, invisible some widgets)
- Date: Fri, 11 Mar 2022 11:29:54 +0000 (UTC)
commit d759d9d6edbe82cb66ec59e34e45d84126efa6e9
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Mar 11 12:28:06 2022 +0100
Networks new feautre: guest user (no wristband, no upload, meanSpeed, invisible some widgets)
glade/app1.glade | 1 +
src/gui/app1/encoder.cs | 1 +
src/gui/app1/menu_tiny.cs | 1 +
src/gui/networks.cs | 65 +++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 68 insertions(+)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 88fd21feb..5c5357b8a 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -31065,6 +31065,7 @@ Concentric</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"/>
<child>
<widget class="GtkEventBox"
id="eventbox_button_networks_encoder_guest">
<property name="visible">True</property>
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index 72050758d..2ecdb2b8d 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -101,6 +101,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Button button_encoder_capture_finish_cont;
[Widget] Gtk.Button button_encoder_exercise_close_and_recalculate;
[Widget] Gtk.Button button_encoder_capture_session_overview;
+ [Widget] Gtk.Button button_encoder_bells;
[Widget] Gtk.Button button_encoder_load_signal;
[Widget] Gtk.Button button_encoder_load_signal_at_analyze;
[Widget] Gtk.Viewport viewport_image_encoder_capture;
diff --git a/src/gui/app1/menu_tiny.cs b/src/gui/app1/menu_tiny.cs
index 17b232104..a49efd41d 100644
--- a/src/gui/app1/menu_tiny.cs
+++ b/src/gui/app1/menu_tiny.cs
@@ -44,6 +44,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.EventBox eventbox_button_encoder_person_change;
[Widget] Gtk.EventBox eventbox_button_networks_encoder_guest;
[Widget] Gtk.CheckButton check_menu_session1;
+ [Widget] Gtk.Button button_menu_preferences1;
[Widget] Gtk.Button button_menu_news1;
[Widget] Gtk.VBox vbox_menu_session1;
[Widget] Gtk.Alignment alignment_menu_session_options1;
diff --git a/src/gui/networks.cs b/src/gui/networks.cs
index 4837b57bb..259f29d2d 100644
--- a/src/gui/networks.cs
+++ b/src/gui/networks.cs
@@ -366,6 +366,68 @@ public partial class ChronoJumpWindow
rfidProcessCancel = true;
}
+ private void on_button_networks_encoder_guest_clicked (object sender, EventArgs e)
+ {
+ // 1) do not allow to click again the button
+ button_networks_encoder_guest.Visible = false;
+
+ // 2) reset logout counter
+ compujumpAutologout = new CompujumpAutologout();
+
+ // 3) create/load person. guest is id: -2, check if it exists. If it exists will return -2,
if not: -1
+ currentPerson = SqlitePerson.Select(false, -2);
+ if(currentPerson.UniqueID == -1) //do not exists, create it
+ currentPerson = new Person (true, -2, Catalog.GetString("Guest"), "-1", ""); //this
true means insertPerson
+
+ // 4) personSession insert if needed and assign
+ currentPersonSession = SqlitePersonSession.Select(false, currentPerson.UniqueID,
currentSession.UniqueID);
+ if(currentPersonSession.UniqueID == -1)
+ currentPersonSession = new PersonSession (
+ currentPerson.UniqueID, currentSession.UniqueID,
+ 0, 0, //width, height
+ Constants.SportUndefinedID,
+ Constants.SpeciallityUndefinedID,
+ Constants.LevelUndefinedID,
+ "", //comments
+ Constants.TrochanterToeUndefinedID,
+ Constants.TrochanterFloorOnFlexionUndefinedID,
+ false); //dbconOpened
+
+ // 5) person active gui changes
+ sensitiveGuiYesPerson();
+ personChanged(); //GTK
+ label_person_change();
+
+ // 6) specific guest setup
+ configNetworsEncoderAsGuest (true);
+ }
+ private void configNetworsEncoderAsGuest(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;
+
+ radio_mode_encoder_analyze_small.Visible = ! guest;
+ button_menu_preferences1.Visible = ! guest;
+ button_encoder_load_signal.Visible = ! guest;
+ button_encoder_capture_session_overview.Visible = ! guest;
+ button_encoder_delete_signal.Visible = ! guest;
+
+ button_encoder_bells.Visible = ! guest;
+ if(guest)
+ {
+ preferences.encoderCaptureMainVariable = Constants.EncoderVariablesCapture.MeanSpeed;
+ preferences.encoderCaptureSecondaryVariable =
Constants.EncoderVariablesCapture.RangeAbsolute;
+ } else {
+ preferences.encoderCaptureMainVariable = (Constants.EncoderVariablesCapture)
+ Enum.Parse(typeof(Constants.EncoderVariablesCapture),
+ SqlitePreferences.Select("encoderCaptureMainVariable",
false));
+ preferences.encoderCaptureSecondaryVariable = (Constants.EncoderVariablesCapture)
+ Enum.Parse(typeof(Constants.EncoderVariablesCapture),
+ SqlitePreferences.Select("encoderCaptureSecondaryVariable",
false));
+ }
+ }
+
private void configInitFromPreferences()
{
if(configChronojump == null)
@@ -854,6 +916,9 @@ public partial class ChronoJumpWindow
if(currentPerson != null && currentPersonWasNull)
sensitiveGuiYesPerson();
+ //it is not a guest remove guest changes
+ configNetworsEncoderAsGuest (false);
+
if(pChangedShowTasks)
{
compujumpAutologout = new CompujumpAutologout();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]