From 016fa373be76cb8d77b31cb23e60ddbd22c8cf5a Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 11 May 2021 18:25:53 +0200 Subject: Do not move selected room item after filtering --- src/DownloadUtils.cpp | 8 +++----- src/Entry.cpp | 2 +- src/QuickMedia.cpp | 8 +++----- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/DownloadUtils.cpp b/src/DownloadUtils.cpp index 5b5246a..7d2cbb8 100644 --- a/src/DownloadUtils.cpp +++ b/src/DownloadUtils.cpp @@ -224,15 +224,13 @@ namespace QuickMedia { bool download_async_gui(const std::string &url, bool use_youtube_dl, bool no_video) { // TODO: Figure out why /proc/self/exe doesn't work when installed to /usr/bin/quickmedia - char quickmedia_path[PATH_MAX] = "/usr/bin/quickmedia"; + char quickmedia_path[PATH_MAX] = "quickmedia"; //if(readlink("/proc/self/exe", quickmedia_path, sizeof(quickmedia_path)) == -1) // return false; std::vector args = { quickmedia_path, "download", "-u", url.c_str() }; - if(use_youtube_dl) - args.push_back("--youtube-dl"); - if(no_video) - args.push_back("--no-video"); + if(use_youtube_dl) args.push_back("--youtube-dl"); + if(no_video) args.push_back("--no-video"); args.push_back(nullptr); return exec_program_async(args.data(), nullptr) == 0; } diff --git a/src/Entry.cpp b/src/Entry.cpp index 5e18340..ba9718b 100644 --- a/src/Entry.cpp +++ b/src/Entry.cpp @@ -98,7 +98,7 @@ namespace QuickMedia { void Entry::set_position(const sf::Vector2f &pos) { background.set_position(pos); text.setPosition(pos + sf::Vector2f(background_margin_horizontal, background_margin_vertical)); - placeholder.setPosition(pos + sf::Vector2f(background_margin_horizontal, background_margin_vertical)); + placeholder.setPosition(pos + sf::Vector2f(background_margin_horizontal, background_margin_vertical + std::floor(5.0f * get_ui_scale()))); } void Entry::set_max_width(float width) { diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 5abc71a..f1f983e 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -1624,7 +1624,7 @@ namespace QuickMedia { int selected_index = tabs[selected_tab].body->get_selected_item(); video_content_page(tabs[selected_tab].page.get(), static_cast(new_tabs[0].page.get()), selected_item->get_title(), false, tabs[selected_tab].body->items, selected_index, &tab_associated_data[selected_tab].fetched_page, tab_associated_data[selected_tab].update_search_text); } else if(new_tabs.size() == 1 && new_tabs[0].page->get_type() == PageTypez::CHAT) { - //body_set_selected_item(tabs[selected_tab].body.get(), selected_item.get()); + body_set_selected_item(tabs[selected_tab].body.get(), selected_item.get()); current_page = PageType::CHAT; current_chat_room = matrix->get_room_by_id(selected_item->url); MatrixRoomsPage *rooms_page = static_cast(tabs[selected_tab].page.get()); @@ -5822,8 +5822,7 @@ namespace QuickMedia { remove(output_filepath.c_str()); std::vector args = { "youtube-dl", "--no-warnings", "--no-continue", "--output", output_filepath.c_str(), "--newline" }; - if(no_video) - args.push_back("-x"); + if(no_video) args.push_back("-x"); args.insert(args.end(), { "--", url.c_str(), nullptr }); if(exec_program_pipe(args.data(), &read_program) != 0) @@ -5950,8 +5949,7 @@ namespace QuickMedia { task_result = run_task_with_loading_screen([this, url, &filename]{ std::string json_str; std::vector args = { "youtube-dl", "--skip-download", "--print-json", "--no-warnings" }; - if(no_video) - args.push_back("-x"); + if(no_video) args.push_back("-x"); args.insert(args.end(), { "--", url, nullptr }); if(exec_program(args.data(), accumulate_string, &json_str) != 0) return false; -- cgit v1.2.3