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/Youtube.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'plugins/Youtube.hpp') diff --git a/plugins/Youtube.hpp b/plugins/Youtube.hpp index 50412de..c7aff93 100644 --- a/plugins/Youtube.hpp +++ b/plugins/Youtube.hpp @@ -30,17 +30,20 @@ namespace QuickMedia { class YoutubeSearchPage : public LazyFetchPage { public: - YoutubeSearchPage(Program *program) : LazyFetchPage(program) {} + YoutubeSearchPage(Program *program, std::string video_id = "") : LazyFetchPage(program), video_id(std::move(video_id)) {} const char* get_title() const override { return "Search"; } + bool search_is_suggestion() override { return true; } bool search_is_filter() override { return false; } SearchResult search(const std::string &str, BodyItems &result_items) override; PluginResult get_page(const std::string &str, int page, BodyItems &result_items) override; PluginResult submit(const std::string &title, const std::string &url, std::vector &result_tabs) override; + PluginResult submit_suggestion(const std::string &title, const std::string &url, BodyItems &result_items) override; PluginResult lazy_fetch(BodyItems &result_items) override; bool lazy_fetch_is_loader() override { return true; } private: PluginResult search_get_continuation(const std::string &url, const std::string &continuation_token, BodyItems &result_items); private: + std::string video_id; std::string search_url; std::string continuation_token; int current_page = 0; @@ -138,7 +141,7 @@ namespace QuickMedia { YoutubeVideoPage(Program *program, std::string url); const char* get_title() const override { return ""; } BodyItems get_related_media(const std::string &url) override; - std::unique_ptr create_search_page(Program *program, int &search_delay) override; + bool create_search_page(Program *program, Tab &tab) override; std::unique_ptr create_comments_page(Program *program) override; std::unique_ptr create_related_videos_page(Program *program) override; std::unique_ptr create_channels_page(Program *program, const std::string &channel_url) override; -- cgit v1.2.3