Skip to content

Commit

Permalink
Updates to v3.6-pre2 / v1.2-pre2
Browse files Browse the repository at this point in the history
WPF.FlyleafHost: Adds support for resize based on Player's aspect ratio
WPF.FlyleafHost: Adds more options for detached positioning/sizing
WPF.FlyleafHost: Adds all the functionality also for the Overlay
WPF.FlyleafHost: Finishes up the new implementation (more renamings, see WPF/FlyleafHost.cs for details)

FlyleafPlayer: Adds Ctrl+N to Open New Window and Ctrl+W to Close it
FlyleafPlayer: Adds Always On Top toggle button
FlyleafPlayer: Adds support to open url from command line (related to #208)

FlyleafME: Fixes an issue to respect Subtitles FontStyle
FlyleafME: Adds Activity Timeout on Settings
  • Loading branch information
SuRGeoNix committed Nov 4, 2022
1 parent 70c11ae commit c7a5f78
Show file tree
Hide file tree
Showing 19 changed files with 934 additions and 543 deletions.
7 changes: 6 additions & 1 deletion FlyleafLib.Controls.WPF/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public ObservableCollection<UITheme>
public string SelectedTheme { get => _SelectedTheme; set => Set(ref _SelectedTheme, value); }
string _SelectedTheme;

public int ActivityTimeout { get; set; } // we just store it to file

public string SubsFontFamily { get => _SubsFontFamily; set => Set(ref _SubsFontFamily, value); }
string _SubsFontFamily;
public double SubsFontSize { get => _SubsFontSize; set => Set(ref _SubsFontSize, value); }
Expand All @@ -45,7 +47,7 @@ public static void Load(FlyleafME flyleaf, string path)
{
XmlSerializer xmlSerializer = new XmlSerializer(typeof(UIConfig));
flyleaf.UIConfig = (UIConfig) xmlSerializer.Deserialize(fs);

flyleaf.ActivityTimeout = flyleaf.UIConfig.ActivityTimeout;
flyleaf.UIConfig.Loaded = true;
flyleaf.UIConfig.flyleaf = flyleaf;
foreach(var theme in flyleaf.UIConfig.Themes)
Expand All @@ -56,11 +58,14 @@ public static void Load(FlyleafME flyleaf, string path)
public static void Save(FlyleafME flyleaf, string uiConfigPath, string configPath, string enginePath)
{
if (uiConfigPath != null)
{
flyleaf.UIConfig.ActivityTimeout = flyleaf.ActivityTimeout;
using (FileStream fs = new FileStream(uiConfigPath, FileMode.Create))
{
XmlSerializer xmlSerializer = new XmlSerializer(typeof(UIConfig));
xmlSerializer.Serialize(fs, flyleaf.UIConfig);
}
}

if (configPath != null)
flyleaf.Config.Save(configPath);
Expand Down
12 changes: 3 additions & 9 deletions FlyleafLib.Controls.WPF/FlyleafLib.Controls.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net6.0-windows;net5.0-windows;net472</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>
<Version>1.2-pre</Version>
<Version>1.2-pre2</Version>
<Authors>SuRGeoNix</Authors>
<Copyright>SuRGeoNix © 2022</Copyright>
<PackageLicenseExpression>LGPL-3.0-or-later</PackageLicenseExpression>
Expand All @@ -14,15 +14,9 @@
<PackageTags>flyleaf flyleaflib video audio media player element control</PackageTags>
<Description>WPF Media Player Control/Element (based on FlyleafLib)</Description>
<PackageReleaseNotes>
- Introduces FlyleafME WPF Media Element Control (WPF Flyleaf Control replacement)
* Updated with the new FlyleafHost and gains better performance
* Resolves several issues with DPI
* Code clean-up and styles to allow easier override and customization
* Fixes an issue to respect Subtitles FontStyle
* Adds Activity Timeout on Settings
* Updates FlyleafLib

- Breaking Changes
* Flyleaf (WPF Control) has been renamed to FlyleafME (Media Element) and does not require a FlyleafHost as it was required previously with the VideoView (it derives from it)
* See WPF/FlyleafHost.cs for the new dependency properties and customization
</PackageReleaseNotes>
</PropertyGroup>

Expand Down
12 changes: 3 additions & 9 deletions FlyleafLib.Controls.WPF/FlyleafME.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ public SerializableDictionary<string, SerializableDictionary<string, string>>
public bool CanPaste { get => _CanPaste; set => Set(ref _CanPaste, value); }
bool _CanPaste;

public string SubtitlesFontDesc { get => _SubtitlesFontDesc; set => Set(ref _SubtitlesFontDesc, value); }
string _SubtitlesFontDesc;

public UITheme SelectedTheme
{
get => _SelectedTheme;
Expand Down Expand Up @@ -309,7 +306,6 @@ private void Initialize()
if (uitheme.Name == UIConfig.SelectedTheme)
SelectedTheme = uitheme;

SubtitlesFontDesc = $"{UIConfig.SubsFontFamily} ({UIConfig.SubsFontWeight}), {UIConfig.SubsFontSize}";
subsInitialMargin = UIConfig.SubsMargin;

if (popUpMenu != null)
Expand Down Expand Up @@ -433,8 +429,8 @@ public async void OpenSettingsAction(object obj = null)

Player.Activity.IsEnabled = false;

var prevKeys = KeyBindingsMode;
KeyBindingsMode = AvailableWindows.None;
var prevKeys = KeyBindings;
KeyBindings = AvailableWindows.None;

Dictionary<VideoFilters, int> saveFilterValues = new Dictionary<VideoFilters, int>();
foreach(var filter in Config.Video.Filters.Values)
Expand All @@ -444,7 +440,7 @@ public async void OpenSettingsAction(object obj = null)
var result = await DialogHost.Show(settings, dialogSettingsIdentifier);

Player.Activity.IsEnabled = true;
KeyBindingsMode = prevKeys;
KeyBindings = prevKeys;

if (result == null) return;

Expand Down Expand Up @@ -530,8 +526,6 @@ public void SetSubtitlesFontAction(object obj = null)
UIConfig.SubsFontStretch= dialog.Font.Stretch.ToString();
UIConfig.SubsFontStyle = dialog.Font.Style.ToString();
UIConfig.SubsFontColor = dialog.Font.BrushColor.Color;

SubtitlesFontDesc = $"{UIConfig.SubsFontFamily} ({UIConfig.SubsFontWeight}), {UIConfig.SubsFontSize}";
}
}
#endregion
Expand Down
50 changes: 31 additions & 19 deletions FlyleafLib.Controls.WPF/Settings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@
</StackPanel>
</TabItem.Header>
<Grid>
<Grid Margin="20" VerticalAlignment="Top">
<ScrollViewer Height="270" Margin="20 20 20 0" VerticalAlignment="Top">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="100"/>
Expand All @@ -207,34 +208,39 @@
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>

<TextBlock Grid.Row="0" Text="Idle Timeout (ms)" VerticalAlignment="Center"/>
<TextBox Grid.Row="0" Grid.Column="1" Style="{StaticResource FLTextboxNP}" Text="{Binding ActivityTimeout, UpdateSourceTrigger=Explicit}"/>

<TextBlock Grid.Row="0" Text="Read Timeout (ms)" VerticalAlignment="Center"/>
<TextBox Grid.Row="0" Grid.Column="1" Style="{StaticResource FLTextboxNP}" Text="{Binding Config.Demuxer.ReadTimeout, UpdateSourceTrigger=Explicit, Converter={StaticResource TicksToMilliSeconds}}"/>
<TextBlock Grid.Row="1" Text="Read Timeout (ms)" VerticalAlignment="Center"/>
<TextBox Grid.Row="1" Grid.Column="1" Style="{StaticResource FLTextboxNP}" Text="{Binding Config.Demuxer.ReadTimeout, UpdateSourceTrigger=Explicit, Converter={StaticResource TicksToMilliSeconds}}"/>

<TextBlock Grid.Row="1" Text="Buffer Duration Min. (ms)" VerticalAlignment="Center"/>
<TextBox Grid.Row="1" Grid.Column="1" Style="{StaticResource FLTextboxNP}" Text="{Binding Config.Player.MinBufferDuration, UpdateSourceTrigger=Explicit, Converter={StaticResource TicksToMilliSeconds}}"/>
<TextBlock Grid.Row="2" Text="Buffer Duration Min. (ms)" VerticalAlignment="Center"/>
<TextBox Grid.Row="2" Grid.Column="1" Style="{StaticResource FLTextboxNP}" Text="{Binding Config.Player.MinBufferDuration, UpdateSourceTrigger=Explicit, Converter={StaticResource TicksToMilliSeconds}}"/>

<TextBlock Grid.Row="2" Text="Buffer Duration Max. (ms)" VerticalAlignment="Center"/>
<TextBox Grid.Row="2" Grid.Column="1" Style="{StaticResource FLTextboxNP}" Text="{Binding Config.Demuxer.BufferDuration, UpdateSourceTrigger=Explicit, Converter={StaticResource TicksToMilliSeconds}}"/>
<TextBlock Grid.Row="3" Text="Buffer Duration Max. (ms)" VerticalAlignment="Center"/>
<TextBox Grid.Row="3" Grid.Column="1" Style="{StaticResource FLTextboxNP}" Text="{Binding Config.Demuxer.BufferDuration, UpdateSourceTrigger=Explicit, Converter={StaticResource TicksToMilliSeconds}}"/>

<TextBlock Grid.Row="3" Text="Audio Frames Max." VerticalAlignment="Center"/>
<TextBox Grid.Row="3" Grid.Column="1" Style="{StaticResource FLTextboxNP}" Text="{Binding Config.Decoder.MaxAudioFrames, UpdateSourceTrigger=Explicit}"/>
<TextBlock Grid.Row="4" Text="Audio Frames Max." VerticalAlignment="Center"/>
<TextBox Grid.Row="4" Grid.Column="1" Style="{StaticResource FLTextboxNP}" Text="{Binding Config.Decoder.MaxAudioFrames, UpdateSourceTrigger=Explicit}"/>

<TextBlock Grid.Row="4" Text="Video Frames Max." VerticalAlignment="Center"/>
<TextBox Grid.Row="4" Grid.Column="1" Style="{StaticResource FLTextboxNP}" Text="{Binding Config.Decoder.MaxVideoFrames, UpdateSourceTrigger=Explicit}"/>
<TextBlock Grid.Row="5" Text="Video Frames Max." VerticalAlignment="Center"/>
<TextBox Grid.Row="5" Grid.Column="1" Style="{StaticResource FLTextboxNP}" Text="{Binding Config.Decoder.MaxVideoFrames, UpdateSourceTrigger=Explicit}"/>

<Separator Grid.Row="5" Grid.ColumnSpan="3"/>
<Separator Grid.Row="6" Grid.ColumnSpan="3"/>

<TextBlock Grid.Row="6" Text="Log File" VerticalAlignment="Center"/>
<TextBox Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="2" Width="260" TextAlignment="Left" Style="{StaticResource FLTextbox}" Text="{Binding ConfigEngine.LogOutput, UpdateSourceTrigger=Explicit}"/>
<TextBlock Grid.Row="7" Text="Log File" VerticalAlignment="Center"/>
<TextBox Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="2" Width="260" TextAlignment="Left" Style="{StaticResource FLTextbox}" Text="{Binding ConfigEngine.LogOutput, UpdateSourceTrigger=Explicit}"/>

<TextBlock Grid.Row="7" Text="Log Level" VerticalAlignment="Center"/>
<ComboBox Grid.Row="7" Grid.Column="1" ItemsSource="{Binding Source={StaticResource LogLevelEnum}}" SelectedItem="{Binding ConfigEngine.LogLevel}"/>
<TextBlock Grid.Row="8" Text="Log Level" VerticalAlignment="Center"/>
<ComboBox Grid.Row="8" Grid.Column="1" ItemsSource="{Binding Source={StaticResource LogLevelEnum}}" SelectedItem="{Binding ConfigEngine.LogLevel}"/>

<TextBlock Grid.Row="8" Text="Log Level (FFmpeg)" VerticalAlignment="Center"/>
<ComboBox Grid.Row="8" Grid.Column="1" ItemsSource="{Binding Source={StaticResource FFmpegLogLevelEnum}}" SelectedItem="{Binding ConfigEngine.FFmpegLogLevel}"/>
<TextBlock Grid.Row="9" Text="Log Level (FFmpeg)" VerticalAlignment="Center"/>
<ComboBox Grid.Row="9" Grid.Column="1" ItemsSource="{Binding Source={StaticResource FFmpegLogLevelEnum}}" SelectedItem="{Binding ConfigEngine.FFmpegLogLevel}"/>
</Grid>
</ScrollViewer>
<StackPanel Margin="0, 0, 0, 10" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Bottom">
<Button Style="{StaticResource SaveButton}"/>
<Button Content="Apply" FontWeight="ExtraBold" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" CommandParameter="apply"/>
Expand Down Expand Up @@ -317,7 +323,13 @@
<Button Margin=" 0 15 0 0" Grid.Row="4" Grid.Column="1" Height="auto" MaxHeight="100" Command="{Binding SetSubtitlesFont}">
<StackPanel Orientation="Horizontal" Margin="0 5 0 5">
<Rectangle Margin=" 0 0 10 0" Width="18" Height="18" Fill="{Binding UIConfig.SubsFontColor, Converter={StaticResource ColorToBrush}}"/>
<TextBlock Text="{Binding SubtitlesFontDesc}" TextWrapping="Wrap" MaxWidth="200" VerticalAlignment="Center"/>
<TextBlock TextWrapping="Wrap" MaxWidth="200" VerticalAlignment="Center">
<Run Text="{Binding UIConfig.SubsFontFamily}"/>
<Run Text="("/>
<Run Text="{Binding UIConfig.SubsFontWeight}"/>
<Run Text="), "/>
<Run Text="{Binding UIConfig.SubsFontSize}"/>
</TextBlock>
</StackPanel>
</Button>
</Grid>
Expand Down
6 changes: 3 additions & 3 deletions FlyleafLib.Controls.WPF/Themes/FlyleafME.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<Style TargetType="{x:Type flwpf:FlyleafME}" BasedOn="{StaticResource {x:Type fl:FlyleafHost}}" x:Shared="False">
<Setter Property="ActivityTimeout" Value="6000"/>
<Setter Property="KeyBindingsMode" Value="Both"/>
<Setter Property="KeyBindings" Value="Both"/>
<Setter Property="Content">
<Setter.Value>
<Border BorderThickness="0.6">
Expand Down Expand Up @@ -57,7 +57,7 @@
<fl:PlayerDebug VerticalAlignment="Center" HorizontalAlignment="Center" Player="{Binding Player}" BoxColor="#AA000000" HeaderColor="White" InfoColor="{DynamicResource PrimaryHueLightBrush}" ValueColor="{DynamicResource SecondaryHueLightBrush}" Visibility="{Binding ShowDebug, Converter={StaticResource BooleanToVisibility}, FallbackValue=Collapsed, TargetNullValue=Collapsed}"/>

<!--Subtitles-->
<TextBlock Margin="{Binding UIConfig.SubsMargin}" VerticalAlignment="Bottom" HorizontalAlignment="Center" TextAlignment="Center" TextWrapping="Wrap" FontFamily="{Binding UIConfig.SubsFontFamily}" FontSize="{Binding UIConfig.SubsFontSize}" Foreground="{Binding UIConfig.SubsFontColor, Converter={StaticResource ColorToBrush}}" FontWeight="{Binding UIConfig.SubsFontWeight}" Text="{Binding Player.Subtitles.SubsText}">
<TextBlock Margin="{Binding UIConfig.SubsMargin}" VerticalAlignment="Bottom" HorizontalAlignment="Center" TextAlignment="Center" TextWrapping="Wrap" FontFamily="{Binding UIConfig.SubsFontFamily}" FontSize="{Binding UIConfig.SubsFontSize}" Foreground="{Binding UIConfig.SubsFontColor, Converter={StaticResource ColorToBrush}}" FontWeight="{Binding UIConfig.SubsFontWeight}" FontStyle="{Binding UIConfig.SubsFontStyle}" Text="{Binding Player.Subtitles.SubsText}">
<TextBlock.Effect>
<DropShadowEffect ShadowDepth="2" Direction="0" Color="{Binding Player.Config.Video.BackgroundColor}" Opacity="1.0" BlurRadius="0"/>
</TextBlock.Effect>
Expand All @@ -74,7 +74,7 @@

<Style TargetType="{x:Type flwpf:FlyleafME}" BasedOn="{StaticResource {x:Type fl:FlyleafHost}}" x:Key="TBR123">
<Setter Property="ActivityTimeout" Value="6000"/>
<Setter Property="KeyBindingsMode" Value="Both"/>
<Setter Property="KeyBindings" Value="Both"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type flwpf:FlyleafME}">
Expand Down
Loading

0 comments on commit c7a5f78

Please sign in to comment.