[longomatch] Revert "Start refactoring"
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [longomatch] Revert "Start refactoring"
- Date: Mon, 2 Nov 2009 00:05:23 +0000 (UTC)
commit 003aad52cbb303f98469ad7e5c83b9a877ff4160
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Mon Nov 2 01:05:02 2009 +0100
Revert "Start refactoring"
This reverts commit eafa2539a6fd737eda91149626830e1c3cfbbb48.
LongoMatch/DB/Project.cs | 41 ++++++--------
LongoMatch/Time/Drawing.cs | 6 --
LongoMatch/Time/HotKey.cs | 28 ++++------
LongoMatch/Time/MediaTimeNode.cs | 103 ++++++-----------------------------
LongoMatch/Time/PlayListTimeNode.cs | 12 ++--
LongoMatch/Time/Player.cs | 11 +---
LongoMatch/Time/Time.cs | 38 ++++++++------
LongoMatch/Time/TimeNode.cs | 60 ++++++++++++--------
8 files changed, 112 insertions(+), 187 deletions(-)
---
diff --git a/LongoMatch/DB/Project.cs b/LongoMatch/DB/Project.cs
index 312ee25..5e99c95 100644
--- a/LongoMatch/DB/Project.cs
+++ b/LongoMatch/DB/Project.cs
@@ -62,11 +62,9 @@ namespace LongoMatch.DB
//Keep this fiel for DB retrocompatibility
private List<MediaTimeNode>[] dataSectionArray;
- #region Constructors
- public Project(PreviewMediaFile file, String localName, String visitorName,
- String season, String competition, int localGoals,
- int visitorGoals, DateTime matchDate, Sections sections,
- TeamTemplate localTeamTemplate, TeamTemplate visitorTeamTemplate) {
+
+ public Project(PreviewMediaFile file, String localName, String visitorName, String season, String competition, int localGoals,
+ int visitorGoals, DateTime matchDate, Sections sections, TeamTemplate localTeamTemplate, TeamTemplate visitorTeamTemplate) {
this.file = file;
this.localName = localName;
@@ -87,9 +85,21 @@ namespace LongoMatch.DB
this.Title = System.IO.Path.GetFileNameWithoutExtension(this.file.FilePath);
}
- #endregion
- #region Properties
+ public void Clear(){
+ //Help the GC freeing objects
+ foreach (List<MediaTimeNode> list in sectionPlaysList)
+ list.Clear();
+ sectionPlaysList.Clear();
+ Sections.Clear();
+ visitorTeamTemplate.Clear();
+ localTeamTemplate.Clear();
+ sectionPlaysList=null;
+ Sections=null;
+ visitorTeamTemplate=null;
+ localTeamTemplate=null;
+ }
+
public PreviewMediaFile File {
get{return file;}
set{file=value;}
@@ -149,22 +159,6 @@ namespace LongoMatch.DB
get{return visitorTeamTemplate;}
set{visitorTeamTemplate=value;}
}
- #endregion
-
- #region Public Methods
- public void Clear(){
- //Help the GC freeing objects
- foreach (List<MediaTimeNode> list in sectionPlaysList)
- list.Clear();
- sectionPlaysList.Clear();
- Sections.Clear();
- visitorTeamTemplate.Clear();
- localTeamTemplate.Clear();
- sectionPlaysList=null;
- Sections=null;
- visitorTeamTemplate=null;
- localTeamTemplate=null;
- }
public void AddSection(SectionsTimeNode tn){
AddSectionAtPos(tn,sections.Count);
@@ -270,6 +264,5 @@ namespace LongoMatch.DB
else
throw new ArgumentException("object is not a Project and cannot be compared");
}
- #endregion
}
}
diff --git a/LongoMatch/Time/Drawing.cs b/LongoMatch/Time/Drawing.cs
index a1f0f94..a6a0aca 100644
--- a/LongoMatch/Time/Drawing.cs
+++ b/LongoMatch/Time/Drawing.cs
@@ -21,12 +21,6 @@ using Gdk;
namespace LongoMatch.TimeNodes
{
- /* Represent a drawing in the database using a { Gdk Pixbuf} stored
- in a bytes array in PNG format for serialization. { Drawings}
- are used by { MediaTimeNodes} to store the key frame drawing
- which stop time time is stored in a int value
- */
-
[Serializable]
public class Drawing
{
diff --git a/LongoMatch/Time/HotKey.cs b/LongoMatch/Time/HotKey.cs
index 9e762ac..9f666d2 100644
--- a/LongoMatch/Time/HotKey.cs
+++ b/LongoMatch/Time/HotKey.cs
@@ -28,25 +28,22 @@ using Mono.Unix;
namespace LongoMatch.TimeNodes
{
- /* Represent a key combination shortcut used to tag plays using the keyboard
- using an int to map to a { Gdk Key} and another int to map to a { Gdk Modifier}
- Only Shift and Alt can be used as modifiers.
- When a hotkey is not defined key and modifier are set to -1
- */
+
public class HotKey : IEquatable<HotKey>
{
private int key;
private int modifier;
- #region Constructors
+#region Constructors
public HotKey()
{
this.key = -1;
this.modifier = -1;
}
- #endregion
+#endregion
+
- #region Properties
+#region Properties
public Gdk.Key Key{
get{return (Gdk.Key)key;}
set{key = (int)value;}
@@ -60,25 +57,22 @@ namespace LongoMatch.TimeNodes
public Boolean Defined{
get{return (key!=-1 && modifier != -1);}
}
- #endregion
- #region Public Methods
public bool Equals(HotKey hotkeyComp){
return (this.Key == hotkeyComp.Key && this.Modifier == hotkeyComp.Modifier);
}
- #endregion
- #region Operators
static public bool operator == (HotKey hk1, HotKey hk2){
return hk1.Equals(hk2);
}
static public bool operator != (HotKey hk1, HotKey hk2){
return !hk1.Equals(hk2);
- }
- #endregion
+ }
+
+#endregion
- #region Overrides
+#region Override
public override bool Equals (object obj)
{
HotKey hotkey= obj as HotKey;
@@ -92,6 +86,7 @@ namespace LongoMatch.TimeNodes
{
return key ^ modifier;
}
+
public override string ToString ()
{
@@ -105,6 +100,7 @@ namespace LongoMatch.TimeNodes
return string.Format("<{0}>+{1}", modifierS,(Key.ToString()).ToLower());
}
- #endregion
+
+#endregion
}
}
diff --git a/LongoMatch/Time/MediaTimeNode.cs b/LongoMatch/Time/MediaTimeNode.cs
index 4b03337..2aa0a11 100644
--- a/LongoMatch/Time/MediaTimeNode.cs
+++ b/LongoMatch/Time/MediaTimeNode.cs
@@ -30,10 +30,11 @@ namespace LongoMatch.TimeNodes
VISITOR = 2,
}
- /* Plays are represented and stored in the database using { MediaTimeNode} objects.
- It stores the name and the start and stop { Time} of a play and
- it's used to replay the video segment of the play. A play can have
- tagged several players storing the { Player} number in a list.
+ /* MediaTimeNode is the main object of the database for { LongoMatch} It' s used to
+ store the name of each reference point we want to remind with its start time
+ and its stop time, and the data type it belowns to. When we mark a segment in the
+ video, this object contains all the information we need to reproduce the
+ video sequence again.
*/
[Serializable]
public class MediaTimeNode : PixbufTimeNode
@@ -52,7 +53,7 @@ namespace LongoMatch.TimeNodes
private string notes;
- private List<int> localPlayersList; //Used for multitagging: one play and several players
+ private List<int> localPlayersList; //Used to multitag: one play and several players
// We use the int index of the player in the template,
private List<int> visitorPlayersList;// because it's the only unmutable variable
@@ -60,7 +61,7 @@ namespace LongoMatch.TimeNodes
- #region Constructors
+#region Constructors
public MediaTimeNode(String name, Time start, Time stop,string notes, uint fps,Pixbuf thumbnail):base (name,start,stop,thumbnail) {
this.notes = notes;
this.team = Team.NONE;
@@ -72,63 +73,31 @@ namespace LongoMatch.TimeNodes
}
#endregion
- #region Properties
- /**
- * Get/Set the notes of a play
- *
- * @returns Stop { Time}
- */
+ #region Properties
+
public string Notes {
get{return notes;}
set{notes = value;}
}
-
- /**
- * Get/Set the { Team}
- *
- * @returns Stop { Time}
- */
+
public Team Team{
get{return this.team;}
set{this.team = value;}
}
- /**
- * Get/Set the frames per second. This value is taken from the
- * video file properties and used to translate from seconds
- * to frames, for instance second 100 is equivalent to frame
- * 100*fps
- *
- * @returns Stop { Time}
- */
public uint Fps{
get{return this.fps;}
set{this.fps = value;}
}
- /**
- * Get the central frame (stop-start)/2
- *
- * @returns Stop { Time}
- */
public uint CentralFrame{
get{ return this.StopFrame-((this.TotalFrames)/2);}
}
- /**
- * Get the numbers of frames between the start and stop time
- *
- * @returns Stop { Time}
- */
public uint TotalFrames{
get{return this.StopFrame-this.StartFrame;}
}
- /**
- * Get/Set the start frame
- *
- * @returns Stop { Time}
- */
public uint StartFrame {
get {return startFrame;}
set {
@@ -137,11 +106,6 @@ namespace LongoMatch.TimeNodes
}
}
- /**
- * Get/Set the stop frame
- *
- * @returns Stop { Time}
- */
public uint StopFrame {
get {return stopFrame;}
set {
@@ -150,11 +114,6 @@ namespace LongoMatch.TimeNodes
}
}
- /**
- * Get the key frame number if this play as key frame drawing or 0
- *
- * @returns Stop { Time}
- */
public uint KeyFrame{
get {
if (HasKeyFrame)
@@ -163,21 +122,11 @@ namespace LongoMatch.TimeNodes
}
}
- /**
- * Get/Set wheter a this play is actually loaded
- *
- * @returns Stop { Time}
- */
public bool Selected {
get {return selected;}
set{this.selected = value;}
}
- /**
- * Get/Set
- *
- * @returns Stop { Time}
- */
public List<int> LocalPlayers{
set {localPlayersList = value;}
get{return localPlayersList;}
@@ -195,54 +144,34 @@ namespace LongoMatch.TimeNodes
public bool HasKeyFrame{
get{return keyFrame != null;}
- }
+ }
+
+
+
#endregion
#region Public methods
- /**
- * Returns true is the frame number is in the play span
- *
- * @returns frame { boo}
- */
+
public bool HasFrame(int frame){
return (frame>=startFrame && frame<stopFrame);
}
- /**
- * Adds a local player to the local team player's list
- *
- * @param index { Player} number
- */
public void AddLocalPlayer(int index){
localPlayersList.Add(index);
}
- /**
- * Adds a visitor player to the visitor team player's list
- *
- * @param index { Player} number
- */
public void AddVisitorPlayer(int index){
visitorPlayersList.Add(index);
}
- /**
- * Removes a local player from the local team player's list
- *
- * @param index { Player} number
- */
public void RemoveLocalPlayer(int index){
localPlayersList.Remove(index);
}
- /**
- * Removes a visitor player from the visitor team player's list
- *
- * @param index { Player} number
- */
public void RemoveVisitorPlayer(int index){
visitorPlayersList.Remove(index);
}
+
#endregion
}
}
diff --git a/LongoMatch/Time/PlayListTimeNode.cs b/LongoMatch/Time/PlayListTimeNode.cs
index 855ae7a..b272b79 100644
--- a/LongoMatch/Time/PlayListTimeNode.cs
+++ b/LongoMatch/Time/PlayListTimeNode.cs
@@ -24,8 +24,7 @@ using LongoMatch.Video.Utils;
namespace LongoMatch.TimeNodes
{
- /*Used in a { LongoMatch PlayList PlayList} to store a play or video segment
- */
+
[Serializable]
public class PlayListTimeNode : TimeNode
{
@@ -43,8 +42,8 @@ namespace LongoMatch.TimeNodes
}
#endregion
+ #region Properties
- #region Properties
public MediaFile MediaFile{
set{
//PlayListTimeNode is serializable and only primary classes
@@ -52,8 +51,8 @@ namespace LongoMatch.TimeNodes
//a new MediaFile object.
if (value is PreviewMediaFile){
MediaFile mf = new MediaFile(value.FilePath,value.Length,value.Fps,
- value.HasAudio,value.HasVideo,value.VideoCodec,
- value.AudioCodec,value.VideoWidth,value.VideoHeight);
+ value.HasAudio,value.HasVideo,value.VideoCodec,
+ value.AudioCodec,value.VideoWidth,value.VideoHeight);
this.mediaFile= mf;
}
else this.mediaFile = value;
@@ -64,7 +63,8 @@ namespace LongoMatch.TimeNodes
public float Rate{
set{ this.rate = value;}
get{ return this.rate;}
- }
+ }
+
public bool Valid{
get{return this.valid;}
diff --git a/LongoMatch/Time/Player.cs b/LongoMatch/Time/Player.cs
index ff86689..cc1f10e 100644
--- a/LongoMatch/Time/Player.cs
+++ b/LongoMatch/Time/Player.cs
@@ -21,8 +21,7 @@ using Gdk;
namespace LongoMatch.TimeNodes
{
- /* Represent a player in the database defined by its name, position in the field, number and photo
- */
+
[Serializable]
public class Player
{
@@ -30,8 +29,7 @@ namespace LongoMatch.TimeNodes
private string position;
private int number;
private byte[] photo;
-
- #region Constructors
+
public Player(string name, string position, int number, Pixbuf photo)
{
this.name = name;
@@ -39,9 +37,7 @@ namespace LongoMatch.TimeNodes
this.number = number;
Photo = photo;
}
- #endregion
-
- #region Properties
+
public string Name{
get{return name;}
set{name=value;}
@@ -71,6 +67,5 @@ namespace LongoMatch.TimeNodes
photo=null;
}
}
- #endregion
}
}
diff --git a/LongoMatch/Time/Time.cs b/LongoMatch/Time/Time.cs
index 838dd65..08a73a6 100644
--- a/LongoMatch/Time/Time.cs
+++ b/LongoMatch/Time/Time.cs
@@ -23,8 +23,7 @@ using System;
namespace LongoMatch.TimeNodes
{
- /* Represents a time instant. It's used to standarize the time units
- */
+
public class Time : IComparable
{
private int time;
@@ -41,8 +40,8 @@ namespace LongoMatch.TimeNodes
this.time = time;
}
#endregion
+ #region Properties
- #region Properties
public int MSeconds {
get { return time;}
set { time = value;}
@@ -50,10 +49,11 @@ namespace LongoMatch.TimeNodes
public int Seconds {
get { return time/SECONDS_TO_TIME;}
- }
+ }
+
#endregion
+ #region Public methods
- #region Public methods
public string ToSecondsString ()
{
int _h, _m, _s;
@@ -96,35 +96,39 @@ namespace LongoMatch.TimeNodes
public override int GetHashCode ()
{
return base.GetHashCode ();
- }
+ }
+
+
public int CompareTo(object obj) {
if(obj is Time)
{
Time otherTime = (Time) obj;
return MSeconds.CompareTo(otherTime.MSeconds);
- }
- else throw new ArgumentException("Object is not a Temperature");
- }
+ }
+
+ else
+ {
+ throw new ArgumentException("Object is not a Temperature");
+ }
+ }
+
#endregion
- #region Operators
+ #region Operators
+
public static bool operator < (Time t1,Time t2){
return t1.MSeconds < t2.MSeconds;
}
-
public static bool operator > (Time t1,Time t2){
return t1.MSeconds > t2.MSeconds;
}
-
public static bool operator <= (Time t1,Time t2){
return t1.MSeconds <= t2.MSeconds;
}
-
public static bool operator >= (Time t1,Time t2){
return t1.MSeconds >= t2.MSeconds;
}
-
public static Time operator +(Time t1,int t2){
return new Time(t1.MSeconds+t2);
}
@@ -139,7 +143,9 @@ namespace LongoMatch.TimeNodes
public static Time operator -(Time t1,int t2){
return new Time(t1.MSeconds-t2);
- }
+ }
+
#endregion
+
}
-}
\ No newline at end of file
+}
diff --git a/LongoMatch/Time/TimeNode.cs b/LongoMatch/Time/TimeNode.cs
index ad89cce..3139d3f 100644
--- a/LongoMatch/Time/TimeNode.cs
+++ b/LongoMatch/Time/TimeNode.cs
@@ -28,7 +28,7 @@ namespace LongoMatch.TimeNodes
[Serializable]
public class TimeNode
{
- //Stores the name of the play
+ //Stores the name of the refenrence point
private string name;
//Stores the start time
@@ -37,7 +37,7 @@ namespace LongoMatch.TimeNodes
//Stores the stop time
private Time stop;
- #region Constructors
+
public TimeNode(){
}
@@ -47,33 +47,44 @@ namespace LongoMatch.TimeNodes
this.start = start;
this.stop = stop;
}
- #endregion
- #region Properties
/**
- * Set/Get the name
+ * Returns a String object that represents the name of the reference point
*
* @returns name Name of the reference point
*/
public string Name {
- get{return this.name;}
- set{this.name=value;}
+ get{
+ return this.name;
+ }
+ set{
+ this.name=value;
+
+ }
}
+
+
/**
- * Set/Get the start { Time}
+ * Returns a Time object representing the start time of the video sequence
*
* @returns Start time
*/
public Time Start{
- get{return this.start;}
- set{ this.start=value;}
+ get{
+ return this.start;
+ }
+
+ set{
+ this.start=value;
+ }
+
}
/**
- * Set/Get the stop
+ * Returns a Time object representing the stop time of the video sequence
*
- * @returns Stop { Time}
+ * @returns Stop time
*/
public Time Stop {
get{
@@ -84,26 +95,27 @@ namespace LongoMatch.TimeNodes
}
}
- /**
- * Get the duration defined like start { Time} - stop { Time}
- *
- * @returns Stop { Time}
- */
public Time Duration {
get {return Stop-Start;}
- }
- #endregion
+ }
+
+
- #region Public methods
/**
- * Change the Start and Stop { Time}
+ * Returns a String object that represents the name of the reference point
*
* @returns name Name of the reference point
- */
- public void ChangeStartStop(Time start, Time stop) {
+ */
+ public string toString() {
+ return name;
+ }
+
+ public void changeStartStop(Time start, Time stop) {
this.start = start;
this.stop = stop;
}
- #endregion
+
+
+
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]