aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--src/AsyncImageLoader.cpp3
-rw-r--r--src/QuickMedia.cpp40
-rw-r--r--src/plugins/AniList.cpp32
-rw-r--r--src/plugins/FileManager.cpp6
-rw-r--r--src/plugins/Fourchan.cpp10
-rw-r--r--src/plugins/HotExamples.cpp10
-rw-r--r--src/plugins/Info.cpp16
-rw-r--r--src/plugins/Lbry.cpp14
-rw-r--r--src/plugins/MangaCombined.cpp9
-rw-r--r--src/plugins/MangaGeneric.cpp17
-rw-r--r--src/plugins/Mangadex.cpp19
-rw-r--r--src/plugins/Manganelo.cpp18
-rw-r--r--src/plugins/Matrix.cpp32
-rw-r--r--src/plugins/MediaGeneric.cpp8
-rw-r--r--src/plugins/MyAnimeList.cpp16
-rw-r--r--src/plugins/NyaaSi.cpp21
-rw-r--r--src/plugins/Page.cpp8
-rw-r--r--src/plugins/Peertube.cpp22
-rw-r--r--src/plugins/Pipe.cpp6
-rw-r--r--src/plugins/Saucenao.cpp8
-rw-r--r--src/plugins/Soundcloud.cpp29
-rw-r--r--src/plugins/Youtube.cpp40
42 files changed, 255 insertions, 262 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 {
diff --git a/src/AsyncImageLoader.cpp b/src/AsyncImageLoader.cpp
index b9bcd30..741ff01 100644
--- a/src/AsyncImageLoader.cpp
+++ b/src/AsyncImageLoader.cpp
@@ -21,8 +21,11 @@
#define STB_IMAGE_RESIZE_IMPLEMENTATION
#include "../external/stb/stb_image_resize.h"
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "../external/stb/stb_image_write.h"
+#pragma GCC diagnostic pop
namespace QuickMedia {
static bool webp_to_png(const Path &thumbnail_path, const Path &destination_path) {
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 5a57022..5a3932e 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -203,11 +203,8 @@ namespace QuickMedia {
HistoryPage(Program *program, Page *search_page, HistoryType history_type) :
LazyFetchPage(program), search_page(search_page), history_type(history_type) {}
const char* get_title() const override { return "History"; }
- PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override {
- search_page->submit_body_item = submit_body_item;
- PluginResult result = search_page->submit(title, url, result_tabs);
- search_page->submit_body_item = nullptr;
- return result;
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override {
+ return search_page->submit(args, result_tabs);
}
PluginResult lazy_fetch(BodyItems &result_items) override {
switch(history_type) {
@@ -234,8 +231,8 @@ namespace QuickMedia {
OptionsPage(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 &url, std::vector<Tab>&) override {
- const int handlers_index = atoi(url.c_str());
+ PluginResult submit(const SubmitArgs &args, std::vector<Tab>&) override {
+ const int handlers_index = atoi(args.url.c_str());
handlers[handlers_index]();
program->set_go_to_previous_page();
return PluginResult::OK;
@@ -1835,8 +1832,6 @@ namespace QuickMedia {
std::vector<Tab> new_tabs;
BodyItems new_body_items;
const bool search_suggestion_submitted = tab_associated_data[selected_tab].search_suggestion_submitted;
- auto prev_selected_item = tabs[selected_tab].page->submit_body_item;
- tabs[selected_tab].page->submit_body_item = selected_item;
if((tabs[selected_tab].page->is_single_page() || (tabs[selected_tab].page->search_is_suggestion() && !search_suggestion_submitted))
&& tab_associated_data[selected_tab].fetch_future.valid())
@@ -1848,11 +1843,18 @@ namespace QuickMedia {
}
auto plugin_submit_handler = [&tabs, selected_tab, &selected_item, &search_text, &new_tabs, &new_body_items, search_suggestion_submitted]() {
+ SubmitArgs submit_args;
+ submit_args.title = selected_item ? selected_item->get_title() : search_text;
+ submit_args.url = selected_item ? selected_item->url : search_text;
+ submit_args.thumbnail_url = selected_item ? selected_item->thumbnail_url : "";
+ submit_args.userdata = selected_item ? selected_item->userdata : nullptr;
+ submit_args.extra = selected_item ? selected_item->extra : nullptr;
+
if(tabs[selected_tab].page->search_is_suggestion() && !search_suggestion_submitted) {
- PluginResult plugin_result = tabs[selected_tab].page->submit_suggestion(selected_item ? selected_item->get_title() : search_text, selected_item ? selected_item->url : search_text, new_body_items);
+ PluginResult plugin_result = tabs[selected_tab].page->submit_suggestion(submit_args, new_body_items);
return plugin_result == PluginResult::OK;
} else {
- PluginResult plugin_result = tabs[selected_tab].page->submit(selected_item ? selected_item->get_title() : search_text, selected_item ? selected_item->url : search_text, new_tabs);
+ PluginResult plugin_result = tabs[selected_tab].page->submit(submit_args, new_tabs);
return plugin_result == PluginResult::OK;
}
};
@@ -1889,11 +1891,9 @@ namespace QuickMedia {
if(tabs[selected_tab].search_bar) tabs[selected_tab].search_bar->clear();
if(new_tabs.size() == 1 && !new_tabs[0].page) {
tabs[selected_tab].body = std::move(new_tabs[0].body);
- tabs[selected_tab].page->submit_body_item = nullptr;
return;
} else if(new_tabs.empty()) {
loop_running = false;
- tabs[selected_tab].page->submit_body_item = prev_selected_item;
return;
}
}
@@ -1902,13 +1902,11 @@ namespace QuickMedia {
if(tabs[selected_tab].search_bar)
tabs[selected_tab].search_bar->set_text(selected_item ? selected_item->get_title() : search_text, false);
tabs[selected_tab].body->set_items(std::move(new_body_items));
- tabs[selected_tab].page->submit_body_item = nullptr;
tab_associated_data[selected_tab].search_suggestion_submitted = true;
return;
}
if(new_tabs.empty()) {
- tabs[selected_tab].page->submit_body_item = prev_selected_item;
return;
}
@@ -2023,7 +2021,6 @@ namespace QuickMedia {
tab.page->on_navigate_to_page(tab.body.get());
}
- tabs[selected_tab].page->submit_body_item = prev_selected_item;
redraw = true;
idle_active_handler();
hide_virtual_keyboard();
@@ -7450,9 +7447,14 @@ namespace QuickMedia {
return;
std::vector<Tab> new_tabs;
- TaskResult task_result = run_task_with_loading_screen([selected, &file_manager_page, &new_tabs]() {
- file_manager_page->submit_body_item = selected;
- return file_manager_page->submit(selected->get_title(), selected->url, new_tabs) == PluginResult::OK;
+ TaskResult task_result = run_task_with_loading_screen([&]() {
+ SubmitArgs submit_args;
+ submit_args.title = selected->get_title();
+ submit_args.url = selected->url;
+ submit_args.thumbnail_url = selected->thumbnail_url;
+ submit_args.userdata = selected->userdata;
+ submit_args.extra = selected->extra;
+ return file_manager_page->submit(submit_args, new_tabs) == PluginResult::OK;
});
if(task_result == TaskResult::TRUE) {
diff --git a/src/plugins/AniList.cpp b/src/plugins/AniList.cpp
index b892229..a41e644 100644
--- a/src/plugins/AniList.cpp
+++ b/src/plugins/AniList.cpp
@@ -517,13 +517,13 @@ query ($id: Int, $page: Int, $perPage: Int) {
return search_page(str, 1, result_items);
}
- PluginResult AniListSearchPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
- if(url.empty())
+ PluginResult AniListSearchPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ if(args.url.empty())
return PluginResult::OK;
- result_tabs.push_back({ create_body(), std::make_unique<AniListDetailsPage>(program, url), nullptr });
- result_tabs.push_back({ create_body(), std::make_unique<AniListRelatedPage>(program, url), nullptr });
- result_tabs.push_back({ create_body(), std::make_unique<AniListRecommendationsPage>(program, url), nullptr });
+ result_tabs.push_back({ create_body(), std::make_unique<AniListDetailsPage>(program, args.url), nullptr });
+ result_tabs.push_back({ create_body(), std::make_unique<AniListRelatedPage>(program, args.url), nullptr });
+ result_tabs.push_back({ create_body(), std::make_unique<AniListRecommendationsPage>(program, args.url), nullptr });
return PluginResult::OK;
}
@@ -531,13 +531,13 @@ query ($id: Int, $page: Int, $perPage: Int) {
return search_result_to_plugin_result(search_page(str, 1 + page, result_items));
}
- PluginResult AniListRelatedPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
- if(url.empty())
+ PluginResult AniListRelatedPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ if(args.url.empty())
return PluginResult::OK;
- result_tabs.push_back({ create_body(), std::make_unique<AniListDetailsPage>(program, url), nullptr });
- result_tabs.push_back({ create_body(), std::make_unique<AniListRelatedPage>(program, url), nullptr });
- result_tabs.push_back({ create_body(), std::make_unique<AniListRecommendationsPage>(program, url), nullptr });
+ result_tabs.push_back({ create_body(), std::make_unique<AniListDetailsPage>(program, args.url), nullptr });
+ result_tabs.push_back({ create_body(), std::make_unique<AniListRelatedPage>(program, args.url), nullptr });
+ result_tabs.push_back({ create_body(), std::make_unique<AniListRecommendationsPage>(program, args.url), nullptr });
return PluginResult::OK;
}
@@ -626,7 +626,7 @@ query ($id: Int, $page: Int, $perPage: Int) {
return PluginResult::OK;
}
- PluginResult AniListDetailsPage::submit(const std::string&, const std::string&, std::vector<Tab>&) {
+ PluginResult AniListDetailsPage::submit(const SubmitArgs&, std::vector<Tab>&) {
return PluginResult::OK;
}
@@ -685,13 +685,13 @@ query ($id: Int, $page: Int, $perPage: Int) {
return PluginResult::OK;
}
- PluginResult AniListRecommendationsPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
- if(url.empty())
+ PluginResult AniListRecommendationsPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ if(args.url.empty())
return PluginResult::OK;
- result_tabs.push_back({ create_body(), std::make_unique<AniListDetailsPage>(program, url), nullptr });
- result_tabs.push_back({ create_body(), std::make_unique<AniListRelatedPage>(program, url), nullptr });
- result_tabs.push_back({ create_body(), std::make_unique<AniListRecommendationsPage>(program, url), nullptr });
+ result_tabs.push_back({ create_body(), std::make_unique<AniListDetailsPage>(program, args.url), nullptr });
+ result_tabs.push_back({ create_body(), std::make_unique<AniListRelatedPage>(program, args.url), nullptr });
+ result_tabs.push_back({ create_body(), std::make_unique<AniListRecommendationsPage>(program, args.url), nullptr });
return PluginResult::OK;
}
diff --git a/src/plugins/FileManager.cpp b/src/plugins/FileManager.cpp
index 59d3a2a..eb4a3ef 100644
--- a/src/plugins/FileManager.cpp
+++ b/src/plugins/FileManager.cpp
@@ -27,12 +27,12 @@ namespace QuickMedia {
return "";
}
- PluginResult FileManagerPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
+ PluginResult FileManagerPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
std::filesystem::path new_path;
- if(url == "..")
+ if(args.url == "..")
new_path = current_dir.parent_path();
else
- new_path = current_dir / url;
+ new_path = current_dir / args.url;
if(std::filesystem::is_regular_file(new_path)) {
program->select_file(new_path);
diff --git a/src/plugins/Fourchan.cpp b/src/plugins/Fourchan.cpp
index c906c4d..d3d5a5c 100644
--- a/src/plugins/Fourchan.cpp
+++ b/src/plugins/Fourchan.cpp
@@ -229,8 +229,8 @@ namespace QuickMedia {
return comment_text;
}
- PluginResult FourchanBoardsPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- result_tabs.push_back(Tab{create_body(false, true), std::make_unique<FourchanThreadListPage>(program, title, url), create_search_bar("Search...", SEARCH_DELAY_FILTER)});
+ PluginResult FourchanBoardsPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ result_tabs.push_back(Tab{create_body(false, true), std::make_unique<FourchanThreadListPage>(program, args.title, args.url), create_search_bar("Search...", SEARCH_DELAY_FILTER)});
return PluginResult::OK;
}
@@ -272,9 +272,9 @@ namespace QuickMedia {
}
// TODO: Merge with lazy fetch
- PluginResult FourchanThreadListPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
+ PluginResult FourchanThreadListPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
Json::Value json_root;
- DownloadResult result = download_json(json_root, fourchan_url + board_id + "/thread/" + url + ".json", {}, true);
+ DownloadResult result = download_json(json_root, fourchan_url + board_id + "/thread/" + args.url + ".json", {}, true);
if(result != DownloadResult::OK) return download_result_to_plugin_result(result);
if(!json_root.isObject())
@@ -366,7 +366,7 @@ namespace QuickMedia {
auto body = create_body(false);
body->set_items(std::move(result_items));
- result_tabs.push_back(Tab{std::move(body), std::make_unique<FourchanThreadPage>(program, board_id, url), nullptr});
+ result_tabs.push_back(Tab{std::move(body), std::make_unique<FourchanThreadPage>(program, board_id, args.url), nullptr});
return PluginResult::OK;
}
diff --git a/src/plugins/HotExamples.cpp b/src/plugins/HotExamples.cpp
index 043ddfd..fbefad5 100644
--- a/src/plugins/HotExamples.cpp
+++ b/src/plugins/HotExamples.cpp
@@ -21,8 +21,8 @@ namespace QuickMedia {
body_items.push_back(create_body_item_with_url("TypeScript", "typescript"));
}
- PluginResult HotExamplesLanguageSelectPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
- result_tabs.push_back({ create_body(), std::make_unique<HotExamplesSearchPage>(program, url), create_search_bar("Search...", 500) });
+ PluginResult HotExamplesLanguageSelectPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ result_tabs.push_back({ create_body(), std::make_unique<HotExamplesSearchPage>(program, args.url), create_search_bar("Search...", 500) });
return PluginResult::OK;
}
@@ -82,10 +82,10 @@ namespace QuickMedia {
return SearchResult::OK;
}
- PluginResult HotExamplesSearchPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
+ PluginResult HotExamplesSearchPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
BodyItems result_items;
std::string website_data;
- DownloadResult download_result = download_to_string(url, website_data, {}, true);
+ DownloadResult download_result = download_to_string(args.url, website_data, {}, true);
if(download_result != DownloadResult::OK) return download_result_to_plugin_result(download_result);
QuickMediaHtmlSearch html_search;
@@ -134,7 +134,7 @@ namespace QuickMedia {
auto body = create_body();
body->set_items(std::move(result_items));
- result_tabs.push_back({ std::move(body), std::make_unique<HotExamplesCodeExamplesPage>(program, title + " code examples"), create_search_bar("Search...", SEARCH_DELAY_FILTER) });
+ result_tabs.push_back({ std::move(body), std::make_unique<HotExamplesCodeExamplesPage>(program, args.title + " code examples"), create_search_bar("Search...", SEARCH_DELAY_FILTER) });
return PluginResult::OK;
}
} \ No newline at end of file
diff --git a/src/plugins/Info.cpp b/src/plugins/Info.cpp
index 2b520ac..90c8fe1 100644
--- a/src/plugins/Info.cpp
+++ b/src/plugins/Info.cpp
@@ -32,20 +32,20 @@ namespace QuickMedia {
return exec_program_async(args, nullptr) == 0 ? PluginResult::OK : PluginResult::ERR;
}
- PluginResult InfoPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
- if(string_starts_with(url, REVERSE_IMAGE_SEARCH_URL)) {
- std::string image_url = url.substr(strlen(REVERSE_IMAGE_SEARCH_URL));
+ PluginResult InfoPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ if(string_starts_with(args.url, REVERSE_IMAGE_SEARCH_URL)) {
+ std::string image_url = args.url.substr(strlen(REVERSE_IMAGE_SEARCH_URL));
result_tabs.push_back(Tab{create_body(), std::make_unique<SaucenaoPage>(program, image_url, false), nullptr});
return PluginResult::OK;
- } else if(string_starts_with(url, GOOGLE_SEARCH_URL)) {
- const std::string search_term = url.substr(strlen(GOOGLE_SEARCH_URL));
+ } else if(string_starts_with(args.url, GOOGLE_SEARCH_URL)) {
+ const std::string search_term = args.url.substr(strlen(GOOGLE_SEARCH_URL));
const std::string search_url = "https://www.google.com/search?q=" + url_param_encode(search_term);
return open_with_browser(search_url);
- } else if(is_youtube_url(url)) {
- result_tabs.push_back(Tab{nullptr, std::make_unique<YoutubeVideoPage>(program, url), nullptr});
+ } else if(is_youtube_url(args.url)) {
+ result_tabs.push_back(Tab{nullptr, std::make_unique<YoutubeVideoPage>(program, args.url), nullptr});
return PluginResult::OK;
} else {
- return open_with_browser(url);
+ return open_with_browser(args.url);
}
}
diff --git a/src/plugins/Lbry.cpp b/src/plugins/Lbry.cpp
index 50da718..73c37ba 100644
--- a/src/plugins/Lbry.cpp
+++ b/src/plugins/Lbry.cpp
@@ -247,11 +247,11 @@ namespace QuickMedia {
return resolve_claims(this, request_json, result_items);
}
- PluginResult LbrySearchPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- if(submit_body_item->userdata == search_type_video)
- result_tabs.push_back(Tab{ nullptr, std::make_unique<LbryVideoPage>(program, title, url), nullptr });
- else if(submit_body_item->userdata == search_type_channel)
- result_tabs.push_back(Tab{ create_body(false, true), std::make_unique<LbryChannelPage>(program, title, url), create_search_bar("Search...", 500) });
+ PluginResult LbrySearchPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ if(args.userdata == search_type_video)
+ result_tabs.push_back(Tab{ nullptr, std::make_unique<LbryVideoPage>(program, args.title, args.url), nullptr });
+ else if(args.userdata == search_type_channel)
+ result_tabs.push_back(Tab{ create_body(false, true), std::make_unique<LbryChannelPage>(program, args.title, args.url), create_search_bar("Search...", 500) });
return PluginResult::OK;
}
@@ -318,8 +318,8 @@ namespace QuickMedia {
return resolve_claims(this, request_json, result_items);
}
- PluginResult LbryChannelPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- result_tabs.push_back(Tab{ nullptr, std::make_unique<LbryVideoPage>(program, title, url), nullptr });
+ PluginResult LbryChannelPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ result_tabs.push_back(Tab{ nullptr, std::make_unique<LbryVideoPage>(program, args.title, args.url), nullptr });
return PluginResult::OK;
}
diff --git a/src/plugins/MangaCombined.cpp b/src/plugins/MangaCombined.cpp
index 06ecfc0..bc4043f 100644
--- a/src/plugins/MangaCombined.cpp
+++ b/src/plugins/MangaCombined.cpp
@@ -119,13 +119,10 @@ namespace QuickMedia {
return PluginResult::OK;
}
- PluginResult MangaCombinedSearchPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- Page *page = (Page*)submit_body_item->userdata;
+ PluginResult MangaCombinedSearchPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ Page *page = (Page*)args.userdata;
if(!page) return PluginResult::OK;
- page->submit_body_item = submit_body_item;
- PluginResult result = page->submit(title, url, result_tabs);
- page->submit_body_item = nullptr;
- return result;
+ return page->submit(args, result_tabs);
}
void MangaCombinedSearchPage::cancel_operation() {
diff --git a/src/plugins/MangaGeneric.cpp b/src/plugins/MangaGeneric.cpp
index e8d8992..609dab9 100644
--- a/src/plugins/MangaGeneric.cpp
+++ b/src/plugins/MangaGeneric.cpp
@@ -284,7 +284,7 @@ namespace QuickMedia {
}
}
- PluginResult MangaGenericSearchPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
+ PluginResult MangaGenericSearchPage::submit(const SubmitArgs &submit_args, std::vector<Tab> &result_tabs) {
if(!list_chapters_query.html_query || !list_chapters_query.title_field || !list_chapters_query.url_field) {
assert(false);
return PluginResult::ERR;
@@ -303,7 +303,7 @@ namespace QuickMedia {
search_userdata.field2_contains = list_chapters_query.url_contains;
std::string website_data;
- if(download_to_string(url, website_data, args, true, fail_on_http_error) != DownloadResult::OK)
+ if(download_to_string(submit_args.url, website_data, args, true, fail_on_http_error) != DownloadResult::OK)
return PluginResult::NET_ERR;
QuickMediaHtmlSearch html_search;
@@ -366,7 +366,7 @@ namespace QuickMedia {
auto body = create_body();
body->set_items(std::move(chapters_items));
- auto chapters_page = std::make_unique<MangaGenericChaptersPage>(program, title, url, submit_body_item->thumbnail_url, manga_id_extractor, service_name, website_url, &list_page_query, fail_on_http_error);
+ auto chapters_page = std::make_unique<MangaGenericChaptersPage>(program, submit_args.title, submit_args.url, submit_args.thumbnail_url, manga_id_extractor, service_name, website_url, &list_page_query, fail_on_http_error);
result_tabs.push_back(Tab{std::move(body), std::move(chapters_page), create_search_bar("Search...", SEARCH_DELAY_FILTER)});
for(auto &it : creators) {
@@ -379,8 +379,8 @@ namespace QuickMedia {
return PluginResult::OK;
}
- PluginResult MangaGenericChaptersPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- result_tabs.push_back(Tab{nullptr, std::make_unique<MangaGenericImagesPage>(program, content_title, title, url, service_name, website_url, list_page_query, fail_on_http_error, thumbnail_url), nullptr});
+ PluginResult MangaGenericChaptersPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ result_tabs.push_back(Tab{nullptr, std::make_unique<MangaGenericImagesPage>(program, content_title, args.title, args.url, service_name, website_url, list_page_query, fail_on_http_error, thumbnail_url), nullptr});
return PluginResult::OK;
}
@@ -405,11 +405,8 @@ namespace QuickMedia {
return true;
}
- PluginResult MangaGenericCreatorPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- search_page->submit_body_item = submit_body_item;
- PluginResult result = search_page->submit(title, url, result_tabs);
- search_page->submit_body_item = nullptr;
- return result;
+ PluginResult MangaGenericCreatorPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ return search_page->submit(args, result_tabs);
}
PluginResult MangaGenericCreatorPage::lazy_fetch(BodyItems &result_items) {
diff --git a/src/plugins/Mangadex.cpp b/src/plugins/Mangadex.cpp
index 79341bd..3b6b2e0 100644
--- a/src/plugins/Mangadex.cpp
+++ b/src/plugins/Mangadex.cpp
@@ -350,21 +350,21 @@ namespace QuickMedia {
}
// TODO: Do requests in parallel
- PluginResult MangadexSearchPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
+ PluginResult MangadexSearchPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
PluginResult result;
BodyItems body_items;
- result = get_chapters_for_manga(this, url, 0, body_items);
+ result = get_chapters_for_manga(this, args.url, 0, body_items);
if(result != PluginResult::OK)
return result;
auto body = create_body();
body->set_items(std::move(body_items));
- auto chapters_page = std::make_unique<MangadexChaptersPage>(program, this, title, url, submit_body_item->thumbnail_url);
+ auto chapters_page = std::make_unique<MangadexChaptersPage>(program, this, args.title, args.url, args.thumbnail_url);
result_tabs.push_back(Tab{std::move(body), std::move(chapters_page), create_search_bar("Search...", SEARCH_DELAY_FILTER)});
std::vector<Creator> creators;
- result = get_creators_for_manga(this, url, creators);
+ result = get_creators_for_manga(this, args.url, creators);
if(result != PluginResult::OK)
return result;
@@ -376,8 +376,8 @@ namespace QuickMedia {
return PluginResult::OK;
}
- PluginResult MangadexChaptersPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- result_tabs.push_back(Tab{nullptr, std::make_unique<MangadexImagesPage>(program, search_page, content_title, url, title, thumbnail_url), nullptr});
+ PluginResult MangadexChaptersPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ result_tabs.push_back(Tab{nullptr, std::make_unique<MangadexImagesPage>(program, search_page, content_title, args.url, args.title, thumbnail_url), nullptr});
return PluginResult::OK;
}
@@ -385,11 +385,8 @@ namespace QuickMedia {
return get_chapters_for_manga(this, content_url, page, result_items);
}
- PluginResult MangadexCreatorPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- search_page->submit_body_item = submit_body_item;
- PluginResult result = search_page->submit(title, url, result_tabs);
- search_page->submit_body_item = nullptr;
- return result;
+ PluginResult MangadexCreatorPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ return search_page->submit(args, result_tabs);
}
PluginResult MangadexCreatorPage::get_page(const std::string&, int page, BodyItems &result_items) {
diff --git a/src/plugins/Manganelo.cpp b/src/plugins/Manganelo.cpp
index 55f0467..a440743 100644
--- a/src/plugins/Manganelo.cpp
+++ b/src/plugins/Manganelo.cpp
@@ -30,12 +30,12 @@ namespace QuickMedia {
return true;
}
- static PluginResult submit_manga(Page *page, const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
+ static PluginResult submit_manga(Page *page, const SubmitArgs &args, std::vector<Tab> &result_tabs) {
BodyItems chapters_items;
std::vector<Creator> creators;
std::string website_data;
- if(download_to_string(url, website_data, {CommandArg { "-H", "referer: https://manganelo.com/" }}, true) != DownloadResult::OK)
+ if(download_to_string(args.url, website_data, {CommandArg { "-H", "referer: https://manganelo.com/" }}, true) != DownloadResult::OK)
return PluginResult::NET_ERR;
QuickMediaHtmlSearch html_search;
@@ -95,7 +95,7 @@ namespace QuickMedia {
auto chapters_body = page->create_body();
chapters_body->set_items(std::move(chapters_items));
- auto chapters_page = std::make_unique<ManganeloChaptersPage>(page->program, title, url, page->submit_body_item->thumbnail_url);
+ auto chapters_page = std::make_unique<ManganeloChaptersPage>(page->program, args.title, args.url, args.thumbnail_url);
result_tabs.push_back(Tab{std::move(chapters_body), std::move(chapters_page), page->create_search_bar("Search...", SEARCH_DELAY_FILTER)});
// TODO: Fix. Doesn't work because manganelo changed creator url format
@@ -149,12 +149,12 @@ namespace QuickMedia {
return SearchResult::OK;
}
- PluginResult ManganeloSearchPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- return submit_manga(this, title, url, result_tabs);
+ PluginResult ManganeloSearchPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ return submit_manga(this, args, result_tabs);
}
- PluginResult ManganeloChaptersPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- result_tabs.push_back(Tab{nullptr, std::make_unique<ManganeloImagesPage>(program, content_title, title, url, thumbnail_url), nullptr});
+ PluginResult ManganeloChaptersPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ result_tabs.push_back(Tab{nullptr, std::make_unique<ManganeloImagesPage>(program, content_title, args.title, args.url, thumbnail_url), nullptr});
return PluginResult::OK;
}
@@ -191,8 +191,8 @@ namespace QuickMedia {
}
}
- PluginResult ManganeloCreatorPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- return submit_manga(this, title, url, result_tabs);
+ PluginResult ManganeloCreatorPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ return submit_manga(this, args, result_tabs);
}
PluginResult ManganeloCreatorPage::lazy_fetch(BodyItems &result_items) {
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index c69a6df..a71b3a8 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -668,8 +668,8 @@ namespace QuickMedia {
room_tags_page->set_current_rooms_page(nullptr);
}
- PluginResult MatrixRoomsPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
- result_tabs.push_back(Tab{nullptr, std::make_unique<MatrixChatPage>(program, url, this), nullptr});
+ PluginResult MatrixRoomsPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ result_tabs.push_back(Tab{nullptr, std::make_unique<MatrixChatPage>(program, args.url, this), nullptr});
return PluginResult::OK;
}
@@ -735,10 +735,10 @@ namespace QuickMedia {
current_chat_page->should_clear_data = true;
}
- PluginResult MatrixRoomTagsPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
+ PluginResult MatrixRoomTagsPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
auto body = create_body(true);
Body *body_ptr = body.get();
- TagData &tag_data = tag_body_items_by_name[url];
+ TagData &tag_data = tag_body_items_by_name[args.url];
BodyItems room_body_items = tag_data.room_body_items;
sort_room_body_items(room_body_items);
body->set_items(std::move(room_body_items));
@@ -834,15 +834,15 @@ namespace QuickMedia {
}
- PluginResult MatrixInvitesPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
+ PluginResult MatrixInvitesPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
auto body = create_body();
body->append_item(BodyItem::create("Accept"));
body->append_item(BodyItem::create("Decline"));
- result_tabs.push_back(Tab{std::move(body), std::make_unique<MatrixInviteDetailsPage>(program, matrix, this, url, "Invite to " + title), nullptr});
+ result_tabs.push_back(Tab{std::move(body), std::make_unique<MatrixInviteDetailsPage>(program, matrix, this, args.url, "Invite to " + title), nullptr});
return PluginResult::OK;
}
- PluginResult MatrixInviteDetailsPage::submit(const std::string &title, const std::string&, std::vector<Tab>&) {
+ PluginResult MatrixInviteDetailsPage::submit(const SubmitArgs &args, std::vector<Tab>&) {
if(title == "Accept") {
if(matrix->join_room(room_id) == PluginResult::OK) {
// TODO: Wait for room invite list change from the server instead of removing room here.
@@ -982,8 +982,8 @@ namespace QuickMedia {
rooms_page->set_room_as_read(room);
}
- PluginResult MatrixRoomDirectoryPage::submit(const std::string &title, const std::string&, std::vector<Tab> &result_tabs) {
- std::string server_name = title;
+ PluginResult MatrixRoomDirectoryPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ std::string server_name = args.title;
if(strncmp(server_name.c_str(), "http://", 7) == 0)
server_name.erase(0, 7);
@@ -1017,12 +1017,12 @@ namespace QuickMedia {
return plugin_result_to_search_result(lazy_fetch(result_items));
}
- PluginResult MatrixServerRoomListPage::submit(const std::string &title, const std::string &url, std::vector<Tab>&) {
- if(matrix->join_room(url) == PluginResult::OK) {
- show_notification("QuickMedia", "You joined " + title, Urgency::NORMAL);
+ PluginResult MatrixServerRoomListPage::submit(const SubmitArgs &args, std::vector<Tab>&) {
+ if(matrix->join_room(args.url) == PluginResult::OK) {
+ show_notification("QuickMedia", "You joined " + args.title, Urgency::NORMAL);
program->set_go_to_previous_page();
} else {
- show_notification("QuickMedia", "Failed to join " + title, Urgency::CRITICAL);
+ show_notification("QuickMedia", "Failed to join " + args.title, Urgency::CRITICAL);
}
return PluginResult::OK;
}
@@ -1060,7 +1060,7 @@ namespace QuickMedia {
MatrixNotificationsPage::MatrixNotificationsPage(Program *program, Matrix *matrix, Body *notifications_body, MatrixRoomsPage *all_rooms_page) :
LazyFetchPage(program), matrix(matrix), notifications_body(notifications_body), all_rooms_page(all_rooms_page) {}
- PluginResult MatrixNotificationsPage::submit(const std::string&, const std::string&, std::vector<Tab> &result_tabs) {
+ PluginResult MatrixNotificationsPage::submit(const SubmitArgs&, std::vector<Tab> &result_tabs) {
BodyItem *selected_item = notifications_body->get_selected();
if(!selected_item)
return PluginResult::OK;
@@ -1145,8 +1145,8 @@ namespace QuickMedia {
return plugin_result_to_search_result(matrix->search_user(str, 20, result_items));
}
- PluginResult MatrixInviteUserPage::submit(const std::string&, const std::string &url, std::vector<Tab>&) {
- PluginResult result = matrix->invite_user(room_id, url);
+ PluginResult MatrixInviteUserPage::submit(const SubmitArgs &args, std::vector<Tab>&) {
+ PluginResult result = matrix->invite_user(room_id, args.url);
if(result != PluginResult::OK) return result;
program->set_go_to_previous_page();
return PluginResult::OK;
diff --git a/src/plugins/MediaGeneric.cpp b/src/plugins/MediaGeneric.cpp
index 2b88fdb..0b69556 100644
--- a/src/plugins/MediaGeneric.cpp
+++ b/src/plugins/MediaGeneric.cpp
@@ -138,8 +138,8 @@ namespace QuickMedia {
return fetch_page_results(url, website_url, text_queries, thumbnail_queries, thumbnail_max_size, nullptr, result_items, cloudflare_bypass, extra_commands);
}
- PluginResult MediaGenericSearchPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
- result_tabs.push_back(Tab{nullptr, std::make_unique<MediaGenericVideoPage>(program, this, url), nullptr});
+ PluginResult MediaGenericSearchPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ result_tabs.push_back(Tab{nullptr, std::make_unique<MediaGenericVideoPage>(program, this, args.url), nullptr});
return PluginResult::OK;
}
@@ -182,8 +182,8 @@ namespace QuickMedia {
return *this;
}
- PluginResult MediaGenericRelatedPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
- result_tabs.push_back(Tab{nullptr, std::make_unique<MediaGenericVideoPage>(program, search_page, url), nullptr});
+ PluginResult MediaGenericRelatedPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ result_tabs.push_back(Tab{nullptr, std::make_unique<MediaGenericVideoPage>(program, search_page, args.url), nullptr});
return PluginResult::OK;
}
diff --git a/src/plugins/MyAnimeList.cpp b/src/plugins/MyAnimeList.cpp
index ee5d4fd..b982e3c 100644
--- a/src/plugins/MyAnimeList.cpp
+++ b/src/plugins/MyAnimeList.cpp
@@ -150,16 +150,16 @@ namespace QuickMedia {
return SearchResult::OK;
}
- PluginResult MyAnimeListSearchPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
- if(url.empty())
+ PluginResult MyAnimeListSearchPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ if(args.url.empty())
return PluginResult::OK;
- result_tabs.push_back({ create_body(), std::make_unique<MyAnimeListDetailsPage>(program, url), nullptr });
- result_tabs.push_back({ create_body(false, true), std::make_unique<MyAnimeListRecommendationsPage>(program, url), nullptr });
+ result_tabs.push_back({ create_body(), std::make_unique<MyAnimeListDetailsPage>(program, args.url), nullptr });
+ result_tabs.push_back({ create_body(false, true), std::make_unique<MyAnimeListRecommendationsPage>(program, args.url), nullptr });
return PluginResult::OK;
}
- PluginResult MyAnimeListDetailsPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
+ PluginResult MyAnimeListDetailsPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
return PluginResult::OK;
}
@@ -210,9 +210,9 @@ namespace QuickMedia {
return PluginResult::OK;
}
- PluginResult MyAnimeListRecommendationsPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
- result_tabs.push_back({ create_body(), std::make_unique<MyAnimeListDetailsPage>(program, url), nullptr });
- result_tabs.push_back({ create_body(false, true), std::make_unique<MyAnimeListRecommendationsPage>(program, url), nullptr });
+ PluginResult MyAnimeListRecommendationsPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ result_tabs.push_back({ create_body(), std::make_unique<MyAnimeListDetailsPage>(program, args.url), nullptr });
+ result_tabs.push_back({ create_body(false, true), std::make_unique<MyAnimeListRecommendationsPage>(program, args.url), nullptr });
return PluginResult::OK;
}
diff --git a/src/plugins/NyaaSi.cpp b/src/plugins/NyaaSi.cpp
index a110c57..fc3e7ee 100644
--- a/src/plugins/NyaaSi.cpp
+++ b/src/plugins/NyaaSi.cpp
@@ -284,14 +284,14 @@ namespace QuickMedia {
return SearchResult::OK;
}
- PluginResult NyaaSiCategoryPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
+ PluginResult NyaaSiCategoryPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
std::string domain = is_sukebei ? "sukebei.nyaa.si" : "nyaa.si";
BodyItems result_items;
- SearchResult search_result = search_page(domain, url, "", 1, NyaaSiSortType::UPLOAD_DATE_DESC, result_items);
+ SearchResult search_result = search_page(domain, args.url, "", 1, NyaaSiSortType::UPLOAD_DATE_DESC, result_items);
if(search_result != SearchResult::OK) return search_result_to_plugin_result(search_result);
- auto search_page = std::make_unique<NyaaSiSearchPage>(program, strip(title), url, std::move(domain));
+ auto search_page = std::make_unique<NyaaSiSearchPage>(program, strip(args.title), args.url, std::move(domain));
NyaaSiSearchPage *search_page_p = search_page.get();
auto body = create_body();
body->set_items(std::move(result_items));
@@ -323,7 +323,7 @@ namespace QuickMedia {
const std::string *domain;
};
- PluginResult NyaaSiSearchPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
+ PluginResult NyaaSiSearchPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
size_t comments_start_index;
std::string title;
BodyItems result_items;
@@ -337,7 +337,7 @@ namespace QuickMedia {
result_item_extra.domain = &domain;
std::string website_data;
- if(download_to_string(url, website_data, {}, true) != DownloadResult::OK)
+ if(download_to_string(args.url, website_data, {}, true) != DownloadResult::OK)
return PluginResult::NET_ERR;
QuickMediaHtmlSearch html_search;
@@ -498,8 +498,8 @@ namespace QuickMedia {
title.erase(title.end() - 5, title.end()); // Erase emoji character and space at the end. TODO: Remove this when tabs support emojis.
}
- PluginResult NyaaSiSortOrderPage::submit(const std::string&, const std::string&, std::vector<Tab>&) {
- const NyaaSiSortType sort_type = (NyaaSiSortType)(size_t)submit_body_item->userdata;
+ PluginResult NyaaSiSortOrderPage::submit(const SubmitArgs &args, std::vector<Tab>&) {
+ const NyaaSiSortType sort_type = (NyaaSiSortType)(size_t)args.userdata;
body->clear_items();
sort_page_create_body_items(body, sort_type);
search_page->set_sort_type(sort_type);
@@ -507,15 +507,14 @@ namespace QuickMedia {
return PluginResult::OK;
}
- PluginResult NyaaSiTorrentPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- (void)title;
+ PluginResult NyaaSiTorrentPage::submit(const SubmitArgs &submit_args, std::vector<Tab> &result_tabs) {
(void)result_tabs;
- if(strncmp(url.c_str(), "magnet:?", 8) == 0) {
+ if(strncmp(submit_args.url.c_str(), "magnet:?", 8) == 0) {
if(!is_program_executable_by_name("xdg-open")) {
show_notification("QuickMedia", "xdg-utils which provides xdg-open needs to be installed to download torrents", Urgency::CRITICAL);
return PluginResult::ERR;
}
- const char *args[] = { "xdg-open", url.c_str(), nullptr };
+ const char *args[] = { "xdg-open", submit_args.url.c_str(), nullptr };
exec_program_async(args, nullptr);
}
return PluginResult::OK;
diff --git a/src/plugins/Page.cpp b/src/plugins/Page.cpp
index c7b0bb3..26c795c 100644
--- a/src/plugins/Page.cpp
+++ b/src/plugins/Page.cpp
@@ -71,12 +71,8 @@ namespace QuickMedia {
program->set_clipboard(clipboard);
}
- PluginResult BookmarksPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- // TODO: Find a better solution to not keep the submit body item alive
- redirect_page->submit_body_item = submit_body_item;
- PluginResult result = redirect_page->submit(title, url, result_tabs);
- redirect_page->submit_body_item = nullptr;
- return result;
+ PluginResult BookmarksPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ return redirect_page->submit(args, result_tabs);
}
PluginResult BookmarksPage::lazy_fetch(BodyItems &result_items) {
diff --git a/src/plugins/Peertube.cpp b/src/plugins/Peertube.cpp
index 3e23807..a5c5865 100644
--- a/src/plugins/Peertube.cpp
+++ b/src/plugins/Peertube.cpp
@@ -15,8 +15,8 @@ namespace QuickMedia {
return "";
}
- PluginResult PeertubeInstanceSelectionPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
- result_tabs.push_back(Tab{create_body(false, true), std::make_unique<PeertubeSearchPage>(program, url), create_search_bar("Search...", 500)});
+ PluginResult PeertubeInstanceSelectionPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ result_tabs.push_back(Tab{create_body(false, true), std::make_unique<PeertubeSearchPage>(program, args.url), create_search_bar("Search...", 500)});
return PluginResult::OK;
}
@@ -252,14 +252,14 @@ namespace QuickMedia {
return videos_request(this, url, server, search_type, result_items);
}
- PluginResult PeertubeSearchPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- const SearchType search_type = (SearchType)(uintptr_t)submit_body_item->userdata;
+ PluginResult PeertubeSearchPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ const SearchType search_type = (SearchType)(uintptr_t)args.userdata;
if(search_type == SearchType::VIDEO_CHANNELS) {
- result_tabs.push_back(Tab{ create_body(false, true), std::make_unique<PeertubeChannelPage>(program, server, title, url), nullptr });
+ result_tabs.push_back(Tab{ create_body(false, true), std::make_unique<PeertubeChannelPage>(program, server, args.title, args.url), nullptr });
} else if(search_type == SearchType::VIDEO_PLAYLISTS) {
- result_tabs.push_back(Tab{ create_body(false, true), std::make_unique<PeertubePlaylistPage>(program, server, title, url), nullptr });
+ result_tabs.push_back(Tab{ create_body(false, true), std::make_unique<PeertubePlaylistPage>(program, server, args.title, args.url), nullptr });
} else if(search_type == SearchType::VIDEOS) {
- result_tabs.push_back(Tab{ nullptr, std::make_unique<PeertubeVideoPage>(program, server, url, false), nullptr });
+ result_tabs.push_back(Tab{ nullptr, std::make_unique<PeertubeVideoPage>(program, server, args.url, false), nullptr });
}
return PluginResult::OK;
}
@@ -274,8 +274,8 @@ namespace QuickMedia {
return videos_request(this, url, server, PeertubeSearchPage::SearchType::VIDEOS, result_items);
}
- PluginResult PeertubeChannelPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
- result_tabs.push_back(Tab{ nullptr, std::make_unique<PeertubeVideoPage>(program, server, url, false), nullptr });
+ PluginResult PeertubeChannelPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ result_tabs.push_back(Tab{ nullptr, std::make_unique<PeertubeVideoPage>(program, server, args.url, false), nullptr });
return PluginResult::OK;
}
@@ -289,8 +289,8 @@ namespace QuickMedia {
return videos_request(this, url, server, PeertubeSearchPage::SearchType::VIDEOS, result_items);
}
- PluginResult PeertubePlaylistPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
- result_tabs.push_back(Tab{ nullptr, std::make_unique<PeertubeVideoPage>(program, server, url, true), nullptr });
+ PluginResult PeertubePlaylistPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ result_tabs.push_back(Tab{ nullptr, std::make_unique<PeertubeVideoPage>(program, server, args.url, true), nullptr });
return PluginResult::OK;
}
diff --git a/src/plugins/Pipe.cpp b/src/plugins/Pipe.cpp
index 4fa8cf3..fdd4958 100644
--- a/src/plugins/Pipe.cpp
+++ b/src/plugins/Pipe.cpp
@@ -4,9 +4,9 @@
#include <iostream>
namespace QuickMedia {
- PluginResult PipePage::submit(const std::string &title, const std::string &url, std::vector<Tab>&) {
- puts(!url.empty() ? url.c_str() : title.c_str());
- program->set_pipe_selected_text(!url.empty() ? url : title);
+ PluginResult PipePage::submit(const SubmitArgs &args, std::vector<Tab>&) {
+ puts(!args.url.empty() ? args.url.c_str() : args.title.c_str());
+ program->set_pipe_selected_text(!args.url.empty() ? args.url : title);
return PluginResult::OK;
}
diff --git a/src/plugins/Saucenao.cpp b/src/plugins/Saucenao.cpp
index 064bb11..6833bea 100644
--- a/src/plugins/Saucenao.cpp
+++ b/src/plugins/Saucenao.cpp
@@ -47,17 +47,17 @@ namespace QuickMedia {
}
}
- PluginResult SaucenaoPage::submit(const std::string &title, const std::string&, std::vector<Tab> &result_tabs) {
- if(!submit_body_item)
+ PluginResult SaucenaoPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ if(!args.extra)
return PluginResult::OK;
- SaucenaoBodyItemUrls *urls = static_cast<SaucenaoBodyItemUrls*>(submit_body_item->extra.get());
+ SaucenaoBodyItemUrls *urls = static_cast<SaucenaoBodyItemUrls*>(args.extra.get());
BodyItems body_items;
for(const std::string &url : urls->urls) {
body_items.push_back(InfoPage::add_url(url));
}
- body_items.push_back(InfoPage::add_google_search(title));
+ body_items.push_back(InfoPage::add_google_search(args.title));
auto body = create_body();
body->set_items(std::move(body_items));
diff --git a/src/plugins/Soundcloud.cpp b/src/plugins/Soundcloud.cpp
index 7f2b1f1..9da65ee 100644
--- a/src/plugins/Soundcloud.cpp
+++ b/src/plugins/Soundcloud.cpp
@@ -236,17 +236,17 @@ namespace QuickMedia {
return PluginResult::OK;
}
- PluginResult SoundcloudPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- if(url.empty())
+ PluginResult SoundcloudPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ if(args.url.empty())
return PluginResult::ERR;
- if(url == "track") {
- SoundcloudPlaylist *playlist = static_cast<SoundcloudPlaylist*>(submit_body_item->extra.get());
+ if(args.url == "track") {
+ SoundcloudPlaylist *playlist = static_cast<SoundcloudPlaylist*>(args.extra.get());
auto body = create_body(false, true);
body->set_items(playlist->tracks);
- result_tabs.push_back(Tab{std::move(body), std::make_unique<SoundcloudPlaylistPage>(program, playlist, title), nullptr});
- } else if(url.find("/stream/users/") != std::string::npos) {
- std::string query_url = url + "?client_id=" + client_id + "&limit=20&offset=0&linked_partitioning=1&app_version=1616689516&app_locale=en";
+ result_tabs.push_back(Tab{std::move(body), std::make_unique<SoundcloudPlaylistPage>(program, playlist, args.title), nullptr});
+ } else if(args.url.find("/stream/users/") != std::string::npos) {
+ std::string query_url = args.url + "?client_id=" + client_id + "&limit=20&offset=0&linked_partitioning=1&app_version=1616689516&app_locale=en";
Json::Value json_root;
DownloadResult result = download_json(json_root, query_url, {}, true);
@@ -259,9 +259,9 @@ namespace QuickMedia {
body->set_items(std::move(body_items));
if(pr != PluginResult::OK) return pr;
- result_tabs.push_back(Tab{std::move(body), std::make_unique<SoundcloudUserPage>(program, title, url, std::move(next_href)), nullptr});
+ result_tabs.push_back(Tab{std::move(body), std::make_unique<SoundcloudUserPage>(program, args.title, args.url, std::move(next_href)), nullptr});
} else {
- std::string query_url = url + "?client_id=" + client_id;
+ std::string query_url = args.url + "?client_id=" + client_id;
Json::Value json_root;
DownloadResult result = download_json(json_root, query_url, {}, true);
@@ -276,21 +276,18 @@ namespace QuickMedia {
// TODO: Remove when youtube-dl is no longer required to download music
std::string permalink_url;
- SoundcloudTrack *track = static_cast<SoundcloudTrack*>(submit_body_item->extra.get());
+ SoundcloudTrack *track = static_cast<SoundcloudTrack*>(args.extra.get());
if(track)
permalink_url = track->permalink_url;
- result_tabs.push_back(Tab{nullptr, std::make_unique<SoundcloudAudioPage>(program, title, url_json.asString(), std::move(permalink_url)), nullptr});
+ result_tabs.push_back(Tab{nullptr, std::make_unique<SoundcloudAudioPage>(program, args.title, url_json.asString(), std::move(permalink_url)), nullptr});
}
return PluginResult::OK;
}
- PluginResult SoundcloudSearchPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- submit_page.submit_body_item = submit_body_item;
- PluginResult result = submit_page.submit(title, url, result_tabs);
- submit_page.submit_body_item = nullptr;
- return result;
+ PluginResult SoundcloudSearchPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ return submit_page.submit(args, result_tabs);
}
SearchResult SoundcloudSearchPage::search(const std::string &str, BodyItems &result_items) {
diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp
index b86112d..d6035f2 100644
--- a/src/plugins/Youtube.cpp
+++ b/src/plugins/Youtube.cpp
@@ -854,26 +854,26 @@ namespace QuickMedia {
return PluginResult::OK;
}
- PluginResult YoutubeSearchPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- if(url.empty())
+ PluginResult YoutubeSearchPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ if(args.url.empty())
return PluginResult::OK;
- if(strncmp(url.c_str(), "https://www.youtube.com/channel/", 32) == 0) {
+ if(strncmp(args.url.c_str(), "https://www.youtube.com/channel/", 32) == 0) {
// TODO: Make all pages (for all services) lazy fetch in a similar manner!
- result_tabs.push_back(Tab{create_body(false, true), std::make_unique<YoutubeChannelPage>(program, url, "", title), create_search_bar("Search...", 350)});
+ result_tabs.push_back(Tab{create_body(false, true), std::make_unique<YoutubeChannelPage>(program, args.url, "", args.title), create_search_bar("Search...", 350)});
} else {
- result_tabs.push_back(Tab{nullptr, std::make_unique<YoutubeVideoPage>(program, url), nullptr});
+ result_tabs.push_back(Tab{nullptr, std::make_unique<YoutubeVideoPage>(program, args.url), nullptr});
}
return PluginResult::OK;
}
- PluginResult YoutubeSearchPage::submit_suggestion(const std::string&, const std::string &url, BodyItems &result_items) {
+ PluginResult YoutubeSearchPage::submit_suggestion(const SubmitArgs &args, BodyItems &result_items) {
continuation_token.clear();
current_page = 0;
added_videos.clear();
search_url = "https://www.youtube.com/results?search_query=";
- search_url += url_param_encode(url);
+ search_url += url_param_encode(args.url);
std::vector<CommandArg> additional_args = {
{ "-H", "x-spf-referer: " + search_url },
@@ -1003,10 +1003,10 @@ namespace QuickMedia {
return PluginResult::OK;
}
- PluginResult YoutubeCommentsPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
- if(url.empty())
+ PluginResult YoutubeCommentsPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ if(args.url.empty())
return PluginResult::OK;
- result_tabs.push_back(Tab{create_body(), std::make_unique<YoutubeCommentRepliesPage>(program, video_url, url), nullptr});
+ result_tabs.push_back(Tab{create_body(), std::make_unique<YoutubeCommentRepliesPage>(program, video_url, args.url), nullptr});
return PluginResult::OK;
}
@@ -1332,7 +1332,7 @@ namespace QuickMedia {
return PluginResult::OK;
}
- PluginResult YoutubeCommentRepliesPage::submit(const std::string&, const std::string&, std::vector<Tab>&) {
+ PluginResult YoutubeCommentRepliesPage::submit(const SubmitArgs &args, std::vector<Tab>&) {
return PluginResult::OK;
}
@@ -1531,10 +1531,10 @@ namespace QuickMedia {
return PluginResult::OK;
}
- PluginResult YoutubeChannelPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
- if(url.empty())
+ PluginResult YoutubeChannelPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ if(args.url.empty())
return PluginResult::OK;
- result_tabs.push_back(Tab{nullptr, std::make_unique<YoutubeVideoPage>(program, url), nullptr});
+ result_tabs.push_back(Tab{nullptr, std::make_unique<YoutubeVideoPage>(program, args.url), nullptr});
return PluginResult::OK;
}
@@ -1624,8 +1624,8 @@ namespace QuickMedia {
return TrackResult::OK;
}
- PluginResult YoutubeSubscriptionsPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
- result_tabs.push_back(Tab{nullptr, std::make_unique<YoutubeVideoPage>(program, url), nullptr});
+ PluginResult YoutubeSubscriptionsPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ result_tabs.push_back(Tab{nullptr, std::make_unique<YoutubeVideoPage>(program, args.url), nullptr});
return PluginResult::OK;
}
@@ -1863,8 +1863,8 @@ namespace QuickMedia {
return PluginResult::OK;
}
- PluginResult YoutubeRecommendedPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
- result_tabs.push_back(Tab{nullptr, std::make_unique<YoutubeVideoPage>(program, url), nullptr});
+ PluginResult YoutubeRecommendedPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ result_tabs.push_back(Tab{nullptr, std::make_unique<YoutubeVideoPage>(program, args.url), nullptr});
return PluginResult::OK;
}
@@ -1959,8 +1959,8 @@ namespace QuickMedia {
return PluginResult::OK;
}
- PluginResult YoutubeRelatedVideosPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
- result_tabs.push_back(Tab{nullptr, std::make_unique<YoutubeVideoPage>(program, url), nullptr});
+ PluginResult YoutubeRelatedVideosPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ result_tabs.push_back(Tab{nullptr, std::make_unique<YoutubeVideoPage>(program, args.url), nullptr});
return PluginResult::OK;
}