diff options
author | sr55 <[email protected]> | 2019-12-29 21:08:24 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2019-12-29 21:08:24 +0000 |
commit | ba012a53f4770ce2c70908a72b577fbbe9e8bd39 (patch) | |
tree | 90a5e57b23869889dfb9973d6ba22f1deef098f7 | |
parent | 282b04f2fe39205664fbccc81aaab1048294811c (diff) |
WinGui: Improve "Send File To". It's arguments text box now accepts "{source}" and "{destination}" as parameters. #2544
7 files changed, 32 insertions, 61 deletions
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs index 7a93220b5..ad1c26bdb 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs @@ -3572,6 +3572,15 @@ namespace HandBrakeWPF.Properties { } /// <summary> + /// Looks up a localized string similar to Replacement Placeholders: {source} {destination}. + /// </summary> + public static string OptionsView_SendFileToArgPlaceholders { + get { + return ResourceManager.GetString("OptionsView_SendFileToArgPlaceholders", resourceCulture); + } + } + + /// <summary> /// Looks up a localized string similar to Click 'Browse' to set the default location. /// </summary> public static string OptionsView_SetDefaultLocationOutputFIle { diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx index 193dca52a..a23927894 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.resx @@ -2181,4 +2181,8 @@ Where supported, any user presets will have been imported.</value> <data name="Options_Experimental" xml:space="preserve">
<value>Experimental</value>
</data>
+ <data name="OptionsView_SendFileToArgPlaceholders" xml:space="preserve">
+ <value>Replacement Placeholders: {source} {destination}</value>
+ <comment>Note: {source} and {destination} are not translatable. </comment>
+ </data>
</root>
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Services/Encode/EventArgs/EncodeCompletedEventArgs.cs b/win/CS/HandBrakeWPF/Services/Encode/EventArgs/EncodeCompletedEventArgs.cs index 1f2fe3bb0..5c8b95b46 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/EventArgs/EncodeCompletedEventArgs.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/EventArgs/EncodeCompletedEventArgs.cs @@ -16,65 +16,29 @@ namespace HandBrakeWPF.Services.Encode.EventArgs /// </summary> public class EncodeCompletedEventArgs : EventArgs { - /// <summary> - /// Initializes a new instance of the <see cref="EncodeCompletedEventArgs"/> class. - /// </summary> - /// <param name="sucessful"> - /// The sucessful. - /// </param> - /// <param name="exception"> - /// The exception. - /// </param> - /// <param name="errorInformation"> - /// The error information. - /// </param> - /// <param name="filename"> - /// The filename. - /// </param> - /// <param name="logPath"> - /// The path and filename of the log for this encode. - /// </param> - /// <param name="finalSizeInBytes"> - /// The final size of the file in bytes. - /// </param> - public EncodeCompletedEventArgs(bool sucessful, Exception exception, string errorInformation, string filename, string logPath, long finalSizeInBytes) + public EncodeCompletedEventArgs(bool sucessful, Exception exception, string errorInformation, string sourceFileName, string filename, string logPath, long finalSizeInBytes) { this.Successful = sucessful; this.Exception = exception; this.ErrorInformation = errorInformation; + this.SourceFileName = sourceFileName; this.FileName = filename; this.ActivityLogPath = logPath; this.FinalFilesizeInBytes = finalSizeInBytes; } - /// <summary> - /// Gets or sets the file name. - /// </summary> public string FileName { get; private set; } - /// <summary> - /// Gets or sets a value indicating whether Successful. - /// </summary> public bool Successful { get; private set; } - /// <summary> - /// Gets or sets Exception. - /// </summary> public Exception Exception { get; private set; } - /// <summary> - /// Gets or sets ErrorInformation. - /// </summary> public string ErrorInformation { get; private set; } - /// <summary> - /// - /// </summary> + public string SourceFileName { get; private set; } + public string ActivityLogPath { get; private set; } - /// <summary> - /// Final filesize in bytes - /// </summary> public long FinalFilesizeInBytes { get; private set; } } } diff --git a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs index eb24d721e..417d77855 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs @@ -130,7 +130,7 @@ namespace HandBrakeWPF.Services.Encode this.IsEncoding = false; this.ServiceLogMessage("Failed to start encoding ..." + Environment.NewLine + exc); - this.InvokeEncodeCompleted(new EventArgs.EncodeCompletedEventArgs(false, exc, "Unable to start encoding", task.Source, null, 0)); + this.InvokeEncodeCompleted(new EventArgs.EncodeCompletedEventArgs(false, exc, "Unable to start encoding", this.currentTask.Source, this.currentTask.Destination, null, 0)); } } @@ -256,8 +256,8 @@ namespace HandBrakeWPF.Services.Encode // Raise the Encode Completed Event. this.InvokeEncodeCompleted( e.Error - ? new EventArgs.EncodeCompletedEventArgs(false, null, string.Empty, this.currentTask.Destination, hbLog, filesize) - : new EventArgs.EncodeCompletedEventArgs(true, null, string.Empty, this.currentTask.Destination, hbLog, filesize)); + ? new EventArgs.EncodeCompletedEventArgs(false, null, string.Empty, this.currentTask.Source, this.currentTask.Destination, hbLog, filesize) + : new EventArgs.EncodeCompletedEventArgs(true, null, string.Empty, this.currentTask.Source, this.currentTask.Destination, hbLog, filesize)); } private long GetFilesize(string destination) diff --git a/win/CS/HandBrakeWPF/Services/PrePostActionService.cs b/win/CS/HandBrakeWPF/Services/PrePostActionService.cs index 636f82d7b..e8118f2a3 100644 --- a/win/CS/HandBrakeWPF/Services/PrePostActionService.cs +++ b/win/CS/HandBrakeWPF/Services/PrePostActionService.cs @@ -83,7 +83,7 @@ namespace HandBrakeWPF.Services // Send the file to the users requested application
if (e.Successful)
{
- this.SendToApplication(e.FileName);
+ this.SendToApplication(e.SourceFileName, e.FileName);
}
if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.PlaySoundWhenDone))
@@ -174,28 +174,21 @@ namespace HandBrakeWPF.Services }
}
- /// <summary>
- /// Send a file to a 3rd party application after encoding has completed.
- /// </summary>
- /// <param name="file">
- /// The file path
- /// </param>
- private void SendToApplication(string file)
+ private void SendToApplication(string source, string destination)
{
if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.SendFile) &&
!string.IsNullOrEmpty(this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileTo)))
{
- string args = string.Format(
- "{0} \"{1}\"",
- this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileToArgs),
- file);
- var destination =
- new ProcessStartInfo(
- this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileTo), args);
+ string arguments = this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileToArgs);
+
+ arguments = arguments.Replace("{source}", string.Format("\"{0}\"", source));
+ arguments = arguments.Replace("{destination}", string.Format("\"{0}\"", destination));
+
+ var process = new ProcessStartInfo(this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileTo), arguments);
- this.ServiceLogMessage(string.Format("Sending output file to: {0}, with arguments: {1} ", destination, args));
+ this.ServiceLogMessage(string.Format("Sending output file to: {0}, with arguments: {1} ", destination, arguments));
- Process.Start(destination);
+ Process.Start(process);
}
}
diff --git a/win/CS/HandBrakeWPF/Services/Queue/QueueService.cs b/win/CS/HandBrakeWPF/Services/Queue/QueueService.cs index cf7f642c2..477aacba3 100644 --- a/win/CS/HandBrakeWPF/Services/Queue/QueueService.cs +++ b/win/CS/HandBrakeWPF/Services/Queue/QueueService.cs @@ -509,7 +509,7 @@ namespace HandBrakeWPF.Services.Queue if (!Directory.Exists(Path.GetDirectoryName(job.Task.Destination))) { - this.EncodeServiceEncodeCompleted(null, new EncodeCompletedEventArgs(false, null, "Destination Directory Missing", null, null, 0)); + this.EncodeServiceEncodeCompleted(null, new EncodeCompletedEventArgs(false, null, "Destination Directory Missing", null, null, null, 0)); this.BackupQueue(string.Empty); return; } diff --git a/win/CS/HandBrakeWPF/Views/OptionsView.xaml b/win/CS/HandBrakeWPF/Views/OptionsView.xaml index 479e4c7e4..5f8634411 100644 --- a/win/CS/HandBrakeWPF/Views/OptionsView.xaml +++ b/win/CS/HandBrakeWPF/Views/OptionsView.xaml @@ -268,6 +268,7 @@ <TextBlock VerticalAlignment="Center" Margin="25,0,5,0" Text="{x:Static Properties:Resources.Options_Arguments}" />
<TextBox Name="SendToArguments" Text="{Binding Arguments}" Width="250" />
</StackPanel>
+ <TextBlock Text="{x:Static Properties:Resources.OptionsView_SendFileToArgPlaceholders}" />
</StackPanel>
<TextBlock Text="{x:Static Properties:Resources.Options_Notifications}" FontSize="14" Margin="0,10,0,10" />
|