diff options
-rw-r--r-- | win/CS/HandBrakeWPF/Converters/Options/FileSizeConverter.cs | 39 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/HandBrakeWPF.csproj | 1 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs | 9 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Properties/ResourcesUI.resx | 3 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 15 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs | 27 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/OptionsView.xaml | 9 |
7 files changed, 81 insertions, 22 deletions
diff --git a/win/CS/HandBrakeWPF/Converters/Options/FileSizeConverter.cs b/win/CS/HandBrakeWPF/Converters/Options/FileSizeConverter.cs new file mode 100644 index 000000000..219fdf3a6 --- /dev/null +++ b/win/CS/HandBrakeWPF/Converters/Options/FileSizeConverter.cs @@ -0,0 +1,39 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="FileSizeConverter.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// Defines the LogLevelConverter type. +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Converters.Options +{ + using System; + using System.Globalization; + using System.Windows.Data; + + public class FileSizeConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null) + { + return (long)value / 1000 / 1000 / 1000; + } + + return null; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + long size; + if (value != null && long.TryParse(value.ToString(), out size)) + { + return size * 1000 * 1000 * 1000; + } + + return null; + } + } +} diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index d37f10acd..b77dcadda 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -159,6 +159,7 @@ <Compile Include="Converters\Audio\AudioBehaviourConverter.cs" />
<Compile Include="Converters\EnumToDescConverter.cs" />
<Compile Include="Converters\Filters\DenoisePresetConverter.cs" />
+ <Compile Include="Converters\Options\FileSizeConverter.cs" />
<Compile Include="Converters\Options\LogLevelConverter.cs" />
<Compile Include="Converters\PresetsMenuConverter.cs" />
<Compile Include="Converters\Queue\PictureSettingsDescConveter.cs" />
diff --git a/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs b/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs index c822e1e00..e04dbe4b5 100644 --- a/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs @@ -1195,6 +1195,15 @@ namespace HandBrakeWPF.Properties { }
/// <summary>
+ /// Looks up a localized string similar to Low diskspace warning level (GB):.
+ /// </summary>
+ public static string Options_LowDiskspaceSize {
+ get {
+ return ResourceManager.GetString("Options_LowDiskspaceSize", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Minimize to system tray (Requires Restart).
/// </summary>
public static string Options_MinimiseTray {
diff --git a/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx b/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx index 30e783a93..87e584e96 100644 --- a/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx +++ b/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx @@ -890,4 +890,7 @@ This will not affect your current settings in the Subtitle tab.</value> <data name="Options_QsvDecodeForNonFullPath" xml:space="preserve">
<value>Use QSV Decoding for non QSV encoders.</value>
</data>
+ <data name="Options_LowDiskspaceSize" xml:space="preserve">
+ <value>Low diskspace warning level (GB):</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 f48902aec..3c6261641 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1819,21 +1819,6 @@ namespace HandBrakeWPF.ViewModels this.Destination = saveFileDialog.FileName;
- // Disk Space Check
- string drive = Path.GetPathRoot(this.Destination);
- if (drive != null && !drive.StartsWith(@"\\"))
- {
- DriveInfo c = new DriveInfo(drive);
- if (c.AvailableFreeSpace < this.userSettingService.GetUserSetting<long>(UserSettingConstants.PauseOnLowDiskspaceLevel))
- {
- this.errorService.ShowMessageBox(
- Resources.MainViewModel_LowDiskSpaceWarning,
- Resources.MainViewModel_LowDiskSpace,
- MessageBoxButton.OK,
- MessageBoxImage.Warning);
- }
- }
-
// Set the Extension Dropdown. This will also set Mp4/m4v correctly.
if (!string.IsNullOrEmpty(saveFileDialog.FileName))
{
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index 17154f922..d261ff16b 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -91,8 +91,8 @@ namespace HandBrakeWPF.ViewModels private bool isClScaling;
private bool showQueueInline;
private bool pauseOnLowDiskspace;
-
- private bool useQsvDecodeForNonQsvEnc;
+ private long pauseOnLowDiskspaceLevel;
+ private bool useQsvDecodeForNonQsvEnc;
#endregion
@@ -616,7 +616,24 @@ namespace HandBrakeWPF.ViewModels this.pauseOnLowDiskspace = value;
this.NotifyOfPropertyChange(() => this.PauseOnLowDiskspace);
}
- }
+ }
+
+ /// <summary>
+ /// Get or sets the value that HB warns about low disk space.
+ /// </summary>
+ public long PauseOnLowDiskspaceLevel
+ {
+ get
+ {
+ return this.pauseOnLowDiskspaceLevel;
+ }
+
+ set
+ {
+ this.pauseOnLowDiskspaceLevel = value;
+ this.NotifyOfPropertyChange(() => this.pauseOnLowDiskspaceLevel);
+ }
+ }
/// <summary>
/// Gets or sets PriorityLevelOptions.
@@ -1264,7 +1281,8 @@ namespace HandBrakeWPF.ViewModels this.PreventSleep = userSettingService.GetUserSetting<bool>(UserSettingConstants.PreventSleep);
this.PauseOnLowDiskspace = userSettingService.GetUserSetting<bool>(UserSettingConstants.PauseOnLowDiskspace);
-
+ this.PauseOnLowDiskspaceLevel = this.userSettingService.GetUserSetting<long>(UserSettingConstants.PauseOnLowDiskspaceLevel);
+
// Log Verbosity Level
this.logVerbosityOptions.Clear();
this.logVerbosityOptions.Add(0);
@@ -1374,6 +1392,7 @@ namespace HandBrakeWPF.ViewModels userSettingService.SetUserSetting(UserSettingConstants.ProcessPriority, this.SelectedPriority);
userSettingService.SetUserSetting(UserSettingConstants.PreventSleep, this.PreventSleep);
userSettingService.SetUserSetting(UserSettingConstants.PauseOnLowDiskspace, this.PauseOnLowDiskspace);
+ userSettingService.SetUserSetting(UserSettingConstants.PauseOnLowDiskspaceLevel, this.PauseOnLowDiskspaceLevel);
userSettingService.SetUserSetting(UserSettingConstants.Verbosity, this.SelectedVerbosity);
userSettingService.SetUserSetting(UserSettingConstants.SaveLogWithVideo, this.CopyLogToEncodeDirectory);
userSettingService.SetUserSetting(UserSettingConstants.SaveLogToCopyDirectory, this.CopyLogToSepcficedLocation);
diff --git a/win/CS/HandBrakeWPF/Views/OptionsView.xaml b/win/CS/HandBrakeWPF/Views/OptionsView.xaml index da8bd67c7..8fcd517ac 100644 --- a/win/CS/HandBrakeWPF/Views/OptionsView.xaml +++ b/win/CS/HandBrakeWPF/Views/OptionsView.xaml @@ -36,6 +36,7 @@ <Options:OptionsTabNameConverter x:Key="tabNameConverter" />
<Converters:EnumComboConverter x:Key="enumComboConverter" />
<Options:LogLevelConverter x:Key="LogLevelConverter" />
+ <Options:FileSizeConverter x:Key="fileSizeConverter" />
<Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
@@ -262,7 +263,10 @@ <CheckBox Content="{x:Static Properties:ResourcesUI.Options_PreventSleep}" IsChecked="{Binding PreventSleep}" />
<CheckBox Content="{x:Static Properties:ResourcesUI.Options_PauseQueueOnLowDiskSpace}"
IsChecked="{Binding PauseOnLowDiskspace}" />
-
+ <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
+ <TextBlock Text="{x:Static Properties:ResourcesUI.Options_LowDiskspaceSize}" VerticalAlignment="Center" Width="250" />
+ <TextBox x:Name="PauseOnLowDiskspaceLEvel" Text="{Binding PauseOnLowDiskspaceLevel, Converter={StaticResource fileSizeConverter}, UpdateSourceTrigger=PropertyChanged}" Width="120"/>
+ </StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<TextBlock Text="{x:Static Properties:ResourcesUI.Options_PreviewScanCount}" VerticalAlignment="Center" Width="250" />
<ComboBox Name="numberOfPreviews" ItemsSource="{Binding PreviewPicturesToScan}" SelectedItem="{Binding SelectedPreviewCount}" Width="120" />
@@ -276,8 +280,7 @@ <TextBlock Text="{x:Static Properties:ResourcesUI.Options_PriorityLevel}" Width="250" VerticalAlignment="Center" />
<ComboBox Name="processPriorityLevel" ItemsSource="{Binding PriorityLevelOptions}" SelectedItem="{Binding SelectedPriority}" Width="120" />
</StackPanel>
-
- </StackPanel>
+ </StackPanel>
</StackPanel>
<StackPanel Orientation="Vertical" Margin="0,10,0,20">
|