diff options
author | sr55 <[email protected]> | 2011-05-08 11:00:16 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2011-05-08 11:00:16 +0000 |
commit | c2e751e3eb2ed19163c6c2a1318eab28bcbb921b (patch) | |
tree | 2a652aefd39b11c7442136052927df1b0e9b6191 /win | |
parent | 3d7392c9e4f114408b2fd16bd848a2e10c36fa32 (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')
-rw-r--r-- | win/CS/Controls/AudioPanel.cs | 6 | ||||
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/EventArgs/EncodeProgressEventArgs.cs | 5 | ||||
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Functions/Win7.cs | 19 | ||||
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Services/Encode.cs | 33 | ||||
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Services/PresetService.cs | 21 | ||||
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs | 2 | ||||
-rw-r--r-- | win/CS/frmMain.Designer.cs | 2 | ||||
-rw-r--r-- | win/CS/frmMain.cs | 4 | ||||
-rw-r--r-- | win/CS/frmQueue.Designer.cs | 3 | ||||
-rw-r--r-- | win/CS/frmQueue.cs | 53 |
10 files changed, 97 insertions, 51 deletions
diff --git a/win/CS/Controls/AudioPanel.cs b/win/CS/Controls/AudioPanel.cs index ff56a1330..7a63f7803 100644 --- a/win/CS/Controls/AudioPanel.cs +++ b/win/CS/Controls/AudioPanel.cs @@ -412,6 +412,12 @@ namespace Handbrake.Controls private void RemoveAudioTrack_Click(object sender, EventArgs e)
{
RemoveTrack();
+
+ if (this.AudioTracks.Count == 0)
+ {
+ drp_audioMix.Enabled =
+ drp_audioBitrate.Enabled = drp_audioSample.Enabled = btn_AdvancedAudio.Enabled = true;
+ }
}
#endregion
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)
diff --git a/win/CS/frmMain.Designer.cs b/win/CS/frmMain.Designer.cs index 066f7f68e..7e3d61e57 100644 --- a/win/CS/frmMain.Designer.cs +++ b/win/CS/frmMain.Designer.cs @@ -673,7 +673,7 @@ namespace Handbrake //
// DVD_Open
//
- this.DVD_Open.Description = "Select the \"VIDEO_TS\" folder from your DVD Drive.";
+ this.DVD_Open.Description = "Select a VIDEO_TS folder or a folder which contains a collection of video files.";
//
// File_Open
//
diff --git a/win/CS/frmMain.cs b/win/CS/frmMain.cs index 1b053150c..5177f6983 100644 --- a/win/CS/frmMain.cs +++ b/win/CS/frmMain.cs @@ -2373,13 +2373,15 @@ namespace Handbrake return;
}
+
lbl_encode.Text =
string.Format(
- "{0:00.00}%, FPS: {1:000.0}, Avg FPS: {2:000.0}, Time Remaining: {3}, Encode(s) Pending {4}",
+ "{0:00.00}%, FPS: {1:000.0}, Avg FPS: {2:000.0}, Time Remaining: {3}, Elapsed: {4:hh\\:mm\\:ss}, Pending Jobs {5}",
e.PercentComplete,
e.CurrentFrameRate,
e.AverageFrameRate,
e.EstimatedTimeLeft,
+ e.ElapsedTime,
this.queueProcessor.QueueManager.Count);
ProgressBarStatus.Value = (int)Math.Round(e.PercentComplete);
diff --git a/win/CS/frmQueue.Designer.cs b/win/CS/frmQueue.Designer.cs index 61e6df6d7..a1dcb886c 100644 --- a/win/CS/frmQueue.Designer.cs +++ b/win/CS/frmQueue.Designer.cs @@ -376,6 +376,9 @@ namespace Handbrake this.lbl_encodesPending.Name = "lbl_encodesPending";
this.lbl_encodesPending.Size = new System.Drawing.Size(115, 17);
this.lbl_encodesPending.Text = "0 encode(s) pending";
+ this.lbl_encodesPending.ToolTipText = "- Displays the number of jobs remaining to process.\r\n- Displays the time for the " +
+ "current processing session. \r\n (Note, this is reset every time you press encode" +
+ ", including after a pause)";
//
// OpenFile
//
diff --git a/win/CS/frmQueue.cs b/win/CS/frmQueue.cs index ee9dae04f..20ce68259 100644 --- a/win/CS/frmQueue.cs +++ b/win/CS/frmQueue.cs @@ -46,6 +46,8 @@ namespace Handbrake private readonly IUserSettingService userSettingService = new UserSettingService();
+ private DateTime startTime;
+
/// <summary>
/// Initializes a new instance of the <see cref="frmQueue"/> class.
/// </summary>
@@ -136,11 +138,14 @@ namespace Handbrake lbl_encodeStatus.Text =
string.Format(
- "Encoding: Pass {0} of {1}, {2:00.00}% Time Remaining: {3}",
+ "Encoding: Pass {0} of {1}, {2:00.00}%, Time Remaining: {3}, Elapsed: {4:hh\\:mm\\:ss}",
e.Task,
e.TaskCount,
e.PercentComplete,
- e.EstimatedTimeLeft);
+ e.EstimatedTimeLeft,
+ e.ElapsedTime);
+
+ UpdateStatusLabel();
}
/// <summary>
@@ -224,6 +229,7 @@ namespace Handbrake if (!queue.IsProcessing)
{
SetUiEncodeStarted();
+ startTime = DateTime.Now;
}
lbl_encodeStatus.Text = "Encoding ...";
@@ -242,6 +248,7 @@ namespace Handbrake private void BtnPauseClick(object sender, EventArgs e)
{
queue.Pause();
+
MessageBox.Show(
"No further items on the queue will start. The current encode process will continue until it is finished. \nClick 'Encode' when you wish to continue encoding the queue.",
"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
@@ -309,7 +316,7 @@ namespace Handbrake lbl_dest.Text = "-";
lbl_encodeOptions.Text = "-";
- lbl_encodesPending.Text = list_queue.Items.Count + " encode(s) pending";
+ UpdateStatusLabel();
}
/// <summary>
@@ -348,22 +355,7 @@ namespace Handbrake item.SubItems.Add(chapters); // Chapters
item.SubItems.Add(queueItem.Source); // Source
item.SubItems.Add(queueItem.Destination); // Destination
-
- switch (parsed.VideoEncoder)
- {
- case VideoEncoder.FFMpeg:
- item.SubItems.Add("MPEG-4 (FFmpeg)");
- break;
- default:
- case VideoEncoder.X264:
- item.SubItems.Add("H.264 (x264)");
- break;
- case VideoEncoder.Theora:
- item.SubItems.Add("VP3 (Theroa)");
- break;
- }
-
- // Video
+ item.SubItems.Add(EnumHelper<VideoEncoder>.GetDescription(parsed.VideoEncoder));
// Display The Audio Track Information
string audio = string.Empty;
@@ -392,7 +384,28 @@ namespace Handbrake }
RedrawQueue();
- lbl_encodesPending.Text = list_queue.Items.Count + " encode(s) pending";
+ UpdateStatusLabel();
+ }
+
+ private void UpdateStatusLabel()
+ {
+ if (InvokeRequired)
+ {
+ BeginInvoke(new UpdateHandler(UpdateStatusLabel));
+ return;
+ }
+ TimeSpan span = DateTime.Now - startTime;
+
+ if (queue.IsProcessing)
+ {
+ lbl_encodesPending.Text = string.Format(
+ "{0} encodes(s) pending, Time Elasped {1:hh\\:mm\\:ss}", list_queue.Items.Count, span);
+ }
+ else
+ {
+ lbl_encodesPending.Text = string.Format(
+ "{0} encodes(s) pending", list_queue.Items.Count);
+ }
}
/// <summary>
|