misc
This commit is contained in:
@@ -4,6 +4,11 @@
|
||||
- Support of the mpv option `title-bar`.
|
||||
- Command line parser fix using list options with `-add` suffix.
|
||||
- Fix video being rendered with black line at the bottom.
|
||||
- The conf file reader/writer detects if the user prefers space before and after the equal sign.
|
||||
- The portable download includes like the installer debug symbols.
|
||||
- Setup questions on startup removed.
|
||||
- Pressing shift while drag and drop (and clipboard import) appends
|
||||
instead of replaces files in the playlist. mpv supports this as well.
|
||||
|
||||
# v7.0.0.4 Beta (2023-12-19)
|
||||
|
||||
|
||||
@@ -153,10 +153,12 @@ public class GuiCommand
|
||||
|
||||
public void OpenFromClipboard(IList<string> args)
|
||||
{
|
||||
bool append = Control.ModifierKeys == Keys.Shift;
|
||||
|
||||
if (System.Windows.Forms.Clipboard.ContainsFileDropList())
|
||||
{
|
||||
string[] files = System.Windows.Forms.Clipboard.GetFileDropList().Cast<string>().ToArray();
|
||||
Player.LoadFiles(files, false, false);
|
||||
Player.LoadFiles(files, false, append);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -173,7 +175,7 @@ public class GuiCommand
|
||||
return;
|
||||
}
|
||||
|
||||
Player.LoadFiles(files.ToArray(), false, false);
|
||||
Player.LoadFiles(files.ToArray(), false, append);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
|
||||
using System.Windows;
|
||||
using MpvNet.Windows.WPF;
|
||||
|
||||
namespace MpvNet.Windows.Help;
|
||||
|
||||
public class WinMpvHelp
|
||||
{
|
||||
public static void Setup()
|
||||
{
|
||||
if (RegistryHelp.GetString("PathEnvVarCheck") == Folder.Startup ||
|
||||
RegistryHelp.GetString("Setup") == Folder.Startup ||
|
||||
App.Settings.StartupFolder == Folder.Startup ||
|
||||
Folder.Startup.Contains("portable_config"))
|
||||
|
||||
return;
|
||||
|
||||
string path = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User)!;
|
||||
|
||||
if (!path.ToLower().Contains(Folder.Startup.TrimEnd(Path.DirectorySeparatorChar).ToLower()))
|
||||
{
|
||||
var result = Msg.ShowQuestion("Would you like to add mpv.net to the Path environment variable?" + BR2 +
|
||||
"This will allow using mpv.net in a console/terminal.", MessageBoxButton.YesNo);
|
||||
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
Environment.SetEnvironmentVariable("Path",
|
||||
Folder.Startup.TrimEnd(Path.DirectorySeparatorChar) + ";" + path,
|
||||
EnvironmentVariableTarget.User);
|
||||
|
||||
Msg.ShowInfo("mpv.net was added successfully to Path.");
|
||||
}
|
||||
else
|
||||
Msg.ShowInfo("If you want to add mpv.net to the Path environment variable later," + BR +
|
||||
"you can do so with the context menu (Settings/Setup).");
|
||||
}
|
||||
|
||||
var result2 = Msg.ShowQuestion("Would you like to register video file associations?", MessageBoxButton.YesNo);
|
||||
|
||||
if (result2 == MessageBoxResult.Yes)
|
||||
{
|
||||
Player.Command("script-message-to mpvnet reg-file-assoc video");
|
||||
|
||||
result2 = Msg.ShowQuestion("Would you like to register audio file associations?", MessageBoxButton.YesNo);
|
||||
|
||||
if (result2 == MessageBoxResult.Yes)
|
||||
Player.Command("script-message-to mpvnet reg-file-assoc audio");
|
||||
}
|
||||
else
|
||||
Msg.ShowInfo("If you want to register file associations later," + BR +
|
||||
"you can do so with the context menu (Settings/Setup).");
|
||||
|
||||
App.Settings.StartupFolder = Folder.Startup;
|
||||
}
|
||||
}
|
||||
@@ -20,13 +20,16 @@ namespace MpvNet.Windows.WPF;
|
||||
|
||||
public partial class ConfWindow : Window, INotifyPropertyChanged
|
||||
{
|
||||
List<Setting> Settings = Conf.LoadConf(Properties.Resources.editor_conf.TrimEnd());
|
||||
List<ConfItem> ConfItems = new List<ConfItem>();
|
||||
string InitialContent;
|
||||
string ThemeConf = GetThemeConf();
|
||||
List<Setting> _settings = Conf.LoadConf(Properties.Resources.editor_conf.TrimEnd());
|
||||
List<ConfItem> _confItems = new List<ConfItem>();
|
||||
string _initialContent;
|
||||
string _themeConf = GetThemeConf();
|
||||
string? _searchText;
|
||||
List<NodeViewModel>? _nodes;
|
||||
bool _shown;
|
||||
int _useSpace;
|
||||
int _useNoSpace;
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
public ConfWindow()
|
||||
@@ -37,7 +40,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
||||
LoadConf(App.ConfPath);
|
||||
LoadLibplaceboConf();
|
||||
LoadSettings();
|
||||
InitialContent = GetCompareString();
|
||||
_initialContent = GetCompareString();
|
||||
|
||||
if (string.IsNullOrEmpty(App.Settings.ConfigEditorSearch))
|
||||
SearchText = "General:";
|
||||
@@ -74,7 +77,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
||||
{
|
||||
var rootNode = new TreeNode();
|
||||
|
||||
foreach (Setting setting in Settings)
|
||||
foreach (Setting setting in _settings)
|
||||
AddNode(rootNode.Children, setting.Directory!);
|
||||
|
||||
_nodes = new NodeViewModel(rootNode).Children;
|
||||
@@ -127,14 +130,14 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
||||
|
||||
void LoadSettings()
|
||||
{
|
||||
foreach (Setting setting in Settings)
|
||||
foreach (Setting setting in _settings)
|
||||
{
|
||||
setting.StartValue = setting.Value;
|
||||
|
||||
if (!FilterStrings.Contains(setting.Directory!))
|
||||
FilterStrings.Add(setting.Directory!);
|
||||
|
||||
foreach (ConfItem item in ConfItems)
|
||||
foreach (ConfItem item in _confItems)
|
||||
{
|
||||
if (setting.Name == item.Name &&
|
||||
setting.File == item.File &&
|
||||
@@ -164,7 +167,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
||||
|
||||
static string GetThemeConf() => Theme.DarkMode + App.DarkTheme + App.LightTheme;
|
||||
|
||||
string GetCompareString() => string.Join("", Settings.Select(item => item.Name + item.Value).ToArray());
|
||||
string GetCompareString() => string.Join("", _settings.Select(item => item.Name + item.Value).ToArray());
|
||||
|
||||
void LoadConf(string file)
|
||||
{
|
||||
@@ -176,9 +179,12 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
||||
|
||||
bool isSectionItem = false;
|
||||
|
||||
foreach (string currentLine in File.ReadAllLines(file))
|
||||
foreach (string it in File.ReadAllLines(file))
|
||||
{
|
||||
string line = currentLine.Trim();
|
||||
string line = it.Trim();
|
||||
|
||||
if (line.StartsWith("-"))
|
||||
line = line.TrimStart('-');
|
||||
|
||||
if (line == "")
|
||||
comment += "\r\n";
|
||||
@@ -187,7 +193,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
||||
else if (line.StartsWith("[") && line.Contains(']'))
|
||||
{
|
||||
if (!isSectionItem && comment != "" && comment != "\r\n")
|
||||
ConfItems.Add(new ConfItem() {
|
||||
_confItems.Add(new ConfItem() {
|
||||
Comment = comment, File = Path.GetFileNameWithoutExtension(file)});
|
||||
|
||||
section = line.Substring(0, line.IndexOf("]") + 1);
|
||||
@@ -197,7 +203,20 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
||||
else if (line.Contains('=') || Regex.Match(line, "^[\\w-]+$").Success)
|
||||
{
|
||||
if (!line.Contains('='))
|
||||
line += "=yes";
|
||||
{
|
||||
if (line.StartsWith("no-"))
|
||||
{
|
||||
line = line.Substring(3);
|
||||
line += "=no";
|
||||
}
|
||||
else
|
||||
line += "=yes";
|
||||
}
|
||||
|
||||
if (line.Contains(" =") || line.Contains("= "))
|
||||
_useSpace += 1;
|
||||
else
|
||||
_useNoSpace += 1;
|
||||
|
||||
ConfItem item = new();
|
||||
item.File = Path.GetFileNameWithoutExtension(file);
|
||||
@@ -207,7 +226,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
||||
item.Section = section;
|
||||
section = "";
|
||||
|
||||
if (line.Contains('#') && !line.Contains("'") && !line.Contains("\""))
|
||||
if (line.Contains('#') && !line.Contains('\'') && !line.Contains('"'))
|
||||
{
|
||||
item.LineComment = line.Substring(line.IndexOf("#")).Trim();
|
||||
line = line.Substring(0, line.IndexOf("#")).Trim();
|
||||
@@ -231,7 +250,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
||||
|
||||
item.Name = left;
|
||||
item.Value = right;
|
||||
ConfItems.Add(item);
|
||||
_confItems.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -240,7 +259,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
||||
{
|
||||
List<string> pairs = new();
|
||||
|
||||
foreach (Setting setting in Settings)
|
||||
foreach (Setting setting in _settings)
|
||||
{
|
||||
if (filename != setting.File)
|
||||
continue;
|
||||
@@ -254,7 +273,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
||||
|
||||
void LoadLibplaceboConf()
|
||||
{
|
||||
foreach (ConfItem item in ConfItems.ToArray())
|
||||
foreach (ConfItem item in _confItems.ToArray())
|
||||
if (item.Name == "libplacebo-opts")
|
||||
LoadKeyValueList(item.Value, "libplacebo");
|
||||
}
|
||||
@@ -276,7 +295,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
||||
item.Name = left;
|
||||
item.Value = right;
|
||||
item.File = file;
|
||||
ConfItems.Add(item);
|
||||
_confItems.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,8 +320,9 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
List<string> namesWritten = new List<string>();
|
||||
string equalString = _useSpace > _useNoSpace ? " = " : "=";
|
||||
|
||||
foreach (ConfItem item in ConfItems)
|
||||
foreach (ConfItem item in _confItems)
|
||||
{
|
||||
if (filename != item.File || item.Section != "" || item.IsSectionItem)
|
||||
continue;
|
||||
@@ -314,7 +334,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
||||
{
|
||||
if (item.Name != "")
|
||||
{
|
||||
sb.Append(item.Name + " = " + EscapeValue(item.Value));
|
||||
sb.Append(item.Name + equalString + EscapeValue(item.Value));
|
||||
|
||||
if (item.LineComment != "")
|
||||
sb.Append(" " + item.LineComment);
|
||||
@@ -325,7 +345,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
||||
}
|
||||
else if ((item.SettingBase.Value ?? "") != item.SettingBase.Default)
|
||||
{
|
||||
sb.Append(item.Name + " = " + EscapeValue(item.SettingBase.Value!));
|
||||
sb.Append(item.Name + equalString + EscapeValue(item.SettingBase.Value!));
|
||||
|
||||
if (item.LineComment != "")
|
||||
sb.Append(" " + item.LineComment);
|
||||
@@ -335,16 +355,16 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Setting setting in Settings)
|
||||
foreach (Setting setting in _settings)
|
||||
{
|
||||
if (filename != setting.File || namesWritten.Contains(setting.Name!))
|
||||
continue;
|
||||
|
||||
if ((setting.Value ?? "") != setting.Default)
|
||||
sb.AppendLine(setting.Name + " = " + EscapeValue(setting.Value!));
|
||||
sb.AppendLine(setting.Name + equalString + EscapeValue(setting.Value!));
|
||||
}
|
||||
|
||||
foreach (ConfItem item in ConfItems)
|
||||
foreach (ConfItem item in _confItems)
|
||||
{
|
||||
if (filename != item.File || (item.Section == "" && !item.IsSectionItem))
|
||||
continue;
|
||||
@@ -360,7 +380,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
||||
if (item.Comment != "")
|
||||
sb.Append(item.Comment);
|
||||
|
||||
sb.Append(item.Name + " = " + EscapeValue(item.Value));
|
||||
sb.Append(item.Name + equalString + EscapeValue(item.Value));
|
||||
|
||||
if (item.LineComment != "")
|
||||
sb.Append(" " + item.LineComment);
|
||||
@@ -415,10 +435,10 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
||||
base.OnClosed(e);
|
||||
App.Settings.ConfigEditorSearch = SearchText;
|
||||
|
||||
if (InitialContent == GetCompareString())
|
||||
if (_initialContent == GetCompareString())
|
||||
return;
|
||||
|
||||
foreach (Setting setting in Settings)
|
||||
foreach (Setting setting in _settings)
|
||||
{
|
||||
if (setting.Name == "libplacebo-opts")
|
||||
{
|
||||
@@ -430,7 +450,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
||||
File.WriteAllText(Player.ConfPath, GetContent("mpv"));
|
||||
File.WriteAllText(App.ConfPath, GetContent("mpvnet"));
|
||||
|
||||
foreach (Setting it in Settings)
|
||||
foreach (Setting it in _settings)
|
||||
{
|
||||
if (it.Value != it.StartValue)
|
||||
{
|
||||
@@ -447,7 +467,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
||||
Theme.Init();
|
||||
Theme.UpdateWpfColors();
|
||||
|
||||
if (ThemeConf != GetThemeConf())
|
||||
if (_themeConf != GetThemeConf())
|
||||
MessageBox.Show("Changed theme settings require mpv.net being restarted.", "Info");
|
||||
}
|
||||
|
||||
|
||||
@@ -1352,14 +1352,8 @@ public partial class MainForm : Form
|
||||
InitAndBuildContextMenu();
|
||||
Cursor.Position = new Point(Cursor.Position.X + 1, Cursor.Position.Y);
|
||||
GlobalHotkey.RegisterGlobalHotkeys(Handle);
|
||||
WasShown = true;
|
||||
StrongReferenceMessenger.Default.Send(new MainWindowIsLoadedMessage());
|
||||
|
||||
TaskHelp.Run(() => {
|
||||
System.Windows.Application.Current.Dispatcher.BeginInvoke(() => {
|
||||
WinMpvHelp.Setup();
|
||||
}, DispatcherPriority.Background);
|
||||
});
|
||||
WasShown = true;
|
||||
}
|
||||
|
||||
void ContextMenu_Closed(object sender, System.Windows.RoutedEventArgs e) => MenuAutoResetEvent.Set();
|
||||
@@ -1448,10 +1442,12 @@ public partial class MainForm : Form
|
||||
{
|
||||
base.OnDragDrop(e);
|
||||
|
||||
bool append = ModifierKeys == Keys.Shift;
|
||||
|
||||
if (e.Data!.GetDataPresent(DataFormats.FileDrop))
|
||||
Player.LoadFiles(e.Data.GetData(DataFormats.FileDrop) as string[], true, false);
|
||||
Player.LoadFiles(e.Data.GetData(DataFormats.FileDrop) as string[], true, append);
|
||||
else if (e.Data.GetDataPresent(DataFormats.Text))
|
||||
Player.LoadFiles(new[] { e.Data.GetData(DataFormats.Text)!.ToString()! }, true, false);
|
||||
Player.LoadFiles(new[] { e.Data.GetData(DataFormats.Text)!.ToString()! }, true, append);
|
||||
}
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
|
||||
@@ -452,7 +452,7 @@ public class MainPlayer : MpvClient
|
||||
|
||||
files.Add(arg);
|
||||
|
||||
LoadFiles(files.ToArray(), !App.Queue, false || App.Queue);
|
||||
LoadFiles(files.ToArray(), !App.Queue, App.Queue);
|
||||
|
||||
if (App.CommandLine.Contains("--shuffle"))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user