[longomatch/device: 5/5] Toggle capture and warn on a device (re|dis)connection
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch/device: 5/5] Toggle capture and warn on a device (re|dis)connection
- Date: Sun, 1 Aug 2010 22:04:40 +0000 (UTC)
commit f84cf68aaae4115101e4a0f788bc4a77d3529516
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Mon Aug 2 00:00:52 2010 +0200
Toggle capture and warn on a device (re|dis)connection
CesarPlayer/Capturer/FakeCapturer.cs | 1 +
CesarPlayer/Capturer/ICapturer.cs | 1 +
CesarPlayer/Gui/CapturerBin.cs | 32 ++++++++++++++++++++++++++++++++
3 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/CesarPlayer/Capturer/FakeCapturer.cs b/CesarPlayer/Capturer/FakeCapturer.cs
index 292a92b..5e3cf88 100644
--- a/CesarPlayer/Capturer/FakeCapturer.cs
+++ b/CesarPlayer/Capturer/FakeCapturer.cs
@@ -30,6 +30,7 @@ namespace LongoMatch.Video.Capturer
{
public event EllpasedTimeHandler EllapsedTime;
public event ErrorHandler Error;
+ public event DeviceChangeHandler DeviceChange;
private LiveSourceTimer timer;
diff --git a/CesarPlayer/Capturer/ICapturer.cs b/CesarPlayer/Capturer/ICapturer.cs
index 89f02ee..4960bdb 100644
--- a/CesarPlayer/Capturer/ICapturer.cs
+++ b/CesarPlayer/Capturer/ICapturer.cs
@@ -30,6 +30,7 @@ namespace LongoMatch.Video.Capturer
{
event EllpasedTimeHandler EllapsedTime;
event ErrorHandler Error;
+ event DeviceChangeHandler DeviceChange;
uint OutputWidth {
get ;
diff --git a/CesarPlayer/Gui/CapturerBin.cs b/CesarPlayer/Gui/CapturerBin.cs
index 6544b62..0907553 100644
--- a/CesarPlayer/Gui/CapturerBin.cs
+++ b/CesarPlayer/Gui/CapturerBin.cs
@@ -74,6 +74,7 @@ namespace LongoMatch.Gui
capturer.EllapsedTime += OnTick;
if (value != CapturerType.Fake){
capturer.Error += OnError;
+ capturer.DeviceChange += OnDeviceChange;
capturerhbox.Add((Widget)capturer);
(capturer as Widget).Visible = true;
capturerhbox.Visible = true;
@@ -171,6 +172,7 @@ namespace LongoMatch.Gui
if (capturerType == CapturerType.Live){
/* release and dispose live capturer */
capturer.Error -= OnError;
+ capturer.DeviceChange += OnDeviceChange;
capturerhbox.Remove(capturer as Gtk.Widget);
capturer.Dispose();
}
@@ -284,6 +286,36 @@ namespace LongoMatch.Gui
Close();
}
+ protected virtual void OnDeviceChange (object o, DeviceChangeArgs args)
+ {
+ /* device disconnected, pause capture */
+ if (args.DeviceChange == -1){
+ recbutton.Visible = false;
+
+ if (capturing)
+ TogglePause();
+
+ MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal,
+ MessageType.Question, ButtonsType.Ok,
+ Catalog.GetString("Device disconnected. " +
+ "The capture will be paused"));
+ md.Icon=Stetic.IconLoader.LoadIcon(md, "longomatch", Gtk.IconSize.Dialog, 48);
+ md.Run();
+ md.Destroy();
+ } else {
+ recbutton.Visible = true;
+ MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal,
+ MessageType.Question, ButtonsType.YesNo,
+ Catalog.GetString("Device reconnected." +
+ "Do you want to restart the capture?"));
+ md.Icon=Stetic.IconLoader.LoadIcon(md, "longomatch", Gtk.IconSize.Dialog, 48);
+ if (md.Run() == (int)ResponseType.Ok){
+ TogglePause();
+ }
+ }
+
+ }
+
protected virtual void OnLogodrawingareaExposeEvent (object o, Gtk.ExposeEventArgs args)
{
Gdk.Window win;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]