Commit 2d741b75 authored by Xavier de Blas's avatar Xavier de Blas

DB: 1.62 implemented videoStopAfter (also on preferences)

parent 08fe0d00
......@@ -2124,7 +2124,7 @@ It starts before and arrives there with some speed.</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">10 1 30 1 10 0</property>
<property name="adjustment">11 1 30 1 10 0</property>
<property name="climb_rate">1</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
......@@ -3572,14 +3572,140 @@ Other</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label_webcam_windows">
<widget class="GtkHBox" id="hbox33">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<widget class="GtkCheckButton" id="check_camera_stop_after">
<property name="label">Camera will be stopped n seconds after end test</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_check_camera_stop_after_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="GtkHBox" id="hbox_camera_stop_after_seconds">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">4</property>
<child>
<widget class="GtkSpinButton" id="spin_camera_stop_after">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip" translatable="yes">Recording time</property>
<property name="invisible_char"></property>
<property name="width_chars">1</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">2 0 9 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">0</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label82">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">seconds</property>
</widget>
<packing>
<property name="expand">True</property>
<property name="fill">True</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>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">4</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment13">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">20</property>
<child>
<widget class="GtkVBox" id="vbox_camera_stop_after">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">10</property>
<child>
<widget class="GtkLabel" id="label83">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">To ensure the end of test is recorded, it is recommended 2 seconds.</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</widget>
</child>
</widget>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">On Windows at least Windows 7 is required.</property>
<property name="top_padding">10</property>
<child>
<widget class="GtkLabel" id="label_webcam_windows">
<property name="can_focus">False</property>
<property name="label" translatable="yes">On Windows at least Windows 7 is required.</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">4</property>
<property name="position">6</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox21">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">10</property>
</widget>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">7</property>
</packing>
</child>
</widget>
......
......@@ -153,6 +153,10 @@ public class PreferencesWindow
[Widget] Gtk.Label label_no_cameras;
[Widget] Gtk.Label label_webcam_windows;
[Widget] Gtk.Image image_video_preview;
[Widget] Gtk.CheckButton check_camera_stop_after;
//[Widget] Gtk.VBox vbox_camera_stop_after;
[Widget] Gtk.HBox hbox_camera_stop_after_seconds;
[Widget] Gtk.SpinButton spin_camera_stop_after;
//language tab
[Widget] Gtk.Box hbox_combo_language;
......@@ -303,7 +307,11 @@ public class PreferencesWindow
pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_photo_preview.png");
PreferencesWindowBox.image_video_preview.Pixbuf = pixbuf;
PreferencesWindowBox.spin_camera_stop_after.Value = preferences.videoStopAfter;
//PreferencesWindowBox.vbox_camera_stop_after.Visible = (preferences.videoStopAfter > 0);
PreferencesWindowBox.hbox_camera_stop_after_seconds.Visible = (preferences.videoStopAfter > 0);
PreferencesWindowBox.check_camera_stop_after.Active = (preferences.videoStopAfter > 0);
string [] decs = {"1", "2", "3"};
PreferencesWindowBox.combo_decimals.Active = UtilGtk.ComboMakeActive(
......@@ -652,6 +660,12 @@ public class PreferencesWindow
hbox_combo_camera_framerate.ShowAll();
combo_camera_framerate.Active = UtilGtk.ComboMakeActive(combo_camera_framerate, framerate);
}
private void on_check_camera_stop_after_toggled (object o, EventArgs args)
{
//vbox_camera_stop_after.Visible = check_camera_stop_after.Active;
hbox_camera_stop_after_seconds.Visible = check_camera_stop_after.Active;
}
private void on_check_appearance_maximized_toggled (object obj, EventArgs args)
{
......@@ -1535,6 +1549,14 @@ public class PreferencesWindow
preferences.videoDeviceFramerate = UtilGtk.ComboGetActive(combo_camera_framerate);
}
int selected_camera_stop_after = Convert.ToInt32(spin_camera_stop_after.Value);
if(! check_camera_stop_after.Active)
selected_camera_stop_after = 0;
if( preferences.videoStopAfter != selected_camera_stop_after) {
SqlitePreferences.Update("videoStopAfter", selected_camera_stop_after.ToString(), true);
preferences.videoStopAfter = selected_camera_stop_after;
}
//end of camera stuff
if(PreferencesWindowBox.radio_export_latin.Active) {
......
......@@ -328,8 +328,13 @@ public partial class ChronoJumpWindow
LogB.Information("Encoder, immediate call to webcamEndDo()");
webcamEndDo();
} else {
LogB.Information("Preparing to call webcamEndDo() in 2s");
GLib.Timeout.Add(2000, new GLib.TimeoutHandler(webcamEndDo)); //call it later to be able to have some video on a short test like a jump.
if(preferences.videoStopAfter == 0)
webcamEndDo();
else {
//call it later to be able to have some video on a short test like a jump.
LogB.Information(string.Format("Preparing to call webcamEndDo() in {0} s", preferences.videoStopAfter));
GLib.Timeout.Add(Convert.ToUInt32(preferences.videoStopAfter * 1000), new GLib.TimeoutHandler(webcamEndDo));
}
}
}
......
......@@ -77,6 +77,7 @@ public class Preferences
public string videoDevice;
public string videoDeviceResolution;
public string videoDeviceFramerate;
public int videoStopAfter;
public string CSVExportDecimalSeparator;
public string language;
public string crashLogLanguage;
......
......@@ -125,7 +125,7 @@ class Sqlite
/*
* Important, change this if there's any update to database
*/
static string lastChronojumpDatabaseVersion = "1.61";
static string lastChronojumpDatabaseVersion = "1.62";
public Sqlite() {
}
......@@ -2379,6 +2379,14 @@ class Sqlite
currentVersion = updateVersion("1.61");
}
if(currentVersion == "1.61")
{
LogB.SQL("Added to preferences: videoStopAfter");
SqlitePreferences.Insert ("videoStopAfter", "2");
currentVersion = updateVersion("1.62");
}
......
......@@ -173,6 +173,7 @@ class SqlitePreferences : Sqlite
Insert ("videoDevice", "", dbcmdTr); //first
Insert ("videoDeviceResolution", "", dbcmdTr);
Insert ("videoDeviceFramerate", "", dbcmdTr);
Insert ("videoStopAfter", "2", dbcmdTr);
Insert ("inertialmomentum", "0.01", dbcmdTr);
Insert ("CSVExportDecimalSeparator", Util.GetDecimalSeparatorFromLocale(), dbcmdTr);
Insert ("RGraphsTranslate", "True", dbcmdTr);
......@@ -375,6 +376,8 @@ class SqlitePreferences : Sqlite
preferences.videoDeviceResolution = reader[1].ToString();
else if(reader[0].ToString() == "videoDeviceFramerate")
preferences.videoDeviceFramerate = reader[1].ToString();
else if(reader[0].ToString() == "videoStopAfter")
preferences.videoStopAfter = Convert.ToInt32(reader[1].ToString());
else if(reader[0].ToString() == "CSVExportDecimalSeparator")
preferences.CSVExportDecimalSeparator = reader[1].ToString();
else if(reader[0].ToString() == "language")
......
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