summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2017-05-29 19:35:36 +0100
committersr55 <[email protected]>2017-05-29 19:35:36 +0100
commit1af79e413bd7e8d6e75604690942d6dddeb4ec97 (patch)
treee5e908c646475b47d9fe3aae9c7b1182351116e3
parentec1ae47d59d52315d7279bafcb883d69803ee96e (diff)
WinGui: Improved error message on Starting an encode or queue when the destination drive is low on space. Fixes #748
-rw-r--r--win/CS/HandBrakeWPF/Properties/Resources.Designer.cs9
-rw-r--r--win/CS/HandBrakeWPF/Properties/Resources.resx3
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs8
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs11
4 files changed, 30 insertions, 1 deletions
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
index 92d55b507..aa6a7e1a0 100644
--- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
+++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
@@ -723,6 +723,15 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
+ /// Looks up a localized string similar to Your destination directory is low on diskspace. Please free up some disk space on your destination drive. Alternatively you can change the level at which this alert triggers in Options. .
+ /// </summary>
+ public static string Main_LowDiskspace {
+ get {
+ return ResourceManager.GetString("Main_LowDiskspace", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to You cannot encode to a file with the same path and filename as the source file. Please update the destination filename so that it does not match the source file..
/// </summary>
public static string Main_MatchingFileOverwriteWarning {
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx
index 6a67940ad..c765c9423 100644
--- a/win/CS/HandBrakeWPF/Properties/Resources.resx
+++ b/win/CS/HandBrakeWPF/Properties/Resources.resx
@@ -849,4 +849,7 @@ Remaining Time: {4}</value>
<data name="QueueViewModel_QueuePaused" xml:space="preserve">
<value>Queue Paused</value>
</data>
+ <data name="Main_LowDiskspace" xml:space="preserve">
+ <value>Your destination directory is low on diskspace. Please free up some disk space on your destination drive. Alternatively you can change the level at which this alert triggers in Options. </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 5056f99a6..93aac9c19 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -1661,6 +1661,14 @@ namespace HandBrakeWPF.ViewModels
return;
}
+ if (!DriveUtilities.HasMinimumDiskSpace(
+ this.Destination,
+ this.userSettingService.GetUserSetting<long>(UserSettingConstants.PauseOnLowDiskspaceLevel)))
+ {
+ this.errorService.ShowMessageBox(Resources.Main_LowDiskspace, Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
+ return;
+ }
+
if (this.scannedSource != null && !string.IsNullOrEmpty(this.scannedSource.ScanPath) && this.Destination.ToLower() == this.scannedSource.ScanPath.ToLower())
{
this.errorService.ShowMessageBox(Resources.Main_MatchingFileOverwriteWarning, Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs
index 4cd2948db..5e9f45aa7 100644
--- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs
@@ -23,6 +23,7 @@ namespace HandBrakeWPF.ViewModels
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.Services.Queue.Interfaces;
using HandBrakeWPF.Services.Queue.Model;
+ using HandBrakeWPF.Utilities;
using HandBrakeWPF.ViewModels.Interfaces;
using Microsoft.Win32;
@@ -371,13 +372,21 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
public void StartQueue()
{
- if (this.queueProcessor.Count == 0)
+ if (this.queueProcessor.Count == 0 || !this.QueueTasks.Any(a => a.Status == QueueItemStatus.Waiting || a.Status == QueueItemStatus.InProgress))
{
this.errorService.ShowMessageBox(
Resources.QueueViewModel_NoPendingJobs, Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
+ var firstOrDefault = this.QueueTasks.FirstOrDefault(s => s.Status == QueueItemStatus.Waiting);
+ if (firstOrDefault != null && !DriveUtilities.HasMinimumDiskSpace(firstOrDefault.Task.Destination,
+ this.userSettingService.GetUserSetting<long>(UserSettingConstants.PauseOnLowDiskspaceLevel)))
+ {
+ this.errorService.ShowMessageBox(Resources.Main_LowDiskspace, Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
+ return;
+ }
+
this.JobStatus = Resources.QueueViewModel_QueueStarted;
this.JobsPending = string.Format(Resources.QueueViewModel_JobsPending, this.queueProcessor.Count);
this.IsQueueRunning = true;