aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-02-07 22:54:20 +0100
committerdec05eba <dec05eba@protonmail.com>2022-02-07 22:55:11 +0100
commit75c610d1f65d741bbeba9f1ddeef60a6e9315427 (patch)
tree0dd79a5a7f35c89b9672d55fbf24cb1f6de13aa9 /plugins
parent9539a71dbeafdc4107d3b92eefada332ee45579a (diff)
Use one struct for all args in Page::submit instead of multiple args (easier to add new fields without changing code)
Also remove submit_body_item from page.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/AniList.hpp8
-rw-r--r--plugins/FileManager.hpp2
-rw-r--r--plugins/Fourchan.hpp4
-rw-r--r--plugins/HotExamples.hpp6
-rw-r--r--plugins/Info.hpp2
-rw-r--r--plugins/Lbry.hpp4
-rw-r--r--plugins/MangaCombined.hpp2
-rw-r--r--plugins/MangaGeneric.hpp6
-rw-r--r--plugins/Mangadex.hpp6
-rw-r--r--plugins/Manganelo.hpp6
-rw-r--r--plugins/Matrix.hpp16
-rw-r--r--plugins/MediaGeneric.hpp4
-rw-r--r--plugins/MyAnimeList.hpp6
-rw-r--r--plugins/NyaaSi.hpp8
-rw-r--r--plugins/Page.hpp21
-rw-r--r--plugins/Peertube.hpp8
-rw-r--r--plugins/Pipe.hpp2
-rw-r--r--plugins/Saucenao.hpp2
-rw-r--r--plugins/Soundcloud.hpp4
-rw-r--r--plugins/Youtube.hpp16
20 files changed, 69 insertions, 64 deletions
diff --git a/plugins/AniList.hpp b/plugins/AniList.hpp
index 5fc5eef..8e57b4e 100644
--- a/plugins/AniList.hpp
+++ b/plugins/AniList.hpp
@@ -15,7 +15,7 @@ namespace QuickMedia {
bool search_is_filter() override { return false; }
bool submit_is_async() const 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;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
PluginResult get_page(const std::string &str, int page, BodyItems &result_items) override;
private:
SearchResult search_page(const std::string &str, int page, BodyItems &result_items);
@@ -28,7 +28,7 @@ namespace QuickMedia {
AniListRelatedPage(Program *program, std::string id) : LazyFetchPage(program), id(std::move(id)) {}
const char* get_title() const override { return "Related"; }
bool submit_is_async() const override { return false; }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
private:
std::string id;
@@ -39,7 +39,7 @@ namespace QuickMedia {
AniListDetailsPage(Program *program, std::string id) : LazyFetchPage(program), id(std::move(id)) {}
const char* get_title() const override { return "Details"; }
bool submit_is_async() const override { return false; }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
private:
std::string id;
@@ -50,7 +50,7 @@ namespace QuickMedia {
AniListRecommendationsPage(Program *program, std::string id) : LazyFetchPage(program), id(std::move(id)) {}
const char* get_title() const override { return "Recommendations"; }
bool submit_is_async() const override { return false; }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
PluginResult get_page(const std::string &str, int page, BodyItems &result_items) override;
private:
diff --git a/plugins/FileManager.hpp b/plugins/FileManager.hpp
index 4e36b3c..e31eb41 100644
--- a/plugins/FileManager.hpp
+++ b/plugins/FileManager.hpp
@@ -21,7 +21,7 @@ namespace QuickMedia {
FileManagerPage(Program *program, FileManagerMimeType mime_type = FILE_MANAGER_MIME_TYPE_ALL, FileSelectionHandler selection_handler = nullptr) :
Page(program), current_dir("/"), mime_type(mime_type), selection_handler(selection_handler) {}
const char* get_title() const override { return current_dir.c_str(); }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
bool is_single_page() const override { return true; }
bool set_current_directory(const std::string &path);
diff --git a/plugins/Fourchan.hpp b/plugins/Fourchan.hpp
index 8c608a1..05fb784 100644
--- a/plugins/Fourchan.hpp
+++ b/plugins/Fourchan.hpp
@@ -7,7 +7,7 @@ namespace QuickMedia {
public:
FourchanBoardsPage(Program *program, std::string resources_root) : Page(program), resources_root(std::move(resources_root)) {}
const char* get_title() const override { return "Select board"; }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
void get_boards(BodyItems &result_items);
const std::string resources_root;
@@ -17,7 +17,7 @@ namespace QuickMedia {
public:
FourchanThreadListPage(Program *program, std::string title, std::string board_id) : LazyFetchPage(program), title(std::move(title)), board_id(std::move(board_id)) {}
const char* get_title() const override { return title.c_str(); }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
const std::string title;
diff --git a/plugins/HotExamples.hpp b/plugins/HotExamples.hpp
index 73bc150..9bca74a 100644
--- a/plugins/HotExamples.hpp
+++ b/plugins/HotExamples.hpp
@@ -9,7 +9,7 @@ namespace QuickMedia {
public:
HotExamplesLanguageSelectPage(Program *program) : Page(program) {}
const char* get_title() const override { return "Select language"; }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
bool submit_is_async() const override { return false; }
};
@@ -19,7 +19,7 @@ namespace QuickMedia {
const char* get_title() const override { return "Select result"; }
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;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
private:
std::string language;
};
@@ -28,7 +28,7 @@ namespace QuickMedia {
public:
HotExamplesCodeExamplesPage(Program *program, std::string title) : Page(program), title(std::move(title)) {}
const char* get_title() const override { return title.c_str(); }
- PluginResult submit(const std::string&, const std::string&, std::vector<Tab>&) override { return PluginResult::OK; }
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab>&) override { (void)args; return PluginResult::OK; }
bool submit_is_async() const override { return false; }
private:
std::string title;
diff --git a/plugins/Info.hpp b/plugins/Info.hpp
index cdaefd3..3ede60d 100644
--- a/plugins/Info.hpp
+++ b/plugins/Info.hpp
@@ -7,7 +7,7 @@ namespace QuickMedia {
public:
InfoPage(Program *program) : Page(program) {}
const char* get_title() const override { return "Info"; }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
bool submit_is_async() const override { return false; }
void copy_to_clipboard(const BodyItem *body_item) override;
diff --git a/plugins/Lbry.hpp b/plugins/Lbry.hpp
index 1cddf56..224e43b 100644
--- a/plugins/Lbry.hpp
+++ b/plugins/Lbry.hpp
@@ -10,7 +10,7 @@ namespace QuickMedia {
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<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
bool submit_is_async() const override { return false; }
private:
std::string channel_id;
@@ -25,7 +25,7 @@ namespace QuickMedia {
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<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
private:
LbrySearchPage search_page;
diff --git a/plugins/MangaCombined.hpp b/plugins/MangaCombined.hpp
index 39a143c..1348b1b 100644
--- a/plugins/MangaCombined.hpp
+++ b/plugins/MangaCombined.hpp
@@ -21,7 +21,7 @@ namespace QuickMedia {
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<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
void cancel_operation() override;
private:
std::vector<MangaPlugin> search_pages;
diff --git a/plugins/MangaGeneric.hpp b/plugins/MangaGeneric.hpp
index 439fc19..56d7c74 100644
--- a/plugins/MangaGeneric.hpp
+++ b/plugins/MangaGeneric.hpp
@@ -112,7 +112,7 @@ namespace QuickMedia {
SearchResult search(const std::string &str, BodyItems &result_items) override;
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;
+ PluginResult submit(const SubmitArgs &args, 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);
@@ -157,7 +157,7 @@ namespace QuickMedia {
public:
MangaGenericChaptersPage(Program *program, std::string manga_name, std::string manga_url, const std::string &thumbnail_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), thumbnail_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;
+ PluginResult submit(const SubmitArgs &args, 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;
@@ -174,7 +174,7 @@ namespace QuickMedia {
public:
MangaGenericCreatorPage(Program *program, MangaGenericSearchPage *search_page, Creator creator) : LazyFetchPage(program), search_page(search_page), creator(std::move(creator)) {}
const char* get_title() const override { return creator.name.c_str(); }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
private:
MangaGenericSearchPage *search_page;
diff --git a/plugins/Mangadex.hpp b/plugins/Mangadex.hpp
index d6206cc..8735326 100644
--- a/plugins/Mangadex.hpp
+++ b/plugins/Mangadex.hpp
@@ -16,7 +16,7 @@ namespace QuickMedia {
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<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
const char* get_bookmark_name() const override { return "mangadex"; }
private:
bool get_rememberme_token(std::string &rememberme_token);
@@ -27,7 +27,7 @@ namespace QuickMedia {
public:
MangadexChaptersPage(Program *program, MangadexSearchPage *search_page, std::string manga_name, std::string manga_url, const std::string &thumbnail_url) :
MangaChaptersPage(program, std::move(manga_name), std::move(manga_url), thumbnail_url), search_page(search_page) {}
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, 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:
@@ -41,7 +41,7 @@ namespace QuickMedia {
public:
MangadexCreatorPage(Program *program, MangadexSearchPage *search_page, Creator creator) : LazyFetchPage(program), search_page(search_page), creator(std::move(creator)) {}
const char* get_title() const override { return creator.name.c_str(); }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
PluginResult get_page(const std::string &str, int page, BodyItems &result_items) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
private:
diff --git a/plugins/Manganelo.hpp b/plugins/Manganelo.hpp
index 8946447..d835a06 100644
--- a/plugins/Manganelo.hpp
+++ b/plugins/Manganelo.hpp
@@ -9,14 +9,14 @@ namespace QuickMedia {
const char* get_title() const override { return "Search"; }
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;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
const char* get_bookmark_name() const override { return "manganelo"; }
};
class ManganeloChaptersPage : public MangaChaptersPage {
public:
ManganeloChaptersPage(Program *program, std::string manga_name, std::string manga_url, const std::string &thumbnail_url) : MangaChaptersPage(program, std::move(manga_name), std::move(manga_url), thumbnail_url) {}
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, 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;
@@ -27,7 +27,7 @@ namespace QuickMedia {
public:
ManganeloCreatorPage(Program *program, Creator creator) : LazyFetchPage(program), creator(std::move(creator)) {}
const char* get_title() const override { return creator.name.c_str(); }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
private:
Creator creator;
diff --git a/plugins/Matrix.hpp b/plugins/Matrix.hpp
index 7244ee3..9b0fc58 100644
--- a/plugins/Matrix.hpp
+++ b/plugins/Matrix.hpp
@@ -323,7 +323,7 @@ namespace QuickMedia {
~MatrixRoomsPage() override;
const char* get_title() const override { return title.c_str(); }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
bool submit_is_async() const override { return false; }
bool clear_search_after_submit() override { return true; }
@@ -353,7 +353,7 @@ namespace QuickMedia {
public:
MatrixRoomTagsPage(Program *program, Body *body) : Page(program), body(body) {}
const char* get_title() const override { return "Tags"; }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
bool submit_is_async() const override { return false; }
bool clear_search_after_submit() override { return true; }
@@ -384,7 +384,7 @@ namespace QuickMedia {
MatrixInvitesPage(Program *program, Matrix *matrix, Body *body);
const char* get_title() const override { return title.c_str(); }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
bool submit_is_async() const override { return false; }
bool clear_search_after_submit() override { return true; }
@@ -404,7 +404,7 @@ namespace QuickMedia {
MatrixInviteDetailsPage(Program *program, Matrix *matrix, MatrixInvitesPage *invites_page, std::string room_id, std::string title) :
Page(program), matrix(matrix), invites_page(invites_page), room_id(std::move(room_id)), title(std::move(title)) {}
const char* get_title() const override { return title.c_str(); }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
Matrix *matrix;
MatrixInvitesPage *invites_page;
@@ -455,7 +455,7 @@ namespace QuickMedia {
const char* get_title() const override { return "Room directory"; }
bool allow_submit_no_selection() const override { return true; }
bool clear_search_after_submit() override { return true; }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
private:
Matrix *matrix;
};
@@ -468,7 +468,7 @@ namespace QuickMedia {
PluginResult lazy_fetch(BodyItems &result_items) override;
PluginResult get_page(const std::string &str, int page, BodyItems &result_items) override;
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;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
private:
Matrix *matrix;
const std::string server_name;
@@ -481,7 +481,7 @@ namespace QuickMedia {
public:
MatrixNotificationsPage(Program *program, Matrix *matrix, Body *notifications_body, MatrixRoomsPage *all_rooms_page);
const char* get_title() const override { return "Notifications"; }
- PluginResult submit(const std::string&, const std::string&, std::vector<Tab>&) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab>&) override;
PluginResult get_page(const std::string &str, int page, BodyItems &result_items) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
bool is_ready() override;
@@ -507,7 +507,7 @@ namespace QuickMedia {
const char* get_title() const override { return "Invite user"; }
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;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
bool allow_submit_no_selection() const override { return true; }
private:
Matrix *matrix;
diff --git a/plugins/MediaGeneric.hpp b/plugins/MediaGeneric.hpp
index f0d5462..3720ba3 100644
--- a/plugins/MediaGeneric.hpp
+++ b/plugins/MediaGeneric.hpp
@@ -39,7 +39,7 @@ namespace QuickMedia {
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<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
PluginResult get_related_media(const std::string &url, BodyItems &result_items);
@@ -74,7 +74,7 @@ namespace QuickMedia {
class MediaGenericRelatedPage : public RelatedVideosPage {
public:
MediaGenericRelatedPage(Program *program, MediaGenericSearchPage *search_page) : RelatedVideosPage(program), search_page(search_page) {}
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
private:
MediaGenericSearchPage *search_page;
};
diff --git a/plugins/MyAnimeList.hpp b/plugins/MyAnimeList.hpp
index 192f0f3..8f35043 100644
--- a/plugins/MyAnimeList.hpp
+++ b/plugins/MyAnimeList.hpp
@@ -10,7 +10,7 @@ namespace QuickMedia {
bool search_is_filter() override { return false; }
bool submit_is_async() const 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;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
};
class MyAnimeListDetailsPage : public LazyFetchPage {
@@ -18,7 +18,7 @@ namespace QuickMedia {
MyAnimeListDetailsPage(Program *program, std::string url) : LazyFetchPage(program), url(std::move(url)) {}
const char* get_title() const override { return "Details"; }
bool submit_is_async() const override { return false; }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
private:
std::string url;
@@ -29,7 +29,7 @@ namespace QuickMedia {
MyAnimeListRecommendationsPage(Program *program, std::string url) : LazyFetchPage(program), url(std::move(url)) {}
const char* get_title() const override { return "Recommendations"; }
bool submit_is_async() const override { return false; }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
private:
std::string url;
diff --git a/plugins/NyaaSi.hpp b/plugins/NyaaSi.hpp
index 5556fa8..3236fc5 100644
--- a/plugins/NyaaSi.hpp
+++ b/plugins/NyaaSi.hpp
@@ -10,7 +10,7 @@ namespace QuickMedia {
public:
NyaaSiCategoryPage(Program *program, bool is_sukebei) : Page(program), is_sukebei(is_sukebei) {}
const char* get_title() const override { return is_sukebei ? "Select sukebei category" : "Select nyaa.si category"; }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
const bool is_sukebei;
};
@@ -36,7 +36,7 @@ namespace QuickMedia {
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<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
void set_sort_type(NyaaSiSortType sort_type);
@@ -52,7 +52,7 @@ namespace QuickMedia {
public:
NyaaSiSortOrderPage(Program *program, Body *body, NyaaSiSearchPage *search_page) : Page(program), body(body), search_page(search_page) {}
const char* get_title() const override { return "Sort order"; }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
bool submit_is_async() const override { return false; }
private:
Body *body;
@@ -63,7 +63,7 @@ namespace QuickMedia {
public:
NyaaSiTorrentPage(Program *program) : Page(program) {}
const char* get_title() const override { return "Torrent"; }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
bool submit_is_async() const override { return false; }
};
} \ No newline at end of file
diff --git a/plugins/Page.hpp b/plugins/Page.hpp
index b9f220d..0e904c2 100644
--- a/plugins/Page.hpp
+++ b/plugins/Page.hpp
@@ -20,6 +20,14 @@ namespace QuickMedia {
CHAT
};
+ struct SubmitArgs {
+ std::string title;
+ std::string url;
+ std::string thumbnail_url;
+ void *userdata;
+ std::shared_ptr<BodyItemExtra> extra;
+ };
+
class Page {
public:
Page(Program *program) : program(program) {}
@@ -34,18 +42,16 @@ namespace QuickMedia {
virtual bool search_is_suggestion() { return false; }
// 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<Tab> &result_tabs) {
- (void)title;
- (void)url;
+ virtual PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ (void)args;
(void)result_tabs;
return PluginResult::ERR;
}
// Override and return false to make submit run in the main (ui) thread
virtual bool submit_is_async() const { return true; }
virtual bool clear_search_after_submit() { return false; }
- virtual PluginResult submit_suggestion(const std::string &title, const std::string &url, BodyItems &result_items) {
- (void)title;
- (void)url;
+ virtual PluginResult submit_suggestion(const SubmitArgs &args, BodyItems &result_items) {
+ (void)args;
(void)result_items;
return PluginResult::ERR;
}
@@ -84,7 +90,6 @@ namespace QuickMedia {
void set_clipboard(const std::string &str);
Program *program;
- std::shared_ptr<BodyItem> submit_body_item; // TODO: Remove this
bool needs_refresh = false; // Set to true to refresh the page. Note: only works for search pages and lazy fetch pages
};
@@ -173,7 +178,7 @@ namespace QuickMedia {
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 submit(const SubmitArgs &args, 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(); }
diff --git a/plugins/Peertube.hpp b/plugins/Peertube.hpp
index 90453ee..10c2761 100644
--- a/plugins/Peertube.hpp
+++ b/plugins/Peertube.hpp
@@ -9,7 +9,7 @@ namespace QuickMedia {
const char* get_title() const override { return "Select instance"; }
bool allow_submit_no_selection() const override { return true; }
bool submit_is_async() const override { return false; }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
};
@@ -28,7 +28,7 @@ namespace QuickMedia {
// Fetches local videos if |str| is empty
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;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
// Fetches all local videos
PluginResult lazy_fetch(BodyItems &result_items) override;
private:
@@ -45,7 +45,7 @@ namespace QuickMedia {
const char* get_title() const override { return title.c_str(); }
bool submit_is_async() const override { return false; }
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;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
private:
std::string server;
@@ -60,7 +60,7 @@ namespace QuickMedia {
const char* get_title() const override { return title.c_str(); }
bool submit_is_async() const override { return false; }
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;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
private:
std::string server;
diff --git a/plugins/Pipe.hpp b/plugins/Pipe.hpp
index 46864be..8a6454a 100644
--- a/plugins/Pipe.hpp
+++ b/plugins/Pipe.hpp
@@ -7,7 +7,7 @@ namespace QuickMedia {
public:
PipePage(Program *program, const char *title = "") : Page(program), title(title) {}
const char* get_title() const override { return title; }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
bool is_single_page() const override { return true; }
static void load_body_items_from_stdin(BodyItems &items);
diff --git a/plugins/Saucenao.hpp b/plugins/Saucenao.hpp
index d58b424..997fb05 100644
--- a/plugins/Saucenao.hpp
+++ b/plugins/Saucenao.hpp
@@ -8,7 +8,7 @@ namespace QuickMedia {
SaucenaoPage(Program *program, const std::string &path, bool is_local) : LazyFetchPage(program), path(path), is_local(is_local) {}
const char* get_title() const override { return "SauceNAO"; }
bool submit_is_async() const override { return false; }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
private:
std::string path;
diff --git a/plugins/Soundcloud.hpp b/plugins/Soundcloud.hpp
index 5850fab..7e65cc1 100644
--- a/plugins/Soundcloud.hpp
+++ b/plugins/Soundcloud.hpp
@@ -11,7 +11,7 @@ namespace QuickMedia {
SoundcloudPage(Program *program) : Page(program) {}
virtual ~SoundcloudPage() = default;
virtual const char* get_title() const override { return ""; }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
};
class SoundcloudSearchPage : public LazyFetchPage {
@@ -19,7 +19,7 @@ namespace QuickMedia {
SoundcloudSearchPage(Program *program) : LazyFetchPage(program), submit_page(program) {}
const char* get_title() const override { return "Search"; }
bool search_is_filter() override { return false; }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
SearchResult search(const std::string &str, BodyItems &result_items) override;
PluginResult get_page(const std::string &str, int page, BodyItems &result_items) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
diff --git a/plugins/Youtube.hpp b/plugins/Youtube.hpp
index 53fb3b7..511c78a 100644
--- a/plugins/Youtube.hpp
+++ b/plugins/Youtube.hpp
@@ -46,8 +46,8 @@ namespace QuickMedia {
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<Tab> &result_tabs) override;
- PluginResult submit_suggestion(const std::string &title, const std::string &url, BodyItems &result_items) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
+ PluginResult submit_suggestion(const SubmitArgs &args, BodyItems &result_items) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
bool lazy_fetch_is_loader() override { return true; }
private:
@@ -71,7 +71,7 @@ namespace QuickMedia {
YoutubeCommentsPage(Program *program, const std::string &video_url, const std::string &continuation_token) : LazyFetchPage(program), video_url(video_url), continuation_token(continuation_token) {}
const char* get_title() const override { return "Comments"; }
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;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
private:
int current_page = 0;
@@ -84,7 +84,7 @@ namespace QuickMedia {
YoutubeCommentRepliesPage(Program *program, const std::string &video_url, const std::string &continuation_token) : LazyFetchPage(program), video_url(video_url), continuation_token(continuation_token) {}
const char* get_title() const override { return "Comment replies"; }
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;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
private:
int current_page = 0;
@@ -99,7 +99,7 @@ namespace QuickMedia {
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<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
TrackResult track(const std::string &str) override;
@@ -124,7 +124,7 @@ namespace QuickMedia {
public:
YoutubeSubscriptionsPage(Program *program) : LazyFetchPage(program) {}
const char* get_title() const override { return "Subscriptions"; }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
private:
std::array<AsyncTask<std::vector<YoutubeSubscriptionTaskResult>>, 4> subscription_load_tasks; // TODO: Use multiple curl outputs instead?
@@ -135,7 +135,7 @@ namespace QuickMedia {
YoutubeRecommendedPage(Program *program) : LazyFetchPage(program) {}
const char* get_title() const override { return "Recommended"; }
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;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
PluginResult lazy_fetch(BodyItems &result_items) override;
bool reload_on_page_change() override { return true; }
private:
@@ -149,7 +149,7 @@ namespace QuickMedia {
class YoutubeRelatedVideosPage : public RelatedVideosPage {
public:
YoutubeRelatedVideosPage(Program *program) : RelatedVideosPage(program) {}
- PluginResult submit(const std::string&, const std::string&, std::vector<Tab> &result_tabs) override;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
};
class YoutubeVideoPage : public VideoPage {