[chronojump] Encoder auto save curve removed from preferences window
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder auto save curve removed from preferences window
- Date: Tue, 29 Oct 2019 14:21:50 +0000 (UTC)
commit ecaa11d415bf47156224a0cc3f89a374cf3f2080
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Oct 29 15:21:32 2019 +0100
Encoder auto save curve removed from preferences window
glade/preferences_win.glade | 270 +-------------------------------------------
src/gui/chronojump.cs | 5 -
src/gui/encoder.cs | 14 +++
src/gui/preferences.cs | 51 ---------
src/preferences.cs | 5 +-
5 files changed, 18 insertions(+), 327 deletions(-)
---
diff --git a/glade/preferences_win.glade b/glade/preferences_win.glade
index 9955894e..6f18bbbd 100644
--- a/glade/preferences_win.glade
+++ b/glade/preferences_win.glade
@@ -2365,274 +2365,6 @@ It starts before and arrives there with some speed.</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">20</property>
- <child>
- <widget class="GtkVBox" id="vbox13">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">8</property>
- <property name="spacing">8</property>
- <child>
- <widget class="GtkRadioButton"
id="radio_encoder_auto_save_curve_best">
- <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>
- <child>
- <widget class="GtkHBox" id="hbox11">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">8</property>
- <child>
- <widget class="GtkLabel" id="label40">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Save the best
repetition</property>
- </widget>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkHBox" id="hbox12">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <widget class="GtkLabel" id="label37">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label">(</property>
- </widget>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label39">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label"
translatable="yes">default</property>
- </widget>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label41">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label">)</property>
- </widget>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkHBox" id="hbox48">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">8</property>
- <child>
- <widget class="GtkRadioButton"
id="radio_encoder_auto_save_curve_best_n">
- <property name="label" translatable="yes">Save the best n
repetitions</property>
- <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>
- <property
name="group">radio_encoder_auto_save_curve_best</property>
- <signal name="toggled"
handler="on_radio_encoder_auto_save_curve_best_n_toggled" swapped="no"/>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkSpinButton"
id="spin_encoder_auto_save_curve_best_n">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="has_tooltip">True</property>
- <property name="tooltip" translatable="yes">Minimal
height</property>
- <property name="invisible_char">●</property>
- <property name="width_chars">2</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">3 1 10 1 10 0</property>
- <property name="climb_rate">1</property>
- <property name="snap_to_ticks">True</property>
- <property name="numeric">True</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>
- <child>
- <widget class="GtkRadioButton"
id="radio_encoder_auto_save_curve_all">
- <property name="label" translatable="yes">Save all</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- <property
name="group">radio_encoder_auto_save_curve_best</property>
- </widget>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <widget class="GtkRadioButton"
id="radio_encoder_auto_save_curve_4top">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- <property
name="group">radio_encoder_auto_save_curve_best</property>
- <child>
- <widget class="GtkHBox" id="hbox18">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">8</property>
- <child>
- <widget class="GtkLabel" id="label4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Save all but
last</property>
- </widget>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkHBox" id="hbox19">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <widget class="GtkLabel" id="label6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label">(</property>
- </widget>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label42">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Good for
inertial</property>
- </widget>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label55">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label">)</property>
- </widget>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <widget class="GtkRadioButton"
id="radio_encoder_auto_save_curve_none">
- <property name="label" translatable="yes">Do not save</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- <property
name="group">radio_encoder_auto_save_curve_best</property>
- </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>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVSeparator" id="vseparator1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
<child>
<widget class="GtkVBox" id="vbox21">
<property name="visible">True</property>
@@ -2719,7 +2451,7 @@ It starts before and arrives there with some speed.</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">2</property>
+ <property name="position">0</property>
</packing>
</child>
</widget>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index eae57ef2..b496a7c3 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -844,8 +844,6 @@ public partial class ChronoJumpWindow
//---- encoder ----
- spin_encoder_capture_curves_best_n.Value = preferences.encoderAutoSaveCurveBestNValue;
-
encoderRhythm = new EncoderRhythm(
preferences.encoderRhythmActive, preferences.encoderRhythmRepsOrPhases,
preferences.encoderRhythmRepSeconds,
@@ -3042,9 +3040,6 @@ public partial class ChronoJumpWindow
LogB.Information("catched at on_preferences_accepted ()");
}
- //encoder
- spin_encoder_capture_curves_best_n.Value = preferences.encoderAutoSaveCurveBestNValue;
-
//forceSensor (check that pen has already been defined)
if(pen_black_force_capture != null)
pen_black_force_capture.SetLineAttributes (preferences.forceSensorGraphsLineWidth,
Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round);
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 609022e3..1bcef822 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -3931,6 +3931,8 @@ public partial class ChronoJumpWindow
hbox_encoder_capture_curves_save.PackStart(combo_encoder_capture_curves_save, true, true, 0);
hbox_encoder_capture_curves_save.ShowAll();
+
+ spin_encoder_capture_curves_best_n.Value = preferences.encoderAutoSaveCurveBestNValue;
manageVisibilityOf_spin_encoder_capture_curves_best_n ();
button_combo_encoder_exercise_capture_right = UtilGtk.CreateArrowButton(ArrowType.Right,
ShadowType.In, 40, 40, UtilGtk.ArrowEnum.NONE);
@@ -4217,10 +4219,22 @@ public partial class ChronoJumpWindow
void on_button_encoder_capture_curves_save_clicked (object o, EventArgs args)
{
+ //1) gest Constants.EncoderAutoSaveCurve
string englishOption =
Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_capture_curves_save),
encoderCaptureCurvesSaveOptionsTranslation);
Constants.EncoderAutoSaveCurve easc = Constants.GetEncoderAutoSaveCurvesEnum (englishOption);
+
+ //2) update preferences
+ preferences.encoderAutoSaveCurve = easc;
+
+ //3) update Sqlite
+ SqlitePreferences.Update("encoderAutoSaveCurve", easc.ToString(), false);
+
+ if(easc == Constants.EncoderAutoSaveCurve.BESTN || easc ==
Constants.EncoderAutoSaveCurve.BESTNCONSECUTIVE)
+ SqlitePreferences.Update(SqlitePreferences.EncoderAutoSaveCurveBestNValue,
spin_encoder_capture_curves_best_n.Value.ToString(), false);
+
+ //4) save or unsave curves
encoderCaptureSaveCurvesAllNoneBest(easc,
Constants.GetEncoderVariablesCapture(preferences.encoderCaptureMainVariable));
}
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 818edc20..fa1270c8 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -121,12 +121,6 @@ public class PreferencesWindow
[Widget] Gtk.RadioButton radio_encoder_capture_show_all_bars;
[Widget] Gtk.RadioButton radio_encoder_capture_show_only_some_bars;
[Widget] Gtk.SpinButton spin_encoder_capture_barplot_font_size;
- [Widget] Gtk.RadioButton radio_encoder_auto_save_curve_best;
- [Widget] Gtk.RadioButton radio_encoder_auto_save_curve_best_n;
- [Widget] Gtk.SpinButton spin_encoder_auto_save_curve_best_n;
- [Widget] Gtk.RadioButton radio_encoder_auto_save_curve_4top;
- [Widget] Gtk.RadioButton radio_encoder_auto_save_curve_all;
- [Widget] Gtk.RadioButton radio_encoder_auto_save_curve_none;
[Widget] Gtk.CheckButton check_show_start_and_duration;
[Widget] Gtk.RadioButton radio_encoder_triggers_no;
[Widget] Gtk.RadioButton radio_encoder_triggers_yes;
@@ -551,23 +545,6 @@ public class PreferencesWindow
}
- PreferencesWindowBox.spin_encoder_auto_save_curve_best_n.Value =
preferences.encoderAutoSaveCurveBestNValue;
- PreferencesWindowBox.spin_encoder_auto_save_curve_best_n.Sensitive = false;
-
- if(preferences.encoderAutoSaveCurve == Constants.EncoderAutoSaveCurve.BEST)
- PreferencesWindowBox.radio_encoder_auto_save_curve_best.Active = true;
- else if(preferences.encoderAutoSaveCurve == Constants.EncoderAutoSaveCurve.BESTN)
- {
- PreferencesWindowBox.radio_encoder_auto_save_curve_best_n.Active = true;
- PreferencesWindowBox.spin_encoder_auto_save_curve_best_n.Sensitive = true;
- }
- else if(preferences.encoderAutoSaveCurve == Constants.EncoderAutoSaveCurve.FROM4TOPENULTIMATE)
- PreferencesWindowBox.radio_encoder_auto_save_curve_4top.Active = true;
- else if(preferences.encoderAutoSaveCurve == Constants.EncoderAutoSaveCurve.ALL)
- PreferencesWindowBox.radio_encoder_auto_save_curve_all.Active = true;
- else
- PreferencesWindowBox.radio_encoder_auto_save_curve_none.Active = true;
-
PreferencesWindowBox.spin_encoder_capture_barplot_font_size.Value =
preferences.encoderCaptureBarplotFontSize;
PreferencesWindowBox.check_show_start_and_duration.Active =
preferences.encoderShowStartAndDuration;
@@ -643,11 +620,6 @@ public class PreferencesWindow
spin_encoder_capture_show_only_some_bars.Sensitive = true;
}
- private void on_radio_encoder_auto_save_curve_best_n_toggled (object o, EventArgs args)
- {
- spin_encoder_auto_save_curve_best_n.Sensitive = radio_encoder_auto_save_curve_best_n.Active;
- }
-
private void on_check_encoder_capture_inactivity_end_time_clicked (object o, EventArgs args)
{
hbox_encoder_capture_inactivity_time.Sensitive =
check_encoder_capture_inactivity_end_time.Active;
@@ -1870,29 +1842,6 @@ public class PreferencesWindow
preferences.encoderCaptureShowNRepetitions = (int)
PreferencesWindowBox.spin_encoder_capture_show_only_some_bars.Value;
}
- if(PreferencesWindowBox.radio_encoder_auto_save_curve_best.Active) {
- SqlitePreferences.Update("encoderAutoSaveCurve",
Constants.EncoderAutoSaveCurve.BEST.ToString(), true);
- preferences.encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.BEST;
- }
- else if(PreferencesWindowBox.radio_encoder_auto_save_curve_best_n.Active) {
- SqlitePreferences.Update("encoderAutoSaveCurve",
Constants.EncoderAutoSaveCurve.BESTN.ToString(), true);
- preferences.encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.BESTN;
- SqlitePreferences.Update(SqlitePreferences.EncoderAutoSaveCurveBestNValue,
spin_encoder_auto_save_curve_best_n.Value.ToString(), true);
- preferences.encoderAutoSaveCurveBestNValue =
Convert.ToInt32(spin_encoder_auto_save_curve_best_n.Value);
- }
- else if(PreferencesWindowBox.radio_encoder_auto_save_curve_4top.Active) {
- SqlitePreferences.Update("encoderAutoSaveCurve",
Constants.EncoderAutoSaveCurve.FROM4TOPENULTIMATE.ToString(), true);
- preferences.encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.FROM4TOPENULTIMATE;
- }
- else if(PreferencesWindowBox.radio_encoder_auto_save_curve_all.Active) {
- SqlitePreferences.Update("encoderAutoSaveCurve",
Constants.EncoderAutoSaveCurve.ALL.ToString(), true);
- preferences.encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.ALL;
- }
- else {
- SqlitePreferences.Update("encoderAutoSaveCurve",
Constants.EncoderAutoSaveCurve.NONE.ToString(), true);
- preferences.encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.NONE;
- }
-
preferences.encoderCaptureBarplotFontSize = preferencesChange(
"encoderCaptureBarplotFontSize",
preferences.encoderCaptureBarplotFontSize,
diff --git a/src/preferences.cs b/src/preferences.cs
index 3d2990f6..f18d3b6b 100644
--- a/src/preferences.cs
+++ b/src/preferences.cs
@@ -67,8 +67,6 @@ public class Preferences
public int encoderCaptureInertialDiscardFirstN;
public bool encoderCaptureCheckFullyExtended;
public int encoderCaptureCheckFullyExtendedValue;
- public Constants.EncoderAutoSaveCurve encoderAutoSaveCurve;
- public int encoderAutoSaveCurveBestNValue;
public int encoderCaptureBarplotFontSize;
public bool encoderShowStartAndDuration;
public enum TriggerTypes { NO_TRIGGERS, START_AT_CAPTURE, START_AT_FIRST_ON};
@@ -113,6 +111,9 @@ public class Preferences
public Constants.MultimediaStorage multimediaStorage;
public string databaseVersion;
+ //encoder
+ public Constants.EncoderAutoSaveCurve encoderAutoSaveCurve;
+ public int encoderAutoSaveCurveBestNValue;
//encoder rhythm
public bool encoderRhythmActive;
public bool encoderRhythmRepsOrPhases;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]