[chronojump] play video on main gui (jumps)
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] play video on main gui (jumps)
- Date: Fri, 11 Feb 2011 12:23:38 +0000 (UTC)
commit e9534028c0a9130203e34cb27cafe59ae9ab9ae5
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Feb 11 13:23:19 2011 +0100
play video on main gui (jumps)
glade/chronojump.glade | 39 +++++++++++++++++++++++++++++-------
src/gui/chronojump.cs | 51 ++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 80 insertions(+), 10 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index b984f2b..0a3f5e1 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -11951,12 +11951,6 @@ comments</property>
</packing>
</child>
<child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
<widget class="GtkLabel" id="label_video">
<property name="visible">True</property>
<property name="xalign">0</property>
@@ -12002,7 +11996,7 @@ comments</property>
</child>
<child>
<widget class="GtkButton" id="button_video_watch">
- <property name="label" translatable="yes">watch video</property>
+ <property name="label" translatable="yes">Play video</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@@ -12020,6 +12014,12 @@ comments</property>
<property name="bottom_attach">14</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="position">1</property>
@@ -18654,6 +18654,29 @@ by you</property>
</packing>
</child>
<child>
+ <widget class="GtkButton" id="button_video_play_selected_jump">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip" translatable="yes">Play Video (v)</property>
+ <signal name="clicked" handler="on_video_play_selected_jump_clicked"/>
+ <accelerator key="v" signal="clicked"/>
+ <child>
+ <widget class="GtkImage" id="image45">
+ <property name="visible">True</property>
+ <property name="stock">gtk-media-play</property>
+ <property name="icon-size">1</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkButton" id="button_delete_selected_jump">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -18670,7 +18693,7 @@ by you</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
</widget>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 5e4d6b3..49e51d7 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -94,6 +94,7 @@ public class ChronoJumpWindow
[Widget] Gtk.MenuItem menuitem_repair_selected_jump_rj;
[Widget] Gtk.MenuItem menuitem_delete_selected_jump_rj;
[Widget] Gtk.Button button_edit_selected_jump;
+ [Widget] Gtk.Button button_video_play_selected_jump;
[Widget] Gtk.Button button_delete_selected_jump;
[Widget] Gtk.Button button_edit_selected_jump_rj;
[Widget] Gtk.Button button_delete_selected_jump_rj;
@@ -1172,13 +1173,25 @@ public class ChronoJumpWindow
myItem = new MenuItem ( Catalog.GetString("Edit selected") + " " + myJump.Type + " (" + myJump.PersonName + ")");
myItem.Activated += on_edit_selected_jump_clicked;
myMenu.Attach( myItem, 0, 1, 0, 1 );
+
+ myItem = new MenuItem ( Catalog.GetString("Play Video") + " " + myJump.Type + " (" + myJump.PersonName + ")");
+ string videoFileName = Util.GetVideoFileName(currentSession.UniqueID,
+ Constants.TestTypes.JUMP, myTreeViewJumps.EventSelectedID);
+ if(File.Exists(videoFileName)) {
+ myItem.Activated += on_video_play_selected_jump_clicked;
+ myItem.Sensitive = true;
+ } else
+ myItem.Sensitive = false;
+
+
+ myMenu.Attach( myItem, 0, 1, 1, 2 );
Gtk.SeparatorMenuItem mySep = new SeparatorMenuItem();
- myMenu.Attach( mySep, 0, 1, 1, 2 );
+ myMenu.Attach( mySep, 0, 1, 2, 3 );
myItem = new MenuItem ( Catalog.GetString("Delete selected") + " " + myJump.Type + " (" + myJump.PersonName + ")");
myItem.Activated += on_delete_selected_jump_clicked;
- myMenu.Attach( myItem, 0, 1, 2, 3 );
+ myMenu.Attach( myItem, 0, 1, 3, 4 );
myMenu.Popup();
myMenu.ShowAll();
@@ -4367,6 +4380,32 @@ Console.WriteLine("X");
}
/* ---------------------------------------------------------
+ * ---------------- EVENTS PLAY VIDEO ---------------------
+ * --------------------------------------------------------
+ */
+
+ private void on_video_play_selected_jump_clicked (object o, EventArgs args) {
+ if (myTreeViewJumps.EventSelectedID > 0) {
+ string videoFileName = Util.GetVideoFileName(currentSession.UniqueID,
+ Constants.TestTypes.JUMP, myTreeViewJumps.EventSelectedID);
+ 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();
+ }
+ }
+ }
+
+
+ /* ---------------------------------------------------------
* ---------------- EVENTS DELETE -------------------------
* --------------------------------------------------------
*/
@@ -5069,6 +5108,14 @@ Console.WriteLine("X");
menuitem_delete_selected_jump.Sensitive = show;
button_edit_selected_jump.Sensitive = show;
button_delete_selected_jump.Sensitive = show;
+ button_video_play_selected_jump.Sensitive = false;
+ if (myTreeViewJumps.EventSelectedID > 0) {
+ string videoFileName = Util.GetVideoFileName(currentSession.UniqueID,
+ Constants.TestTypes.JUMP, myTreeViewJumps.EventSelectedID);
+ if(File.Exists(videoFileName))
+ button_video_play_selected_jump.Sensitive = true;
+ }
+
success = true;
}
if (type == "ALL" || type == "JumpRj") {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]