From fdeb82815db468ac7e99e9646f57bed2bf1832de Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 22 Sep 2021 20:10:48 +0200 Subject: Sort anilist recommendations by best match, show episode duration, show titles differently --- include/Body.hpp | 3 +-- include/BodyItem.hpp | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'include') 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 create(std::string title) { return std::make_shared(std::move(title)); } + static std::shared_ptr 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 @@ -161,6 +162,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) @@ -171,6 +174,7 @@ namespace QuickMedia { sf::Color title_color; sf::Color author_color; sf::Color description_color; + bool selectable; }; using BodyItems = std::vector>; -- cgit v1.2.3