From e1a8d10b61c5f8ca092ba3aa458b661da29ba447 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 30 Sep 2020 19:07:05 +0200 Subject: Matrix: add message replying with ctrl+r, also use shared_ptr for BodyItem --- src/plugins/Youtube.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/plugins/Youtube.cpp') diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index 2827d83..4126532 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -17,7 +17,7 @@ namespace QuickMedia { } } - static std::unique_ptr parse_content_video_renderer(const Json::Value &content_item_json, std::unordered_set &added_videos) { + static std::shared_ptr parse_content_video_renderer(const Json::Value &content_item_json, std::unordered_set &added_videos) { if(!content_item_json.isObject()) return nullptr; @@ -68,7 +68,7 @@ namespace QuickMedia { if(!title) return nullptr; - auto body_item = std::make_unique(title); + auto body_item = BodyItem::create(title); /* TODO: Make date a different color */ std::string date_str; if(date) @@ -170,7 +170,7 @@ namespace QuickMedia { continue; const Json::Value &rich_item_contents = rich_item_renderer_json["content"]; - std::unique_ptr body_item = parse_content_video_renderer(rich_item_contents, added_videos); + std::shared_ptr body_item = parse_content_video_renderer(rich_item_contents, added_videos); if(body_item) result_items.push_back(std::move(body_item)); } @@ -273,14 +273,14 @@ namespace QuickMedia { continue; for(const Json::Value &item_json : items_json) { - std::unique_ptr body_item = parse_content_video_renderer(item_json, added_videos); + std::shared_ptr body_item = parse_content_video_renderer(item_json, added_videos); if(body_item) result_items.push_back(std::move(body_item)); } } for(const Json::Value &content_item_json : item_contents_json) { - std::unique_ptr body_item = parse_content_video_renderer(content_item_json, added_videos); + std::shared_ptr body_item = parse_content_video_renderer(content_item_json, added_videos); if(body_item) result_items.push_back(std::move(body_item)); } @@ -444,7 +444,7 @@ namespace QuickMedia { return result.substr(0, index); } - static std::unique_ptr parse_compact_video_renderer_json(const Json::Value &item_json, std::unordered_set &added_videos) { + static std::shared_ptr parse_compact_video_renderer_json(const Json::Value &item_json, std::unordered_set &added_videos) { const Json::Value &compact_video_renderer_json = item_json["compactVideoRenderer"]; if(!compact_video_renderer_json.isObject()) return nullptr; @@ -487,7 +487,7 @@ namespace QuickMedia { if(!title) return nullptr; - auto body_item = std::make_unique(title); + auto body_item = BodyItem::create(title); /* TODO: Make date a different color */ std::string date_str; if(date) -- cgit v1.2.3