summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF
diff options
context:
space:
mode:
authorsr55 <[email protected]>2019-05-22 20:20:49 +0100
committersr55 <[email protected]>2019-05-22 20:20:49 +0100
commitc976c8399a041d4a75f713ea6dfc4be7c20a222a (patch)
tree5691e74cde6a4678f498d19330bbbef9e6a69186 /win/CS/HandBrakeWPF
parentaed187e1b8e8d29d23dea695f80924a6d28bce2d (diff)
WinGui: Add Preference to perform the When Done Action immediately without the 60 second prompt. (off by default)
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r--win/CS/HandBrakeWPF/Properties/Resources.Designer.cs9
-rw-r--r--win/CS/HandBrakeWPF/Properties/Resources.resx3
-rw-r--r--win/CS/HandBrakeWPF/Services/PrePostActionService.cs13
-rw-r--r--win/CS/HandBrakeWPF/UserSettingConstants.cs1
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs49
-rw-r--r--win/CS/HandBrakeWPF/Views/OptionsView.xaml28
-rw-r--r--win/CS/HandBrakeWPF/defaultsettings.xml9
7 files changed, 85 insertions, 27 deletions
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
index e67762dc5..60aa0c287 100644
--- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
+++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
@@ -2851,6 +2851,15 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
+ /// Looks up a localized string similar to Perform action immediately. (This will disable the 60 second confirmation dialog).
+ /// </summary>
+ public static string Options_PromptBeforeAction {
+ get {
+ return ResourceManager.GetString("Options_PromptBeforeAction", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Prefer use of Intel QuickSync for decoding video when available. .
/// </summary>
public static string Options_QsvDecode {
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx
index 4aa9ec7fb..86df442ca 100644
--- a/win/CS/HandBrakeWPF/Properties/Resources.resx
+++ b/win/CS/HandBrakeWPF/Properties/Resources.resx
@@ -1996,4 +1996,7 @@ Non-Live Options: {date} {time} {creation-date} {creation-time} {quality} {bitra
Where supported, any user presets will have been imported.</value>
</data>
+ <data name="Options_PromptBeforeAction" xml:space="preserve">
+ <value>Perform action immediately. (This will disable the 60 second confirmation dialog)</value>
+ </data>
</root> \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Services/PrePostActionService.cs b/win/CS/HandBrakeWPF/Services/PrePostActionService.cs
index 20a6c39a8..44d20dfa4 100644
--- a/win/CS/HandBrakeWPF/Services/PrePostActionService.cs
+++ b/win/CS/HandBrakeWPF/Services/PrePostActionService.cs
@@ -141,15 +141,20 @@ namespace HandBrakeWPF.Services
}
// Give the user the ability to cancel the shutdown. Default 60 second timer.
- ICountdownAlertViewModel titleSpecificView = IoC.Get<ICountdownAlertViewModel>();
- Execute.OnUIThread(
- () =>
+ bool isCancelled = false;
+ if (!this.userSettingService.GetUserSetting<bool>(UserSettingConstants.WhenDonePerformActionImmediately))
+ {
+ ICountdownAlertViewModel titleSpecificView = IoC.Get<ICountdownAlertViewModel>();
+ Execute.OnUIThread(
+ () =>
{
titleSpecificView.SetAction(this.userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction));
this.windowManager.ShowDialog(titleSpecificView);
+ isCancelled = titleSpecificView.IsCancelled;
});
+ }
- if (!titleSpecificView.IsCancelled)
+ if (!isCancelled)
{
// Do something when the encode ends.
switch (this.userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction))
diff --git a/win/CS/HandBrakeWPF/UserSettingConstants.cs b/win/CS/HandBrakeWPF/UserSettingConstants.cs
index 07019e567..014c9ef23 100644
--- a/win/CS/HandBrakeWPF/UserSettingConstants.cs
+++ b/win/CS/HandBrakeWPF/UserSettingConstants.cs
@@ -71,5 +71,6 @@ namespace HandBrakeWPF
public const string FileOverwriteBehaviour = "FileOverwriteBehaviour";
public const string AutonameFileCollisionBehaviour = "AutonameFileCollisionBehaviour";
public const string AutonameFilePrePostString = "AutonameFilePrePostString";
+ public const string WhenDonePerformActionImmediately = "WhenDonePerformActionImmediately";
}
} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
index 3090a8144..06500c309 100644
--- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
@@ -107,10 +107,9 @@ namespace HandBrakeWPF.ViewModels
private bool showAddAllToQueue;
private int selectedOverwriteBehaviour;
private int selectedCollisionBehaviour;
-
private string prePostFilenameText;
-
private bool showPrePostFilenameBox;
+ private bool whenDonePerformActionImmediately;
#endregion
@@ -381,6 +380,17 @@ namespace HandBrakeWPF.ViewModels
}
}
+ public bool WhenDonePerformActionImmediately
+ {
+ get => this.whenDonePerformActionImmediately;
+ set
+ {
+ if (value == this.whenDonePerformActionImmediately) return;
+ this.whenDonePerformActionImmediately = value;
+ this.NotifyOfPropertyChange(() => this.WhenDonePerformActionImmediately);
+ }
+ }
+
/// <summary>
/// Gets or sets a value indicating whether show queue inline.
/// </summary>
@@ -1428,6 +1438,16 @@ namespace HandBrakeWPF.ViewModels
this.CheckForUpdatesFrequency = 1;
}
+ this.ShowQueueInline = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowQueueInline);
+ this.ShowStatusInTitleBar = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowStatusInTitleBar);
+ this.ShowPreviewOnSummaryTab = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowPreviewOnSummaryTab);
+ this.ShowAddAllToQueue = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowAddAllToQueue);
+ this.ShowAddSelectionToQueue = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowAddSelectionToQueue);
+
+ // #############################
+ // When Done
+ // #############################
+
// On Encode Completion Action
this.whenDoneOptions.Clear();
this.whenDoneOptions.Add("Do nothing");
@@ -1437,7 +1457,8 @@ namespace HandBrakeWPF.ViewModels
this.whenDoneOptions.Add("Lock System");
this.whenDoneOptions.Add("Log off");
this.whenDoneOptions.Add("Quit HandBrake");
- this.WhenDone = userSettingService.GetUserSetting<string>("WhenCompleteAction");
+
+ this.WhenDone = userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction);
if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ResetWhenDoneAction))
{
this.WhenDone = "Do nothing";
@@ -1448,17 +1469,12 @@ namespace HandBrakeWPF.ViewModels
this.SendFileToPath = this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileTo) ?? string.Empty;
this.Arguments = this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileToArgs) ?? string.Empty;
this.ResetWhenDoneAction = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ResetWhenDoneAction);
- this.ShowQueueInline = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowQueueInline);
- this.ShowStatusInTitleBar = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowStatusInTitleBar);
- this.ShowPreviewOnSummaryTab = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowPreviewOnSummaryTab);
+ this.WhenDonePerformActionImmediately = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.WhenDonePerformActionImmediately);
this.WhenDoneAudioFile = Path.GetFileNameWithoutExtension(this.userSettingService.GetUserSetting<string>(UserSettingConstants.WhenDoneAudioFile)) ?? string.Empty;
this.WhenDoneAudioFileFullPath = this.userSettingService.GetUserSetting<string>(UserSettingConstants.WhenDoneAudioFile);
this.PlaySoundWhenDone = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.PlaySoundWhenDone);
this.PlaySoundWhenQueueDone = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.PlaySoundWhenQueueDone);
- this.ShowAddAllToQueue = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowAddAllToQueue);
- this.ShowAddSelectionToQueue = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowAddSelectionToQueue);
-
// #############################
// Output Settings
// #############################
@@ -1624,16 +1640,12 @@ namespace HandBrakeWPF.ViewModels
/* General */
this.userSettingService.SetUserSetting(UserSettingConstants.UpdateStatus, this.CheckForUpdates);
this.userSettingService.SetUserSetting(UserSettingConstants.DaysBetweenUpdateCheck, this.CheckForUpdatesFrequency);
- this.userSettingService.SetUserSetting(UserSettingConstants.WhenCompleteAction, this.WhenDone);
this.userSettingService.SetUserSetting(UserSettingConstants.SendFileTo, this.SendFileToPath);
this.userSettingService.SetUserSetting(UserSettingConstants.SendFile, this.SendFileAfterEncode);
this.userSettingService.SetUserSetting(UserSettingConstants.SendFileToArgs, this.Arguments);
- this.userSettingService.SetUserSetting(UserSettingConstants.ResetWhenDoneAction, this.ResetWhenDoneAction);
this.userSettingService.SetUserSetting(UserSettingConstants.ShowStatusInTitleBar, this.ShowStatusInTitleBar);
this.userSettingService.SetUserSetting(UserSettingConstants.ShowPreviewOnSummaryTab, this.ShowPreviewOnSummaryTab);
- this.userSettingService.SetUserSetting(UserSettingConstants.PlaySoundWhenDone, this.PlaySoundWhenDone);
- this.userSettingService.SetUserSetting(UserSettingConstants.PlaySoundWhenQueueDone, this.PlaySoundWhenQueueDone);
- this.userSettingService.SetUserSetting(UserSettingConstants.WhenDoneAudioFile, this.WhenDoneAudioFileFullPath);
+
this.userSettingService.SetUserSetting(UserSettingConstants.UiLanguage, this.SelectedLanguage?.Culture);
this.userSettingService.SetUserSetting(UserSettingConstants.ShowAddAllToQueue, this.ShowAddAllToQueue);
this.userSettingService.SetUserSetting(UserSettingConstants.ShowAddSelectionToQueue, this.ShowAddSelectionToQueue);
@@ -1641,6 +1653,15 @@ namespace HandBrakeWPF.ViewModels
/* Experiments */
this.userSettingService.SetUserSetting(UserSettingConstants.ShowQueueInline, this.ShowQueueInline);
+ /* When Done */
+ this.userSettingService.SetUserSetting(UserSettingConstants.WhenCompleteAction, this.WhenDone);
+ this.userSettingService.SetUserSetting(UserSettingConstants.ResetWhenDoneAction, this.ResetWhenDoneAction);
+ this.userSettingService.SetUserSetting(UserSettingConstants.WhenDonePerformActionImmediately, this.WhenDonePerformActionImmediately);
+ this.userSettingService.SetUserSetting(UserSettingConstants.PlaySoundWhenDone, this.PlaySoundWhenDone);
+ this.userSettingService.SetUserSetting(UserSettingConstants.PlaySoundWhenQueueDone, this.PlaySoundWhenQueueDone);
+ this.userSettingService.SetUserSetting(UserSettingConstants.WhenDoneAudioFile, this.WhenDoneAudioFileFullPath);
+
+
/* Output Files */
this.userSettingService.SetUserSetting(UserSettingConstants.AutoNaming, this.AutomaticallyNameFiles);
this.userSettingService.SetUserSetting(UserSettingConstants.AutoNameFormat, this.AutonameFormat);
diff --git a/win/CS/HandBrakeWPF/Views/OptionsView.xaml b/win/CS/HandBrakeWPF/Views/OptionsView.xaml
index 2357ba925..c5cfa5eba 100644
--- a/win/CS/HandBrakeWPF/Views/OptionsView.xaml
+++ b/win/CS/HandBrakeWPF/Views/OptionsView.xaml
@@ -226,16 +226,28 @@
<TextBlock Text="{x:Static Properties:Resources.Options_WhenDone}" FontSize="20" FontFamily="Segoe UI Light" />
<TextBlock Text="{x:Static Properties:Resources.Options_QueueCompleted}" FontSize="14" Margin="0,10,0,10" />
- <StackPanel Orientation="Vertical" Margin="0,0,0,10">
- <StackPanel Orientation="Vertical" Margin="20,0,0,0">
- <StackPanel Orientation="Horizontal">
- <TextBlock Text="{x:Static Properties:Resources.Options_WhenDoneColon}" />
- <ComboBox Name="whenDone" ItemsSource="{Binding WhenDoneOptions}" SelectedItem="{Binding WhenDone}" Width="120" HorizontalAlignment="Left" />
- <CheckBox Content="{x:Static Properties:Resources.Options_ResetDoNothing}" VerticalAlignment="Center" Margin="5,0,0,0" IsChecked="{Binding ResetWhenDoneAction}" />
- </StackPanel>
- </StackPanel>
+ <StackPanel Orientation="Vertical" Margin="0,0,0,10">
+ <Grid Margin="20,0,0,0">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+
+ <TextBlock Text="{x:Static Properties:Resources.Options_WhenDoneColon}" Grid.Row="0" Grid.Column="0" />
+ <ComboBox Name="whenDone" ItemsSource="{Binding WhenDoneOptions}" SelectedItem="{Binding WhenDone}" Width="120" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="1" />
+ <CheckBox Content="{x:Static Properties:Resources.Options_ResetDoNothing}" VerticalAlignment="Center" Margin="0,5,0,0" Grid.Row="1" Grid.Column="1"
+ IsChecked="{Binding ResetWhenDoneAction}" />
+ <CheckBox Content="{x:Static Properties:Resources.Options_PromptBeforeAction}" VerticalAlignment="Center" Margin="0,5,0,0" Grid.Row="2" Grid.Column="1"
+ IsChecked="{Binding WhenDonePerformActionImmediately}" />
+ </Grid>
+
<TextBlock Text="{x:Static Properties:Resources.Options_EncodeCompleted}" FontSize="14" Margin="0,10,0,10" />
<StackPanel Orientation="Vertical" Margin="20,0,0,0">
diff --git a/win/CS/HandBrakeWPF/defaultsettings.xml b/win/CS/HandBrakeWPF/defaultsettings.xml
index 8bcf3f882..dd7ef6abe 100644
--- a/win/CS/HandBrakeWPF/defaultsettings.xml
+++ b/win/CS/HandBrakeWPF/defaultsettings.xml
@@ -545,5 +545,12 @@
<anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:string" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">output_</anyType>
</value>
</item>
-
+ <item>
+ <key>
+ <string>WhenDonePerformActionImmediately</string>
+ </key>
+ <value>
+ <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:boolean" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">false</anyType>
+ </value>
+ </item>
</dictionary> \ No newline at end of file