[longomatch/statebar: 13/13] WIP
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch/statebar: 13/13] WIP
- Date: Sun, 18 Sep 2011 23:37:17 +0000 (UTC)
commit 7af55230ccfd30e9513adcd33dfe245075f97cdc
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Mon Sep 19 01:35:35 2011 +0200
WIP
LongoMatch/Common/Enums.cs | 8 ++
LongoMatch/Gui/Component/RenderingStateBar.cs | 53 ++++++++++++++
LongoMatch/Gui/MainWindow.cs | 14 +++-
LongoMatch/Handlers/EventsManager.cs | 35 +---------
LongoMatch/LongoMatch.mdp | 6 ++
LongoMatch/Main.cs | 1 +
.../LongoMatch.Gui.Component.RenderingStateBar.cs | 72 ++++++++++++++++++++
LongoMatch/gtk-gui/LongoMatch.Gui.MainWindow.cs | 19 ++---
LongoMatch/gtk-gui/gui.stetic | 60 ++++++++++++++--
LongoMatch/gtk-gui/objects.xml | 8 ++
10 files changed, 220 insertions(+), 56 deletions(-)
---
diff --git a/LongoMatch/Common/Enums.cs b/LongoMatch/Common/Enums.cs
index dd8b5e4..f7906b5 100644
--- a/LongoMatch/Common/Enums.cs
+++ b/LongoMatch/Common/Enums.cs
@@ -53,4 +53,12 @@ namespace LongoMatch.Common
LOCAL = 1,
VISITOR = 2,
}
+
+ public enum JobState {
+ NotStarted,
+ Running,
+ Finished,
+ Cancelled,
+ Error,
+ }
}
diff --git a/LongoMatch/Gui/Component/RenderingStateBar.cs b/LongoMatch/Gui/Component/RenderingStateBar.cs
new file mode 100644
index 0000000..fbff457
--- /dev/null
+++ b/LongoMatch/Gui/Component/RenderingStateBar.cs
@@ -0,0 +1,53 @@
+//
+// Copyright (C) 2011 Andoni Morales Alastruey
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+using System;
+namespace LongoMatch.Gui.Component
+{
+ [System.ComponentModel.ToolboxItem(true)]
+ public partial class RenderingStateBar : Gtk.Bin
+ {
+ public RenderingStateBar ()
+ {
+ this.Build ();
+ }
+
+ public bool JobRunning {
+ set {
+ cancellbutton.Visible = value;
+ progressbar.Visible = value;
+ }
+ }
+
+ public string Text {
+ set {
+ statebutton.Label = value;
+ }
+ }
+
+ public double Fraction {
+ set {
+ progressbar.Fraction = value;
+ }
+ get {
+ return progressbar.Fraction;
+ }
+
+ }
+ }
+}
+
diff --git a/LongoMatch/Gui/MainWindow.cs b/LongoMatch/Gui/MainWindow.cs
index 5e59ac7..4423305 100644
--- a/LongoMatch/Gui/MainWindow.cs
+++ b/LongoMatch/Gui/MainWindow.cs
@@ -29,6 +29,7 @@ using LongoMatch.Gui.Dialog;
using LongoMatch.Handlers;
using LongoMatch.Store;
using LongoMatch.Store.Templates;
+using LongoMatch.Services.VideoRenderer;
using LongoMatch.Video.Capturer;
using LongoMatch.Video.Common;
using LongoMatch.Video.Utils;
@@ -49,6 +50,7 @@ namespace LongoMatch.Gui
private EventsManager eManager;
private HotKeysManager hkManager;
private KeyPressEventHandler hotkeysListener;
+ VideoRenderer videoRenderer;
#region Constructors
@@ -72,7 +74,6 @@ namespace LongoMatch.Gui
playlistwidget2,
playerbin1,
timelinewidget1,
- videoprogressbar,
noteswidget1,
capturerBin);
@@ -85,6 +86,7 @@ namespace LongoMatch.Gui
DrawingManager dManager = new DrawingManager(drawingtoolbox1,playerbin1.VideoWidget);
//Forward Key and Button events to the Drawing Manager
KeyPressEvent += new KeyPressEventHandler(dManager.OnKeyPressEvent);
+
playerbin1.SetLogo(System.IO.Path.Combine(MainClass.ImagesDir(),"background.png"));
playerbin1.LogoMode = true;
@@ -95,6 +97,8 @@ namespace LongoMatch.Gui
CloseCaptureProject();
};
+ videoRenderer = new VideoRenderer();
+
buttonswidget1.Mode = TagMode.Predifined;
playlistwidget2.SetPlayer(playerbin1);
@@ -106,6 +110,8 @@ namespace LongoMatch.Gui
#endregion
#region Private Methods
+
+
private void SetProject(Project project, ProjectType projectType, CaptureSettings props)
{
bool isLive = false;
@@ -285,7 +291,7 @@ namespace LongoMatch.Gui
}
private void ShowWidgets() {
- leftbox.Show();
+ leftbox1.Show();
if(TaggingViewAction.Active || ManualTaggingViewAction.Active)
buttonswidget1.Show();
else
@@ -293,7 +299,7 @@ namespace LongoMatch.Gui
}
private void HideWidgets() {
- leftbox.Hide();
+ leftbox1.Hide();
rightvbox.Hide();
buttonswidget1.Hide();
timelinewidget1.Hide();
@@ -471,7 +477,7 @@ namespace LongoMatch.Gui
protected virtual void OnHideAllWidgetsActionToggled(object sender, System.EventArgs e)
{
if(openedProject != null) {
- leftbox.Visible = !((Gtk.ToggleAction)sender).Active;
+ leftbox1.Visible = !((Gtk.ToggleAction)sender).Active;
timelinewidget1.Visible = !((Gtk.ToggleAction)sender).Active && TimelineViewAction.Active;
buttonswidget1.Visible = !((Gtk.ToggleAction)sender).Active &&
(TaggingViewAction.Active || ManualTaggingViewAction.Active);
diff --git a/LongoMatch/Handlers/EventsManager.cs b/LongoMatch/Handlers/EventsManager.cs
index a07cc92..e04ef63 100644
--- a/LongoMatch/Handlers/EventsManager.cs
+++ b/LongoMatch/Handlers/EventsManager.cs
@@ -47,7 +47,6 @@ namespace LongoMatch
private PlayerBin player;
private CapturerBin capturer;
private TimeLineWidget timeline;
- private ProgressBar videoprogressbar;
private NotesWidget notes;
private FramesSeriesCapturer fsc;
private FramesCaptureProgressDialog fcpd;
@@ -63,8 +62,7 @@ namespace LongoMatch
public EventsManager(PlaysListTreeWidget treewidget, PlayersListTreeWidget localPlayersList,
PlayersListTreeWidget visitorPlayersList, TagsTreeWidget tagsTreeWidget,
ButtonsWidget buttonswidget, PlayListWidget playlist, PlayerBin player,
- TimeLineWidget timeline, ProgressBar videoprogressbar,NotesWidget notes,
- CapturerBin capturer)
+ TimeLineWidget timeline, NotesWidget notes, CapturerBin capturer)
{
this.treewidget = treewidget;
this.localPlayersList = localPlayersList;
@@ -74,7 +72,6 @@ namespace LongoMatch
this.playlist = playlist;
this.player = player;
this.timeline = timeline;
- this.videoprogressbar = videoprogressbar;
this.notes = notes;
this.capturer = capturer;
this.drawingManager = new VideoDrawingsManager(player);
@@ -123,7 +120,6 @@ namespace LongoMatch
/* Connect playlist events */
playlist.PlayListNodeSelected += OnPlayListNodeSelected;
- playlist.Progress += OnProgress;
playlist.ApplyCurrentRate += OnApplyRate;
/* Connect PlayListNodeAdded events */
@@ -203,35 +199,6 @@ namespace LongoMatch
timeline.QueueDraw();
}
- protected virtual void OnProgress(float progress) {
-
- if(progress > (float)EditorState.START && progress <= (float)EditorState.FINISHED && progress > videoprogressbar.Fraction) {
- videoprogressbar.Fraction = progress;
- }
-
- if(progress == (float)EditorState.CANCELED) {
- videoprogressbar.Hide();
- }
-
- else if(progress == (float)EditorState.START) {
- videoprogressbar.Show();
- videoprogressbar.Fraction = 0;
- videoprogressbar.Text = "Creating new video";
- }
-
- else if(progress == (float)EditorState.FINISHED) {
- MessagePopup.PopupMessage(player, MessageType.Info, Catalog.GetString("The video edition has finished successfully."));
- videoprogressbar.Hide();
- }
-
- else if(progress == (float)EditorState.ERROR) {
- MessagePopup.PopupMessage(player, MessageType.Error,
- Catalog.GetString("An error has occurred in the video editor.")
- +Catalog.GetString("Please, try again."));
- videoprogressbar.Hide();
- }
- }
-
protected virtual void OnNewMarkAtFrame(Category category, int frame) {
Time pos = new Time { MSeconds = frame*1000/openedProject.Description.File.Fps};
player.CloseActualSegment();
diff --git a/LongoMatch/LongoMatch.mdp b/LongoMatch/LongoMatch.mdp
index 2282c44..1926f9d 100644
--- a/LongoMatch/LongoMatch.mdp
+++ b/LongoMatch/LongoMatch.mdp
@@ -192,6 +192,12 @@
<File subtype="Code" buildaction="Compile" name="Common/Images.cs" />
<File subtype="Code" buildaction="Compile" name="Gui/Component/CategoriesTemplateEditor.cs" />
<File subtype="Code" buildaction="Compile" name="Gui/Component/TeamTemplateEditor.cs" />
+ <File subtype="Directory" buildaction="Compile" name="Services/VideoRenderer" />
+ <File subtype="Code" buildaction="Compile" name="Services/VideoRenderer/VideoRenderer.cs" />
+ <File subtype="Directory" buildaction="Compile" name="Services" />
+ <File subtype="Code" buildaction="Compile" name="Services/VideoRenderer/Job.cs" />
+ <File subtype="Code" buildaction="Compile" name="Gui/Component/RenderingStateBar.cs" />
+ <File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Component.RenderingStateBar.cs" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
diff --git a/LongoMatch/Main.cs b/LongoMatch/Main.cs
index 62c283f..1650aa3 100644
--- a/LongoMatch/Main.cs
+++ b/LongoMatch/Main.cs
@@ -28,6 +28,7 @@ using LongoMatch.Gui;
using LongoMatch.IO;
using LongoMatch.Store.Templates;
using LongoMatch.Services;
+using LongoMatch.Services.VideoRenderer;
using Mono.Unix;
namespace LongoMatch
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.Component.RenderingStateBar.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.RenderingStateBar.cs
new file mode 100644
index 0000000..759ab08
--- /dev/null
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.RenderingStateBar.cs
@@ -0,0 +1,72 @@
+
+// This file has been generated by the GUI designer. Do not modify.
+namespace LongoMatch.Gui.Component
+{
+ public partial class RenderingQueue
+ {
+ private global::Gtk.HBox hbox1;
+
+ private global::Gtk.Button statebutton;
+
+ private global::Gtk.ProgressBar progressbar;
+
+ private global::Gtk.Button cancellbutton;
+
+ protected virtual void Build ()
+ {
+ global::Stetic.Gui.Initialize (this);
+ // Widget LongoMatch.Gui.Component.RenderingQueue
+ global::Stetic.BinContainer.Attach (this);
+ this.Name = "LongoMatch.Gui.Component.RenderingQueue";
+ // Container child LongoMatch.Gui.Component.RenderingQueue.Gtk.Container+ContainerChild
+ this.hbox1 = new global::Gtk.HBox ();
+ this.hbox1.Name = "hbox1";
+ this.hbox1.Spacing = 6;
+ // Container child hbox1.Gtk.Box+BoxChild
+ this.statebutton = new global::Gtk.Button ();
+ this.statebutton.CanFocus = true;
+ this.statebutton.Name = "statebutton";
+ this.statebutton.UseUnderline = true;
+ this.statebutton.Label = "";
+ this.hbox1.Add (this.statebutton);
+ global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.statebutton]));
+ w1.Position = 0;
+ // Container child hbox1.Gtk.Box+BoxChild
+ this.progressbar = new global::Gtk.ProgressBar ();
+ this.progressbar.Name = "progressbar";
+ this.hbox1.Add (this.progressbar);
+ global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.progressbar]));
+ w2.Position = 1;
+ // Container child hbox1.Gtk.Box+BoxChild
+ this.cancellbutton = new global::Gtk.Button ();
+ this.cancellbutton.CanFocus = true;
+ this.cancellbutton.Name = "cancellbutton";
+ this.cancellbutton.UseUnderline = true;
+ // Container child cancellbutton.Gtk.Container+ContainerChild
+ global::Gtk.Alignment w3 = new global::Gtk.Alignment (0.5f, 0.5f, 0f, 0f);
+ // Container child GtkAlignment.Gtk.Container+ContainerChild
+ global::Gtk.HBox w4 = new global::Gtk.HBox ();
+ w4.Spacing = 2;
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ global::Gtk.Image w5 = new global::Gtk.Image ();
+ w5.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-cancel", global::Gtk.IconSize.Menu);
+ w4.Add (w5);
+ // Container child GtkHBox.Gtk.Container+ContainerChild
+ global::Gtk.Label w7 = new global::Gtk.Label ();
+ w4.Add (w7);
+ w3.Add (w4);
+ this.cancellbutton.Add (w3);
+ this.hbox1.Add (this.cancellbutton);
+ global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.cancellbutton]));
+ w11.Position = 2;
+ w11.Expand = false;
+ w11.Fill = false;
+ this.Add (this.hbox1);
+ if ((this.Child != null)) {
+ this.Child.ShowAll ();
+ }
+ this.cancellbutton.Hide ();
+ this.Hide ();
+ }
+ }
+}
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.MainWindow.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.MainWindow.cs
index 0d197d9..6010ec5 100644
--- a/LongoMatch/gtk-gui/LongoMatch.Gui.MainWindow.cs
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.MainWindow.cs
@@ -104,7 +104,7 @@ namespace LongoMatch.Gui
private global::Gtk.Statusbar statusbar1;
- private global::Gtk.ProgressBar videoprogressbar;
+ private global::LongoMatch.Gui.Component.RenderingStateBar renderingqueue1;
protected virtual void Build ()
{
@@ -188,7 +188,7 @@ namespace LongoMatch.Gui
this.ImportProjectAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("_Import Project");
w1.Add (this.ImportProjectAction, "<Control>i");
this.ManualTaggingViewAction = new global::Gtk.RadioAction ("ManualTaggingViewAction", global::Mono.Unix.Catalog.GetString ("Manual tagging view"), null, null, 0);
- this.ManualTaggingViewAction.Group = this.TimelineViewAction.Group;
+ this.ManualTaggingViewAction.Group = this.TaggingViewAction.Group;
this.ManualTaggingViewAction.Sensitive = false;
this.ManualTaggingViewAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Free Capture Mode");
w1.Add (this.ManualTaggingViewAction, "<Control>f");
@@ -234,7 +234,7 @@ namespace LongoMatch.Gui
this.notebook1 = new global::Gtk.Notebook ();
this.notebook1.CanFocus = true;
this.notebook1.Name = "notebook1";
- this.notebook1.CurrentPage = 0;
+ this.notebook1.CurrentPage = 3;
this.notebook1.TabPos = ((global::Gtk.PositionType)(3));
// Container child notebook1.Gtk.Notebook+NotebookChild
this.treewidget1 = new global::LongoMatch.Gui.Component.PlaysListTreeWidget ();
@@ -392,14 +392,12 @@ namespace LongoMatch.Gui
this.statusbar1.Name = "statusbar1";
this.statusbar1.Spacing = 6;
// Container child statusbar1.Gtk.Box+BoxChild
- this.videoprogressbar = new global::Gtk.ProgressBar ();
- this.videoprogressbar.Name = "videoprogressbar";
- this.videoprogressbar.Text = global::Mono.Unix.Catalog.GetString ("Creating video...");
- this.statusbar1.Add (this.videoprogressbar);
- global::Gtk.Box.BoxChild w22 = ((global::Gtk.Box.BoxChild)(this.statusbar1[this.videoprogressbar]));
+ this.renderingqueue1 = new global::LongoMatch.Gui.Component.RenderingStateBar ();
+ this.renderingqueue1.Events = ((global::Gdk.EventMask)(256));
+ this.renderingqueue1.Name = "renderingqueue1";
+ this.statusbar1.Add (this.renderingqueue1);
+ global::Gtk.Box.BoxChild w22 = ((global::Gtk.Box.BoxChild)(this.statusbar1[this.renderingqueue1]));
w22.Position = 3;
- w22.Expand = false;
- w22.Fill = false;
this.vbox1.Add (this.statusbar1);
global::Gtk.Box.BoxChild w23 = ((global::Gtk.Box.BoxChild)(this.vbox1[this.statusbar1]));
w23.Position = 2;
@@ -418,7 +416,6 @@ namespace LongoMatch.Gui
this.noteswidget1.Hide ();
this.playlistwidget2.Hide ();
this.rightvbox.Hide ();
- this.videoprogressbar.Hide ();
this.Show ();
this.NewPojectAction.Activated += new global::System.EventHandler (this.OnNewActivated);
this.OpenProjectAction.Activated += new global::System.EventHandler (this.OnOpenActivated);
diff --git a/LongoMatch/gtk-gui/gui.stetic b/LongoMatch/gtk-gui/gui.stetic
index 869305e..aec0eb6 100644
--- a/LongoMatch/gtk-gui/gui.stetic
+++ b/LongoMatch/gtk-gui/gui.stetic
@@ -1823,7 +1823,7 @@
<widget class="Gtk.Notebook" id="notebook1">
<property name="MemberName" />
<property name="CanFocus">True</property>
- <property name="CurrentPage">0</property>
+ <property name="CurrentPage">3</property>
<property name="TabPos">Bottom</property>
<child>
<widget class="LongoMatch.Gui.Component.PlaysListTreeWidget" id="treewidget1">
@@ -2054,16 +2054,13 @@
<placeholder />
</child>
<child>
- <widget class="Gtk.ProgressBar" id="videoprogressbar">
+ <widget class="LongoMatch.Gui.Component.RenderingQueue" id="renderingqueue1">
<property name="MemberName" />
- <property name="Visible">False</property>
- <property name="Text" translatable="yes">Creating video...</property>
+ <property name="Events">ButtonPressMask</property>
</widget>
<packing>
<property name="Position">3</property>
- <property name="AutoSize">False</property>
- <property name="Expand">False</property>
- <property name="Fill">False</property>
+ <property name="AutoSize">True</property>
</packing>
</child>
</widget>
@@ -6429,4 +6426,53 @@ You can continue with the current capture, cancel it or save your project.
</widget>
</child>
</widget>
+ <widget class="Gtk.Bin" id="LongoMatch.Gui.Component.RenderingStateBar" design-size="300 28">
+ <property name="MemberName" />
+ <property name="Visible">False</property>
+ <child>
+ <widget class="Gtk.HBox" id="hbox1">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.Button" id="statebutton">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="Type">TextOnly</property>
+ <property name="Label" translatable="yes" />
+ <property name="UseUnderline">True</property>
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.ProgressBar" id="progressbar">
+ <property name="MemberName" />
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">True</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="cancellbutton">
+ <property name="MemberName" />
+ <property name="Visible">False</property>
+ <property name="CanFocus">True</property>
+ <property name="Type">TextAndIcon</property>
+ <property name="Icon">stock:gtk-cancel Menu</property>
+ <property name="Label" translatable="yes" />
+ <property name="UseUnderline">True</property>
+ </widget>
+ <packing>
+ <property name="Position">2</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
</stetic-interface>
\ No newline at end of file
diff --git a/LongoMatch/gtk-gui/objects.xml b/LongoMatch/gtk-gui/objects.xml
index 237219b..f43f237 100644
--- a/LongoMatch/gtk-gui/objects.xml
+++ b/LongoMatch/gtk-gui/objects.xml
@@ -282,4 +282,12 @@
</itemgroup>
</signals>
</object>
+ <object type="LongoMatch.Gui.Component.RenderingStateBar" palette-category="General" allow-children="false" base-type="Gtk.Bin">
+ <itemgroups>
+ <itemgroup label="RenderingStateBar Properties">
+ <property name="Fraction" />
+ </itemgroup>
+ </itemgroups>
+ <signals />
+ </object>
</objects>
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]