--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------
+// <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;
+ }
+ }
+}
<Compile Include="Converters\Audio\AudioBehaviourConverter.cs" />\r
<Compile Include="Converters\EnumToDescConverter.cs" />\r
<Compile Include="Converters\Filters\DenoisePresetConverter.cs" />\r
+ <Compile Include="Converters\Options\FileSizeConverter.cs" />\r
<Compile Include="Converters\Options\LogLevelConverter.cs" />\r
<Compile Include="Converters\PresetsMenuConverter.cs" />\r
<Compile Include="Converters\Queue\PictureSettingsDescConveter.cs" />\r
}\r
}\r
\r
+ /// <summary>\r
+ /// Looks up a localized string similar to Low diskspace warning level (GB):.\r
+ /// </summary>\r
+ public static string Options_LowDiskspaceSize {\r
+ get {\r
+ return ResourceManager.GetString("Options_LowDiskspaceSize", resourceCulture);\r
+ }\r
+ }\r
+ \r
/// <summary>\r
/// Looks up a localized string similar to Minimize to system tray (Requires Restart).\r
/// </summary>\r
<data name="Options_QsvDecodeForNonFullPath" xml:space="preserve">\r
<value>Use QSV Decoding for non QSV encoders.</value>\r
</data>\r
+ <data name="Options_LowDiskspaceSize" xml:space="preserve">\r
+ <value>Low diskspace warning level (GB):</value>\r
+ </data>\r
</root>
\ No newline at end of file
\r
this.Destination = saveFileDialog.FileName;\r
\r
- // Disk Space Check\r
- string drive = Path.GetPathRoot(this.Destination); \r
- if (drive != null && !drive.StartsWith(@"\\"))\r
- {\r
- DriveInfo c = new DriveInfo(drive);\r
- if (c.AvailableFreeSpace < this.userSettingService.GetUserSetting<long>(UserSettingConstants.PauseOnLowDiskspaceLevel))\r
- {\r
- this.errorService.ShowMessageBox(\r
- Resources.MainViewModel_LowDiskSpaceWarning,\r
- Resources.MainViewModel_LowDiskSpace,\r
- MessageBoxButton.OK,\r
- MessageBoxImage.Warning);\r
- }\r
- }\r
-\r
// Set the Extension Dropdown. This will also set Mp4/m4v correctly.\r
if (!string.IsNullOrEmpty(saveFileDialog.FileName))\r
{\r
private bool isClScaling;\r
private bool showQueueInline;\r
private bool pauseOnLowDiskspace;\r
-\r
- private bool useQsvDecodeForNonQsvEnc;\r
+ private long pauseOnLowDiskspaceLevel;\r
+ private bool useQsvDecodeForNonQsvEnc; \r
\r
#endregion\r
\r
this.pauseOnLowDiskspace = value;\r
this.NotifyOfPropertyChange(() => this.PauseOnLowDiskspace);\r
}\r
- } \r
+ }\r
+\r
+ /// <summary>\r
+ /// Get or sets the value that HB warns about low disk space.\r
+ /// </summary>\r
+ public long PauseOnLowDiskspaceLevel\r
+ {\r
+ get\r
+ {\r
+ return this.pauseOnLowDiskspaceLevel;\r
+ }\r
+\r
+ set\r
+ {\r
+ this.pauseOnLowDiskspaceLevel = value;\r
+ this.NotifyOfPropertyChange(() => this.pauseOnLowDiskspaceLevel);\r
+ }\r
+ }\r
\r
/// <summary>\r
/// Gets or sets PriorityLevelOptions.\r
\r
this.PreventSleep = userSettingService.GetUserSetting<bool>(UserSettingConstants.PreventSleep);\r
this.PauseOnLowDiskspace = userSettingService.GetUserSetting<bool>(UserSettingConstants.PauseOnLowDiskspace);\r
- \r
+ this.PauseOnLowDiskspaceLevel = this.userSettingService.GetUserSetting<long>(UserSettingConstants.PauseOnLowDiskspaceLevel);\r
+\r
// Log Verbosity Level\r
this.logVerbosityOptions.Clear();\r
this.logVerbosityOptions.Add(0);\r
userSettingService.SetUserSetting(UserSettingConstants.ProcessPriority, this.SelectedPriority);\r
userSettingService.SetUserSetting(UserSettingConstants.PreventSleep, this.PreventSleep);\r
userSettingService.SetUserSetting(UserSettingConstants.PauseOnLowDiskspace, this.PauseOnLowDiskspace);\r
+ userSettingService.SetUserSetting(UserSettingConstants.PauseOnLowDiskspaceLevel, this.PauseOnLowDiskspaceLevel);\r
userSettingService.SetUserSetting(UserSettingConstants.Verbosity, this.SelectedVerbosity);\r
userSettingService.SetUserSetting(UserSettingConstants.SaveLogWithVideo, this.CopyLogToEncodeDirectory);\r
userSettingService.SetUserSetting(UserSettingConstants.SaveLogToCopyDirectory, this.CopyLogToSepcficedLocation);\r
<Options:OptionsTabNameConverter x:Key="tabNameConverter" />\r
<Converters:EnumComboConverter x:Key="enumComboConverter" />\r
<Options:LogLevelConverter x:Key="LogLevelConverter" />\r
+ <Options:FileSizeConverter x:Key="fileSizeConverter" />\r
\r
\r
<Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />\r
<CheckBox Content="{x:Static Properties:ResourcesUI.Options_PreventSleep}" IsChecked="{Binding PreventSleep}" />\r
<CheckBox Content="{x:Static Properties:ResourcesUI.Options_PauseQueueOnLowDiskSpace}" \r
IsChecked="{Binding PauseOnLowDiskspace}" />\r
-\r
+ <StackPanel Orientation="Horizontal" Margin="0,5,0,0">\r
+ <TextBlock Text="{x:Static Properties:ResourcesUI.Options_LowDiskspaceSize}" VerticalAlignment="Center" Width="250" />\r
+ <TextBox x:Name="PauseOnLowDiskspaceLEvel" Text="{Binding PauseOnLowDiskspaceLevel, Converter={StaticResource fileSizeConverter}, UpdateSourceTrigger=PropertyChanged}" Width="120"/>\r
+ </StackPanel>\r
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">\r
<TextBlock Text="{x:Static Properties:ResourcesUI.Options_PreviewScanCount}" VerticalAlignment="Center" Width="250" />\r
<ComboBox Name="numberOfPreviews" ItemsSource="{Binding PreviewPicturesToScan}" SelectedItem="{Binding SelectedPreviewCount}" Width="120" />\r
<TextBlock Text="{x:Static Properties:ResourcesUI.Options_PriorityLevel}" Width="250" VerticalAlignment="Center" />\r
<ComboBox Name="processPriorityLevel" ItemsSource="{Binding PriorityLevelOptions}" SelectedItem="{Binding SelectedPriority}" Width="120" />\r
</StackPanel>\r
-\r
- </StackPanel>\r
+ </StackPanel>\r
</StackPanel>\r
\r
<StackPanel Orientation="Vertical" Margin="0,10,0,20">\r