diff options
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | plugins/Page.hpp | 2 | ||||
-rw-r--r-- | src/QuickMedia.cpp | 14 | ||||
-rw-r--r-- | src/SearchBar.cpp | 2 | ||||
-rw-r--r-- | src/plugins/Matrix.cpp | 4 |
5 files changed, 16 insertions, 11 deletions
@@ -58,7 +58,8 @@ Type text and then wait and QuickMedia will automatically search.\ `Ctrl+D`: Clear the input text.\ `Ctrl+C`: Copy the text in the selected item to your clipboard.\ `Ctrl+V`: Paste clipboard content into the search bar.\ -`Ctrl+I`: Select which url in the selected item to open in a browser. +`Ctrl+I`: Select which url in the selected item to open in a browser.\ +`Ctrl+Enter`: Submit search ignoring the selected item. Only works for matrix room directory page and matrix invites page. ### Video controls `mpv` controls apply in general, see https://mpv.io/manual/master/#interactive-control.\ `Esc`/`Backspace`/`Q`: Close the video.\ @@ -112,8 +113,6 @@ Type text and then wait and QuickMedia will automatically search.\ `Ctrl+V`: Paste clipboard content into the message input.\ `Ctrl+D`: Clear the input text.\ `@`: Start searching for a user to mention. -#### Server search page controls -`Ctrl+Enter`: Use the server specified in the search input. ### 4chan thread controls `Enter`: Show the posts that the selected post replies to and the posts the replied to the selected post.\ `Backspace`: Go back to the previously selected item after selecting it with `Enter`.\ diff --git a/plugins/Page.hpp b/plugins/Page.hpp index 07d4e0d..6cea186 100644 --- a/plugins/Page.hpp +++ b/plugins/Page.hpp @@ -50,7 +50,7 @@ namespace QuickMedia { virtual bool is_single_page() const { return false; } virtual bool is_trackable() const { return false; } virtual bool is_lazy_fetch_page() const { return false; } - // Note: If submit is done without any selection, then the search term is sent as the |title|, not |url|. Submit will only be sent if the input text is not empty or if an item is selected + // Note: If submit is done without any selection, then the search term is sent as the |title| and |url|. Submit will only be sent if the input text is not empty or if an item is selected virtual bool allow_submit_no_selection() const { return false; } // This is used to delay loading of the page. For example if the page relies on an external factor to start loading virtual bool is_ready() { return true; } diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index b52678d..6069cf9 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -1702,9 +1702,13 @@ namespace QuickMedia { std::function<void(const std::string&)> submit_handler = [this, &submit_handler, &after_submit_handler, &tabs, &tab_associated_data, &ui_tabs, &loop_running, &redraw](const std::string &search_text) { const int selected_tab = ui_tabs.get_selected(); auto selected_item = tabs[selected_tab].body->get_selected_shared(); + if(!selected_item && search_text.empty()) + return; + if(tabs[selected_tab].page->allow_submit_no_selection() && (sf::Keyboard::isKeyPressed(sf::Keyboard::LControl) || sf::Keyboard::isKeyPressed(sf::Keyboard::RControl))) selected_item = nullptr; - if(!selected_item && (!tabs[selected_tab].page->allow_submit_no_selection() || search_text.empty())) + + if(!selected_item && !tabs[selected_tab].page->allow_submit_no_selection()) return; hide_virtual_keyboard(); @@ -1714,7 +1718,7 @@ namespace QuickMedia { tabs[selected_tab].page->submit_body_item = selected_item; auto plugin_submit_handler = [&tabs, selected_tab, &selected_item, &search_text, &new_tabs]() { - PluginResult plugin_result = tabs[selected_tab].page->submit(selected_item ? selected_item->get_title() : search_text, selected_item ? selected_item->url : "", new_tabs); + PluginResult plugin_result = tabs[selected_tab].page->submit(selected_item ? selected_item->get_title() : search_text, selected_item ? selected_item->url : search_text, new_tabs); return plugin_result == PluginResult::OK; }; @@ -4265,8 +4269,10 @@ namespace QuickMedia { captcha_slide_fg.set_size(sf::Vector2f(std::floor(captcha_slide_fg_size.x * captcha_slide), captcha_slide_fg_size.y)); captcha_slide_fg.set_position(captcha_slide_bg.get_position() + sf::Vector2f(captcha_slide_padding_x, captcha_slide_padding_y)); - captcha_slide_bg.draw(window); - captcha_slide_fg.draw(window); + if(has_captcha_bg) { + captcha_slide_bg.draw(window); + captcha_slide_fg.draw(window); + } captcha_solution_text.setPosition( sf::Vector2f( diff --git a/src/SearchBar.cpp b/src/SearchBar.cpp index 0634ae8..5909635 100644 --- a/src/SearchBar.cpp +++ b/src/SearchBar.cpp @@ -121,7 +121,7 @@ namespace QuickMedia { time_since_search_update.restart(); } - if(sf::Keyboard::isKeyPressed(sf::Keyboard::LControl) || sf::Keyboard::isKeyPressed(sf::Keyboard::RControl)) + if((sf::Keyboard::isKeyPressed(sf::Keyboard::LControl) || sf::Keyboard::isKeyPressed(sf::Keyboard::RControl)) && (event.type != sf::Event::TextEntered || event.text.unicode != 13)) // Enter return; if(event.type == sf::Event::TextEntered && event.text.unicode != 8 && event.text.unicode != 127) // 8 = backspace, 127 = del diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 6e95831..68b9524 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -981,8 +981,8 @@ namespace QuickMedia { rooms_page->set_room_as_read(room); } - PluginResult MatrixRoomDirectoryPage::submit(const std::string &title, const std::string&, std::vector<Tab> &result_tabs) { - std::string server_name = title; + PluginResult MatrixRoomDirectoryPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) { + std::string server_name = url; if(strncmp(server_name.c_str(), "http://", 7) == 0) server_name.erase(0, 7); |