Commit e2e66949 authored by Xavier de Blas's avatar Xavier de Blas

DB 1.24 runs options on SQL and preferences win

parent 009970a5
This diff is collapsed.
......@@ -825,7 +825,7 @@ public class Constants
public enum EncoderAutoSaveCurve { ALL, NONE, BESTMEANPOWER }
public enum DoubleContact {
FIRST, AVERAGE, LAST
NONE, FIRST, AVERAGE, LAST
}
//DISPLACED means: total
......
......@@ -43,9 +43,8 @@ public class RunExecute : EventExecute
}
protected static runPhases runPhase;
protected bool checkDoubleContact;
protected int checkDoubleContactTime;
protected Constants.DoubleContact checkDoubleContactMode;
protected int checkDoubleContactTime;
protected bool speedStartArrival;
......@@ -57,8 +56,7 @@ public class RunExecute : EventExecute
Chronopic cp, Gtk.Label event_execute_label_message, Gtk.Window app,
int pDN, bool metersSecondsPreferred, bool volumeOn,
double progressbarLimit, ExecutingGraphData egd,
bool checkDoubleContact, int checkDoubleContactTime,
Constants.DoubleContact checkDoubleContactMode,
Constants.DoubleContact checkDoubleContactMode, int checkDoubleContactTime,
bool speedStartArrival
)
{
......@@ -76,9 +74,8 @@ public class RunExecute : EventExecute
this.volumeOn = volumeOn;
this.progressbarLimit = progressbarLimit;
this.egd = egd;
this.checkDoubleContact = checkDoubleContact;
this.checkDoubleContactTime = checkDoubleContactTime;
this.checkDoubleContactMode = checkDoubleContactMode;
this.checkDoubleContactTime = checkDoubleContactTime;
this.speedStartArrival = speedStartArrival;
fakeButtonUpdateGraph = new Gtk.Button();
......@@ -231,7 +228,7 @@ public class RunExecute : EventExecute
timestamp = simulatedTimeLast * 1000; //conversion to milliseconds
//prevent double contact stuff
if(checkDoubleContact) {
if(checkDoubleContactMode != Constants.DoubleContact.NONE) {
if(timestamp <= checkDoubleContactTime) {
/*
when checking double contact
......@@ -268,7 +265,7 @@ public class RunExecute : EventExecute
}
}
if(! checkDoubleContact)
if(checkDoubleContactMode == Constants.DoubleContact.NONE)
success = true;
if(success) {
......@@ -300,7 +297,7 @@ public class RunExecute : EventExecute
//change the automata state
loggedState = States.OFF;
if(checkDoubleContact && timestampDCn > 0)
if(checkDoubleContactMode != Constants.DoubleContact.NONE && timestampDCn > 0)
timestampDCContactTimes += timestamp;
else {
if(runPhase == runPhases.PLATFORM_INI_YES_TIME)
......@@ -473,8 +470,7 @@ public class RunIntervalExecute : RunExecute
Chronopic cp, Gtk.Label event_execute_label_message, Gtk.Window app, int pDN, bool metersSecondsPreferred,
bool volumeOn, RepetitiveConditionsWindow repetitiveConditionsWin,
double progressbarLimit, ExecutingGraphData egd ,
bool checkDoubleContact, int checkDoubleContactTime,
Constants.DoubleContact checkDoubleContactMode,
Constants.DoubleContact checkDoubleContactMode, int checkDoubleContactTime,
bool speedStartArrival
)
{
......@@ -511,9 +507,8 @@ public class RunIntervalExecute : RunExecute
this.repetitiveConditionsWin = repetitiveConditionsWin;
this.progressbarLimit = progressbarLimit;
this.egd = egd;
this.checkDoubleContact = checkDoubleContact;
this.checkDoubleContactTime = checkDoubleContactTime;
this.checkDoubleContactMode = checkDoubleContactMode;
this.checkDoubleContactTime = checkDoubleContactTime;
this.speedStartArrival = speedStartArrival;
fakeButtonUpdateGraph = new Gtk.Button();
......@@ -594,7 +589,7 @@ public class RunIntervalExecute : RunExecute
if(simulated)
timestamp = simulatedTimeLast * 1000; //conversion to milliseconds
if(checkDoubleContact) {
if(checkDoubleContactMode != Constants.DoubleContact.NONE) {
if(timestamp <= checkDoubleContactTime) {
/*
when checking double contact
......@@ -715,7 +710,7 @@ public class RunIntervalExecute : RunExecute
feedbackMessage = "";
needShowFeedbackMessage = true;
} else {
if(checkDoubleContact && timestampDCn > 0)
if(checkDoubleContactMode != Constants.DoubleContact.NONE && timestampDCn > 0)
timestampDCContactTimes += timestamp;
else
lastTc = timestamp/1000.0;
......
......@@ -572,14 +572,6 @@ public partial class ChronoJumpWindow
on_extra_window_jumps_test_changed(new object(), new EventArgs());
//changeTestImage("", "", "LOGO");
//don't know why Glade is not doing this
spinbutton_runs_prevent_double_contact.Value=1000;
spinbutton_runs_i_prevent_double_contact.Value=1000;
radio_runs_prevent_double_contact_last.Active = true;
radio_runs_i_prevent_double_contact_average.Active = true;
//We have no session, mark some widgets as ".Sensitive = false"
sensitiveGuiNoSession();
definedSession = false;
......@@ -873,22 +865,6 @@ public partial class ChronoJumpWindow
changeVideoButtons(preferences.videoOn);
//load preferences, update radios, but not update database
update_sqlite_at_runs_speed_radios = false;
if (preferences.runSpeedStartArrival)
radio_runs_speed_start_arrival.Active = true;
else
radio_runs_speed_start_leaving.Active = true;
if (preferences.runISpeedStartArrival)
radio_runs_i_speed_start_arrival.Active = true;
else
radio_runs_i_speed_start_leaving.Active = true;
update_sqlite_at_runs_speed_radios = true;
//change language works on windows. On Linux let's change the locale
//if(UtilAll.IsWindows())
// languageChange();
......@@ -4139,24 +4115,6 @@ public partial class ChronoJumpWindow
* --------------------------------------------------------
*/
private Constants.DoubleContact getDoubleContactModes(bool runSimple) {
if(runSimple) {
if(radio_runs_prevent_double_contact_first.Active)
return Constants.DoubleContact.FIRST;
else if(radio_runs_prevent_double_contact_average.Active)
return Constants.DoubleContact.AVERAGE;
else
return Constants.DoubleContact.LAST;
} else { //runInterval
if(radio_runs_i_prevent_double_contact_first.Active)
return Constants.DoubleContact.FIRST;
else if(radio_runs_i_prevent_double_contact_average.Active)
return Constants.DoubleContact.AVERAGE;
else
return Constants.DoubleContact.LAST;
}
}
//suitable for all runs not repetitive
private void on_normal_run_activate (object o, EventArgs args)
{
......@@ -4209,10 +4167,9 @@ public partial class ChronoJumpWindow
chronopicWin.CP, event_execute_label_message, app1,
preferences.digitsNumber, preferences.metersSecondsPreferred, preferences.volumeOn,
progressbarLimit, egd,
checkbutton_runs_prevent_double_contact.Active,
(int) spinbutton_runs_prevent_double_contact.Value,
getDoubleContactModes(true), //true: runSimple
radio_runs_speed_start_arrival.Active
preferences.runDoubleContactsMode,
preferences.runDoubleContactsMS,
preferences.runSpeedStartArrival
);
if (!chronopicWin.Connected)
......@@ -4333,10 +4290,9 @@ public partial class ChronoJumpWindow
chronopicWin.CP, event_execute_label_message, app1,
preferences.digitsNumber, preferences.metersSecondsPreferred, preferences.volumeOn, repetitiveConditionsWin,
progressbarLimit, egd,
checkbutton_runs_i_prevent_double_contact.Active,
(int) spinbutton_runs_i_prevent_double_contact.Value,
getDoubleContactModes(false), //false: not runSimple
radio_runs_i_speed_start_arrival.Active
preferences.runIDoubleContactsMode,
preferences.runIDoubleContactsMS,
preferences.runSpeedStartArrival
);
......
......@@ -34,6 +34,8 @@ public class PreferencesWindow {
[Widget] Gtk.Window preferences_win;
//database tab
[Widget] Gtk.Label label_database;
[Widget] Gtk.Label label_database_temp;
......@@ -50,55 +52,72 @@ public class PreferencesWindow {
[Widget] Gtk.Box hbox_backup_doing;
[Widget] Gtk.ProgressBar pulsebar;
[Widget] Gtk.ComboBox combo_decimals;
//jumps tab
[Widget] Gtk.CheckButton checkbutton_power;
[Widget] Gtk.CheckButton checkbutton_stiffness;
[Widget] Gtk.CheckButton checkbutton_initial_speed;
[Widget] Gtk.CheckButton checkbutton_angle;
[Widget] Gtk.CheckButton checkbutton_show_tv_tc_index;
[Widget] Gtk.Box hbox_indexes;
[Widget] Gtk.RadioButton radiobutton_show_q_index;
[Widget] Gtk.RadioButton radiobutton_show_dj_index;
[Widget] Gtk.CheckButton checkbutton_ask_deletion;
[Widget] Gtk.RadioButton radio_elevation_height;
[Widget] Gtk.RadioButton radio_elevation_tf;
[Widget] Gtk.RadioButton radio_speed_ms;
[Widget] Gtk.RadioButton radio_speed_km;
[Widget] Gtk.RadioButton radio_weight_percent;
[Widget] Gtk.RadioButton radio_weight_kg;
[Widget] Gtk.RadioButton radio_use_heights_on_jump_indexes;
[Widget] Gtk.RadioButton radio_do_not_use_heights_on_jump_indexes;
//runs tab
[Widget] Gtk.RadioButton radio_speed_ms;
[Widget] Gtk.RadioButton radio_speed_km;
[Widget] Gtk.RadioButton radio_runs_speed_start_arrival;
[Widget] Gtk.RadioButton radio_runs_speed_start_leaving;
[Widget] Gtk.Box vbox_runs_prevent_double_contact;
[Widget] Gtk.CheckButton checkbutton_runs_prevent_double_contact;
[Widget] Gtk.SpinButton spinbutton_runs_prevent_double_contact;
[Widget] Gtk.RadioButton radio_runs_prevent_double_contact_first;
[Widget] Gtk.RadioButton radio_runs_prevent_double_contact_average;
[Widget] Gtk.RadioButton radio_runs_prevent_double_contact_last;
[Widget] Gtk.Box vbox_runs_i_prevent_double_contact;
[Widget] Gtk.CheckButton checkbutton_runs_i_prevent_double_contact;
[Widget] Gtk.SpinButton spinbutton_runs_i_prevent_double_contact;
[Widget] Gtk.RadioButton radio_runs_i_prevent_double_contact_first;
[Widget] Gtk.RadioButton radio_runs_i_prevent_double_contact_average;
[Widget] Gtk.RadioButton radio_runs_i_prevent_double_contact_last;
//encoder tab
[Widget] Gtk.CheckButton checkbutton_encoder_propulsive;
[Widget] Gtk.SpinButton spin_encoder_smooth_con;
[Widget] Gtk.Label label_encoder_con;
[Widget] Gtk.RadioButton radio_encoder_1RM_nonweighted;
[Widget] Gtk.RadioButton radio_encoder_1RM_weighted;
[Widget] Gtk.RadioButton radio_encoder_1RM_weighted2;
[Widget] Gtk.RadioButton radio_encoder_1RM_weighted3;
[Widget] Gtk.RadioButton radio_encoder_auto_save_curve_bestmeanpower;
[Widget] Gtk.RadioButton radio_encoder_auto_save_curve_all;
[Widget] Gtk.RadioButton radio_encoder_auto_save_curve_none;
//camera tab
[Widget] Gtk.Box hbox_combo_camera;
[Widget] Gtk.ComboBox combo_camera;
//other tab
[Widget] Gtk.ComboBox combo_decimals;
[Widget] Gtk.CheckButton checkbutton_ask_deletion;
[Widget] Gtk.RadioButton radio_export_latin;
[Widget] Gtk.RadioButton radio_export_non_latin;
[Widget] Gtk.RadioButton radio_graphs_translate;
[Widget] Gtk.RadioButton radio_graphs_no_translate;
[Widget] Gtk.RadioButton radio_use_heights_on_jump_indexes;
[Widget] Gtk.RadioButton radio_do_not_use_heights_on_jump_indexes;
[Widget] Gtk.RadioButton radio_encoder_auto_save_curve_bestmeanpower;
[Widget] Gtk.RadioButton radio_encoder_auto_save_curve_all;
[Widget] Gtk.RadioButton radio_encoder_auto_save_curve_none;
// [Widget] Gtk.Box hbox_language_row;
// [Widget] Gtk.Box hbox_combo_language;
// [Widget] Gtk.ComboBox combo_language;
[Widget] Gtk.Box hbox_combo_camera;
[Widget] Gtk.ComboBox combo_camera;
[Widget] Gtk.Button button_accept;
[Widget] Gtk.Button button_cancel;
......@@ -209,6 +228,42 @@ public class PreferencesWindow {
PreferencesWindowBox.radio_speed_km.Active = true;
if(preferences.runSpeedStartArrival)
PreferencesWindowBox.radio_runs_speed_start_arrival.Active = true;
else
PreferencesWindowBox.radio_runs_speed_start_leaving.Active = true;
//start of double contacts stuff ----
PreferencesWindowBox.checkbutton_runs_prevent_double_contact.Active =
(preferences.runDoubleContactsMode != Constants.DoubleContact.NONE);
PreferencesWindowBox.checkbutton_runs_i_prevent_double_contact.Active =
(preferences.runIDoubleContactsMode != Constants.DoubleContact.NONE);
PreferencesWindowBox.spinbutton_runs_prevent_double_contact.Value =
preferences.runDoubleContactsMS;
PreferencesWindowBox.spinbutton_runs_i_prevent_double_contact.Value =
preferences.runIDoubleContactsMS;
if(preferences.runDoubleContactsMode != Constants.DoubleContact.NONE) {
if(preferences.runDoubleContactsMode == Constants.DoubleContact.FIRST)
PreferencesWindowBox.radio_runs_prevent_double_contact_first.Active = true;
else if(preferences.runDoubleContactsMode == Constants.DoubleContact.AVERAGE)
PreferencesWindowBox.radio_runs_prevent_double_contact_average.Active = true;
else // Constants.DoubleContact.LAST DEFAULT
PreferencesWindowBox.radio_runs_prevent_double_contact_last.Active = true;
}
if(preferences.runIDoubleContactsMode != Constants.DoubleContact.NONE) {
if(preferences.runIDoubleContactsMode == Constants.DoubleContact.FIRST)
PreferencesWindowBox.radio_runs_i_prevent_double_contact_first.Active = true;
else if(preferences.runIDoubleContactsMode == Constants.DoubleContact.LAST)
PreferencesWindowBox.radio_runs_i_prevent_double_contact_last.Active = true;
else //Constants.DoubleContact.AVERAGE DEFAULT
PreferencesWindowBox.radio_runs_i_prevent_double_contact_average.Active = true;
}
//---- end of double contacts stuff
if(preferences.CSVExportDecimalSeparator == "COMMA")
PreferencesWindowBox.radio_export_latin.Active = true;
else
......@@ -306,6 +361,14 @@ public class PreferencesWindow {
else
hbox_indexes.Hide();
}
private void on_checkbutton_runs_prevent_double_contact_toggled (object o, EventArgs args) {
vbox_runs_prevent_double_contact.Visible = checkbutton_runs_prevent_double_contact.Active;
}
private void on_checkbutton_runs_i_prevent_double_contact_toggled (object o, EventArgs args) {
vbox_runs_i_prevent_double_contact.Visible = checkbutton_runs_i_prevent_double_contact.Active;
}
void on_button_cancel_clicked (object o, EventArgs args)
{
......@@ -594,7 +657,85 @@ public class PreferencesWindow {
SqlitePreferences.Update("metersSecondsPreferred", PreferencesWindowBox.radio_speed_ms.Active.ToString(), true);
preferences.metersSecondsPreferred = PreferencesWindowBox.radio_speed_ms.Active;
}
if( preferences.runSpeedStartArrival != PreferencesWindowBox.radio_runs_speed_start_arrival.Active ) {
SqlitePreferences.Update("runSpeedStartArrival", PreferencesWindowBox.radio_runs_speed_start_arrival.Active.ToString(), true);
preferences.runSpeedStartArrival = PreferencesWindowBox.radio_runs_speed_start_arrival.Active;
}
//start of double contacts stuff ----
//1 simple runs ----
//1.1 was FIRST or AVERAGE or LAST and now will be NONE
if( (preferences.runDoubleContactsMode != Constants.DoubleContact.NONE) &&
! PreferencesWindowBox.checkbutton_runs_prevent_double_contact.Active)
{
SqlitePreferences.Update("runDoubleContactsMode", Constants.DoubleContact.NONE.ToString(), true);
preferences.runDoubleContactsMode = Constants.DoubleContact.NONE;
}
else if(PreferencesWindowBox.checkbutton_runs_prevent_double_contact.Active)
{
//1.2 mode has changed between FIRST, AVERAGE or LAST
if( PreferencesWindowBox.radio_runs_prevent_double_contact_first.Active &&
(preferences.runDoubleContactsMode != Constants.DoubleContact.FIRST) ) {
SqlitePreferences.Update("runDoubleContactsMode", Constants.DoubleContact.FIRST.ToString(), true);
preferences.runDoubleContactsMode = Constants.DoubleContact.FIRST;
}
else if( PreferencesWindowBox.radio_runs_prevent_double_contact_average.Active &&
(preferences.runDoubleContactsMode != Constants.DoubleContact.AVERAGE) ) {
SqlitePreferences.Update("runDoubleContactsMode", Constants.DoubleContact.AVERAGE.ToString(), true);
preferences.runDoubleContactsMode = Constants.DoubleContact.AVERAGE;
}
else if( PreferencesWindowBox.radio_runs_prevent_double_contact_last.Active &&
(preferences.runDoubleContactsMode != Constants.DoubleContact.LAST) ) {
SqlitePreferences.Update("runDoubleContactsMode", Constants.DoubleContact.LAST.ToString(), true);
preferences.runDoubleContactsMode = Constants.DoubleContact.LAST;
}
if(preferences.runDoubleContactsMS != (int) PreferencesWindowBox.spinbutton_runs_prevent_double_contact.Value) {
SqlitePreferences.Update("runDoubleContactsMS",
PreferencesWindowBox.spinbutton_runs_prevent_double_contact.Value.ToString(), true); //saved as string
preferences.runDoubleContactsMS = (int) spinbutton_runs_prevent_double_contact.Value;
}
}
//2 intervallic runs ----
//2.1 was FIRST or AVERAGE or LAST and now will be NONE
if( (preferences.runIDoubleContactsMode != Constants.DoubleContact.NONE) &&
! PreferencesWindowBox.checkbutton_runs_i_prevent_double_contact.Active)
{
SqlitePreferences.Update("runIDoubleContactsMode", Constants.DoubleContact.NONE.ToString(), true);
preferences.runIDoubleContactsMode = Constants.DoubleContact.NONE;
}
else if(PreferencesWindowBox.checkbutton_runs_i_prevent_double_contact.Active)
{
//2.2 mode has changed between FIRST, AVERAGE or LAST
if( PreferencesWindowBox.radio_runs_i_prevent_double_contact_first.Active &&
(preferences.runIDoubleContactsMode != Constants.DoubleContact.FIRST) ) {
SqlitePreferences.Update("runIDoubleContactsMode", Constants.DoubleContact.FIRST.ToString(), true);
preferences.runIDoubleContactsMode = Constants.DoubleContact.FIRST;
}
else if( PreferencesWindowBox.radio_runs_i_prevent_double_contact_average.Active &&
(preferences.runIDoubleContactsMode != Constants.DoubleContact.AVERAGE) ) {
SqlitePreferences.Update("runIDoubleContactsMode", Constants.DoubleContact.AVERAGE.ToString(), true);
preferences.runIDoubleContactsMode = Constants.DoubleContact.AVERAGE;
}
else if( PreferencesWindowBox.radio_runs_i_prevent_double_contact_last.Active &&
(preferences.runIDoubleContactsMode != Constants.DoubleContact.LAST) ) {
SqlitePreferences.Update("runIDoubleContactsMode", Constants.DoubleContact.LAST.ToString(), true);
preferences.runIDoubleContactsMode = Constants.DoubleContact.LAST;
}
if(preferences.runIDoubleContactsMS != (int) PreferencesWindowBox.spinbutton_runs_i_prevent_double_contact.Value) {
SqlitePreferences.Update("runIDoubleContactsMS",
PreferencesWindowBox.spinbutton_runs_i_prevent_double_contact.Value.ToString(), true); //saved as string
preferences.runIDoubleContactsMS = (int) spinbutton_runs_i_prevent_double_contact.Value;
}
}
//---- end of double contacts stuff
if( preferences.encoderPropulsive != PreferencesWindowBox.checkbutton_encoder_propulsive.Active ) {
......
......@@ -894,15 +894,6 @@ partial class ChronoJumpWindow
[Widget] Gtk.Label extra_window_runs_label_distance_units;
[Widget] Gtk.Label extra_window_label_runs_no_options;
[Widget] Gtk.Box vbox_runs_prevent_double_contact;
[Widget] Gtk.CheckButton checkbutton_runs_prevent_double_contact;
[Widget] Gtk.SpinButton spinbutton_runs_prevent_double_contact;
[Widget] Gtk.RadioButton radio_runs_prevent_double_contact_first;
[Widget] Gtk.RadioButton radio_runs_prevent_double_contact_average;
[Widget] Gtk.RadioButton radio_runs_prevent_double_contact_last;
[Widget] Gtk.RadioButton radio_runs_speed_start_arrival;
[Widget] Gtk.RadioButton radio_runs_speed_start_leaving;
//options runs interval
[Widget] Gtk.Label extra_window_runs_interval_label_distance;
[Widget] Gtk.SpinButton extra_window_runs_interval_spinbutton_distance;
......@@ -912,15 +903,6 @@ partial class ChronoJumpWindow
[Widget] Gtk.Label extra_window_runs_interval_label_limit_units;
[Widget] Gtk.Label extra_window_label_runs_interval_no_options;
[Widget] Gtk.Box vbox_runs_i_prevent_double_contact;
[Widget] Gtk.CheckButton checkbutton_runs_i_prevent_double_contact;
[Widget] Gtk.SpinButton spinbutton_runs_i_prevent_double_contact;
[Widget] Gtk.RadioButton radio_runs_i_prevent_double_contact_first;
[Widget] Gtk.RadioButton radio_runs_i_prevent_double_contact_average;
[Widget] Gtk.RadioButton radio_runs_i_prevent_double_contact_last;
[Widget] Gtk.RadioButton radio_runs_i_speed_start_arrival;
[Widget] Gtk.RadioButton radio_runs_i_speed_start_leaving;
double extra_window_runs_distance = 100;
double extra_window_runs_interval_distance = 100;
......@@ -1143,31 +1125,6 @@ partial class ChronoJumpWindow
extra_window_label_runs_no_options.Visible = ! hasOptions;
}
protected void on_checkbutton_runs_prevent_double_contact_toggled (object o, EventArgs args) {
vbox_runs_prevent_double_contact.Visible = checkbutton_runs_prevent_double_contact.Active;
}
protected void on_checkbutton_runs_i_prevent_double_contact_toggled (object o, EventArgs args) {
vbox_runs_i_prevent_double_contact.Visible = checkbutton_runs_i_prevent_double_contact.Active;
}
bool update_sqlite_at_runs_speed_radios = false;
private void on_radio_runs_speed_start_toggled (object o, EventArgs args) {
if(update_sqlite_at_runs_speed_radios) {
if(radio_runs_speed_start_arrival.Active)
SqlitePreferences.Update("runSpeedStartArrival", "True", false);
else
SqlitePreferences.Update("runSpeedStartArrival", "False", false);
}
}
private void on_radio_runs_i_speed_start_toggled (object o, EventArgs args) {
if(update_sqlite_at_runs_speed_radios) {
if(radio_runs_i_speed_start_arrival.Active)
SqlitePreferences.Update("runISpeedStartArrival", "True", false);
else
SqlitePreferences.Update("runISpeedStartArrival", "False", false);
}
}
}
......
......@@ -38,6 +38,13 @@ public class Preferences
public bool weightStatsPercent; //AKA weightPercentPreferred
public bool heightPreferred;
public bool metersSecondsPreferred;
public bool runSpeedStartArrival;
public Constants.DoubleContact runDoubleContactsMode; //default LAST
public int runDoubleContactsMS; //milliseconds
public Constants.DoubleContact runIDoubleContactsMode; //default AVERAGE
public int runIDoubleContactsMS; //milliseconds
public bool encoderPropulsive;
public double encoderSmoothCon;
public int videoDeviceNum; //AKA videoDevice
......@@ -56,8 +63,6 @@ public class Preferences
public bool videoOn;
public int evaluatorServerID;
public string versionAvailable;
public bool runSpeedStartArrival;
public bool runISpeedStartArrival;
public string machineID;
public Constants.MultimediaStorage multimediaStorage;
public string databaseVersion;
......
......@@ -65,6 +65,7 @@ class Sqlite
//for db conversion
static string currentVersion = "0";
static int conversionRate;
static int conversionRateTotal;
protected static int conversionSubRate;
......@@ -73,7 +74,7 @@ class Sqlite
/*
* Important, change this if there's any update to database
*/
static string lastChronojumpDatabaseVersion = "1.23";
static string lastChronojumpDatabaseVersion = "1.24";
public Sqlite() {
}
......@@ -1793,7 +1794,43 @@ class Sqlite
currentVersion = "1.23";
}
// ----------------------------------------------
// IMPORTANT HERE IS DEFINED sqliteOpened == true
// this is useful to not do more than 50 SQL open close
// that crashes mac (Linux 100)
// ----------------------------------------------
LogB.SQL("Leaving Sqlite opened before DB updates");
bool sqliteOpened = true;
string newVersion = "";
Sqlite.Open(); //------------------------------------------------
if(currentVersion == "1.23") {
LogB.SQL("Delete runISpeedStartArrival and add 4 double contacts configs");
DeleteFromName(true, Constants.PreferencesTable, "runISpeedStartArrival");
SqlitePreferences.Insert ("runDoubleContactsMode", Constants.DoubleContact.LAST.ToString());
SqlitePreferences.Insert ("runDoubleContactsMS", "1000");
SqlitePreferences.Insert ("runIDoubleContactsMode", Constants.DoubleContact.AVERAGE.ToString());
SqlitePreferences.Insert ("runIDoubleContactsMS", "1000");
newVersion = "1.24";
SqlitePreferences.Update ("databaseVersion", newVersion, true);
currentVersion = newVersion;
}
// --- add more updates here
// --- end of update, close DB
LogB.SQL("Closing Sqlite after DB updates");
sqliteOpened = false;
Sqlite.Close(); //------------------------------------------------
}
//if changes are made here, remember to change also in CreateTables()
......@@ -1937,6 +1974,7 @@ class Sqlite
SqliteExecuteAuto.addChronojumpProfileAndBilateral();
//changes [from - to - desc]
//1.23 - 1.24 Converted DB to 1.24 Delete runISpeedStartArrival and add 4 double contacts configs
//1.22 - 1.23 Converted DB to 1.23 Added encoder configuration
//1.21 - 1.22 Converted DB to 1.22 Encoder laterality in english again
//1.20 - 1.21 Converted DB to 1.21 Fixing loosing of encoder videoURL after recalculate
......
......@@ -69,7 +69,13 @@ class SqlitePreferences : Sqlite
Insert ("evaluatorServerID", "-1", dbcmdTr);
Insert ("versionAvailable", "", dbcmdTr);
Insert ("runSpeedStartArrival", "True", dbcmdTr);
Insert ("runISpeedStartArrival", "True", dbcmdTr);
Insert ("runDoubleContactsMode",
Constants.DoubleContact.LAST.ToString(), dbcmdTr);
Insert ("runDoubleContactsMS", "1000", dbcmdTr);
Insert ("runIDoubleContactsMode",
Constants.DoubleContact.AVERAGE.ToString(), dbcmdTr);
Insert ("runIDoubleContactsMS", "1000", dbcmdTr);
Random rnd = new Random();
string machineID = rnd.Next().ToString();
......@@ -175,6 +181,9 @@ class SqlitePreferences : Sqlite
Preferences preferences = new Preferences();
while(reader.Read()) {
//LogB.Debug("Reading preferences");
//LogB.Information(reader[0].ToString() + ":" + reader[1].ToString());
//these are sent to preferences window
if(reader[0].ToString() == "digitsNumber")
preferences.digitsNumber = Convert.ToInt32(reader[1].ToString());
......@@ -230,8 +239,18 @@ class SqlitePreferences : Sqlite
preferences.versionAvailable = reader[1].ToString();
else if(reader[0].ToString() == "runSpeedStartArrival")
preferences.runSpeedStartArrival = reader[1].ToString() == "True";
else if(reader[0].ToString() == "runISpeedStartArrival")
preferences.runISpeedStartArrival = reader[1].ToString() == "True";
else if(reader[0].ToString() == "runDoubleContactsMode")
preferences.runDoubleContactsMode = (Constants.DoubleContact)
Enum.Parse(typeof(Constants.DoubleContact), reader[1].ToString());
else if(reader[0].ToString() == "runDoubleContactsMS")
preferences.runDoubleContactsMS = Convert.ToInt32(reader[1].ToString());
else if(reader[0].ToString() == "runIDoubleContactsMode")
preferences.runIDoubleContactsMode = (Constants.DoubleContact)
Enum.Parse(typeof(Constants.DoubleContact), reader[1].ToString());
else if(reader[0].ToString() == "runIDoubleContactsMS")
preferences.runIDoubleContactsMS = Convert.ToInt32(reader[1].ToString());
else if(reader[0].ToString() == "machineID")
preferences.machineID = reader[1].ToString();
else if(reader[0].ToString() == "multimediaStorage")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment