aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-10-23 01:15:31 +0200
committerdec05eba <dec05eba@protonmail.com>2020-10-23 01:15:31 +0200
commit05ce6bac22d498fb2827df72f4c2b86d02826042 (patch)
tree89d55681168f1aa66df7a2bb1016e7327dae6ecc
parent290ca90416e96febdc4ae8bafccbbdd4cea01351 (diff)
Remove requiring to use ctrl on 4chan, remove formatting text in modified text on matrix
-rw-r--r--README.md2
-rw-r--r--TODO4
-rw-r--r--src/Body.cpp2
-rw-r--r--src/QuickMedia.cpp28
4 files changed, 21 insertions, 15 deletions
diff --git a/README.md b/README.md
index 7033d2f..a0d3470 100644
--- a/README.md
+++ b/README.md
@@ -36,7 +36,7 @@ Press `Ctrl + R` to show/hide related videos menu when watching a video.\
Press `Ctrl + T` when hovering over a manga chapter to start tracking manga after that chapter. This only works if AutoMedia is installed and accessible in PATH environment variable.\
Press `Backspace` to return to the preview item when reading replies in image board threads.\
Press `R` to paste the post number of the selected post into the post field (image boards).\
-Press `Ctrl + M` to begin writing a post to a thread (image boards), press `ESC` to cancel.\
+Press `M` to begin writing a post to a thread (image boards), press `ESC` to cancel.\
Press `1 to 9` or `Numpad 1 to 9` to select google captcha image when posting a comment on 4chan.\
Press `P` to preview the 4chan image of the selected row in full screen view, press `ESC` or `Backspace` to go back.\
Press `I` to switch between single image and scroll image view mode when reading manga.\
diff --git a/TODO b/TODO
index 66ff8aa..8f8de4f 100644
--- a/TODO
+++ b/TODO
@@ -112,4 +112,6 @@ Check if we need to call /_matrix/client/r0/notifications for intial sync to rec
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).
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
+Pressing enter on a pinned message should go to the message in the messages tab.
+Cache pinned messages on disk (messages by event id), but take into consider edits? for example if one message is pinned in the room and then edited multiple times (such as room rules). In that case cache the pinned message to quickly display it and then fetch the latest version from the server and then replace the message with the latest version.
+Display file list for nyaa. \ No newline at end of file
diff --git a/src/Body.cpp b/src/Body.cpp
index f9b3edc..ee32b08 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -698,7 +698,7 @@ namespace QuickMedia {
sf::String replies_text_str;
for(size_t reply_index : item->replies) {
BodyItem *reply_item = items[reply_index].get();
- replies_text_str += ">>";
+ replies_text_str += " >>";
replies_text_str += reply_item->post_number;
}
replies_text.setString(std::move(replies_text_str));
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 7a95ee6..046ba9d 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -2384,7 +2384,7 @@ namespace QuickMedia {
}, is_tor_enabled());
};
- Entry comment_input("Press ctrl+m to begin writing a comment...", font.get(), cjk_font.get());
+ Entry comment_input("Press m to begin writing a comment...", font.get(), cjk_font.get());
comment_input.draw_background = false;
comment_input.set_editable(false);
@@ -2481,7 +2481,7 @@ namespace QuickMedia {
if(event.type == sf::Event::Resized || event.type == sf::Event::GainedFocus)
redraw = true;
- else if(event.type == sf::Event::KeyPressed && navigation_stage == NavigationStage::VIEWING_COMMENTS) {
+ else if(navigation_stage == NavigationStage::VIEWING_COMMENTS && event.type == sf::Event::KeyPressed) {
if(event.key.code == sf::Keyboard::Up) {
thread_body->select_previous_item();
} else if(event.key.code == sf::Keyboard::Down) {
@@ -2564,15 +2564,15 @@ namespace QuickMedia {
thread_body->clamp_selection();
}
thread_body->set_page_scroll(previous_page_scroll);
- } else if(event.key.code == sf::Keyboard::M && event.key.control && selected_item) {
- navigation_stage = NavigationStage::REPLYING;
- comment_input.set_editable(true);
- comment_input.move_caret_to_end();
} else if(event.key.code == sf::Keyboard::R && selected_item) {
std::string text_to_add = ">>" + selected_item->post_number + "\n";
comment_input.append_text(std::move(text_to_add));
comment_input.move_caret_to_end();
}
+ } else if(navigation_stage == NavigationStage::VIEWING_COMMENTS && event.type == sf::Event::KeyReleased && event.key.code == sf::Keyboard::M) {
+ navigation_stage = NavigationStage::REPLYING;
+ comment_input.set_editable(true);
+ comment_input.move_caret_to_end();
}
if(event.type == sf::Event::KeyPressed && navigation_stage == NavigationStage::SOLVING_POST_CAPTCHA) {
@@ -2887,15 +2887,19 @@ namespace QuickMedia {
return str;
}
+ static std::string message_get_body_remove_formatting(Message *message) {
+ if(message->related_event_type == RelatedEventType::REPLY || message->related_event_type == RelatedEventType::EDIT)
+ return remove_reply_formatting(message->body);
+ else
+ return message->body;
+ }
+
static const sf::Vector2i CHAT_MESSAGE_THUMBNAIL_MAX_SIZE(600, 337);
static std::shared_ptr<BodyItem> message_to_body_item(Message *message, UserInfo *me) {
auto body_item = BodyItem::create("");
body_item->set_author(message->user->display_name);
- std::string text = message->body;
- if(message->related_event_type == RelatedEventType::REPLY)
- text = remove_reply_formatting(text);
- body_item->set_description(std::move(text));
+ body_item->set_description(message_get_body_remove_formatting(message));
body_item->set_timestamp(message->timestamp);
if(!message->thumbnail_url.empty()) {
body_item->thumbnail_url = message->thumbnail_url;
@@ -3153,7 +3157,7 @@ namespace QuickMedia {
if(message->related_event_type == RelatedEventType::REDACTION || message->related_event_type == RelatedEventType::EDIT) {
auto body_item = find_body_item_by_event_id(body_items, num_body_items, message->related_event_id);
if(body_item) {
- body_item->set_description(message->body);
+ body_item->set_description(message_get_body_remove_formatting(message.get()));
if(message->related_event_type == RelatedEventType::REDACTION)
set_body_as_deleted(message.get(), body_item.get());
it = unreferenced_events.erase(it);
@@ -3175,7 +3179,7 @@ namespace QuickMedia {
if(message->related_event_type == RelatedEventType::REDACTION || message->related_event_type == RelatedEventType::EDIT) {
auto body_item = find_body_item_by_event_id(body_items.data(), body_items.size(), message->related_event_id);
if(body_item) {
- body_item->set_description(message->body);
+ body_item->set_description(message_get_body_remove_formatting(message.get()));
if(message->related_event_type == RelatedEventType::REDACTION)
set_body_as_deleted(message.get(), body_item.get());
} else {