aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--src/QuickMedia.cpp30
2 files changed, 29 insertions, 3 deletions
diff --git a/README.md b/README.md
index 9d1f325..5575541 100644
--- a/README.md
+++ b/README.md
@@ -57,7 +57,7 @@ Press `Ctrl + C` to copy the text of the selected item to the clipboard.\
Press `U` in matrix or in a 4chan thread to bring up the file manager to choose a file to upload.\
Press `Ctrl + V` to upload media to room in matrix if the clipboard contains a valid absolute filepath.\
Press `Ctrl + D` to remove the file that was previously selected with `U` in a 4chan thread.\
-Press `Ctrl + I` to reverse image search the selected image on 4chan.\
+Press `Ctrl + I` to reverse image search the selected image on 4chan or matrix.\
Press `Ctrl+Alt+Arrow up` / `Ctrl+Alt+Arrow down` or `Ctrl+Alt+K` / `Ctrl+Alt+J` to view the room above/below the selected room in matrix.
In matrix you can select a message with enter to open the url in the message (or if there are multiple urls then a menu will appear for selecting which to open).
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 4647787..0e4ba22 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3217,9 +3217,13 @@ namespace QuickMedia {
}
} else if(event.key.code == sf::Keyboard::I && event.key.control) {
BodyItem *selected_item = thread_body->get_selected();
- if(selected_item && !selected_item->url.empty()) {
+ if(selected_item && !selected_item->url.empty() && !selected_item->thumbnail_url.empty()) {
+ std::string image_url = selected_item->url;
+ if(is_url_video(selected_item->url))
+ image_url = selected_item->thumbnail_url;
+
std::vector<Tab> saucenao_tabs;
- saucenao_tabs.push_back(Tab{create_body(), std::make_unique<SaucenaoPage>(this, selected_item->url, false), nullptr});
+ saucenao_tabs.push_back(Tab{create_body(), std::make_unique<SaucenaoPage>(this, image_url, false), nullptr});
page_loop(saucenao_tabs);
redraw = true;
frame_skip_text_entry = true;
@@ -4881,6 +4885,28 @@ namespace QuickMedia {
tabs[selected_tab].body.get()->select_last_item();
} else if(event.key.code == sf::Keyboard::Escape) {
goto chat_page_end;
+ } else if(event.key.code == sf::Keyboard::I && event.key.control) {
+ BodyItem *selected_item = tabs[selected_tab].body->get_selected();
+ if(selected_item && !selected_item->url.empty() && !selected_item->thumbnail_url.empty()) {
+ Message *selected_item_message = nullptr;
+ if(selected_tab == MESSAGES_TAB_INDEX) {
+ selected_item_message = static_cast<Message*>(selected_item->userdata);
+ } else if(selected_tab == PINNED_TAB_INDEX && static_cast<PinnedEventData*>(selected_item->userdata)->status == FetchStatus::FINISHED_LOADING) {
+ selected_item_message = static_cast<PinnedEventData*>(selected_item->userdata)->message;
+ }
+
+ if(selected_item_message && (selected_item_message->type == MessageType::IMAGE || selected_item_message->type == MessageType::VIDEO)) {
+ std::string image_url = selected_item->url;
+ if(selected_item_message->type == MessageType::VIDEO)
+ image_url = selected_item->thumbnail_url;
+
+ std::vector<Tab> saucenao_tabs;
+ saucenao_tabs.push_back(Tab{create_body(), std::make_unique<SaucenaoPage>(this, image_url, false), nullptr});
+ page_loop(saucenao_tabs);
+ redraw = true;
+ frame_skip_text_entry = true;
+ }
+ }
}
if((selected_tab == MESSAGES_TAB_INDEX || selected_tab == PINNED_TAB_INDEX) && event.key.code == sf::Keyboard::Enter && !frame_skip_text_entry) {