summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF
diff options
context:
space:
mode:
authorsr55 <[email protected]>2017-12-25 17:01:17 +0000
committersr55 <[email protected]>2017-12-25 17:01:17 +0000
commitde47c6c4b9198c951a3160802158aa1c0beff604 (patch)
tree095ce5ccf1c4a178709fb9a4bf27da46386b9be9 /win/CS/HandBrakeWPF
parent0ee7c489ca5c0408877d304b65cb1d92160af807 (diff)
WinGui: Display Source Names in the Title Dropdown (only when open), when we are not scanning a DVD / Bluray.
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r--win/CS/HandBrakeWPF/Services/Scan/LibScan.cs3
-rw-r--r--win/CS/HandBrakeWPF/Services/Scan/Model/Title.cs50
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml24
3 files changed, 71 insertions, 6 deletions
diff --git a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs
index beceb9361..7558bc163 100644
--- a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs
+++ b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs
@@ -388,7 +388,8 @@ namespace HandBrakeWPF.Services.Scan
MainTitle = titles.MainFeature == title.Index,
Playlist = title.Type == 1 ? string.Format(" {0:d5}.MPLS", title.Playlist).Trim() : null,
FramerateNumerator = title.FrameRate.Num,
- FramerateDenominator = title.FrameRate.Den
+ FramerateDenominator = title.FrameRate.Den,
+ Type = title.Type
};
int currentTrack = 1;
diff --git a/win/CS/HandBrakeWPF/Services/Scan/Model/Title.cs b/win/CS/HandBrakeWPF/Services/Scan/Model/Title.cs
index 32fddb36d..e60520fa7 100644
--- a/win/CS/HandBrakeWPF/Services/Scan/Model/Title.cs
+++ b/win/CS/HandBrakeWPF/Services/Scan/Model/Title.cs
@@ -11,10 +11,14 @@ namespace HandBrakeWPF.Services.Scan.Model
{
using System;
using System.Collections.Generic;
+ using System.IO;
using System.Linq;
using HandBrake.ApplicationServices.Interop.Model;
+ using HandBrakeWPF.Model;
+ using HandBrakeWPF.Utilities;
+
/// <summary>
/// An object that represents a single Title of a DVD
/// </summary>
@@ -123,6 +127,52 @@ namespace HandBrakeWPF.Services.Scan.Model
/// </summary>
public string SourceName { get; set; }
+ public string SourceDisplayName
+ {
+ get
+ {
+ switch (this.Type)
+ {
+ case 0: // HB_DVD_TYPE
+ case 1: // HB_BD_TYPE
+ default:
+ return string.Empty;
+ case 2: // HB_STREAM_TYPE
+ case 3: // HB_FF_STREAM_TYPE
+ return Path.GetFileNameWithoutExtension(this.SourceName);
+ }
+ }
+ }
+
+ public string ItemDisplayText
+ {
+ get
+ {
+ return string.Format(
+ "{0}{1} ({2:00}:{3:00}:{4:00}) {5}",
+ this.TitleNumber,
+ this.Playlist,
+ this.Duration.Hours,
+ this.Duration.Minutes,
+ this.Duration.Seconds,
+ this.SourceDisplayName);
+ }
+ }
+
+ public string ItemDisplayTextClosed
+ {
+ get
+ {
+ return string.Format(
+ "{0}{1} ({2:00}:{3:00}:{4:00})",
+ this.TitleNumber,
+ this.Playlist,
+ this.Duration.Hours,
+ this.Duration.Minutes,
+ this.Duration.Seconds);
+ }
+ }
+
#endregion
/// <summary>
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml
index f4fffe924..d8e7a27fa 100644
--- a/win/CS/HandBrakeWPF/Views/MainView.xaml
+++ b/win/CS/HandBrakeWPF/Views/MainView.xaml
@@ -304,11 +304,25 @@
<StackPanel Orientation="Horizontal" Grid.Row="1" Margin="0,5,0,0">
<Label FontWeight="Bold" Content="{x:Static Properties:ResourcesUI.MainView_Title}" />
<ComboBox Name="Titles"
- MinWidth="100"
- Margin="17,0,0,0"
- ItemsSource="{Binding ScannedSource.Titles}"
- ToolTip="{x:Static Properties:ResourcesTooltips.MainView_Title}"
- SelectedItem="{Binding Path=SelectedTitle}" />
+ Width="160"
+ Margin="17,0,0,0"
+ ItemsSource="{Binding ScannedSource.Titles}"
+ ToolTip="{x:Static Properties:ResourcesTooltips.MainView_Title}"
+ SelectedItem="{Binding Path=SelectedTitle}" >
+
+ <ComboBox.Style>
+ <Style TargetType="{x:Type ComboBox}">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Path=IsDropDownOpen, ElementName=Titles}" Value="True">
+ <Setter Property="DisplayMemberPath" Value="ItemDisplayText" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Path=IsDropDownOpen, ElementName=Titles}" Value="False">
+ <Setter Property="DisplayMemberPath" Value="ItemDisplayTextClosed" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </ComboBox.Style>
+ </ComboBox>
<Label Margin="8,0,0,0" FontWeight="Bold" Content="{x:Static Properties:ResourcesUI.MainView_Angle}" />
<ComboBox Name="Angles"