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/Fourchan.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/plugins/Fourchan.cpp') 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 &result_tabs) { - result_tabs.push_back(Tab{create_body(false, true), std::make_unique(program, title, url), create_search_bar("Search...", SEARCH_DELAY_FILTER)}); + PluginResult FourchanBoardsPage::submit(const SubmitArgs &args, std::vector &result_tabs) { + result_tabs.push_back(Tab{create_body(false, true), std::make_unique(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 &result_tabs) { + PluginResult FourchanThreadListPage::submit(const SubmitArgs &args, std::vector &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(program, board_id, url), nullptr}); + result_tabs.push_back(Tab{std::move(body), std::make_unique(program, board_id, args.url), nullptr}); return PluginResult::OK; } -- cgit v1.2.3