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/Peertube.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/Peertube.cpp')
-rw-r--r-- | src/plugins/Peertube.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/plugins/Peertube.cpp b/src/plugins/Peertube.cpp index 3e23807..a5c5865 100644 --- a/src/plugins/Peertube.cpp +++ b/src/plugins/Peertube.cpp @@ -15,8 +15,8 @@ namespace QuickMedia { return ""; } - PluginResult PeertubeInstanceSelectionPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) { - result_tabs.push_back(Tab{create_body(false, true), std::make_unique<PeertubeSearchPage>(program, url), create_search_bar("Search...", 500)}); + PluginResult PeertubeInstanceSelectionPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) { + result_tabs.push_back(Tab{create_body(false, true), std::make_unique<PeertubeSearchPage>(program, args.url), create_search_bar("Search...", 500)}); return PluginResult::OK; } @@ -252,14 +252,14 @@ namespace QuickMedia { return videos_request(this, url, server, search_type, result_items); } - PluginResult PeertubeSearchPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) { - const SearchType search_type = (SearchType)(uintptr_t)submit_body_item->userdata; + PluginResult PeertubeSearchPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) { + const SearchType search_type = (SearchType)(uintptr_t)args.userdata; if(search_type == SearchType::VIDEO_CHANNELS) { - result_tabs.push_back(Tab{ create_body(false, true), std::make_unique<PeertubeChannelPage>(program, server, title, url), nullptr }); + result_tabs.push_back(Tab{ create_body(false, true), std::make_unique<PeertubeChannelPage>(program, server, args.title, args.url), nullptr }); } else if(search_type == SearchType::VIDEO_PLAYLISTS) { - result_tabs.push_back(Tab{ create_body(false, true), std::make_unique<PeertubePlaylistPage>(program, server, title, url), nullptr }); + result_tabs.push_back(Tab{ create_body(false, true), std::make_unique<PeertubePlaylistPage>(program, server, args.title, args.url), nullptr }); } else if(search_type == SearchType::VIDEOS) { - result_tabs.push_back(Tab{ nullptr, std::make_unique<PeertubeVideoPage>(program, server, url, false), nullptr }); + result_tabs.push_back(Tab{ nullptr, std::make_unique<PeertubeVideoPage>(program, server, args.url, false), nullptr }); } return PluginResult::OK; } @@ -274,8 +274,8 @@ namespace QuickMedia { return videos_request(this, url, server, PeertubeSearchPage::SearchType::VIDEOS, result_items); } - PluginResult PeertubeChannelPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) { - result_tabs.push_back(Tab{ nullptr, std::make_unique<PeertubeVideoPage>(program, server, url, false), nullptr }); + PluginResult PeertubeChannelPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) { + result_tabs.push_back(Tab{ nullptr, std::make_unique<PeertubeVideoPage>(program, server, args.url, false), nullptr }); return PluginResult::OK; } @@ -289,8 +289,8 @@ namespace QuickMedia { return videos_request(this, url, server, PeertubeSearchPage::SearchType::VIDEOS, result_items); } - PluginResult PeertubePlaylistPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) { - result_tabs.push_back(Tab{ nullptr, std::make_unique<PeertubeVideoPage>(program, server, url, true), nullptr }); + PluginResult PeertubePlaylistPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) { + result_tabs.push_back(Tab{ nullptr, std::make_unique<PeertubeVideoPage>(program, server, args.url, true), nullptr }); return PluginResult::OK; } |