aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Youtube.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-11-12 22:37:23 +0100
committerdec05eba <dec05eba@protonmail.com>2021-11-12 22:37:23 +0100
commit5c27b5fbaa0f1693bf4605a3e6fc57d0f066c0ec (patch)
tree5a9d3e2cccc08d671da99c45fee040f3e24fae3c /src/plugins/Youtube.cpp
parent09d8b9895c7001f991d2aab7a75e8b573edb086f (diff)
Allow plugins to add their own tabs in ctrl+r instead of search, comments, related and channel
Diffstat (limited to 'src/plugins/Youtube.cpp')
-rw-r--r--src/plugins/Youtube.cpp27
1 files changed, 7 insertions, 20 deletions
diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp
index 40b6970..c7a9e5c 100644
--- a/src/plugins/Youtube.cpp
+++ b/src/plugins/Youtube.cpp
@@ -2167,26 +2167,13 @@ namespace QuickMedia {
return result_items;
}
- bool YoutubeVideoPage::create_search_page(Program *program, Tab &tab) {
- std::string video_id;
- youtube_url_extract_id(url, video_id);
-
- tab.body = create_body(false, false);
- tab.page = std::make_unique<YoutubeSearchPage>(program, std::move(video_id));
- tab.search_bar = create_search_bar("Search...", 100);
- return true;
- }
-
- std::unique_ptr<Page> YoutubeVideoPage::create_comments_page(Program *program) {
- return std::make_unique<YoutubeCommentsPage>(program, url, comments_continuation_token);
- }
-
- std::unique_ptr<RelatedVideosPage> YoutubeVideoPage::create_related_videos_page(Program *program) {
- return std::make_unique<YoutubeRelatedVideosPage>(program);
- }
-
- std::unique_ptr<Page> YoutubeVideoPage::create_channels_page(Program *program, const std::string &channel_url) {
- return std::make_unique<YoutubeChannelPage>(program, channel_url, "", "Channel videos");
+ PluginResult YoutubeVideoPage::get_related_pages(const BodyItems &related_videos, const std::string &channel_url, std::vector<Tab> &result_tabs) {
+ auto related_page_body = create_body(false, true);
+ related_page_body->set_items(related_videos);
+ result_tabs.push_back(Tab{create_body(), std::make_unique<YoutubeCommentsPage>(program, url, comments_continuation_token), nullptr});
+ result_tabs.push_back(Tab{std::move(related_page_body), std::make_unique<YoutubeRelatedVideosPage>(program), create_search_bar("Search...", SEARCH_DELAY_FILTER)});
+ result_tabs.push_back(Tab{create_body(false, true), std::make_unique<YoutubeChannelPage>(program, channel_url, "", "Channel videos"), create_search_bar("Search...", 350)});
+ return PluginResult::OK;
}
static std::map<std::string, std::string> http_params_parse(const std::string &http_params) {