[chronojump] player added for all tests



commit 729bd3716b5f29f6a24af202e0b4b2cf2eb39077
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Feb 8 13:58:18 2011 +0100

    player added for all tests

 CesarPlayer/Gui/PlayerBin.cs                    |    4 +-
 CesarPlayer/gtk-gui/LongoMatch.Gui.PlayerBin.cs |   36 +++++-----
 glade/chronojump.glade                          |   82 ++++++++++++++++++++---
 src/gui/event.cs                                |   41 +++++++++++-
 src/gui/jump.cs                                 |    2 +
 src/gui/multiChronopic.cs                       |    1 +
 src/gui/pulse.cs                                |    1 +
 src/gui/reactionTime.cs                         |    1 +
 src/gui/run.cs                                  |    2 +
 9 files changed, 140 insertions(+), 30 deletions(-)
---
diff --git a/CesarPlayer/Gui/PlayerBin.cs b/CesarPlayer/Gui/PlayerBin.cs
index 7a99fc7..edc9c64 100644
--- a/CesarPlayer/Gui/PlayerBin.cs
+++ b/CesarPlayer/Gui/PlayerBin.cs
@@ -81,6 +81,7 @@ namespace LongoMatch.Gui
 			timescale.CanFocus = false;
 			vscale1.CanFocus = false;	
 			drawbutton.CanFocus = false;
+			drawbutton.Visible = false;
 			seeksQueue = new double[2];
 			seeksQueue [0] = -1;
 			seeksQueue [1] = -1;
@@ -314,7 +315,8 @@ namespace LongoMatch.Gui
 			vscale1.Value=25;
 			//timescale.Sensitive = true;
 			slength = TimeString.MSecondsToSecondsString(length);
-			SegmentClosedEvent();
+			if (SegmentClosedEvent != null)
+				SegmentClosedEvent();
 			player.CancelProgramedStop();			
 		}
 		
diff --git a/CesarPlayer/gtk-gui/LongoMatch.Gui.PlayerBin.cs b/CesarPlayer/gtk-gui/LongoMatch.Gui.PlayerBin.cs
index cf1eaf0..0de8ff6 100644
--- a/CesarPlayer/gtk-gui/LongoMatch.Gui.PlayerBin.cs
+++ b/CesarPlayer/gtk-gui/LongoMatch.Gui.PlayerBin.cs
@@ -84,12 +84,12 @@ namespace LongoMatch.Gui
 			global::Gtk.Label w6 = new global::Gtk.Label ();
 			w3.Add (w6);
 			w2.Add (w3);
-			this.closebutton.Add (w2);
-			this.buttonsbox.Add (this.closebutton);
-			global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.buttonsbox[this.closebutton]));
-			w10.Position = 0;
-			w10.Expand = false;
-			w10.Fill = false;
+			//this.closebutton.Add (w2);
+			//this.buttonsbox.Add (this.closebutton);
+			//global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.buttonsbox[this.closebutton]));
+			//w10.Position = 0;
+			//w10.Expand = false;
+			//w10.Fill = false;
 			// Container child buttonsbox.Gtk.Box+BoxChild
 			this.drawbutton = new global::Gtk.Button ();
 			this.drawbutton.Name = "drawbutton";
@@ -107,12 +107,12 @@ namespace LongoMatch.Gui
 			global::Gtk.Label w15 = new global::Gtk.Label ();
 			w12.Add (w15);
 			w11.Add (w12);
-			this.drawbutton.Add (w11);
-			this.buttonsbox.Add (this.drawbutton);
-			global::Gtk.Box.BoxChild w19 = ((global::Gtk.Box.BoxChild)(this.buttonsbox[this.drawbutton]));
-			w19.Position = 1;
-			w19.Expand = false;
-			w19.Fill = false;
+			//this.drawbutton.Add (w11);
+			//this.buttonsbox.Add (this.drawbutton);
+			//global::Gtk.Box.BoxChild w19 = ((global::Gtk.Box.BoxChild)(this.buttonsbox[this.drawbutton]));
+			//w19.Position = 1;
+			//w19.Expand = false;
+			//w19.Fill = false;
 			// Container child buttonsbox.Gtk.Box+BoxChild
 			this.playbutton = new global::Gtk.Button ();
 			this.playbutton.Name = "playbutton";
@@ -263,12 +263,12 @@ namespace LongoMatch.Gui
 			global::Gtk.Label w64 = new global::Gtk.Label ();
 			w61.Add (w64);
 			w60.Add (w61);
-			this.volumebutton.Add (w60);
-			this.controlsbox.Add (this.volumebutton);
-			global::Gtk.Box.BoxChild w68 = ((global::Gtk.Box.BoxChild)(this.controlsbox[this.volumebutton]));
-			w68.Position = 4;
-			w68.Expand = false;
-			w68.Fill = false;
+			//this.volumebutton.Add (w60);
+			//this.controlsbox.Add (this.volumebutton);
+			//global::Gtk.Box.BoxChild w68 = ((global::Gtk.Box.BoxChild)(this.controlsbox[this.volumebutton]));
+			//w68.Position = 4;
+			//w68.Expand = false;
+			//w68.Fill = false;
 			this.vbox2.Add (this.controlsbox);
 			global::Gtk.Box.BoxChild w69 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.controlsbox]));
 			w69.Position = 1;
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index eadbdf8..019fd34 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -11527,7 +11527,7 @@ Test&lt;/b&gt;</property>
         <child>
           <widget class="GtkTable" id="table42">
             <property name="visible">True</property>
-            <property name="n_rows">15</property>
+            <property name="n_rows">16</property>
             <property name="n_columns">2</property>
             <property name="column_spacing">4</property>
             <property name="row_spacing">2</property>
@@ -11863,8 +11863,8 @@ Test&lt;/b&gt;</property>
               <packing>
                 <property name="left_attach">1</property>
                 <property name="right_attach">2</property>
-                <property name="top_attach">14</property>
-                <property name="bottom_attach">15</property>
+                <property name="top_attach">15</property>
+                <property name="bottom_attach">16</property>
                 <property name="y_options"></property>
               </packing>
             </child>
@@ -11876,8 +11876,8 @@ Test&lt;/b&gt;</property>
 comments</property>
               </widget>
               <packing>
-                <property name="top_attach">14</property>
-                <property name="bottom_attach">15</property>
+                <property name="top_attach">15</property>
+                <property name="bottom_attach">16</property>
                 <property name="x_options">GTK_FILL</property>
                 <property name="y_options"></property>
               </packing>
@@ -11933,8 +11933,8 @@ comments</property>
               <packing>
                 <property name="left_attach">1</property>
                 <property name="right_attach">2</property>
-                <property name="top_attach">13</property>
-                <property name="bottom_attach">14</property>
+                <property name="top_attach">14</property>
+                <property name="bottom_attach">15</property>
                 <property name="x_options">GTK_FILL</property>
               </packing>
             </child>
@@ -11945,8 +11945,8 @@ comments</property>
                 <property name="label" translatable="yes">Mistakes</property>
               </widget>
               <packing>
-                <property name="top_attach">13</property>
-                <property name="bottom_attach">14</property>
+                <property name="top_attach">14</property>
+                <property name="bottom_attach">15</property>
                 <property name="x_options">GTK_FILL</property>
                 <property name="y_options"></property>
               </packing>
@@ -11957,6 +11957,70 @@ comments</property>
             <child>
               <placeholder/>
             </child>
+            <child>
+              <widget class="GtkLabel" id="label_video">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Video available</property>
+              </widget>
+              <packing>
+                <property name="top_attach">13</property>
+                <property name="bottom_attach">14</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkHBox" id="hbox1">
+                <property name="visible">True</property>
+                <child>
+                  <widget class="GtkHBox" id="hbox2">
+                    <property name="visible">True</property>
+                    <child>
+                      <widget class="GtkLabel" id="label_video_yes">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Yes</property>
+                      </widget>
+                      <packing>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label_video_no">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">No</property>
+                      </widget>
+                      <packing>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="button_video_watch">
+                    <property name="label" translatable="yes">watch video</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <signal name="clicked" handler="on_button_video_watch_clicked"/>
+                  </widget>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">13</property>
+                <property name="bottom_attach">14</property>
+              </packing>
+            </child>
           </widget>
           <packing>
             <property name="position">1</property>
diff --git a/src/gui/event.cs b/src/gui/event.cs
index aa12633..1ed3e38 100644
--- a/src/gui/event.cs
+++ b/src/gui/event.cs
@@ -23,9 +23,11 @@ using Gtk;
 using Glade;
 using System.Text; //StringBuilder
 using System.Collections; //ArrayList
-
+using System.IO;
 using System.Threading;
 using Mono.Unix;
+using LongoMatch.Gui;
+using LongoMatch.Video.Player;
 
 
 //--------------------------------------------------------
@@ -68,6 +70,11 @@ public class EditEventWindow
 	
 	[Widget] protected Gtk.Label label_mistakes;
 	[Widget] protected Gtk.SpinButton spin_mistakes;
+
+	[Widget] protected Gtk.Label label_video_yes;
+	[Widget] protected Gtk.Label label_video_no;
+	[Widget] protected Gtk.Button button_video_watch;
+	protected string videoFileName = "";
 	
 	[Widget] protected Gtk.Entry entry_description;
 	//[Widget] protected Gtk.TextView textview_description;
@@ -86,6 +93,7 @@ public class EditEventWindow
 	protected string entryWeight = "0"; //used to record the % for old person if we change it
 	protected string entryAngle = "0";
 
+	protected Constants.TestTypes typeOfTest;
 	protected bool showType;
 	protected bool showTv;
 	protected bool showTc;
@@ -134,6 +142,7 @@ public class EditEventWindow
 }
 	
 	protected virtual void initializeValues () {
+		typeOfTest = Constants.TestTypes.JUMP;
 		showType = true;
 		showTv = true;
 		showTc = true;
@@ -255,6 +264,34 @@ public class EditEventWindow
 			
 		hbox_combo_person.PackStart(combo_persons, true, true, 0);
 		hbox_combo_person.ShowAll();
+
+		//show video if available	
+		videoFileName = Util.GetVideoFileName(myEvent.SessionID, typeOfTest, myEvent.UniqueID);
+		if(File.Exists(videoFileName)) {
+			label_video_yes.Visible = true;
+			label_video_no.Visible = false;
+			button_video_watch.Sensitive = true;
+		} else {
+			label_video_yes.Visible = false;
+			label_video_no.Visible = true;
+			button_video_watch.Sensitive = false;
+		}
+	}
+
+	private void on_button_video_watch_clicked (object o, EventArgs args) {
+		if(File.Exists(videoFileName)) { 
+			Log.WriteLine("Exists and clicked " + videoFileName);
+			
+			PlayerBin player = new PlayerBin();
+			player.Open(videoFileName);
+
+			Gtk.Window d = new Gtk.Window(Catalog.GetString("Playing video"));
+			d.Add(player);
+			d.Modal = true;
+			d.ShowAll();
+			d.DeleteEvent += delegate(object sender, DeleteEventArgs e) {player.Close(); player.Dispose();};
+			player.Play(); 
+		}
 	}
 	
 	protected void fillWindowTitleAndLabelHeader() {
@@ -465,7 +502,7 @@ public class EditEventWindow
 		EditEventWindowBox.edit_event.Hide();
 		EditEventWindowBox = null;
 	}
-	
+
 	void on_button_accept_clicked (object o, EventArgs args)
 	{
 		int eventID = Convert.ToInt32 ( label_event_id_value.Text );
diff --git a/src/gui/jump.cs b/src/gui/jump.cs
index d7862c5..23a3d3e 100644
--- a/src/gui/jump.cs
+++ b/src/gui/jump.cs
@@ -81,6 +81,7 @@ public class EditJumpWindow : EditEventWindow
 	}
 	
 	protected override void initializeValues () {
+		typeOfTest = Constants.TestTypes.JUMP;
 		showType = true;
 		showTv = true;
 		showTc= true;
@@ -306,6 +307,7 @@ public class EditJumpRjWindow : EditJumpWindow
 	}
 	
 	protected override void initializeValues () {
+		typeOfTest = Constants.TestTypes.JUMP_RJ;
 		showType = true;
 		showTv = false;
 		showTc = false;
diff --git a/src/gui/multiChronopic.cs b/src/gui/multiChronopic.cs
index f653041..c13ecbb 100644
--- a/src/gui/multiChronopic.cs
+++ b/src/gui/multiChronopic.cs
@@ -75,6 +75,7 @@ public class EditMultiChronopicWindow : EditEventWindow
 	}
 	
 	protected override void initializeValues () {
+		typeOfTest = Constants.TestTypes.MULTICHRONOPIC;
 		headerShowDecimal = false;
 		showType = false;
 		showTv = false;
diff --git a/src/gui/pulse.cs b/src/gui/pulse.cs
index e0038b8..ea33399 100644
--- a/src/gui/pulse.cs
+++ b/src/gui/pulse.cs
@@ -68,6 +68,7 @@ public class EditPulseWindow : EditEventWindow
 	}
 	
 	protected override void initializeValues () {
+		typeOfTest = Constants.TestTypes.PULSE;
 		showType = true;
 		showTv = false;
 		showTc= false;
diff --git a/src/gui/reactionTime.cs b/src/gui/reactionTime.cs
index af5cab0..1e08f02 100644
--- a/src/gui/reactionTime.cs
+++ b/src/gui/reactionTime.cs
@@ -69,6 +69,7 @@ public class EditReactionTimeWindow : EditEventWindow
 	}
 	
 	protected override void initializeValues () {
+		typeOfTest = Constants.TestTypes.RT;
 		headerShowDecimal = false;
 		showType = false;
 		showTv = false;
diff --git a/src/gui/run.cs b/src/gui/run.cs
index 7cf0910..8c0864a 100644
--- a/src/gui/run.cs
+++ b/src/gui/run.cs
@@ -80,6 +80,7 @@ public class EditRunWindow : EditEventWindow
 	}
 	
 	protected override void initializeValues () {
+		typeOfTest = Constants.TestTypes.RUN;
 		showType = true;
 		showTv = false;
 		showTc= false;
@@ -268,6 +269,7 @@ public class EditRunIntervalWindow : EditRunWindow
 	}
 	
 	protected override void initializeValues () {
+		typeOfTest = Constants.TestTypes.RUN_I;
 		showType = true;
 		showTv = false;
 		showTc= false;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]