5.4.9.2 Beta

This commit is contained in:
Frank Skare
2021-08-08 14:31:43 +02:00
parent fbf50e7466
commit 95a3403898
7 changed files with 61 additions and 33 deletions

View File

@@ -1,5 +1,5 @@
5.4.9.2 Beta (2021-??-??)
5.4.9.2 Beta (2021-08-08)
- Manual translated to simplified Chinese. (hooke007)
- watch-later-options support added to conf editor. (hooke007)
@@ -15,6 +15,9 @@
- Some scroll bars where replaced with Windows 10 styled scroll bars,
complex code used from HandyControl project.
- Some UI elements use rounded corners.
- The recent list can also be shown in the command palette:
Alt+r script-message mpv.net show-recent #menu: View > Show Recent
- The recent context menu removes the folder info in case of very long paths.
- libmpv shinchiro 2021-08-01

View File

@@ -3,7 +3,6 @@ using System;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
using System.Windows.Interop;
using System.Windows;
@@ -48,6 +47,7 @@ namespace mpvnet
case "show-profiles": ShowTextWithEditor("profile-list", mpvHelp.GetProfiles()); break;
case "show-properties": ShowProperties(); break;
case "show-protocols": ShowTextWithEditor("protocol-list", mpvHelp.GetProtocols()); break;
case "show-recent": ShowRecent(); break;
case "show-setup-dialog": ShowDialog(typeof(SetupWindow)); break;
case "show-text": ShowText(args[0], Convert.ToInt32(args[1]), Convert.ToInt32(args[2])); break;
case "update-check": UpdateCheck.CheckOnline(true); break;
@@ -93,21 +93,7 @@ namespace mpvnet
dialog.ShowNewFolderButton = false;
if (dialog.ShowDialog() == DialogResult.OK)
{
Core.Command("stop");
Thread.Sleep(500);
if (Directory.Exists(dialog.SelectedPath + "\\BDMV"))
{
Core.SetPropertyString("bluray-device", dialog.SelectedPath);
Core.LoadFiles(new[] { @"bd://" }, false, false);
}
else
{
Core.SetPropertyString("dvd-device", dialog.SelectedPath);
Core.LoadFiles(new[] { @"dvd://" }, false, false);
}
}
Core.LoadDiskFolder(dialog.SelectedPath);
}
}));
}
@@ -398,7 +384,7 @@ namespace mpvnet
string file = Core.GetPropertyString($"playlist/{i}/filename");
CommandPaletteItem item = new CommandPaletteItem() {
Text = PathHelp.GetFileName(file),
Text = file.FileName(),
Action = () => Core.SetPropertyInt("playlist-pos", index)
};
@@ -451,5 +437,28 @@ namespace mpvnet
CommandPalette.Instance.SetItems(items);
MainForm.Instance.ShowCommandPalette();
}
public static void ShowRecent() => App.InvokeOnMainThread(ShowRecentInternal);
public static void ShowRecentInternal()
{
List<CommandPaletteItem> items = new List<CommandPaletteItem>();
foreach (string i in App.Settings.RecentFiles)
{
string file = i;
CommandPaletteItem item = new CommandPaletteItem()
{
Text = file.ShortPath(60),
Action = () => Core.LoadFiles(new[] { file }, true, Control.ModifierKeys.HasFlag(Keys.Control))
};
items.Add(item);
}
CommandPalette.Instance.SetItems(items);
MainForm.Instance.ShowCommandPalette();
}
}
}

View File

@@ -1189,6 +1189,23 @@ namespace mpvnet
}
}
public void LoadDiskFolder(string path)
{
Core.Command("stop");
Thread.Sleep(500);
if (Directory.Exists(path + "\\BDMV"))
{
Core.SetPropertyString("bluray-device", path);
Core.LoadFiles(new[] { @"bd://" }, false, false);
}
else
{
Core.SetPropertyString("dvd-device", path);
Core.LoadFiles(new[] { @"dvd://" }, false, false);
}
}
public void LoadFolder()
{
if (!App.AutoLoadFolder || Control.ModifierKeys.HasFlag(Keys.Shift))

View File

@@ -1,6 +1,7 @@

using System.Globalization;
using System.IO;
using System.Text.RegularExpressions;
public static class TestStringExtension
{
@@ -94,6 +95,17 @@ public static class PathStringExtension
return instance;
}
public static string ShortPath(this string instance, int maxLength)
{
if (string.IsNullOrEmpty(instance))
return "";
if (instance.Length > maxLength && instance.Substring(1, 2) == ":\\")
instance = instance.Substring(0, 3) + "...\\" + instance.FileName();
return instance;
}
// Ensure trailing directory separator char
public static string AddSep(this string instance)
{

View File

@@ -14,20 +14,6 @@ using static mpvnet.Global;
namespace mpvnet
{
public static class PathHelp
{
public static string GetFileName(string path)
{
if (string.IsNullOrEmpty(path))
return "";
if (path.Contains(Path.DirectorySeparatorChar))
return path.Substring(path.LastIndexOf(Path.DirectorySeparatorChar) + 1);
return path;
}
}
public static class StringHelp
{
public static string GetMD5Hash(string txt)

View File

@@ -157,6 +157,7 @@ P script-message mpv.net show-properties #menu: View > Show Propertie
_ script-message mpv.net show-protocols #menu: View > Show Protocols
F9 show-text ${track-list} 5000 #menu: View > Show Tracks
Ctrl+m script-message mpv.net show-media-info #menu: View > Show Media Info
Alt+r script-message mpv.net show-recent #menu: View > Show Recent
_ ignore #menu: Profile

View File

@@ -270,7 +270,7 @@ namespace mpvnet
recent.DropDownItems.Clear();
foreach (string path in App.Settings.RecentFiles)
MenuItem.Add(recent.DropDownItems, path, () => Core.LoadFiles(new[] { path }, true, Control.ModifierKeys.HasFlag(Keys.Control)));
MenuItem.Add(recent.DropDownItems, path.ShortPath(100), () => Core.LoadFiles(new[] { path }, true, ModifierKeys.HasFlag(Keys.Control)));
recent.DropDownItems.Add(new ToolStripSeparator());
MenuItem mi = new MenuItem("Clear List");