aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/HotExamples.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/HotExamples.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/HotExamples.cpp')
-rw-r--r--src/plugins/HotExamples.cpp10
1 files changed, 5 insertions, 5 deletions
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