diff options
author | sr55 <[email protected]> | 2012-07-08 15:57:58 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2012-07-08 15:57:58 +0000 |
commit | aea2c5f0a32428671182a5e9d680ab4c016fce2c (patch) | |
tree | 39ae475bc274cb2ecf5099c6ddb98bc44e7d0e66 /win | |
parent | da44aa82136fb9423f041b200b3e40632b8287e7 (diff) |
WinGui: Initial work to restore queue editing functionality. (Note, it's not complete yet)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4821 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
24 files changed, 387 insertions, 132 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs index cdd436b03..f6b57b1e3 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs @@ -147,39 +147,15 @@ namespace HandBrake.ApplicationServices.Model /// </summary>
public PointToPointMode PointToPointMode { get; set; }
- private int startPoint;
-
/// <summary>
/// Gets or sets StartPoint.
/// </summary>
- public int StartPoint
- {
- get
- {
- return this.startPoint;
- }
- set
- {
- this.startPoint = value;
- }
- }
-
- private int endPoint;
+ public int StartPoint { get; set; }
/// <summary>
/// Gets or sets EndPoint.
/// </summary>
- public int EndPoint
- {
- get
- {
- return this.endPoint;
- }
- set
- {
- this.endPoint = value;
- }
- }
+ public int EndPoint { get; set; }
#endregion
diff --git a/win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs b/win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs index 0e06ca5c6..15f158381 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs @@ -11,6 +11,8 @@ namespace HandBrake.ApplicationServices.Model {
using Caliburn.Micro;
+ using HandBrake.ApplicationServices.Parsing;
+
/// <summary>
/// The QueueTask.
/// </summary>
@@ -28,6 +30,11 @@ namespace HandBrake.ApplicationServices.Model #region Properties
/// <summary>
+ /// Gets or sets ScannedSource.
+ /// </summary>
+ public Source ScannedSource { get; set; }
+
+ /// <summary>
/// Gets or sets a value indicating whether if this is a user or GUI generated query
/// </summary>
public bool CustomQuery { get; set; }
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs index 3ad25c583..cd69084eb 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs @@ -84,7 +84,10 @@ namespace HandBrake.ApplicationServices.Services.Interfaces /// <param name="previewCount">
/// The preview Count.
/// </param>
- void Scan(string sourcePath, int title, int previewCount);
+ /// <param name="postAction">
+ /// The post Action.
+ /// </param>
+ void Scan(string sourcePath, int title, int previewCount, Action<bool> postAction);
/// <summary>
/// Kill the scan
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs index 8fe7affc6..4957a62bb 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs @@ -141,7 +141,10 @@ namespace HandBrake.ApplicationServices.Services /// <param name="previewCount">
/// The preview Count.
/// </param>
- public void Scan(string sourcePath, int title, int previewCount)
+ /// <param name="postAction">
+ /// The post Action.
+ /// </param>
+ public void Scan(string sourcePath, int title, int previewCount, Action<bool> postAction)
{
Thread t = new Thread(unused => this.ScanSource(sourcePath, title, previewCount));
t.Start();
diff --git a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs index 742a46b08..5eb1f0a37 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs @@ -124,9 +124,12 @@ namespace HandBrake.ApplicationServices.Services /// <param name="previewCount">
/// The preview Count.
/// </param>
- public void Scan(string sourcePath, int title, int previewCount)
+ /// <param name="postScanAction">
+ /// The post Scan Action.
+ /// </param>
+ public void Scan(string sourcePath, int title, int previewCount, Action<bool> postScanAction)
{
- Thread t = new Thread(unused => this.ScanSource(sourcePath, title, previewCount));
+ Thread t = new Thread(unused => this.ScanSource(sourcePath, title, previewCount, postScanAction));
t.Start();
}
@@ -195,7 +198,10 @@ namespace HandBrake.ApplicationServices.Services /// <param name="previewCount">
/// The preview Count.
/// </param>
- private void ScanSource(object sourcePath, int title, int previewCount)
+ /// <param name="postScanAction">
+ /// The post Scan Action. Disables the Scan Completed Event
+ /// </param>
+ private void ScanSource(object sourcePath, int title, int previewCount, Action<bool> postScanAction)
{
try
{
@@ -292,17 +298,34 @@ namespace HandBrake.ApplicationServices.Services this.IsScanning = false;
- if (this.ScanCompleted != null)
+
+ if (postScanAction != null)
{
- this.ScanCompleted(this, new ScanCompletedEventArgs(true, null, string.Empty));
+ postScanAction(true);
+ }
+ else
+ {
+ if (this.ScanCompleted != null)
+ {
+ this.ScanCompleted(this, new ScanCompletedEventArgs(true, null, string.Empty));
+ }
}
}
catch (Exception exc)
{
this.Stop();
- if (this.ScanCompleted != null)
- this.ScanCompleted(this, new ScanCompletedEventArgs(false, exc, "An Error has occured in ScanService.ScanSource()"));
+ if (postScanAction != null)
+ {
+ postScanAction(false);
+ }
+ else
+ {
+ if (this.ScanCompleted != null)
+ {
+ this.ScanCompleted(this, new ScanCompletedEventArgs(false, exc, "An Error has occured in ScanService.ScanSource()"));
+ }
+ }
}
}
diff --git a/win/CS/HandBrakeWPF/Converters/Audio/AudioQueueDisplayConverter.cs b/win/CS/HandBrakeWPF/Converters/Audio/AudioQueueDisplayConverter.cs index d3440e265..624e40a57 100644 --- a/win/CS/HandBrakeWPF/Converters/Audio/AudioQueueDisplayConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/Audio/AudioQueueDisplayConverter.cs @@ -45,7 +45,7 @@ namespace HandBrakeWPF.Converters.Audio }
else
{
- audioTracks.Append( "," + EnumHelper<AudioEncoder>.GetDisplay(track.Encoder));
+ audioTracks.Append(", " + EnumHelper<AudioEncoder>.GetDisplay(track.Encoder));
}
}
}
diff --git a/win/CS/HandBrakeWPF/Converters/Subtitles/SubtitlesQueueDisplayConverter.cs b/win/CS/HandBrakeWPF/Converters/Subtitles/SubtitlesQueueDisplayConverter.cs new file mode 100644 index 000000000..e30967ae3 --- /dev/null +++ b/win/CS/HandBrakeWPF/Converters/Subtitles/SubtitlesQueueDisplayConverter.cs @@ -0,0 +1,67 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SubtitlesQueueDisplayConverter.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// Subtitle Queue Display Converter
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Converters.Subtitles
+{
+ using System;
+ using System.Collections.ObjectModel;
+ using System.Globalization;
+ using System.Text;
+ using System.Windows.Data;
+
+ using HandBrake.ApplicationServices.Model.Encoding;
+
+ /// <summary>
+ /// Subtitle Queue Display Converter
+ /// </summary>
+ public class SubtitlesQueueDisplayConverter : IValueConverter
+ {
+ /// <summary>
+ /// Converts a value.
+ /// </summary>
+ /// <returns>
+ /// A converted value. If the method returns null, the valid null value is used.
+ /// </returns>
+ /// <param name="value">The value produced by the binding source.</param><param name="targetType">The type of the binding target property.</param><param name="parameter">The converter parameter to use.</param><param name="culture">The culture to use in the converter.</param>
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ ObservableCollection<SubtitleTrack> tracks = value as ObservableCollection<SubtitleTrack>;
+ StringBuilder audioTracks = new StringBuilder();
+ if (tracks != null)
+ {
+ foreach (SubtitleTrack track in tracks)
+ {
+ string text = track.SourceTrack != null ? track.SourceTrack.ToString() : (track.SrtFileName + ".srt");
+ if (string.IsNullOrEmpty(audioTracks.ToString()))
+ {
+ audioTracks.Append(text);
+ }
+ else
+ {
+ audioTracks.Append(", " + text);
+ }
+ }
+ }
+
+ return string.IsNullOrEmpty(audioTracks.ToString()) ? "None" : audioTracks.ToString();
+ }
+
+ /// <summary>
+ /// Converts a value.
+ /// </summary>
+ /// <returns>
+ /// A converted value. If the method returns null, the valid null value is used.
+ /// </returns>
+ /// <param name="value">The value that is produced by the binding target.</param><param name="targetType">The type to convert to.</param><param name="parameter">The converter parameter to use.</param><param name="culture">The culture to use in the converter.</param>
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index 7ef57cd74..2a10df83a 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -123,6 +123,7 @@ <Compile Include="Converters\Audio\AudioQueueDisplayConverter.cs" />
<Compile Include="Converters\BooleanToHiddenVisibilityConverter.cs" />
<Compile Include="Converters\Options\OptionsTabConverter.cs" />
+ <Compile Include="Converters\Subtitles\SubtitlesQueueDisplayConverter.cs" />
<Compile Include="Converters\Video\VideoEncoderConverter.cs" />
<Compile Include="Model\ShellWindow.cs" />
<Compile Include="Model\UpdateCheckInformation.cs" />
@@ -152,10 +153,8 @@ <Compile Include="Helpers\QueueRecoveryHelper.cs" />
<Compile Include="Model\AdvancedChoice.cs" />
<Compile Include="Services\ErrorService.cs" />
- <Compile Include="Services\Interfaces\IJobContextService.cs" />
<Compile Include="Services\Interfaces\IErrorService.cs" />
<Compile Include="Services\Interfaces\IUpdateVersionService.cs" />
- <Compile Include="Services\JobContextService.cs" />
<Compile Include="Services\UpdateVersionService.cs" />
<Compile Include="Startup\CastleBootstrapper.cs" />
<Compile Include="Startup\MefBootstrapper.cs" />
diff --git a/win/CS/HandBrakeWPF/Services/Interfaces/IJobContextService.cs b/win/CS/HandBrakeWPF/Services/Interfaces/IJobContextService.cs deleted file mode 100644 index d1301026b..000000000 --- a/win/CS/HandBrakeWPF/Services/Interfaces/IJobContextService.cs +++ /dev/null @@ -1,30 +0,0 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="IJobContextService.cs" company="HandBrake Project (http://handbrake.fr)">
-// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
-// </copyright>
-// <summary>
-// Defines the IJobContextService type.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrakeWPF.Services.Interfaces
-{
- using HandBrake.ApplicationServices.Model;
- using HandBrake.ApplicationServices.Parsing;
-
- /// <summary>
- /// A Context service for the current Job Information
- /// </summary>
- public interface IJobContextService
- {
- /// <summary>
- /// Gets or sets CurrentTask.
- /// </summary>
- EncodeTask CurrentTask { get; set; }
-
- /// <summary>
- /// Gets or sets CurrentSource.
- /// </summary>
- Source CurrentSource { get; set; }
- }
-}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Services/JobContextService.cs b/win/CS/HandBrakeWPF/Services/JobContextService.cs deleted file mode 100644 index b5f3060a5..000000000 --- a/win/CS/HandBrakeWPF/Services/JobContextService.cs +++ /dev/null @@ -1,32 +0,0 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="JobContextService.cs" company="HandBrake Project (http://handbrake.fr)">
-// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
-// </copyright>
-// <summary>
-// Defines the JobContextService type.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrakeWPF.Services
-{
- using HandBrake.ApplicationServices.Model;
- using HandBrake.ApplicationServices.Parsing;
-
- using HandBrakeWPF.Services.Interfaces;
-
- /// <summary>
- /// A Context service for the current Job Information.
- /// </summary>
- public class JobContextService : IJobContextService
- {
- /// <summary>
- /// Gets or sets CurrentTask.
- /// </summary>
- public EncodeTask CurrentTask { get; set; }
-
- /// <summary>
- /// Gets or sets CurrentSource.
- /// </summary>
- public Source CurrentSource { get; set; }
- }
-}
diff --git a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs index e929047ea..632b93877 100644 --- a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs +++ b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs @@ -66,7 +66,6 @@ namespace HandBrakeWPF.Startup this.windsorContainer.Register(Component.For<IAboutViewModel>().ImplementedBy<AboutViewModel>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<IOptionsViewModel>().ImplementedBy<OptionsViewModel>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<IUpdateVersionService>().ImplementedBy<UpdateVersionService>().LifeStyle.Is(LifestyleType.Singleton));
- this.windsorContainer.Register(Component.For<IJobContextService>().ImplementedBy<JobContextService>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<ITitleSpecificViewModel>().ImplementedBy<TitleSpecificViewModel>().LifeStyle.Is(LifestyleType.Singleton));
// Tab Components
diff --git a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs index 39861bce7..2a0425114 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs @@ -954,6 +954,19 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// Update all the UI controls based on the encode task passed in.
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void UpdateTask(EncodeTask task)
+ {
+ this.Task = task;
+ this.SetEncoder(task.VideoEncoder);
+ this.AdvancedOptionsString = task.AdvancedEncoderOptions;
+ }
+
+ /// <summary>
/// Setup this window for a new source
/// </summary>
/// <param name="title">
diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs index 06bd20326..03e779665 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs @@ -185,6 +185,19 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// Update all the UI controls based on the encode task passed in.
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void UpdateTask(EncodeTask task)
+ {
+ this.Task = task;
+ this.NotifyOfPropertyChange(() => Task.AudioTracks);
+ this.NotifyOfPropertyChange(() => this.Task);
+ }
+
+ /// <summary>
/// Set the Source Title
/// </summary>
/// <param name="title">
diff --git a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs index cbd6e8441..586167840 100644 --- a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs @@ -227,6 +227,20 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// Update all the UI controls based on the encode task passed in.
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void UpdateTask(EncodeTask task)
+ {
+ this.Task = task;
+
+ this.NotifyOfPropertyChange(() => this.Task.IncludeChapterMarkers);
+ this.NotifyOfPropertyChange(() => this.Task.ChapterNames);
+ }
+
+ /// <summary>
/// Set the Source Chapters List
/// </summary>
/// <param name="sourceChapters">
diff --git a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs index 92d069698..e6a93a41b 100644 --- a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs @@ -373,6 +373,29 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// Update all the UI controls based on the encode task passed in.
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void UpdateTask(EncodeTask task)
+ {
+ this.CurrentTask = task;
+
+ this.NotifyOfPropertyChange(() => this.SelectedDenoise);
+ this.NotifyOfPropertyChange(() => this.SelectedDecomb);
+ this.NotifyOfPropertyChange(() => this.SelectedDeInterlace);
+ this.NotifyOfPropertyChange(() => this.SelectedDetelecine);
+ this.NotifyOfPropertyChange(() => this.Grayscale);
+ this.NotifyOfPropertyChange(() => this.DeblockValue);
+
+ this.NotifyOfPropertyChange(() => this.CustomDecomb);
+ this.NotifyOfPropertyChange(() => this.CustomDeinterlace);
+ this.NotifyOfPropertyChange(() => this.CustomDetelecine);
+ this.NotifyOfPropertyChange(() => this.CustomDenoise);
+ }
+
+ /// <summary>
/// Setup this window for a new source
/// </summary>
/// <param name="title">
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs index 8f1f6e5a6..079ce3ad5 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs @@ -60,5 +60,13 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// Start an Encode
/// </summary>
void StartEncode();
+
+ /// <summary>
+ /// Edit a Queue Task
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ void EditQueueJob(EncodeTask task);
}
}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ITabInterface.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ITabInterface.cs index b583fba86..42ca560f4 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ITabInterface.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ITabInterface.cs @@ -41,5 +41,13 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// The task.
/// </param>
void SetPreset(Preset preset, EncodeTask task);
+
+ /// <summary>
+ /// Update all the UI controls based on the encode task passed in.
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ void UpdateTask(EncodeTask task);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index d63915624..36a1a0e11 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -147,6 +147,11 @@ namespace HandBrakeWPF.ViewModels /// </summary>
private Preset selectedPreset;
+ /// <summary>
+ /// Queue Edit Task
+ /// </summary>
+ private EncodeTask queueEditTask;
+
#endregion
/// <summary>
@@ -1115,6 +1120,19 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// Edit a Queue Task
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void EditQueueJob(EncodeTask task)
+ {
+ // Rescan the source to make sure it's still valid
+ this.queueEditTask = task;
+ this.scanService.Scan(task.Source, task.Title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount), QueueEditAction);
+ }
+
+ /// <summary>
/// Pause an Encode
/// </summary>
public void PauseEncode()
@@ -1369,6 +1387,44 @@ namespace HandBrakeWPF.ViewModels #region Private Methods
/// <summary>
+ /// Update all the UI Components to allow the user to edit their previous settings.
+ /// </summary>
+ /// <param name="successful">
+ /// The successful.
+ /// </param>
+ private void QueueEditAction(bool successful)
+ {
+ Execute.OnUIThread(() =>
+ {
+ // Copy all the Scan data into the UI
+ this.scanService.SouceData.CopyTo(this.ScannedSource);
+ this.NotifyOfPropertyChange(() => this.ScannedSource);
+ this.NotifyOfPropertyChange(() => this.ScannedSource.Titles);
+
+ // Select the Users Title
+ this.CurrentTask = new EncodeTask(queueEditTask);
+ this.NotifyOfPropertyChange(() => this.CurrentTask);
+ this.SelectedTitle = this.ScannedSource.Titles.FirstOrDefault(t => t.TitleNumber == this.CurrentTask.Title);
+
+ // Update the Main UI control Area (TODO)
+ this.CurrentTask = new EncodeTask(queueEditTask);
+ this.NotifyOfPropertyChange(() => this.CurrentTask);
+
+ // Update the Tab Controls (TODO)
+ this.PictureSettingsViewModel.UpdateTask(this.CurrentTask);
+ this.VideoViewModel.UpdateTask(this.CurrentTask);
+ this.FiltersViewModel.UpdateTask(this.CurrentTask);
+ this.AudioViewModel.UpdateTask(this.CurrentTask);
+ this.SubtitleViewModel.UpdateTask(this.CurrentTask);
+ this.ChaptersViewModel.UpdateTask(this.CurrentTask);
+ this.AdvancedViewModel.UpdateTask(this.CurrentTask);
+
+ // Cleanup
+ this.ShowStatusWindow = false;
+ });
+ }
+
+ /// <summary>
/// Start a Scan
/// </summary>
/// <param name="filename">
@@ -1381,7 +1437,7 @@ namespace HandBrakeWPF.ViewModels {
// TODO
// 1. Disable GUI.
- this.scanService.Scan(filename, title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount));
+ this.scanService.Scan(filename, title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount), null);
}
/// <summary>
@@ -1548,8 +1604,6 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange("ScannedSource.Titles");
this.SelectedTitle = this.ScannedSource.Titles.FirstOrDefault(t => t.MainTitle)
?? this.ScannedSource.Titles.FirstOrDefault();
- this.JobContextService.CurrentSource = this.ScannedSource;
- this.JobContextService.CurrentTask = this.CurrentTask;
this.SetupTabs();
this.ShowStatusWindow = false;
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs index b052a4ba7..e911905d2 100644 --- a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs @@ -640,6 +640,24 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// Update all the UI controls based on the encode task passed in.
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void UpdateTask(EncodeTask task)
+ {
+ this.Task = task;
+ this.NotifyOfPropertyChange(() => this.Width);
+ this.NotifyOfPropertyChange(() => this.Height);
+ this.NotifyOfPropertyChange(() => this.SelectedAnamorphicMode);
+ this.NotifyOfPropertyChange(() => this.SelectedModulus);
+ this.NotifyOfPropertyChange(() => this.DisplayWidth);
+ this.NotifyOfPropertyChange(() => this.ParHeight);
+ this.NotifyOfPropertyChange(() => this.ParWidth);
+ }
+
+ /// <summary>
/// Setup this window for a new source
/// </summary>
/// <param name="title">
diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs index abcf289e5..badb64e17 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs @@ -331,6 +331,33 @@ namespace HandBrakeWPF.ViewModels this.queueProcessor.QueueManager.RestoreQueue(dialog.FileName);
}
+ /// <summary>
+ /// Edit this Job
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void EditJob(QueueTask task)
+ {
+ MessageBoxResult result = this.errorService.ShowMessageBox(
+ "Are you sure you wish to edit this job?\nWARNING!!! This feature is not finished YET! Only part of the job will be copied back!!!",
+ "Modify Job?",
+ MessageBoxButton.YesNo,
+ MessageBoxImage.Question);
+
+ if (result != MessageBoxResult.Yes)
+ {
+ return;
+ }
+
+ // Remove the job if it is not already encoding. Let the user decide if they want to cancel or not.
+ this.RemoveJob(task);
+
+ // Pass a copy of the job back to the Main Screen
+ IMainViewModel mvm = IoC.Get<IMainViewModel>();
+ mvm.EditQueueJob(new EncodeTask(task.Task));
+ }
+
#endregion
#region Methods
diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs index aaf6fa43e..5950bc448 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs @@ -253,6 +253,18 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// Update all the UI controls based on the encode task passed in.
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void UpdateTask(EncodeTask task)
+ {
+ this.Task = task;
+ this.NotifyOfPropertyChange(() => this.Task.SubtitleTracks);
+ }
+
+ /// <summary>
/// Setup this window for a new source
/// </summary>
/// <param name="title">
diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index a520bf202..c5460b0ae 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -487,7 +487,28 @@ namespace HandBrakeWPF.ViewModels // this.X264Profile = preset.Task.x264Profile;
// this.X264Tune = preset.Task.X264Tune;
//}
+ }
+ /// <summary>
+ /// Update all the UI controls based on the encode task passed in.
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void UpdateTask(EncodeTask task)
+ {
+ this.Task = task;
+ this.NotifyOfPropertyChange(() => this.IsConstantFramerate);
+ this.NotifyOfPropertyChange(() => this.IsConstantQuantity);
+ this.NotifyOfPropertyChange(() => this.IsPeakFramerate);
+ this.NotifyOfPropertyChange(() => this.IsVariableFramerate);
+ this.NotifyOfPropertyChange(() => this.SelectedVideoEncoder);
+ this.NotifyOfPropertyChange(() => this.SelectedFramerate);
+ this.NotifyOfPropertyChange(() => this.RF);
+ this.NotifyOfPropertyChange(() => this.DisplayRF);
+ this.NotifyOfPropertyChange(() => this.Task.VideoBitrate);
+ this.NotifyOfPropertyChange(() => this.Task.TwoPass);
+ this.NotifyOfPropertyChange(() => this.Task.TurboFirstPass);
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs b/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs index dd992ef68..ac9098bac 100644 --- a/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs +++ b/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs @@ -75,10 +75,6 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public IUserSettingService UserSettingService { get; set; }
- /// <summary>
- /// Gets or sets JobContextService.
- /// </summary>
- public IJobContextService JobContextService { get; set; }
#endregion
#region Public Methods
diff --git a/win/CS/HandBrakeWPF/Views/QueueView.xaml b/win/CS/HandBrakeWPF/Views/QueueView.xaml index 8b3b31f03..6c64557b1 100644 --- a/win/CS/HandBrakeWPF/Views/QueueView.xaml +++ b/win/CS/HandBrakeWPF/Views/QueueView.xaml @@ -8,7 +8,8 @@ xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:YourNamespace="clr-namespace:HandBrakeWPF.AttachedProperties"
- xmlns:Audio="clr-namespace:HandBrakeWPF.Converters.Audio" Title="{Binding Title}"
+ xmlns:Audio="clr-namespace:HandBrakeWPF.Converters.Audio"
+ xmlns:Subtitles="clr-namespace:HandBrakeWPF.Converters.Subtitles" Title="{Binding Title}"
Width="600"
Height="400"
MinWidth="600"
@@ -24,6 +25,7 @@ <Converters:EnumComboConverter x:Key="enumComboConverter" />
<Converters:QueueStatusToVisibilityConverter x:Key="queueStatusVisConverter" />
<Audio:AudioQueueDisplayConverter x:Key="audioTrackDisplayConverter" />
+ <Subtitles:SubtitlesQueueDisplayConverter x:Key="subtitleTrackDisplayConverter" />
</Window.Resources>
<Grid>
@@ -142,6 +144,7 @@ dd:DragDrop.IsDragSource="True"
dd:DragDrop.IsDropTarget="True"
ItemsSource="{Binding QueueJobs}"
+ SelectedItem="{Binding SelectedJob}"
SelectionMode="Extended">
<ListBox.ContextMenu>
@@ -171,7 +174,12 @@ <TextBlock Margin="10,0,0,0" FontWeight="Bold" Text="Audio: " />
<TextBlock Text="{Binding Task.AudioTracks, Converter={StaticResource audioTrackDisplayConverter}}" />
</StackPanel>
-
+
+ <StackPanel Orientation="Horizontal">
+ <TextBlock FontWeight="Bold" Text="Subtitles: " />
+ <TextBlock Text="{Binding Task.SubtitleTracks, Converter={StaticResource subtitleTrackDisplayConverter}}" />
+ </StackPanel>
+
<StackPanel Orientation="Horizontal">
<TextBlock FontWeight="Bold" Text="Advanced: " />
<TextBlock Text="{Binding Task.AdvancedEncoderOptions}" />
@@ -251,36 +259,61 @@ <Grid Grid.Column="2"
Margin="10,0,10,0"
VerticalAlignment="Center">
- <StackPanel Orientation="Vertical">
- <Image Width="20"
- Height="20"
+
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <Image Width="20" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2"
+ Height="20" VerticalAlignment="Center" Margin="0,0,5,0"
Source="Images/Refresh.ico"
ToolTip="Reset job status to Waiting."
Visibility="{Binding Status,
Converter={StaticResource queueStatusVisConverter}}">
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="MouseDown">
- <cal:ActionMessage MethodName="RetryJob">
- <cal:Parameter Value="{Binding}" />
- </cal:ActionMessage>
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </Image>
-
- <Image Width="20"
+ <i:Interaction.Triggers>
+ <i:EventTrigger EventName="MouseDown">
+ <cal:ActionMessage MethodName="RetryJob">
+ <cal:Parameter Value="{Binding}" />
+ </cal:ActionMessage>
+ </i:EventTrigger>
+ </i:Interaction.Triggers>
+ </Image>
+
+ <Image Width="20" Grid.Row="0" Grid.Column="1"
+ Height="20"
+ Margin="0,5,0,0"
+ Source="Images/Options24.png"
+ ToolTip="Edit this Job">
+ <i:Interaction.Triggers>
+ <i:EventTrigger EventName="MouseDown">
+ <cal:ActionMessage MethodName="EditJob">
+ <cal:Parameter Value="{Binding}" />
+ </cal:ActionMessage>
+ </i:EventTrigger>
+ </i:Interaction.Triggers>
+ </Image>
+
+ <Image Width="20" Grid.Row="1" Grid.Column="1"
Height="20"
Margin="0,5,0,0"
Source="Images/delete.png"
ToolTip="Remove this Job">
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="MouseDown">
- <cal:ActionMessage MethodName="RemoveJob">
- <cal:Parameter Value="{Binding}" />
- </cal:ActionMessage>
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </Image>
- </StackPanel>
+ <i:Interaction.Triggers>
+ <i:EventTrigger EventName="MouseDown">
+ <cal:ActionMessage MethodName="RemoveJob">
+ <cal:Parameter Value="{Binding}" />
+ </cal:ActionMessage>
+ </i:EventTrigger>
+ </i:Interaction.Triggers>
+ </Image>
+
+
</Grid>
|