summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2016-02-20 17:28:42 +0000
committersr55 <[email protected]>2016-02-20 17:28:42 +0000
commiteff231c2375c4056925c538332db44445de027e1 (patch)
treea554603ff5480b34e7cc1982b179a77de50eb473
parent2ffd38224aaed783471d7a6203782d27273e876b (diff)
WinGui: Adding a "Queue" Menu
-rw-r--r--win/CS/HandBrakeWPF/Commands/Menu/QueueCommandParams.cs23
-rw-r--r--win/CS/HandBrakeWPF/Commands/Menu/QueueCommands.cs81
-rw-r--r--win/CS/HandBrakeWPF/HandBrakeWPF.csproj2
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs25
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs11
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml13
6 files changed, 155 insertions, 0 deletions
diff --git a/win/CS/HandBrakeWPF/Commands/Menu/QueueCommandParams.cs b/win/CS/HandBrakeWPF/Commands/Menu/QueueCommandParams.cs
new file mode 100644
index 000000000..e68b17d09
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Commands/Menu/QueueCommandParams.cs
@@ -0,0 +1,23 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="QueueCommandParams.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 QueueCommandParams type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Commands.Menu
+{
+ /// <summary>
+ /// The queue command params.
+ /// </summary>
+ public enum QueueCommandParams
+ {
+ ClearCompleted,
+ ClearAll,
+ ClearSelected,
+ Import,
+ Export
+ }
+}
diff --git a/win/CS/HandBrakeWPF/Commands/Menu/QueueCommands.cs b/win/CS/HandBrakeWPF/Commands/Menu/QueueCommands.cs
new file mode 100644
index 000000000..2f0bb009d
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Commands/Menu/QueueCommands.cs
@@ -0,0 +1,81 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="QueueCommands.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 commands.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Commands.Menu
+{
+ using System;
+ using System.Windows.Input;
+
+ using HandBrakeWPF.ViewModels.Interfaces;
+
+ /// <summary>
+ /// The queue commands.
+ /// </summary>
+ public class QueueCommands : ICommand
+ {
+ /// <summary>
+ /// Gets or sets the queue view model.
+ /// </summary>
+ public IQueueViewModel QueueViewModel { get; set; }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="QueueCommands"/> class.
+ /// </summary>
+ /// <param name="queueViewModel">
+ /// The queue View Model.
+ /// </param>
+ public QueueCommands(IQueueViewModel queueViewModel)
+ {
+ this.QueueViewModel = queueViewModel;
+ }
+
+ /// <summary>
+ /// Defines the method that determines whether the command can execute in its current state.
+ /// </summary>
+ /// <returns>
+ /// true if this command can be executed; otherwise, false.
+ /// </returns>
+ /// <param name="parameter">Data used by the command. If the command does not require data to be passed, this object can be set to null.</param>
+ public bool CanExecute(object parameter)
+ {
+ return true;
+ }
+
+ /// <summary>
+ /// Defines the method to be called when the command is invoked.
+ /// </summary>
+ /// <param name="parameter">Data used by the command. If the command does not require data to be passed, this object can be set to null.</param>
+ public void Execute(object parameter)
+ {
+ switch ((QueueCommandParams)parameter)
+ {
+ case QueueCommandParams.ClearAll:
+ this.QueueViewModel.Clear();
+ break;
+ case QueueCommandParams.ClearCompleted:
+ this.QueueViewModel.ClearCompleted();
+ break;
+ case QueueCommandParams.ClearSelected:
+ this.QueueViewModel.RemoveSelectedJobs();
+ break;
+ case QueueCommandParams.Import:
+ this.QueueViewModel.Import();
+ break;
+ case QueueCommandParams.Export:
+ this.QueueViewModel.Export();
+ break;
+ }
+ }
+
+ /// <summary>
+ /// The can execute changed.
+ /// </summary>
+ public event EventHandler CanExecuteChanged;
+ }
+}
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
index 21b92b13e..4b4dd7b81 100644
--- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
+++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
@@ -128,6 +128,8 @@
<Compile Include="Collections\SerializableDictionary.cs" />
<Compile Include="Commands\InputBindingTrigger.cs" />
<Compile Include="Commands\Interfaces\IAdvancedEncoderOptionsCommand.cs" />
+ <Compile Include="Commands\Menu\QueueCommandParams.cs" />
+ <Compile Include="Commands\Menu\QueueCommands.cs" />
<Compile Include="Commands\OpenOptionsScreenCommand.cs" />
<Compile Include="Commands\CloseOverlayPanelCommand.cs" />
<Compile Include="Commands\OpenOverlayPanelCommand.cs" />
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs
index 770869122..44d5d0f98 100644
--- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs
@@ -21,5 +21,30 @@ namespace HandBrakeWPF.ViewModels.Interfaces
/// The action.
/// </param>
void WhenDone(string action);
+
+ /// <summary>
+ /// The import.
+ /// </summary>
+ void Import();
+
+ /// <summary>
+ /// The export.
+ /// </summary>
+ void Export();
+
+ /// <summary>
+ /// The clear completed.
+ /// </summary>
+ void ClearCompleted();
+
+ /// <summary>
+ /// The clear.
+ /// </summary>
+ void Clear();
+
+ /// <summary>
+ /// The remove selected jobs.
+ /// </summary>
+ void RemoveSelectedJobs();
}
} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index 5eb792abb..0065bef6a 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -18,6 +18,7 @@ namespace HandBrakeWPF.ViewModels
using System.Linq;
using System.Threading;
using System.Windows;
+ using System.Windows.Input;
using Caliburn.Micro;
@@ -25,6 +26,7 @@ namespace HandBrakeWPF.ViewModels
using HandBrake.ApplicationServices.Utilities;
using HandBrakeWPF.Commands;
+ using HandBrakeWPF.Commands.Menu;
using HandBrakeWPF.EventArgs;
using HandBrakeWPF.Factories;
using HandBrakeWPF.Helpers;
@@ -221,6 +223,9 @@ namespace HandBrakeWPF.ViewModels
break;
}
+ // Setup Commands
+ this.QueueCommand = new QueueCommands(this.QueueViewModel);
+
HandBrakeInstanceManager.Init();
}
@@ -1176,6 +1181,12 @@ namespace HandBrakeWPF.ViewModels
#endregion
+ #region Commands
+
+ public ICommand QueueCommand { get; set; }
+
+ #endregion
+
#region Load and Shutdown Handling
/// <summary>
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml
index ae24fb286..3b86fdcb3 100644
--- a/win/CS/HandBrakeWPF/Views/MainView.xaml
+++ b/win/CS/HandBrakeWPF/Views/MainView.xaml
@@ -8,6 +8,7 @@
xmlns:Properties="clr-namespace:HandBrakeWPF.Properties"
xmlns:cal="http://www.caliburnproject.org"
xmlns:attachedProperties="clr-namespace:HandBrakeWPF.AttachedProperties"
+ xmlns:menu="clr-namespace:HandBrakeWPF.Commands.Menu"
AllowDrop="True"
FontSize="11"
cal:Message.Attach="[Event Loaded] = [Action Load]"
@@ -125,6 +126,18 @@
</MenuItem>
</MenuItem>
+ <MenuItem Header="_Queue" x:Name="queueMenu" Visibility="{Binding HasSource, Converter={StaticResource booleanConverter}, ConverterParameter=false}">
+ <MenuItem Header="Add to Queue" cal:Message.Attach="[Event Click] = [Action AddAllToQueue]" InputGestureText="Ctrl + A" />
+ <MenuItem Header="All Selection to Queue" cal:Message.Attach="[Event Click] = [Action AddSelectionToQueue]" />
+ <Separator Visibility="{Binding IsQueueShowingInLine, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
+ <MenuItem Command="{Binding QueueCommand}" CommandParameter="{x:Static menu:QueueCommandParams.ClearCompleted}" Header="{x:Static Properties:ResourcesUI.QueueView_ClearCompleted}" Visibility="{Binding IsQueueShowingInLine, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
+ <MenuItem Command="{Binding QueueCommand}" CommandParameter="{x:Static menu:QueueCommandParams.ClearAll}" Header="{x:Static Properties:ResourcesUI.QueueView_ClearAll}" Visibility="{Binding IsQueueShowingInLine, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
+ <MenuItem Command="{Binding QueueCommand}" CommandParameter="{x:Static menu:QueueCommandParams.ClearSelected}" Header="{x:Static Properties:ResourcesUI.QueueView_ClearSelected}" Visibility="{Binding IsQueueShowingInLine, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
+ <Separator Visibility="{Binding IsQueueShowingInLine, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
+ <MenuItem Command="{Binding QueueCommand}" CommandParameter="{x:Static menu:QueueCommandParams.Import}" Header="{x:Static Properties:ResourcesUI.QueueView_Import}" Visibility="{Binding IsQueueShowingInLine, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
+ <MenuItem Command="{Binding QueueCommand}" CommandParameter="{x:Static menu:QueueCommandParams.Export}" Header="{x:Static Properties:ResourcesUI.QueueView_Export}" Visibility="{Binding IsQueueShowingInLine, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
+ </MenuItem>
+
<MenuItem Header="_Help">
<MenuItem Header="_HandBrake User Guide (HTTP)" cal:Message.Attach="[Event Click] = [Action LaunchHelp]" InputGestureText="F1">
<MenuItem.Icon>