This commit is contained in:
Frank Skare
2019-03-25 23:25:51 +01:00
parent 07b6d4379e
commit 77ba7f105c
22 changed files with 114 additions and 207 deletions

View File

@@ -4,6 +4,9 @@
xmlns:local="clr-namespace:DynamicGUI"
StartupUri="MainWindow.xaml">
<Application.Resources>
<!--<Style x:Key="UrlTextBoxStyle" TargetType="TextBox">
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Foreground" Value="Blue"/>
</Style>-->
</Application.Resources>
</Application>
</Application>

View File

@@ -12,8 +12,8 @@ help = "screen=<default|0-32> In multi-monitor configurations (i.e. a single des
name = "osd-playing-msg"
default = ""
width = 300
help = "osd-playing-msg=<value> Show a message on OSD when playback starts. The string is expanded for properties, e.g. --osd-playing-msg='file: ${filename}' will show the message file: followed by a space and the currently played filename."
helpurl = "https://mpv.io/manual/master/#property-expansion"
help = "osd-playing-msg=<value> Show a message on OSD when playback starts. The string is expanded for properties, e.g. --osd-playing-msg='file: ${filename}' will show the message file: followed by a space and the currently played filename."
[[settings]]
name = "fullscreen"
@@ -47,8 +47,8 @@ name = "vo"
default = "gpu"
helpurl = "https://mpv.io/manual/master/#video-output-drivers-vo"
help = "gpu=<mode> Video output drivers to be used. Default = gpu."
options = [{ name = "direct3d", help = "Video output driver that uses the Direct3D interface" },
{ name = "gpu", text = "gpu (Default)", help = "General purpose, customizable, GPU-accelerated video output driver. It supports extended scaling methods, dithering, color management, custom shaders, HDR, and more. (Default)" }]
options = [{ name = "gpu", text = "gpu (Default)", help = "General purpose, customizable, GPU-accelerated video output driver. It supports extended scaling methods, dithering, color management, custom shaders, HDR, and more. (Default)" },
{ name = "direct3d", help = "Video output driver that uses the Direct3D interface" }]
[[settings]]
name = "keep-open-pause"
@@ -60,8 +60,8 @@ options = [{ name = "yes", text = "yes (Default)" }, { name = "no" }]
name = "keep-open"
default = "no"
help = "keep-open=<yes|no|always> Do not terminate when playing or seeking beyond the end of the file, and there is not next file to be played (and --loop is not used). Instead, pause the player. When trying to seek beyond end of the file, the player will attempt to seek to the last frame.\n\nNormally, this will act like set pause yes on EOF, unless the --keep-open-pause=no option is set."
options = [{ name = "no", text = "no (Default)", help = "If the current file ends, go to the next file or terminate. (Default.)" },
{ name = "yes", help = "Don't terminate if the current file is the last playlist entry. Equivalent to --keep-open without arguments."},
options = [{ name = "yes", help = "Don't terminate if the current file is the last playlist entry. Equivalent to --keep-open without arguments."},
{ name = "no", text = "no (Default)", help = "If the current file ends, go to the next file or terminate. (Default.)" },
{ name = "always", help = "Like yes, but also applies to files before the last playlist entry. This means playback will never automatically advance to the next file."}]
[[settings]]
@@ -70,6 +70,12 @@ alias = "loop"
default = ""
help = "loop-file=<N|inf|no>, loop=<N|inf|no> Loop a single file N times. inf means forever, no means normal playback. For compatibility, --loop-file and --loop-file=yes are also accepted, and are the same as --loop-file=inf.\n\nThe difference to --loop-playlist is that this doesn't loop the playlist, just the file itself. If the playlist contains only a single file, the difference between the two option is that this option performs a seek on loop, instead of reloading the file.\n\n--loop is an alias for this option."
[[settings]]
name = "save-position-on-quit"
default = "no"
help = "Always save the current playback position on quit. When this file is played again later, the player will seek to the old playback position on start. This does not happen if playback of a file is stopped in any other way than quitting. For example, going to the next file in the playlist will not save the position, and start playback at beginning the next time the file is played.\n\nThis behavior is disabled by default, but is always available when quitting the player with Shift+Q."
options = [{ name = "yes" }, { name = "no", text = "no (Default)" }]
[[settings]]
name = "screenshot-directory"
default = ""
@@ -85,4 +91,23 @@ help = "input-ar-delay=<integer> Delay in milliseconds before we start to autore
[[settings]]
name = "input-ar-rate"
default = ""
help = "input-ar-rate=<integer> Number of key presses to generate per second on autorepeat."
help = "input-ar-rate=<integer> Number of key presses to generate per second on autorepeat."
[[settings]]
name = "alang"
default = ""
help = "alang=<languagecode[,languagecode,...]> Specify a priority list of audio languages to use. Different container formats employ different language codes. DVDs use ISO 639-1 two-letter language codes, Matroska, MPEG-TS and NUT use ISO 639-2 three-letter language codes, while OGM uses a free-form identifier. See also --aid.\n\nExamples\n\nmpv dvd://1 --alang=hu,en chooses the Hungarian language track on a DVD and falls back on English if Hungarian is not available.\n\nmpv --alang=jpn example.mkv plays a Matroska file with Japanese audio."
[[settings]]
name = "slang"
default = ""
help = "--slang=<languagecode[,languagecode,...]> Specify a priority list of subtitle languages to use. Different container formats employ different language codes. DVDs use ISO 639-1 two letter language codes, Matroska uses ISO 639-2 three letter language codes while OGM uses a free-form identifier. See also --sid."
[[settings]]
name = "hr-seek"
default = "absolute"
help = "hr-seek=<no|absolute|yes> Select when to use precise seeks that are not limited to keyframes. Such seeks require decoding video from the previous keyframe up to the target position and so can take some time depending on decoding performance. For some video formats, precise seeks are disabled. This option selects the default choice to use for seeks; it is possible to explicitly override that default in the definition of key bindings and in input commands."
options = [{ name = "yes", help = "Use precise seeks whenever possible." },
{ name = "no", help = "Never use precise seeks." },
{ name = "absolute", text = "absolute (Default)", help = "Use precise seeks if the seek is to an absolute position in the file, such as a chapter seek, but not for relative seeks like the default behavior of arrow keys (default)." },
{ name = "always", help = "Same as yes (for compatibility)." }]

View File

@@ -0,0 +1,24 @@
using System;
using System.Diagnostics;
using System.Windows.Documents;
using System.Windows.Navigation;
namespace DynamicGUI
{
public class HyperlinkEx : Hyperlink
{
private void HyperLinkEx_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
Process.Start(e.Uri.AbsoluteUri);
}
public void SetURL(string url)
{
if (string.IsNullOrEmpty(url)) return;
NavigateUri = new Uri(url);
RequestNavigate += HyperLinkEx_RequestNavigate;
Inlines.Clear();
Inlines.Add(url);
}
}
}

View File

@@ -47,6 +47,7 @@ namespace DynamicGUI
baseSetting.Name = setting["name"];
if (setting.HasKey("help")) baseSetting.Help = setting["help"];
if (setting.HasKey("helpurl")) baseSetting.HelpURL = setting["helpurl"];
if (setting.HasKey("alias")) baseSetting.Alias = setting["alias"];
if (setting.HasKey("width")) baseSetting.Width = setting["width"];
settingsList.Add(baseSetting);
@@ -93,8 +94,6 @@ namespace DynamicGUI
set => _Text = value;
}
//private bool _IsChecked;
public bool IsChecked
{
get => OptionSetting.Value == Name ;

View File

@@ -8,7 +8,7 @@
d:DesignHeight="450" d:DesignWidth="800">
<Grid Margin="20,0">
<WrapPanel Orientation="Vertical">
<TextBox x:Name="TitleTextBox" FontSize="20" Margin="0,0,0,10" BorderThickness="0" IsReadOnly="True"></TextBox>
<TextBox x:Name="TitleTextBox" FontSize="24" Margin="0,10" BorderThickness="0" IsReadOnly="True"></TextBox>
<ItemsControl x:Name="ItemsControl">
<ItemsControl.ItemTemplate>
<DataTemplate>
@@ -19,7 +19,10 @@
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<TextBox x:Name="HelpTextBox" TextWrapping="WrapWithOverflow" Margin="0,10" BorderThickness="0" IsReadOnly="True" Padding="0"></TextBox>
<TextBox x:Name="HelpTextBox" TextWrapping="WrapWithOverflow" BorderThickness="0" IsReadOnly="True" Margin="0,10,0,0"></TextBox>
<TextBlock Margin="0,10,0,0">
<local:HyperlinkEx x:Name="Link"></local:HyperlinkEx>
</TextBlock>
</WrapPanel>
</Grid>
</UserControl>

View File

@@ -1,5 +1,4 @@
using DynamicGUI;
using System.Windows.Controls;
using System.Windows.Controls;
namespace DynamicGUI
{
@@ -14,6 +13,7 @@ namespace DynamicGUI
TitleTextBox.Text = optionSetting.Name;
HelpTextBox.Text = optionSetting.Help;
ItemsControl.ItemsSource = optionSetting.Options;
Link.SetURL(optionSetting.HelpURL);
}
private string _SearchableText;

View File

@@ -9,7 +9,7 @@
d:DesignWidth="800" >
<Grid Margin="20,0">
<WrapPanel Orientation="Vertical">
<TextBox x:Name="TitleTextBox" FontSize="20" Margin="0,0,0,10" BorderThickness="0" IsReadOnly="True"></TextBox>
<TextBox x:Name="TitleTextBox" FontSize="24" Margin="0,0,0,10" BorderThickness="0" IsReadOnly="True"></TextBox>
<Grid Margin="0,0,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />

View File

@@ -1,17 +1,17 @@
<Window xmlns:DynamicGUI="clr-namespace:DynamicGUI" x:Name="MainWindow1" x:Class="DynamicGUI.MainWindow"
<Window xmlns:DynamicGUI="clr-namespace:mpvSettingsEditor" x:Name="MainWindow1" x:Class="mpvSettingsEditor.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:DynamicGUI"
xmlns:local="clr-namespace:mpvSettingsEditor"
mc:Ignorable="d"
Height="500" Width="800">
Height="500" Width="800" Loaded="MainWindow1_Loaded">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Background="White" Width="300" Margin="0,0,0,10">
<Grid x:Name="SearchGrid" Background="White" Width="300" Margin="0,0,0,10">
<TextBlock Margin="5,2" MinWidth="50" Text="Search..." Foreground="LightSteelBlue" IsHitTestVisible="False" />
<TextBox MinWidth="50" Name="SearchTextBox" Background="Transparent" TextChanged="SearchTextBox_TextChanged" />
</Grid>

View File

@@ -1,4 +1,5 @@
using System;
using DynamicGUI;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
@@ -6,20 +7,20 @@ using System.Linq;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using DynamicGUI;
using System.Windows.Input;
namespace DynamicGUI
namespace mpvSettingsEditor
{
public partial class MainWindow : Window
{
public string mpvConfPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\mpv\\mpv.conf";
private List<SettingBase> mpvSettings = Settings.LoadSettings("Definitions.toml");
private List<SettingBase> mpvSettings = Settings.LoadSettings(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\Definitions.toml");
public MainWindow()
{
InitializeComponent();
Title = (Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), true)[0] as AssemblyProductAttribute).Product + " " + Assembly.GetExecutingAssembly().GetName().Version.ToString();
foreach (var setting in mpvSettings)
{
foreach (var pair in mpvConf)
@@ -153,5 +154,10 @@ namespace DynamicGUI
MainWrapPanel.Children[i].Visibility = Visibility.Collapsed;
}
}
private void MainWindow1_Loaded(object sender, RoutedEventArgs e)
{
FocusManager.SetFocusedElement(SearchGrid, SearchTextBox);
}
}
}

View File

@@ -51,5 +51,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("0.2.0.0")]

View File

@@ -63,6 +63,7 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="DynamicGUI\Controls.cs" />
<Compile Include="DynamicGUI\DynamicGUI.cs" />
<Compile Include="DynamicGUI\OptionSettingControl.xaml.cs">
<DependentUpon>OptionSettingControl.xaml</DependentUpon>