playlist shows current file
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
5.4.9.2 Beta (2021-??-??)
|
5.4.9.2 Beta (2021-??-??)
|
||||||
|
|
||||||
- Manual translated to simplified Chinese (hooke007)
|
- Manual translated to simplified Chinese (hooke007)
|
||||||
|
- Showing the playlist selects the currently played file/stream in the playlist.
|
||||||
|
|
||||||
|
|
||||||
5.4.9.1 Beta (2021-06-23)
|
5.4.9.1 Beta (2021-06-23)
|
||||||
|
|||||||
@@ -382,6 +382,7 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
CommandPalette.Instance.SetItems(CommandPalette.GetItems());
|
CommandPalette.Instance.SetItems(CommandPalette.GetItems());
|
||||||
MainForm.Instance.ShowCommandPalette();
|
MainForm.Instance.ShowCommandPalette();
|
||||||
|
CommandPalette.Instance.SelectFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ShowPlaylist() => App.InvokeOnMainThread(ShowPlaylistInternal);
|
public static void ShowPlaylist() => App.InvokeOnMainThread(ShowPlaylistInternal);
|
||||||
@@ -389,6 +390,8 @@ namespace mpvnet
|
|||||||
static void ShowPlaylistInternal()
|
static void ShowPlaylistInternal()
|
||||||
{
|
{
|
||||||
int count = Core.get_property_int("playlist-count");
|
int count = Core.get_property_int("playlist-count");
|
||||||
|
string currentPath = Core.get_property_string("path");
|
||||||
|
CommandPaletteItem currentItem = null;
|
||||||
|
|
||||||
if (count <= 0)
|
if (count <= 0)
|
||||||
return;
|
return;
|
||||||
@@ -399,14 +402,27 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
int index = i;
|
int index = i;
|
||||||
string file = Core.get_property_string($"playlist/{i}/filename");
|
string file = Core.get_property_string($"playlist/{i}/filename");
|
||||||
|
|
||||||
CommandPaletteItem item = new CommandPaletteItem() {
|
CommandPaletteItem item = new CommandPaletteItem() {
|
||||||
Text = PathHelp.GetFileName(file),
|
Text = PathHelp.GetFileName(file),
|
||||||
Action = () => Core.set_property_int("playlist-pos", index)
|
Action = () => Core.set_property_int("playlist-pos", index)
|
||||||
};
|
};
|
||||||
|
|
||||||
items.Add(item);
|
items.Add(item);
|
||||||
|
|
||||||
|
if (currentPath.ToLowerEx() == file.ToLowerEx())
|
||||||
|
currentItem = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandPalette.Instance.SetItems(items);
|
CommandPalette.Instance.SetItems(items);
|
||||||
|
|
||||||
|
if (currentItem != null)
|
||||||
|
{
|
||||||
|
CommandPalette.Instance.MainListView.SelectedItem = currentItem;
|
||||||
|
CommandPalette.Instance.MainListView.ScrollIntoView(
|
||||||
|
CommandPalette.Instance.MainListView.SelectedItem);
|
||||||
|
}
|
||||||
|
|
||||||
MainForm.Instance.ShowCommandPalette();
|
MainForm.Instance.ShowCommandPalette();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1063,7 +1063,6 @@ namespace mpvnet
|
|||||||
AdjustCommandPaletteLeftAndWidth();
|
AdjustCommandPaletteLeftAndWidth();
|
||||||
CommandPaletteHost.Child = CommandPalette.Instance;
|
CommandPaletteHost.Child = CommandPalette.Instance;
|
||||||
CommandPalette.Instance.AdjustHeight();
|
CommandPalette.Instance.AdjustHeight();
|
||||||
CommandPalette.Instance.SelectFirst();
|
|
||||||
Controls.Add(CommandPaletteHost);
|
Controls.Add(CommandPaletteHost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user