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/Peertube.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/plugins/Peertube.cpp') 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 &result_tabs) { - result_tabs.push_back(Tab{create_body(false, true), std::make_unique(program, url), create_search_bar("Search...", 500)}); + PluginResult PeertubeInstanceSelectionPage::submit(const SubmitArgs &args, std::vector &result_tabs) { + result_tabs.push_back(Tab{create_body(false, true), std::make_unique(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 &result_tabs) { - const SearchType search_type = (SearchType)(uintptr_t)submit_body_item->userdata; + PluginResult PeertubeSearchPage::submit(const SubmitArgs &args, std::vector &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(program, server, title, url), nullptr }); + result_tabs.push_back(Tab{ create_body(false, true), std::make_unique(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(program, server, title, url), nullptr }); + result_tabs.push_back(Tab{ create_body(false, true), std::make_unique(program, server, args.title, args.url), nullptr }); } else if(search_type == SearchType::VIDEOS) { - result_tabs.push_back(Tab{ nullptr, std::make_unique(program, server, url, false), nullptr }); + result_tabs.push_back(Tab{ nullptr, std::make_unique(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 &result_tabs) { - result_tabs.push_back(Tab{ nullptr, std::make_unique(program, server, url, false), nullptr }); + PluginResult PeertubeChannelPage::submit(const SubmitArgs &args, std::vector &result_tabs) { + result_tabs.push_back(Tab{ nullptr, std::make_unique(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 &result_tabs) { - result_tabs.push_back(Tab{ nullptr, std::make_unique(program, server, url, true), nullptr }); + PluginResult PeertubePlaylistPage::submit(const SubmitArgs &args, std::vector &result_tabs) { + result_tabs.push_back(Tab{ nullptr, std::make_unique(program, server, args.url, true), nullptr }); return PluginResult::OK; } -- cgit v1.2.3