From d58ea43d93fb41519fad6547cf6533d76ecd2441 Mon Sep 17 00:00:00 2001 From: Midov Date: Sun, 22 Nov 2020 14:17:34 +0100 Subject: initial support for ctrl+hjkl movement, redact changed to ctrl+d --- README.md | 6 +++--- src/QuickMedia.cpp | 24 +++++++++++++++--------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index b2aacc7..d758ff7 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,8 @@ QuickMedia youtube --tor ## Installation If you are running arch linux then you can install QuickMedia from aur (https://aur.archlinux.org/packages/quickmedia-git/), otherwise you will need to use [sibs](https://git.dec05eba.com/sibs/) to build QuickMedia manually.\ ## Controls -Press `Arrow up` or `Arrow down` to navigate the menu and also to scroll to the previous/next image when viewing manga in scroll mode. Alternatively you can use the mouse scroll to scroll to the previous/next manga in scroll mode.\ -Press `Arrow left` or `Arrow right` to switch tab.\ +Press `Arrow up` / `Arrow down` or `Ctrl+K` / `Ctrl+J` to navigate the menu and also to scroll to the previous/next image when viewing manga in scroll mode. Alternatively you can use the mouse scroll to scroll to the previous/next manga in scroll mode.\ +Press `Arrow left` / `Arrow right` or `Ctrl+H` / `Ctrl+L` to switch tab.\ Press `Page up` to scroll up and entire page or `Page down` to scroll down an entire page.\ Press `Home` to scroll to the top or `End` to scroll to the bottom.\ Press `Enter` (aka `Return`) to select the item.\ @@ -50,7 +50,7 @@ Press `Enter` to view image/video attached to matrix message, or to view the url Press `I` to begin writing a message in a matrix room, press `ESC` to cancel.\ Press `R` to reply to a message on matrix, press `ESC` to cancel.\ Press `E` to edit a message on matrix, press `ESC` to cancel. Currently only works for your own messages.\ -Press `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 + 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. diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 9a842dc..2eb369c 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -642,9 +642,9 @@ namespace QuickMedia { sf::FloatRect visible_area(0, 0, window_size.x, window_size.y); window.setView(sf::View(visible_area)); } else if(handle_keypress && event.type == sf::Event::KeyPressed) { - if(event.key.code == sf::Keyboard::Up) { + if(event.key.code == sf::Keyboard::Up || (event.key.control && event.key.code == sf::Keyboard::K)) { body->select_previous_item(); - } else if(event.key.code == sf::Keyboard::Down) { + } else if(event.key.code == sf::Keyboard::Down || (event.key.control && event.key.code == sf::Keyboard::J)) { body->select_next_item(); } else if(event.key.code == sf::Keyboard::PageUp) { body->select_previous_page(); @@ -1132,12 +1132,15 @@ namespace QuickMedia { if(event.type == sf::Event::Resized || event.type == sf::Event::GainedFocus) redraw = true; else if(event.type == sf::Event::KeyPressed) { - if(event.key.code == sf::Keyboard::Down || event.key.code == sf::Keyboard::PageDown || event.key.code == sf::Keyboard::End) { + if(event.key.code == sf::Keyboard::Down || event.key.code == sf::Keyboard::PageDown || event.key.code == sf::Keyboard::End || (event.key.control && event.key.code == sf::Keyboard::J)) { bool hit_bottom = false; switch(event.key.code) { case sf::Keyboard::Down: hit_bottom = !tabs[selected_tab].body->select_next_item(); break; + case sf::Keyboard::J: + hit_bottom = !tabs[selected_tab].body->select_next_item(); + break; case sf::Keyboard::PageDown: hit_bottom = !tabs[selected_tab].body->select_next_page(); break; @@ -1167,7 +1170,7 @@ namespace QuickMedia { return result_items; }); } - } else if(event.key.code == sf::Keyboard::Up) { + } else if(event.key.code == sf::Keyboard::Up || (event.key.control && event.key.code == sf::Keyboard::K)) { tabs[selected_tab].body->select_previous_item(); } else if(event.key.code == sf::Keyboard::PageUp) { tabs[selected_tab].body->select_previous_page(); @@ -1175,13 +1178,13 @@ namespace QuickMedia { tabs[selected_tab].body->select_first_item(); } else if(event.key.code == sf::Keyboard::Escape) { goto page_end; - } else if(event.key.code == sf::Keyboard::Left) { + } else if(event.key.code == sf::Keyboard::Left || (event.key.control && event.key.code == sf::Keyboard::H)) { if(selected_tab > 0) { tabs[selected_tab].body->clear_cache(); --selected_tab; redraw = true; } - } else if(event.key.code == sf::Keyboard::Right) { + } else if(event.key.code == sf::Keyboard::Right || (event.key.control && event.key.code == sf::Keyboard::L)) { if(selected_tab < (int)tabs.size() - 1) { tabs[selected_tab].body->clear_cache(); ++selected_tab; @@ -4072,12 +4075,15 @@ namespace QuickMedia { } else if(event.type == sf::Event::Resized || event.type == sf::Event::GainedFocus) { redraw = true; } else if(event.type == sf::Event::KeyPressed && chat_state == ChatState::NAVIGATING) { - if(event.key.code == sf::Keyboard::Up || event.key.code == sf::Keyboard::PageUp || event.key.code == sf::Keyboard::Home){ + if(event.key.code == sf::Keyboard::Up || event.key.code == sf::Keyboard::PageUp || event.key.code == sf::Keyboard::Home || (event.key.control && event.key.code == sf::Keyboard::K)){ bool hit_top = false; switch(event.key.code) { case sf::Keyboard::Up: hit_top = !tabs[selected_tab].body->select_previous_item(); break; + case sf::Keyboard::K: + hit_top = !tabs[selected_tab].body->select_previous_item(); + break; case sf::Keyboard::PageUp: hit_top = !tabs[selected_tab].body->select_previous_page(); break; @@ -4098,7 +4104,7 @@ namespace QuickMedia { return messages; }; } - } else if(event.key.code == sf::Keyboard::Down) { + } else if(event.key.code == sf::Keyboard::Down || (event.key.control && event.key.code == sf::Keyboard::J)) { tabs[selected_tab].body->select_next_item(); } else if(event.key.code == sf::Keyboard::PageDown) { tabs[selected_tab].body->select_next_page(); @@ -4213,7 +4219,7 @@ namespace QuickMedia { } } - if(event.key.code == sf::Keyboard::D) { + if(event.key.control && event.key.code == sf::Keyboard::D) { frame_skip_text_entry = true; BodyItem *selected = tabs[selected_tab].body->get_selected(); if(selected) { -- cgit v1.2.3