[longomatch] Use the default shield icon



commit 63b719f97cfa6ea29222decccca70fe388b36687
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Fri Oct 24 14:39:28 2014 +0200

    Use the default shield icon

 LongoMatch.Core/Common/Image.cs                    |    5 ++++
 LongoMatch.Core/Store/Templates/TeamTemplate.cs    |    3 ++
 LongoMatch.Core/StyleConf.cs                       |    1 +
 .../CanvasObjects/PlayersTaggerObject.cs           |   14 +++++++++++-
 LongoMatch.GUI/Gui/Component/TeamTemplateEditor.cs |    5 +--
 LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs    |    8 +++---
 data/icons/Makefile.am                             |    1 +
 .../scalable/actions/longomatch-default-shield.svg |   21 ++++++++++++++++++++
 8 files changed, 49 insertions(+), 9 deletions(-)
---
diff --git a/LongoMatch.Core/Common/Image.cs b/LongoMatch.Core/Common/Image.cs
index d7fb49a..32740cd 100644
--- a/LongoMatch.Core/Common/Image.cs
+++ b/LongoMatch.Core/Common/Image.cs
@@ -161,6 +161,11 @@ namespace LongoMatch.Core.Common
                        return new Image (new SImage (filename));
                }
                
+               public static Image LoadFromFile (string filename, int width, int height)
+               {
+                       return new Image (new SImage (filename, width, height));
+               }
+               
                public static Image Composite(Image image1, Image image2) {
                        SImage dest = new SImage(image1.Value.Colorspace, true, image1.Value.BitsPerSample,
                                                 image1.Width, image1.Height);
diff --git a/LongoMatch.Core/Store/Templates/TeamTemplate.cs b/LongoMatch.Core/Store/Templates/TeamTemplate.cs
index 8376938..af45b2b 100644
--- a/LongoMatch.Core/Store/Templates/TeamTemplate.cs
+++ b/LongoMatch.Core/Store/Templates/TeamTemplate.cs
@@ -24,6 +24,7 @@ using Newtonsoft.Json;
 
 using LongoMatch.Core.Common;
 using LongoMatch.Core.Interfaces;
+using System.IO;
 
 namespace LongoMatch.Core.Store.Templates
 {
@@ -40,6 +41,8 @@ namespace LongoMatch.Core.Store.Templates
                        }
                        ID = Guid.NewGuid();
                        List = new List<Player>();
+                       string path = Path.Combine (Config.IconsDir, StyleConf.DefaultShield);
+                       Shield = Image.LoadFromFile (path);
                }
                
                public Guid ID {
diff --git a/LongoMatch.Core/StyleConf.cs b/LongoMatch.Core/StyleConf.cs
index b3c709e..a606842 100644
--- a/LongoMatch.Core/StyleConf.cs
+++ b/LongoMatch.Core/StyleConf.cs
@@ -88,6 +88,7 @@ namespace LongoMatch.Core.Common
                
                public const string SubsLock = "hicolor/scalable/actions/longomatch-player-swap-lock.svg";
                public const string SubsUnlock = "hicolor/scalable/actions/longomatch-player-swap-unlock.svg";
+               public const string DefaultShield = "hicolor/scalable/actions/longomatch-default-shield.svg";
 
                public const string EditButton = "hicolor/scalable/actions/longomatch-apply.svg";
                public const string ApplyButton = "hicolor/scalable/actions/longomatch-apply.svg";
diff --git a/LongoMatch.Drawing/CanvasObjects/PlayersTaggerObject.cs 
b/LongoMatch.Drawing/CanvasObjects/PlayersTaggerObject.cs
index 8222790..aca0ff7 100644
--- a/LongoMatch.Drawing/CanvasObjects/PlayersTaggerObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/PlayersTaggerObject.cs
@@ -301,7 +301,12 @@ namespace LongoMatch.Drawing.CanvasObjects
                                homePlayers.AddRange (homePlayingPlayers);
                                homePlayers.AddRange (homeBenchPlayers);
                                homeF = homeTeam.Formation;
-                               homeButton.BackgroundImage = homeTeam.Shield;
+                               if (homeTeam.Shield == null) {
+                                       string path = Path.Combine (Config.IconsDir, StyleConf.DefaultShield);
+                                       homeButton.BackgroundImage = Image.LoadFromFile (path);
+                               } else {
+                                       homeButton.BackgroundImage = homeTeam.Shield;
+                               }
                                NTeams ++;
                        }
                        if (awayTeam != null) {
@@ -310,7 +315,12 @@ namespace LongoMatch.Drawing.CanvasObjects
                                awayPlayers.AddRange (awayPlayingPlayers);
                                awayPlayers.AddRange (awayBenchPlayers);
                                awayF = awayTeam.Formation;
-                               awayButton.BackgroundImage = awayTeam.Shield;
+                               if (awayTeam.Shield == null) {
+                                       string path = Path.Combine (Config.IconsDir, StyleConf.DefaultShield);
+                                       awayButton.BackgroundImage = Image.LoadFromFile (path);
+                               } else {
+                                       awayButton.BackgroundImage = awayTeam.Shield;
+                               }
                                NTeams ++;
                        }
 
diff --git a/LongoMatch.GUI/Gui/Component/TeamTemplateEditor.cs 
b/LongoMatch.GUI/Gui/Component/TeamTemplateEditor.cs
index eab2ebe..dcb9eb4 100644
--- a/LongoMatch.GUI/Gui/Component/TeamTemplateEditor.cs
+++ b/LongoMatch.GUI/Gui/Component/TeamTemplateEditor.cs
@@ -82,9 +82,8 @@ namespace LongoMatch.Gui.Component
                                if (template.Shield != null) {
                                        shieldimage.Pixbuf = template.Shield.Value;
                                } else {
-                                       shieldimage.Pixbuf = Helpers.Misc.LoadIcon (Constants.LOGO_ICON,
-                                                                                        
Constants.MAX_SHIELD_ICON_SIZE,
-                                                                                        
IconLookupFlags.ForceSvg);
+                                       shieldimage.Pixbuf = Helpers.Misc.LoadIcon 
("longomatch-default-shield",
+                                                                                   
Constants.MAX_SHIELD_ICON_SIZE);
                                }
                                teamnameentry.Text = template.TeamName;
                                FillFormation ();
diff --git a/LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs b/LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs
index 39b38a3..f9cc6e2 100644
--- a/LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs
@@ -131,11 +131,11 @@ namespace LongoMatch.Gui.Panel
                                TreeIter iter;
                                
                                if (template.Shield != null) {
-                                       img = template.Shield.Scale (StyleConf.TeamsShieldIconSize, 
StyleConf.TeamsShieldIconSize).Value;
+                                       img = template.Shield.Scale (StyleConf.TeamsShieldIconSize,
+                                                                    StyleConf.TeamsShieldIconSize).Value;
                                } else {
-                                       img = Helpers.Misc.LoadIcon (Constants.LOGO_ICON,
-                                                                    StyleConf.TeamsShieldIconSize,
-                                                                    IconLookupFlags.ForceSvg);
+                                       img = Helpers.Misc.LoadIcon ("longomatch-default-shield",
+                                                                    StyleConf.TeamsShieldIconSize);
                                }
                                iter = teams.AppendValues (img, template.Name, template);
                                itersDict.Add (template.Name, iter);
diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am
index 1d59e29..6eab66b 100644
--- a/data/icons/Makefile.am
+++ b/data/icons/Makefile.am
@@ -31,6 +31,7 @@ nobase_dist_icons_DATA = Makefile.am \
        hicolor/scalable/actions/longomatch-dash-edit_active.svg \
        hicolor/scalable/actions/longomatch-dash-fill.svg \
        hicolor/scalable/actions/longomatch-dash-fit.svg \
+       hicolor/scalable/actions/longomatch-default-shield.svg \
        hicolor/scalable/actions/longomatch-eraser.svg \
        hicolor/scalable/actions/longomatch-eye.svg \
        hicolor/scalable/actions/longomatch-field-full.svg \
diff --git a/data/icons/hicolor/scalable/actions/longomatch-default-shield.svg 
b/data/icons/hicolor/scalable/actions/longomatch-default-shield.svg
new file mode 100644
index 0000000..59b9a27
--- /dev/null
+++ b/data/icons/hicolor/scalable/actions/longomatch-default-shield.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";>
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; x="0px" y="0px"
+        width="36px" height="36px" viewBox="13.49 0 36 36" enable-background="new 13.49 0 36 36" 
xml:space="preserve">
+<path id="plus_12_" fill="#6A6A6A" d="M1730.626,833.451c-0.297,0-0.535-0.238-0.535-0.535v-5.23h-5.229
+       
c-0.297,0-0.537-0.24-0.537-0.535v-3.461c0-0.297,0.24-0.535,0.537-0.535h5.229v-5.23c0-0.299,0.238-0.537,0.535-0.537h3.461
+       
c0.296,0,0.536,0.238,0.536,0.537v5.23h5.229c0.297,0,0.537,0.238,0.537,0.535v3.461c0,0.295-0.24,0.535-0.537,0.535h-5.229v5.23
+       c0,0.297-0.24,0.535-0.536,0.535H1730.626z"/>
+<g>
+       <path fill="#58595B" 
d="M32.43,33.554l-0.363-0.177c-11.954-5.826-11.585-15.118-11.533-15.89V6.542l0.31-0.249
+               
c4.565-3.662,10.307-3.848,11.412-3.848c0.094,0,0.155,0.001,0.185,0.002c0.009-0.001,0.071-0.002,0.165-0.002
+               
c1.104,0,6.846,0.186,11.411,3.848l0.31,0.249v10.945c0.053,0.771,0.422,10.063-11.532,15.89L32.43,33.554z 
M22.189,7.344
+               
l-0.003,10.242c-0.027,0.354-0.534,8.681,10.243,14.122c10.83-5.472,10.25-14.035,10.242-14.122l-0.002-0.068V7.344
+               
c-4.08-3.083-9.083-3.243-10.065-3.243l-0.147,0.002l-0.202-0.002C31.272,4.101,26.271,4.261,22.189,7.344z"/>
+       <g>
+               <path fill-rule="evenodd" clip-rule="evenodd" fill="#6D6E70" 
d="M23.637,9.355v8.304c0,0-0.609,7.332,8.688,11.864V6.479
+                       C32.325,6.479,27.431,6.312,23.637,9.355z"/>
+       </g>
+</g>
+</svg>


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