From 75c610d1f65d741bbeba9f1ddeef60a6e9315427 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 7 Feb 2022 22:54:20 +0100 Subject: 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. --- src/plugins/HotExamples.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/plugins/HotExamples.cpp') 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 &result_tabs) { - result_tabs.push_back({ create_body(), std::make_unique(program, url), create_search_bar("Search...", 500) }); + PluginResult HotExamplesLanguageSelectPage::submit(const SubmitArgs &args, std::vector &result_tabs) { + result_tabs.push_back({ create_body(), std::make_unique(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 &result_tabs) { + PluginResult HotExamplesSearchPage::submit(const SubmitArgs &args, std::vector &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(program, title + " code examples"), create_search_bar("Search...", SEARCH_DELAY_FILTER) }); + result_tabs.push_back({ std::move(body), std::make_unique(program, args.title + " code examples"), create_search_bar("Search...", SEARCH_DELAY_FILTER) }); return PluginResult::OK; } } \ No newline at end of file -- cgit v1.2.3