OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 31 Jul 2009 15:50:17 +0000 (15:50 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 31 Jul 2009 15:50:17 +0000 (15:50 +0000)
- Fixed and issue during scan where missing audio track information would cause the log parser to throw an exception.
- Added support for "Growl for Windows" http://growlforwindows.com/gfw/  - Thanks to bdunnington

git-svn-id: svn://localhost/HandBrake/trunk@2739 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/Changelog.html
win/C#/EncodeQueue/EncodeAndQueueHandler.cs
win/C#/Functions/GrowlCommunicator.cs [new file with mode: 0644]
win/C#/HandBrakeCS.csproj
win/C#/Parsing/AudioTrack.cs
win/C#/frmMain.cs
win/C#/frmOptions.Designer.cs
win/C#/frmOptions.resx
win/C#/libraries/Growl.Connector.dll [new file with mode: 0644]
win/C#/libraries/Growl.CoreLibrary.dll [new file with mode: 0644]

index 9bec1da..bf5df35 100644 (file)
@@ -8,7 +8,29 @@
 <body>\r
 Windows Platform Specific Changlog.<br />\r
 \r
-    <h3>Major Changes</h3>\r
+    <h2>Changes since Snapshot 1 - SVN2592</h2>\r
+    \r
+    <h4>Major Changes</h4>\r
+    - Added support for Sparkle for Windows.<br />\r
+    - Import MacGUI presets.<br />\r
+    - External SRT supported added.<br />\r
+    \r
+    <h4>Minor Improvements / Changes</h4>\r
+    - Some UI layout changes / improvements<br />\r
+    - Added new options: preferred language, "Dub Foreign language audio" and "Use Foreign language audio and Subtitles"<br />\r
+    - Remove M4v from format dropdown and add new option "Use iPod/iTunes friendly (.m4v) file extension for MP4<br />\r
+    \r
+    \r
+    <h4>Fixed</h4>\r
+    - Re-written the Picture Settings Panel code so it should now work alot better.<br />\r
+    - Issue where the GUI would error if the encode was stoped too quickly.<br />\r
+    - Numerous other fixes including: Quality slider resetting to 0 and other settings lost when a title change occurs.<br />\r
+    - Fixes some scaling / quality issues with QuickTime preview. Also added a possible fix for QT not working on 64bit systems.<br />\r
+    \r
+    \r
+    \r
+    <h2>Changes since 0.9.3</h2>\r
+    <h4>Major Changes</h4>\r
 \r
     - Video Preview window using QuickTime or VLC. (5 to 60 second preview clips) <br />\r
     - Re-designed audio tab. Now uses a List and allows for >4 audio channels.<br />\r
@@ -21,9 +43,7 @@ Windows Platform Specific Changlog.<br />
     - Improved control over how logs are stored. Logs are now kept in the Application data folder for each user. <br />\r
     - The Main window and the Queue "Start/Stop" buttons are now linked. Start on the main window starts the Queue. They are no longer separate.<br />\r
 \r
-\r
-\r
-    <h3>Minor Improvements / Changes</h3>\r
+    <h4>Minor Improvements / Changes</h4>\r
     - Resizable queue Window<br />\r
     - Scanning a source no longer uses a separate popup window. Scanning simply disables the main window, and displays the status much like the MacGUI<br />\r
     - Queue recovery now uses an XML file.<br />\r
@@ -44,9 +64,7 @@ Windows Platform Specific Changlog.<br />
     - CLI status can now be displayed in-GUI instead of the CLI readout. (Experimental)<br />\r
     - Misc Typo's<br />\r
 \r
-\r
-\r
-    <h3>Fixed</h3>\r
+    <h4>Fixed</h4>\r
     - Source and Destination fields unpopulated on queue in certain conditions.<br />\r
     - Several bugs in the way x264 widgets are handled with custom x264 strings.<br />\r
     - Fixed a null pointer exception after scan if all presets had been deleted.<br />\r
index 319163d..a3f8ca6 100644 (file)
@@ -448,6 +448,9 @@ namespace Handbrake.EncodeQueue
                 case "Lock System":\r
                     Win32.LockWorkStation();\r
                     break;\r
+                case "Growl Notification":\r
+                    GrowlCommunicator.Notify();\r
+                    break;\r
                 case "Quit HandBrake":\r
                     Application.Exit();\r
                     break;\r
diff --git a/win/C#/Functions/GrowlCommunicator.cs b/win/C#/Functions/GrowlCommunicator.cs
new file mode 100644 (file)
index 0000000..eb4091a
--- /dev/null
@@ -0,0 +1,109 @@
+using System;\r
+using System.Collections.Generic;\r
+using System.Text;\r
+using Growl.Connector;\r
+using Growl.CoreLibrary;\r
+\r
+namespace Handbrake.Functions\r
+{\r
+    /// <summary>\r
+    /// Provides all functionality for communicating with Growl for Windows.\r
+    /// </summary>\r
+    /// <remarks>\r
+    /// This class is implemented as a static class because:\r
+    ///     1. It allows nearly all of the Growl-related code to be in one place\r
+    ///     2. It prevents the main form, queue handler, and any other part of Handbrake from having to declare\r
+    ///        or track any new instance variables\r
+    /// </remarks>\r
+    public static class GrowlCommunicator\r
+    {\r
+        /// <summary>\r
+        /// The <see cref="GrowlConnector"/> that actually talks to Growl\r
+        /// </summary>\r
+        private static GrowlConnector growl;\r
+\r
+        /// <summary>\r
+        /// The Handbrake application instance that is registered with Growl\r
+        /// </summary>\r
+        private static Application application;\r
+\r
+        /// <summary>\r
+        /// Notification shown upon completion of encoding\r
+        /// </summary>\r
+        public static NotificationType EncodingComplete;\r
+\r
+\r
+        /// <summary>\r
+        /// Checks to see if Growl is currently running on the local machine.\r
+        /// </summary>\r
+        /// <returns>\r
+        /// <c>true</c> if Growl is running;\r
+        /// <c>false</c> otherwise\r
+        /// </returns>\r
+        public static bool IsRunning()\r
+        {\r
+            Initialize();\r
+\r
+            return growl.IsGrowlRunning();\r
+        }\r
+\r
+        /// <summary>\r
+        /// Registers Handbrake with the local Growl instance\r
+        /// </summary>\r
+        /// <remarks>\r
+        /// This should usually be called at application start-up\r
+        /// </remarks>\r
+        public static void Register()\r
+        {\r
+            Initialize();\r
+\r
+            growl.Register(application, new NotificationType[] { EncodingComplete });\r
+        }\r
+\r
+        /// <summary>\r
+        /// Sends a notification to Growl. (Since Handbrake currently only supports one type of notification with\r
+        /// static text, this is a shortcut method).\r
+        /// </summary>\r
+        public static void Notify()\r
+        {\r
+            string title = "Encoding Complete";\r
+            string text = "Put down that cocktail...\nyour Handbrake encode is done.";\r
+            Notification notification = new Notification(application.Name, EncodingComplete.Name, String.Empty, title, text);\r
+\r
+            growl.Notify(notification);\r
+        }\r
+\r
+        /// <summary>\r
+        /// Sends a notification to Growl. (This is the more generic version that could be used in the future if \r
+        /// more notification types are implemented)\r
+        /// </summary>\r
+        /// <param name="notificationType">The <see cref="NotificationType">type</see> of notification to send</param>\r
+        /// <param name="title">The notification title</param>\r
+        /// <param name="text">The notification text</param>\r
+        /// <param name="imageUrl">The notification image as a url</param>\r
+        public static void Notify(NotificationType notificationType, string title, string text, string imageUrl)\r
+        {\r
+            Notification notification = new Notification(application.Name, notificationType.Name, String.Empty, title, text);\r
+            notification.Icon = imageUrl;\r
+\r
+            growl.Notify(notification);\r
+        }\r
+\r
+        /// <summary>\r
+        /// Initializes the GrowlCommunicator\r
+        /// </summary>\r
+        private static void Initialize()\r
+        {\r
+            if (growl == null)\r
+            {\r
+                growl = new GrowlConnector();\r
+                growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText;\r
+\r
+                application = new Application("Handbrake");\r
+                application.Icon = global::Handbrake.Properties.Resources.logo64;\r
+\r
+                EncodingComplete = new NotificationType("Encoding Complete");\r
+            }\r
+        }\r
+    }\r
+}\r
index e89fa54..9f1667c 100644 (file)
     <PlatformTarget>x86</PlatformTarget>\r
   </PropertyGroup>\r
   <ItemGroup>\r
+    <Reference Include="Growl.Connector, Version=2.0.0.0, Culture=neutral, PublicKeyToken=980c2339411be384, processorArchitecture=x86">\r
+      <SpecificVersion>False</SpecificVersion>\r
+      <HintPath>libraries\Growl.Connector.dll</HintPath>\r
+      <Private>True</Private>\r
+    </Reference>\r
+    <Reference Include="Growl.CoreLibrary, Version=2.0.0.0, Culture=neutral, PublicKeyToken=13e59d82e007b064, processorArchitecture=x86">\r
+      <SpecificVersion>False</SpecificVersion>\r
+      <HintPath>libraries\Growl.CoreLibrary.dll</HintPath>\r
+      <Private>True</Private>\r
+    </Reference>\r
     <Reference Include="PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=x86" />\r
     <Reference Include="PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />\r
     <Reference Include="System" />\r
     <Compile Include="frmUpdater.designer.cs">\r
       <DependentUpon>frmUpdater.cs</DependentUpon>\r
     </Compile>\r
+    <Compile Include="Functions\GrowlCommunicator.cs" />\r
     <Compile Include="Functions\PresetLoader.cs" />\r
     <Compile Include="Functions\QueryGenerator.cs" />\r
     <Compile Include="Functions\Main.cs" />\r
index c4e1bbc..56a3519 100644 (file)
@@ -99,6 +99,8 @@ namespace Handbrake.Parsing
             Match bitrate = Regex.Match(audio_track, @"([0-9]*)bps");\r
 \r
             string subformat = m.Groups[4].Value.Trim().Contains("iso639") ? null : m.Groups[4].Value;\r
+            string samplerateVal = samplerate.Success ? samplerate.Groups[0].Value.Replace("Hz", "").Trim() : "0";\r
+            string bitrateVal = bitrate.Success ? bitrate.Groups[0].Value.Replace("bps", "").Trim() : "0";\r
 \r
             if (track.Success)\r
             {\r
@@ -108,8 +110,8 @@ namespace Handbrake.Parsing
                     m_language = track.Groups[2].Value,\r
                     m_format = m.Groups[3].Value,\r
                     m_subFormat = subformat,\r
-                    m_frequency = int.Parse(samplerate.Groups[0].Value.Replace("Hz","").Trim()),\r
-                    m_bitrate = int.Parse(bitrate.Groups[0].Value.Replace("bps","").Trim()),\r
+                    m_frequency = int.Parse(samplerateVal),\r
+                    m_bitrate = int.Parse(bitrateVal),\r
                     m_iso639_2 = iso639_2.Value.Replace("iso639-2: ", "").Replace(")", "")\r
                 };\r
                 return thisTrack; \r
index e40f558..94e2cc6 100644 (file)
@@ -119,6 +119,9 @@ namespace Handbrake
             if (Properties.Settings.Default.tooltipEnable)\r
                 ToolTip.Active = true;\r
 \r
+            // Register with Growl (if not using Growl for the encoding completion action, this wont hurt anything)\r
+            GrowlCommunicator.Register();\r
+\r
             //Finished Loading\r
             lblStatus.Text = "Loading Complete!";\r
             Application.DoEvents();\r
@@ -1440,7 +1443,7 @@ namespace Handbrake
                             dvdInfoPath);\r
                     }\r
 \r
-                    using (StreamReader sr = new StreamReader(dvdInfoPath))\r
+                    using (StreamReader sr = new StreamReader("scanlog.txt"))\r
                     {\r
                         thisDVD = DVD.Parse(sr);\r
                         sr.Close();\r
index 9d54c4e..ff14b8a 100644 (file)
@@ -176,6 +176,7 @@ namespace Handbrake
             "Hibernate",\r
             "Lock system",\r
             "Log off",\r
+            "Growl Notification",\r
             "Quit HandBrake"});\r
             this.drp_completeOption.Location = new System.Drawing.Point(106, 119);\r
             this.drp_completeOption.Name = "drp_completeOption";\r
index 427cdd9..139d824 100644 (file)
   <metadata name="ToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
     <value>132, 18</value>\r
   </metadata>\r
-  <metadata name="ToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
-    <value>132, 18</value>\r
-  </metadata>\r
   <metadata name="pathFinder.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
     <value>17, 17</value>\r
   </metadata>\r
diff --git a/win/C#/libraries/Growl.Connector.dll b/win/C#/libraries/Growl.Connector.dll
new file mode 100644 (file)
index 0000000..29e33d6
Binary files /dev/null and b/win/C#/libraries/Growl.Connector.dll differ
diff --git a/win/C#/libraries/Growl.CoreLibrary.dll b/win/C#/libraries/Growl.CoreLibrary.dll
new file mode 100644 (file)
index 0000000..0cfe12d
Binary files /dev/null and b/win/C#/libraries/Growl.CoreLibrary.dll differ