]> granicus.if.org Git - handbrake/commitdiff
WinGui: Restore the "No Titles Found" dialog from previous versions of HandBrake.
authorsr55 <sr55.hb@outlook.com>
Mon, 20 Apr 2015 18:46:33 +0000 (18:46 +0000)
committersr55 <sr55.hb@outlook.com>
Mon, 20 Apr 2015 18:46:33 +0000 (18:46 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7108 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/CS/HandBrake.ApplicationServices/Services/Scan/EventArgs/ScanCompletedEventArgs.cs
win/CS/HandBrakeWPF/Controls/AlertPanel.xaml [new file with mode: 0644]
win/CS/HandBrakeWPF/HandBrakeWPF.csproj
win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
win/CS/HandBrakeWPF/Properties/Resources.resx
win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
win/CS/HandBrakeWPF/Views/Images/information64.png [new file with mode: 0644]
win/CS/HandBrakeWPF/Views/MainView.xaml
win/CS/HandBrakeWPF/Views/QueueSelectionView.xaml

index 41c44fb76a7939f429d9b6854661dc375e047ff2..c23945dd0914f3aa45637a8a358f49ec81e48660 100644 (file)
@@ -35,7 +35,7 @@ namespace HandBrake.ApplicationServices.Services.Scan.EventArgs
         /// </param>\r
         public ScanCompletedEventArgs(bool cancelled, Exception exception, string errorInformation, Source scannedSource)\r
         {\r
-            this.Successful = !cancelled && exception == null && string.IsNullOrEmpty(errorInformation);\r
+            this.Successful = !cancelled && exception == null && string.IsNullOrEmpty(errorInformation) && scannedSource != null && scannedSource.Titles != null && scannedSource.Titles.Count > 0;\r
             this.Cancelled = cancelled;\r
             this.Exception = exception;\r
             this.ErrorInformation = errorInformation;\r
diff --git a/win/CS/HandBrakeWPF/Controls/AlertPanel.xaml b/win/CS/HandBrakeWPF/Controls/AlertPanel.xaml
new file mode 100644 (file)
index 0000000..2960a72
--- /dev/null
@@ -0,0 +1,59 @@
+<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"\r
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"\r
+             x:Class="HandBrakeWPF.Controls.AlertPanel"\r
+             >\r
+\r
+    <UserControl.Resources>\r
+        <BooleanToVisibilityConverter x:Key="boolTovisibility" />\r
+    </UserControl.Resources>\r
+    \r
+    <Grid>\r
+        <Grid.RowDefinitions>\r
+            <RowDefinition Height="*" />\r
+            <RowDefinition Height="Auto" />\r
+            <RowDefinition Height="*" />\r
+        </Grid.RowDefinitions>\r
+\r
+        <StackPanel Grid.Row="0" Background="Black" Opacity="0.45" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>\r
+\r
+        <Grid VerticalAlignment="Center" Grid.Row="1" HorizontalAlignment="Stretch"\r
+                       Background="{Binding Background, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}">\r
+            \r
+            <Grid.RowDefinitions>\r
+                <RowDefinition Height="Auto" />\r
+                <RowDefinition Height="Auto" />\r
+            </Grid.RowDefinitions>\r
+\r
+            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="0" MaxHeight="220" MinHeight="220">\r
+                <Image Source="../Views/Images/information64.png" VerticalAlignment="Center" Height="64" Margin="18,10" />\r
+\r
+\r
+                <StackPanel VerticalAlignment="Center" Orientation="Vertical" >\r
+                    <StackPanel VerticalAlignment="Center" MinWidth="300">\r
+                        <TextBlock SnapsToDevicePixels="True" VerticalAlignment="Top" FontSize="26" FontFamily="Segoe UI Light" Margin="0,11,0,0" HorizontalAlignment="Left"\r
+                                                   FontWeight="Bold" TextWrapping="WrapWithOverflow"\r
+                                                   Text="{Binding Message, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"\r
+                           />\r
+\r
+                        <TextBlock SnapsToDevicePixels="True" VerticalAlignment="Top" FontSize="12" FontFamily="Segoe UI Light" Margin="0,5" HorizontalAlignment="Left"\r
+                                                   Text="{Binding SubMessage, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" \r
+                                                   TextWrapping="WrapWithOverflow"\r
+                           />\r
+                    </StackPanel>\r
+             \r
+                    <Button Content="{Binding ActionText, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" Margin="0,10,0,0"\r
+                            x:Name="StatusActionButton" Click="StatusActionButton_OnClick" Padding="8,2" HorizontalAlignment="Right"\r
+                            Visibility="{Binding IsActionButtonVisible, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Converter={StaticResource boolTovisibility}}" />\r
+\r
+                </StackPanel>\r
+            </StackPanel>\r
+\r
+            \r
+        </Grid>\r
+\r
+        <StackPanel Grid.Row="2" Background="Black" Opacity="0.45" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>\r
+\r
+    </Grid>\r
+\r
+\r
+</UserControl>\r
index 38d3e838462b1058fda8fb275fdd426f39c41cc7..61cc11defb8be3bebb4e9a7e3e0393a4ed0d427d 100644 (file)
     <Compile Include="Commands\AdvancedEncoderOptionsCommand.cs" />\r
     <Compile Include="Constants.cs" />\r
     <Compile Include="Controls\SplitButton\SplitMenuButton.cs" />\r
+    <Compile Include="Controls\AlertPanel.xaml.cs">\r
+      <DependentUpon>AlertPanel.xaml</DependentUpon>\r
+    </Compile>\r
     <Compile Include="Converters\Audio\AudioBehaviourConverter.cs" />\r
     <Compile Include="Converters\Filters\DenoisePresetConverter.cs" />\r
     <Compile Include="Converters\Subtitles\SubtitleBurnInBehaviourConverter.cs" />\r
     <AppDesigner Include="Properties\" />\r
   </ItemGroup>\r
   <ItemGroup>\r
+    <Page Include="Controls\AlertPanel.xaml">\r
+      <Generator>MSBuild:Compile</Generator>\r
+      <SubType>Designer</SubType>\r
+    </Page>\r
     <Page Include="Themes\Generic.xaml">\r
       <SubType>Designer</SubType>\r
       <Generator>MSBuild:Compile</Generator>\r
   <ItemGroup>\r
     <Resource Include="Views\Images\File32.png" />\r
   </ItemGroup>\r
+  <ItemGroup>\r
+    <Resource Include="Views\Images\information64.png" />\r
+  </ItemGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <Import Project="$(ProgramFiles)\MSBuild\StyleCop\v4.*\StyleCop.targets" />\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
index 3f26afe6ea4ce425c087d617c43ddcd444db5df0..4d30f91916104304c4693297762c63ccfa6850f3 100644 (file)
@@ -613,7 +613,7 @@ namespace HandBrakeWPF.Properties {
         }\r
         \r
         /// <summary>\r
-        ///   Looks up a localized string similar to Scan Failed... See Activity Log for details..\r
+        ///   Looks up a localized string similar to Scan Failed... Please See Activity Log for details..\r
         /// </summary>\r
         public static string Main_ScanFailled_CheckLog {\r
             get {\r
@@ -639,6 +639,29 @@ namespace HandBrakeWPF.Properties {
             }\r
         }\r
         \r
+        /// <summary>\r
+        ///   Looks up a localized string similar to No valid source or titles found..\r
+        /// </summary>\r
+        public static string Main_ScanNoTitlesFound {\r
+            get {\r
+                return ResourceManager.GetString("Main_ScanNoTitlesFound", resourceCulture);\r
+            }\r
+        }\r
+        \r
+        /// <summary>\r
+        ///   Looks up a localized string similar to HandBrake will not be able to encode the seleteced source as it did not find a valid source with titles to encode. \r
+        ///This could be due to one of the following reasons:\r
+        ///- The source file is not a valid video file or is in a format that HandBrake does not support.\r
+        ///- The source may be copy protected or include DRM. Please note that HandBrake is not a ripper.\r
+        ///\r
+        ///The Activity log may have further information..\r
+        /// </summary>\r
+        public static string Main_ScanNoTitlesFoundMessage {\r
+            get {\r
+                return ResourceManager.GetString("Main_ScanNoTitlesFoundMessage", resourceCulture);\r
+            }\r
+        }\r
+        \r
         /// <summary>\r
         ///   Looks up a localized string similar to You must first scan a source and setup your job before starting an encode..\r
         /// </summary>\r
index 2bc82bd716ac4ec206146679488f32a84aa54c5a..c0cbc37b73f9d27a0d5b04fbb62c67eaf1446960 100644 (file)
@@ -449,7 +449,7 @@ The previous user_presets.xml file was backed up.</value>
     <value>Scan failed: </value>\r
   </data>\r
   <data name="Main_ScanFailled_CheckLog" xml:space="preserve">\r
-    <value>Scan Failed... See Activity Log for details.</value>\r
+    <value>Scan Failed... Please See Activity Log for details.</value>\r
   </data>\r
   <data name="Main_ScanningPleaseWait" xml:space="preserve">\r
     <value>Scanning source, please wait...</value>\r
@@ -562,4 +562,15 @@ Foreign Audio Track - The Foreign Audio track will be burned in if available.
 First Track - The first track will be burned in.\r
 Foreign Audio Preferred, else First - If the foreign audio track exists, it will be burned in, otherwise the first track will be chosen.</value>\r
   </data>\r
+  <data name="Main_ScanNoTitlesFound" xml:space="preserve">\r
+    <value>No valid source or titles found.</value>\r
+  </data>\r
+  <data name="Main_ScanNoTitlesFoundMessage" xml:space="preserve">\r
+    <value>HandBrake will not be able to encode the seleteced source as it did not find a valid source with titles to encode. \r
+This could be due to one of the following reasons:\r
+- The source file is not a valid video file or is in a format that HandBrake does not support.\r
+- The source may be copy protected or include DRM. Please note that HandBrake is not a ripper.\r
+\r
+The Activity log may have further information.</value>\r
+  </data>\r
 </root>
\ No newline at end of file
index 65206844428e9f5c3b1d9e2f16258011edbf0244..c521ee235c7db2e20ab8a29ea20fff93eb5a787f 100644 (file)
@@ -199,6 +199,12 @@ namespace HandBrakeWPF.ViewModels
         /// </summary>\r
         private bool canPause;\r
 \r
+        private bool showAlertWindow;\r
+\r
+        private string alertWindowHeader;\r
+\r
+        private string alertWindowText;\r
+\r
         #endregion\r
 \r
         /// <summary>\r
@@ -1058,6 +1064,77 @@ namespace HandBrakeWPF.ViewModels
             }\r
         }\r
 \r
+        /// <summary>\r
+        /// Gets or sets a value indicating whether show alert window.\r
+        /// </summary>\r
+        public bool ShowAlertWindow\r
+        {\r
+            get\r
+            {\r
+                return this.showAlertWindow;\r
+            }\r
+            set\r
+            {\r
+                if (value.Equals(this.showAlertWindow))\r
+                {\r
+                    return;\r
+                }\r
+                this.showAlertWindow = value;\r
+                this.NotifyOfPropertyChange(() => this.ShowAlertWindow);\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets a value indicating whether alert window header.\r
+        /// </summary>\r
+        public string AlertWindowHeader\r
+        {\r
+            get\r
+            {\r
+                return this.alertWindowHeader;\r
+            }\r
+            set\r
+            {\r
+                if (value == this.alertWindowHeader)\r
+                {\r
+                    return;\r
+                }\r
+                this.alertWindowHeader = value;\r
+                this.NotifyOfPropertyChange(() => this.AlertWindowHeader);\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets or sets a value indicating whether alert window text.\r
+        /// </summary>\r
+        public string AlertWindowText\r
+        {\r
+            get\r
+            {\r
+                return this.alertWindowText;\r
+            }\r
+            set\r
+            {\r
+                if (value == this.alertWindowText)\r
+                {\r
+                    return;\r
+                }\r
+                this.alertWindowText = value;\r
+                this.NotifyOfPropertyChange(() => this.AlertWindowText);\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets the alert window close.\r
+        /// </summary>\r
+        public Action AlertWindowClose\r
+        {\r
+            get\r
+            {\r
+                return this.CloseAlertWindow;\r
+            }\r
+        }\r
+\r
         #endregion\r
 \r
         #region Load and Shutdown Handling\r
@@ -1486,6 +1563,16 @@ namespace HandBrakeWPF.ViewModels
             this.ShowSourceSelection = false;\r
         }\r
 \r
+        /// <summary>\r
+        /// The close alert window.\r
+        /// </summary>\r
+        public void CloseAlertWindow()\r
+        {\r
+            this.ShowAlertWindow = false;\r
+            this.AlertWindowText = string.Empty;\r
+            this.AlertWindowHeader = string.Empty;\r
+        }\r
+\r
         #endregion\r
 \r
         #region Main Window Public Methods\r
@@ -1999,6 +2086,22 @@ namespace HandBrakeWPF.ViewModels
             }\r
         }\r
 \r
+        /// <summary>\r
+        /// The open alert window.\r
+        /// </summary>\r
+        /// <param name="header">\r
+        /// The header.\r
+        /// </param>\r
+        /// <param name="message">\r
+        /// The message.\r
+        /// </param>\r
+        private void OpenAlertWindow(string header, string message)\r
+        {\r
+            this.ShowAlertWindow = true;\r
+            this.AlertWindowHeader = header;\r
+            this.AlertWindowText = message;\r
+        }\r
+\r
         #endregion\r
 \r
         #region Event Handlers\r
@@ -2043,8 +2146,11 @@ namespace HandBrakeWPF.ViewModels
                     {\r
                         this.NotifyOfPropertyChange(() => this.ScannedSource);\r
                         this.NotifyOfPropertyChange(() => this.ScannedSource.Titles);\r
-                        this.SelectedTitle = this.ScannedSource.Titles.FirstOrDefault(t => t.MainTitle)\r
-                                             ?? this.ScannedSource.Titles.FirstOrDefault();\r
+                        this.SelectedTitle = this.ScannedSource.Titles.FirstOrDefault(t => t.MainTitle) ?? this.ScannedSource.Titles.FirstOrDefault();\r
+                    }\r
+                    else\r
+                    {\r
+                        this.OpenAlertWindow(Resources.Main_ScanNoTitlesFound, Resources.Main_ScanNoTitlesFoundMessage);\r
                     }\r
 \r
                     this.ShowStatusWindow = false;\r
@@ -2058,11 +2164,6 @@ namespace HandBrakeWPF.ViewModels
                         this.SourceLabel = Resources.Main_ScanCancelled;\r
                         this.StatusLabel = Resources.Main_ScanCancelled;\r
                     }\r
-                    else if (e.Exception == null && e.ErrorInformation != null)\r
-                    {\r
-                        this.SourceLabel = Resources.Main_ScanFailed_NoReason + e.ErrorInformation;\r
-                        this.StatusLabel = Resources.Main_ScanFailed_NoReason + e.ErrorInformation;\r
-                    }\r
                     else\r
                     {\r
                         this.SourceLabel = Resources.Main_ScanFailled_CheckLog;\r
diff --git a/win/CS/HandBrakeWPF/Views/Images/information64.png b/win/CS/HandBrakeWPF/Views/Images/information64.png
new file mode 100644 (file)
index 0000000..798e116
Binary files /dev/null and b/win/CS/HandBrakeWPF/Views/Images/information64.png differ
index 7f4809d83cf5ca08a996f4f98d9ca7449c829ccb..cf42b439ef00db9804c4b7eb19cb4e65c10def08 100644 (file)
                               CancelAction="{Binding CancelAction}"\r
                               />\r
 \r
+        <Controls:AlertPanel x:Name="alertPanel"\r
+                              Grid.Row="0"\r
+                              Grid.RowSpan="3"\r
+                              Visibility="{Binding ShowAlertWindow, Converter={StaticResource boolToVisConverter}, ConverterParameter=false, TargetNullValue=Collapsed, FallbackValue=Collapsed}"\r
+                              VerticalAlignment="Stretch" HorizontalAlignment="Stretch"\r
+                              Panel.ZIndex="10"\r
+                              Message="{Binding AlertWindowHeader}"\r
+                              SubMessage="{Binding AlertWindowText}"\r
+                              ActionText="OK"\r
+                              DefaultAction="{Binding AlertWindowClose}">\r
+            \r
+        </Controls:AlertPanel>\r
+\r
         <!--  Status Bar  -->\r
         <StatusBar Grid.Row="2" Grid.ColumnSpan="2" MinHeight="32" >\r
 \r
index 13ddd9cc95d0222018c51eb62f96baa611291fdc..2712d02640abfe8c0230d949a3eb765acf261df3 100644 (file)
@@ -44,7 +44,7 @@
 \r
         <!-- Selection -->\r
         <ListBox Grid.Row="2"\r
-                 MinHeight="250"\r
+                 MinHeight="240"\r
                  MaxHeight="500"\r
                  Margin="10,10,10,10"\r
                  VerticalAlignment="Stretch"\r