[chronojump] Webcam: show progressbar at capture end on contacts
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Webcam: show progressbar at capture end on contacts
- Date: Wed, 3 Jul 2019 10:31:28 +0000 (UTC)
commit 23550dfcbbdbbcfa0a7150c9d0c121c000c9a4d4
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Jul 3 12:31:01 2019 +0200
Webcam: show progressbar at capture end on contacts
glade/app1.glade | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
src/gui/webcam.cs | 24 ++++++++++++++++++++++--
2 files changed, 72 insertions(+), 2 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 3bf89c9d..a1589e36 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1968,6 +1968,9 @@
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkLabel"
id="label_start_selector_jumps">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -10869,6 +10872,12 @@ EncoderInertialCapture</property>
</packing>
</child>
<child>
+ <widget class="GtkNotebook"
id="notebook_last_test_buttons">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="show_tabs">False</property>
+ <property name="show_border">False</property>
+ <child>
<widget class="GtkHBox" id="hbox52">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -10944,6 +10953,41 @@ EncoderInertialCapture</property>
</packing>
</child>
</widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label402">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">page
1</property>
+ </widget>
+ <packing>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkProgressBar"
id="progressbar_video_generating">
+ <property name="width_request">10</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label403">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">page
2</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ </widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -21160,6 +21204,9 @@ Concentric</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -29897,6 +29944,9 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/gui/webcam.cs b/src/gui/webcam.cs
index 301429e5..8f6f8708 100644
--- a/src/gui/webcam.cs
+++ b/src/gui/webcam.cs
@@ -27,6 +27,8 @@ using System.Threading;
public partial class ChronoJumpWindow
{
+ [Widget] Gtk.Notebook notebook_last_test_buttons;
+ [Widget] Gtk.ProgressBar progressbar_video_generating;
[Widget] Gtk.VSeparator vseparator_force_sensor_camera_space;
[Widget] Gtk.VBox vbox_contacts_camera;
[Widget] Gtk.CheckButton checkbutton_video;
@@ -154,6 +156,7 @@ public partial class ChronoJumpWindow
private enum statusEnum { NOT_STARTED, STARTING, FAILURE, SUCCESS };
static statusEnum webcamStartThreadBeforeTestStatus;
static Stopwatch swWebcamStart;
+ static Stopwatch swWebcamStop;
//Attention: no GTK here
private void webcamStartThreadBeforeTest()
@@ -339,14 +342,30 @@ public partial class ChronoJumpWindow
//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));
+ notebook_last_test_buttons.CurrentPage = 1;
+ progressbar_video_generating.Text = "Ending video";
+
+ //GLib.Timeout.Add(Convert.ToUInt32(preferences.videoStopAfter * 1000), new
GLib.TimeoutHandler(webcamEndDo));
+ //do not done the above method because now we call webcamEndDo to update the
progressbar, until preferences.videoStopAfter end
+ swWebcamStop = new Stopwatch();
+ swWebcamStop.Start();
+ GLib.Timeout.Add(50, new GLib.TimeoutHandler(webcamEndDo));
}
}
}
private bool webcamEndDo()
{
- LogB.Information("Called webcamEndDo()");
+ if(swWebcamStop.Elapsed.TotalSeconds < preferences.videoStopAfter)
+ {
+ //progressbar_video_generating.Pulse();
+ progressbar_video_generating.Fraction =
Util.DivideSafeFraction(swWebcamStop.Elapsed.TotalMilliseconds, preferences.videoStopAfter * 1000);
+ return true;
+ }
+
+ swWebcamStart.Stop();
+ progressbar_video_generating.Fraction = 1;
+ LogB.Information("Called webcamEndDo() ending the pulse");
Webcam.Result resultExit = webcamManage.ExitAndFinish (webcamEndParams.camera,
webcamEndParams.sessionID,
webcamEndParams.testType, webcamEndParams.uniqueID,
webcamEndParams.guiContactsEncoder);
@@ -359,6 +378,7 @@ public partial class ChronoJumpWindow
button_video_play_selected_test(current_menuitem_mode);
sensitiveGuiEventDone();
+ notebook_last_test_buttons.CurrentPage = 0;
return false; //do not call this Timeout routine again
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]