diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-09-22 20:10:48 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-09-22 20:10:48 +0200 |
commit | fdeb82815db468ac7e99e9646f57bed2bf1832de (patch) | |
tree | ffc1ca95e05f47e26c21cce29f5510275e01787e /include | |
parent | 7934864d58ec39b237e2b45d0180aa567b29b944 (diff) |
Sort anilist recommendations by best match, show episode duration, show titles differently
Diffstat (limited to 'include')
-rw-r--r-- | include/Body.hpp | 3 | ||||
-rw-r--r-- | include/BodyItem.hpp | 8 |
2 files changed, 7 insertions, 4 deletions
diff --git a/include/Body.hpp b/include/Body.hpp index 91913b5..4126697 100644 --- a/include/Body.hpp +++ b/include/Body.hpp @@ -117,8 +117,6 @@ namespace QuickMedia { // TODO: Highlight the part of the text that matches the search. void filter_search_fuzzy(const std::string &text); - bool no_items_visible() const; - int get_selected_item() const { return selected_item; } bool is_selected_item_last_visible_item() const; @@ -162,6 +160,7 @@ namespace QuickMedia { void update_dirty_state(BodyItem *body_item, float width); void clear_body_item_cache(BodyItem *body_item); sf::Vector2i get_item_thumbnail_size(BodyItem *item) const; + // Returns -1 if not found int get_previous_visible_item(int start_index); // Returns -1 if not found diff --git a/include/BodyItem.hpp b/include/BodyItem.hpp index e2f4918..5889d58 100644 --- a/include/BodyItem.hpp +++ b/include/BodyItem.hpp @@ -43,11 +43,10 @@ namespace QuickMedia { class BodyItem { public: - BodyItem(std::string _title); BodyItem(const BodyItem&) = delete; BodyItem& operator=(const BodyItem &other); - static std::shared_ptr<BodyItem> create(std::string title) { return std::make_shared<BodyItem>(std::move(title)); } + static std::shared_ptr<BodyItem> create(std::string title, bool selectable = true); void set_title(std::string new_title) { if(title == new_title) @@ -122,6 +121,8 @@ namespace QuickMedia { sf::Color get_description_color() const { return description_color; } sf::Color get_author_color() const { return author_color; } + bool is_selectable() const { return selectable; } + void draw_list(Body *body, sf::RenderTarget &render_target); // TODO: Use a list of strings instead, not all plugins need all of these fields @@ -162,6 +163,8 @@ namespace QuickMedia { // Internal use only int keep_alive_frames = 0; private: + BodyItem(std::string _title, bool selectable); + private: // TODO: Clean up these strings when set in text, and get_title for example should return |title_text.getString()| // TODO: Use sf::String instead, removes the need to convert to utf32 every time the text is dirty (for example when resizing window) std::string title; @@ -171,6 +174,7 @@ namespace QuickMedia { sf::Color title_color; sf::Color author_color; sf::Color description_color; + bool selectable; }; using BodyItems = std::vector<std::shared_ptr<BodyItem>>; |