From 59e4ce5c35e7e5a73d61e7111e8d4f07d63b7056 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 4 Jun 2021 19:22:04 +0200 Subject: Add grid view --- src/plugins/Fourchan.cpp | 4 +++- src/plugins/Page.cpp | 4 ++-- src/plugins/Soundcloud.cpp | 6 +++--- src/plugins/Youtube.cpp | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/Fourchan.cpp b/src/plugins/Fourchan.cpp index d2f81a9..52024e1 100644 --- a/src/plugins/Fourchan.cpp +++ b/src/plugins/Fourchan.cpp @@ -167,7 +167,7 @@ namespace QuickMedia { } PluginResult FourchanBoardsPage::submit(const std::string &title, const std::string &url, std::vector &result_tabs) { - result_tabs.push_back(Tab{create_body(false), std::make_unique(program, title, url), create_search_bar("Search...", SEARCH_DELAY_FILTER)}); + result_tabs.push_back(Tab{create_body(false, true), std::make_unique(program, title, url), create_search_bar("Search...", SEARCH_DELAY_FILTER)}); return PluginResult::OK; } @@ -262,6 +262,8 @@ namespace QuickMedia { if(author.isString()) author_str = author.asString(); + author_str += " #" + std::to_string(post_num.asInt64()); + std::string comment_text; extract_comment_pieces(sub_begin, sub_end - sub_begin, [&comment_text](const CommentPiece &cp) { diff --git a/src/plugins/Page.cpp b/src/plugins/Page.cpp index 9eb874f..8605d82 100644 --- a/src/plugins/Page.cpp +++ b/src/plugins/Page.cpp @@ -29,8 +29,8 @@ namespace QuickMedia { return DownloadResult::OK; } - std::unique_ptr Page::create_body(bool plain_text_list) { - return program->create_body(plain_text_list); + std::unique_ptr Page::create_body(bool plain_text_list, bool prefer_card_view) { + return program->create_body(plain_text_list, prefer_card_view); } std::unique_ptr Page::create_search_bar(const std::string &placeholder_text, int search_delay) { diff --git a/src/plugins/Soundcloud.cpp b/src/plugins/Soundcloud.cpp index 9c2d5f4..f4d01b6 100644 --- a/src/plugins/Soundcloud.cpp +++ b/src/plugins/Soundcloud.cpp @@ -253,7 +253,7 @@ namespace QuickMedia { if(url == "track") { SoundcloudPlaylist *playlist = static_cast(submit_body_item->extra.get()); - auto body = create_body(); + auto body = create_body(false, true); body->items = playlist->tracks; result_tabs.push_back(Tab{std::move(body), std::make_unique(program, playlist, title), nullptr}); } else if(url.find("/stream/users/") != std::string::npos) { @@ -263,7 +263,7 @@ namespace QuickMedia { DownloadResult result = download_json(json_root, query_url, {}, true); if(result != DownloadResult::OK) return download_result_to_plugin_result(result); - auto body = create_body(); + auto body = create_body(false, true); std::string next_href; PluginResult pr = parse_user_page(json_root, body->items, next_href); if(pr != PluginResult::OK) return pr; @@ -283,7 +283,7 @@ namespace QuickMedia { if(!url_json.isString()) return PluginResult::ERR; - result_tabs.push_back(Tab{create_body(), std::make_unique(program, url_json.asString()), nullptr}); + result_tabs.push_back(Tab{nullptr, std::make_unique(program, url_json.asString()), nullptr}); } return PluginResult::OK; diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index f7b36d6..9b7c5ba 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -648,7 +648,7 @@ namespace QuickMedia { if(strncmp(url.c_str(), "https://www.youtube.com/channel/", 32) == 0) { // TODO: Make all pages (for all services) lazy fetch in a similar manner! - result_tabs.push_back(Tab{create_body(), std::make_unique(program, url, "", title), create_search_bar("Search...", 350)}); + result_tabs.push_back(Tab{create_body(false, true), std::make_unique(program, url, "", title), create_search_bar("Search...", 350)}); } else { result_tabs.push_back(Tab{nullptr, std::make_unique(program, url), nullptr}); } -- cgit v1.2.3