diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-09-30 19:07:05 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-09-30 19:08:05 +0200 |
commit | e1a8d10b61c5f8ca092ba3aa458b661da29ba447 (patch) | |
tree | 4de5ca75c3d19e4bd4c5c25a4362768b3e994326 /src/plugins/Youtube.cpp | |
parent | 86d228bfc3e9c81c011c31bc81a908a21f975bfb (diff) |
Matrix: add message replying with ctrl+r, also use shared_ptr for BodyItem
Diffstat (limited to 'src/plugins/Youtube.cpp')
-rw-r--r-- | src/plugins/Youtube.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
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<BodyItem> parse_content_video_renderer(const Json::Value &content_item_json, std::unordered_set<std::string> &added_videos) { + static std::shared_ptr<BodyItem> parse_content_video_renderer(const Json::Value &content_item_json, std::unordered_set<std::string> &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<BodyItem>(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<BodyItem> body_item = parse_content_video_renderer(rich_item_contents, added_videos); + std::shared_ptr<BodyItem> 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<BodyItem> body_item = parse_content_video_renderer(item_json, added_videos); + std::shared_ptr<BodyItem> 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<BodyItem> body_item = parse_content_video_renderer(content_item_json, added_videos); + std::shared_ptr<BodyItem> 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<BodyItem> parse_compact_video_renderer_json(const Json::Value &item_json, std::unordered_set<std::string> &added_videos) { + static std::shared_ptr<BodyItem> parse_compact_video_renderer_json(const Json::Value &item_json, std::unordered_set<std::string> &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<BodyItem>(title); + auto body_item = BodyItem::create(title); /* TODO: Make date a different color */ std::string date_str; if(date) |