From 74b98bed98aad3e70e8abe51292767ea8a7d109a Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 12 Feb 2022 04:31:44 +0100 Subject: Local-manga: show if the latest chapter of a manga has been read --- plugins/LocalManga.hpp | 5 +++++ plugins/Manga.hpp | 2 +- plugins/Page.hpp | 6 ++++-- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/LocalManga.hpp b/plugins/LocalManga.hpp index d112892..eca5f96 100644 --- a/plugins/LocalManga.hpp +++ b/plugins/LocalManga.hpp @@ -1,6 +1,7 @@ #pragma once #include "Manga.hpp" +#include namespace QuickMedia { struct LocalMangaPage { @@ -29,8 +30,12 @@ namespace QuickMedia { PluginResult submit(const SubmitArgs &args, std::vector &result_tabs) override; PluginResult lazy_fetch(BodyItems &result_items) override; const char* get_bookmark_name() const override { return "local-manga"; } + bool reload_on_page_change() override { return true; } + bool reseek_to_body_item_by_url() override { return true; } + std::shared_ptr get_bookmark_body_item(BodyItem *selected_item) override; private: std::vector manga_list; + std::unordered_set finished_reading_manga; bool standalone; }; diff --git a/plugins/Manga.hpp b/plugins/Manga.hpp index bc6b415..fe9f0b4 100644 --- a/plugins/Manga.hpp +++ b/plugins/Manga.hpp @@ -65,7 +65,7 @@ namespace QuickMedia { TrackResult track(const std::string &str) override; void on_navigate_to_page(Body *body) override; bool is_trackable() const override { return true; } - std::shared_ptr get_bookmark_body_item() override; + std::shared_ptr get_bookmark_body_item(BodyItem *selected_item) override; protected: virtual bool extract_id_from_url(const std::string &url, std::string &manga_id) const = 0; virtual const char* get_service_name() const = 0; diff --git a/plugins/Page.hpp b/plugins/Page.hpp index a803725..6864a5d 100644 --- a/plugins/Page.hpp +++ b/plugins/Page.hpp @@ -67,8 +67,9 @@ namespace QuickMedia { virtual bool is_trackable() const { return false; } // Return nullptr if bookmark is not supported by this page virtual const char* get_bookmark_name() const { return nullptr; } - // If this returns nullptr then the currently selected body item is used instead - virtual std::shared_ptr get_bookmark_body_item() { return nullptr; } + // If this returns nullptr then the currently selected body item is used instead. + // |selected_item| may be nullptr. + virtual std::shared_ptr get_bookmark_body_item(BodyItem *selected_item) { (void)selected_item; return nullptr; } virtual bool is_bookmark_page() const { return false; } virtual bool is_lazy_fetch_page() const { return false; } // Note: If submit is done without any selection, then the search term is sent as the |title| and |url|. Submit will only be sent if the input text is not empty or if an item is selected @@ -117,6 +118,7 @@ namespace QuickMedia { // If this returns true then |lazy_fetch| is not meant to return results but async background load the page. This can be used to fetch API keys for example virtual bool lazy_fetch_is_loader() { return false; } virtual bool reload_on_page_change() { return false; } + virtual bool reseek_to_body_item_by_url() { return false; } }; class RelatedVideosPage : public Page { -- cgit v1.2.3