From b6216bad1cdd523992c4f3b95c3ba703959d8568 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 8 Feb 2021 23:37:37 +0100 Subject: Matrix: add QM_PHONE_FACTOR to hide room list side panel, do not render room list tabs when viewing room --- src/QuickMedia.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/QuickMedia.cpp') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index ec33b3e..0eb40c3 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -397,6 +397,11 @@ namespace QuickMedia { fprintf(stderr, "Failed to create thumbnails directory\n"); } + const char *qm_phone_factor = getenv("QM_PHONE_FACTOR"); + if(qm_phone_factor && atoi(qm_phone_factor) == 1) + show_room_side_panel = false; + else + show_room_side_panel = true; main_thread_id = std::this_thread::get_id(); } @@ -4486,9 +4491,9 @@ namespace QuickMedia { body_padding_horizontal = 0.0f; } - this->body_pos = sf::Vector2f(0.0f, body_padding_vertical + tab_shade_height); - if(body_width > 640.0f) { - this->body_size = sf::Vector2f(300.0f, window_size.y - body_padding_vertical - tab_shade_height); + this->body_pos = sf::Vector2f(0.0f, tab_shade_height); + if(body_width > 640.0f && show_room_side_panel) { + this->body_size = sf::Vector2f(300.0f, window_size.y - tab_shade_height); draw_room_list = true; } else { this->body_size = sf::Vector2f(0.0f, 0.0f); @@ -4614,10 +4619,10 @@ namespace QuickMedia { room_list_background.setPosition(this->body_pos); room_list_background.setFillColor(sf::Color(31, 35, 41)); window.draw(room_list_background); - page_loop_render(window, room_tabs, room_selected_tab, room_tab_associated_data, &Json::Value::nullSingleton()); + room_tabs[room_selected_tab].body->draw(window, this->body_pos, this->body_size, Json::Value::nullSingleton()); } - const float width_per_tab = window_size.x / tabs.size(); + const float width_per_tab = body_size.x / tabs.size(); tab_background.setSize(sf::Vector2f(std::floor(width_per_tab - tab_margin_x * 2.0f), tab_height)); if(chat_state == ChatState::URL_SELECTION) @@ -4646,10 +4651,10 @@ namespace QuickMedia { int i = 0; for(ChatTab &tab : tabs) { if(i == selected_tab) { - tab_background.setPosition(std::floor(i * width_per_tab + tab_margin_x), tab_spacer_height + std::floor(tab_vertical_offset) + room_name_padding_y); + tab_background.setPosition(std::floor(body_pos.x + i * width_per_tab + tab_margin_x), tab_spacer_height + std::floor(tab_vertical_offset) + room_name_padding_y); window.draw(tab_background); } - const float center = (i * width_per_tab) + (width_per_tab * 0.5f); + const float center = body_pos.x + (i * width_per_tab) + (width_per_tab * 0.5f); tab.text.setPosition(std::floor(center - tab.text.getLocalBounds().width * 0.5f), tab_y); window.draw(tab.text); ++i; -- cgit v1.2.3