diff options
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r-- | win/CS/HandBrakeWPF/Properties/Resources.Designer.cs | 9 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Properties/Resources.resx | 3 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs | 54 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/Queue/QueueTwoContent.xaml | 67 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/Queue/QueueTwoContent.xaml.cs | 13 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/QueueView.xaml | 2 |
6 files changed, 128 insertions, 20 deletions
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs index e03f008f4..c09fd1370 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs @@ -4122,6 +4122,15 @@ namespace HandBrakeWPF.Properties { }
/// <summary>
+ /// Looks up a localized string similar to Play File.
+ /// </summary>
+ public static string QueueView_PlayMediaFile {
+ get {
+ return ResourceManager.GetString("QueueView_PlayMediaFile", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Quit HandBrake.
/// </summary>
public static string QueueView_QuitHandBrake {
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx index efa015780..521194d2c 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.resx @@ -2011,4 +2011,7 @@ This will not affect your current settings in the Subtitle tab.</value> <data name="MainView_ShowAddSelectionToQueue" xml:space="preserve">
<value>'Add Selection' to Queue</value>
</data>
+ <data name="QueueView_PlayMediaFile" xml:space="preserve">
+ <value>Play File</value>
+ </data>
</root>
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs index 2e31a2a04..ee5dfb583 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs @@ -15,6 +15,7 @@ namespace HandBrakeWPF.ViewModels using System.Diagnostics;
using System.IO;
using System.Linq;
+ using System.Runtime.CompilerServices;
using System.Windows;
using Caliburn.Micro;
@@ -74,7 +75,7 @@ namespace HandBrakeWPF.ViewModels this.errorService = errorService;
this.Title = Resources.QueueViewModel_Queue;
this.JobsPending = Resources.QueueViewModel_NoEncodesPending;
- this.JobStatus = Resources.QueueViewModel_NoJobsPending;
+ this.JobStatus = string.Empty;
this.SelectedItems = new BindingList<QueueTask>();
this.DisplayName = "Queue";
this.IsQueueRunning = false;
@@ -118,9 +119,12 @@ namespace HandBrakeWPF.ViewModels {
this.jobStatus = value;
this.NotifyOfPropertyChange(() => this.JobStatus);
+ this.NotifyOfPropertyChange(() => this.IsJobStatusVisible);
}
}
+ public bool IsJobStatusVisible => !string.IsNullOrEmpty(this.JobStatus);
+
/// <summary>
/// Gets or sets JobsPending.
/// </summary>
@@ -188,6 +192,8 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange(() => this.CanRetryJob);
this.NotifyOfPropertyChange(() => this.CanEditJob);
this.NotifyOfPropertyChange(() => this.CanRemoveJob);
+ this.NotifyOfPropertyChange(() => this.CanPerformActionOnSource);
+ this.NotifyOfPropertyChange(() => this.CanPlayFile);
this.NotifyOfPropertyChange(() => this.StatsVisible);
}
}
@@ -200,6 +206,12 @@ namespace HandBrakeWPF.ViewModels public bool CanRemoveJob => this.SelectedTask != null;
+ public bool CanPerformActionOnSource => this.SelectedTask != null;
+
+ public bool CanPlayFile =>
+ this.SelectedTask != null && this.SelectedTask.Task.Destination != null &&
+ this.SelectedTask.Status == QueueItemStatus.Completed && File.Exists(this.SelectedTask.Task.Destination);
+
public double ProgressValue
{
get => this.progressValue;
@@ -348,7 +360,6 @@ namespace HandBrakeWPF.ViewModels {
this.queueProcessor.Pause();
- this.JobStatus = Resources.QueueViewModel_QueuePending;
this.JobsPending = string.Format(Resources.QueueViewModel_JobsPending, this.queueProcessor.Count);
this.IsQueueRunning = false;
@@ -447,7 +458,6 @@ namespace HandBrakeWPF.ViewModels task.Status = QueueItemStatus.Waiting;
this.queueProcessor.BackupQueue(null);
this.JobsPending = string.Format(Resources.QueueViewModel_JobsPending, this.queueProcessor.Count);
- this.JobStatus = Resources.QueueViewModel_QueueReady;
this.NotifyOfPropertyChange(() => this.CanRetryJob);
}
@@ -471,7 +481,6 @@ namespace HandBrakeWPF.ViewModels return;
}
- this.JobStatus = Resources.QueueViewModel_QueueStarted;
this.JobsPending = string.Format(Resources.QueueViewModel_JobsPending, this.queueProcessor.Count);
this.IsQueueRunning = true;
@@ -536,6 +545,17 @@ namespace HandBrakeWPF.ViewModels mvm.EditQueueJob(task);
}
+ public void OpenSourceDir()
+ {
+ this.OpenSourceDirectory(this.SelectedTask);
+
+ }
+
+ public void OpenDestDir()
+ {
+ this.OpenDestinationDirectory(this.SelectedTask);
+ }
+
public void OpenSourceDirectory(QueueTask task)
{
if (task != null)
@@ -585,6 +605,23 @@ namespace HandBrakeWPF.ViewModels }
}
+ public void PlayFile()
+ {
+ if (this.SelectedTask != null && this.SelectedTask.Task != null && File.Exists(this.SelectedTask.Task.Destination))
+ {
+ Process.Start(this.SelectedTask.Task.Destination);
+ }
+ }
+
+ public void MoveUp()
+ {
+ this.errorService.ShowMessageBox("Not Implemented yet. You can drag / drop re-organise the queue for now.", "Coming Soon!", MessageBoxButton.OK, MessageBoxImage.Information);
+ }
+
+ public void MoveDown()
+ {
+ this.errorService.ShowMessageBox("Not Implemented yet. You can drag / drop re-organise the queue for now.", "Coming Soon!", MessageBoxButton.OK, MessageBoxImage.Information);
+ }
#endregion
@@ -615,7 +652,6 @@ namespace HandBrakeWPF.ViewModels this.queueProcessor.QueuePaused += this.QueueProcessor_QueuePaused;
this.JobsPending = string.Format(Resources.QueueViewModel_JobsPending, this.queueProcessor.Count);
- this.JobStatus = Resources.QueueViewModel_QueueReady;
base.OnActivate();
}
@@ -794,13 +830,14 @@ namespace HandBrakeWPF.ViewModels if (!queueProcessor.IsProcessing)
{
- this.JobStatus = Resources.QueueViewModel_QueueNotRunning;
this.IsQueueRunning = false;
}
this.NotifyOfPropertyChange(() => this.CanRetryJob);
this.NotifyOfPropertyChange(() => this.CanEditJob);
this.NotifyOfPropertyChange(() => this.CanRemoveJob);
+ this.NotifyOfPropertyChange(() => this.CanPerformActionOnSource);
+ this.NotifyOfPropertyChange(() => this.CanPlayFile);
this.NotifyOfPropertyChange(() => this.StatsVisible);
this.HandleLogData();
}
@@ -816,12 +853,13 @@ namespace HandBrakeWPF.ViewModels /// </param>
private void queueProcessor_QueueCompleted(object sender, EventArgs e)
{
- this.JobStatus = Resources.QueueViewModel_QueueCompleted;
this.JobsPending = string.Format(Resources.QueueViewModel_JobsPending, this.queueProcessor.Count);
this.IsQueueRunning = false;
this.NotifyOfPropertyChange(() => this.SelectedTask);
this.NotifyOfPropertyChange(() => this.StatsVisible);
this.NotifyOfPropertyChange(() => this.CanRetryJob);
+
+ this.JobStatus = string.Empty;
}
/// <summary>
@@ -837,7 +875,7 @@ namespace HandBrakeWPF.ViewModels {
if (!this.queueProcessor.IsProcessing)
{
- this.JobStatus = Resources.QueueViewModel_LastJobFinished;
+ this.JobStatus = string.Empty;
}
}
diff --git a/win/CS/HandBrakeWPF/Views/Queue/QueueTwoContent.xaml b/win/CS/HandBrakeWPF/Views/Queue/QueueTwoContent.xaml index 930533987..66e8d3ab4 100644 --- a/win/CS/HandBrakeWPF/Views/Queue/QueueTwoContent.xaml +++ b/win/CS/HandBrakeWPF/Views/Queue/QueueTwoContent.xaml @@ -52,15 +52,9 @@ </Grid.ColumnDefinitions> <TextBlock Text="{x:Static Properties:Resources.MainView_ShowQueue}" FontSize="28" VerticalAlignment="Center" FontFamily="Segoe UI Light" Margin="10,0,0,0" /> - </Grid> - <StackPanel Grid.Row="1" Margin="20,5,10,0" Visibility="{Binding IsNewQueueVisible, Converter={StaticResource boolToVisConverter}}"> - <TextBlock Text="{Binding JobsPending}" TextWrapping="WrapWithOverflow" TextTrimming="CharacterEllipsis" /> - <TextBlock Text="{Binding JobStatus}" TextWrapping="WrapWithOverflow" TextTrimming="CharacterEllipsis"/> - </StackPanel> - - <Grid Grid.Row="2" Margin="0,10,0,0"> + <Grid Grid.Row="2" Margin="0,0,0,0"> <Grid.ColumnDefinitions> <ColumnDefinition Width="3*" MaxWidth="600" x:Name="leftTabPanel" /> <ColumnDefinition Width="5*" x:Name="rightTabPanel" /> @@ -69,11 +63,32 @@ <Border> <Grid> <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> <RowDefinition Height="*" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> - <ListBox Tag="{Binding}" x:Name="queueJobs" Grid.Row="0" Margin="10,0,5,0" + <Grid Grid.Row="0" HorizontalAlignment="Stretch" Margin="15,0,5,5"> + + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*" /> + <ColumnDefinition Width="Auto" /> + </Grid.ColumnDefinitions> + + <TextBlock Text="{Binding JobsPending}" Grid.Row="1" Grid.Column="0" TextWrapping="WrapWithOverflow" TextTrimming="CharacterEllipsis"/> + + <StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal"> + <Button Content="^" Width="20" Height="20" Margin="0" cal:Message.Attach="[Event Click] = [Action MoveUp]" /> + <Button Content="v" Width="20" Height="20" Margin="5,0,0,0" cal:Message.Attach="[Event Click] = [Action MoveDown]" /> + </StackPanel> + </Grid> + + <ListBox Tag="{Binding}" x:Name="queueJobs" Grid.Row="1" Margin="10,0,5,0" dd:DragDrop.DropHandler="{Binding}" dd:DragDrop.IsDragSource="True" @@ -212,7 +227,7 @@ </ListBox.ItemTemplate> </ListBox> - <Border BorderThickness="1,0,1,1" BorderBrush="DarkGray" Grid.Row="1" Margin="10,0,5,10" SnapsToDevicePixels="True" > + <Border BorderThickness="1,0,1,1" BorderBrush="DarkGray" Grid.Row="2" Margin="10,0,5,10" SnapsToDevicePixels="True" > <Menu HorizontalAlignment="Center" VerticalAlignment="Center" Background="Transparent" AutomationProperties.Name="{x:Static Properties:Resources.QueueView_WhenDone}"> <MenuItem> @@ -326,9 +341,41 @@ </i:EventTrigger> </i:Interaction.Triggers> </Button> + + + <Button x:Name="queueOptionsDropButton" Margin="10,0,0,0" Click="QueueOptionsDropButton_OnClick" + AutomationProperties.Name="{x:Static Properties:Resources.QueueView_Options}" IsEnabled="{Binding CanPerformActionOnSource}"> + <Button.Content> + <StackPanel Orientation="Horizontal"> + <Image Width="20" Height="20" VerticalAlignment="Center" Margin="0,0,5,0" + Source="../Images/Advanced.png"> + </Image> + + <TextBlock Margin="0,0,5,0" Padding="0" + VerticalAlignment="Center" + Text="{x:Static Properties:Resources.QueueView_Options}" /> + + <Path Height="5" Margin="2,2,0,0" VerticalAlignment="Center" HorizontalAlignment="Center" + Data="M 0 0 L 4 4 L 8 0 Z" + Fill="{DynamicResource GlyphBrush}" x:Name="dropdownArrowPreset" /> + </StackPanel> + </Button.Content> + + <Button.ContextMenu> + <ContextMenu cal:Action.TargetWithoutContext="{Binding DataContext, RelativeSource={RelativeSource Self}}"> + <MenuItem Header="{x:Static Properties:Resources.QueueView_PlayMediaFile}" cal:Message.Attach="[Event Click] = [Action PlayFile]" /> + <Separator /> + <MenuItem Header="{x:Static Properties:Resources.QueueView_OpenSourceDir}" cal:Message.Attach="[Event Click] = [Action OpenSourceDir]" /> + <MenuItem Header="{x:Static Properties:Resources.QueueView_OpenDestDir}" cal:Message.Attach="[Event Click] = [Action OpenDestDir]" /> + </ContextMenu> + </Button.ContextMenu> + </Button> </StackPanel> - <Grid Style="{StaticResource LongToolTipHolder}" Margin="0,5,0,0" > + <TextBlock Text="{Binding JobStatus}" Visibility="{Binding IsJobStatusVisible, Converter={StaticResource boolToVisConverter}}" + Margin="0,15,10,5" TextWrapping="WrapWithOverflow" TextTrimming="CharacterEllipsis" /> + + <Grid Style="{StaticResource LongToolTipHolder}" Margin="0,10,0,0" > <Grid.Resources> <Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}"> <Setter Property="Margin" Value="0,5,0,5" /> diff --git a/win/CS/HandBrakeWPF/Views/Queue/QueueTwoContent.xaml.cs b/win/CS/HandBrakeWPF/Views/Queue/QueueTwoContent.xaml.cs index 691854b74..e6fe29971 100644 --- a/win/CS/HandBrakeWPF/Views/Queue/QueueTwoContent.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/Queue/QueueTwoContent.xaml.cs @@ -25,7 +25,7 @@ namespace HandBrakeWPF.Views.Queue private QueueTask mouseActiveQueueTask; /// <summary> - /// Initializes a new instance of the <see cref="Queue2View"/> class. + /// Initializes a new instance of the <see cref="QueueTwoContent"/> class. /// </summary> public QueueTwoContent() { @@ -93,5 +93,16 @@ namespace HandBrakeWPF.Views.Queue { ((QueueViewModel)this.DataContext).OpenDestinationDirectory(this.mouseActiveQueueTask); } + + private void QueueOptionsDropButton_OnClick(object sender, RoutedEventArgs e) + { + var button = sender as FrameworkElement; + if (button != null && button.ContextMenu != null) + { + button.ContextMenu.PlacementTarget = button; + button.ContextMenu.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom; + button.ContextMenu.IsOpen = true; + } + } } } diff --git a/win/CS/HandBrakeWPF/Views/QueueView.xaml b/win/CS/HandBrakeWPF/Views/QueueView.xaml index 39a81a760..33710d000 100644 --- a/win/CS/HandBrakeWPF/Views/QueueView.xaml +++ b/win/CS/HandBrakeWPF/Views/QueueView.xaml @@ -176,7 +176,7 @@ <StackPanel Grid.Row="1" Margin="10,20,10,0">
<TextBlock Text="{Binding JobsPending}" TextWrapping="WrapWithOverflow" TextTrimming="CharacterEllipsis" />
- <TextBlock Text="{Binding JobStatus}" TextWrapping="WrapWithOverflow" TextTrimming="CharacterEllipsis"/>
+ <TextBlock Text="{Binding JobStatus}" Visibility="{Binding IsJobStatusVisible, Converter={StaticResource boolToVisConverter}}" TextWrapping="WrapWithOverflow" TextTrimming="CharacterEllipsis"/>
</StackPanel>
<ListBox Grid.Row="2" Tag="{Binding}" x:Name="queueJobs"
|