[chronojump] EncoderCaptureOptions -> preferences (66%)
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] EncoderCaptureOptions -> preferences (66%)
- Date: Thu, 11 Aug 2016 15:14:47 +0000 (UTC)
commit fd862b65a9d8aa3e54defee312a500224b0b93ad
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Aug 11 17:09:38 2016 +0200
EncoderCaptureOptions -> preferences (66%)
glade/chronojump.glade | 98 ++++++++++++++++++++++++++-------------------
src/constants.cs | 23 +++++++++-
src/gui/encoder.cs | 11 -----
src/gui/preferences.cs | 10 ++++-
src/sqlite/main.cs | 53 ++++++++++++------------
src/sqlite/preferences.cs | 44 +++++++++++++++-----
6 files changed, 146 insertions(+), 93 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index e6f10c3..4305381 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -14548,37 +14548,6 @@ Concentric</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox189">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">4</property>
- <child>
- <widget class="GtkButton"
id="button_encoder_capture_options">
- <property name="width_request">30</property>
- <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">Options</property>
- <property name="use_underline">True</property>
- <signal name="clicked"
handler="on_button_encoder_capture_options_clicked" swapped="no"/>
- <child>
- <widget class="GtkImage" id="image19">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-preferences</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_encoder_bells">
<property name="width_request">30</property>
<property name="visible">True</property>
@@ -14598,13 +14567,6 @@ Concentric</property>
</child>
</widget>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- <packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
</packing>
@@ -18056,6 +18018,9 @@ Concentric</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -22862,6 +22827,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -24149,6 +24117,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -25928,6 +25899,9 @@ by you</property>
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkButton" id="button_video_url">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -26764,6 +26738,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -40014,6 +39991,24 @@ options</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -43125,6 +43120,18 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -44263,9 +44270,6 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<placeholder/>
</child>
<child>
- <placeholder/>
- </child>
- <child>
<widget class="GtkLabel" id="label218">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -45552,6 +45556,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -50392,6 +50399,9 @@ Other</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="left_attach">2</property>
@@ -51343,6 +51353,9 @@ Other</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -52309,6 +52322,9 @@ Other</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
diff --git a/src/constants.cs b/src/constants.cs
index 199929f..d26c625 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -820,12 +820,29 @@ public class Constants
public const string MaxForce = "Max force";
public const string MeanPower = "Mean power";
public const string PeakPower = "Peak power";
- public enum EncoderVariablesCapture {
- MeanSpeed, MaxSpeed, MeanForce, MaxForce, MeanPower, PeakPower
- }
public static string [] EncoderVariablesCaptureList = {
MeanSpeed, MaxSpeed, MeanForce, MaxForce, MeanPower, PeakPower
};
+ public enum EncoderVariablesCapture {
+ MeanSpeed, MaxSpeed, MeanForce, MaxForce, MeanPower, PeakPower
+ }
+ public static string GetEncoderVariablesCapture(EncoderVariablesCapture enumVariable) {
+ switch(enumVariable) {
+ case EncoderVariablesCapture.MeanSpeed:
+ return MeanSpeed;
+ case EncoderVariablesCapture.MaxSpeed:
+ return MaxSpeed;
+ case EncoderVariablesCapture.MeanForce:
+ return MeanForce;
+ case EncoderVariablesCapture.MaxForce:
+ return MaxForce;
+ case EncoderVariablesCapture.MeanPower:
+ return MeanPower;
+ case EncoderVariablesCapture.PeakPower:
+ return PeakPower;
+ }
+ return MeanPower;
+ }
public enum Encoder1RMMethod { NONWEIGHTED, WEIGHTED, WEIGHTED2, WEIGHTED3 }
public enum ContextMenu { NONE, EDITDELETE, DELETE }
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 4cd32ed..b6935d7 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -409,9 +409,6 @@ public partial class ChronoJumpWindow
encoderRProcCapture = new EncoderRProcCapture();
encoderRProcAnalyze = new EncoderRProcAnalyze();
-// encoderCaptureOptionsWin = EncoderCaptureOptionsWindow.Create(repetitiveConditionsWin);
-// encoderCaptureOptionsWin.FakeButtonClose.Clicked += new
EventHandler(on_encoder_capture_options_closed);
-
captureCurvesBarsData = new ArrayList(0);
try {
@@ -545,15 +542,7 @@ public partial class ChronoJumpWindow
{
on_button_encoder_capture_calcule_im();
}
-
- void on_button_encoder_capture_options_clicked (object o, EventArgs args) {
- encoderCaptureOptionsWin.View(repetitiveConditionsWin, preferences.volumeOn,
currentEncoderGI);
- }
- private void on_encoder_capture_options_closed(object o, EventArgs args) {
- LogB.Information("Encoder capture options closed");
- //update the bars graph because main variable maybe has changed
- }
private void on_button_encoder_bells_clicked(object o, EventArgs args) {
repetitiveConditionsWin.View(Constants.BellModes.ENCODER, preferences.volumeOn);
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index c22a190..27ff203 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -297,12 +297,16 @@ public class PreferencesWindow {
//encoder capture -->
PreferencesWindowBox.spin_encoder_capture_time.Value = preferences.encoderCaptureTime;
PreferencesWindowBox.spin_encoder_capture_inactivity_end_time.Value =
preferences.encoderCaptureInactivityEndTime;
-
PreferencesWindowBox.createComboEncoderCaptureMainVariable(preferences.encoderCaptureMainVariable);
+
+ PreferencesWindowBox.createComboEncoderCaptureMainVariable(
+ Constants.GetEncoderVariablesCapture(preferences.encoderCaptureMainVariable));
+
PreferencesWindowBox.spin_encoder_capture_min_height_gravitatory.Value =
preferences.encoderCaptureMinHeightGravitatory;
PreferencesWindowBox.spin_encoder_capture_min_height_inertial.Value =
preferences.encoderCaptureMinHeightInertial;
PreferencesWindowBox.checkbutton_encoder_capture_fully_extended.Active =
preferences.encoderCaptureCheckFullyExtended;
PreferencesWindowBox.spin_encoder_capture_fully_extended.Value =
preferences.encoderCaptureCheckFullyExtendedValue;
PreferencesWindowBox.hbox_encoder_capture_fully_extended.Visible =
preferences.encoderCaptureCheckFullyExtended;
+
if(preferences.encoderAutoSaveCurve == Constants.EncoderAutoSaveCurve.BEST)
PreferencesWindowBox.radio_encoder_auto_save_curve_best.Active = true;
else if(preferences.encoderAutoSaveCurve == Constants.EncoderAutoSaveCurve.FROM4TOPENULTIMATE)
@@ -311,6 +315,8 @@ public class PreferencesWindow {
PreferencesWindowBox.radio_encoder_auto_save_curve_all.Active = true;
else
PreferencesWindowBox.radio_encoder_auto_save_curve_none.Active = true;
+
+ PreferencesWindowBox.check_show_start_and_duration.Active =
preferences.encoderShowStartAndDuration;
//encoder other -->
@@ -354,7 +360,7 @@ public class PreferencesWindow {
return PreferencesWindowBox;
}
- private void createComboEncoderCaptureMainVariable(Constants.EncoderVariablesCapture v) {
+ private void createComboEncoderCaptureMainVariable(string v) {
combo_main_variable = ComboBox.NewText ();
string [] values = Constants.EncoderVariablesCaptureList;
UtilGtk.ComboUpdate(combo_main_variable, values, "");
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 45c5dbc..762b549 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -78,7 +78,7 @@ class Sqlite
/*
* Important, change this if there's any update to database
*/
- static string lastChronojumpDatabaseVersion = "1.31";
+ static string lastChronojumpDatabaseVersion = "1.32";
public Sqlite() {
}
@@ -1822,7 +1822,6 @@ class Sqlite
// ----------------------------------------------
LogB.SQL("Leaving Sqlite opened before DB updates");
bool sqliteOpened = true;
- string newVersion = "";
Sqlite.Open(); //------------------------------------------------
@@ -1836,51 +1835,39 @@ class Sqlite
SqlitePreferences.Insert ("runIDoubleContactsMode",
Constants.DoubleContact.AVERAGE.ToString());
SqlitePreferences.Insert ("runIDoubleContactsMS", "1000");
- newVersion = "1.24";
- SqlitePreferences.Update ("databaseVersion", newVersion, true);
- currentVersion = newVersion;
+ currentVersion = updateVersion("1.24");
}
if(currentVersion == "1.24") {
LogB.SQL("Language defaults to (empty string), means detected");
SqlitePreferences.Update("language", "", true);
- newVersion = "1.25";
- SqlitePreferences.Update ("databaseVersion", newVersion, true);
- currentVersion = newVersion;
+ currentVersion = updateVersion("1.25");
}
if(currentVersion == "1.25") {
LogB.SQL("Changed Inclinated to Inclined");
Update(true, Constants.EncoderExerciseTable, "name", "Inclinated plane",
"Inclined plane", "", "");
Update(true, Constants.EncoderExerciseTable, "name", "Inclinated plane BW",
"Inclined plane BW", "", "");
- newVersion = "1.26";
- SqlitePreferences.Update ("databaseVersion", newVersion, true);
- currentVersion = newVersion;
+ currentVersion = updateVersion("1.26");
}
if(currentVersion == "1.26") {
LogB.SQL("Changing runDoubleContactsMS and runIDoubleContactsMS from 1000ms
to 300ms");
SqlitePreferences.Update("runDoubleContactsMS", "300", true);
SqlitePreferences.Update("runIDoubleContactsMS", "300", true);
- newVersion = "1.27";
- SqlitePreferences.Update ("databaseVersion", newVersion, true);
- currentVersion = newVersion;
+ currentVersion = updateVersion("1.27");
}
if(currentVersion == "1.27") {
LogB.SQL("Changed encoderAutoSaveCurve BESTMEANPOWER to BEST");
Update(true, Constants.PreferencesTable, "value", "BESTMEANPOWER", "BEST",
"name", "encoderAutoSaveCurve");
- newVersion = "1.28";
- SqlitePreferences.Update ("databaseVersion", newVersion, true);
- currentVersion = newVersion;
+ currentVersion = updateVersion("1.28");
}
if(currentVersion == "1.28") {
LogB.SQL("Changed reaction time rows have reactionTime as default value");
Update(true, Constants.ReactionTimeTable, "type", "", "reactionTime", "", "");
- newVersion = "1.29";
- SqlitePreferences.Update ("databaseVersion", newVersion, true);
- currentVersion = newVersion;
+ currentVersion = updateVersion("1.29");
}
if(currentVersion == "1.29") {
LogB.SQL("Added SIMULATED session");
@@ -1888,9 +1875,7 @@ class Sqlite
//add SIMULATED session if doesn't exists. Unique session where tests can be
simulated.
SqliteSession.insertSimulatedSession();
- newVersion = "1.30";
- SqlitePreferences.Update ("databaseVersion", newVersion, true);
- currentVersion = newVersion;
+ currentVersion = updateVersion("1.30");
}
if(currentVersion == "1.30") {
LogB.SQL("Insert encoderCaptureCheckFullyExtended and ...Value at
preferences");
@@ -1898,9 +1883,19 @@ class Sqlite
SqlitePreferences.Insert ("encoderCaptureCheckFullyExtended", "True");
SqlitePreferences.Insert ("encoderCaptureCheckFullyExtendedValue", "4");
- newVersion = "1.31";
- SqlitePreferences.Update ("databaseVersion", newVersion, true);
- currentVersion = newVersion;
+ currentVersion = updateVersion("1.31");
+ }
+ if(currentVersion == "1.31") {
+ LogB.SQL("encoderCaptureOptionsWin -> preferences");
+
+ SqlitePreferences.Insert ("encoderCaptureTime", "60");
+ SqlitePreferences.Insert ("encoderCaptureInactivityEndTime", "3");
+ SqlitePreferences.Insert ("encoderCaptureMainVariable",
Constants.EncoderVariablesCapture.MeanPower.ToString());
+ SqlitePreferences.Insert ("encoderCaptureMinHeightGravitatory", "20");
+ SqlitePreferences.Insert ("encoderCaptureMinHeightInertial", "5");
+ SqlitePreferences.Insert ("encoderShowStartAndDuration", "False");
+
+ currentVersion = updateVersion("1.32");
}
@@ -1922,6 +1917,11 @@ class Sqlite
return returnSoftwareIsNew;
}
+
+ private static string updateVersion(string newVersion) {
+ SqlitePreferences.Update ("databaseVersion", newVersion, true);
+ return newVersion;
+ }
public static bool ChangeDjToDJna() {
string v = SqlitePreferences.Select("databaseVersion");
@@ -2062,6 +2062,7 @@ class Sqlite
SqliteExecuteAuto.addChronojumpProfileAndBilateral();
//changes [from - to - desc]
+ //1.31 - 1.32 Converted DB to 1.32 encoderCaptureOptionsWin -> preferences
//1.30 - 1.31 Converted DB to 1.31 Insert encoderCaptureCheckFullyExtended and ...Value at
preferences
//1.29 - 1.30 Converted DB to 1.30 Added SIMULATED session
//1.28 - 1.29 Converted DB to 1.29 Changed reaction time rows have reactionTime as default
value
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index 80c51b4..b909b64 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -83,13 +83,21 @@ class SqlitePreferences : Sqlite
Insert ("multimediaStorage",
Constants.MultimediaStorage.BYSESSION.ToString(), dbcmdTr);
- Insert ("encoderPropulsive", "True", dbcmdTr);
+ //encoder
+ Insert ("encoderCaptureTime", "60", dbcmdTr);
+ Insert ("encoderCaptureInactivityEndTime", "3", dbcmdTr);
+ Insert ("encoderCaptureMainVariable",
Constants.EncoderVariablesCapture.MeanPower.ToString(), dbcmdTr);
+ Insert ("encoderCaptureMinHeightGravitatory", "20", dbcmdTr);
+ Insert ("encoderCaptureMinHeightInertial", "5", dbcmdTr);
Insert ("encoderCaptureCheckFullyExtended", "True", dbcmdTr);
Insert ("encoderCaptureCheckFullyExtendedValue", "4", dbcmdTr);
+ Insert ("encoderShowStartAndDuration", "False", dbcmdTr);
+ Insert ("encoderPropulsive", "True", dbcmdTr);
Insert ("encoderSmoothEccCon", "0.6", dbcmdTr);
Insert ("encoderSmoothCon", "0.7", dbcmdTr);
- Insert ("videoDevice", "0", dbcmdTr); //first
Insert ("encoder1RMMethod", Constants.Encoder1RMMethod.WEIGHTED2.ToString(),
dbcmdTr);
+
+ Insert ("videoDevice", "0", dbcmdTr); //first
Insert ("inertialmomentum", "0.01", dbcmdTr);
Insert ("CSVExportDecimalSeparator", Util.GetDecimalSeparatorFromLocale(),
dbcmdTr);
Insert ("RGraphsTranslate", "True", dbcmdTr);
@@ -209,15 +217,37 @@ class SqlitePreferences : Sqlite
preferences.heightPreferred = reader[1].ToString() == "True";
else if(reader[0].ToString() == "metersSecondsPreferred")
preferences.metersSecondsPreferred = reader[1].ToString() == "True";
- else if(reader[0].ToString() == "encoderPropulsive")
- preferences.encoderPropulsive = reader[1].ToString() == "True";
+ //encoder capture
+ else if(reader[0].ToString() == "encoderCaptureTime")
+ preferences.encoderCaptureTime = Convert.ToInt32(reader[1].ToString());
+ else if(reader[0].ToString() == "encoderCaptureInactivityEndTime")
+ preferences.encoderCaptureInactivityEndTime =
Convert.ToInt32(reader[1].ToString());
+ else if(reader[0].ToString() == "encoderCaptureMainVariable")
+ preferences.encoderCaptureMainVariable = (Constants.EncoderVariablesCapture)
+ Enum.Parse(typeof(Constants.EncoderVariablesCapture),
reader[1].ToString());
+ else if(reader[0].ToString() == "encoderCaptureMinHeightGravitatory")
+ preferences.encoderCaptureMinHeightGravitatory =
Convert.ToInt32(reader[1].ToString());
+ else if(reader[0].ToString() == "encoderCaptureMinHeightInertial")
+ preferences.encoderCaptureMinHeightInertial =
Convert.ToInt32(reader[1].ToString());
else if(reader[0].ToString() == "encoderCaptureCheckFullyExtended")
preferences.encoderCaptureCheckFullyExtended = reader[1].ToString() == "True";
else if(reader[0].ToString() == "encoderCaptureCheckFullyExtendedValue")
preferences.encoderCaptureCheckFullyExtendedValue =
Convert.ToInt32(reader[1].ToString());
+ else if(reader[0].ToString() == "encoderAutoSaveCurve")
+ preferences.encoderAutoSaveCurve = (Constants.EncoderAutoSaveCurve)
+ Enum.Parse(typeof(Constants.EncoderAutoSaveCurve),
reader[1].ToString());
+ else if(reader[0].ToString() == "encoderShowStartAndDuration")
+ preferences.encoderShowStartAndDuration = reader[1].ToString() == "True";
+ //encoder other
+ else if(reader[0].ToString() == "encoderPropulsive")
+ preferences.encoderPropulsive = reader[1].ToString() == "True";
else if(reader[0].ToString() == "encoderSmoothCon")
preferences.encoderSmoothCon = Convert.ToDouble(
Util.ChangeDecimalSeparator(reader[1].ToString()));
+ else if(reader[0].ToString() == "encoder1RMMethod")
+ preferences.encoder1RMMethod = (Constants.Encoder1RMMethod)
+ Enum.Parse(typeof(Constants.Encoder1RMMethod), reader[1].ToString());
+ //video... other
else if(reader[0].ToString() == "videoDevice")
preferences.videoDeviceNum = Convert.ToInt32(reader[1].ToString());
else if(reader[0].ToString() == "CSVExportDecimalSeparator")
@@ -228,12 +258,6 @@ class SqlitePreferences : Sqlite
preferences.RGraphsTranslate = reader[1].ToString() == "True";
else if(reader[0].ToString() == "useHeightsOnJumpIndexes")
preferences.useHeightsOnJumpIndexes = reader[1].ToString() == "True";
- else if(reader[0].ToString() == "encoderAutoSaveCurve")
- preferences.encoderAutoSaveCurve = (Constants.EncoderAutoSaveCurve)
- Enum.Parse(typeof(Constants.EncoderAutoSaveCurve),
reader[1].ToString());
- else if(reader[0].ToString() == "encoder1RMMethod")
- preferences.encoder1RMMethod = (Constants.Encoder1RMMethod)
- Enum.Parse(typeof(Constants.Encoder1RMMethod), reader[1].ToString());
//these are NOT sent to preferences window
else if(reader[0].ToString() == "allowFinishRjAfterTime")
preferences.allowFinishRjAfterTime = reader[1].ToString() == "True";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]