]> granicus.if.org Git - handbrake/commitdiff
WinGui: Array of fixes and changes
authorsr55 <sr55.hb@outlook.com>
Fri, 20 Jul 2012 13:24:52 +0000 (13:24 +0000)
committersr55 <sr55.hb@outlook.com>
Fri, 20 Jul 2012 13:24:52 +0000 (13:24 +0000)
- Change Font rendering to "Display" mode to see if folks prefer it. If not it can be reverted back.
- Fixes to Queue Edit for the Audio/Subs panel. These should now populate correctly.
- Thrown the Drive detector onto a background thread as it seems the windows drive management service can get "stuck" and block the app from starting while it waits.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4867 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/CS/HandBrake.ApplicationServices/Parsing/Audio.cs
win/CS/HandBrake.ApplicationServices/Parsing/Subtitle.cs
win/CS/HandBrakeWPF/Services/DriveDetectService.cs
win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs
win/CS/HandBrakeWPF/Views/AdvancedView.xaml
win/CS/HandBrakeWPF/Views/MainView.xaml
win/CS/HandBrakeWPF/Views/ShellView.xaml
win/CS/HandBrakeWPF/Views/Styles/Styles.xaml
win/CS/HandBrakeWPF/Views/VideoView.xaml

index 0e65a3502252bd0015a96bbf34d8266a689267ed..b78ca5ad8641ba2d66eff027dbf8b8b80328d975 100644 (file)
@@ -112,5 +112,70 @@ namespace HandBrake.ApplicationServices.Parsing
 \r
             return string.Format("{0} {1} ({2}) ({3})", this.TrackNumber, this.Language, this.Format, this.Description);\r
         }\r
+\r
+        /// <summary>\r
+        /// The equals.\r
+        /// </summary>\r
+        /// <param name="other">\r
+        /// The other.\r
+        /// </param>\r
+        /// <returns>\r
+        /// The System.Boolean.\r
+        /// </returns>\r
+        public bool Equals(Audio other)\r
+        {\r
+            if (ReferenceEquals(null, other))\r
+            {\r
+                return false;\r
+            }\r
+            if (ReferenceEquals(this, other))\r
+            {\r
+                return true;\r
+            }\r
+            return other.TrackNumber == this.TrackNumber && object.Equals(other.Language, this.Language) && object.Equals(other.LanguageCode, this.LanguageCode) && object.Equals(other.Format, this.Format);\r
+        }\r
+\r
+        /// <summary>\r
+        /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.\r
+        /// </summary>\r
+        /// <returns>\r
+        /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.\r
+        /// </returns>\r
+        /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>. </param><filterpriority>2</filterpriority>\r
+        public override bool Equals(object obj)\r
+        {\r
+            if (ReferenceEquals(null, obj))\r
+            {\r
+                return false;\r
+            }\r
+            if (ReferenceEquals(this, obj))\r
+            {\r
+                return true;\r
+            }\r
+            if (obj.GetType() != typeof(Audio))\r
+            {\r
+                return false;\r
+            }\r
+            return Equals((Audio)obj);\r
+        }\r
+\r
+        /// <summary>\r
+        /// Serves as a hash function for a particular type. \r
+        /// </summary>\r
+        /// <returns>\r
+        /// A hash code for the current <see cref="T:System.Object"/>.\r
+        /// </returns>\r
+        /// <filterpriority>2</filterpriority>\r
+        public override int GetHashCode()\r
+        {\r
+            unchecked\r
+            {\r
+                int result = this.TrackNumber;\r
+                result = (result * 397) ^ (this.Language != null ? this.Language.GetHashCode() : 0);\r
+                result = (result * 397) ^ (this.LanguageCode != null ? this.LanguageCode.GetHashCode() : 0);\r
+                result = (result * 397) ^ (this.Format != null ? this.Format.GetHashCode() : 0);\r
+                return result;\r
+            }\r
+        }\r
     }\r
 }
\ No newline at end of file
index 6548f3aafcc5376503278421b843c3169c649a70..20deeae1b5713c5b42014a095db5562ba56bb7c6 100644 (file)
@@ -175,5 +175,70 @@ namespace HandBrake.ApplicationServices.Parsing
         {\r
             return this.SubtitleType == SubtitleType.ForeignAudioSearch ? "Foreign Audio Scan" : string.Format("{0} {1} ({2})", this.TrackNumber, this.Language, this.TypeString);\r
         }\r
+\r
+        /// <summary>\r
+        /// The equals.\r
+        /// </summary>\r
+        /// <param name="other">\r
+        /// The other.\r
+        /// </param>\r
+        /// <returns>\r
+        /// The System.Boolean.\r
+        /// </returns>\r
+        public bool Equals(Subtitle other)\r
+        {\r
+            if (ReferenceEquals(null, other))\r
+            {\r
+                return false;\r
+            }\r
+            if (ReferenceEquals(this, other))\r
+            {\r
+                return true;\r
+            }\r
+            return other.TrackNumber == this.TrackNumber && object.Equals(other.Language, this.Language) && object.Equals(other.LanguageCode, this.LanguageCode) && object.Equals(other.SubtitleType, this.SubtitleType);\r
+        }\r
+\r
+        /// <summary>\r
+        /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.\r
+        /// </summary>\r
+        /// <returns>\r
+        /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.\r
+        /// </returns>\r
+        /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>. </param><filterpriority>2</filterpriority>\r
+        public override bool Equals(object obj)\r
+        {\r
+            if (ReferenceEquals(null, obj))\r
+            {\r
+                return false;\r
+            }\r
+            if (ReferenceEquals(this, obj))\r
+            {\r
+                return true;\r
+            }\r
+            if (obj.GetType() != typeof(Subtitle))\r
+            {\r
+                return false;\r
+            }\r
+            return Equals((Subtitle)obj);\r
+        }\r
+\r
+        /// <summary>\r
+        /// Serves as a hash function for a particular type. \r
+        /// </summary>\r
+        /// <returns>\r
+        /// A hash code for the current <see cref="T:System.Object"/>.\r
+        /// </returns>\r
+        /// <filterpriority>2</filterpriority>\r
+        public override int GetHashCode()\r
+        {\r
+            unchecked\r
+            {\r
+                int result = this.TrackNumber;\r
+                result = (result * 397) ^ (this.Language != null ? this.Language.GetHashCode() : 0);\r
+                result = (result * 397) ^ (this.LanguageCode != null ? this.LanguageCode.GetHashCode() : 0);\r
+                result = (result * 397) ^ this.SubtitleType.GetHashCode();\r
+                return result;\r
+            }\r
+        }\r
     }\r
 }
\ No newline at end of file
index 7f1b3f9b9047ee6c46d4d3ecb4b3db390e820040..3a4ef51131f2154c26c198070421e7a51b0ea160 100644 (file)
@@ -11,6 +11,7 @@ namespace HandBrakeWPF.Services
 {\r
     using System;\r
     using System.Management;\r
+    using System.Threading;\r
 \r
     using HandBrakeWPF.Services.Interfaces;\r
 \r
@@ -37,28 +38,32 @@ namespace HandBrakeWPF.Services
         /// </param>\r
         public void StartDetection(Action action)\r
         {\r
-            this.detectionAction = action;\r
+            ThreadPool.QueueUserWorkItem(\r
+                delegate\r
+                {\r
+                    this.detectionAction = action;\r
 \r
-            var options = new ConnectionOptions { EnablePrivileges = true };\r
-            var scope = new ManagementScope(@"root\CIMV2", options);\r
+                    var options = new ConnectionOptions { EnablePrivileges = true };\r
+                    var scope = new ManagementScope(@"root\CIMV2", options);\r
 \r
-            try\r
-            {\r
-                var query = new WqlEventQuery\r
-                {\r
-                    EventClassName = "__InstanceModificationEvent",\r
-                    WithinInterval = TimeSpan.FromSeconds(1),\r
-                    Condition = @"TargetInstance ISA 'Win32_LogicalDisk' and TargetInstance.DriveType = 5" // DriveType - 5: CDROM\r
-                };\r
+                    try\r
+                    {\r
+                        var query = new WqlEventQuery\r
+                        {\r
+                            EventClassName = "__InstanceModificationEvent",\r
+                            WithinInterval = TimeSpan.FromSeconds(1),\r
+                            Condition = @"TargetInstance ISA 'Win32_LogicalDisk' and TargetInstance.DriveType = 5" // DriveType - 5: CDROM\r
+                        };\r
 \r
-                this.watcher = new ManagementEventWatcher(scope, query);\r
-                this.watcher.EventArrived += this.WatcherEventArrived;\r
-                this.watcher.Start();\r
-            }\r
-            catch (Exception e)\r
-            {\r
-                Console.WriteLine(e.Message);\r
-            }\r
+                        this.watcher = new ManagementEventWatcher(scope, query);\r
+                        this.watcher.EventArrived += this.WatcherEventArrived;\r
+                        this.watcher.Start();\r
+                    }\r
+                    catch (Exception e)\r
+                    {\r
+                        Console.WriteLine(e.Message);\r
+                    }\r
+                });\r
         }\r
 \r
         /// <summary>\r
@@ -66,7 +71,10 @@ namespace HandBrakeWPF.Services
         /// </summary>\r
         public void Close()\r
         {\r
-            this.watcher.Stop();\r
+            if (watcher != null)\r
+            {\r
+                this.watcher.Stop();\r
+            }\r
         }\r
 \r
         /// <summary>\r
index aea8461bca5a349b568df1aa7d6e858b0bda01b5..c1df4b8be42d9e71b9e499ff41f2d18a62b5084c 100644 (file)
@@ -1114,6 +1114,21 @@ namespace HandBrakeWPF.ViewModels
                 MessageBoxImage.Information);\r
         }\r
 \r
+        /// <summary>\r
+        /// The debug scan log.\r
+        /// </summary>\r
+        public void DebugScanLog()\r
+        {\r
+            VistaOpenFileDialog dialog = new VistaOpenFileDialog();\r
+             \r
+            dialog.ShowDialog();\r
+\r
+            if (File.Exists(dialog.FileName))\r
+            {\r
+                this.scanService.DebugScanLog(dialog.FileName);\r
+            }    \r
+        }\r
+\r
         #endregion\r
 \r
         #region Main Window Public Methods\r
index 5950bc448a7f62be0da13867e9e14abc87ce8ab1..d5e949809c312d21c30fb0781c360f62affedd3d 100644 (file)
@@ -262,6 +262,7 @@ namespace HandBrakeWPF.ViewModels
         {\r
             this.Task = task;\r
             this.NotifyOfPropertyChange(() => this.Task.SubtitleTracks);\r
+            this.NotifyOfPropertyChange(() => this.Task);\r
         }\r
 \r
         /// <summary>\r
index bea0cb81475e4732d8c0b6f2bdc0313ee54878a2..e30a0fcd20885ea75e5936545f60cda32d3dc9bd 100644 (file)
 \r
         <Style x:Key="LongToolTipHolder" TargetType="FrameworkElement">\r
             <Setter Property="ToolTipService.ShowDuration" Value="20000" />\r
+            <Setter Property="Margin" Value="0,2,0,2" />\r
         </Style>\r
 \r
         <Style x:Key="LongToolTip" TargetType="TextBlock">\r
             <Setter Property="Width" Value="400" />\r
             <Setter Property="TextWrapping" Value="Wrap" />\r
         </Style>\r
-    </UserControl.Resources>\r
+\r
+      </UserControl.Resources>\r
     <Grid>\r
         <Grid.RowDefinitions>\r
             <RowDefinition Height="Auto" />\r
                             <ColumnDefinition Width="*" MinWidth="100" />\r
                         </Grid.ColumnDefinitions>\r
 \r
-                        <Label Grid.Row="0"\r
-                               Grid.Column="0"\r
-                               Content="Adaptive B-Frames:"\r
+                        <Label Content="Adaptive B-Frames:"\r
                                Style="{StaticResource AdvancedLabel}"\r
                                Visibility="{Binding BFramesOptionsVisible,\r
-                                                    Converter={StaticResource VisibilityConverter}}"\r
-                               />\r
+                                                    Converter={StaticResource VisibilityConverter}}" Height="26" VerticalAlignment="Top" />\r
                         <ComboBox Grid.Row="0"\r
                                   Grid.Column="1"\r
                                   Width="120"\r
index 5f6fe7f145dac809fc3c9f81296c1e512e502e0f..5515fbbe8f0074f73686811e968525dad3076ffc 100644 (file)
 \r
                 <MenuItem Header="Debug" Foreground="Transparent" >\r
                     <MenuItem Header="Show CLI Equiv" Micro:Message.Attach="[Event Click] = [Action ShowCliQuery]" />\r
+                    <MenuItem Header="Debug Scan Log" Micro:Message.Attach="[Event Click] = [Action DebugScanLog]" />\r
                 </MenuItem>\r
             </Menu>\r
 \r
index 9aba2a3fe53416c8a4dd4e95a98fce2c27635e50..b6f3cc9eb077b91f0fbf921bd96850d4367f6382 100644 (file)
@@ -13,6 +13,7 @@
         SnapsToDevicePixels="True"\r
         UseLayoutRounding="True"\r
         WindowStartupLocation="CenterScreen"\r
+        TextOptions.TextFormattingMode="Display"\r
         >\r
     <Window.Resources>\r
         <Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />\r
index 1bdb2e727fc3490a818c175068540941e5881a6a..9c3f001c8e7f99f9a4fe879adefc5e0153123329 100644 (file)
         </Setter>\r
     </Style>\r
 \r
+    <Style TargetType="{x:Type ComboBox}">\r
+        <Setter Property="Height" Value="22"/>\r
+        <Setter Property="Margin" Value="0,2,0,2" />\r
+    </Style>\r
+\r
+    <Style TargetType="{x:Type TextBlock}">\r
+        <Setter Property="VerticalAlignment" Value="Center"/>\r
+    </Style>\r
+\r
+    <Style TargetType="{x:Type Button}">\r
+        <Setter Property="Height" Value="22"/>\r
+    </Style>\r
+\r
+    <Style TargetType="{x:Type RadioButton}">\r
+        <Setter Property="Margin" Value="0,0,0,8" />\r
+    </Style>\r
+\r
     <SolidColorBrush x:Key="GlyphBrush" Color="#444"/>\r
 \r
 </ResourceDictionary>
\ No newline at end of file
index 8b6d8cff351a281f2b1b2282d2845247eeb2dede..27f2a2f30c384e2c4119cf057bc84ad5967141e8 100644 (file)
@@ -50,7 +50,7 @@
                 </StackPanel>\r
 \r
                 <StackPanel Orientation="Horizontal">\r
-                    <TextBlock Text="Framerate (FPS):" Width="100"/>\r
+                    <TextBlock Text="Framerate (FPS):" VerticalAlignment="Top" Margin="0,5,0,0" Width="100"/>\r
                     <StackPanel Orientation="Vertical">\r
                         <ComboBox Width="120" ItemsSource="{Binding Framerates}" SelectedItem="{Binding SelectedFramerate}" />\r
                         <RadioButton Content="Constant Framerate" IsChecked="{Binding IsConstantFramerate}" Margin="0,10,0,0" />\r