[longomatch] Add new capture based on periods
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Add new capture based on periods
- Date: Mon, 7 Jul 2014 11:31:09 +0000 (UTC)
commit cbb6f12347854cb80951ac425814c8cdeb331fd9
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Sat Jun 21 19:24:30 2014 +0200
Add new capture based on periods
LongoMatch.Core/Handlers/Multimedia.cs | 1 +
LongoMatch.Core/Interfaces/GUI/ICapturerBin.cs | 10 +-
LongoMatch.Drawing/Widgets/TimersTimeline.cs | 6 +-
LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs | 292 ++++++++++----------
LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs | 37 ++-
.../gtk-gui/LongoMatch.Gui.CapturerBin.cs | 108 +++++---
LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic | 125 ++++++---
LongoMatch.GUI.Multimedia/gtk-gui/objects.xml | 6 +-
LongoMatch.GUI/Gui/Component/AnalysisComponent.cs | 8 +-
LongoMatch.GUI/Gui/Component/CodingWidget.cs | 54 ++---
.../Gui/Component/PlayersListTreeWidget.cs | 6 -
.../Gui/Component/PlaysListTreeWidget.cs | 6 -
.../Gui/Component/PlaysSelectionWidget.cs | 5 +-
LongoMatch.GUI/Gui/Component/ProjectPeriods.cs | 15 +-
LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs | 10 -
LongoMatch.GUI/gtk-gui/gui.stetic | 23 +-
LongoMatch.Services/Services/ProjectsManager.cs | 24 +-
17 files changed, 403 insertions(+), 333 deletions(-)
---
diff --git a/LongoMatch.Core/Handlers/Multimedia.cs b/LongoMatch.Core/Handlers/Multimedia.cs
index e30b851..3c35994 100644
--- a/LongoMatch.Core/Handlers/Multimedia.cs
+++ b/LongoMatch.Core/Handlers/Multimedia.cs
@@ -37,6 +37,7 @@ namespace LongoMatch.Handlers
public delegate void PlaybackRateChangedHandler (float rate);
public delegate void DeviceChangeHandler(int deviceID);
+ public delegate void CaptureFinishedHandler (bool close);
public delegate void ErrorHandler(string message);
public delegate void PercentCompletedHandler(float percent);
public delegate void StateChangeHandler(bool playing);
diff --git a/LongoMatch.Core/Interfaces/GUI/ICapturerBin.cs b/LongoMatch.Core/Interfaces/GUI/ICapturerBin.cs
index 264cbf6..c11cb48 100644
--- a/LongoMatch.Core/Interfaces/GUI/ICapturerBin.cs
+++ b/LongoMatch.Core/Interfaces/GUI/ICapturerBin.cs
@@ -20,23 +20,25 @@ using System;
using LongoMatch.Common;
using LongoMatch.Handlers;
using LongoMatch.Store;
+using System.Collections.Generic;
namespace LongoMatch.Interfaces.GUI
{
public interface ICapturerBin
{
- event EventHandler CaptureFinished;
+ event CaptureFinishedHandler CaptureFinished;
event ErrorHandler Error;
- string Logo {set;}
Time CurrentTime {get;}
bool Capturing {get;}
Image CurrentMiniatureFrame {get;}
CaptureSettings CaptureSettings {get;}
+ List<string> PeriodsNames {set;}
void Run (CapturerType type, CaptureSettings settings);
- void Start();
- void TogglePause();
+ void StartPeriod();
+ void StopPeriod();
+ void Stop();
void Close();
}
}
diff --git a/LongoMatch.Drawing/Widgets/TimersTimeline.cs b/LongoMatch.Drawing/Widgets/TimersTimeline.cs
index 7923591..cf6172d 100644
--- a/LongoMatch.Drawing/Widgets/TimersTimeline.cs
+++ b/LongoMatch.Drawing/Widgets/TimersTimeline.cs
@@ -27,7 +27,11 @@ namespace LongoMatch.Drawing.Widgets
SelectionMode = MultiSelectionMode.MultipleWithModifier;
}
- public void LoadTimers (List<Timer> timers, Time duration, bool splitTimers) {
+ public void LoadPeriods (List<Period> periods, Time duration) {
+ LoadTimers (periods.Select (p => p as Timer).ToList(), duration, false);
+ }
+
+ public void LoadTimers (List<Timer> timers, Time duration, bool splitTimers = true) {
Objects.Clear();
this.timers = new Dictionary<Timer, TimerTimeline>();
this.duration = duration;
diff --git a/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs b/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs
index 80d3e24..4685063 100644
--- a/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs
@@ -34,6 +34,7 @@ using LongoMatch.Video.Utils;
using Mono.Unix;
using LongoMatch.Store;
using LongoMatch.Multimedia.Utils;
+using System.Collections.Generic;
namespace LongoMatch.Gui
{
@@ -43,41 +44,34 @@ namespace LongoMatch.Gui
[System.ComponentModel.ToolboxItem(true)]
public partial class CapturerBin : Gtk.Bin, ICapturerBin
{
- public event EventHandler CaptureFinished;
+ public event CaptureFinishedHandler CaptureFinished;
public event ErrorHandler Error;
- Image logopix;
CaptureSettings settings;
CapturerType type;
- bool captureStarted, capturing, delayStart;
+ bool delayStart;
ICapturer capturer;
+ int periodIndex;
+ Period currentPeriod;
+ Time ellapsedTime;
+ List<string> periods;
public CapturerBin()
{
this.Build();
- recbutton.Clicked += OnRecbuttonClicked;
- pausebutton.Clicked += OnPausebuttonClicked;
- stopbutton.Clicked += OnStopbuttonClicked;
+ recbutton.Visible = false;
+ stopbutton.Visible = false;
+ finishbutton.Visible = false;
+ cancelbutton.Visible = true;
videodrawingarea.CanFocus = false;
-
- videodrawingarea.Realized += (sender, e) => {
- if (delayStart) {
- Configure ();
- capturer.Run ();
- }
- };
+ ConnectSignals ();
}
- public string Logo {
- set {
- try {
- this.logopix = new Image(new Gdk.Pixbuf(value));
- } catch {
- /* FIXME: Add log */
- }
- }
+ public bool Capturing {
+ get;
+ protected set;
}
-
+
public Time CurrentTime {
get {
if(capturer == null)
@@ -86,44 +80,87 @@ namespace LongoMatch.Gui
}
}
- public bool Capturing {
+ public CaptureSettings CaptureSettings {
get {
- return capturing;
+ return settings;
}
}
- public CaptureSettings CaptureSettings {
+ public List<string> PeriodsNames {
+ set {
+ periods = value;
+ UpdateLabel (value[0]);
+ }
get {
- return settings;
+ return periods;
}
}
+
+ public List<Period> Periods {
+ set;
+ get;
+ }
- public void Start() {
+ public void StartPeriod () {
if(capturer == null)
return;
+
+ if (currentPeriod != null) {
+ throw new Exception ("Period already started");
+ }
- capturing = true;
- captureStarted = true;
+ currentPeriod = new Period {Name = periods[periodIndex]};
+ currentPeriod.Start (ellapsedTime);
+ Log.Information (String.Format ("Start new period {0} at {1}",
+ currentPeriod.Name, ellapsedTime.ToSecondsString()));
+ Capturing = true;
recbutton.Visible = false;
- pausebutton.Visible = true;
stopbutton.Visible = true;
- capturer.Start();
+ finishbutton.Visible = true;
+ if (Periods.Count == 0) {
+ capturer.Start ();
+ } else {
+ capturer.TogglePause ();
+ }
+ if (periodIndex + 1 == periods.Count) {
+ stopbutton.Visible = false;
+ }
+ UpdateLabel (currentPeriod.Name);
+ Periods.Add (currentPeriod);
}
-
- public void TogglePause() {
- if(capturer == null)
+
+ public void StopPeriod () {
+ string msg;
+
+ msg = Catalog.GetString ("Do you want to stop the current period?");
+
+ if (!MessagesHelpers.QuestionMessage (this, msg)) {
return;
-
- if (capturing) {
- string msg = Catalog.GetString("Do you want to pause the recording?");
- if (!MessagesHelpers.QuestionMessage (this, msg)) {
- return;
- }
- }
- capturing = !capturing;
- recbutton.Visible = !capturing;
- pausebutton.Visible = capturing;
- capturer.TogglePause();
+ }
+ if (currentPeriod == null) {
+ throw new Exception ("Period not started");
+ }
+
+ Log.Information (String.Format ("Stop period {0} at {1}",
+ currentPeriod.Name, ellapsedTime.ToSecondsString()));
+ periodIndex ++;
+ Capturing = false;
+ capturer.TogglePause ();
+ currentPeriod.Stop (ellapsedTime);
+ UpdateLabel (periods[periodIndex]);
+ currentPeriod = null;
+ recbutton.Visible = true;
+ stopbutton.Visible = false;
+ }
+
+ public void Stop () {
+ if (currentPeriod != null) {
+ Log.Information (String.Format ("Stop period {0} at {1}",
+ currentPeriod.Name,
ellapsedTime.ToSecondsString()));
+ currentPeriod.Stop (ellapsedTime);
+ }
+ Log.Information ("Stop capture");
+ capturer.Stop ();
}
public void Run (CapturerType type, CaptureSettings settings) {
@@ -146,15 +183,17 @@ namespace LongoMatch.Gui
} else {
delayStart = true;
}
+ Periods = new List<Period> ();
}
-
+
public void Close() {
+ bool stop = Capturing;
+
/* resetting common properties */
- pausebutton.Visible = false;
stopbutton.Visible = false;
- recbutton.Visible = true;
- captureStarted = false;
- capturing = false;
+ finishbutton.Visible = false;
+ recbutton.Visible = false;
+ Capturing = false;
OnTick(new Time (0));
if(capturer == null)
@@ -162,7 +201,9 @@ namespace LongoMatch.Gui
/* stopping and closing capturer */
try {
- capturer.Stop();
+ if (Capturing) {
+ capturer.Stop();
+ }
capturer.Close();
if (type == CapturerType.Live) {
/* release and dispose live capturer */
@@ -190,6 +231,40 @@ namespace LongoMatch.Gui
}
}
+ void ConnectSignals ()
+ {
+ recbutton.Clicked += (sender, e) => StartPeriod ();
+ stopbutton.Clicked += (sender, e) => StopPeriod ();
+ finishbutton.Clicked += (sender, e) => {
+ string msg = Catalog.GetString ("Do you want to finish the current capture?");
+
+ if (!MessagesHelpers.QuestionMessage (this, msg)) {
+ return;
+ }
+ if (CaptureFinished != null)
+ CaptureFinished (false);
+ };
+ cancelbutton.Clicked += (sender, e) => {
+ if (CaptureFinished != null)
+ CaptureFinished (true);
+ };
+ videodrawingarea.Realized += (sender, e) => {
+ if (delayStart) {
+ Configure ();
+ capturer.Run ();
+ }
+ };
+ }
+
+ void UpdateLabel (string name) {
+ frame1.Label = Catalog.GetString ("Period") + " " + name;
+ }
+
+ string FormatTime (Period period, Time time) {
+ return String.Format ("{0} {1}: {2} ", Catalog.GetString ("Period"),
+ period.Name, time.ToSecondsString ());
+ }
+
void Configure () {
VideoMuxerType muxer;
IntPtr windowHandle;
@@ -197,6 +272,7 @@ namespace LongoMatch.Gui
if(capturer == null)
return;
+ recbutton.Visible = true;
/* We need to use Matroska for live replay and remux when the capture is done */
muxer = settings.EncodingSettings.EncodingProfile.Muxer;
if (muxer == VideoMuxerType.Avi || muxer == VideoMuxerType.Mp4) {
@@ -208,64 +284,38 @@ namespace LongoMatch.Gui
delayStart = false;
}
- protected virtual void OnRecbuttonClicked(object sender, System.EventArgs e)
- {
- if(capturer == null)
- return;
-
- if(captureStarted == true) {
- if(capturing)
- return;
- TogglePause();
- }
- else
- Start();
- }
-
- protected virtual void OnPausebuttonClicked(object sender, System.EventArgs e)
+ void OnError (string message)
{
- if(capturer != null && capturing)
- TogglePause();
- }
-
- protected virtual void OnStopbuttonClicked(object sender, System.EventArgs e)
- {
- string msg;
-
- if(capturer == null)
- return;
-
- msg = Catalog.GetString("Do you want to stop and finish the current capture?");
- if (MessagesHelpers.QuestionMessage (this, msg, null)) {
- Close();
- recbutton.Visible = true;
- pausebutton.Visible = false;
- stopbutton.Visible = false;
-
- if(CaptureFinished != null)
- CaptureFinished(this, new EventArgs());
- }
+ if(Error != null)
+ Error(message);
}
- protected virtual void OnTick(Time ellapsedTime) {
- timelabel.Markup = String.Format("<span font=\"20px bold\">Time --> {0}</span> ",
- CurrentTime.ToSecondsString());
- }
+ void OnTick(Time ellapsedTime) {
+ string text = "";
+ Time duration = new Time (0);
- protected virtual void OnError(string message)
- {
- if(Error != null)
- Error(message);
- Close();
+ this.ellapsedTime = ellapsedTime;
+
+ foreach (Period period in Periods) {
+ TimeNode tn = period.PeriodNode;
+ if (tn.Stop != null) {
+ text += FormatTime (period, tn.Duration);
+ duration += tn.Duration;
+ } else {
+ text += FormatTime (period, ellapsedTime - duration);
+ break;
+ }
+ }
+ timelabel.Markup = String.Format("<span font=\"30px bold\">{0}</span> ", text);
}
- protected virtual void OnDeviceChange(int deviceID)
+ void OnDeviceChange(int deviceID)
{
string msg;
/* device disconnected, pause capture */
if(deviceID == -1) {
- if(capturing)
- TogglePause();
+ if(Capturing)
+ capturer.TogglePause();
recbutton.Sensitive = false;
msg = Catalog.GetString("Device disconnected. " +
@@ -276,51 +326,9 @@ namespace LongoMatch.Gui
msg = Catalog.GetString("Device reconnected." +
"Do you want to restart the capture?");
if (MessagesHelpers.QuestionMessage (this, msg, null)) {
- TogglePause ();
+ capturer.TogglePause();
}
}
}
-
- protected virtual void OnLogodrawingareaExposeEvent(object o, Gtk.ExposeEventArgs args)
- {
- Gdk.Window win;
- Gdk.Pixbuf logo, frame;
- int width, height, allocWidth, allocHeight, logoX, logoY;
- float ratio;
-
- if(logopix == null)
- return;
-
- logo = logopix.Value;
-
- win = videodrawingarea.GdkWindow;
- width = logo.Width;
- height = logo.Height;
- allocWidth = videodrawingarea.Allocation.Width;
- allocHeight = videodrawingarea.Allocation.Height;
-
- /* Checking if allocated space is smaller than our logo */
- if((float) allocWidth / width > (float) allocHeight / height) {
- ratio = (float) allocHeight / height;
- } else {
- ratio = (float) allocWidth / width;
- }
- width = (int)(width * ratio);
- height = (int)(height * ratio);
-
- logoX = (allocWidth / 2) - (width / 2);
- logoY = (allocHeight / 2) - (height / 2);
-
- /* Drawing our frame */
- frame = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, false, 8, allocWidth, allocHeight);
- logo.Composite(frame, 0, 0, allocWidth, allocHeight, logoX, logoY,
- ratio, ratio, Gdk.InterpType.Bilinear, 255);
-
- win.DrawPixbuf(this.Style.BlackGC, frame, 0, 0,
- 0, 0, allocWidth, allocHeight,
- Gdk.RgbDither.Normal, 0, 0);
- frame.Dispose();
- return;
- }
}
}
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
b/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
index 11ba7a1..e4c923f 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
@@ -21,6 +21,7 @@ using LongoMatch.Handlers;
using LongoMatch.Interfaces.GUI;
using LongoMatch.Common;
using LongoMatch.Store;
+using System.Collections.Generic;
namespace LongoMatch.Gui
{
@@ -32,7 +33,7 @@ namespace LongoMatch.Gui
public event ErrorHandler Error;
/* Capturer events */
- public event EventHandler CaptureFinished;
+ public event CaptureFinishedHandler CaptureFinished;
/* Player Events */
public event SegmentClosedHandler SegmentClosedEvent;
@@ -114,12 +115,6 @@ namespace LongoMatch.Gui
#endregion
#region Capturer
- public string Logo {
- set {
- capturerbin.Logo = value;
- }
- }
-
public CaptureSettings CaptureSettings {
get {
return capturerbin.CaptureSettings;
@@ -132,12 +127,28 @@ namespace LongoMatch.Gui
}
}
- public void Start () {
- capturerbin.Start ();
+ public List<string> PeriodsNames {
+ set {
+ capturerbin.PeriodsNames = value;
+ }
+ }
+
+ public List<Period> PeriodsTimers {
+ set {
+ capturerbin.Periods = value;
+ }
+ }
+
+ public void StartPeriod () {
+ capturerbin.StartPeriod ();
+ }
+
+ public void StopPeriod () {
+ capturerbin.StopPeriod ();
}
- public void TogglePause () {
- capturerbin.TogglePause ();
+ public void Stop () {
+ capturerbin.Stop ();
}
public void Run (CapturerType type, CaptureSettings settings) {
@@ -269,9 +280,9 @@ namespace LongoMatch.Gui
}
void ConnectSignals () {
- capturerbin.CaptureFinished += delegate(object sender, EventArgs e) {
+ capturerbin.CaptureFinished += (bool close) => {
if (CaptureFinished != null)
- CaptureFinished (sender, e);
+ CaptureFinished (close);
};
capturerbin.Error += delegate(string message) {
diff --git a/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.CapturerBin.cs
b/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.CapturerBin.cs
index 37d8b05..144defe 100644
--- a/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.CapturerBin.cs
+++ b/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.CapturerBin.cs
@@ -7,10 +7,14 @@ namespace LongoMatch.Gui
private global::Gtk.VBox vbox1;
private global::Gtk.DrawingArea videodrawingarea;
private global::Gtk.HBox hbox2;
+ private global::Gtk.Frame frame1;
+ private global::Gtk.Alignment GtkAlignment;
private global::Gtk.HBox buttonsbox;
private global::Gtk.Button recbutton;
- private global::Gtk.Button pausebutton;
private global::Gtk.Button stopbutton;
+ private global::Gtk.Button finishbutton;
+ private global::Gtk.Button cancelbutton;
+ private global::Gtk.Label GtkLabel3;
private global::Gtk.Label timelabel;
protected virtual void Build ()
@@ -34,12 +38,20 @@ namespace LongoMatch.Gui
this.hbox2.Name = "hbox2";
this.hbox2.Spacing = 6;
// Container child hbox2.Gtk.Box+BoxChild
+ this.frame1 = new global::Gtk.Frame ();
+ this.frame1.Name = "frame1";
+ this.frame1.ShadowType = ((global::Gtk.ShadowType)(0));
+ // Container child frame1.Gtk.Container+ContainerChild
+ this.GtkAlignment = new global::Gtk.Alignment (0F, 0F, 1F, 1F);
+ this.GtkAlignment.Name = "GtkAlignment";
+ this.GtkAlignment.LeftPadding = ((uint)(12));
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
this.buttonsbox = new global::Gtk.HBox ();
this.buttonsbox.Name = "buttonsbox";
this.buttonsbox.Spacing = 6;
// Container child buttonsbox.Gtk.Box+BoxChild
this.recbutton = new global::Gtk.Button ();
- this.recbutton.TooltipMarkup = "Start or continue capture";
+ this.recbutton.TooltipMarkup = "Start capturing new period";
this.recbutton.Name = "recbutton";
this.recbutton.UseUnderline = true;
// Container child recbutton.Gtk.Container+ContainerChild
@@ -62,78 +74,108 @@ namespace LongoMatch.Gui
w10.Expand = false;
w10.Fill = false;
// Container child buttonsbox.Gtk.Box+BoxChild
- this.pausebutton = new global::Gtk.Button ();
- this.pausebutton.TooltipMarkup = "Pause capture";
- this.pausebutton.Name = "pausebutton";
- this.pausebutton.UseUnderline = true;
- // Container child pausebutton.Gtk.Container+ContainerChild
+ this.stopbutton = new global::Gtk.Button ();
+ this.stopbutton.TooltipMarkup = "Stop capturing current period";
+ this.stopbutton.Name = "stopbutton";
+ this.stopbutton.UseUnderline = true;
+ // Container child stopbutton.Gtk.Container+ContainerChild
global::Gtk.Alignment w11 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
// Container child GtkAlignment.Gtk.Container+ContainerChild
global::Gtk.HBox w12 = new global::Gtk.HBox ();
w12.Spacing = 2;
// Container child GtkHBox.Gtk.Container+ContainerChild
global::Gtk.Image w13 = new global::Gtk.Image ();
- w13.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-media-pause",
global::Gtk.IconSize.Dialog);
+ w13.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-media-stop",
global::Gtk.IconSize.Dialog);
w12.Add (w13);
// Container child GtkHBox.Gtk.Container+ContainerChild
global::Gtk.Label w15 = new global::Gtk.Label ();
w12.Add (w15);
w11.Add (w12);
- this.pausebutton.Add (w11);
- this.buttonsbox.Add (this.pausebutton);
- global::Gtk.Box.BoxChild w19 = ((global::Gtk.Box.BoxChild)(this.buttonsbox
[this.pausebutton]));
+ this.stopbutton.Add (w11);
+ this.buttonsbox.Add (this.stopbutton);
+ global::Gtk.Box.BoxChild w19 = ((global::Gtk.Box.BoxChild)(this.buttonsbox
[this.stopbutton]));
w19.Position = 1;
w19.Expand = false;
w19.Fill = false;
// Container child buttonsbox.Gtk.Box+BoxChild
- this.stopbutton = new global::Gtk.Button ();
- this.stopbutton.TooltipMarkup = "Stop and close capture";
- this.stopbutton.Name = "stopbutton";
- this.stopbutton.UseUnderline = true;
- // Container child stopbutton.Gtk.Container+ContainerChild
+ this.finishbutton = new global::Gtk.Button ();
+ this.finishbutton.TooltipMarkup = "End capture";
+ this.finishbutton.Name = "finishbutton";
+ this.finishbutton.UseUnderline = true;
+ // Container child finishbutton.Gtk.Container+ContainerChild
global::Gtk.Alignment w20 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
// Container child GtkAlignment.Gtk.Container+ContainerChild
global::Gtk.HBox w21 = new global::Gtk.HBox ();
w21.Spacing = 2;
// Container child GtkHBox.Gtk.Container+ContainerChild
global::Gtk.Image w22 = new global::Gtk.Image ();
- w22.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-media-stop",
global::Gtk.IconSize.Dialog);
+ w22.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-ok",
global::Gtk.IconSize.Dialog);
w21.Add (w22);
// Container child GtkHBox.Gtk.Container+ContainerChild
global::Gtk.Label w24 = new global::Gtk.Label ();
w21.Add (w24);
w20.Add (w21);
- this.stopbutton.Add (w20);
- this.buttonsbox.Add (this.stopbutton);
- global::Gtk.Box.BoxChild w28 = ((global::Gtk.Box.BoxChild)(this.buttonsbox
[this.stopbutton]));
+ this.finishbutton.Add (w20);
+ this.buttonsbox.Add (this.finishbutton);
+ global::Gtk.Box.BoxChild w28 = ((global::Gtk.Box.BoxChild)(this.buttonsbox
[this.finishbutton]));
w28.Position = 2;
w28.Expand = false;
w28.Fill = false;
- this.hbox2.Add (this.buttonsbox);
- global::Gtk.Box.BoxChild w29 = ((global::Gtk.Box.BoxChild)(this.hbox2
[this.buttonsbox]));
- w29.Position = 0;
- w29.Expand = false;
- w29.Fill = false;
+ // Container child buttonsbox.Gtk.Box+BoxChild
+ this.cancelbutton = new global::Gtk.Button ();
+ this.cancelbutton.TooltipMarkup = "Close current capture";
+ this.cancelbutton.CanFocus = true;
+ this.cancelbutton.Name = "cancelbutton";
+ this.cancelbutton.UseUnderline = true;
+ // Container child cancelbutton.Gtk.Container+ContainerChild
+ global::Gtk.Alignment w29 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
+ global::Gtk.HBox w30 = new global::Gtk.HBox ();
+ w30.Spacing = 2;
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ global::Gtk.Image w31 = new global::Gtk.Image ();
+ w31.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-stop",
global::Gtk.IconSize.Dialog);
+ w30.Add (w31);
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ global::Gtk.Label w33 = new global::Gtk.Label ();
+ w30.Add (w33);
+ w29.Add (w30);
+ this.cancelbutton.Add (w29);
+ this.buttonsbox.Add (this.cancelbutton);
+ global::Gtk.Box.BoxChild w37 = ((global::Gtk.Box.BoxChild)(this.buttonsbox
[this.cancelbutton]));
+ w37.Position = 3;
+ w37.Expand = false;
+ w37.Fill = false;
+ this.GtkAlignment.Add (this.buttonsbox);
+ this.frame1.Add (this.GtkAlignment);
+ this.GtkLabel3 = new global::Gtk.Label ();
+ this.GtkLabel3.Name = "GtkLabel3";
+ this.GtkLabel3.UseMarkup = true;
+ this.frame1.LabelWidget = this.GtkLabel3;
+ this.hbox2.Add (this.frame1);
+ global::Gtk.Box.BoxChild w40 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.frame1]));
+ w40.Position = 0;
+ w40.Expand = false;
+ w40.Fill = false;
// Container child hbox2.Gtk.Box+BoxChild
this.timelabel = new global::Gtk.Label ();
this.timelabel.Name = "timelabel";
this.timelabel.LabelProp = "Time: 0:00:00";
this.timelabel.UseMarkup = true;
this.hbox2.Add (this.timelabel);
- global::Gtk.Box.BoxChild w30 = ((global::Gtk.Box.BoxChild)(this.hbox2
[this.timelabel]));
- w30.PackType = ((global::Gtk.PackType)(1));
- w30.Position = 1;
+ global::Gtk.Box.BoxChild w41 = ((global::Gtk.Box.BoxChild)(this.hbox2
[this.timelabel]));
+ w41.PackType = ((global::Gtk.PackType)(1));
+ w41.Position = 1;
this.vbox1.Add (this.hbox2);
- global::Gtk.Box.BoxChild w31 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.hbox2]));
- w31.Position = 1;
- w31.Expand = false;
- w31.Fill = false;
+ global::Gtk.Box.BoxChild w42 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.hbox2]));
+ w42.Position = 1;
+ w42.Expand = false;
this.Add (this.vbox1);
if ((this.Child != null)) {
this.Child.ShowAll ();
}
- this.pausebutton.Hide ();
this.stopbutton.Hide ();
+ this.finishbutton.Hide ();
this.Show ();
}
}
diff --git a/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic b/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
index f55494a..87e24a8 100644
--- a/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
@@ -433,57 +433,97 @@
<property name="MemberName" />
<property name="Spacing">6</property>
<child>
- <widget class="Gtk.HBox" id="buttonsbox">
+ <widget class="Gtk.Frame" id="frame1">
<property name="MemberName" />
- <property name="Spacing">6</property>
+ <property name="ShadowType">None</property>
<child>
- <widget class="Gtk.Button" id="recbutton">
+ <widget class="Gtk.Alignment" id="GtkAlignment">
<property name="MemberName" />
- <property name="Tooltip" translatable="yes">Start or continue capture</property>
- <property name="Type">TextAndIcon</property>
- <property name="Icon">stock:gtk-media-record Dialog</property>
- <property name="Label" translatable="yes" />
- <property name="UseUnderline">True</property>
- </widget>
- <packing>
- <property name="Position">0</property>
- <property name="AutoSize">False</property>
- <property name="Expand">False</property>
- <property name="Fill">False</property>
- </packing>
- </child>
- <child>
- <widget class="Gtk.Button" id="pausebutton">
- <property name="MemberName" />
- <property name="Visible">False</property>
- <property name="Tooltip" translatable="yes">Pause capture</property>
- <property name="Type">TextAndIcon</property>
- <property name="Icon">stock:gtk-media-pause Dialog</property>
- <property name="Label" translatable="yes" />
- <property name="UseUnderline">True</property>
+ <property name="Xalign">0</property>
+ <property name="Yalign">0</property>
+ <property name="LeftPadding">12</property>
+ <child>
+ <widget class="Gtk.HBox" id="buttonsbox">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.Button" id="recbutton">
+ <property name="MemberName" />
+ <property name="Tooltip" translatable="yes">Start capturing new period</property>
+ <property name="Type">TextAndIcon</property>
+ <property name="Icon">stock:gtk-media-record Dialog</property>
+ <property name="Label" translatable="yes" />
+ <property name="UseUnderline">True</property>
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">False</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="stopbutton">
+ <property name="MemberName" />
+ <property name="Visible">False</property>
+ <property name="Tooltip" translatable="yes">Stop capturing current
period</property>
+ <property name="Type">TextAndIcon</property>
+ <property name="Icon">stock:gtk-media-stop Dialog</property>
+ <property name="Label" translatable="yes" />
+ <property name="UseUnderline">True</property>
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">False</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="finishbutton">
+ <property name="MemberName" />
+ <property name="Visible">False</property>
+ <property name="Tooltip" translatable="yes">End capture</property>
+ <property name="Type">TextAndIcon</property>
+ <property name="Icon">stock:gtk-ok Dialog</property>
+ <property name="Label" translatable="yes" />
+ <property name="UseUnderline">True</property>
+ </widget>
+ <packing>
+ <property name="Position">2</property>
+ <property name="AutoSize">False</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="cancelbutton">
+ <property name="MemberName" />
+ <property name="Tooltip" translatable="yes">Close current capture</property>
+ <property name="CanFocus">True</property>
+ <property name="Type">TextAndIcon</property>
+ <property name="Icon">stock:gtk-stop Dialog</property>
+ <property name="Label" translatable="yes" />
+ <property name="UseUnderline">True</property>
+ </widget>
+ <packing>
+ <property name="Position">3</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
</widget>
- <packing>
- <property name="Position">1</property>
- <property name="AutoSize">False</property>
- <property name="Expand">False</property>
- <property name="Fill">False</property>
- </packing>
</child>
<child>
- <widget class="Gtk.Button" id="stopbutton">
+ <widget class="Gtk.Label" id="GtkLabel3">
<property name="MemberName" />
- <property name="Visible">False</property>
- <property name="Tooltip" translatable="yes">Stop and close capture</property>
- <property name="Type">TextAndIcon</property>
- <property name="Icon">stock:gtk-media-stop Dialog</property>
- <property name="Label" translatable="yes" />
- <property name="UseUnderline">True</property>
+ <property name="UseMarkup">True</property>
</widget>
<packing>
- <property name="Position">2</property>
- <property name="AutoSize">False</property>
- <property name="Expand">False</property>
- <property name="Fill">False</property>
+ <property name="type">label_item</property>
</packing>
</child>
</widget>
@@ -511,7 +551,6 @@
<property name="Position">1</property>
<property name="AutoSize">False</property>
<property name="Expand">False</property>
- <property name="Fill">False</property>
</packing>
</child>
</widget>
diff --git a/LongoMatch.GUI.Multimedia/gtk-gui/objects.xml b/LongoMatch.GUI.Multimedia/gtk-gui/objects.xml
index 838558d..949d29c 100644
--- a/LongoMatch.GUI.Multimedia/gtk-gui/objects.xml
+++ b/LongoMatch.GUI.Multimedia/gtk-gui/objects.xml
@@ -1,6 +1,10 @@
<objects attr-sync="on">
<object type="LongoMatch.Gui.CapturerBin" palette-category="General" allow-children="false"
base-type="Gtk.Bin">
- <itemgroups />
+ <itemgroups>
+ <itemgroup label="CapturerBin Properties">
+ <property name="Capturing" />
+ </itemgroup>
+ </itemgroups>
<signals>
<itemgroup label="ICapturerBin Signals">
<signal name="CaptureFinished" />
diff --git a/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
b/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
index 3b27897..0a428c2 100644
--- a/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
+++ b/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
@@ -134,8 +134,6 @@ namespace LongoMatch.Gui.Component
public void SetProject(Project project, ProjectType projectType, CaptureSettings props,
PlaysFilter filter)
{
- bool isLive = false;
-
openedProject = project;
this.projectType = projectType;
@@ -145,8 +143,8 @@ namespace LongoMatch.Gui.Component
CreatePreviewUI ();
}
- codingwidget.SetProject (project, isLive, filter);
- playsSelection.SetProject (project, isLive, filter);
+ codingwidget.SetProject (project, projectType, filter);
+ playsSelection.SetProject (project, filter);
}
void CreateCodingUI () {
@@ -197,6 +195,8 @@ namespace LongoMatch.Gui.Component
playercapturer.Mode = PlayerCapturerBin.PlayerOperationMode.Player;
} else {
playercapturer.Mode = PlayerCapturerBin.PlayerOperationMode.PreviewCapturer;
+ playercapturer.PeriodsNames = openedProject.Categories.GamePeriods;
+ playercapturer.PeriodsTimers = openedProject.Periods;
}
centralpane.Show ();
diff --git a/LongoMatch.GUI/Gui/Component/CodingWidget.cs b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
index a4d47fd..53b47de 100644
--- a/LongoMatch.GUI/Gui/Component/CodingWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
@@ -31,6 +31,7 @@ namespace LongoMatch.Gui.Component
VideoAnalysisMode analysisMode;
TeamTagger teamtagger;
Project project;
+ ProjectType projectType;
public CodingWidget ()
{
@@ -64,30 +65,36 @@ namespace LongoMatch.Gui.Component
base.OnDestroyed ();
}
- public void SetProject (Project project, bool isLive, PlaysFilter filter) {
+ public void SetProject (Project project, ProjectType projectType, PlaysFilter filter) {
this.project = project;
+ this.projectType = projectType;
autoTaggingMode.Active = true;
- timeline.Visible = false;
buttonswidget.Visible = true;
+ timeline.Visible = false;
+ playspositionviewer1.Visible = false;
buttonswidget.Project = project;
teamtagger.LoadTeams (project.LocalTeamTemplate, project.VisitorTeamTemplate,
project.Categories.FieldBackground);
- timeline.SetProject (project, filter);
+ if (projectType != ProjectType.FileProject) {
+ timelineMode.Visible = false;
+ } else {
+ timelineMode.Visible = true;
+ timeline.SetProject (project, filter);
+ }
playspositionviewer1.LoadProject (project);
}
- public AnalysisComponent AnalysisComponentParent {
- set;
- protected get;
- }
-
public void AddPlay(Play play) {
- timeline.AddPlay(play);
+ if (projectType == ProjectType.FileProject) {
+ timeline.AddPlay(play);
+ }
playspositionviewer1.AddPlay (play);
}
public void DeletePlays (List<Play> plays) {
- timeline.RemovePlays(plays);
+ if (projectType == ProjectType.FileProject) {
+ timeline.RemovePlays(plays);
+ }
playspositionviewer1.RemovePlays (plays);
}
@@ -95,33 +102,6 @@ namespace LongoMatch.Gui.Component
buttonswidget.Project = project;
}
- public VideoAnalysisMode AnalysisMode {
- set {
- buttonswidget.Visible = (value == VideoAnalysisMode.ManualTagging) ||
- (value == VideoAnalysisMode.PredefinedTagging);
- drawingarea1.Visible = buttonswidget.Visible;
- timeline.Visible = value == VideoAnalysisMode.Timeline;
- if(value == VideoAnalysisMode.ManualTagging)
- buttonswidget.Mode = TagMode.Free;
- else if (value == VideoAnalysisMode.ManualTagging)
- buttonswidget.Mode = TagMode.Predifined;
- analysisMode = value;
- timeline.Visible = true;
- }
- protected get {
- return analysisMode;
- }
- }
-
- public bool WidgetsVisible {
- set {
- timeline.Visible = value && AnalysisMode == VideoAnalysisMode.Timeline;
- buttonswidget.Visible = value && (AnalysisMode ==
VideoAnalysisMode.ManualTagging ||
- AnalysisMode ==
VideoAnalysisMode.PredefinedTagging);
- drawingarea1.Visible = buttonswidget.Visible;
- }
- }
-
void HandleViewToggled (object sender, EventArgs e)
{
buttonswidget.Visible = autoTaggingMode.Active;
diff --git a/LongoMatch.GUI/Gui/Component/PlayersListTreeWidget.cs
b/LongoMatch.GUI/Gui/Component/PlayersListTreeWidget.cs
index 4340275..9307299 100644
--- a/LongoMatch.GUI/Gui/Component/PlayersListTreeWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/PlayersListTreeWidget.cs
@@ -50,12 +50,6 @@ namespace LongoMatch.Gui.Component
}
}
- public bool ProjectIsLive {
- set {
- playerstreeview.ProjectIsLive = value;
- }
- }
-
public PlaysFilter Filter {
set{
playerstreeview.Filter = value;
diff --git a/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs
b/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs
index 4a67336..b366169 100644
--- a/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/PlaysListTreeWidget.cs
@@ -103,12 +103,6 @@ namespace LongoMatch.Gui.Component
treeview.Selection.SelectIter(playIter);
}
- public bool ProjectIsLive {
- set {
- treeview.ProjectIsLive = value;
- }
- }
-
public Project Project {
set {
project = value;
diff --git a/LongoMatch.GUI/Gui/Component/PlaysSelectionWidget.cs
b/LongoMatch.GUI/Gui/Component/PlaysSelectionWidget.cs
index cf0c67e..7f94e33 100644
--- a/LongoMatch.GUI/Gui/Component/PlaysSelectionWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/PlaysSelectionWidget.cs
@@ -47,12 +47,9 @@ namespace LongoMatch.Gui.Component
#region Plubic Methods
- public void SetProject(Project project, bool isLive, PlaysFilter filter) {
+ public void SetProject(Project project, PlaysFilter filter) {
this.project = project;
this.filter = filter;
- playsList.ProjectIsLive = isLive;
- localPlayersList.ProjectIsLive = isLive;
- visitorPlayersList.ProjectIsLive = isLive;
playsList.Filter = filter;
localPlayersList.Filter = filter;
visitorPlayersList.Filter = filter;
diff --git a/LongoMatch.GUI/Gui/Component/ProjectPeriods.cs b/LongoMatch.GUI/Gui/Component/ProjectPeriods.cs
index a0d0254..573f078 100644
--- a/LongoMatch.GUI/Gui/Component/ProjectPeriods.cs
+++ b/LongoMatch.GUI/Gui/Component/ProjectPeriods.cs
@@ -61,21 +61,22 @@ namespace LongoMatch.Gui.Component
start = new Time (0);
duration = value.Description.File.Duration;
pDuration = new Time (duration.MSeconds / gamePeriods.Count);
- List<Timer> timers = new List<Timer> ();
+ List<Period> periods = new List<Period> ();
gamePeriods = value.Categories.GamePeriods;
timerule.Duration = duration;
SetZoom ();
playerbin2.Open (value.Description.File.FilePath);
-
+
foreach (string s in gamePeriods) {
- Timer timer = new Timer {Name = s};
- timer.Start (start);
- timer.Stop (start + pDuration);
- timers.Add (timer);
+ Period period = new Period {Name = s};
+ period.Start (start);
+ period.Stop (start + pDuration);
+ periods.Add (period);
start += pDuration;
}
- timersTimenline.LoadTimers (timers, duration, false);
+ value.Periods = periods;
+ timersTimenline.LoadPeriods (periods, duration);
}
}
diff --git a/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs b/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs
index ca418a4..9cfb845 100644
--- a/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs
+++ b/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs
@@ -43,7 +43,6 @@ namespace LongoMatch.Gui.Component
protected Gtk.CellRendererText nameCell;
protected Gtk.TreeViewColumn nameColumn;
protected bool editing;
- protected bool projectIsLive;
protected bool enableCategoryMove = false;
TreeModelFilter modelFilter;
@@ -60,7 +59,6 @@ namespace LongoMatch.Gui.Component
HeadersVisible = false;
SetMenu();
- ProjectIsLive = false;
PlayListLoaded = false;
nameColumn = new Gtk.TreeViewColumn();
@@ -78,14 +76,6 @@ namespace LongoMatch.Gui.Component
}
- public bool ProjectIsLive {
- set {
- projectIsLive = value;
- addPLN.Visible = !projectIsLive;
- snapshot.Visible = !projectIsLive;
- }
- }
-
public bool Colors {
get;
set;
diff --git a/LongoMatch.GUI/gtk-gui/gui.stetic b/LongoMatch.GUI/gtk-gui/gui.stetic
index 0c58c88..5635f56 100644
--- a/LongoMatch.GUI/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI/gtk-gui/gui.stetic
@@ -6052,6 +6052,7 @@ You can continue with the current capture, cancel it or save your project.
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="Label" translatable="yes">New project using a video
file</property>
+ <property name="Active">True</property>
<property name="DrawIndicator">True</property>
<property name="HasLabel">True</property>
<property name="UseUnderline">True</property>
@@ -9258,6 +9259,17 @@ Click 2 players to swap them</property>
</child>
</widget>
<widget class="Gtk.Bin" id="LongoMatch.Gui.Component.CodingWidget" design-size="673 300">
+ <action-group name="Timeline">
+ <action id="positionMode">
+ <property name="Type">Radio</property>
+ <property name="Label" translatable="yes" />
+ <property name="StockId">gtk-justify-fill</property>
+ <property name="DrawAsRadio">False</property>
+ <property name="Active">False</property>
+ <property name="Value">0</property>
+ <property name="Group">codingmode</property>
+ </action>
+ </action-group>
<action-group name="Default">
<action id="timelineMode">
<property name="Type">Radio</property>
@@ -9294,17 +9306,6 @@ Click 2 players to swap them</property>
<property name="Group">codingmode</property>
</action>
</action-group>
- <action-group name="Timeline">
- <action id="positionMode">
- <property name="Type">Radio</property>
- <property name="Label" translatable="yes" />
- <property name="StockId">gtk-justify-fill</property>
- <property name="DrawAsRadio">False</property>
- <property name="Active">False</property>
- <property name="Value">0</property>
- <property name="Group">codingmode</property>
- </action>
- </action-group>
<property name="MemberName" />
<property name="Visible">False</property>
<child>
diff --git a/LongoMatch.Services/Services/ProjectsManager.cs b/LongoMatch.Services/Services/ProjectsManager.cs
index 217803c..127ab98 100644
--- a/LongoMatch.Services/Services/ProjectsManager.cs
+++ b/LongoMatch.Services/Services/ProjectsManager.cs
@@ -161,8 +161,6 @@ namespace LongoMatch.Services
"saved. Try to import it later:\n")+
filePath+"\n"+projectFile);
}
- CloseOpenedProject (false);
- OpenProjectID (projectID);
}
bool SetProject(Project project, ProjectType projectType, CaptureSettings props)
@@ -187,7 +185,12 @@ namespace LongoMatch.Services
Player.SegmentClosedEvent += Config.EventsBroker.EmitSegmentClosed;
}
if (Capturer != null) {
- Capturer.CaptureFinished += (sender, e) =>
Config.EventsBroker.EmitCloseOpenedProject();
+ Capturer.CaptureFinished += (close) => {
+ CloseOpenedProject (!close);
+ if (!close) {
+ OpenProjectID (project.ID);
+ }
+ };
if (Capturer != Player)
Capturer.Error += HandleMultimediaError;
}
@@ -289,14 +292,16 @@ namespace LongoMatch.Services
if(OpenedProject == null)
return;
- if (save)
- SaveProject(OpenedProject, OpenedProjectType);
-
Log.Debug ("Closing project " + OpenedProject.ID);
- if(OpenedProjectType != ProjectType.FileProject)
+ if(OpenedProjectType != ProjectType.FileProject) {
+ Capturer.Stop();
Capturer.Close();
- else
+ } else {
Player.Close();
+ }
+
+ if (save)
+ SaveProject(OpenedProject, OpenedProjectType);
if(OpenedProject != null)
OpenedProject.Clear();
@@ -421,9 +426,6 @@ namespace LongoMatch.Services
if (Capturer == null)
return;
switch(key) {
- case Constants.TOGGLE_PLAY:
- Capturer.TogglePause();
- break;
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]