aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO5
-rw-r--r--src/QuickMedia.cpp17
-rw-r--r--src/Text.cpp8
3 files changed, 15 insertions, 15 deletions
diff --git a/TODO b/TODO
index a4c6581..0b528a5 100644
--- a/TODO
+++ b/TODO
@@ -90,4 +90,7 @@ Use memberName() instead of key() when iterating json object. key() creates a co
Do not try to reload/redownload thumbnail that fails to download after its cleared when its no longer visible on screen and then becomes visible.
Sort matrix events by timestamp (not messages). This affects the applying of certain actions, such as changing avatar, room name, etc.
Some services such as 4chan, youtube, matrix and nyaa supports knowing the size of an image before it has downloaded. Use that to deal with pop-in of images because the image fallback size is not the same as the image size.
-Show google recaptcha on youtube when search/play fails, which can happen when using tor. \ No newline at end of file
+Show google recaptcha on youtube when search/play fails, which can happen when using tor.
+Show notifications when we receive a message in a matrix room even if we are not mentioned. This happens when we have set to receive notifications for all messages.
+Some mp4 videos fail to play because +faststart is not set, so the metadata is not at the beginning of the file. In such cases the video needs to be fully downloaded before it can play. QuickMedia should detect such files and download them (with progress bar) and then play them.
+If there are multiple users with the same name in a matrix room, then display the user id beside the displayname. \ No newline at end of file
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index a0e9b78..3922ceb 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3434,8 +3434,12 @@ namespace QuickMedia {
};
std::unordered_map<std::string, RoomBodyData> body_items_by_room_id;
+ std::string current_room_id;
+ RoomBodyData *current_room_body_data = nullptr;
- auto process_new_room_messages = [matrix, &body_items_by_room_id](RoomSyncMessages &room_sync_messages, bool only_show_mentions) mutable {
+ bool is_window_focused = window.hasFocus();
+
+ auto process_new_room_messages = [matrix, &body_items_by_room_id, &current_room_id, &is_window_focused](RoomSyncMessages &room_sync_messages, bool only_show_mentions) mutable {
for(auto &[room, messages] : room_sync_messages) {
bool was_mentioned = false;
for(auto &message : messages) {
@@ -3443,7 +3447,8 @@ namespace QuickMedia {
was_mentioned = true;
message->mentions_me = false;
// TODO: What if the message or username begins with "-"? also make the notification image be the avatar of the user
- show_notification("QuickMedia matrix - " + matrix->message_get_author_displayname(message.get()) + " (" + room->name + ")", message->body);
+ if(!is_window_focused || room->id != current_room_id)
+ show_notification("QuickMedia matrix - " + matrix->message_get_author_displayname(message.get()) + " (" + room->name + ")", message->body);
}
}
@@ -3481,12 +3486,6 @@ namespace QuickMedia {
}
};
- // The room id should be saved in a file when changing viewed room.
- std::string current_room_id;
- RoomBodyData *current_room_body_data = nullptr;
-
- // get_all_room_messages is not needed here because its done in the loop, where the initial timeout is 0ms
-
enum class ChatState {
NAVIGATING,
TYPING_MESSAGE,
@@ -3711,8 +3710,6 @@ namespace QuickMedia {
return result;
};
- bool is_window_focused = true;
-
while (current_page == Page::CHAT) {
sf::Int32 frame_time_ms = frame_timer.restart().asMilliseconds();
while (window.pollEvent(event)) {
diff --git a/src/Text.cpp b/src/Text.cpp
index d58473d..c1adc5d 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -97,6 +97,7 @@ namespace QuickMedia
{
this->maxWidth = maxWidth;
dirty = true;
+ dirtyCaret = true;
}
}
@@ -567,7 +568,7 @@ namespace QuickMedia
}
if(closest_index != -1)
return closest_index;
- return 0;
+ return startIndex;
}
// TODO: This can be optimized by using binary search
@@ -588,7 +589,7 @@ namespace QuickMedia
}
if(closest_index != -1)
return closest_index;
- return num_vertices;
+ return startIndex;
}
// TODO: Optimize text editing by only processing the changed parts in updateGeometry.
@@ -697,8 +698,7 @@ namespace QuickMedia
{
updateGeometry();
- if(dirtyCaret || caretMoveDirection != CaretMoveDirection::NONE)
- {
+ if(editable && (dirtyCaret || caretMoveDirection != CaretMoveDirection::NONE)) {
updateCaret();
dirtyCaret = false;
caretMoveDirection = CaretMoveDirection::NONE;