From 3563f867798a35491793f1c27c9840769367ebb6 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 30 Apr 2021 06:47:19 +0200 Subject: Fix 4chan codeblocks not visible, change titles and rearrange youtube tabs --- src/QuickMedia.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/QuickMedia.cpp') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 247221e..4ed11b2 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -595,8 +595,10 @@ namespace QuickMedia { return -1; } + int start_tab_index = 0; + init(parent_window); - load_plugin_by_name(tabs, start_dir); + load_plugin_by_name(tabs, start_dir, start_tab_index); while(!tabs.empty() || matrix) { if(matrix) { @@ -611,12 +613,12 @@ namespace QuickMedia { return exit_code; } - page_loop(tabs); + page_loop(tabs, start_tab_index); tabs.clear(); if(strcmp(plugin_name, "launcher") == 0) { plugin_name = pipe_selected_text.c_str(); - load_plugin_by_name(tabs, start_dir); + load_plugin_by_name(tabs, start_dir, start_tab_index); } } @@ -893,7 +895,7 @@ namespace QuickMedia { .related_media_thumbnail_handler({{"//img", "src", "/thumb-"}}); } - void Program::load_plugin_by_name(std::vector &tabs, const char *start_dir) { + void Program::load_plugin_by_name(std::vector &tabs, const char *start_dir, int &start_tab_index) { if(!plugin_name || plugin_name[0] == '\0') return; @@ -1012,6 +1014,8 @@ namespace QuickMedia { PipePage::load_body_items_from_stdin(pipe_body->items); tabs.push_back(Tab{std::move(pipe_body), std::make_unique(this), create_search_bar("Search...", SEARCH_DELAY_FILTER)}); } else if(strcmp(plugin_name, "youtube") == 0) { + start_tab_index = 1; + tabs.push_back(Tab{create_body(), std::make_unique(this), create_search_bar("Search...", SEARCH_DELAY_FILTER)}); tabs.push_back(Tab{create_body(), std::make_unique(this), create_search_bar("Search...", 350)}); auto history_body = create_body(); @@ -1022,7 +1026,6 @@ namespace QuickMedia { auto recommended_search_bar = create_search_bar("Search...", SEARCH_DELAY_FILTER); auto recommended_page = std::make_unique(this, tabs.front().page.get(), recommended_search_bar.get(), plugin_name); tabs.push_back(Tab{create_body(), std::move(recommended_page), std::move(recommended_search_bar)}); - tabs.push_back(Tab{create_body(), std::make_unique(this), create_search_bar("Search...", SEARCH_DELAY_FILTER)}); } else if(strcmp(plugin_name, "pornhub") == 0) { auto search_page = std::make_unique(this, "https://www.pornhub.com/", sf::Vector2i(320/1.5f, 180/1.5f)); add_pornhub_handlers(search_page.get()); -- cgit v1.2.3