aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp30
1 files changed, 28 insertions, 2 deletions
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) {