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