aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-10-22 22:58:38 +0200
committerdec05eba <dec05eba@protonmail.com>2020-10-22 22:58:38 +0200
commit290ca90416e96febdc4ae8bafccbbdd4cea01351 (patch)
tree42ebcfbcf04c1cbc0c07d2c0a564e349214d1ee4
parent97564d40636aafb251644f61a0b990e392afd7a4 (diff)
Matrix: improve pinned messages view
-rw-r--r--TODO4
-rw-r--r--src/QuickMedia.cpp14
2 files changed, 10 insertions, 8 deletions
diff --git a/TODO b/TODO
index 6ba625a..66ff8aa 100644
--- a/TODO
+++ b/TODO
@@ -110,4 +110,6 @@ Read image exif into to apply image rotation. This is common in images taken on
Handle M_LIMIT_EXCEEDED in matrix
Check if we need to call /_matrix/client/r0/notifications for intial sync to receive old notifications or if /sync always includes mentions.
Maybe dont clear cache for body items when filtering.
-Change scroll in body when previous items change size (such as when thumbnail has finished loading). \ No newline at end of file
+Change scroll in body when previous items change size (such as when thumbnail has finished loading).
+Load the replied-to message in the pinned messages tab.
+Pressing enter on a pinned message should go to the message in the messages tab. \ No newline at end of file
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 5c1bdfa..7a95ee6 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3236,6 +3236,7 @@ namespace QuickMedia {
std::vector<std::string> pinned_events;
matrix->get_all_pinned_events(current_room, pinned_events);
process_new_pinned_events(pinned_events);
+ tabs[PINNED_TAB_INDEX].body->select_last_item();
room_name_text.setString(static_cast<BodyItem*>(current_room->userdata)->get_title());
room_avatar_thumbnail_data = std::make_shared<ThumbnailData>();
@@ -3488,7 +3489,7 @@ namespace QuickMedia {
}
};
- auto add_new_rooms = [&tabs, &current_room, &room_name_text, &room_search_bar](Rooms &rooms) {
+ auto add_new_rooms = [&tabs, &current_room, &room_search_bar, &room_name_text](Rooms &rooms) {
if(rooms.empty())
return;
@@ -3865,13 +3866,13 @@ namespace QuickMedia {
}
float room_name_padding_y = 0.0f;
- if(selected_tab == MESSAGES_TAB_INDEX)
+ if(selected_tab == MESSAGES_TAB_INDEX || selected_tab == PINNED_TAB_INDEX)
room_name_padding_y = room_name_total_height;
else if(selected_tab == ROOMS_TAB_INDEX)
room_name_padding_y = room_search_bar.getBottomWithoutShadow();
chat_input_height_full = chat_input.get_height() + chat_input_padding_y * 2.0f;
- if(selected_tab != MESSAGES_TAB_INDEX)
+ if(selected_tab != MESSAGES_TAB_INDEX || selected_tab == PINNED_TAB_INDEX)
chat_input_height_full = 0.0f;
const float chat_height = chat_input.get_height();
@@ -3886,15 +3887,13 @@ namespace QuickMedia {
float room_name_padding_y = 0.0f;
float padding_bottom = 0.0f;
- if(selected_tab == MESSAGES_TAB_INDEX) {
+ if(selected_tab == MESSAGES_TAB_INDEX || selected_tab == PINNED_TAB_INDEX) {
room_name_padding_y = 10.0f + room_name_total_height;
tab_vertical_offset = 10.0f;
} else if(selected_tab == ROOMS_TAB_INDEX) {
room_name_padding_y = room_search_bar.getBottomWithoutShadow();
tab_vertical_offset = 0.0f;
padding_bottom = 10.0f;
- } else if(selected_tab == PINNED_TAB_INDEX) {
- padding_bottom = 10.0f;
}
tab_shade_height = tab_spacer_height + std::floor(tab_vertical_offset) + tab_height + room_name_padding_y + padding_bottom;
@@ -3998,6 +3997,7 @@ namespace QuickMedia {
event_data->status = PinnedEventStatus::FINISHED_LOADING;
fetch_body_item->userdata = event_data;
} else {
+ fetch_body_item->set_description("Failed to load message!");
event_data->status = PinnedEventStatus::FAILED_TO_LOAD;
}
} else if(fetch_message_tab == MESSAGES_TAB_INDEX) {
@@ -4029,7 +4029,7 @@ namespace QuickMedia {
tab_shade.setSize(sf::Vector2f(window_size.x, tab_shade_height));
window.draw(tab_shade);
- if(selected_tab == MESSAGES_TAB_INDEX) {
+ if(selected_tab == MESSAGES_TAB_INDEX || selected_tab == PINNED_TAB_INDEX) {
float room_name_text_offset_x = 0.0f;
if(room_avatar_sprite.getTexture() && room_avatar_sprite.getTexture()->getNativeHandle() != 0) {
auto room_avatar_texture_size = room_avatar_sprite.getTexture()->getSize();