diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-10-01 12:30:03 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-10-01 12:30:03 +0200 |
commit | d760a699bebd950644aa7a7aa006ce698a995e47 (patch) | |
tree | d0df8b0b00ec60a210e14c31cf9d2e661d45fcba /src | |
parent | 925139ea3ba6634a267586db0e60af1ea60cdc6f (diff) |
Matrix: ctrl+p > enter
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 35 |
1 files changed, 22 insertions, 13 deletions
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)); + } } } } |