diff options
author | sr55 <[email protected]> | 2013-05-19 17:41:51 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2013-05-19 17:41:51 +0000 |
commit | df40df10c06a92609979c34dc461d9807669cc54 (patch) | |
tree | 42c170d321dbaec15872e1142a7a760ee62b74a1 /win/CS/HandBrakeWPF/ViewModels | |
parent | 39d5addd4f0772fe45811be4a3b1e3305785866e (diff) |
WinGui: Some additional work on my prototype batch add to queue feature.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5486 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels')
4 files changed, 65 insertions, 12 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueSelectionViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueSelectionViewModel.cs index 36a64846a..c9c0e38bd 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueSelectionViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueSelectionViewModel.cs @@ -9,6 +9,7 @@ namespace HandBrakeWPF.ViewModels.Interfaces
{
+ using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -35,6 +36,9 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// <param name="sourceName">
/// The source Name.
/// </param>
- void Setup(Source scannedSource, string sourceName);
+ /// <param name="addAction">
+ /// The add To Queue action
+ /// </param>
+ void Setup(Source scannedSource, string sourceName, Action<IEnumerable<SelectionTitle>> addAction);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index bbcd093c5..fb14cd9a1 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -803,7 +803,7 @@ namespace HandBrakeWPF.ViewModels this.SelectedStartPoint = 1;
this.SelectedEndPoint = selectedTitle.Chapters.Last().ChapterNumber;
- }
+ }
else if (value == PointToPointMode.Seconds)
{
if (this.selectedTitle == null)
@@ -1113,7 +1113,14 @@ namespace HandBrakeWPF.ViewModels Window window = Application.Current.Windows.Cast<Window>().FirstOrDefault(x => x.GetType() == typeof(QueueSelectionViewModel));
IQueueSelectionViewModel viewModel = IoC.Get<IQueueSelectionViewModel>();
- viewModel.Setup(this.ScannedSource, this.SourceName);
+ viewModel.Setup(this.ScannedSource, this.SourceName, (tasks) =>
+ {
+ foreach (SelectionTitle title in tasks)
+ {
+ this.SelectedTitle = title.Title;
+ this.AddToQueue();
+ }
+ });
if (window != null)
{
@@ -1783,7 +1790,7 @@ namespace HandBrakeWPF.ViewModels }
else
{
- this.SourceLabel = "Scan Failed... See Activity Log for details."; this.StatusLabel = "Scan Failed... See Activity Log for details.";
+ this.SourceLabel = "Scan Failed... See Activity Log for details."; this.StatusLabel = "Scan Failed... See Activity Log for details.";
}
});
}
@@ -2022,10 +2029,10 @@ namespace HandBrakeWPF.ViewModels /// </param>
private void CurrentTask_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
- if (e.PropertyName == UserSettingConstants.ShowAdvancedTab)
- {
- this.NotifyOfPropertyChange(() => this.ShowAdvancedTab);
- }
+ if (e.PropertyName == UserSettingConstants.ShowAdvancedTab)
+ {
+ this.NotifyOfPropertyChange(() => this.ShowAdvancedTab);
+ }
}
#endregion
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index 4b61c4192..94baf73d1 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -1556,7 +1556,7 @@ namespace HandBrakeWPF.ViewModels this.preferredLanguages.Add(item);
// In the available languages should be no "Any" and no selected language.
- if ((item != "(Any)") && (!this.userSettingService.GetUserSetting<StringCollection>(UserSettingConstants.SelectedLanguages).Contains(item)))
+ if ((item != Constants.Any) && (!this.userSettingService.GetUserSetting<StringCollection>(UserSettingConstants.SelectedLanguages).Contains(item)))
{
this.availableLanguages.Add(item);
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueSelectionViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueSelectionViewModel.cs index c5b6072cc..3cbe56feb 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueSelectionViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueSelectionViewModel.cs @@ -41,6 +41,11 @@ namespace HandBrakeWPF.ViewModels private bool orderedByTitle;
/// <summary>
+ /// The add to queue.
+ /// </summary>
+ private Action<IEnumerable<SelectionTitle>> addToQueue;
+
+ /// <summary>
/// Initializes a new instance of the <see cref="QueueSelectionViewModel"/> class.
/// </summary>
/// <param name="errorService">
@@ -99,6 +104,36 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// Gets a value indicating whether is auto naming enabled.
+ /// </summary>
+ public bool IsAutoNamingEnabled
+ {
+ get
+ {
+ return this.UserSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNaming);
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether is automatic track selection enabled.
+ /// </summary>
+ public bool IsAutomaticTrackSelectionEnabled
+ {
+ get
+ {
+ // TODO decide what is the minimal requirement to hide the warning message.
+ if (this.UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguage) != Constants.Any ||
+ this.UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguageForSubtitles) !=
+ Constants.Any)
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
+
+ /// <summary>
/// The order by title.
/// </summary>
public void OrderByTitle()
@@ -147,6 +182,7 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void Add()
{
+ this.addToQueue(this.TitleList.Where(c => c.IsSelected));
this.Close();
}
@@ -176,23 +212,29 @@ namespace HandBrakeWPF.ViewModels /// <param name="srcName">
/// The src Name.
/// </param>
- public void Setup(Source scannedSource, string srcName)
+ /// <param name="addAction">
+ /// The add Action.
+ /// </param>
+ public void Setup(Source scannedSource, string srcName, Action<IEnumerable<SelectionTitle>> addAction)
{
this.TitleList.Clear();
+ this.addToQueue = addAction;
if (scannedSource != null)
{
-
IEnumerable<Title> titles = orderedByTitle
? scannedSource.Titles
: scannedSource.Titles.OrderByDescending(o => o.Duration).ToList();
foreach (Title item in titles)
{
- SelectionTitle title = new SelectionTitle(item, srcName);
+ SelectionTitle title = new SelectionTitle(item, srcName) { IsSelected = true };
TitleList.Add(title);
}
}
+
+ this.NotifyOfPropertyChange(() => this.IsAutoNamingEnabled);
+ this.NotifyOfPropertyChange(() => this.IsAutomaticTrackSelectionEnabled);
}
}
}
|