From 2e348b4bf3ae59af88b9481007fdc7c0a7bec9e1 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 2 Jan 2021 22:06:36 +0100 Subject: Matrix: fix reactions in reply messages --- TODO | 5 ++++- src/Body.cpp | 3 ++- src/QuickMedia.cpp | 11 ++++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/TODO b/TODO index 34aba01..207eb09 100644 --- a/TODO +++ b/TODO @@ -156,4 +156,7 @@ Make the messages that mention us red using the matrix notification api that we Replace sfml font glyph loading completely with FreeType. There is a very old bug in sfml that causes text to get corrupt sometimes. Im guessing this happens when adding new characters to the font atlas and that coordinates for the glyphs become incorrect? Add arguments to pipe plugin to pass input and output fifo for sending commands to QuickMedia and receiving events. Update thumbnails in file-manager if an image is replaced, by including the modify date of the image in the thumbnail cache as well. -Create a workaround for dwm terminal swallow patch stealing mpv when moving QuickMedia to another monitor sometimes. Maybe check for structure notify events on mpv and reparent and select input on the mpv window again? \ No newline at end of file +Create a workaround for dwm terminal swallow patch stealing mpv when moving QuickMedia to another monitor sometimes. Maybe check for structure notify events on mpv and reparent and select input on the mpv window again? +Resize video thumbnail when extracted with ffmpeg to 480x360, clamped from its original size. +Remove reply formatting from edited text in room description in room list. +Add option to decline and mute user in invites. This is to combat invite spam, where muted users cant invite you. \ No newline at end of file diff --git a/src/Body.cpp b/src/Body.cpp index b12ed7f..157ed03 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -841,6 +841,7 @@ namespace QuickMedia { float reaction_offset_x = 0.0f; item_pos.y += reaction_padding_y; float reaction_max_height = 0.0f; + // TODO: Fix first row wrap-around for(int i = 0; i < item->reactions.size(); ++i) { auto &reaction = item->reactions[i]; reaction.text->setMaxWidth(size.x - text_offset_x - image_padding_x); @@ -1027,4 +1028,4 @@ namespace QuickMedia { } return true; } -} \ No newline at end of file +} diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index e50d08e..5c9ea36 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -1824,7 +1824,7 @@ namespace QuickMedia { window_size.y = event.size.height; sf::FloatRect visible_area(0, 0, window_size.x, window_size.y); window.setView(sf::View(visible_area)); - } else if(event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape) { + } else if(event.type == sf::Event::KeyPressed && (event.key.code == sf::Keyboard::Escape || event.key.code == sf::Keyboard::Q)) { // To be able to close the video player while the video is loading current_page = previous_page; } @@ -3690,7 +3690,7 @@ namespace QuickMedia { body_item->set_description_color(sf::Color(255, 100, 100)); body_item->embedded_item = std::make_shared(""); *body_item->embedded_item = *related_body_item; - body_item->reactions.clear(); + body_item->embedded_item->reactions.clear(); body_item->embedded_item_status = FetchStatus::FINISHED_LOADING; return; } @@ -3715,8 +3715,9 @@ namespace QuickMedia { if(related_body_item) { if((related_body_item->userdata && static_cast(related_body_item->userdata)->user == me) || message_contains_user_mention(event_data->message->body, current_room->get_user_display_name(me)) || message_contains_user_mention(event_data->message->body, me->user_id)) body_item->set_description_color(sf::Color(255, 100, 100)); - *body_item = *related_body_item; - body_item->reactions.clear(); + body_item->embedded_item = std::make_shared(""); + *body_item->embedded_item = *related_body_item; + body_item->embedded_item->reactions.clear(); event_data->status = FetchStatus::FINISHED_LOADING; event_data->message = static_cast(related_body_item->userdata); body_item->userdata = event_data; @@ -3770,7 +3771,7 @@ namespace QuickMedia { body_item->set_description_color(sf::Color(255, 100, 100)); body_item->embedded_item = std::make_shared(""); *body_item->embedded_item = *related_body_item; - body_item->reactions.clear(); + body_item->embedded_item->reactions.clear(); body_item->embedded_item_status = FetchStatus::FINISHED_LOADING; return; } -- cgit v1.2.3