diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 0139f37..cea2afb 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -3199,10 +3199,12 @@ 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.code == sf::Keyboard::K) + { bool hit_top = false; switch(event.key.code) { case sf::Keyboard::Up: + case sf::Keyboard::K: hit_top = !tabs[selected_tab].body->select_previous_item(); break; case sf::Keyboard::PageUp: @@ -3227,7 +3229,7 @@ namespace QuickMedia { return result_items; }); } - } else if(event.key.code == sf::Keyboard::Down) { + } else if(event.key.code == sf::Keyboard::Down || 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(); @@ -3235,7 +3237,7 @@ namespace QuickMedia { tabs[selected_tab].body->select_last_item(); } else if(event.key.code == sf::Keyboard::Escape) { current_page = PageType::EXIT; - } else if(event.key.code == sf::Keyboard::Left && synced) { + } else if((event.key.code == sf::Keyboard::Left || event.key.code == sf::Keyboard::H) && synced) { tabs[selected_tab].body->clear_cache(); selected_tab = std::max(0, selected_tab - 1); read_marker_timer.restart(); @@ -3245,7 +3247,7 @@ namespace QuickMedia { typing = false; typing_futures.push_back(std::async(typing_async_func, false, current_room_id)); } - } else if(event.key.code == sf::Keyboard::Right && synced) { + } else if((event.key.code == sf::Keyboard::Right || event.key.code == sf::Keyboard::L) && synced) { tabs[selected_tab].body->clear_cache(); selected_tab = std::min((int)tabs.size() - 1, selected_tab + 1); read_marker_timer.restart(); @@ -3257,6 +3259,21 @@ namespace QuickMedia { } } + if(tabs[selected_tab].type == ChatTabType::MESSAGES && ((event.key.control && event.key.code == sf::Keyboard::M) || event.key.code == sf::Keyboard::I)) { + chat_input.set_editable(true); + chat_state = ChatState::TYPING_MESSAGE; + } + + if(tabs[selected_tab].type == ChatTabType::MESSAGES && event.key.control && event.key.code == sf::Keyboard::V) { + // TODO: Make asynchronous. + // TODO: Upload multiple files. + std::string err_msg; + if(matrix->post_file(current_room_id, sf::Clipboard::getString(), err_msg) != PluginResult::OK) { + std::string desc = "Failed to upload media to room, error: " + err_msg; + show_notification("QuickMedia", desc.c_str(), Urgency::CRITICAL); + } + } + if(tabs[selected_tab].type == ChatTabType::MESSAGES && event.key.control && event.key.code == sf::Keyboard::R) { std::shared_ptr<BodyItem> selected = tabs[selected_tab].body->get_selected_shared(); if(selected) { @@ -3373,11 +3390,6 @@ namespace QuickMedia { } } - if(chat_state == ChatState::NAVIGATING && tabs[selected_tab].type == ChatTabType::MESSAGES && event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::M && event.key.control) { - chat_input.set_editable(true); - chat_state = ChatState::TYPING_MESSAGE; - } - if((chat_state == ChatState::TYPING_MESSAGE || chat_state == ChatState::REPLYING || chat_state == ChatState::EDITING) && tabs[selected_tab].type == ChatTabType::MESSAGES) { if(event.type == sf::Event::TextEntered) { //chat_input.onTextEntered(event.text.unicode); @@ -3454,7 +3466,7 @@ namespace QuickMedia { // TODO: Upload multiple files. std::string err_msg; if(matrix->post_file(current_room_id, selected_files[0], err_msg) != PluginResult::OK) { - std::string desc = "Failed to upload image to room, error: " + err_msg; + std::string desc = "Failed to upload media to room, error: " + err_msg; show_notification("QuickMedia", desc.c_str(), Urgency::CRITICAL); } } |