diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/MangaGeneric.hpp | 1 | ||||
-rw-r--r-- | plugins/Mangadex.hpp | 1 | ||||
-rw-r--r-- | plugins/Manganelo.hpp | 1 | ||||
-rw-r--r-- | plugins/Page.hpp | 18 |
4 files changed, 20 insertions, 1 deletions
diff --git a/plugins/MangaGeneric.hpp b/plugins/MangaGeneric.hpp index 2f65762..4b4f55c 100644 --- a/plugins/MangaGeneric.hpp +++ b/plugins/MangaGeneric.hpp @@ -113,6 +113,7 @@ namespace QuickMedia { PluginResult get_page(const std::string &url, bool is_post, const std::vector<MangaFormDataStr> &form_data, BodyItems &result_items); 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<Tab> &result_tabs) override; + const char* get_bookmark_name() const override { return service_name; } MangaGenericSearchPage& search_handler(const char *search_template, int page_start); MangaGenericSearchPage& search_post_handler(const char *url, std::vector<MangaFormData> form_data, SearchQueryJsonHandler result_handler); diff --git a/plugins/Mangadex.hpp b/plugins/Mangadex.hpp index cd81c44..1bc4b21 100644 --- a/plugins/Mangadex.hpp +++ b/plugins/Mangadex.hpp @@ -16,6 +16,7 @@ namespace QuickMedia { 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<Tab> &result_tabs) override; + const char* get_bookmark_name() const override { return "mangadex"; } ChapterImageUrls chapter_image_urls; private: diff --git a/plugins/Manganelo.hpp b/plugins/Manganelo.hpp index 62fd9bf..70526ff 100644 --- a/plugins/Manganelo.hpp +++ b/plugins/Manganelo.hpp @@ -10,6 +10,7 @@ namespace QuickMedia { bool search_is_filter() override { return false; } SearchResult search(const std::string &str, BodyItems &result_items) override; 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"; } }; class ManganeloChaptersPage : public MangaChaptersPage { diff --git a/plugins/Page.hpp b/plugins/Page.hpp index e60c752..39d76d6 100644 --- a/plugins/Page.hpp +++ b/plugins/Page.hpp @@ -59,6 +59,9 @@ namespace QuickMedia { // Mutually exclusive with |get_type| when |get_type| is not PageTypez::REGULAR virtual bool is_single_page() const { return false; } 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; } + 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 virtual bool allow_submit_no_selection() const { return false; } @@ -76,7 +79,7 @@ namespace QuickMedia { Program *program; std::shared_ptr<BodyItem> submit_body_item; // TODO: Remove this - bool needs_refresh = false; // Set to true to refresh the page + bool needs_refresh = false; // Set to true to refresh the page. Note: only works for search pages and lazy fetch pages }; enum class TrackResult { @@ -153,4 +156,17 @@ namespace QuickMedia { protected: std::string url; }; + + class BookmarksPage : public LazyFetchPage { + public: + BookmarksPage(Program *program, Page *redirect_page) : LazyFetchPage(program), redirect_page(redirect_page) {} + const char* get_title() const override { return "Bookmarks"; } + PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override; + PluginResult lazy_fetch(BodyItems &result_items) override; + bool reload_on_page_change() override { return true; } + const char* get_bookmark_name() const override { return redirect_page->get_bookmark_name(); } + bool is_bookmark_page() const override { return true; } + private: + Page *redirect_page; + }; }
\ No newline at end of file |