summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices/Services
diff options
context:
space:
mode:
authorsr55 <[email protected]>2011-05-08 11:00:16 +0000
committersr55 <[email protected]>2011-05-08 11:00:16 +0000
commitc2e751e3eb2ed19163c6c2a1318eab28bcbb921b (patch)
tree2a652aefd39b11c7442136052927df1b0e9b6191 /win/CS/HandBrake.ApplicationServices/Services
parent3d7392c9e4f114408b2fd16bd848a2e10c36fa32 (diff)
WinGui:
- Add Elapsed Encode Time the main window. - Add Elapsed Queue Time to the queue window. (Note, Pausing the queue resets this currently) - Fixed an issue with disabled controls on the audio panel after removing the last track which was passthru. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3973 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Services')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Encode.cs33
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/PresetService.cs21
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs2
3 files changed, 36 insertions, 20 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
index 9232ea95e..5787ab8a8 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
@@ -28,11 +28,6 @@ namespace HandBrake.ApplicationServices.Services
#region Private Variables
/// <summary>
- /// The User Setting Service
- /// </summary>
- private IUserSettingService userSettingService = new UserSettingService();
-
- /// <summary>
/// The Log Buffer
/// </summary>
private StringBuilder logBuffer;
@@ -67,6 +62,11 @@ namespace HandBrake.ApplicationServices.Services
/// </summary>
StringBuilder header = GeneralUtilities.CreateCliLogHeader(null);
+ /// <summary>
+ /// The Start time of the current Encode;
+ /// </summary>
+ private DateTime startTime;
+
#endregion
/// <summary>
@@ -100,11 +100,6 @@ namespace HandBrake.ApplicationServices.Services
#region Properties
/// <summary>
- /// Gets or sets The HB Process
- /// </summary>
- protected Process HbProcess { get; set; }
-
- /// <summary>
/// Gets a value indicating whether IsEncoding.
/// </summary>
public bool IsEncoding { get; private set; }
@@ -115,11 +110,16 @@ namespace HandBrake.ApplicationServices.Services
public string ActivityLog
{
get
- {
+ {
return string.IsNullOrEmpty(this.logBuffer.ToString()) ? header + "No log data available..." : header + this.logBuffer.ToString();
}
}
+ /// <summary>
+ /// Gets or sets The HB Process
+ /// </summary>
+ protected Process HbProcess { get; set; }
+
#endregion
#region Public Methods
@@ -190,6 +190,8 @@ namespace HandBrake.ApplicationServices.Services
this.HbProcess.Start();
+ this.startTime = DateTime.Now;
+
if (enableLogging)
{
this.HbProcess.ErrorDataReceived += HbProcErrorDataReceived;
@@ -529,18 +531,21 @@ namespace HandBrake.ApplicationServices.Services
EstimatedTimeLeft = Converters.EncodeToTimespan(timeRemaining),
PercentComplete = percentComplete,
Task = currentTask,
- TaskCount = taskCount
+ TaskCount = taskCount,
+ ElapsedTime = DateTime.Now - this.startTime,
};
if (this.EncodeStatusChanged != null)
+ {
this.EncodeStatusChanged(this, eventArgs);
+ }
- if (windowsSeven.IsWindowsSeven)
+ if (this.windowsSeven.IsWindowsSeven)
{
int percent;
int.TryParse(Math.Round(percentComplete).ToString(), out percent);
- windowsSeven.SetTaskBarProgress(percent);
+ this.windowsSeven.SetTaskBarProgress(percent);
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
index e4f67b7db..da5f10e94 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
@@ -12,6 +12,7 @@ namespace HandBrake.ApplicationServices.Services
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
+ using System.Windows;
using System.Xml.Serialization;
using HandBrake.ApplicationServices.Model;
@@ -253,6 +254,7 @@ namespace HandBrake.ApplicationServices.Services
Description = string.Empty, // Maybe one day we will populate this.
IsBuildIn = true
};
+
this.presets.Add(newPreset);
}
}
@@ -321,15 +323,22 @@ namespace HandBrake.ApplicationServices.Services
/// </param>
private static void RecoverFromCorruptedPresetFile(string file)
{
- // Recover from Error.
- if (File.Exists(file))
+ try
{
- string disabledFile = file + ".old";
- File.Move(file, disabledFile);
+ // Recover from Error.
if (File.Exists(file))
{
- File.Delete(file);
+ string disabledFile = file + ".old";
+ File.Move(file, disabledFile);
+ if (File.Exists(file))
+ {
+ File.Delete(file);
+ }
}
+ }
+ catch(IOException)
+ {
+ // Give up
}
}
@@ -341,7 +350,7 @@ namespace HandBrake.ApplicationServices.Services
// First clear the Presets arraylists
this.presets.Clear();
- // Load in the users Presets from UserPresets.xml
+ // Load in the Presets from Presets.xml
try
{
if (File.Exists(this.builtInPresetFile))
diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
index ef95b6388..f2ca04c6d 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
@@ -265,7 +265,9 @@ namespace HandBrake.ApplicationServices.Services
{
// Growl
if (Properties.Settings.Default.GrowlQueue)
+ {
GrowlCommunicator.Notify("Queue Completed", "Put down that cocktail...\nyour Handbrake queue is done.");
+ }
// Do something whent he encode ends.
switch (Properties.Settings.Default.WhenCompleteAction)