[longomatch] Add a new preferences panel for live



commit 2df334099845be5c856530039fda69102ca7772a
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Thu Jun 27 17:03:40 2013 +0200

    Add a new preferences panel for live

 LongoMatch.Core/Config.cs                          |   35 +++++
 .../Gui/Component/LiveAnalysisPreferences.cs       |   66 +++++++++
 LongoMatch.GUI/Gui/Dialog/PropertiesEditor.cs      |   12 +-
 LongoMatch.GUI/LongoMatch.GUI.mdp                  |    2 +
 LongoMatch.GUI/Makefile.am                         |    2 +
 ...oMatch.Gui.Component.LiveAnalysisPreferences.cs |  109 +++++++++++++++
 LongoMatch.GUI/gtk-gui/gui.stetic                  |  141 ++++++++++++++++++++
 LongoMatch.GUI/gtk-gui/objects.xml                 |    4 +
 8 files changed, 367 insertions(+), 4 deletions(-)
---
diff --git a/LongoMatch.Core/Config.cs b/LongoMatch.Core/Config.cs
index 85ede9f..5d649ad 100644
--- a/LongoMatch.Core/Config.cs
+++ b/LongoMatch.Core/Config.cs
@@ -293,6 +293,35 @@ namespace LongoMatch
                        }
                }
                
+               public static bool AutoRenderPlaysInLive {
+                       get {
+                               return state.autorender;
+                       }
+                       set {
+                               state.autorender = value;
+                               Save ();
+                       }
+               }
+               
+               public static string AutoRenderDir {
+                       get {
+                               return state.autorenderDir;
+                       }
+                       set {
+                               state.autorenderDir = value;
+                               Save ();
+                       }
+               }
+               
+               public static bool ReviewPlaysInSameWindow {
+                       get {
+                               return state.reviewPlaysInSameWindow;
+                       }
+                       set {
+                               state.reviewPlaysInSameWindow = value;
+                               Save ();
+                       }
+               }
                #endregion
 
        }
@@ -313,6 +342,9 @@ namespace LongoMatch
                public EncodingQuality renderEncodingQuality;
                public bool overlayTitle;
                public bool enableAudio;
+               public bool autorender;
+               public string autorenderDir;
+               public bool reviewPlaysInSameWindow;
                
                public ConfigState () {
                        /* Set default values */
@@ -330,6 +362,9 @@ namespace LongoMatch
                        enableAudio = false;
                        fps_n = 25;
                        fps_d = 1;
+                       autorender = false;
+                       autorenderDir = null;
+                       reviewPlaysInSameWindow = true;
                }
        }
 }
diff --git a/LongoMatch.GUI/Gui/Component/LiveAnalysisPreferences.cs 
b/LongoMatch.GUI/Gui/Component/LiveAnalysisPreferences.cs
new file mode 100644
index 0000000..e44c191
--- /dev/null
+++ b/LongoMatch.GUI/Gui/Component/LiveAnalysisPreferences.cs
@@ -0,0 +1,66 @@
+//
+//  Copyright (C) 2013 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;
+using Gtk;
+using Mono.Unix;
+
+using LongoMatch.Gui.Helpers;
+
+namespace LongoMatch.Gui.Component
+{
+       [System.ComponentModel.ToolboxItem(true)]
+       public partial class LiveAnalysisPreferences : Gtk.Bin
+       {
+               CheckButton rendercb, reviewcb;
+               
+               public LiveAnalysisPreferences ()
+               {
+                       this.Build ();
+                       
+                       rendercb  = new CheckButton();
+                       table1.Attach (rendercb, 1, 2, 0, 1,
+                                      AttachOptions.Shrink,
+                                      AttachOptions.Shrink, 0, 0);
+                       rendercb.CanFocus = false;
+                       rendercb.Show();
+                       rendercb.Active = Config.AutoRenderPlaysInLive;
+                       rendercb.Toggled += (sender, e) => {Config.AutoRenderPlaysInLive = rendercb.Active;};
+                       
+                       reviewcb  = new CheckButton();
+                       table1.Attach (reviewcb, 1, 2, 2, 3,
+                                      AttachOptions.Shrink,
+                                      AttachOptions.Shrink, 0, 0);
+                       reviewcb.CanFocus = false;
+                       reviewcb.Show();
+                       reviewcb.Active = Config.ReviewPlaysInSameWindow;
+                       reviewcb.Toggled += (sender, e) => {Config.ReviewPlaysInSameWindow = 
reviewcb.Active;};
+                       
+                       dirlabel.Text = Config.AutoRenderDir;
+               }
+               
+               protected void OnDirbuttonClicked (object sender, EventArgs e)
+               {
+                       string folderDir = FileChooserHelper.SelectFolder(this, Catalog.GetString ("Select a 
folder"),
+                                                                         "Live", Config.VideosDir, null, 
null);
+                       if (folderDir != null) {
+                               dirlabel.Text = folderDir;
+                               Config.AutoRenderDir = folderDir;
+                       }
+               }
+       }
+}
diff --git a/LongoMatch.GUI/Gui/Dialog/PropertiesEditor.cs b/LongoMatch.GUI/Gui/Dialog/PropertiesEditor.cs
index d5d7b11..012d6af 100644
--- a/LongoMatch.GUI/Gui/Dialog/PropertiesEditor.cs
+++ b/LongoMatch.GUI/Gui/Dialog/PropertiesEditor.cs
@@ -45,14 +45,18 @@ namespace LongoMatch.Gui.Dialog
                }
 
                void AddPanels () {
-                       AddPane (Catalog.GetString ("General"), "gtk-preferences",
+                       AddPane (Catalog.GetString ("General"),
+                                Stetic.IconLoader.LoadIcon(this, "gtk-preferences", IconSize.Dialog),
                                 new GeneralPreferencesPanel());
-                       AddPane (Catalog.GetString ("Video"), "gtk-media-record",
+                       AddPane (Catalog.GetString ("Video"),
+                                Stetic.IconLoader.LoadIcon(this, "gtk-media-record", IconSize.Dialog),
                                 new VideoPreferencesPanel());
+                       AddPane (Catalog.GetString ("Live analysis"),
+                                Gdk.Pixbuf.LoadFromResource ("camera-video.png"),
+                                new LiveAnalysisPreferences());
                }
                
-               void AddPane (string desc, string iconName, Widget pane) {
-                       Pixbuf icon = Stetic.IconLoader.LoadIcon(this, iconName, IconSize.Dialog);
+               void AddPane (string desc, Pixbuf icon, Widget pane) {
                        prefsStore.AppendValues(icon, desc, pane);
                }
                
diff --git a/LongoMatch.GUI/LongoMatch.GUI.mdp b/LongoMatch.GUI/LongoMatch.GUI.mdp
index b11618f..2db1522 100644
--- a/LongoMatch.GUI/LongoMatch.GUI.mdp
+++ b/LongoMatch.GUI/LongoMatch.GUI.mdp
@@ -174,6 +174,8 @@
     <File subtype="Code" buildaction="Compile" name="Gui/Component/VideoPreferencesPanel.cs" />
     <File subtype="Code" buildaction="Compile" 
name="gtk-gui/LongoMatch.Gui.Component.VideoPreferencesPanel.cs" />
     <File subtype="Code" buildaction="EmbedAsResource" name="../images/half_field_background.svg" />
+    <File subtype="Code" buildaction="Compile" name="Gui/Component/LiveAnalysisPreferences.cs" />
+    <File subtype="Code" buildaction="Compile" 
name="gtk-gui/LongoMatch.Gui.Component.LiveAnalysisPreferences.cs" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.12.0.0, Culture=neutral, 
PublicKeyToken=35e10195dab3c99f" />
diff --git a/LongoMatch.GUI/Makefile.am b/LongoMatch.GUI/Makefile.am
index 5b79fcc..68015d6 100644
--- a/LongoMatch.GUI/Makefile.am
+++ b/LongoMatch.GUI/Makefile.am
@@ -16,6 +16,7 @@ SOURCES = \
        gtk-gui/LongoMatch.Gui.Component.GameUnitsTagger.cs \
        gtk-gui/LongoMatch.Gui.Component.GameUnitWidget.cs \
        gtk-gui/LongoMatch.Gui.Component.GeneralPreferencesPanel.cs \
+       gtk-gui/LongoMatch.Gui.Component.LiveAnalysisPreferences.cs \
        gtk-gui/LongoMatch.Gui.Component.NotesWidget.cs \
        gtk-gui/LongoMatch.Gui.Component.PlayerProperties.cs \
        gtk-gui/LongoMatch.Gui.Component.PlayersListTreeWidget.cs \
@@ -74,6 +75,7 @@ SOURCES = \
        Gui/Component/GameUnitsTimelineWidget.cs \
        Gui/Component/GameUnitWidget.cs \
        Gui/Component/GeneralPreferencesPanel.cs \
+       Gui/Component/LiveAnalysisPreferences.cs \
        Gui/Component/NotesWidget.cs \
        Gui/Component/PlayerProperties.cs \
        Gui/Component/PlayersListTreeWidget.cs \
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.LiveAnalysisPreferences.cs 
b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.LiveAnalysisPreferences.cs
new file mode 100644
index 0000000..b00a488
--- /dev/null
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.LiveAnalysisPreferences.cs
@@ -0,0 +1,109 @@
+
+// This file has been generated by the GUI designer. Do not modify.
+namespace LongoMatch.Gui.Component
+{
+       public partial class LiveAnalysisPreferences
+       {
+               private global::Gtk.ScrolledWindow scrolledwindow1;
+               private global::Gtk.Table table1;
+               private global::Gtk.HBox hbox1;
+               private global::Gtk.Button dirbutton;
+               private global::Gtk.Label dirlabel;
+               private global::Gtk.Label label1;
+               private global::Gtk.Label label3;
+               private global::Gtk.Label label4;
+               
+               protected virtual void Build ()
+               {
+                       global::Stetic.Gui.Initialize (this);
+                       // Widget LongoMatch.Gui.Component.LiveAnalysisPreferences
+                       global::Stetic.BinContainer.Attach (this);
+                       this.Name = "LongoMatch.Gui.Component.LiveAnalysisPreferences";
+                       // Container child 
LongoMatch.Gui.Component.LiveAnalysisPreferences.Gtk.Container+ContainerChild
+                       this.scrolledwindow1 = new global::Gtk.ScrolledWindow ();
+                       this.scrolledwindow1.CanFocus = true;
+                       this.scrolledwindow1.Name = "scrolledwindow1";
+                       this.scrolledwindow1.ShadowType = ((global::Gtk.ShadowType)(1));
+                       // Container child scrolledwindow1.Gtk.Container+ContainerChild
+                       global::Gtk.Viewport w1 = new global::Gtk.Viewport ();
+                       w1.ShadowType = ((global::Gtk.ShadowType)(0));
+                       // Container child GtkViewport.Gtk.Container+ContainerChild
+                       this.table1 = new global::Gtk.Table (((uint)(3)), ((uint)(2)), false);
+                       this.table1.Name = "table1";
+                       this.table1.RowSpacing = ((uint)(6));
+                       this.table1.ColumnSpacing = ((uint)(6));
+                       // Container child table1.Gtk.Table+TableChild
+                       this.hbox1 = new global::Gtk.HBox ();
+                       this.hbox1.Name = "hbox1";
+                       this.hbox1.Spacing = 6;
+                       // Container child hbox1.Gtk.Box+BoxChild
+                       this.dirbutton = new global::Gtk.Button ();
+                       this.dirbutton.CanFocus = true;
+                       this.dirbutton.Name = "dirbutton";
+                       this.dirbutton.UseStock = true;
+                       this.dirbutton.UseUnderline = true;
+                       this.dirbutton.Label = "gtk-open";
+                       this.hbox1.Add (this.dirbutton);
+                       global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.hbox1 
[this.dirbutton]));
+                       w2.Position = 0;
+                       w2.Expand = false;
+                       w2.Fill = false;
+                       // Container child hbox1.Gtk.Box+BoxChild
+                       this.dirlabel = new global::Gtk.Label ();
+                       this.dirlabel.Name = "dirlabel";
+                       this.dirlabel.Wrap = true;
+                       this.dirlabel.Ellipsize = ((global::Pango.EllipsizeMode)(1));
+                       this.dirlabel.MaxWidthChars = 20;
+                       this.hbox1.Add (this.dirlabel);
+                       global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox1 
[this.dirlabel]));
+                       w3.Position = 1;
+                       this.table1.Add (this.hbox1);
+                       global::Gtk.Table.TableChild w4 = ((global::Gtk.Table.TableChild)(this.table1 
[this.hbox1]));
+                       w4.TopAttach = ((uint)(1));
+                       w4.BottomAttach = ((uint)(2));
+                       w4.LeftAttach = ((uint)(1));
+                       w4.RightAttach = ((uint)(2));
+                       w4.YOptions = ((global::Gtk.AttachOptions)(4));
+                       // Container child table1.Gtk.Table+TableChild
+                       this.label1 = new global::Gtk.Label ();
+                       this.label1.Name = "label1";
+                       this.label1.Xalign = 0F;
+                       this.label1.LabelProp = global::Mono.Unix.Catalog.GetString ("Review plays in the 
same window");
+                       this.table1.Add (this.label1);
+                       global::Gtk.Table.TableChild w5 = ((global::Gtk.Table.TableChild)(this.table1 
[this.label1]));
+                       w5.TopAttach = ((uint)(2));
+                       w5.BottomAttach = ((uint)(3));
+                       w5.XOptions = ((global::Gtk.AttachOptions)(4));
+                       w5.YOptions = ((global::Gtk.AttachOptions)(4));
+                       // Container child table1.Gtk.Table+TableChild
+                       this.label3 = new global::Gtk.Label ();
+                       this.label3.Name = "label3";
+                       this.label3.Xalign = 0F;
+                       this.label3.LabelProp = global::Mono.Unix.Catalog.GetString ("Output directory");
+                       this.table1.Add (this.label3);
+                       global::Gtk.Table.TableChild w6 = ((global::Gtk.Table.TableChild)(this.table1 
[this.label3]));
+                       w6.TopAttach = ((uint)(1));
+                       w6.BottomAttach = ((uint)(2));
+                       w6.XOptions = ((global::Gtk.AttachOptions)(4));
+                       w6.YOptions = ((global::Gtk.AttachOptions)(4));
+                       // Container child table1.Gtk.Table+TableChild
+                       this.label4 = new global::Gtk.Label ();
+                       this.label4.Name = "label4";
+                       this.label4.Xalign = 0F;
+                       this.label4.LabelProp = global::Mono.Unix.Catalog.GetString ("Render new plays 
automatically\n(Requires a powerful CPU)");
+                       this.label4.UseMarkup = true;
+                       this.table1.Add (this.label4);
+                       global::Gtk.Table.TableChild w7 = ((global::Gtk.Table.TableChild)(this.table1 
[this.label4]));
+                       w7.XOptions = ((global::Gtk.AttachOptions)(4));
+                       w7.YOptions = ((global::Gtk.AttachOptions)(4));
+                       w1.Add (this.table1);
+                       this.scrolledwindow1.Add (w1);
+                       this.Add (this.scrolledwindow1);
+                       if ((this.Child != null)) {
+                               this.Child.ShowAll ();
+                       }
+                       this.Hide ();
+                       this.dirbutton.Clicked += new global::System.EventHandler (this.OnDirbuttonClicked);
+               }
+       }
+}
diff --git a/LongoMatch.GUI/gtk-gui/gui.stetic b/LongoMatch.GUI/gtk-gui/gui.stetic
index a7c7a26..bde4b0f 100644
--- a/LongoMatch.GUI/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI/gtk-gui/gui.stetic
@@ -8440,4 +8440,145 @@ Defining &lt;b&gt; Game Units &lt;/b&gt; will help you during the analysis to in
       </widget>
     </child>
   </widget>
+  <widget class="Gtk.Bin" id="LongoMatch.Gui.Component.LiveAnalysisPreferences" design-size="555 118">
+    <property name="MemberName" />
+    <property name="Visible">False</property>
+    <child>
+      <widget class="Gtk.ScrolledWindow" id="scrolledwindow1">
+        <property name="MemberName" />
+        <property name="CanFocus">True</property>
+        <property name="ShadowType">In</property>
+        <child>
+          <widget class="Gtk.Viewport" id="GtkViewport">
+            <property name="MemberName" />
+            <property name="ShadowType">None</property>
+            <child>
+              <widget class="Gtk.Table" id="table1">
+                <property name="MemberName" />
+                <property name="NRows">3</property>
+                <property name="NColumns">2</property>
+                <property name="RowSpacing">6</property>
+                <property name="ColumnSpacing">6</property>
+                <child>
+                  <placeholder />
+                </child>
+                <child>
+                  <placeholder />
+                </child>
+                <child>
+                  <widget class="Gtk.HBox" id="hbox1">
+                    <property name="MemberName" />
+                    <property name="Spacing">6</property>
+                    <child>
+                      <widget class="Gtk.Button" id="dirbutton">
+                        <property name="MemberName" />
+                        <property name="CanFocus">True</property>
+                        <property name="UseStock">True</property>
+                        <property name="Type">StockItem</property>
+                        <property name="StockId">gtk-open</property>
+                        <signal name="Clicked" handler="OnDirbuttonClicked" />
+                        <property name="label">gtk-open</property>
+                      </widget>
+                      <packing>
+                        <property name="Position">0</property>
+                        <property name="AutoSize">True</property>
+                        <property name="Expand">False</property>
+                        <property name="Fill">False</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="Gtk.Label" id="dirlabel">
+                        <property name="MemberName" />
+                        <property name="Wrap">True</property>
+                        <property name="Ellipsize">Start</property>
+                        <property name="MaxWidthChars">20</property>
+                      </widget>
+                      <packing>
+                        <property name="Position">1</property>
+                        <property name="AutoSize">False</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="TopAttach">1</property>
+                    <property name="BottomAttach">2</property>
+                    <property name="LeftAttach">1</property>
+                    <property name="RightAttach">2</property>
+                    <property name="AutoSize">False</property>
+                    <property name="YOptions">Fill</property>
+                    <property name="XExpand">True</property>
+                    <property name="XFill">True</property>
+                    <property name="XShrink">False</property>
+                    <property name="YExpand">False</property>
+                    <property name="YFill">True</property>
+                    <property name="YShrink">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="Gtk.Label" id="label1">
+                    <property name="MemberName" />
+                    <property name="Xalign">0</property>
+                    <property name="LabelProp" translatable="yes">Review plays in the same window</property>
+                  </widget>
+                  <packing>
+                    <property name="TopAttach">2</property>
+                    <property name="BottomAttach">3</property>
+                    <property name="AutoSize">False</property>
+                    <property name="XOptions">Fill</property>
+                    <property name="YOptions">Fill</property>
+                    <property name="XExpand">False</property>
+                    <property name="XFill">True</property>
+                    <property name="XShrink">False</property>
+                    <property name="YExpand">False</property>
+                    <property name="YFill">True</property>
+                    <property name="YShrink">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="Gtk.Label" id="label3">
+                    <property name="MemberName" />
+                    <property name="Xalign">0</property>
+                    <property name="LabelProp" translatable="yes">Output directory</property>
+                  </widget>
+                  <packing>
+                    <property name="TopAttach">1</property>
+                    <property name="BottomAttach">2</property>
+                    <property name="AutoSize">False</property>
+                    <property name="XOptions">Fill</property>
+                    <property name="YOptions">Fill</property>
+                    <property name="XExpand">False</property>
+                    <property name="XFill">True</property>
+                    <property name="XShrink">False</property>
+                    <property name="YExpand">False</property>
+                    <property name="YFill">True</property>
+                    <property name="YShrink">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="Gtk.Label" id="label4">
+                    <property name="MemberName" />
+                    <property name="Xalign">0</property>
+                    <property name="LabelProp" translatable="yes">Render new plays automatically
+(Requires a powerful CPU)</property>
+                    <property name="UseMarkup">True</property>
+                  </widget>
+                  <packing>
+                    <property name="AutoSize">False</property>
+                    <property name="XOptions">Fill</property>
+                    <property name="YOptions">Fill</property>
+                    <property name="XExpand">False</property>
+                    <property name="XFill">True</property>
+                    <property name="XShrink">False</property>
+                    <property name="YExpand">False</property>
+                    <property name="YFill">True</property>
+                    <property name="YShrink">False</property>
+                  </packing>
+                </child>
+              </widget>
+            </child>
+          </widget>
+        </child>
+      </widget>
+    </child>
+  </widget>
 </stetic-interface>
\ No newline at end of file
diff --git a/LongoMatch.GUI/gtk-gui/objects.xml b/LongoMatch.GUI/gtk-gui/objects.xml
index df3636e..4e054ad 100644
--- a/LongoMatch.GUI/gtk-gui/objects.xml
+++ b/LongoMatch.GUI/gtk-gui/objects.xml
@@ -387,4 +387,8 @@
     <itemgroups />
     <signals />
   </object>
+  <object type="LongoMatch.Gui.Component.LiveAnalysisPreferences" palette-category="General" 
allow-children="false" base-type="Gtk.Bin">
+    <itemgroups />
+    <signals />
+  </object>
 </objects>
\ No newline at end of file


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