aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/MangaGeneric.cpp
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 /src/plugins/MangaGeneric.cpp
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 'src/plugins/MangaGeneric.cpp')
-rw-r--r--src/plugins/MangaGeneric.cpp17
1 files changed, 7 insertions, 10 deletions
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) {