From 928f2525c29929de0c2ab520f48c82b5cb882aa7 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 30 Oct 2020 16:47:40 +0100 Subject: Matrix: re-add /logout, cancel task immediately Cancel video download when pressing escape, other fixes.. --- src/Body.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/Body.cpp') diff --git a/src/Body.cpp b/src/Body.cpp index 7f96263..3f5c755 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -186,10 +186,11 @@ namespace QuickMedia { return true; } - void Body::set_selected_item(int item) { + void Body::set_selected_item(int item, bool reset_prev_selected_item) { //assert(item >= 0 && item < (int)items.size()); selected_item = item; - prev_selected_item = selected_item; + if(reset_prev_selected_item) + prev_selected_item = selected_item; clamp_selection(); //page_scroll = 0.0f; } @@ -216,10 +217,6 @@ namespace QuickMedia { clamp_selection(); } - void Body::reset_selected() { - select_first_item(); - } - void Body::clear_items() { items.clear(); selected_item = 0; @@ -235,6 +232,7 @@ namespace QuickMedia { items.insert(items.end(), std::make_move_iterator(new_items.begin()), std::make_move_iterator(new_items.end())); } + // TODO: Binary search and use hint to start search from start or end (for example when adding "previous" items or "next" items) void Body::insert_item_by_timestamp(std::shared_ptr body_item) { for(size_t i = 0; i < items.size(); ++i) { if(body_item->get_timestamp() < items[i]->get_timestamp()) { -- cgit v1.2.3