diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-02-07 22:54:20 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-02-07 22:55:11 +0100 |
commit | 75c610d1f65d741bbeba9f1ddeef60a6e9315427 (patch) | |
tree | 0dd79a5a7f35c89b9672d55fbf24cb1f6de13aa9 /src/plugins/Info.cpp | |
parent | 9539a71dbeafdc4107d3b92eefada332ee45579a (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/Info.cpp')
-rw-r--r-- | src/plugins/Info.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
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); } } |