change profile using command palette
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
|
||||
- New feature to change profile using the command palette.
|
||||
- Progress command shows time and date.
|
||||
- New show-santa-logo (green and grumpy) option.
|
||||
- New quick bookmark feature, see manual.
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace mpvnet
|
||||
case "quick-bookmark": QuickBookmark(); break;
|
||||
case "reg-file-assoc": RegisterFileAssociations(args[0]); break;
|
||||
case "scale-window": ScaleWindow(float.Parse(args[0], CultureInfo.InvariantCulture)); break;
|
||||
case "select-profile": SelectProfile(); break;
|
||||
case "shell-execute": ProcessHelp.ShellExecute(args[0]); break;
|
||||
case "show-about": ShowDialog(typeof(AboutWindow)); break;
|
||||
case "show-audio-devices": Msg.ShowInfo(Core.GetPropertyOsdString("audio-device-list")); break;
|
||||
@@ -652,6 +653,19 @@ namespace mpvnet
|
||||
CommandPalette.Instance.SelectFirst();
|
||||
});
|
||||
|
||||
public static void SelectProfile() => App.InvokeOnMainThread(() =>
|
||||
{
|
||||
var items = Core.ProfileNames.Where(i => !i.StartsWith("extension."))
|
||||
.Select(i => new CommandPaletteItem(i, () => {
|
||||
Core.CommandV("show-text", i);
|
||||
Core.CommandV("apply-profile", i);
|
||||
}));
|
||||
|
||||
CommandPalette.Instance.SetItems(items);
|
||||
MainForm.Instance.ShowCommandPalette();
|
||||
CommandPalette.Instance.SelectFirst();
|
||||
});
|
||||
|
||||
public static void ShowMenu() => Core.RaiseShowMenu();
|
||||
|
||||
public static void PlaylistAdd(int value)
|
||||
|
||||
@@ -369,7 +369,7 @@ namespace mpvnet
|
||||
{
|
||||
profilesMenuItem.Items.Clear();
|
||||
|
||||
foreach (string profile in ProfileNames)
|
||||
foreach (string profile in Core.ProfileNames)
|
||||
{
|
||||
if (!profile.StartsWith("extension."))
|
||||
{
|
||||
@@ -387,23 +387,6 @@ namespace mpvnet
|
||||
}
|
||||
}
|
||||
|
||||
private string[] _ProfileNames;
|
||||
|
||||
public string[] ProfileNames {
|
||||
get {
|
||||
if (_ProfileNames == null)
|
||||
{
|
||||
string[] ignore = { "builtin-pseudo-gui", "encoding", "libmpv", "pseudo-gui", "default" };
|
||||
string profileList = Core.GetPropertyString("profile-list");
|
||||
var json = profileList.FromJson<List<Dictionary<string, object>>>();
|
||||
_ProfileNames = json.Select(i => i["name"].ToString())
|
||||
.Where(i => !ignore.Contains(i)).ToArray();
|
||||
}
|
||||
|
||||
return _ProfileNames;
|
||||
}
|
||||
}
|
||||
|
||||
public WpfControls.MenuItem FindMenuItem(string text) => FindMenuItem(text, ContextMenu.Items);
|
||||
|
||||
WpfControls.MenuItem FindMenuItem(string text, WpfControls.ItemCollection items)
|
||||
|
||||
@@ -1516,5 +1516,24 @@ namespace mpvnet
|
||||
track.Text += " " + value + ",";
|
||||
}
|
||||
}
|
||||
|
||||
private string[] _ProfileNames;
|
||||
|
||||
public string[] ProfileNames
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ProfileNames == null)
|
||||
{
|
||||
string[] ignore = { "builtin-pseudo-gui", "encoding", "libmpv", "pseudo-gui", "default" };
|
||||
string profileList = Core.GetPropertyString("profile-list");
|
||||
var json = profileList.FromJson<List<Dictionary<string, object>>>();
|
||||
_ProfileNames = json.Select(i => i["name"].ToString())
|
||||
.Where(i => !ignore.Contains(i)).ToArray();
|
||||
}
|
||||
|
||||
return _ProfileNames;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,6 +114,8 @@ Alt+2 script-message mpv.net window-scale 2.0 #menu: View > Zoom > 200 %
|
||||
Alt+3 script-message mpv.net window-scale 3.0 #menu: View > Zoom > 300 %
|
||||
|
||||
F8 script-message mpv.net show-playlist #menu: View > Show Playlist
|
||||
Ctrl+p script-message mpv.net select-profile #menu: View > Show Profile Selection
|
||||
Ctrl+P script-message mpv.net show-profiles #menu: View > Show Profiles
|
||||
Ctrl+7 script-message mpv.net show-audio-tracks #menu: View > Show Audio Tracks
|
||||
Ctrl+8 script-message mpv.net show-subtitle-tracks #menu: View > Show Subtitle Tracks
|
||||
b cycle border #menu: View > Toggle Border
|
||||
@@ -122,7 +124,6 @@ t script-binding stats/display-stats-toggle #menu: View > Toggle Statist
|
||||
Del script-binding osc/visibility #menu: View > Toggle OSC Visibility
|
||||
i script-message mpv.net show-info #menu: View > Show File/Stream Info
|
||||
p show-progress #menu: View > Show Progress
|
||||
Ctrl+p script-message mpv.net show-profiles #menu: View > Show Profiles
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user