From d760a699bebd950644aa7a7aa006ce698a995e47 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 1 Oct 2020 12:30:03 +0200 Subject: Matrix: ctrl+p > enter --- src/QuickMedia.cpp | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'src/QuickMedia.cpp') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 9460ec6..709dfea 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -3673,19 +3673,28 @@ namespace QuickMedia { if(tabs[selected_tab].type == ChatTabType::MESSAGES && event.key.code == sf::Keyboard::Enter) { BodyItem *selected = tabs[selected_tab].body->get_selected(); if(selected) { - // TODO: Change this when messages are not stored in the description - const std::string &message_str = selected->get_description(); - auto urls_begin = std::sregex_iterator(message_str.begin(), message_str.end(), url_extract_regex); - auto urls_end = std::sregex_iterator(); - size_t num_urls = std::distance(urls_begin, urls_end); - if(num_urls == 1) { - launch_url(urls_begin->str()); - } else if(num_urls > 1) { - chat_state = ChatState::URL_SELECTION; - url_selection_body.clear_items(); - for(auto it = urls_begin; it != urls_end; ++it) { - auto body_item = BodyItem::create(it->str()); - url_selection_body.items.push_back(std::move(body_item)); + if(!selected->url.empty()) { + page_stack.push(Page::CHAT); + watched_videos.clear(); + content_url = selected->url; + current_page = Page::VIDEO_CONTENT; + video_content_page(); + redraw = true; + } else { + // TODO: Change this when messages are not stored in the description + const std::string &message_str = selected->get_description(); + auto urls_begin = std::sregex_iterator(message_str.begin(), message_str.end(), url_extract_regex); + auto urls_end = std::sregex_iterator(); + size_t num_urls = std::distance(urls_begin, urls_end); + if(num_urls == 1) { + launch_url(urls_begin->str()); + } else if(num_urls > 1) { + chat_state = ChatState::URL_SELECTION; + url_selection_body.clear_items(); + for(auto it = urls_begin; it != urls_end; ++it) { + auto body_item = BodyItem::create(it->str()); + url_selection_body.items.push_back(std::move(body_item)); + } } } } -- cgit v1.2.3