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 | |
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')
-rw-r--r-- | win/CS/HandBrakeWPF/Constants.cs | 5 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Properties/Resources.Designer.cs | 23 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Properties/Resources.resx | 6 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueSelectionViewModel.cs | 6 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 21 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs | 2 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/QueueSelectionViewModel.cs | 48 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/MainView.xaml | 2 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/QueueSelectionView.xaml | 22 |
9 files changed, 115 insertions, 20 deletions
diff --git a/win/CS/HandBrakeWPF/Constants.cs b/win/CS/HandBrakeWPF/Constants.cs index 862f08011..7295c9339 100644 --- a/win/CS/HandBrakeWPF/Constants.cs +++ b/win/CS/HandBrakeWPF/Constants.cs @@ -23,5 +23,10 @@ namespace HandBrakeWPF /// The appcast 32.
/// </summary>
public const string Appcast32 = "http://handbrake.fr/appcast.i386.xml";
+
+ /// <summary>
+ /// The any.
+ /// </summary>
+ public const string Any = "(Any)";
}
}
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs index 7db59a4d0..1b2f1531a 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:4.0.30319.296
+// Runtime Version:4.0.30319.18047
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -337,6 +337,9 @@ namespace HandBrakeWPF.Properties { }
}
+ /// <summary>
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ /// </summary>
public static System.Drawing.Bitmap logo64 {
get {
object obj = ResourceManager.GetObject("logo64", resourceCulture);
@@ -345,6 +348,24 @@ namespace HandBrakeWPF.Properties { }
/// <summary>
+ /// Looks up a localized string similar to WARNING: You do not have automatic file naming turned on. Please enable this in options..
+ /// </summary>
+ public static string QueueSelection_AutoNameWarning {
+ get {
+ return ResourceManager.GetString("QueueSelection_AutoNameWarning", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to WARNING: You do not currently have automatic audio and subtitle track selection setup. You can setup the default track selection behaviour in options..
+ /// </summary>
+ public static string QueueSelection_AutoTrackSelectionWarning {
+ get {
+ return ResourceManager.GetString("QueueSelection_AutoTrackSelectionWarning", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Warning: RF 0 is Lossless!.
/// </summary>
public static string Video_LosslessWarning {
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx index fed5d3923..a1796ff59 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.resx @@ -329,4 +329,10 @@ To enable this tab, check the "Use Advanced Tab instead" option on the Video Tab If you do not use this tab, it can be hidden from: Tools Menu > Options > Advanced.</value>
</data>
+ <data name="QueueSelection_AutoNameWarning" xml:space="preserve">
+ <value>WARNING: You do not have automatic file naming turned on. Please enable this in options.</value>
+ </data>
+ <data name="QueueSelection_AutoTrackSelectionWarning" xml:space="preserve">
+ <value>WARNING: You do not currently have automatic audio and subtitle track selection setup. You can setup the default track selection behaviour in options.</value>
+ </data>
</root>
\ No newline at end of file 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);
}
}
}
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index 0d93eea2d..92d0d0955 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -270,7 +270,7 @@ </StackPanel>
</MenuItem.Header>
<MenuItem Header="Add All" Micro:Message.Attach="[Event Click] = [Action AddAllToQueue]" />
- <!--<MenuItem Header="Add Selection" Micro:Message.Attach="[Event Click] = [Action AddSelectionToQueue]" />-->
+ <MenuItem Header="Add Selection" Micro:Message.Attach="[Event Click] = [Action AddSelectionToQueue]" />
</MenuItem>
</Menu>
diff --git a/win/CS/HandBrakeWPF/Views/QueueSelectionView.xaml b/win/CS/HandBrakeWPF/Views/QueueSelectionView.xaml index b46b07ff5..5e645dc7b 100644 --- a/win/CS/HandBrakeWPF/Views/QueueSelectionView.xaml +++ b/win/CS/HandBrakeWPF/Views/QueueSelectionView.xaml @@ -4,6 +4,8 @@ xmlns:cal="http://www.caliburnproject.org"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:Conveters="clr-namespace:HandBrakeWPF.Converters"
+ xmlns:Properties="clr-namespace:HandBrakeWPF.Properties"
Title="{Binding Title}"
Width="450"
MaxHeight="450"
@@ -18,6 +20,8 @@ <Setter Property="ToolTipService.ShowDuration" Value="20000" />
<Setter Property="Margin" Value="0,2,0,2" />
</Style>
+
+ <Conveters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
</Window.Resources>
<Grid HorizontalAlignment="Stretch"
@@ -33,17 +37,18 @@ <!-- Header -->
<StackPanel Grid.Row="0"
- Height="30"
+ Height="36"
Margin="0,0,0,10"
Background="White"
Orientation="Horizontal">
- <Image Width="24"
- Height="24"
+ <Image Width="32"
+ Height="32"
Margin="10,0,5,0"
VerticalAlignment="Center"
Source="Images/AddToQueue_small.png" />
<StackPanel VerticalAlignment="Center" Orientation="Vertical">
- <TextBlock FontWeight="Bold" Text="Queue Multiple Items" />
+ <TextBlock FontWeight="Bold" Text="Add to Queue" />
+ <TextBlock Text="*** Experimental ***" />
</StackPanel>
</StackPanel>
@@ -70,7 +75,7 @@ <ListBox.ContextMenu>
<ContextMenu>
<MenuItem Header="Select All" cal:Message.Attach="[Event Click] = [Action SelectAll]" />
- <MenuItem Header="Select All" cal:Message.Attach="[Event Click] = [Action UnSelectAll]" />
+ <MenuItem Header="Deselect All" cal:Message.Attach="[Event Click] = [Action UnSelectAll]" />
<Separator />
<MenuItem Header="Order by Title" IsChecked="{Binding OrderedByTitle}" cal:Message.Attach="[Event Click] = [Action OrderByTitle]" />
<MenuItem Header="Order by Duration" IsChecked="{Binding OrderedByDuration}" cal:Message.Attach="[Event Click] = [Action OrderByDuration]" />
@@ -109,7 +114,12 @@ <!-- Checlist -->
<StackPanel Orientation="Vertical" Grid.Row="3" Margin="10,10,10,0">
- <TextBlock Text="Checklist " />
+ <TextBlock Text="{x:Static Properties:Resources.QueueSelection_AutoTrackSelectionWarning}"
+ TextWrapping="Wrap" Visibility="{Binding IsAutomaticTrackSelectionEnabled, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}"
+ Margin="0,0,0,10"/>
+
+ <TextBlock Text="{x:Static Properties:Resources.QueueSelection_AutoNameWarning}"
+ TextWrapping="Wrap" Visibility="{Binding IsAutoNamingEnabled, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}"/>
</StackPanel>
<!-- Controls -->
|