From e1bbef2d64de09e0eef88410d69ac772d34d79ad Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 9 Feb 2021 22:13:27 +0100 Subject: Matrix: final room sort, hide room list behind reply/edit --- README.md | 2 +- src/QuickMedia.cpp | 5 +++++ src/plugins/Matrix.cpp | 8 ++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 03d572b..c69ad3a 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Press `E` to edit a message on matrix, press `ESC` to cancel. Currently only wor Press `Ctrl + D` to delete a message on matrix. Currently deleting a message only deletes the event, so if you delete an edit then the original message wont be deleted.\ Press `Ctrl + C` to copy the message of the selected item in matrix to the clipboard.\ Press `Ctrl + V` to upload media to room in matrix if the clipboard contains a valid absolute filepath.\ -Press `Ctrl+Alt+Arrow up` / `Ctrl+Alt+Arrow down` or `Ctrl+Alt+K` / `Ctrl+Alt+J` to select another room in matrix when you are viewing a room. Press `Ctrl+Alt+Enter` to view the selected room. +Press `Ctrl+Alt+Arrow up` / `Ctrl+Alt+Arrow down` or `Ctrl+Alt+K` / `Ctrl+Alt+J` to view the room above/below the selected room in matrix. In matrix you can select a message with enter to open the url in the message (or if there are multiple urls then a menu will appear for selecting which to open). ## Matrix commands diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 3bd75d6..205b201 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -4739,6 +4739,11 @@ namespace QuickMedia { item_background.setPosition(sf::Vector2f(0.0f, body_item_pos.y - replying_to_text_height - margin)); item_background.setFillColor(back_color); window.draw(item_background); + + sf::RectangleShape message_box_shade_left(sf::Vector2f(body_pos.x, chat_input_height_full)); + message_box_shade_left.setPosition(0.0f, window_size.y - chat_input_height_full); + message_box_shade_left.setFillColor(chat_input_shade.getFillColor()); + window.draw(message_box_shade_left); replying_to_text.setPosition(body_item_pos.x, body_item_pos.y - replying_to_text_height); window.draw(replying_to_text); diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 8c9b1c1..d3e8117 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -674,13 +674,17 @@ namespace QuickMedia { for(size_t i = 0; i < body->items.size(); ++i) { RoomData *room_i = static_cast(body->items[i]->userdata); - if((int)i != selected_item && room_i && room->last_message_timestamp > room_i->last_message_timestamp) { + if((int)i == room_body_index) + return; + if((int)i != selected_item && room_i && room->last_message_timestamp >= room_i->last_message_timestamp) { auto body_item_to_insert = body->items[room_body_index]; body->items.erase(body->items.begin() + room_body_index); - if((int)i <= room_body_index) + if(room_body_index >= (int)i) body->items.insert(body->items.begin() + i, std::move(body_item_to_insert)); else body->items.insert(body->items.begin() + (i - 1), std::move(body_item_to_insert)); + if((int)i < selected_item && room_body_index > selected_item && body->items.size() > 1 && i != body->items.size() - 1) + body->set_selected_item(selected_item + 1); return; } } -- cgit v1.2.3