aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-02-12 04:31:44 +0100
committerdec05eba <dec05eba@protonmail.com>2022-02-12 04:33:00 +0100
commit74b98bed98aad3e70e8abe51292767ea8a7d109a (patch)
treeea1558431137f8a1e52f4d550c0438e68e676f6f /plugins
parentcc445c60d4806fb462a3efc27bf8d727176f77da (diff)
Local-manga: show if the latest chapter of a manga has been read
Diffstat (limited to 'plugins')
-rw-r--r--plugins/LocalManga.hpp5
-rw-r--r--plugins/Manga.hpp2
-rw-r--r--plugins/Page.hpp6
3 files changed, 10 insertions, 3 deletions
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 <unordered_set>
namespace QuickMedia {
struct LocalMangaPage {
@@ -29,8 +30,12 @@ namespace QuickMedia {
PluginResult submit(const SubmitArgs &args, std::vector<Tab> &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<BodyItem> get_bookmark_body_item(BodyItem *selected_item) override;
private:
std::vector<LocalManga> manga_list;
+ std::unordered_set<std::string> 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<BodyItem> get_bookmark_body_item() override;
+ std::shared_ptr<BodyItem> 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<BodyItem> 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<BodyItem> 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 {