From aa9a861c662f7c65cde92fbf133deaca3692bbd2 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 23 Oct 2020 07:42:13 +0200 Subject: Mangadex: implement pagination --- plugins/Mangadex.hpp | 2 ++ plugins/Page.hpp | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/Mangadex.hpp b/plugins/Mangadex.hpp index 96bfc50..00da59c 100644 --- a/plugins/Mangadex.hpp +++ b/plugins/Mangadex.hpp @@ -10,9 +10,11 @@ namespace QuickMedia { const char* get_title() const override { return "All"; } 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; sf::Vector2i get_thumbnail_max_size() override { return sf::Vector2i(101, 141); }; private: + SearchResult search(const std::string &str, int page, BodyItems &result_items); bool get_rememberme_token(std::string &rememberme_token); std::optional rememberme_token; }; diff --git a/plugins/Page.hpp b/plugins/Page.hpp index b4ea9a6..d8f1d05 100644 --- a/plugins/Page.hpp +++ b/plugins/Page.hpp @@ -21,7 +21,8 @@ namespace QuickMedia { // 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) = 0; - // 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: 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; } virtual BodyItems get_related_media(const std::string &url); -- cgit v1.2.3