From 479ed7ab493c4423a4cc48adbf5ad420224fabb4 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 29 Oct 2019 00:58:27 +0100 Subject: Add search menu tab (currently only manga) --- include/Body.hpp | 3 ++- include/QuickMedia.hpp | 2 +- include/SearchBar.hpp | 3 ++- include/Storage.hpp | 6 ++++++ 4 files changed, 11 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/Body.hpp b/include/Body.hpp index c394519..fd1e438 100644 --- a/include/Body.hpp +++ b/include/Body.hpp @@ -44,7 +44,8 @@ namespace QuickMedia { static bool string_find_case_insensitive(const std::string &str, const std::string &substr); // TODO: Make this actually fuzzy... Right now it's just a case insensitive string find. - // TODO: Highlight the part of the text that matches the search + // TODO: Highlight the part of the text that matches the search. + // TODO: Ignore dot, whitespace and special characters void filter_search_fuzzy(const std::string &text); sf::Text title_text; diff --git a/include/QuickMedia.hpp b/include/QuickMedia.hpp index 6906036..7bf8231 100644 --- a/include/QuickMedia.hpp +++ b/include/QuickMedia.hpp @@ -24,7 +24,7 @@ namespace QuickMedia { Plugin* get_current_plugin() { return current_plugin; } private: - void base_event_handler(sf::Event &event, Page previous_page); + void base_event_handler(sf::Event &event, Page previous_page, bool handle_key_press = true); void search_suggestion_page(); void search_result_page(); void video_content_page(); diff --git a/include/SearchBar.hpp b/include/SearchBar.hpp index 8ac8766..88eed19 100644 --- a/include/SearchBar.hpp +++ b/include/SearchBar.hpp @@ -15,13 +15,14 @@ namespace QuickMedia { class SearchBar { public: SearchBar(sf::Font &font, sf::Texture &plugin_logo); - void draw(sf::RenderWindow &window); + void draw(sf::RenderWindow &window, bool draw_shadow = true); void update(); void onWindowResize(const sf::Vector2f &window_size); void onTextEntered(sf::Uint32 codepoint); void clear(); float getBottom() const; + float getBottomWithoutShadow() const; TextUpdateCallback onTextUpdateCallback; TextSubmitCallback onTextSubmitCallback; diff --git a/include/Storage.hpp b/include/Storage.hpp index 5b35ba7..4dd8db2 100644 --- a/include/Storage.hpp +++ b/include/Storage.hpp @@ -1,8 +1,13 @@ #pragma once #include "Path.hpp" +#include +#include namespace QuickMedia { + // Return false to stop the iterator + using FileIteratorCallback = std::function; + enum class FileType { FILE_NOT_FOUND, REGULAR, @@ -17,4 +22,5 @@ namespace QuickMedia { int file_get_content(const Path &path, std::string &result); int file_overwrite(const Path &path, const std::string &data); int create_lock_file(const Path &path); + void for_files_in_dir(const Path &path, FileIteratorCallback callback); } \ No newline at end of file -- cgit v1.2.3