]> granicus.if.org Git - handbrake/commitdiff
WinGui: Improvements to the new queue design.
authorsr55 <sr55.hb@outlook.com>
Fri, 4 Jan 2019 21:25:01 +0000 (21:25 +0000)
committersr55 <sr55.hb@outlook.com>
Fri, 4 Jan 2019 21:25:01 +0000 (21:25 +0000)
- Added "Options" drop button to the Summary Tab.   Includes "Play File" and "Open Source/Dest directory" options
- Moved the encode status information onto the Summary Tab (only shown when encoding)
- Added placeholder buttons for Move up/down to make queue re-ordering more discoverable.
- Space optimisation

win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
win/CS/HandBrakeWPF/Properties/Resources.resx
win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs
win/CS/HandBrakeWPF/Views/Queue/QueueTwoContent.xaml
win/CS/HandBrakeWPF/Views/Queue/QueueTwoContent.xaml.cs
win/CS/HandBrakeWPF/Views/QueueView.xaml

index e03f008f479fc5cf470f6e10bcf5c0ea8069d966..c09fd137071f65af546c79d37fc526c63d462a30 100644 (file)
@@ -4121,6 +4121,15 @@ namespace HandBrakeWPF.Properties {
             }\r
         }\r
         \r
+        /// <summary>\r
+        ///   Looks up a localized string similar to Play File.\r
+        /// </summary>\r
+        public static string QueueView_PlayMediaFile {\r
+            get {\r
+                return ResourceManager.GetString("QueueView_PlayMediaFile", resourceCulture);\r
+            }\r
+        }\r
+        \r
         /// <summary>\r
         ///   Looks up a localized string similar to Quit HandBrake.\r
         /// </summary>\r
index efa0157802730e38811aae72766490bd40d993eb..521194d2c468879f0c96943f02f609167d94532e 100644 (file)
@@ -2011,4 +2011,7 @@ This will not affect your current settings in the Subtitle tab.</value>
   <data name="MainView_ShowAddSelectionToQueue" xml:space="preserve">\r
     <value>'Add Selection' to Queue</value>\r
   </data>\r
+  <data name="QueueView_PlayMediaFile" xml:space="preserve">\r
+    <value>Play File</value>\r
+  </data>\r
 </root>
\ No newline at end of file
index 2e31a2a04fd8f12ad452b43f0828666039ec58c0..ee5dfb58344526402ff15ee11def5e6de5917d8c 100644 (file)
@@ -15,6 +15,7 @@ namespace HandBrakeWPF.ViewModels
     using System.Diagnostics;\r
     using System.IO;\r
     using System.Linq;\r
+    using System.Runtime.CompilerServices;\r
     using System.Windows;\r
 \r
     using Caliburn.Micro;\r
@@ -74,7 +75,7 @@ namespace HandBrakeWPF.ViewModels
             this.errorService = errorService;\r
             this.Title = Resources.QueueViewModel_Queue;\r
             this.JobsPending = Resources.QueueViewModel_NoEncodesPending;\r
-            this.JobStatus = Resources.QueueViewModel_NoJobsPending;\r
+            this.JobStatus = string.Empty;\r
             this.SelectedItems = new BindingList<QueueTask>();\r
             this.DisplayName = "Queue";\r
             this.IsQueueRunning = false;\r
@@ -118,9 +119,12 @@ namespace HandBrakeWPF.ViewModels
             {\r
                 this.jobStatus = value;\r
                 this.NotifyOfPropertyChange(() => this.JobStatus);\r
+                this.NotifyOfPropertyChange(() => this.IsJobStatusVisible);\r
             }\r
         }\r
 \r
+        public bool IsJobStatusVisible => !string.IsNullOrEmpty(this.JobStatus);\r
+\r
         /// <summary>\r
         /// Gets or sets JobsPending.\r
         /// </summary>\r
@@ -188,6 +192,8 @@ namespace HandBrakeWPF.ViewModels
                 this.NotifyOfPropertyChange(() => this.CanRetryJob);\r
                 this.NotifyOfPropertyChange(() => this.CanEditJob);\r
                 this.NotifyOfPropertyChange(() => this.CanRemoveJob);\r
+                this.NotifyOfPropertyChange(() => this.CanPerformActionOnSource);\r
+                this.NotifyOfPropertyChange(() => this.CanPlayFile);\r
                 this.NotifyOfPropertyChange(() => this.StatsVisible);\r
             }\r
         }\r
@@ -200,6 +206,12 @@ namespace HandBrakeWPF.ViewModels
 \r
         public bool CanRemoveJob => this.SelectedTask != null;\r
 \r
+        public bool CanPerformActionOnSource => this.SelectedTask != null;\r
+\r
+        public bool CanPlayFile =>\r
+            this.SelectedTask != null && this.SelectedTask.Task.Destination != null && \r
+            this.SelectedTask.Status == QueueItemStatus.Completed && File.Exists(this.SelectedTask.Task.Destination);\r
+\r
         public double ProgressValue\r
         {\r
             get => this.progressValue;\r
@@ -348,7 +360,6 @@ namespace HandBrakeWPF.ViewModels
         {\r
             this.queueProcessor.Pause();\r
 \r
-            this.JobStatus = Resources.QueueViewModel_QueuePending;\r
             this.JobsPending = string.Format(Resources.QueueViewModel_JobsPending, this.queueProcessor.Count);\r
             this.IsQueueRunning = false;\r
 \r
@@ -447,7 +458,6 @@ namespace HandBrakeWPF.ViewModels
             task.Status = QueueItemStatus.Waiting;\r
             this.queueProcessor.BackupQueue(null);\r
             this.JobsPending = string.Format(Resources.QueueViewModel_JobsPending, this.queueProcessor.Count);\r
-            this.JobStatus = Resources.QueueViewModel_QueueReady;\r
             this.NotifyOfPropertyChange(() => this.CanRetryJob);\r
         }\r
 \r
@@ -471,7 +481,6 @@ namespace HandBrakeWPF.ViewModels
                 return;\r
             }\r
 \r
-            this.JobStatus = Resources.QueueViewModel_QueueStarted;\r
             this.JobsPending = string.Format(Resources.QueueViewModel_JobsPending, this.queueProcessor.Count);\r
             this.IsQueueRunning = true;\r
 \r
@@ -536,6 +545,17 @@ namespace HandBrakeWPF.ViewModels
             mvm.EditQueueJob(task);\r
         }\r
 \r
+        public void OpenSourceDir()\r
+        {\r
+            this.OpenSourceDirectory(this.SelectedTask);\r
+\r
+        }\r
+\r
+        public void OpenDestDir()\r
+        {\r
+            this.OpenDestinationDirectory(this.SelectedTask);\r
+        }\r
+\r
         public void OpenSourceDirectory(QueueTask task)\r
         {\r
             if (task != null)\r
@@ -585,6 +605,23 @@ namespace HandBrakeWPF.ViewModels
             }\r
         }\r
 \r
+        public void PlayFile()\r
+        {\r
+            if (this.SelectedTask != null && this.SelectedTask.Task != null && File.Exists(this.SelectedTask.Task.Destination))\r
+            {\r
+                Process.Start(this.SelectedTask.Task.Destination);\r
+            }\r
+        }\r
+\r
+        public void MoveUp()\r
+        {\r
+            this.errorService.ShowMessageBox("Not Implemented yet. You can drag / drop re-organise the queue for now.", "Coming Soon!", MessageBoxButton.OK, MessageBoxImage.Information);\r
+        }\r
+\r
+        public void MoveDown()\r
+        {\r
+            this.errorService.ShowMessageBox("Not Implemented yet. You can drag / drop re-organise the queue for now.", "Coming Soon!", MessageBoxButton.OK, MessageBoxImage.Information);\r
+        }\r
 \r
         #endregion\r
 \r
@@ -615,7 +652,6 @@ namespace HandBrakeWPF.ViewModels
             this.queueProcessor.QueuePaused += this.QueueProcessor_QueuePaused;\r
 \r
             this.JobsPending = string.Format(Resources.QueueViewModel_JobsPending, this.queueProcessor.Count);\r
-            this.JobStatus = Resources.QueueViewModel_QueueReady;\r
 \r
             base.OnActivate();\r
         }\r
@@ -794,13 +830,14 @@ namespace HandBrakeWPF.ViewModels
 \r
             if (!queueProcessor.IsProcessing)\r
             {\r
-                this.JobStatus = Resources.QueueViewModel_QueueNotRunning;\r
                 this.IsQueueRunning = false;\r
             }\r
 \r
             this.NotifyOfPropertyChange(() => this.CanRetryJob);\r
             this.NotifyOfPropertyChange(() => this.CanEditJob);\r
             this.NotifyOfPropertyChange(() => this.CanRemoveJob);\r
+            this.NotifyOfPropertyChange(() => this.CanPerformActionOnSource);\r
+            this.NotifyOfPropertyChange(() => this.CanPlayFile);\r
             this.NotifyOfPropertyChange(() => this.StatsVisible);\r
             this.HandleLogData();\r
         }\r
@@ -816,12 +853,13 @@ namespace HandBrakeWPF.ViewModels
         /// </param>\r
         private void queueProcessor_QueueCompleted(object sender, EventArgs e)\r
         {\r
-            this.JobStatus = Resources.QueueViewModel_QueueCompleted;\r
             this.JobsPending = string.Format(Resources.QueueViewModel_JobsPending, this.queueProcessor.Count);\r
             this.IsQueueRunning = false;\r
             this.NotifyOfPropertyChange(() => this.SelectedTask);\r
             this.NotifyOfPropertyChange(() => this.StatsVisible);\r
             this.NotifyOfPropertyChange(() => this.CanRetryJob);\r
+\r
+            this.JobStatus = string.Empty;\r
         }\r
 \r
         /// <summary>\r
@@ -837,7 +875,7 @@ namespace HandBrakeWPF.ViewModels
         {\r
             if (!this.queueProcessor.IsProcessing)\r
             {\r
-                this.JobStatus = Resources.QueueViewModel_LastJobFinished;\r
+                this.JobStatus = string.Empty;\r
             }\r
         }\r
 \r
index 930533987135cc17575ae9f5fd5c0349e291efd7..66e8d3ab407eddf0446c552a254be950ad1721e0 100644 (file)
             </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"  />
             <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"
                         </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>
                                         </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" />
index 691854b74244606168562049d7a68dbf24b10f4a..e6fe29971923ab30f9fc8375c43124b68fd5224c 100644 (file)
@@ -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;
+            }
+        }
     }
 }
index 39a81a76094a884a312741bfcebebf4e0ee6f0e7..33710d00087bb96815f894789423b259af511516 100644 (file)
 \r
             <StackPanel Grid.Row="1" Margin="10,20,10,0">\r
                 <TextBlock Text="{Binding JobsPending}" TextWrapping="WrapWithOverflow" TextTrimming="CharacterEllipsis" />\r
-                <TextBlock Text="{Binding JobStatus}" TextWrapping="WrapWithOverflow" TextTrimming="CharacterEllipsis"/>\r
+                <TextBlock Text="{Binding JobStatus}" Visibility="{Binding IsJobStatusVisible, Converter={StaticResource boolToVisConverter}}"  TextWrapping="WrapWithOverflow" TextTrimming="CharacterEllipsis"/>\r
             </StackPanel>\r
 \r
             <ListBox Grid.Row="2" Tag="{Binding}" x:Name="queueJobs"\r