aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-10-29 00:58:27 +0100
committerdec05eba <dec05eba@protonmail.com>2019-10-29 00:59:49 +0100
commit479ed7ab493c4423a4cc48adbf5ad420224fabb4 (patch)
tree4bcb1b33b6b99bb02f3ef0bf0cc7f2536edc51c0 /include
parentbe7a58b8e37e70bae5c6699ca9b7a0fec1fd72f9 (diff)
Add search menu tab (currently only manga)
Diffstat (limited to 'include')
-rw-r--r--include/Body.hpp3
-rw-r--r--include/QuickMedia.hpp2
-rw-r--r--include/SearchBar.hpp3
-rw-r--r--include/Storage.hpp6
4 files changed, 11 insertions, 3 deletions
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 <functional>
+#include <filesystem>
namespace QuickMedia {
+ // Return false to stop the iterator
+ using FileIteratorCallback = std::function<bool(const std::filesystem::path &filepath)>;
+
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