[chronojump] preferences.encoderCaptureShowOnlyBars boolean -> EncoderCaptureDisplay
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] preferences.encoderCaptureShowOnlyBars boolean -> EncoderCaptureDisplay
- Date: Tue, 20 Jul 2021 14:42:39 +0000 (UTC)
commit bc860aab3174dc72bc45a520d571e157bf84397c
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Jul 20 16:40:30 2021 +0200
preferences.encoderCaptureShowOnlyBars boolean -> EncoderCaptureDisplay
src/gui/app1/chronojump.cs | 2 ++
src/gui/app1/encoder.cs | 21 +++++++++++++++++++++
src/preferences.cs | 2 +-
src/sqlite/preferences.cs | 7 +++++--
4 files changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index ee2ca5291..4e1aa053c 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -446,6 +446,8 @@ public partial class ChronoJumpWindow
private static List<News> newsAtDB_l; //to not read/write SQL on pingThread and at the same time
outside of thread
private static List<News> newsAtServer_l; //to not read/write SQL on pingThread and at the same time
outside of thread
+ private static bool followSignals = true;
+
//windows needed
ChronopicRegisterWindow chronopicRegisterWin;
PreferencesWindow preferencesWin;
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index 9d12ae4c8..42f8f02eb 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -533,6 +533,14 @@ public partial class ChronoJumpWindow
vbox_encoder_signal_comment.SetSizeRequest
(button_encoder_signal_save_comment.SizeRequest().Width, -1);
notebook_encoder_signal_comment_rhythm_and_triggers.SetSizeRequest
(button_encoder_signal_save_comment.SizeRequest().Width, -1);
+
+ followSignals = false;
+ check_encoder_capture_bars.Active = preferences.encoderCaptureShowOnlyBars.ShowBars;
+ check_encoder_capture_table.Active = preferences.encoderCaptureShowOnlyBars.ShowTable;
+ check_encoder_capture_signal.Active = preferences.encoderCaptureShowOnlyBars.ShowSignal;
+ followSignals = true;
+ //call here to have the gui updated and preferences.encoderCaptureShowOnlyBars correctly
assigned
+ on_check_encoder_capture_show_modes_clicked (new object (), new EventArgs ());
}
void on_button_encoder_select_clicked (object o, EventArgs args)
@@ -1339,6 +1347,9 @@ public partial class ChronoJumpWindow
private void on_check_encoder_capture_show_modes_clicked (object o, EventArgs args)
{
+ if(! followSignals)
+ return;
+
alignment_encoder_capture_curves_bars_drawingarea.Visible = check_encoder_capture_bars.Active;
alignment_treeview_encoder_capture_curves.Visible = check_encoder_capture_table.Active;
vpaned_encoder_capture_video_and_set_graph.Visible = check_encoder_capture_signal.Active;
@@ -1351,6 +1362,16 @@ public partial class ChronoJumpWindow
hbox_encoder_capture_show_need_one.Visible =
! (check_encoder_capture_bars.Active || check_encoder_capture_table.Active ||
check_encoder_capture_signal.Active);
+
+ /*
+ update the preferences variable
+ note as can be changed while capturing, it will be saved to SQL on exit
+ to not have problems with SQL while capturing
+ */
+ preferences.encoderCaptureShowOnlyBars = new EncoderCaptureDisplay(
+ check_encoder_capture_signal.Active,
+ check_encoder_capture_table.Active,
+ check_encoder_capture_bars.Active);
}
private void encoderUpdateTreeViewCapture(List<string> contents)
diff --git a/src/preferences.cs b/src/preferences.cs
index b48e984e0..bce999a8b 100644
--- a/src/preferences.cs
+++ b/src/preferences.cs
@@ -59,7 +59,7 @@ public class Preferences
public UnitsEnum units;
public bool encoderCaptureInfinite;
- public bool encoderCaptureShowOnlyBars;
+ public EncoderCaptureDisplay encoderCaptureShowOnlyBars;
public int encoderCaptureShowNRepetitions;
public bool showPower;
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index cf868b1b2..70c10b59c 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -185,7 +185,10 @@ class SqlitePreferences : Sqlite
Insert (RestTimeSeconds, "0", dbcmdTr);
Insert (UnitsStr, Preferences.UnitsEnum.METRIC.ToString(), dbcmdTr);
Insert (EncoderCaptureInfinite, "False", dbcmdTr);
- Insert ("encoderCaptureShowOnlyBars", "True", dbcmdTr);
+
+ EncoderCaptureDisplay ecd = new EncoderCaptureDisplay(false, false, true);
+ Insert ("encoderCaptureShowOnlyBars", ecd.GetInt.ToString(), dbcmdTr);
+
Insert ("encoderCaptureShowNRepetitions", "-1", dbcmdTr);
Insert ("digitsNumber", "3", dbcmdTr);
Insert ("showPower", "True", dbcmdTr);
@@ -529,7 +532,7 @@ class SqlitePreferences : Sqlite
else if(reader[0].ToString() == EncoderCaptureInfinite)
preferences.encoderCaptureInfinite = reader[1].ToString() == "True";
else if(reader[0].ToString() == "encoderCaptureShowOnlyBars")
- preferences.encoderCaptureShowOnlyBars = reader[1].ToString() == "True";
+ preferences.encoderCaptureShowOnlyBars = new
EncoderCaptureDisplay(Convert.ToInt32(reader[1].ToString()));
else if(reader[0].ToString() == "encoderCaptureShowNRepetitions")
preferences.encoderCaptureShowNRepetitions =
Convert.ToInt32(reader[1].ToString());
else if(reader[0].ToString() == "showPower")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]