diff options
author | sr55 <[email protected]> | 2018-09-22 21:36:22 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2018-09-22 21:36:22 +0100 |
commit | e8f7443a6f31f657f0b51721bb4ff12cea9b5d5a (patch) | |
tree | fd0c2563715c8fda204843749295ca91ee13cdb5 | |
parent | c0ab54be2370f7ddd889738a425e8076d76c9043 (diff) |
WinGui: Adding Stats and Log Tabs to the new experimental queue view. #1087
5 files changed, 248 insertions, 28 deletions
diff --git a/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs b/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs index 4c3609f4e..e1e5222c4 100644 --- a/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs @@ -2124,6 +2124,24 @@ namespace HandBrakeWPF.Properties { }
/// <summary>
+ /// Looks up a localized string similar to Encode Time:.
+ /// </summary>
+ public static string QueueView_Duration {
+ get {
+ return ResourceManager.GetString("QueueView_Duration", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to End Time:.
+ /// </summary>
+ public static string QueueView_EndTime {
+ get {
+ return ResourceManager.GetString("QueueView_EndTime", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Export Queue for CLI.
/// </summary>
public static string QueueView_Export {
@@ -2133,6 +2151,15 @@ namespace HandBrakeWPF.Properties { }
/// <summary>
+ /// Looks up a localized string similar to Filesize: .
+ /// </summary>
+ public static string QueueView_FileSize {
+ get {
+ return ResourceManager.GetString("QueueView_FileSize", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Hibernate.
/// </summary>
public static string QueueView_Hibernate {
@@ -2151,6 +2178,15 @@ namespace HandBrakeWPF.Properties { }
/// <summary>
+ /// Looks up a localized string similar to The log will be available after the encode completes..
+ /// </summary>
+ public static string QueueView_LogNotAvailableYet {
+ get {
+ return ResourceManager.GetString("QueueView_LogNotAvailableYet", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Log off.
/// </summary>
public static string QueueView_Logoff {
@@ -2196,6 +2232,15 @@ namespace HandBrakeWPF.Properties { }
/// <summary>
+ /// Looks up a localized string similar to Paused Duration:.
+ /// </summary>
+ public static string QueueView_PausedDuration {
+ get {
+ return ResourceManager.GetString("QueueView_PausedDuration", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Picture Settings:.
/// </summary>
public static string QueueView_PictureSettings {
@@ -2241,6 +2286,33 @@ namespace HandBrakeWPF.Properties { }
/// <summary>
+ /// Looks up a localized string similar to Start Time:.
+ /// </summary>
+ public static string QueueView_StartTime {
+ get {
+ return ResourceManager.GetString("QueueView_StartTime", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Statistics.
+ /// </summary>
+ public static string QueueView_Statistics {
+ get {
+ return ResourceManager.GetString("QueueView_Statistics", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Statistics will be available after an encode completes..
+ /// </summary>
+ public static string QueueView_StatsNotAvailableYet {
+ get {
+ return ResourceManager.GetString("QueueView_StatsNotAvailableYet", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Subtitles:.
/// </summary>
public static string QueueView_Subtitles {
@@ -2250,6 +2322,15 @@ namespace HandBrakeWPF.Properties { }
/// <summary>
+ /// Looks up a localized string similar to Summary.
+ /// </summary>
+ public static string QueueView_Summary {
+ get {
+ return ResourceManager.GetString("QueueView_Summary", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Suspend.
/// </summary>
public static string QueueView_Suspend {
diff --git a/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx b/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx index dfa6745dc..9f7a186b9 100644 --- a/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx +++ b/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx @@ -1061,4 +1061,31 @@ This will not affect your current settings in the Subtitle tab.</value> <data name="Options_ShowExperimentalQueueDesign" xml:space="preserve">
<value>Show the new experimental queue design.</value>
</data>
+ <data name="QueueView_Duration" xml:space="preserve">
+ <value>Encode Time:</value>
+ </data>
+ <data name="QueueView_EndTime" xml:space="preserve">
+ <value>End Time:</value>
+ </data>
+ <data name="QueueView_FileSize" xml:space="preserve">
+ <value>Filesize: </value>
+ </data>
+ <data name="QueueView_PausedDuration" xml:space="preserve">
+ <value>Paused Duration:</value>
+ </data>
+ <data name="QueueView_StartTime" xml:space="preserve">
+ <value>Start Time:</value>
+ </data>
+ <data name="QueueView_LogNotAvailableYet" xml:space="preserve">
+ <value>The log will be available after the encode completes.</value>
+ </data>
+ <data name="QueueView_Statistics" xml:space="preserve">
+ <value>Statistics</value>
+ </data>
+ <data name="QueueView_StatsNotAvailableYet" xml:space="preserve">
+ <value>Statistics will be available after an encode completes.</value>
+ </data>
+ <data name="QueueView_Summary" xml:space="preserve">
+ <value>Summary</value>
+ </data>
</root>
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs index d12c99059..77454c4ad 100644 --- a/win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs +++ b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs @@ -68,6 +68,11 @@ namespace HandBrakeWPF.Services.Queue.Model { get { + if (this.endTime == DateTime.MinValue) + { + return TimeSpan.MinValue; + } + return this.EndTime - this.StartTime - this.PausedDuration; } } diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs index aefcf2980..a11b14571 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs @@ -42,7 +42,6 @@ namespace HandBrakeWPF.ViewModels private readonly IErrorService errorService;
private readonly IUserSettingService userSettingService;
private readonly IQueueProcessor queueProcessor;
- private bool isEncoding;
private string jobStatus;
private string jobsPending;
private string whenDoneAction;
@@ -79,7 +78,7 @@ namespace HandBrakeWPF.ViewModels this.SelectedItems = new BindingList<QueueTask>();
this.DisplayName = "Queue";
this.IsQueueRunning = false;
-
+
this.WhenDoneAction = this.userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction);
}
@@ -189,11 +188,10 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange(() => this.CanRetryJob);
this.NotifyOfPropertyChange(() => this.CanEditJob);
this.NotifyOfPropertyChange(() => this.CanRemoveJob);
+ this.NotifyOfPropertyChange(() => this.StatsVisible);
}
}
- public bool ShowLogTab { get; private set; }
-
public string ActivityLog { get; private set; }
public bool CanRetryJob => this.SelectedTask != null && this.SelectedTask.Status != QueueItemStatus.Waiting;
@@ -239,6 +237,20 @@ namespace HandBrakeWPF.ViewModels public bool IsInline { get; set; }
+ public bool StatsVisible
+ {
+ get
+ {
+ if (this.SelectedTask != null &&
+ (this.selectedTask.Status == QueueItemStatus.Completed || this.selectedTask.Status == QueueItemStatus.Error))
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
+
#endregion
#region Public Methods
@@ -340,7 +352,7 @@ namespace HandBrakeWPF.ViewModels this.JobsPending = string.Format(Resources.QueueViewModel_JobsPending, this.queueProcessor.Count);
this.IsQueueRunning = false;
- MessageBox.Show(Resources.QueueViewModel_QueuePauseNotice, Resources.QueueViewModel_Queue,
+ MessageBox.Show(Resources.QueueViewModel_QueuePauseNotice, Resources.QueueViewModel_Queue,
MessageBoxButton.OK, MessageBoxImage.Information);
}
@@ -397,9 +409,9 @@ namespace HandBrakeWPF.ViewModels {
MessageBoxResult result =
this.errorService.ShowMessageBox(
- Resources.QueueViewModel_JobCurrentlyRunningWarning,
- Resources.Warning,
- MessageBoxButton.YesNo,
+ Resources.QueueViewModel_JobCurrentlyRunningWarning,
+ Resources.Warning,
+ MessageBoxButton.YesNo,
MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
@@ -461,12 +473,12 @@ namespace HandBrakeWPF.ViewModels public void Export()
{
SaveFileDialog dialog = new SaveFileDialog
- {
- Filter = "Json (*.json)|*.json",
- OverwritePrompt = true,
- DefaultExt = ".json",
- AddExtension = true
- };
+ {
+ Filter = "Json (*.json)|*.json",
+ OverwritePrompt = true,
+ DefaultExt = ".json",
+ AddExtension = true
+ };
if (dialog.ShowDialog() == true)
{
@@ -495,9 +507,9 @@ namespace HandBrakeWPF.ViewModels public void EditJob(QueueTask task)
{
MessageBoxResult result = this.errorService.ShowMessageBox(
- Resources.QueueViewModel_EditConfrimation,
- "Modify Job?",
- MessageBoxButton.YesNo,
+ Resources.QueueViewModel_EditConfrimation,
+ "Modify Job?",
+ MessageBoxButton.YesNo,
MessageBoxImage.Question);
if (result != MessageBoxResult.Yes)
@@ -612,11 +624,37 @@ namespace HandBrakeWPF.ViewModels }
}
+ /// <summary>
+ /// Open the Log file directory
+ /// </summary>
+ public void OpenLogDirectory()
+ {
+ string logDir = DirectoryUtilities.GetLogDirectory();
+ string windir = Environment.GetEnvironmentVariable("WINDIR");
+ Process prc = new Process { StartInfo = { FileName = windir + @"\explorer.exe", Arguments = logDir } };
+ prc.Start();
+ }
+
+ /// <summary>
+ /// Copy the log file to the system clipboard
+ /// </summary>
+ public void CopyLog()
+ {
+ try
+ {
+ Clipboard.SetDataObject(this.ActivityLog, true);
+ }
+ catch (Exception exc)
+ {
+ this.errorService.ShowError(Resources.Clipboard_Unavailable, Resources.Clipboard_Unavailable_Solution, exc);
+ }
+ }
+
private void HandleLogData()
{
- if (this.SelectedTask == null || this.SelectedTask.Status == QueueItemStatus.InProgress)
+ if (this.SelectedTask == null || this.SelectedTask.Status == QueueItemStatus.InProgress || this.SelectedTask.Status == QueueItemStatus.Waiting)
{
- this.ShowLogTab = false;
+ this.ActivityLog = ResourcesUI.QueueView_LogNotAvailableYet;
}
else
{
@@ -632,18 +670,15 @@ namespace HandBrakeWPF.ViewModels this.ActivityLog = logContent;
}
- this.ShowLogTab = true;
}
}
catch (Exception exc)
{
Debug.WriteLine(exc);
- this.ShowLogTab = true;
this.ActivityLog = exc.ToString();
}
}
- this.NotifyOfPropertyChange(() => this.ShowLogTab);
this.NotifyOfPropertyChange(() => this.ActivityLog);
}
@@ -661,7 +696,7 @@ namespace HandBrakeWPF.ViewModels Execute.OnUIThread(() =>
{
string jobsPending = string.Format(Resources.Main_JobsPending_addon, this.queueProcessor.Count);
- this.IntermediateProgress = false;
+ this.IntermediateProgress = false;
if (e.IsSubtitleScan)
{
@@ -724,6 +759,8 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange(() => this.CanRetryJob);
this.NotifyOfPropertyChange(() => this.CanEditJob);
this.NotifyOfPropertyChange(() => this.CanRemoveJob);
+ this.NotifyOfPropertyChange(() => this.StatsVisible);
+ this.HandleLogData();
}
/// <summary>
@@ -772,7 +809,7 @@ namespace HandBrakeWPF.ViewModels {
this.JobStatus = Resources.QueueViewModel_QueueStarted;
this.JobsPending = string.Format(Resources.QueueViewModel_JobsPending, this.queueProcessor.Count);
- this.IsQueueRunning = true;
+ this.IsQueueRunning = true;
}
private void QueueProcessor_QueuePaused(object sender, EventArgs e)
diff --git a/win/CS/HandBrakeWPF/Views/Queue/QueueTwoContent.xaml b/win/CS/HandBrakeWPF/Views/Queue/QueueTwoContent.xaml index 3e3a93d80..1a8828be5 100644 --- a/win/CS/HandBrakeWPF/Views/Queue/QueueTwoContent.xaml +++ b/win/CS/HandBrakeWPF/Views/Queue/QueueTwoContent.xaml @@ -249,7 +249,7 @@ <TextBlock Text="{Binding Task.Destination, Converter={StaticResource filePathToFilenameConverter}}" /> </StackPanel> - <ProgressBar Minimum="0" Height="4" Maximum="100" Name="pbStatus" Margin="0,0,5,0" + <ProgressBar Minimum="0" Height="4" Maximum="100" Name="pbStatus" Margin="0,2,5,0" Value="{Binding DataContext.ProgressValue, ElementName=queueJobs}" IsIndeterminate="{Binding DataContext.IntermediateProgress, ElementName=queueJobs}" Visibility="{Binding ShowEncodeProgress, Converter={StaticResource boolToVisConverter}}" /> </StackPanel> @@ -257,9 +257,9 @@ </DataTemplate> </ListBox.ItemTemplate> </ListBox> - - <TabControl x:Name="summaryTabControl" Grid.Column="1" Margin="0,0,10,10"> - <TabItem Header="Summary" > + + <TabControl x:Name="summaryTabControl" Grid.Column="1" Margin="0,0,10,10" > + <TabItem Header="{x:Static Properties:ResourcesUI.QueueView_Summary}" > <ScrollViewer VerticalScrollBarVisibility="Auto" Margin="5,5,0,5"> <StackPanel Orientation="Vertical" Margin="5,5,0,5"> @@ -378,6 +378,76 @@ </StackPanel> </ScrollViewer> </TabItem> + + <TabItem Header="{x:Static Properties:ResourcesUI.QueueView_Statistics}" > + <ScrollViewer VerticalScrollBarVisibility="Auto" Margin="10,0,0,5"> + <StackPanel> + <TextBlock Text="{x:Static Properties:ResourcesUI.QueueView_StatsNotAvailableYet}" Margin="0,10,0,0" Visibility="{Binding StatsVisible, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" /> + + <Grid Style="{StaticResource LongToolTipHolder}" Margin="0,5,0,0" Visibility="{Binding StatsVisible, Converter={StaticResource boolToVisConverter}}"> + <Grid.Resources> + <Style TargetType="TextBlock"> + <Setter Property="Margin" Value="0,5,0,5" /> + </Style> + </Grid.Resources> + + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto" MinWidth="100" /> + <ColumnDefinition Width="*" /> + </Grid.ColumnDefinitions> + + <TextBlock FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.QueueView_StartTime}" VerticalAlignment="Top" Grid.Row="0" Grid.Column="0" /> + <TextBlock Text="{Binding SelectedTask.Statistics.StartTime}" TextWrapping="Wrap" Grid.Row="0" Grid.Column="1" /> + + <TextBlock FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.QueueView_EndTime}" VerticalAlignment="Top" Grid.Row="1" Grid.Column="0" /> + <TextBlock Text="{Binding SelectedTask.Statistics.EndTime}" TextWrapping="Wrap" Grid.Row="1" Grid.Column="1" /> + + <TextBlock FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.QueueView_PausedDuration}" VerticalAlignment="Top" Grid.Row="2" Grid.Column="0" /> + <TextBlock Text="{Binding SelectedTask.Statistics.PausedDuration,StringFormat=hh\\:mm\\:ss}" TextWrapping="Wrap" Grid.Row="2" Grid.Column="1" /> + + <TextBlock FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.QueueView_Duration}" VerticalAlignment="Top" Grid.Row="3" Grid.Column="0" /> + <TextBlock Text="{Binding SelectedTask.Statistics.Duration,StringFormat=hh\\:mm\\:ss}" TextWrapping="Wrap" Grid.Row="3" Grid.Column="1" /> + + <TextBlock FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.QueueView_FileSize}" VerticalAlignment="Top" Grid.Row="4" Grid.Column="0" /> + <StackPanel Orientation="Horizontal" Grid.Row="4" Grid.Column="1" > + <TextBlock Text="{Binding SelectedTask.Statistics.FinalFileSizeInMegaBytes}" TextWrapping="Wrap" /> + <TextBlock Text=" MB" /> + </StackPanel> + + </Grid> + + </StackPanel> + </ScrollViewer> + </TabItem> + + <TabItem Header="{x:Static Properties:ResourcesUI.MainView_ActivityLog}"> + <TextBox ScrollViewer.VerticalScrollBarVisibility="Visible" Text="{Binding ActivityLog, Mode=OneWay}" TextWrapping="Wrap" x:Name="logText"> + <TextBox.ContextMenu> + <ContextMenu> + <MenuItem Header="{x:Static Properties:ResourcesUI.LogView_CopyClipboard}" cal:Message.Attach="[Event Click] = [Action CopyLog]" > + <MenuItem.Icon> + <Image Width="16" Source="../Images/copy.png" /> + </MenuItem.Icon> + </MenuItem> + <MenuItem Header="{x:Static Properties:ResourcesUI.LogView_OpenLogDir}" cal:Message.Attach="[Event Click] = [Action OpenLogDirectory]"> + <MenuItem.Icon> + <Image Width="16" Source="../Images/folder.png" /> + </MenuItem.Icon> + </MenuItem> + </ContextMenu> + </TextBox.ContextMenu> + </TextBox> + </TabItem> </TabControl> </Grid> |