[longomatch] Check if we have codecs providers and show a dialog if not. The dialog will present a legal disclaim



commit 570e5ab869ab73a7203b1413c9aece71cc9f87f2
Author: Julien Moutte <julien fluendo com>
Date:   Fri Nov 7 18:29:39 2014 +0100

    Check if we have codecs providers and show a dialog if not.
    The dialog will present a legal disclaimer and provide 2 options : Get the Pro version or install the 
open source codecs at risk.

 LongoMatch.Core/Common/Constants.cs                |    4 +
 LongoMatch.GUI/Gui/Dialog/CodecsChoiceDialog.cs    |   30 +++++
 LongoMatch.GUI/LongoMatch.GUI.csproj               |    2 +
 .../LongoMatch.Gui.Dialog.CodecsChoiceDialog.cs    |  109 +++++++++++++++++
 LongoMatch.GUI/gtk-gui/gui.stetic                  |  125 ++++++++++++++++++++
 LongoMatch/LongoMatch.csproj                       |    1 +
 LongoMatch/Main.cs                                 |   20 +++-
 7 files changed, 290 insertions(+), 1 deletions(-)
---
diff --git a/LongoMatch.Core/Common/Constants.cs b/LongoMatch.Core/Common/Constants.cs
index 70070ed..fbfd36b 100644
--- a/LongoMatch.Core/Common/Constants.cs
+++ b/LongoMatch.Core/Common/Constants.cs
@@ -73,6 +73,10 @@ Xavier Queralt Mateu (ca)";
 
                public const string WEBSITE = "http://www.longomatch.org";;
 
+               public const string PRO_WEBSITE = "http://www.longomatch.org/pro";;
+
+               public const string FREE_CODECS_WEBSITE = "http://www.longomatch.org/free";;
+
                public const string MANUAL = "http://www.longomatch.org/documentation/manual.html";;
 
 #if HAVE_GTK
diff --git a/LongoMatch.GUI/Gui/Dialog/CodecsChoiceDialog.cs b/LongoMatch.GUI/Gui/Dialog/CodecsChoiceDialog.cs
new file mode 100644
index 0000000..8a63470
--- /dev/null
+++ b/LongoMatch.GUI/Gui/Dialog/CodecsChoiceDialog.cs
@@ -0,0 +1,30 @@
+//
+//  Copyright (C) 2014 dolphy
+//
+//  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.Dialog
+{
+       public partial class CodecsChoiceDialog : Gtk.Dialog
+       {
+               public CodecsChoiceDialog ()
+               {
+                       this.Build ();
+               }
+       }
+}
+
diff --git a/LongoMatch.GUI/LongoMatch.GUI.csproj b/LongoMatch.GUI/LongoMatch.GUI.csproj
index 6ba853f..cdcdccb 100644
--- a/LongoMatch.GUI/LongoMatch.GUI.csproj
+++ b/LongoMatch.GUI/LongoMatch.GUI.csproj
@@ -194,6 +194,8 @@
     <Compile Include="gtk-gui\LongoMatch.Gui.Component.EventsListWidget.cs" />
     <Compile Include="Gui\Component\PluginsPreferences.cs" />
     <Compile Include="gtk-gui\LongoMatch.Gui.Component.PluginsPreferences.cs" />
+    <Compile Include="Gui\Dialog\CodecsChoiceDialog.cs" />
+    <Compile Include="gtk-gui\LongoMatch.Gui.Dialog.CodecsChoiceDialog.cs" />
   </ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="gtk-gui\gui.stetic">
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Dialog.CodecsChoiceDialog.cs 
b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Dialog.CodecsChoiceDialog.cs
new file mode 100644
index 0000000..63ea2e9
--- /dev/null
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Dialog.CodecsChoiceDialog.cs
@@ -0,0 +1,109 @@
+
+// This file has been generated by the GUI designer. Do not modify.
+namespace LongoMatch.Gui.Dialog
+{
+       public partial class CodecsChoiceDialog
+       {
+               private global::Gtk.VBox vbox2;
+               private global::Gtk.HBox hbox1;
+               private global::Gtk.Image titleimage;
+               private global::Gtk.Label titlelabel;
+               private global::Gtk.ScrolledWindow GtkScrolledWindow;
+               private global::Gtk.TextView disclaimertextview;
+               private global::Gtk.Button buttonCancel;
+               private global::Gtk.Button buttonOk;
+
+               protected virtual void Build ()
+               {
+                       global::Stetic.Gui.Initialize (this);
+                       // Widget LongoMatch.Gui.Dialog.CodecsChoiceDialog
+                       this.Name = "LongoMatch.Gui.Dialog.CodecsChoiceDialog";
+                       this.WindowPosition = ((global::Gtk.WindowPosition)(4));
+                       // Internal child LongoMatch.Gui.Dialog.CodecsChoiceDialog.VBox
+                       global::Gtk.VBox w1 = this.VBox;
+                       w1.Name = "dialog1_VBox";
+                       w1.BorderWidth = ((uint)(2));
+                       // Container child dialog1_VBox.Gtk.Box+BoxChild
+                       this.vbox2 = new global::Gtk.VBox ();
+                       this.vbox2.Name = "vbox2";
+                       this.vbox2.Spacing = 6;
+                       // Container child vbox2.Gtk.Box+BoxChild
+                       this.hbox1 = new global::Gtk.HBox ();
+                       this.hbox1.Name = "hbox1";
+                       this.hbox1.Spacing = 6;
+                       // Container child hbox1.Gtk.Box+BoxChild
+                       this.titleimage = new global::Gtk.Image ();
+                       this.titleimage.Name = "titleimage";
+                       this.titleimage.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, 
"gtk-dialog-warning", global::Gtk.IconSize.Dialog);
+                       this.hbox1.Add (this.titleimage);
+                       global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.hbox1 
[this.titleimage]));
+                       w2.Position = 0;
+                       w2.Expand = false;
+                       w2.Fill = false;
+                       // Container child hbox1.Gtk.Box+BoxChild
+                       this.titlelabel = new global::Gtk.Label ();
+                       this.titlelabel.Name = "titlelabel";
+                       this.titlelabel.LabelProp = global::Mono.Unix.Catalog.GetString ("Missing multimedia 
components");
+                       this.hbox1.Add (this.titlelabel);
+                       global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox1 
[this.titlelabel]));
+                       w3.Position = 1;
+                       this.vbox2.Add (this.hbox1);
+                       global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.hbox1]));
+                       w4.Position = 0;
+                       w4.Expand = false;
+                       w4.Fill = false;
+                       // Container child vbox2.Gtk.Box+BoxChild
+                       this.GtkScrolledWindow = new global::Gtk.ScrolledWindow ();
+                       this.GtkScrolledWindow.Name = "GtkScrolledWindow";
+                       this.GtkScrolledWindow.ShadowType = ((global::Gtk.ShadowType)(1));
+                       // Container child GtkScrolledWindow.Gtk.Container+ContainerChild
+                       this.disclaimertextview = new global::Gtk.TextView ();
+                       this.disclaimertextview.Buffer.Text = "We advise you to use our professional pack 
OnePlay ® with fully licensed patents. \n\nYou might want to install the codecs available from other sources. 
We inform you that we do not make any representation as to their availability, their fitness to the purpose 
and we provide some links for your convenience only.  \n\nCertain software, and in particular software that 
implements multimedia standard formats such as Mp3, MPEG 2 video and audio, h.264, MPEG 4 audio and video, 
AC3, etc, can have patent issues. In certain countries patents are granted on software and even software-only 
solution are by and large considered patentable and are patented (such as in the United States). In certain 
others, patents on pure software solutions are formally prohibited, but granted (this is the case of Europe), 
and in others again are neither allowed nor granted.\n\nIt is up to you to make sure that in the countries 
where Longomatch is used, a license
  from the applicable patent holders on the codec packages is required or not. Receiving Longomatch– or links 
to other downloadable software – does not provide any license expressed or implied over these patents, except 
in very limited conditions where the license so provides. No representation is made.\n\nBesides, your 
provider could be actively filtering the target URLs.\n\nInstalling these codecs will therefore be entirely 
at your risk.";
+                       this.disclaimertextview.CanFocus = true;
+                       this.disclaimertextview.Name = "disclaimertextview";
+                       this.disclaimertextview.WrapMode = ((global::Gtk.WrapMode)(3));
+                       this.GtkScrolledWindow.Add (this.disclaimertextview);
+                       this.vbox2.Add (this.GtkScrolledWindow);
+                       global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vbox2 
[this.GtkScrolledWindow]));
+                       w6.Position = 1;
+                       w1.Add (this.vbox2);
+                       global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(w1 [this.vbox2]));
+                       w7.Position = 0;
+                       // Internal child LongoMatch.Gui.Dialog.CodecsChoiceDialog.ActionArea
+                       global::Gtk.HButtonBox w8 = this.ActionArea;
+                       w8.Name = "dialog1_ActionArea";
+                       w8.Spacing = 10;
+                       w8.BorderWidth = ((uint)(5));
+                       w8.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4));
+                       // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
+                       this.buttonCancel = new global::Gtk.Button ();
+                       this.buttonCancel.CanDefault = true;
+                       this.buttonCancel.CanFocus = true;
+                       this.buttonCancel.Name = "buttonCancel";
+                       this.buttonCancel.UseUnderline = true;
+                       this.buttonCancel.Label = global::Mono.Unix.Catalog.GetString ("Get me to the free 
codecs at my own _risk");
+                       this.AddActionWidget (this.buttonCancel, -2);
+                       global::Gtk.ButtonBox.ButtonBoxChild w9 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w8 
[this.buttonCancel]));
+                       w9.Expand = false;
+                       w9.Fill = false;
+                       // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
+                       this.buttonOk = new global::Gtk.Button ();
+                       this.buttonOk.CanDefault = true;
+                       this.buttonOk.CanFocus = true;
+                       this.buttonOk.Name = "buttonOk";
+                       this.buttonOk.UseUnderline = true;
+                       this.buttonOk.Label = global::Mono.Unix.Catalog.GetString ("I want the _professional 
pack !");
+                       this.AddActionWidget (this.buttonOk, -3);
+                       global::Gtk.ButtonBox.ButtonBoxChild w10 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w8 
[this.buttonOk]));
+                       w10.Position = 1;
+                       w10.Expand = false;
+                       w10.Fill = false;
+                       if ((this.Child != null)) {
+                               this.Child.ShowAll ();
+                       }
+                       this.DefaultWidth = 606;
+                       this.DefaultHeight = 300;
+                       this.Show ();
+               }
+       }
+}
diff --git a/LongoMatch.GUI/gtk-gui/gui.stetic b/LongoMatch.GUI/gtk-gui/gui.stetic
index 5bab058..d48b965 100644
--- a/LongoMatch.GUI/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI/gtk-gui/gui.stetic
@@ -11920,4 +11920,129 @@ You can continue with the current capture, cancel it or save your project.
       </widget>
     </child>
   </widget>
+  <widget class="Gtk.Dialog" id="LongoMatch.Gui.Dialog.CodecsChoiceDialog" design-size="606 300">
+    <property name="MemberName" />
+    <property name="WindowPosition">CenterOnParent</property>
+    <property name="Buttons">2</property>
+    <property name="HelpButton">False</property>
+    <child internal-child="VBox">
+      <widget class="Gtk.VBox" id="dialog1_VBox">
+        <property name="MemberName" />
+        <property name="BorderWidth">2</property>
+        <child>
+          <widget class="Gtk.VBox" id="vbox2">
+            <property name="MemberName" />
+            <property name="Spacing">6</property>
+            <child>
+              <widget class="Gtk.HBox" id="hbox1">
+                <property name="MemberName" />
+                <property name="Spacing">6</property>
+                <child>
+                  <widget class="Gtk.Image" id="titleimage">
+                    <property name="MemberName" />
+                    <property name="Pixbuf">stock:gtk-dialog-warning Dialog</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="titlelabel">
+                    <property name="MemberName" />
+                    <property name="LabelProp" translatable="yes">Missing multimedia components</property>
+                  </widget>
+                  <packing>
+                    <property name="Position">1</property>
+                    <property name="AutoSize">False</property>
+                  </packing>
+                </child>
+              </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.ScrolledWindow" id="GtkScrolledWindow">
+                <property name="MemberName" />
+                <property name="ShadowType">In</property>
+                <child>
+                  <widget class="Gtk.TextView" id="disclaimertextview">
+                    <property name="MemberName" />
+                    <property name="CanFocus">True</property>
+                    <property name="ShowScrollbars">True</property>
+                    <property name="Text" translatable="yes" context="yes">Legal disclaimers when no codec 
pack is detected|We advise you to use our professional pack OnePlay ® with fully licensed patents. 
+
+You might want to install the codecs available from other sources. We inform you that we do not make any 
representation as to their availability, their fitness to the purpose and we provide some links for your 
convenience only.  
+
+Certain software, and in particular software that implements multimedia standard formats such as Mp3, MPEG 2 
video and audio, h.264, MPEG 4 audio and video, AC3, etc, can have patent issues. In certain countries 
patents are granted on software and even software-only solution are by and large considered patentable and 
are patented (such as in the United States). In certain others, patents on pure software solutions are 
formally prohibited, but granted (this is the case of Europe), and in others again are neither allowed nor 
granted.
+
+It is up to you to make sure that in the countries where Longomatch is used, a license from the applicable 
patent holders on the codec packages is required or not. Receiving Longomatch– or links to other downloadable 
software – does not provide any license expressed or implied over these patents, except in very limited 
conditions where the license so provides. No representation is made.
+
+Besides, your provider could be actively filtering the target URLs.
+
+Installing these codecs will therefore be entirely at your risk.</property>
+                    <property name="WrapMode">WordChar</property>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="Position">1</property>
+                <property name="AutoSize">True</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="Position">0</property>
+            <property name="AutoSize">True</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+    <child internal-child="ActionArea">
+      <widget class="Gtk.HButtonBox" id="dialog1_ActionArea">
+        <property name="MemberName" />
+        <property name="Spacing">10</property>
+        <property name="BorderWidth">5</property>
+        <property name="Size">2</property>
+        <property name="LayoutStyle">End</property>
+        <child>
+          <widget class="Gtk.Button" id="buttonCancel">
+            <property name="MemberName" />
+            <property name="CanDefault">True</property>
+            <property name="CanFocus">True</property>
+            <property name="Type">TextOnly</property>
+            <property name="Label" translatable="yes">Get me to the free codecs at my own _risk</property>
+            <property name="UseUnderline">True</property>
+            <property name="ResponseId">-2</property>
+          </widget>
+          <packing>
+            <property name="Expand">False</property>
+            <property name="Fill">False</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="Gtk.Button" id="buttonOk">
+            <property name="MemberName" />
+            <property name="CanDefault">True</property>
+            <property name="CanFocus">True</property>
+            <property name="Type">TextOnly</property>
+            <property name="Label" translatable="yes">I want the _professional pack !</property>
+            <property name="UseUnderline">True</property>
+            <property name="ResponseId">-3</property>
+          </widget>
+          <packing>
+            <property name="Position">1</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/LongoMatch.csproj b/LongoMatch/LongoMatch.csproj
index 5410f59..5d92a90 100644
--- a/LongoMatch/LongoMatch.csproj
+++ b/LongoMatch/LongoMatch.csproj
@@ -53,6 +53,7 @@
     <Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
       <Package>gtk-sharp-2.0</Package>
     </Reference>
+    <Reference Include="System" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\LongoMatch.Services\LongoMatch.Services.csproj">
diff --git a/LongoMatch/Main.cs b/LongoMatch/Main.cs
index 3043a7d..ea31b72 100644
--- a/LongoMatch/Main.cs
+++ b/LongoMatch/Main.cs
@@ -24,6 +24,7 @@ using LongoMatch.Addins;
 using LongoMatch.Core.Common;
 using LongoMatch.Drawing.Cairo;
 using LongoMatch.Gui;
+using LongoMatch.Gui.Dialog;
 using LongoMatch.Gui.Helpers;
 using LongoMatch.Core.Interfaces.Multimedia;
 using LongoMatch.Multimedia.Utils;
@@ -53,7 +54,7 @@ namespace LongoMatch
                        try {
                                AddinsManager.Initialize (Config.PluginsConfigDir, Config.PluginsDir);
                                AddinsManager.LoadConfigModifierAddins ();
-                               AddinsManager.RegisterGStreamerPlugins ();
+                               bool haveCodecs = AddinsManager.RegisterGStreamerPlugins ();
                                Config.DrawingToolkit = new CairoBackend ();
                                Config.EventsBroker = new EventsBroker ();
                                IMultimediaToolkit multimediaToolkit = new MultimediaToolkit ();
@@ -61,6 +62,23 @@ namespace LongoMatch
                                GUIToolkit guiToolkit = new GUIToolkit (version);
                                AddinsManager.LoadExportProjectAddins (guiToolkit.MainController);
                                AddinsManager.LoadMultimediaBackendsAddins (multimediaToolkit);
+
+                               if (!haveCodecs) {
+                                       CodecsChoiceDialog ccd = new CodecsChoiceDialog ();
+                                       int response = ccd.Run ();
+                                       if (response == (int) ResponseType.Accept) {
+                                               try {
+                                                       System.Diagnostics.Process.Start 
(Constants.PRO_WEBSITE);
+                                               } catch {
+                                               }
+                                       } else if (response == (int) ResponseType.Reject) {
+                                               try {
+                                                       System.Diagnostics.Process.Start 
(Constants.FREE_CODECS_WEBSITE);
+                                               } catch {
+                                               }
+                                       }
+                                       ccd.Destroy ();
+                               }
                                try {
                                        CoreServices.Start (guiToolkit, multimediaToolkit);
                                } catch (DBLockedException locked) {


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