diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-12-07 18:20:17 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2019-12-07 18:20:17 +0100 |
commit | a213862c5e34116890e210eda71ea04758149f98 (patch) | |
tree | 559df4a9142f4a75faf103aae4702e4124f9d540 /src | |
parent | 3364e8c6291907ea88e45314c5add9624b81c110 (diff) |
Do not clear page when exiting video. Clear thumbnails when clearing items
Diffstat (limited to 'src')
-rw-r--r-- | src/Body.cpp | 2 | ||||
-rw-r--r-- | src/QuickMedia.cpp | 12 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/Body.cpp b/src/Body.cpp index 27e09f9..ac809eb 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -72,7 +72,7 @@ namespace QuickMedia { void Body::clear_items() { items.clear(); selected_item = 0; - //item_thumbnail_textures.clear(); + item_thumbnail_textures.clear(); } BodyItem* Body::get_selected() const { diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index e2fc237..a9e5a89 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -234,7 +234,7 @@ namespace QuickMedia { return 0; } - void Program::base_event_handler(sf::Event &event, Page previous_page, bool handle_keypress) { + void Program::base_event_handler(sf::Event &event, Page previous_page, bool handle_keypress, bool clear_on_escape) { if (event.type == sf::Event::Closed) { current_page = Page::EXIT; } else if(event.type == sf::Event::Resized) { @@ -249,9 +249,11 @@ namespace QuickMedia { body->select_next_item(); } else if(event.key.code == sf::Keyboard::Escape) { current_page = previous_page; - body->clear_items(); - body->reset_selected(); - search_bar->clear(); + if(clear_on_escape) { + body->clear_items(); + body->reset_selected(); + search_bar->clear(); + } } } else if(event.type == sf::Event::TextEntered) { search_bar->onTextEntered(event.text.unicode); @@ -764,7 +766,7 @@ namespace QuickMedia { while (current_page == Page::VIDEO_CONTENT) { while (window.pollEvent(event)) { - base_event_handler(event, previous_page); + base_event_handler(event, previous_page, true, false); if(event.type == sf::Event::Resized) { if(video_player_ui_window) ui_resize = true; |