summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices
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
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')
-rw-r--r--win/CS/HandBrake.ApplicationServices/EventArgs/EncodeProgressEventArgs.cs5
-rw-r--r--win/CS/HandBrake.ApplicationServices/Functions/Win7.cs19
-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
5 files changed, 51 insertions, 29 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/EventArgs/EncodeProgressEventArgs.cs b/win/CS/HandBrake.ApplicationServices/EventArgs/EncodeProgressEventArgs.cs
index b4d6b9a64..8ef8ceb39 100644
--- a/win/CS/HandBrake.ApplicationServices/EventArgs/EncodeProgressEventArgs.cs
+++ b/win/CS/HandBrake.ApplicationServices/EventArgs/EncodeProgressEventArgs.cs
@@ -41,5 +41,10 @@ namespace HandBrake.ApplicationServices.EventArgs
/// Gets or sets TaskCount.
/// </summary>
public int TaskCount { get; set; }
+
+ /// <summary>
+ /// Gets or sets ElapsedTime.
+ /// </summary>
+ public TimeSpan ElapsedTime { get; set; }
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Functions/Win7.cs b/win/CS/HandBrake.ApplicationServices/Functions/Win7.cs
index 8d694d2f8..b2262f147 100644
--- a/win/CS/HandBrake.ApplicationServices/Functions/Win7.cs
+++ b/win/CS/HandBrake.ApplicationServices/Functions/Win7.cs
@@ -23,9 +23,10 @@ namespace HandBrake.ApplicationServices.Functions
/// </summary>
public Win7()
{
- if (IsWindowsSeven)
+ if (this.IsWindowsSeven)
{
- windowsTaskbar = TaskbarManager.Instance;
+ this.windowsTaskbar = TaskbarManager.Instance;
+ this.windowsTaskbar.ApplicationId = "HandBrake";
}
}
@@ -36,8 +37,7 @@ namespace HandBrake.ApplicationServices.Functions
{
get
{
- OperatingSystem os = Environment.OSVersion;
- return os.Version.Major >= 6 && os.Version.Minor >= 1;
+ return TaskbarManager.IsPlatformSupported;
}
}
@@ -49,12 +49,13 @@ namespace HandBrake.ApplicationServices.Functions
/// </param>
public void SetTaskBarProgress(int percentage)
{
- if (!IsWindowsSeven)
+ if (!this.IsWindowsSeven)
{
return;
}
- windowsTaskbar.SetProgressState(TaskbarProgressBarState.Normal);
- windowsTaskbar.SetProgressValue(percentage, 100);
+
+ this.windowsTaskbar.SetProgressState(TaskbarProgressBarState.Normal);
+ this.windowsTaskbar.SetProgressValue(percentage, 100);
}
/// <summary>
@@ -62,12 +63,12 @@ namespace HandBrake.ApplicationServices.Functions
/// </summary>
public void SetTaskBarProgressToNoProgress()
{
- if (!IsWindowsSeven)
+ if (!this.IsWindowsSeven)
{
return;
}
- windowsTaskbar.SetProgressState(TaskbarProgressBarState.NoProgress);
+ this.windowsTaskbar.SetProgressState(TaskbarProgressBarState.NoProgress);
}
}
} \ No newline at end of file
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)