diff options
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r-- | win/CS/HandBrakeWPF/App.xaml | 1 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs | 4 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Converters/QueueStatusToVisibilityConverter.cs | 86 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/HandBrakeWPF.csproj | 9 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 70 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs | 230 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs | 2 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/Images/Complete.png | bin | 0 -> 314 bytes | |||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/Images/Refresh.ico | bin | 0 -> 29926 bytes | |||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/Images/WarningSmall.png | bin | 0 -> 618 bytes | |||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/Images/Working0.png | bin | 0 -> 350 bytes | |||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/MainView.xaml | 9 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/QueueView.xaml | 125 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/Styles/Styles.xaml | 18 |
14 files changed, 424 insertions, 130 deletions
diff --git a/win/CS/HandBrakeWPF/App.xaml b/win/CS/HandBrakeWPF/App.xaml index f0af595ce..5ac1f993e 100644 --- a/win/CS/HandBrakeWPF/App.xaml +++ b/win/CS/HandBrakeWPF/App.xaml @@ -4,6 +4,7 @@ <Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
+ <ResourceDictionary Source="Views/Styles/Styles.xaml"/>
<ResourceDictionary>
<local:CastleBootstrapper x:Key="bootstrapper" />
</ResourceDictionary>
diff --git a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs index 635b3bd0c..bb6a4be61 100644 --- a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs @@ -137,6 +137,10 @@ namespace HandBrakeWPF.Converters {
return EnumHelper<Denoise>.GetDisplay((Denoise)value);
}
+ if (targetType == typeof(QueueItemStatus) || value.GetType() == typeof(QueueItemStatus))
+ {
+ return EnumHelper<QueueItemStatus>.GetDisplay((QueueItemStatus)value);
+ }
return null;
}
diff --git a/win/CS/HandBrakeWPF/Converters/QueueStatusToVisibilityConverter.cs b/win/CS/HandBrakeWPF/Converters/QueueStatusToVisibilityConverter.cs new file mode 100644 index 000000000..68503b741 --- /dev/null +++ b/win/CS/HandBrakeWPF/Converters/QueueStatusToVisibilityConverter.cs @@ -0,0 +1,86 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="QueueStatusToVisibilityConverter.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 QueueStatusToVisibilityConverter type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Converters
+{
+ using System.Globalization;
+ using System.Windows;
+ using System.Windows.Data;
+ using System;
+
+ using HandBrake.ApplicationServices.Model;
+
+ /// <summary>
+ /// Boolean to Visibility Converter
+ /// </summary>
+ public sealed class QueueStatusToVisibilityConverter : IValueConverter
+ {
+ /// <summary>
+ /// Convert a boolean to visibility property.
+ /// </summary>
+ /// <param name="value">
+ /// The value.
+ /// </param>
+ /// <param name="targetType">
+ /// The target type.
+ /// </param>
+ /// <param name="parameter">
+ /// The parameter. (A boolean which inverts the output)
+ /// </param>
+ /// <param name="culture">
+ /// The culture.
+ /// </param>
+ /// <returns>
+ /// Visibility property
+ /// </returns>
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value != null)
+ {
+ QueueItemStatus status = (QueueItemStatus)value;
+ switch (status)
+ {
+ case QueueItemStatus.Waiting:
+ case QueueItemStatus.InProgress:
+ return Visibility.Collapsed;
+ default:
+ return Visibility.Visible;
+ }
+ }
+
+ return Visibility.Collapsed;
+ }
+
+ /// <summary>
+ /// Convert Back for the IValueConverter Interface. Not used!
+ /// </summary>
+ /// <param name="value">
+ /// The value.
+ /// </param>
+ /// <param name="targetType">
+ /// The target type.
+ /// </param>
+ /// <param name="parameter">
+ /// The parameter.
+ /// </param>
+ /// <param name="culture">
+ /// The culture.
+ /// </param>
+ /// <returns>
+ /// Nothing
+ /// </returns>
+ /// <exception cref="NotImplementedException">
+ /// This method is not used!
+ /// </exception>
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index 580a9fb56..16989a264 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -97,6 +97,7 @@ </ApplicationDefinition>
<Compile Include="Converters\BooleanConverter.cs" />
<Compile Include="Converters\BooleanToVisibilityConverter.cs" />
+ <Compile Include="Converters\QueueStatusToVisibilityConverter.cs" />
<Compile Include="Converters\EnumComboConverter.cs" />
<Compile Include="Converters\FullPathToFileNameConverter.cs" />
<Compile Include="Helpers\AutoNameHelper.cs" />
@@ -232,6 +233,10 @@ <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Resource Include="Views\Styles\Styles.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Resource>
<Page Include="Views\AudioView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -289,6 +294,10 @@ <Content Include="defaultsettings.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+ <Resource Include="Views\Images\Refresh.ico" />
+ <Resource Include="Views\Images\WarningSmall.png" />
+ <Resource Include="Views\Images\Complete.png" />
+ <Resource Include="Views\Images\Working0.png" />
<Resource Include="handbrakepineapple.ico" />
<Resource Include="Views\Images\delete.png" />
<Resource Include="Views\Images\Close.png" />
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index b2f067670..54622b392 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -95,7 +95,7 @@ namespace HandBrakeWPF.ViewModels /// <summary>
/// The Toolbar Status Label
/// </summary>
- private string programStatusLabel;
+ private string statusLabel;
/// <summary>
/// Backing field for the scanned source.
@@ -171,7 +171,7 @@ namespace HandBrakeWPF.ViewModels this.queueProcessor.QueuePaused += this.QueuePaused;
this.queueProcessor.EncodeService.EncodeStarted += this.EncodeStarted;
this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeStatusChanged;
-
+
this.Presets = this.presetService.Presets;
}
@@ -237,19 +237,19 @@ namespace HandBrakeWPF.ViewModels /// Gets or sets the Program Status Toolbar Label
/// This indicates the status of HandBrake
/// </summary>
- public string ProgramStatusLabel
+ public string StatusLabel
{
get
{
- return string.IsNullOrEmpty(this.programStatusLabel) ? "Ready" : this.sourceLabel;
+ return string.IsNullOrEmpty(this.statusLabel) ? "Ready" : this.statusLabel;
}
set
{
- if (!Equals(this.programStatusLabel, value))
+ if (!Equals(this.statusLabel, value))
{
- this.programStatusLabel = value;
- this.NotifyOfPropertyChange("ProgramStatusLabel");
+ this.statusLabel = value;
+ this.NotifyOfPropertyChange(() => this.StatusLabel);
}
}
}
@@ -741,7 +741,7 @@ namespace HandBrakeWPF.ViewModels if (!this.IsEncoding)
{
- this.ProgramStatusLabel = string.Format("{0} Encodes Pending", this.queueProcessor.QueueManager.Count);
+ this.StatusLabel = string.Format("{0} Encodes Pending", this.queueProcessor.QueueManager.Count);
}
}
@@ -778,7 +778,14 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void StartEncode()
{
- // Santiy Checking.
+ // Check if we already have jobs, and if we do, just start the queue.
+ if (this.queueProcessor.QueueManager.Count != 0)
+ {
+ this.queueProcessor.Start();
+ return;
+ }
+
+ // Otherwise, perform Santiy Checking then add to the queue and start if everything is ok.
if (this.ScannedSource == null || this.CurrentTask == null)
{
this.errorService.ShowMessageBox("You must first scan a source.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
@@ -1129,7 +1136,7 @@ namespace HandBrakeWPF.ViewModels switch (this.SelectedPointToPoint)
{
case PointToPointMode.Chapters:
- return this.SelectedTitle.CalculateDuration(this.SelectedStartPoint -1, this.SelectedEndPoint -1).ToString();
+ return this.SelectedTitle.CalculateDuration(this.SelectedStartPoint - 1, this.SelectedEndPoint - 1).ToString();
case PointToPointMode.Seconds:
return TimeSpan.FromSeconds(startEndDuration).ToString();
case PointToPointMode.Frames:
@@ -1183,6 +1190,7 @@ namespace HandBrakeWPF.ViewModels }
this.SourceLabel = "Scan Completed";
+ this.StatusLabel = "Scan Completed";
});
// TODO Re-enable GUI.
@@ -1199,6 +1207,11 @@ namespace HandBrakeWPF.ViewModels /// </param>
private void ScanStared(object sender, EventArgs e)
{
+ Execute.OnUIThread(
+ () =>
+ {
+ this.StatusLabel = "Scanning source, please wait...";
+ });
// TODO - Disable relevant parts of the UI.
}
@@ -1213,15 +1226,19 @@ namespace HandBrakeWPF.ViewModels /// </param>
private void EncodeStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs e)
{
- ProgramStatusLabel =
- string.Format(
- "{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);
+ Execute.OnUIThread(
+ () =>
+ {
+ this.StatusLabel =
+ string.Format(
+ "{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);
+ });
}
/// <summary>
@@ -1235,6 +1252,13 @@ namespace HandBrakeWPF.ViewModels /// </param>
private void EncodeStarted(object sender, EventArgs e)
{
+ Execute.OnUIThread(
+ () =>
+ {
+ this.StatusLabel = "Preparing to encode ...";
+ this.IsEncoding = true;
+ });
+
// TODO Handle Updating the UI
}
@@ -1249,6 +1273,7 @@ namespace HandBrakeWPF.ViewModels /// </param>
private void QueuePaused(object sender, EventArgs e)
{
+ this.IsEncoding = false;
// TODO Handle Updating the UI
}
@@ -1265,6 +1290,13 @@ namespace HandBrakeWPF.ViewModels {
this.IsEncoding = false;
+ Execute.OnUIThread(
+ () =>
+ {
+ this.StatusLabel = "Queue Finished";
+ this.IsEncoding = false;
+ });
+
// TODO Handle Updating the UI
}
#endregion
diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs index 7c3d79994..b5344788d 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs @@ -9,29 +9,29 @@ namespace HandBrakeWPF.ViewModels
{
+ using System;
using System.Collections.ObjectModel;
using System.ComponentModel.Composition;
using System.Windows;
using Caliburn.Micro;
+ using HandBrake.ApplicationServices.EventArgs;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.ViewModels.Interfaces;
+ using Ookii.Dialogs.Wpf;
+
/// <summary>
/// The Preview View Model
/// </summary>
[Export(typeof(IQueueViewModel))]
public class QueueViewModel : ViewModelBase, IQueueViewModel
{
- #region Private Fields
- /// <summary>
- /// Queue Processor Backing field
- /// </summary>
- private readonly IQueueProcessor queueProcessor;
+ #region Constants and Fields
/// <summary>
/// The Error Service Backing field
@@ -39,9 +39,14 @@ namespace HandBrakeWPF.ViewModels private readonly IErrorService errorService;
/// <summary>
- /// Jobs pending backing field
+ /// Queue Processor Backing field
/// </summary>
- private string jobsPending;
+ private readonly IQueueProcessor queueProcessor;
+
+ /// <summary>
+ /// IsEncoding Backing field
+ /// </summary>
+ private bool isEncoding;
/// <summary>
/// Job Status Backing field.
@@ -49,22 +54,26 @@ namespace HandBrakeWPF.ViewModels private string jobStatus;
/// <summary>
- /// IsEncoding Backing field
+ /// Jobs pending backing field
/// </summary>
- private bool isEncoding;
+ private string jobsPending;
#endregion
+ #region Constructors and Destructors
+
/// <summary>
/// Initializes a new instance of the <see cref="QueueViewModel"/> class.
/// </summary>
/// <param name="windowManager">
/// The window manager.
/// </param>
- /// <param name="queueProcessor">
+ /// <param name="queueProcessor">
+ ///
/// The Queue Processor Service
/// </param>
- /// <param name="errorService">
+ /// <param name="errorService">
+ ///
/// The Error Service
/// </param>
public QueueViewModel(IWindowManager windowManager, IQueueProcessor queueProcessor, IErrorService errorService)
@@ -76,13 +85,9 @@ namespace HandBrakeWPF.ViewModels this.JobStatus = "There are no jobs currently encoding";
}
- /// <summary>
- /// Gets QueueJobs.
- /// </summary>
- public ObservableCollection<QueueTask> QueueJobs
- {
- get { return this.queueProcessor.QueueManager.Queue; }
- }
+ #endregion
+
+ #region Properties
/// <summary>
/// Gets or sets a value indicating whether IsEncoding.
@@ -97,7 +102,7 @@ namespace HandBrakeWPF.ViewModels set
{
this.isEncoding = value;
- this.NotifyOfPropertyChange("IsEncoding");
+ this.NotifyOfPropertyChange(() => IsEncoding);
}
}
@@ -114,7 +119,7 @@ namespace HandBrakeWPF.ViewModels set
{
this.jobStatus = value;
- this.NotifyOfPropertyChange("JobStatus");
+ this.NotifyOfPropertyChange(() => this.JobStatus);
}
}
@@ -131,22 +136,64 @@ namespace HandBrakeWPF.ViewModels set
{
this.jobsPending = value;
- this.NotifyOfPropertyChange("JobsPending");
+ this.NotifyOfPropertyChange(() => this.JobsPending);
}
}
/// <summary>
- /// Start Encode
+ /// Gets QueueJobs.
/// </summary>
- public void StartEncode()
+ public ObservableCollection<QueueTask> QueueJobs
{
- if (this.queueProcessor.QueueManager.Count == 0)
+ get
{
- this.errorService.ShowMessageBox("There are no pending jobs.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
- return;
+ return this.queueProcessor.QueueManager.Queue;
}
+ }
- this.queueProcessor.Start();
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Clear the Queue
+ /// </summary>
+ public void Clear()
+ {
+ this.queueProcessor.QueueManager.Clear();
+ }
+
+ /// <summary>
+ /// Clear Completed Items
+ /// </summary>
+ public void ClearCompleted()
+ {
+ this.queueProcessor.QueueManager.ClearCompleted();
+ }
+
+ /// <summary>
+ /// Close this window.
+ /// </summary>
+ public void Close()
+ {
+ this.TryClose();
+ }
+
+ /// <summary>
+ /// Handle the On Window Load
+ /// </summary>
+ public override void OnLoad()
+ {
+ this.queueProcessor.JobProcessingStarted += this.queueProcessor_JobProcessingStarted;
+ this.queueProcessor.QueueCompleted += this.queueProcessor_QueueCompleted;
+ this.queueProcessor.QueuePaused += this.queueProcessor_QueuePaused;
+ this.queueProcessor.QueueManager.QueueChanged += this.QueueManager_QueueChanged;
+
+ // Setup the window to the correct state.
+ this.IsEncoding = this.queueProcessor.EncodeService.IsEncoding;
+ this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);
+
+ base.OnLoad();
}
/// <summary>
@@ -167,12 +214,16 @@ namespace HandBrakeWPF.ViewModels {
if (task.Status == QueueItemStatus.InProgress)
{
- MessageBoxResult result = this.errorService.ShowMessageBox(
- "This encode is currently in progress. If you delete it, the encode will be stoped. Are you sure you wish to proceed?",
- "Warning", MessageBoxButton.YesNo, MessageBoxImage.Question);
+ MessageBoxResult result =
+ this.errorService.ShowMessageBox(
+ "This encode is currently in progress. If you delete it, the encode will be stoped. Are you sure you wish to proceed?",
+ "Warning",
+ MessageBoxButton.YesNo,
+ MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
+ this.queueProcessor.EncodeService.Stop();
this.queueProcessor.QueueManager.Remove(task);
}
}
@@ -185,31 +236,58 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
- /// Handle the On Window Load
+ /// Reset the job state to waiting.
/// </summary>
- public override void OnLoad()
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void RetryJob(QueueTask task)
{
- this.queueProcessor.JobProcessingStarted += queueProcessor_JobProcessingStarted;
- this.queueProcessor.QueueCompleted += queueProcessor_QueueCompleted;
- this.queueProcessor.QueuePaused += queueProcessor_QueuePaused;
- this.queueProcessor.QueueManager.QueueChanged += QueueManager_QueueChanged;
+ task.Status = QueueItemStatus.Waiting;
+ }
- // Setup the window to the correct state.
- this.IsEncoding = queueProcessor.EncodeService.IsEncoding;
- this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);
+ /// <summary>
+ /// Start Encode
+ /// </summary>
+ public void StartEncode()
+ {
+ if (this.queueProcessor.QueueManager.Count == 0)
+ {
+ this.errorService.ShowMessageBox(
+ "There are no pending jobs.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ return;
+ }
- base.OnLoad();
+ this.queueProcessor.Start();
}
/// <summary>
- /// Close this window.
+ /// Export the Queue to a file.
/// </summary>
- public void Close()
+ public void Export()
{
- this.TryClose();
+ VistaSaveFileDialog dialog = new VistaSaveFileDialog { Filter = "HandBrake Queue Files (*.hbq)|*.hbq"};
+ dialog.ShowDialog();
+
+ this.queueProcessor.QueueManager.BackupQueue(dialog.FileName);
}
/// <summary>
+ /// Import a saved queue
+ /// </summary>
+ public void Import()
+ {
+ VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "HandBrake Queue Files (*.hbq)|*.hbq", CheckFileExists = true };
+ dialog.ShowDialog();
+
+ this.queueProcessor.QueueManager.RestoreQueue(dialog.FileName);
+ }
+
+ #endregion
+
+ #region Methods
+
+ /// <summary>
/// Override the OnActive to run the Screen Loading code in the view model base.
/// </summary>
protected override void OnActivate()
@@ -219,33 +297,41 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
- /// Handle the Queue Paused Event
+ /// Handle the Encode Status Changed Event.
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
- /// The EventArgs.
+ /// The EncodeProgressEventArgs.
/// </param>
- private void queueProcessor_QueuePaused(object sender, System.EventArgs e)
+ private void EncodeService_EncodeStatusChanged(
+ object sender, EncodeProgressEventArgs e)
{
- this.JobStatus = "Queue Paused";
- this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);
+ this.JobStatus =
+ string.Format(
+ "Encoding: Pass {0} of {1}, {2:00.00}%, FPS: {3:000.0}, Avg FPS: {4:000.0}, Time Remaining: {5}, Elapsed: {6:hh\\:mm\\:ss}",
+ e.Task,
+ e.TaskCount,
+ e.PercentComplete,
+ e.CurrentFrameRate,
+ e.AverageFrameRate,
+ e.EstimatedTimeLeft,
+ e.ElapsedTime);
}
/// <summary>
- /// Handle the Queue Completed Event
+ /// Handle the Queue Changed Event.
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
- /// The EventArgs.
+ /// The e.
/// </param>
- private void queueProcessor_QueueCompleted(object sender, System.EventArgs e)
+ private void QueueManager_QueueChanged(object sender, EventArgs e)
{
- this.JobStatus = "Queue Completed";
- this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);
+ // TODO
}
/// <summary>
@@ -257,47 +343,47 @@ namespace HandBrakeWPF.ViewModels /// <param name="e">
/// The QueueProgressEventArgs.
/// </param>
- private void queueProcessor_JobProcessingStarted(object sender, HandBrake.ApplicationServices.EventArgs.QueueProgressEventArgs e)
+ private void queueProcessor_JobProcessingStarted(
+ object sender, QueueProgressEventArgs e)
{
this.JobStatus = "Queue Started";
this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);
- this.queueProcessor.EncodeService.EncodeStatusChanged += EncodeService_EncodeStatusChanged;
+ this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeService_EncodeStatusChanged;
+ this.IsEncoding = true;
}
/// <summary>
- /// Handle the Encode Status Changed Event.
+ /// Handle the Queue Completed Event
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
- /// The EncodeProgressEventArgs.
+ /// The EventArgs.
/// </param>
- private void EncodeService_EncodeStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs e)
+ private void queueProcessor_QueueCompleted(object sender, EventArgs e)
{
- this.JobStatus = string.Format(
- "Encoding: Pass {0} of {1}, {2:00.00}%, FPS: {3:000.0}, Avg FPS: {4:000.0}, Time Remaining: {5}, Elapsed: {6:hh\\:mm\\:ss}",
- e.Task,
- e.TaskCount,
- e.PercentComplete,
- e.CurrentFrameRate,
- e.AverageFrameRate,
- e.EstimatedTimeLeft,
- e.ElapsedTime);
+ this.JobStatus = "Queue Completed";
+ this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);
+ this.IsEncoding = false;
}
/// <summary>
- /// Handle the Queue Changed Event.
+ /// Handle the Queue Paused Event
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
- /// The e.
+ /// The EventArgs.
/// </param>
- private void QueueManager_QueueChanged(object sender, System.EventArgs e)
+ private void queueProcessor_QueuePaused(object sender, EventArgs e)
{
- // TODO
+ this.JobStatus = "Queue Paused";
+ this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);
+ this.IsEncoding = false;
}
+
+ #endregion
}
-}
+}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index 8fa221b21..358ebcbf5 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -96,7 +96,7 @@ namespace HandBrakeWPF.ViewModels {
get
{
- return new List<string> { "Same as source", "5", "10", "12", "15", "23.976", "24", "25", "29.97`" };
+ return new List<string> { "Same as source", "5", "10", "12", "15", "23.976", "24", "25", "29.97", "30", "50", "59.94", "60" };
}
}
diff --git a/win/CS/HandBrakeWPF/Views/Images/Complete.png b/win/CS/HandBrakeWPF/Views/Images/Complete.png Binary files differnew file mode 100644 index 000000000..503e52c8e --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/Images/Complete.png diff --git a/win/CS/HandBrakeWPF/Views/Images/Refresh.ico b/win/CS/HandBrakeWPF/Views/Images/Refresh.ico Binary files differnew file mode 100644 index 000000000..3267a092a --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/Images/Refresh.ico diff --git a/win/CS/HandBrakeWPF/Views/Images/WarningSmall.png b/win/CS/HandBrakeWPF/Views/Images/WarningSmall.png Binary files differnew file mode 100644 index 000000000..78f246f04 --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/Images/WarningSmall.png diff --git a/win/CS/HandBrakeWPF/Views/Images/Working0.png b/win/CS/HandBrakeWPF/Views/Images/Working0.png Binary files differnew file mode 100644 index 000000000..200606b54 --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/Images/Working0.png diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index e6a4e6997..4f243237f 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -16,7 +16,8 @@ </i:EventTrigger>
</i:Interaction.Triggers>
- <Window.Resources>
+ <Window.Resources>
+
<Style TargetType="Button">
<Setter Property="Foreground" Value="DarkOrange" />
<Setter Property="FontWeight" Value="Bold" />
@@ -94,7 +95,7 @@ </MenuItem>
<MenuItem Header="Help">
- <MenuItem Header="HandBrake User Guide" Micro:Message.Attach="[Event Click] = [Action LaunchHelp]" >
+ <MenuItem Header="HandBrake User Guide (HTTP)" Micro:Message.Attach="[Event Click] = [Action LaunchHelp]" >
<MenuItem.Icon>
<Image Source="Images/Help16.png" Width="16" />
</MenuItem.Icon>
@@ -345,8 +346,8 @@ </StackPanel>
<!-- Status Bar -->
- <StatusBar Grid.Row="6" Height="28" Grid.ColumnSpan="2" VerticalAlignment="Bottom">
- <Label Content="{Binding Path=ProgramStatusLabel}" FontSize="10" VerticalAlignment="Center" />
+ <StatusBar Padding="0" Margin="0" Grid.Row="6" Height="32" Grid.ColumnSpan="2" VerticalAlignment="Bottom" >
+ <Label Content="{Binding Path=StatusLabel}" FontSize="11" Padding="0,0,0,5" VerticalAlignment="Center" />
</StatusBar>
</StackPanel>
diff --git a/win/CS/HandBrakeWPF/Views/QueueView.xaml b/win/CS/HandBrakeWPF/Views/QueueView.xaml index 982b8f1ec..1c5d09861 100644 --- a/win/CS/HandBrakeWPF/Views/QueueView.xaml +++ b/win/CS/HandBrakeWPF/Views/QueueView.xaml @@ -5,13 +5,17 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:cal="http://www.caliburnproject.org"
xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
- xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop" mc:Ignorable="d" Title="{Binding Title}"
+ xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
+ xmlns:Model="clr-namespace:HandBrake.ApplicationServices.Model;assembly=HandBrake.ApplicationServices"
+ mc:Ignorable="d" Title="{Binding Title}"
Width="600" Height="400"
Background="#FFF0F0F0">
<Window.Resources>
<Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
<Converters:FullPathToFileNameConverter x:Key="filePathToFilenameConverter" />
+ <Converters:EnumComboConverter x:Key="enumComboConverter" />
+ <Converters:QueueStatusToVisibilityConverter x:Key="queueStatusVisConverter" />
</Window.Resources>
<Grid >
@@ -46,6 +50,17 @@ <ListBox Grid.Row="2" ItemsSource="{Binding QueueJobs}" SelectionMode="Extended" Background="LightGray" Margin="10,0,10,10"
dd:DragDrop.IsDragSource="True" dd:DragDrop.IsDropTarget="True"
dd:DragDrop.DropHandler="{Binding}">
+
+ <ListBox.ContextMenu>
+ <ContextMenu>
+ <MenuItem Header="Import Queue" cal:Message.Attach="[Event Click] = [Action Import]" />
+ <MenuItem Header="Export Queue" cal:Message.Attach="[Event Click] = [Action Export]" />
+ <Separator />
+ <MenuItem Header="Clear" cal:Message.Attach="[Event Click] = [Action Clear]" />
+ <MenuItem Header="Clear Completed" cal:Message.Attach="[Event Click] = [Action ClearCompleted]" />
+ </ContextMenu>
+ </ListBox.ContextMenu>
+
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
@@ -65,43 +80,85 @@ </Grid.ColumnDefinitions>
<!-- Marker -->
- <Image Source="Images/Movies.png" Width="16" Height="16" Grid.Column="0" Margin="10,0,10,0" />
+ <Image Width="16" Height="16" Grid.Column="0" Margin="10,0,10,0" >
+ <Image.Style>
+ <Style TargetType="{x:Type Image}">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Status, Converter={StaticResource enumComboConverter}}" Value="Waiting">
+ <Setter Property="Source" Value="Images\Movies.png"/>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Status, Converter={StaticResource enumComboConverter}}" Value="In Progress">
+ <Setter Property="Source" Value="Images\Working0.png"/>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Status, Converter={StaticResource enumComboConverter}}" Value="Completed" >
+ <Setter Property="Source" Value="Images\Complete.png"/>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Status, Converter={StaticResource enumComboConverter}}" Value="Error" >
+ <Setter Property="Source" Value="Images\WarningSmall.png"/>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Image.Style>
+ </Image>
<!-- Settings -->
- <StackPanel Grid.Column="1" HorizontalAlignment="Stretch" Margin="0,5,0,5">
- <StackPanel Orientation="Horizontal">
- <TextBlock Text="Title: " FontWeight="Bold" />
- <TextBlock Text="{Binding Task.Title}"/>
-
- <TextBlock Text="{Binding Task.PointToPointMode}" FontWeight="Bold" Margin="10,0,0,0" />
- <TextBlock Text=": " />
- <TextBlock Text="{Binding Task.StartPoint}"/>
- <TextBlock Text="to" Margin="5,0,5,0" />
- <TextBlock Text="{Binding Task.EndPoint}"/>
- </StackPanel>
-
- <!-- TODO Support Drive Label Name-->
- <StackPanel Orientation="Horizontal">
- <TextBlock Text="Source: " FontWeight="Bold" />
- <TextBlock Text="{Binding Task.Source, Converter={StaticResource filePathToFilenameConverter}}"/>
- </StackPanel>
-
- <StackPanel Orientation="Horizontal">
- <TextBlock Text="Destination: " FontWeight="Bold" />
- <TextBlock Text="{Binding Task.Destination, Converter={StaticResource filePathToFilenameConverter}}"/>
- </StackPanel>
+ <StackPanel Grid.Column="1" HorizontalAlignment="Stretch" Margin="0,5,0,5">
+ <StackPanel Orientation="Horizontal">
+ <TextBlock Text="Title: " FontWeight="Bold" />
+ <TextBlock Text="{Binding Task.Title}"/>
+
+ <TextBlock Text="{Binding Task.PointToPointMode}" FontWeight="Bold" Margin="10,0,0,0" />
+ <TextBlock Text=": " />
+ <TextBlock Text="{Binding Task.StartPoint}"/>
+ <TextBlock Text="to" Margin="5,0,5,0" />
+ <TextBlock Text="{Binding Task.EndPoint}"/>
+ </StackPanel>
+
+ <!-- TODO Support Drive Label Name-->
+ <StackPanel Orientation="Horizontal">
+ <TextBlock Text="Source: " FontWeight="Bold" />
+ <TextBlock Text="{Binding Task.Source, Converter={StaticResource filePathToFilenameConverter}}"/>
+ </StackPanel>
+
+ <StackPanel Orientation="Horizontal">
+ <TextBlock Text="Destination: " FontWeight="Bold" />
+ <TextBlock Text="{Binding Task.Destination, Converter={StaticResource filePathToFilenameConverter}}"/>
</StackPanel>
-
+
+ <StackPanel Orientation="Horizontal">
+ <TextBlock Text="Status: " FontWeight="Bold" />
+ <TextBlock Text="{Binding Status, Converter={StaticResource enumComboConverter}}"/>
+ </StackPanel>
+ </StackPanel>
+
<!-- Delete -->
- <Image Source="Images/delete.png" Width="16" Height="16" Grid.Column="2" Margin="10,0,10,0">
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="MouseDown">
- <cal:ActionMessage MethodName="RemoveJob">
- <cal:Parameter Value="{Binding}" />
- </cal:ActionMessage>
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </Image>
+ <Grid VerticalAlignment="Center" Grid.Column="2" Margin="10,0,10,0">
+ <StackPanel Orientation="Vertical">
+ <Image Source="Images/Refresh.ico" Width="20" Height="20" ToolTip="Reset job status to Waiting."
+ Visibility="{Binding Status, Converter={StaticResource queueStatusVisConverter}}" >
+ <i:Interaction.Triggers>
+ <i:EventTrigger EventName="MouseDown">
+ <cal:ActionMessage MethodName="RetryJob">
+ <cal:Parameter Value="{Binding}" />
+ </cal:ActionMessage>
+ </i:EventTrigger>
+ </i:Interaction.Triggers>
+ </Image>
+
+ <Image Source="Images/delete.png" Width="20" Height="20" Margin="0,5,0,0" ToolTip="Remove this Job">
+ <i:Interaction.Triggers>
+ <i:EventTrigger EventName="MouseDown">
+ <cal:ActionMessage MethodName="RemoveJob">
+ <cal:Parameter Value="{Binding}" />
+ </cal:ActionMessage>
+ </i:EventTrigger>
+ </i:Interaction.Triggers>
+ </Image>
+ </StackPanel>
+ </Grid>
+
+
+
</Grid>
diff --git a/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml b/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml new file mode 100644 index 000000000..ada586ec4 --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml @@ -0,0 +1,18 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+
+ <Style x:Key="{x:Type StatusBar}" TargetType="{x:Type StatusBar}">
+ <Setter Property="SnapsToDevicePixels" Value="True"/>
+ <Setter Property="OverridesDefaultStyle" Value="true"/>
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type StatusBar}">
+ <Border Background="#FAFAFA" Padding="1">
+ <ItemsPresenter Margin="0" />
+ </Border>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+
+</ResourceDictionary>
\ No newline at end of file |