From 5e7215b4675955fee8197076914599fe62f39c26 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 17 Sep 2020 16:44:52 +0200 Subject: Disable wrap around body, detect wrap around --- src/QuickMedia.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/QuickMedia.cpp') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 377729f..75bc027 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -2025,10 +2025,11 @@ namespace QuickMedia { if(image_index > 0) { --image_index; return; - } else if(image_index == 0 && body->selected_item < (int)body->items.size() - 1) { + } else if(image_index == 0 && body->get_selected_item() < (int)body->items.size() - 1) { // TODO: Make this work if the list is sorted differently than from newest to oldest. - body->selected_item++; - select_episode(body->items[body->selected_item].get(), true); + body->filter_search_fuzzy(""); + body->select_next_item(); + select_episode(body->items[body->get_selected_item()].get(), true); image_index = 99999; // Start at the page that shows we are at the end of the chapter return; } @@ -2036,10 +2037,11 @@ namespace QuickMedia { if(image_index < num_images) { ++image_index; return; - } else if(image_index == num_images && body->selected_item > 0) { + } else if(image_index == num_images && body->get_selected_item() > 0) { // TODO: Make this work if the list is sorted differently than from newest to oldest. - body->selected_item--; - select_episode(body->items[body->selected_item].get(), true); + body->filter_search_fuzzy(""); + body->select_previous_item(); + select_episode(body->items[body->get_selected_item()].get(), true); return; } } else if(event.key.code == sf::Keyboard::Escape) { @@ -2564,7 +2566,7 @@ namespace QuickMedia { } BodyItem *selected_item = body->get_selected(); - if(event.key.code == sf::Keyboard::Enter && selected_item && (comment_navigation_stack.empty() || body->selected_item != comment_navigation_stack.top()) && !selected_item->replies.empty()) { + if(event.key.code == sf::Keyboard::Enter && selected_item && (comment_navigation_stack.empty() || body->get_selected_item() != comment_navigation_stack.top()) && !selected_item->replies.empty()) { for(auto &body_item : body->items) { body_item->visible = false; } @@ -2572,7 +2574,7 @@ namespace QuickMedia { for(size_t reply_index : selected_item->replies) { body->items[reply_index]->visible = true; } - comment_navigation_stack.push(body->selected_item); + comment_navigation_stack.push(body->get_selected_item()); } else if(event.key.code == sf::Keyboard::BackSpace && !comment_navigation_stack.empty()) { size_t previous_selected = 0; if(!comment_navigation_stack.empty()) { @@ -2583,12 +2585,12 @@ namespace QuickMedia { for(auto &body_item : body->items) { body_item->visible = true; } - body->selected_item = previous_selected; + body->set_selected_item(previous_selected); } else { for(auto &body_item : body->items) { body_item->visible = false; } - body->selected_item = previous_selected; + body->set_selected_item(previous_selected); selected_item = body->items[comment_navigation_stack.top()].get(); selected_item->visible = true; for(size_t reply_index : selected_item->replies) { -- cgit v1.2.3