From 5756acdbf1a2679db8db91d873f57eeb2387c32f Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 24 Mar 2021 16:03:36 +0100 Subject: Decrease gui spacing, padding and remove lines between body items --- TODO | 3 ++- src/Body.cpp | 15 ++++++++------- src/QuickMedia.cpp | 20 +++++++++++--------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/TODO b/TODO index 3c3ca29..827a84e 100644 --- a/TODO +++ b/TODO @@ -157,4 +157,5 @@ Replies to the local user shouldn't remove the red text. Maybe fix this by check Sort reactions by timestamp. Check what happens with xsrf_token if comments are not fetched for a long time. Does it time out? if so do we need to refetch the video page to get the new token?. Add support for comments in live youtube videos, api is at: https://www.youtube.com/youtubei/v1/live_chat/get_live_chat?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8. -Make video visible when reading comments (youtube). \ No newline at end of file +Make video visible when reading comments (youtube). +Convert nyaa.si date from unix date to local time. \ No newline at end of file diff --git a/src/Body.cpp b/src/Body.cpp index 247424b..b7cfe4b 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -13,7 +13,7 @@ static const sf::Color front_color(32, 36, 42); static const sf::Color back_color(33, 35, 37); -static const float spacing_y = std::floor(15.0f * QuickMedia::get_ui_scale()); +static const float spacing_y = std::floor(10.0f * QuickMedia::get_ui_scale()); static const float padding_x = std::floor(10.0f * QuickMedia::get_ui_scale()); static const float image_padding_x = std::floor(5.0f * QuickMedia::get_ui_scale()); static const float padding_y = std::floor(5.0f * QuickMedia::get_ui_scale()); @@ -607,11 +607,12 @@ namespace QuickMedia { const bool merge_with_next = next_body_item && body_item_merge_handler && body_item_merge_handler(items[selected_item].get(), next_body_item); if(!merge_with_previous && merge_with_next) page_scroll += spacing_y; - } else if(page_scroll < 0.0f && selected_line_top_visible && selected_item_fits_on_screen) { + } else if(page_scroll < (merge_with_previous ? spacing_y : 0.0f) && selected_line_top_visible && selected_item_fits_on_screen) { //fprintf(stderr, "bottom!\n"); - page_scroll = 0.0f; if(merge_with_previous) - page_scroll += spacing_y; + page_scroll = spacing_y; + else + page_scroll = 0.0f; } } @@ -936,9 +937,9 @@ namespace QuickMedia { } } - item_separator.setSize(sf::Vector2f(std::max(0.0f, size.x - 20.0f), 1.0f)); - item_separator.setPosition(item_pos + sf::Vector2f(10.0f, std::floor(item_height + spacing_y * 0.5f))); - window.draw(item_separator); + //item_separator.setSize(sf::Vector2f(std::max(0.0f, size.x - 20.0f), 1.0f)); + //item_separator.setPosition(item_pos + sf::Vector2f(10.0f, std::floor(item_height + spacing_y * 0.5f))); + //window.draw(item_separator); if(item_index == selected_item) { item_background.setPosition(item_pos); diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index f020277..9fced02 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -50,7 +50,7 @@ static const std::string fourchan_google_captcha_api_key = "6Ldp2bsSAAAAAAJ5uyx_ static const float tab_text_size = std::floor(16.0f * QuickMedia::get_ui_scale()); static const float tab_height = tab_text_size + std::floor(10.0f * QuickMedia::get_ui_scale()); static const sf::Color tab_selected_color(55, 60, 68); -static const float tab_margin_x = std::floor(10.0f * QuickMedia::get_ui_scale()); +static const float tab_margin_x = std::floor(10.0f); static int FPS_IDLE = 2; static const double IDLE_TIMEOUT_SEC = 2.0; static const sf::Vector2i AVATAR_THUMBNAIL_SIZE(std::floor(32 * QuickMedia::get_ui_scale()), std::floor(32 * QuickMedia::get_ui_scale())); @@ -929,16 +929,18 @@ namespace QuickMedia { } static void get_body_dimensions(const sf::Vector2f &window_size, SearchBar *search_bar, sf::Vector2f &body_pos, sf::Vector2f &body_size, bool has_tabs = false) { - float body_padding_horizontal = 25.0f; - float body_padding_vertical = std::floor(25.0f * get_ui_scale()); + float body_padding_horizontal = 10.0f; + float body_padding_vertical = std::floor(10.0f); float body_width = window_size.x - body_padding_horizontal * 2.0f; if(body_width <= 480.0f) { body_width = window_size.x; body_padding_horizontal = 0.0f; - body_padding_vertical = std::floor(10.0f * get_ui_scale()); } - float tab_h = tab_height; + float tab_h = tab_height + std::floor(10.0f * get_ui_scale()); + if(!search_bar) + tab_h += std::floor(10.0f * get_ui_scale()); + if(!has_tabs) tab_h = 0.0f; @@ -2962,8 +2964,8 @@ namespace QuickMedia { comment_input.set_max_width(window_size.x - (logo_padding_x + logo_size.x + chat_input_padding_x + logo_padding_x)); comment_input.set_position(sf::Vector2f(std::floor(logo_padding_x + logo_size.x + chat_input_padding_x), chat_input_padding_y)); - float body_padding_horizontal = 25.0f; - float body_padding_vertical = std::floor(5.0f * get_ui_scale()); + float body_padding_horizontal = 10.0f; + float body_padding_vertical = std::floor(10.0f); float body_width = window_size.x - body_padding_horizontal * 2.0f; if(body_width <= 480.0f) { body_width = window_size.x; @@ -4737,8 +4739,8 @@ namespace QuickMedia { tab_shade_height = tab_spacer_height + std::floor(tab_vertical_offset) + tab_height + room_name_padding_y + padding_bottom; - float body_padding_horizontal = 25.0f; - float body_padding_vertical = std::floor(5.0f * get_ui_scale()); + float body_padding_horizontal = 10.0f; + float body_padding_vertical = std::floor(10.0f); float body_width = window_size.x - body_padding_horizontal * 2.0f; if(body_width <= 480.0f) { body_width = window_size.x; -- cgit v1.2.3