[chronojump] Webcam preferences show error if cannot playpreview
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Webcam preferences show error if cannot playpreview
- Date: Tue, 16 Jul 2019 14:38:25 +0000 (UTC)
commit a98dafdff62760b69bdd759577a85075855f457c
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Jul 16 16:37:59 2019 +0200
Webcam preferences show error if cannot playpreview
glade/preferences_win.glade | 14 ++++++++++++--
src/gui/preferences.cs | 17 ++++++++++++++++-
2 files changed, 28 insertions(+), 3 deletions(-)
---
diff --git a/glade/preferences_win.glade b/glade/preferences_win.glade
index 09f28725..b9fd8679 100644
--- a/glade/preferences_win.glade
+++ b/glade/preferences_win.glade
@@ -3943,7 +3943,7 @@ Other</property>
<property name="stock">gtk-missing-image</property>
</widget>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
@@ -3955,7 +3955,7 @@ Other</property>
<property name="label" translatable="yes">Preview</property>
</widget>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
@@ -3969,6 +3969,16 @@ Other</property>
<property name="position">0</property>
</packing>
</child>
+ <child>
+ <widget class="GtkLabel" id="label_video_preview_error">
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index fe1d0780..9c415cf4 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -169,6 +169,7 @@ public class PreferencesWindow
[Widget] Gtk.Image image_multimedia_video;
[Widget] Gtk.Image image_video_preview;
[Widget] Gtk.Button button_video_preview;
+ [Widget] Gtk.Label label_video_preview_error;
[Widget] Gtk.CheckButton check_camera_stop_after;
[Widget] Gtk.CheckButton check_camera_advanced;
[Widget] Gtk.Frame frame_camera_advanced;
@@ -939,14 +940,28 @@ public class PreferencesWindow
}
private void on_button_video_preview_clicked (object o, EventArgs args)
+ {
+ label_video_preview_error.Visible = false;
+
+ //this allows us to update the previous label, if not we have to end camera play
+ GLib.Timeout.Add(100, new GLib.TimeoutHandler(button_video_preview_do));
+ }
+ private bool button_video_preview_do ()
{
string cameraCode = wd_list.GetCodeOfFullname(UtilGtk.ComboGetActive(combo_camera));
if(cameraCode == "")
- return;
+ return false; //do not call again
Webcam webcamPlay = new WebcamFfmpeg (Webcam.Action.PLAYPREVIEW, UtilAll.GetOSEnum(),
cameraCode,
getSelectedPixelFormat(), getSelectedResolution(), getSelectedFramerate());
+
Webcam.Result result = webcamPlay.PlayPreviewNoBackground ();
+ if(! result.success) {
+ label_video_preview_error.Text = result.error;
+ label_video_preview_error.Visible = true;
+ }
+
+ return false; //do not call again
}
private string getSelectedPixelFormat()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]