aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-08-29 09:27:41 +0200
committerdec05eba <dec05eba@protonmail.com>2021-08-29 09:27:41 +0200
commita12c897435e615618b14f5cbdd50c7d01dd291fa (patch)
treedae906a7a4a46f45f77ff2d41c53569b1354d8f6 /plugins
parentb4f2787ef695f9957fbf6c8674ef1669d8524b0a (diff)
Allow bookmarking manga from chapters page
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Manga.hpp1
-rw-r--r--plugins/MangaGeneric.hpp1
-rw-r--r--plugins/Mangadex.hpp1
-rw-r--r--plugins/Manganelo.hpp1
-rw-r--r--plugins/Page.hpp2
5 files changed, 6 insertions, 0 deletions
diff --git a/plugins/Manga.hpp b/plugins/Manga.hpp
index ee7638b..020099e 100644
--- a/plugins/Manga.hpp
+++ b/plugins/Manga.hpp
@@ -54,6 +54,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;
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/MangaGeneric.hpp b/plugins/MangaGeneric.hpp
index 4b4f55c..183fbb4 100644
--- a/plugins/MangaGeneric.hpp
+++ b/plugins/MangaGeneric.hpp
@@ -158,6 +158,7 @@ namespace QuickMedia {
MangaGenericChaptersPage(Program *program, std::string manga_name, std::string manga_url, const MangaIdExtractor &manga_id_extractor, const char *service_name, const std::string &website_url, const ListPageQuery *list_page_query, bool fail_on_http_error) :
MangaChaptersPage(program, std::move(manga_name), std::move(manga_url)), manga_id_extractor(manga_id_extractor), service_name(service_name), website_url(website_url), list_page_query(list_page_query), fail_on_http_error(fail_on_http_error) {}
PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ const char* get_bookmark_name() const override { return service_name; }
protected:
bool extract_id_from_url(const std::string &url, std::string &manga_id) const override;
const char* get_service_name() const override { return service_name; }
diff --git a/plugins/Mangadex.hpp b/plugins/Mangadex.hpp
index cb412da..beceddb 100644
--- a/plugins/Mangadex.hpp
+++ b/plugins/Mangadex.hpp
@@ -32,6 +32,7 @@ namespace QuickMedia {
MangadexChaptersPage(Program *program, MangadexSearchPage *search_page, std::string manga_name, std::string manga_url) : MangaChaptersPage(program, std::move(manga_name), std::move(manga_url)), search_page(search_page) {}
PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
PluginResult get_page(const std::string &str, int page, BodyItems &result_items) override;
+ const char* get_bookmark_name() const override { return "mangadex"; }
protected:
bool extract_id_from_url(const std::string &url, std::string &manga_id) const override;
const char* get_service_name() const override { return "mangadex"; }
diff --git a/plugins/Manganelo.hpp b/plugins/Manganelo.hpp
index 70526ff..5012fa3 100644
--- a/plugins/Manganelo.hpp
+++ b/plugins/Manganelo.hpp
@@ -17,6 +17,7 @@ namespace QuickMedia {
public:
ManganeloChaptersPage(Program *program, std::string manga_name, std::string manga_url) : MangaChaptersPage(program, std::move(manga_name), std::move(manga_url)) {}
PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ const char* get_bookmark_name() const override { return "manganelo"; }
protected:
bool extract_id_from_url(const std::string &url, std::string &manga_id) const override;
const char* get_service_name() const override { return "manganelo"; }
diff --git a/plugins/Page.hpp b/plugins/Page.hpp
index 39d76d6..3ecb016 100644
--- a/plugins/Page.hpp
+++ b/plugins/Page.hpp
@@ -61,6 +61,8 @@ 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; }
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