From 58a6cf4793963b23026222b8086faf7846bbb698 Mon Sep 17 00:00:00 2001 From: Asada shinon Date: Thu, 24 Dec 2020 17:01:33 +0800 Subject: [PATCH] Added new hotkey command to reload current font provider. --- src/command/video.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/command/video.cpp b/src/command/video.cpp index d3ffaf7fe..cb1254596 100644 --- a/src/command/video.cpp +++ b/src/command/video.cpp @@ -236,6 +236,23 @@ struct video_cycle_subtitles_provider final : public cmd::Command { } }; +struct video_reload_subtitles_provider final : public cmd::Command { + CMD_NAME("video/subtitles_provider/reload") + STR_MENU("Reload active subtitles provider") + STR_DISP("Reload active subtitles provider") + STR_HELP("Reloads the current subtitles provider") + + void operator()(agi::Context* c) override { + auto providers = SubtitlesProviderFactory::GetClasses(); + if (providers.empty()) return; + + auto it = find(begin(providers), end(providers), OPT_GET("Subtitle/Provider")->GetString()); + + OPT_SET("Subtitle/Provider")->SetString(*it); + c->frame->StatusTimeout(fmt_tl("Subtitles provider set to %s", *it), 5000); + } +}; + struct video_detach final : public validator_video_loaded { CMD_NAME("video/detach") CMD_ICON(detach_video_menu) @@ -746,6 +763,7 @@ namespace cmd { reg(agi::make_unique()); reg(agi::make_unique()); reg(agi::make_unique()); + reg(agi::make_unique()); reg(agi::make_unique()); reg(agi::make_unique()); reg(agi::make_unique());