From 44bc399ccbd7e37107ae754db7da3d918229422d Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 9 Aug 2021 18:22:43 +0200 Subject: Youtube: show search suggestions instead of immediate search Fix save file dialog not showing all files after navigating to another directory if the search is not empty. Fix matrix system message deletion reverting back to use message (for avatar) and text color. --- plugins/Page.hpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'plugins/Page.hpp') diff --git a/plugins/Page.hpp b/plugins/Page.hpp index c61fd6d..9d5bade 100644 --- a/plugins/Page.hpp +++ b/plugins/Page.hpp @@ -29,6 +29,9 @@ namespace QuickMedia { virtual bool search_is_filter() { return true; } // This show be overriden if search_is_filter is overriden to return false virtual SearchResult search(const std::string &str, BodyItems &result_items) { (void)str; (void)result_items; return SearchResult::ERR; } + // If this returns true then |submit_suggestion| is called when submitting the selected item instead of |submit| + // and |submit| is called when submitting the response of |submit_suggestion| + virtual bool search_is_suggestion() { return false; } // Return empty |result_tabs| and PluginResult::OK to do nothing; which is useful for implementing custom actions on item submit virtual PluginResult submit(const std::string &title, const std::string &url, std::vector &result_tabs) { @@ -40,6 +43,12 @@ namespace QuickMedia { // Override and return false to make submit run in the main (ui) thread virtual bool submit_is_async() { return true; } virtual bool clear_search_after_submit() { return false; } + virtual PluginResult submit_suggestion(const std::string &title, const std::string &url, BodyItems &result_items) { + (void)title; + (void)url; + (void)result_items; + return PluginResult::ERR; + } // Note: If pagination is done by fetching the next page until we get to |page|, then the "current page" should be reset everytime |search| is called. // Note: the first page is 0 virtual PluginResult get_page(const std::string &str, int page, BodyItems &result_items) { (void)str; (void)page; (void)result_items; return PluginResult::OK; } @@ -110,7 +119,7 @@ namespace QuickMedia { virtual PageTypez get_type() const override { return PageTypez::VIDEO; } virtual bool autoplay_next_item() { return false; } virtual BodyItems get_related_media(const std::string &url) { (void)url; return {}; } - virtual std::unique_ptr create_search_page(Program *program, int &search_delay) { (void)program; (void)search_delay; return nullptr; } + virtual bool create_search_page(Program *program, Tab &tab) { (void)program; (void)tab; return false; } virtual std::unique_ptr create_comments_page(Program *program) { (void)program; return nullptr; } // Return nullptr if the service doesn't support related videos page virtual std::unique_ptr create_related_videos_page(Program *program) = 0; -- cgit v1.2.3