diff options
author | sr55 <[email protected]> | 2011-12-27 18:41:31 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2011-12-27 18:41:31 +0000 |
commit | 20fd52b888f111ac2d7670fa3c41e495661cdebd (patch) | |
tree | 9f8f53b17435ed3a8a14df338ec26410a3ecba75 /win/CS/HandBrakeWPF | |
parent | 015a2a45691dee523047f3b2a1a3628a2dd106f9 (diff) |
WinGui: (WPF) Initial work to implement the "Queue" and "Add Preset" Windows. Additional setup work around the main window.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4389 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF')
26 files changed, 761 insertions, 65 deletions
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index fa78a1515..b6ab522d8 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -35,6 +35,9 @@ <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+ <PropertyGroup>
+ <ApplicationIcon>handbrakepineapple.ico</ApplicationIcon>
+ </PropertyGroup>
<ItemGroup>
<Reference Include="Caliburn.Micro">
<HintPath>..\libraries\caliburn\Caliburn.Micro.dll</HintPath>
@@ -80,12 +83,17 @@ </ApplicationDefinition>
<Compile Include="Converters\BooleanToVisibilityConverter.cs" />
<Compile Include="Helpers\ListBoxHelper.cs" />
+ <Compile Include="Services\ErrorService.cs" />
+ <Compile Include="Services\Interfaces\IErrorService.cs" />
<Compile Include="Startup\CastleBootstrapper.cs" />
<Compile Include="Startup\MefBootstrapper.cs" />
<Compile Include="UserSettingConstants.cs" />
<Compile Include="ViewModels\AboutViewModel.cs" />
<Compile Include="ViewModels\AddPresetViewModel.cs" />
<Compile Include="ViewModels\ErrorViewModel.cs" />
+ <Compile Include="ViewModels\Interfaces\IAddPresetViewModel.cs" />
+ <Compile Include="ViewModels\Interfaces\IQueueViewModel.cs" />
+ <Compile Include="ViewModels\Interfaces\IPreviewViewModel.cs" />
<Compile Include="ViewModels\Interfaces\IErrorViewModel.cs" />
<Compile Include="ViewModels\Interfaces\ILogViewModel.cs" />
<Compile Include="ViewModels\Interfaces\IAboutViewModel.cs" />
@@ -225,6 +233,7 @@ <Content Include="defaultsettings.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+ <Resource Include="handbrakepineapple.ico" />
<Resource Include="Views\Images\delete.png" />
<Resource Include="Views\Images\Close.png" />
<Resource Include="Views\Images\Help24.png" />
@@ -280,7 +289,6 @@ </ItemGroup>
<ItemGroup>
<Folder Include="Factories\" />
- <Folder Include="Services\Interfaces\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(ProgramFiles)\MSBuild\StyleCop\v4.*\StyleCop.targets" />
diff --git a/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs b/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs index 0e7cf6f8c..72f9c8830 100644 --- a/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs +++ b/win/CS/HandBrakeWPF/Properties/AssemblyInfo.cs @@ -8,11 +8,11 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("HandBrake")]
-[assembly: AssemblyDescription("A WPF MVVM based GUI for HandBrake.")]
+[assembly: AssemblyDescription("HandBrake is an open-source, GPL-licensed, multiplatform, multithreaded video transcoder.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HandBrake Team")]
[assembly: AssemblyProduct("HandBrake")]
-[assembly: AssemblyCopyright("Copyright © HandBrake Team 2011")]
+[assembly: AssemblyCopyright("Copyright © HandBrake Team 2011-2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
diff --git a/win/CS/HandBrakeWPF/Services/ErrorService.cs b/win/CS/HandBrakeWPF/Services/ErrorService.cs new file mode 100644 index 000000000..c5d89d5cf --- /dev/null +++ b/win/CS/HandBrakeWPF/Services/ErrorService.cs @@ -0,0 +1,56 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="ErrorService.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>
+// The Error Service
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Services
+{
+ using System.Windows;
+ using Interfaces;
+ using Caliburn.Micro;
+ using ViewModels.Interfaces;
+
+ /// <summary>
+ /// The Error Service
+ /// </summary>
+ public class ErrorService : IErrorService
+ {
+ /// <summary>
+ /// Show an Exception Error Window.
+ /// </summary>
+ /// <param name="message"></param>
+ /// <param name="solution"></param>
+ /// <param name="details"></param>
+ public void ShowError(string message, string solution, string details)
+ {
+ IWindowManager windowManager = IoC.Get<IWindowManager>();
+ IErrorViewModel errorViewModel = IoC.Get<IErrorViewModel>();
+
+ if (windowManager != null && errorViewModel != null)
+ {
+ errorViewModel.ErrorMessage = message;
+ errorViewModel.Solution = solution;
+ errorViewModel.Details = details;
+ windowManager.ShowDialog(errorViewModel);
+ }
+ }
+
+ /// <summary>
+ /// Show a Message Box.
+ /// It is good practice to use this, so that if we ever introduce unit testing, the message boxes won't cause issues.
+ /// </summary>
+ /// <param name="message"></param>
+ /// <param name="header"></param>
+ /// <param name="image"></param>
+ /// <param name="buttons"></param>
+ /// <returns></returns>
+ public MessageBoxResult ShowMessageBox(string message, string header, MessageBoxButton buttons, MessageBoxImage image)
+ {
+ return MessageBox.Show(message, header, buttons, image);
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/Services/Interfaces/IErrorService.cs b/win/CS/HandBrakeWPF/Services/Interfaces/IErrorService.cs new file mode 100644 index 000000000..cba3a79b3 --- /dev/null +++ b/win/CS/HandBrakeWPF/Services/Interfaces/IErrorService.cs @@ -0,0 +1,34 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IErrorService.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>
+// The Error Service Interface
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+using System.Windows;
+
+namespace HandBrakeWPF.Services.Interfaces
+{
+ public interface IErrorService
+ {
+ /// <summary>
+ /// Show an Error Window with debug output.
+ /// </summary>
+ /// <param name="message"></param>
+ /// <param name="solution"></param>
+ /// <param name="details"></param>
+ void ShowError(string message, string solution, string details);
+
+ /// <summary>
+ /// Show a Message Box
+ /// </summary>
+ /// <param name="message"></param>
+ /// <param name="header"></param>
+ /// <param name="image"></param>
+ /// <param name="buttons"></param>
+ /// <returns></returns>
+ MessageBoxResult ShowMessageBox(string message, string header, MessageBoxButton buttons, MessageBoxImage image);
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs index 695e0c7c1..13e5a896e 100644 --- a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs +++ b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs @@ -7,6 +7,9 @@ // </summary>
// --------------------------------------------------------------------------------------------------------------------
+using HandBrakeWPF.Services;
+using HandBrakeWPF.Services.Interfaces;
+
namespace HandBrakeWPF.Startup
{
using System;
@@ -22,8 +25,8 @@ namespace HandBrakeWPF.Startup using HandBrake.ApplicationServices;
- using HandBrakeWPF.ViewModels;
- using HandBrakeWPF.ViewModels.Interfaces;
+ using ViewModels;
+ using ViewModels.Interfaces;
/// <summary>
/// The Castle Bootstrapper
@@ -49,7 +52,15 @@ namespace HandBrakeWPF.Startup this.windsorContainer.Install(windsorContainer.ResolveAll<IWindsorInstaller>());
// Shell
+ this.windsorContainer.Register(Component.For<IErrorService>().ImplementedBy<ErrorService>().LifeStyle.Is(LifestyleType.Singleton));
+ this.windsorContainer.Register(Component.For<IErrorViewModel>().ImplementedBy<ErrorViewModel>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<IMainViewModel>().ImplementedBy<MainViewModel>().LifeStyle.Is(LifestyleType.Singleton));
+ this.windsorContainer.Register(Component.For<IQueueViewModel>().ImplementedBy<QueueViewModel>().LifeStyle.Is(LifestyleType.Singleton));
+ this.windsorContainer.Register(Component.For<IAddPresetViewModel>().ImplementedBy<AddPresetViewModel>().LifeStyle.Is(LifestyleType.Singleton));
+ this.windsorContainer.Register(Component.For<IPreviewViewModel>().ImplementedBy<PreviewViewModel>().LifeStyle.Is(LifestyleType.Singleton));
+ this.windsorContainer.Register(Component.For<ILogViewModel>().ImplementedBy<LogViewModel>().LifeStyle.Is(LifestyleType.Singleton));
+ this.windsorContainer.Register(Component.For<IAboutViewModel>().ImplementedBy<AboutViewModel>().LifeStyle.Is(LifestyleType.Singleton));
+ this.windsorContainer.Register(Component.For<IOptionsViewModel>().ImplementedBy<OptionsViewModel>().LifeStyle.Is(LifestyleType.Singleton));
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs index d6e5d5598..c300487e3 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs @@ -42,6 +42,7 @@ namespace HandBrakeWPF.ViewModels : base(windowManager)
{
this.userSettingService = userSettingService;
+ this.Title = "About HandBrake";
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs index 8f6919e9d..d4a6f077c 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs @@ -7,23 +7,106 @@ // </summary>
// --------------------------------------------------------------------------------------------------------------------
+using System.Windows;
+using HandBrake.ApplicationServices.Model;
+using HandBrake.ApplicationServices.Services.Interfaces;
+using HandBrake.ApplicationServices.Utilities;
+using HandBrakeWPF.Services.Interfaces;
+
namespace HandBrakeWPF.ViewModels
{
+ using System.ComponentModel.Composition;
+ using Interfaces;
using Caliburn.Micro;
/// <summary>
/// The Add Preset View Model
/// </summary>
- public class AddPresetViewModel : ViewModelBase
+ [Export(typeof(IAddPresetViewModel))]
+ public class AddPresetViewModel : ViewModelBase, IAddPresetViewModel
{
/// <summary>
+ /// Backing field for the Preset Service
+ /// </summary>
+ private readonly IPresetService presetService;
+
+ /// <summary>
+ /// Backing field for the error service
+ /// </summary>
+ private readonly IErrorService errorService;
+
+ /// <summary>
/// Initializes a new instance of the <see cref="AddPresetViewModel"/> class.
/// </summary>
/// <param name="windowManager">
/// The window manager.
/// </param>
- public AddPresetViewModel(IWindowManager windowManager) : base(windowManager)
+ /// <param name="presetService">
+ /// The Preset Service
+ /// </param>
+ /// <param name="errorService">
+ /// The Error Service
+ /// </param>
+ public AddPresetViewModel(IWindowManager windowManager, IPresetService presetService, IErrorService errorService) : base(windowManager)
+ {
+ this.presetService = presetService;
+ this.errorService = errorService;
+ this.Title = "Add Preset";
+ this.Preset = new Preset {IsBuildIn = false, IsDefault = false, Category = "User Presets"};
+ }
+
+ /// <summary>
+ /// Gets or sets the Preset
+ /// </summary>
+ public Preset Preset { get; private set; }
+
+ /// <summary>
+ /// Prepare the Preset window to create a Preset Object later.
+ /// </summary>
+ /// <param name="task">
+ /// The Encode Task.
+ /// </param>
+ public void Setup(EncodeTask task)
+ {
+ task.UsesPictureFilters = this.Preset.UsePictureFilters;
+ task.UsesMaxPictureSettings = false; // TODO
+ task.UsesPictureSettings = false; // TODO
+ this.Preset.Task = task;
+ this.Preset.Query = QueryGeneratorUtility.GenerateQuery(task);
+ }
+
+ /// <summary>
+ /// Add a Preset
+ /// </summary>
+ public void Add()
+ {
+ if (string.IsNullOrEmpty(this.Preset.Name))
+ {
+ this.errorService.ShowMessageBox("A Preset must have a Name. Please fill out the Preset Name field.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ return;
+ }
+
+ if (this.presetService.CheckIfPresetExists(this.Preset.Name))
+ {
+ this.errorService.ShowMessageBox("A Preset with this name already exists. Please choose a new name", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ return;
+ }
+
+ bool added = this.presetService.Add(this.Preset);
+ if (!added)
+ {
+ this.errorService.ShowMessageBox("Unable to add preset", "Unknown Error", MessageBoxButton.OK,
+ MessageBoxImage.Error);
+ }
+ else
+ {
+ this.Close();
+ }
+ }
+
+ public void Cancel()
{
+ this.Close();
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAddPresetViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAddPresetViewModel.cs new file mode 100644 index 000000000..1d5342e01 --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAddPresetViewModel.cs @@ -0,0 +1,27 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IAddPresetViewModel.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>
+// The Add Preset View Model Interface
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels.Interfaces
+{
+ using HandBrake.ApplicationServices.Model;
+
+ /// <summary>
+ /// The Add Preset View Model
+ /// </summary>
+ public interface IAddPresetViewModel
+ {
+ /// <summary>
+ /// Prepare the Preset window to create a Preset Object later.
+ /// </summary>
+ /// <param name="task">
+ /// The Encode Task.
+ /// </param>
+ void Setup(EncodeTask task);
+ }
+}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IErrorViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IErrorViewModel.cs index 51a2b7a98..a0fa8e36d 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IErrorViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IErrorViewModel.cs @@ -14,5 +14,19 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// </summary>
public interface IErrorViewModel
{
+ /// <summary>
+ /// The Error Details
+ /// </summary>
+ string Details { set; }
+
+ /// <summary>
+ /// The Error Message
+ /// </summary>
+ string ErrorMessage { set; }
+
+ /// <summary>
+ /// The Error Solution
+ /// </summary>
+ string Solution { set; }
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IPreviewViewModel.cs new file mode 100644 index 000000000..f0a7bb660 --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IPreviewViewModel.cs @@ -0,0 +1,18 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IPreviewViewModel.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>
+// The Preview View Model Interface
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels.Interfaces
+{
+ /// <summary>
+ /// The Preview View Model Interface
+ /// </summary>
+ public interface IPreviewViewModel
+ {
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs new file mode 100644 index 000000000..3530e84c1 --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs @@ -0,0 +1,18 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IQueueViewModel.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>
+// The Queue View Model Interface
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels.Interfaces
+{
+ /// <summary>
+ /// The Queue View Model Interface
+ /// </summary>
+ public interface IQueueViewModel
+ {
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs index aebdd7e73..83a185276 100644 --- a/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs @@ -27,6 +27,7 @@ namespace HandBrakeWPF.ViewModels public LogViewModel(IWindowManager windowManager)
: base(windowManager)
{
+ this.Title = "Log Viewer";
}
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index c1b008613..5a8ecd233 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -7,6 +7,8 @@ // </summary>
// --------------------------------------------------------------------------------------------------------------------
+using HandBrakeWPF.Services.Interfaces;
+
namespace HandBrakeWPF.ViewModels
{
using System;
@@ -67,6 +69,11 @@ namespace HandBrakeWPF.ViewModels private readonly IPresetService presetService;
/// <summary>
+ /// The Error Service Backing field.
+ /// </summary>
+ private readonly IErrorService errorService;
+
+ /// <summary>
/// HandBrakes Main Window Title
/// </summary>
private string windowName;
@@ -127,14 +134,19 @@ namespace HandBrakeWPF.ViewModels /// <param name="presetService">
/// The preset Service.
/// </param>
+ /// <param name="errorService">
+ /// The Error Service
+ /// </param>
[ImportingConstructor]
- public MainViewModel(IWindowManager windowManager, IUserSettingService userSettingService, IScan scanService, IEncode encodeService, IPresetService presetService)
+ public MainViewModel(IWindowManager windowManager, IUserSettingService userSettingService, IScan scanService, IEncode encodeService, IPresetService presetService,
+ IErrorService errorService)
: base(windowManager)
{
this.userSettingService = userSettingService;
this.scanService = scanService;
this.encodeService = encodeService;
this.presetService = presetService;
+ this.errorService = errorService;
this.queueProcessor = IoC.Get<IQueueProcessor>(); // TODO Instance ID!
// Setup Properties
@@ -174,6 +186,27 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// Gets or sets the Program Status Toolbar Label
+ /// This indicates the status of HandBrake
+ /// </summary>
+ public string ProgramStatusLabel
+ {
+ get
+ {
+ return string.IsNullOrEmpty(this.programStatusLabel) ? "Ready" : this.sourceLabel;
+ }
+
+ set
+ {
+ if (!object.Equals(this.programStatusLabel, value))
+ {
+ this.programStatusLabel = value;
+ this.NotifyOfPropertyChange("ProgramStatusLabel");
+ }
+ }
+ }
+
+ /// <summary>
/// Gets a list of presets
/// </summary>
public ObservableCollection<Preset> Presets
@@ -245,27 +278,6 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
- /// Gets or sets the Program Status Toolbar Label
- /// This indicates the status of HandBrake
- /// </summary>
- public string ProgramStatusLabel
- {
- get
- {
- return string.IsNullOrEmpty(this.programStatusLabel) ? "Ready" : this.sourceLabel;
- }
-
- set
- {
- if (!object.Equals(this.programStatusLabel, value))
- {
- this.programStatusLabel = value;
- this.NotifyOfPropertyChange("ProgramStatusLabel");
- }
- }
- }
-
- /// <summary>
/// Gets RangeMode.
/// </summary>
public IEnumerable<PointToPointMode> RangeMode
@@ -486,7 +498,7 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void OpenAboutApplication()
{
- this.WindowManager.ShowWindow(new AboutViewModel(this.WindowManager, this.userSettingService));
+ this.WindowManager.ShowWindow(IoC.Get<IAboutViewModel>());
}
/// <summary>
@@ -494,7 +506,7 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void OpenOptionsWindow()
{
- this.WindowManager.ShowWindow(new OptionsViewModel(this.WindowManager, this.userSettingService));
+ this.WindowManager.ShowWindow(IoC.Get<IOptionsViewModel>());
}
/// <summary>
@@ -502,7 +514,7 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void OpenLogWindow()
{
- this.WindowManager.ShowWindow(new LogViewModel(this.WindowManager));
+ this.WindowManager.ShowWindow(IoC.Get<ILogViewModel>());
}
/// <summary>
@@ -510,10 +522,18 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void OpenQueueWindow()
{
- this.WindowManager.ShowWindow(new QueueViewModel(this.WindowManager));
+ this.WindowManager.ShowWindow(IoC.Get<IQueueViewModel>());
}
/// <summary>
+ /// Open the Queue Window.
+ /// </summary>
+ public void OpenPreviewWindow()
+ {
+ this.WindowManager.ShowWindow(IoC.Get<IPreviewViewModel>());
+ }
+
+ /// <summary>
/// Launch the Help pages.
/// </summary>
public void LaunchHelp()
@@ -530,6 +550,30 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// Add the current task to the queue.
+ /// </summary>
+ public void AddToQueue()
+ {
+ if (this.ScannedSource == null || string.IsNullOrEmpty(this.ScannedSource.ScanPath) || this.ScannedSource.Titles.Count == 0)
+ {
+ this.errorService.ShowMessageBox("You must first scan a source and setup your job before adding to the queue.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ return;
+ }
+
+ QueueTask task = new QueueTask
+ {
+ Task = this.CurrentTask,
+ Query = QueryGeneratorUtility.GenerateQuery(this.CurrentTask)
+ };
+ this.queueProcessor.QueueManager.Add(task);
+
+ if (!this.IsEncoding)
+ {
+ this.ProgramStatusLabel = string.Format("{0} Encodes Pending", this.queueProcessor.QueueManager.Count);
+ }
+ }
+
+ /// <summary>
/// Folder Scan
/// </summary>
public void FolderScan()
@@ -565,22 +609,29 @@ namespace HandBrakeWPF.ViewModels // Santiy Checking.
if (this.ScannedSource == null || this.CurrentTask == null)
{
- throw new GeneralApplicationException("You must first scan a source.", string.Empty, null);
+ this.errorService.ShowMessageBox("You must first scan a source.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ return;
}
if (string.IsNullOrEmpty(this.CurrentTask.Destination))
{
- throw new GeneralApplicationException("The Destination field was empty.", "You must first set a destination for the encoded file.", null);
+ this.errorService.ShowMessageBox("The Destination field was empty.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ return;
}
if (this.queueProcessor.IsProcessing)
{
- throw new GeneralApplicationException("HandBrake is already encoding.", string.Empty, null);
+ this.errorService.ShowMessageBox("HandBrake is already encoding.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ return;
}
if (File.Exists(this.CurrentTask.Destination))
{
- // TODO: File Overwrite warning.
+ MessageBoxResult result = this.errorService.ShowMessageBox("The current file already exists, do you wish to overwrite it?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Question);
+ if (result == MessageBoxResult.No)
+ {
+ return;
+ }
}
// Create the Queue Task and Start Processing
@@ -647,7 +698,9 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void PresetAdd()
{
- throw new NotImplementedException("Still to do this");
+ IAddPresetViewModel presetViewModel = IoC.Get<IAddPresetViewModel>();
+ presetViewModel.Setup(this.CurrentTask);
+ this.WindowManager.ShowWindow(presetViewModel);
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index dd683b7c8..4d11f6786 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -320,6 +320,7 @@ namespace HandBrakeWPF.ViewModels public OptionsViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
: base(windowManager)
{
+ this.Title = "Options";
this.userSettingService = userSettingService;
this.Load();
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs index 16177a55e..e7fd8f098 100644 --- a/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs @@ -9,12 +9,13 @@ namespace HandBrakeWPF.ViewModels
{
+ using Interfaces;
using Caliburn.Micro;
/// <summary>
/// The About View Model
/// </summary>
- public class PreviewViewModel : ViewModelBase
+ public class PreviewViewModel : ViewModelBase, IPreviewViewModel
{
/// <summary>
/// Initializes a new instance of the <see cref="PreviewViewModel"/> class.
@@ -24,6 +25,7 @@ namespace HandBrakeWPF.ViewModels /// </param>
public PreviewViewModel(IWindowManager windowManager) : base(windowManager)
{
+ this.Title = "Preview";
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs index d294e311b..e651d9830 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs @@ -9,21 +9,188 @@ namespace HandBrakeWPF.ViewModels
{
+ using System.Windows;
+ using HandBrake.ApplicationServices.Model;
+ using Services.Interfaces;
+ using System.Collections.ObjectModel;
+ using HandBrake.ApplicationServices.Services.Interfaces;
+ using System.ComponentModel.Composition;
+ using Interfaces;
using Caliburn.Micro;
/// <summary>
/// The Preview View Model
/// </summary>
- public class QueueViewModel : ViewModelBase
+ [Export(typeof(IQueueViewModel))]
+ public class QueueViewModel : ViewModelBase, IQueueViewModel
{
+ #region Private Fields
+ /// <summary>
+ /// Queue Processor Backing field
+ /// </summary>
+ private readonly IQueueProcessor queueProcessor;
+
+ /// <summary>
+ /// The Error Service Backing field
+ /// </summary>
+ private readonly IErrorService errorService;
+
+ /// <summary>
+ /// Jobs pending backing field
+ /// </summary>
+ private string jobsPending;
+
+ /// <summary>
+ /// Job Status Backing field.
+ /// </summary>
+ private string jobStatus;
+
+ /// <summary>
+ /// IsEncoding Backing field
+ /// </summary>
+ private bool isEncoding;
+
+ #endregion
+
/// <summary>
/// Initializes a new instance of the <see cref="QueueViewModel"/> class.
/// </summary>
/// <param name="windowManager">
/// The window manager.
/// </param>
- public QueueViewModel(IWindowManager windowManager) : base(windowManager)
+ /// <param name="queueProcessor">
+ /// The Queue Processor Service
+ /// </param>
+ /// <param name="errorService">
+ /// The Error Service
+ /// </param>
+ public QueueViewModel(IWindowManager windowManager, IQueueProcessor queueProcessor, IErrorService errorService)
+ : base(windowManager)
+ {
+ this.queueProcessor = queueProcessor;
+ this.errorService = errorService;
+ this.Title = "Queue";
+ this.JobsPending = "No encodes pending";
+ this.JobStatus = "There are no jobs currently encoding";
+ }
+
+ public ObservableCollection<QueueTask> QueueJobs
{
+ get { return this.queueProcessor.QueueManager.Queue; }
+ }
+
+ /// <summary>
+ /// Gets or sets IsEncoding.
+ /// </summary>
+ public bool IsEncoding
+ {
+ get
+ {
+ return this.isEncoding;
+ }
+
+ set
+ {
+ this.isEncoding = value;
+ this.NotifyOfPropertyChange("IsEncoding");
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets JobStatus.
+ /// </summary>
+ public string JobStatus
+ {
+ get
+ {
+ return this.jobStatus;
+ }
+
+ set
+ {
+ this.jobStatus = value;
+ this.NotifyOfPropertyChange("JobStatus");
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets JobsPending.
+ /// </summary>
+ public string JobsPending
+ {
+ get
+ {
+ return this.jobsPending;
+ }
+
+ set
+ {
+ this.jobsPending = value;
+ this.NotifyOfPropertyChange("JobsPending");
+ }
+ }
+
+ /// <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;
+ }
+
+ this.queueProcessor.Start();
+ }
+
+ /// <summary>
+ /// Pause Encode
+ /// </summary>
+ public void PauseEncode()
+ {
+ this.queueProcessor.Pause();
+ }
+
+ /// <summary>
+ /// Remove a Job from the queue
+ /// </summary>
+ /// <param name="task">
+ /// The Job to remove from the queue
+ /// </param>
+ public void RemoveJob(QueueTask task)
+ {
+ 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);
+
+ if (result == MessageBoxResult.Yes)
+ {
+ this.queueProcessor.QueueManager.Remove(task);
+ }
+ }
+ else
+ {
+ this.queueProcessor.QueueManager.Remove(task);
+ }
+
+ this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);
+ }
+
+ public override void OnLoad()
+ {
+ this.queueProcessor.JobProcessingStarted += queueProcessor_JobProcessingStarted;
+ this.queueProcessor.QueueCompleted += queueProcessor_QueueCompleted;
+ this.queueProcessor.QueuePaused += queueProcessor_QueuePaused;
+ this.queueProcessor.QueueManager.QueueChanged += QueueManager_QueueChanged;
+
+ // Setup the window to the correct state.
+ this.IsEncoding = queueProcessor.EncodeService.IsEncoding;
+ this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);
+
+ base.OnLoad();
}
/// <summary>
@@ -33,5 +200,51 @@ namespace HandBrakeWPF.ViewModels {
this.TryClose();
}
+
+ /// <summary>
+ /// Override the OnActive to run the Screen Loading code in the view model base.
+ /// </summary>
+ protected override void OnActivate()
+ {
+ this.Load();
+ base.OnActivate();
+ }
+
+ private void queueProcessor_QueuePaused(object sender, System.EventArgs e)
+ {
+ this.JobStatus = "Queue Paused";
+ this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);
+ }
+
+ private void queueProcessor_QueueCompleted(object sender, System.EventArgs e)
+ {
+ this.JobStatus = "Queue Completed";
+ this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);
+ }
+
+ private void queueProcessor_JobProcessingStarted(object sender, HandBrake.ApplicationServices.EventArgs.QueueProgressEventArgs e)
+ {
+ this.JobStatus = "Queue Started";
+ this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);
+ this.queueProcessor.EncodeService.EncodeStatusChanged += EncodeService_EncodeStatusChanged;
+ }
+
+ private void EncodeService_EncodeStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs 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);
+ }
+
+ private void QueueManager_QueueChanged(object sender, System.EventArgs e)
+ {
+ // TODO
+ }
}
}
diff --git a/win/CS/HandBrakeWPF/Views/AboutView.xaml b/win/CS/HandBrakeWPF/Views/AboutView.xaml index 1a86c7a76..b764d13bc 100644 --- a/win/CS/HandBrakeWPF/Views/AboutView.xaml +++ b/win/CS/HandBrakeWPF/Views/AboutView.xaml @@ -1,6 +1,6 @@ <Window x:Class="HandBrakeWPF.Views.AboutView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Micro="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro" Title="AboutView"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Micro="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro" Title="{Binding Title}"
Height="320" Width="600">
<Grid>
diff --git a/win/CS/HandBrakeWPF/Views/AddPresetView.xaml b/win/CS/HandBrakeWPF/Views/AddPresetView.xaml index 74d79f0c8..97d3974b7 100644 --- a/win/CS/HandBrakeWPF/Views/AddPresetView.xaml +++ b/win/CS/HandBrakeWPF/Views/AddPresetView.xaml @@ -1,11 +1,79 @@ -<UserControl x:Class="HandBrakeWPF.Views.AddPresetView"
+<Window x:Class="HandBrakeWPF.Views.AddPresetView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- mc:Ignorable="d"
- d:DesignHeight="300" d:DesignWidth="300">
- <Grid Background="Beige">
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:cal="http://www.caliburnproject.org"
+ mc:Ignorable="d"
+ Title="{Binding Title}"
+ Width="350" Height="310">
+
+ <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="#FFF1F0EF">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+
+ <!-- Header -->
+ <StackPanel Orientation="Horizontal" Grid.Row="0" Background="White" Height="30" Margin="0,0,0,10" >
+ <Image Source="Images/Add16.png" Margin="10,0,5,0" Width="16" Height="16" VerticalAlignment="Center" />
+ <StackPanel Orientation="Vertical" VerticalAlignment="Center">
+ <TextBlock Text="Add a Preset" FontWeight="Bold" />
+ </StackPanel>
+ </StackPanel>
+
+ <Grid Margin="10,0,10,0" Grid.Row="1">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="100" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+
+ <!-- Name -->
+ <TextBlock Text="Preset Name:" Grid.Row="0" Grid.Column="0" />
+ <TextBox Width="150" Text="{Binding Preset.Name}" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left"/>
+
+ <!-- Settings -->
+ <TextBlock Text="Picture Settings:" FontWeight="Bold" Grid.Row="1" Grid.Column="0" Margin="0,20,0,0" />
+
+ <TextBlock Text="Use Picture Size:" Grid.Row="2" Grid.Column="0" />
+ <ComboBox Width="100" ItemsSource="{Binding PictureSettingModes}" SelectedItem="{Binding SelectedPictureMode}" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" />
+
+ <StackPanel Orientation="Horizontal" Margin="0,10,0,0" Grid.Row="3" Grid.Column="1">
+ <TextBox Width="50" Text="{Binding CustomWidth}" />
+ <TextBlock Text="X" FontWeight="Bold" Margin="10,0,10,0" />
+ <TextBox Width="50" Text="{Binding CustomHeight}" />
+ </StackPanel>
+
+ <CheckBox Content="Use Picture Filters" IsChecked="{Binding Preset.UsePictureFilters}" Margin="0,10,0,0" Grid.Row="4" Grid.Column="1"/>
+
+ <!-- Description -->
+ <TextBlock Text="Description:" FontWeight="Bold" Grid.Row="5" Grid.Column="0" />
+ <TextBox Text="{Binding Preset.Description}" Grid.Row="6" Grid.ColumnSpan="2" HorizontalAlignment="Stretch"/>
+ </Grid>
+
+ <!-- Controls -->
+ <Grid Background="LightGray" Grid.Row="3" Margin="0,20,0,0">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <Button Content="Cancel" Padding="8,2" Margin="0,5,10,5" Grid.Column="1" cal:Message.Attach="[Event Click] = [Action Cancel]" />
+ <Button Content="Add" Padding="8,2" Margin="0,5,10,5" Grid.Column="2" cal:Message.Attach="[Event Click] = [Action Add]" />
+ </Grid>
+
</Grid>
-</UserControl>
+</Window>
diff --git a/win/CS/HandBrakeWPF/Views/AddPresetView.xaml.cs b/win/CS/HandBrakeWPF/Views/AddPresetView.xaml.cs index 9cb9e39e1..91968fdc0 100644 --- a/win/CS/HandBrakeWPF/Views/AddPresetView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/AddPresetView.xaml.cs @@ -9,12 +9,12 @@ namespace HandBrakeWPF.Views
{
- using System.Windows.Controls;
+ using System.Windows;
/// <summary>
/// Interaction logic for VideoView.xaml
/// </summary>
- public partial class AddPresetView : UserControl
+ public partial class AddPresetView : Window
{
/// <summary>
/// Initializes a new instance of the <see cref="AddPresetView"/> class.
diff --git a/win/CS/HandBrakeWPF/Views/LogView.xaml b/win/CS/HandBrakeWPF/Views/LogView.xaml index 908cee484..1d26ef28c 100644 --- a/win/CS/HandBrakeWPF/Views/LogView.xaml +++ b/win/CS/HandBrakeWPF/Views/LogView.xaml @@ -1,7 +1,7 @@ <Window x:Class="HandBrakeWPF.Views.LogView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- Title="LogView" Height="600" Width="420">
+ Title="{Binding Title}" Height="600" Width="420">
<Grid>
<Grid>
<Grid.RowDefinitions>
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index 483fbde1b..cd4e5ccc4 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -36,7 +36,7 @@ </MenuItem>
<MenuItem Header="Tools">
- <MenuItem Header="Show Queue" Micro:Message.Attach="[Event Click] = [Action ExitApplication]" />
+ <MenuItem Header="Show Queue" Micro:Message.Attach="[Event Click] = [Action OpenQueueWindow]" />
<MenuItem Header="Activity Window" Micro:Message.Attach="[Event Click] = [Action OpenLogWindow]" />
<Separator />
<MenuItem Header="Options" Micro:Message.Attach="[Event Click] = [Action OpenOptionsWindow]" />
@@ -98,14 +98,14 @@ </StackPanel>
</Button>
- <Button Name="AddToQueue">
+ <Button Name="AddToQueue" Micro:Message.Attach="[Event Click] = [Action AddToQueue]">
<StackPanel Orientation="Horizontal">
<Image Source="Images/AddToQueue.png" Height="32" Width="32" />
<Label Content="Add To Queue" Margin="8,0,0,0" VerticalAlignment="Center" />
</StackPanel>
</Button>
- <Button Name="ShowQueue">
+ <Button Name="ShowQueue" Micro:Message.Attach="[Event Click] = [Action OpenQueueWindow]">
<StackPanel Orientation="Horizontal">
<Image Source="Images/Queue.png" Height="32" Width="32" />
<Label Content="Show Queue" Margin="8,0,0,0" VerticalAlignment="Center" />
@@ -114,12 +114,13 @@ <Separator />
- <Button Name="Preview">
+ <Button Name="Preview" Micro:Message.Attach="[Event Click] = [Action OpenPreviewWindow]">
<StackPanel Orientation="Horizontal">
<Image Source="Images/window.png" Height="32" Width="32" />
<Label Content="Preview" Margin="8,0,0,0" VerticalAlignment="Center" />
</StackPanel>
</Button>
+
<Button Name="ActivityWindow" Micro:Message.Attach="[Event Click] = [Action OpenLogWindow]">
<StackPanel Orientation="Horizontal">
<Image Source="Images/ActivityWindow.png" Height="32" Width="32" />
diff --git a/win/CS/HandBrakeWPF/Views/OptionsView.xaml b/win/CS/HandBrakeWPF/Views/OptionsView.xaml index 4976800f8..7b58e5511 100644 --- a/win/CS/HandBrakeWPF/Views/OptionsView.xaml +++ b/win/CS/HandBrakeWPF/Views/OptionsView.xaml @@ -1,7 +1,7 @@ <Window x:Class="HandBrakeWPF.Views.OptionsView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cal="http://www.caliburnproject.org"
- xmlns:Helpers="clr-namespace:HandBrakeWPF.Helpers" Title="OptionsView" MinWidth="620" MinHeight="550" Width="620" Height="550">
+ xmlns:Helpers="clr-namespace:HandBrakeWPF.Helpers" Title="{Binding Title}" MinWidth="620" MinHeight="550" Width="620" Height="550">
<Window.Resources>
<Style TargetType="Button">
diff --git a/win/CS/HandBrakeWPF/Views/PreviewView.xaml b/win/CS/HandBrakeWPF/Views/PreviewView.xaml index e3bd0be52..caf0aaca8 100644 --- a/win/CS/HandBrakeWPF/Views/PreviewView.xaml +++ b/win/CS/HandBrakeWPF/Views/PreviewView.xaml @@ -1,11 +1,12 @@ -<UserControl x:Class="HandBrakeWPF.Views.PreviewView"
+<Window x:Class="HandBrakeWPF.Views.PreviewView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
- d:DesignHeight="300" d:DesignWidth="300">
+ Title="{Binding Title}"
+ Width="300" Height="300">
<Grid Background="Beige">
</Grid>
-</UserControl>
+</Window>
diff --git a/win/CS/HandBrakeWPF/Views/PreviewView.xaml.cs b/win/CS/HandBrakeWPF/Views/PreviewView.xaml.cs index e64f70411..a8203245a 100644 --- a/win/CS/HandBrakeWPF/Views/PreviewView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/PreviewView.xaml.cs @@ -9,12 +9,12 @@ namespace HandBrakeWPF.Views
{
- using System.Windows.Controls;
+ using System.Windows;
/// <summary>
/// Interaction logic for VideoView.xaml
/// </summary>
- public partial class PreviewView : UserControl
+ public partial class PreviewView : Window
{
/// <summary>
/// Initializes a new instance of the <see cref="PreviewView"/> class.
diff --git a/win/CS/HandBrakeWPF/Views/QueueView.xaml b/win/CS/HandBrakeWPF/Views/QueueView.xaml index 8007ae889..c37c88a6a 100644 --- a/win/CS/HandBrakeWPF/Views/QueueView.xaml +++ b/win/CS/HandBrakeWPF/Views/QueueView.xaml @@ -2,10 +2,96 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- mc:Ignorable="d"
- d:DesignHeight="300" d:DesignWidth="300">
- <Grid Background="Beige">
+ 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" mc:Ignorable="d" Title="{Binding Title}"
+ Width="600" Height="400"
+ Background="#FFF0F0F0">
+
+ <Window.Resources>
+ <Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
+ </Window.Resources>
+
+ <Grid >
+
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+ <ToolBar Name="mainToolBar" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SnapsToDevicePixels="False">
+
+ <Button Name="Start" cal:Message.Attach="[Event Click] = [Action StartEncode]" Visibility="{Binding IsEncoding, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}">
+ <StackPanel Orientation="Horizontal">
+ <Image Source="Images/Play.png" Height="32" Width="32" />
+ <Label Content="Start" Margin="8,0,0,0" VerticalAlignment="Center" />
+ </StackPanel>
+ </Button>
+
+ <Button Name="Pause" cal:Message.Attach="[Event Click] = [Action PauseEncode]" Visibility="{Binding IsEncoding, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}">
+ <StackPanel Orientation="Horizontal">
+ <Image Source="Images/Pause.png" Height="32" Width="32" />
+ <Label Content="Pause" Margin="8,0,0,0" VerticalAlignment="Center" />
+ </StackPanel>
+ </Button>
+ </ToolBar>
+
+ <StackPanel Grid.Row="1" Margin="10,20,10,20">
+ <TextBlock Text="{Binding JobsPending}" />
+ <TextBlock Text="{Binding JobStatus}" />
+ </StackPanel>
+
+ <ListBox Grid.Row="2" ItemsSource="{Binding QueueJobs}" SelectionMode="Extended" Background="LightGray" Margin="10,0,10,10">
+ <ListBox.ItemContainerStyle>
+ <Style TargetType="ListBoxItem">
+ <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
+ </Style>
+ </ListBox.ItemContainerStyle>
+ <ListBox.ItemTemplate>
+ <DataTemplate>
+
+ <Grid HorizontalAlignment="Stretch">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <!-- Marker -->
+ <Image Source="Images/Movies.png" Width="16" Height="16" Grid.Column="0" Margin="10,0,10,0" />
+
+ <!-- Settings -->
+ <StackPanel Grid.Column="1" HorizontalAlignment="Stretch">
+ <StackPanel Orientation="Horizontal">
+ <TextBlock Text="Source" FontWeight="Bold" />
+ <TextBlock Text="{Binding Source}"/>
+ </StackPanel>
+
+ <StackPanel Orientation="Horizontal">
+ <TextBlock Text="Destination" FontWeight="Bold" />
+ <TextBlock Text="{Binding Source}"/>
+ </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>
+
+
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
+
+
</Grid>
</Window>
diff --git a/win/CS/HandBrakeWPF/handbrakepineapple.ico b/win/CS/HandBrakeWPF/handbrakepineapple.ico Binary files differnew file mode 100644 index 000000000..57a056269 --- /dev/null +++ b/win/CS/HandBrakeWPF/handbrakepineapple.ico |