[longomatch] Improve hotkeys use in fake analysis
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Improve hotkeys use in fake analysis
- Date: Tue, 11 Nov 2014 17:59:47 +0000 (UTC)
commit 2ffb3bd0787e330f119bc602da7bae716dbf072f
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Mon Nov 10 18:08:53 2014 +0100
Improve hotkeys use in fake analysis
LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs | 38 +++++++++++++++++------
LongoMatch.Services/Services/EventsManager.cs | 14 +++++---
LongoMatch.Services/Services/ProjectsManager.cs | 1 -
3 files changed, 37 insertions(+), 16 deletions(-)
---
diff --git a/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs b/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs
index 0d61cd4..9031373 100644
--- a/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs
@@ -156,6 +156,11 @@ namespace LongoMatch.Gui
{
string periodName;
+ if (currentPeriod != null) {
+ string msg = Catalog.GetString ("Period recording already started");
+ Config.GUIToolkit.WarningMessage (msg, this);
+ return;
+ }
recbutton.Visible = false;
pausebutton.Visible = savebutton.Visible = stopbutton.Visible = true;
@@ -185,15 +190,18 @@ namespace LongoMatch.Gui
public void StopPeriod ()
{
- GLib.Source.Remove (timeoutID);
- if (currentPeriod != null) {
- currentPeriod.StopTimer (CurrentCaptureTime);
- accumTime = CurrentCaptureTime;
- Log.Debug ("Stop period stop=", accumTime.ToMSecondsString ());
+ if (currentPeriod == null) {
+ string msg = Catalog.GetString ("Period recording not started");
+ Config.GUIToolkit.WarningMessage (msg, this);
+ return;
}
+
+ GLib.Source.Remove (timeoutID);
+ currentPeriod.StopTimer (CurrentCaptureTime);
+ accumTime = CurrentCaptureTime;
+ Log.Debug ("Stop period stop=", accumTime.ToMSecondsString ());
currentTimeNode = null;
currentPeriod = null;
-
recbutton.Visible = true;
pausebutton.Visible = resumebutton.Visible = stopbutton.Visible = false;
if (Capturer != null && Capturing) {
@@ -204,10 +212,13 @@ namespace LongoMatch.Gui
public void PausePeriod ()
{
- if (currentPeriod != null) {
- Log.Debug ("Pause period at currentTime=",
CurrentCaptureTime.ToMSecondsString ());
- currentPeriod.PauseTimer (CurrentCaptureTime);
+ if (currentPeriod == null) {
+ string msg = Catalog.GetString ("Period recording not started");
+ Config.GUIToolkit.WarningMessage (msg, this);
+ return;
}
+ Log.Debug ("Pause period at currentTime=", CurrentCaptureTime.ToMSecondsString ());
+ currentPeriod.PauseTimer (CurrentCaptureTime);
currentTimeNode = null;
pausebutton.Visible = false;
resumebutton.Visible = true;
@@ -216,6 +227,11 @@ namespace LongoMatch.Gui
public void ResumePeriod ()
{
+ if (currentPeriod == null) {
+ string msg = Catalog.GetString ("Period recording not started");
+ Config.GUIToolkit.WarningMessage (msg, this);
+ return;
+ }
Log.Debug ("Resume period at currentTime=", CurrentCaptureTime.ToMSecondsString ());
currentTimeNode = currentPeriod.Resume (CurrentCaptureTime);
pausebutton.Visible = true;
@@ -299,7 +315,9 @@ namespace LongoMatch.Gui
public void Close ()
{
- StopPeriod ();
+ if (currentPeriod != null) {
+ StopPeriod ();
+ }
/* stopping and closing capturer */
if (Capturer != null) {
try {
diff --git a/LongoMatch.Services/Services/EventsManager.cs b/LongoMatch.Services/Services/EventsManager.cs
index 8a9a327..1524772 100644
--- a/LongoMatch.Services/Services/EventsManager.cs
+++ b/LongoMatch.Services/Services/EventsManager.cs
@@ -323,11 +323,15 @@ namespace LongoMatch.Services
}
if (!openedProject.Dashboard.DisablePopupWindow) {
- bool playing = player.Playing;
- player.Pause ();
- Config.GUIToolkit.EditPlay (play, openedProject, true, true, true, true);
- if (playing) {
- player.Play ();
+ if (player != null) {
+ bool playing = player.Playing;
+ player.Pause ();
+ Config.GUIToolkit.EditPlay (play, openedProject, true, true, true,
true);
+ if (playing) {
+ player.Play ();
+ }
+ } else {
+ Config.GUIToolkit.EditPlay (play, openedProject, true, true, true,
true);
}
}
diff --git a/LongoMatch.Services/Services/ProjectsManager.cs b/LongoMatch.Services/Services/ProjectsManager.cs
index 2d7e88a..ccea658 100644
--- a/LongoMatch.Services/Services/ProjectsManager.cs
+++ b/LongoMatch.Services/Services/ProjectsManager.cs
@@ -275,7 +275,6 @@ namespace LongoMatch.Services
Log.Debug ("Closing project " + OpenedProject.ID);
if (OpenedProjectType != ProjectType.FileProject) {
- Capturer.StopPeriod ();
Capturer.Close ();
} else {
Player.Close ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]