aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-06-02 17:42:30 +0200
committerdec05eba <dec05eba@protonmail.com>2021-06-02 17:43:47 +0200
commitcc3a65bde2e480b2b07b74eeef20d9081d7f730f (patch)
tree1bb5b85ab764592093e8042458ec9f4be0cf904a /include
parent1b6812348e75de21c8f398a7dc944cc427064cc4 (diff)
Add modern theme
Join matrix room by their name instead of id if there is a name. This allows you to join rooms where the homeserver that created the room is no longer participating in the room.
Diffstat (limited to 'include')
-rw-r--r--include/Body.hpp28
-rw-r--r--include/QuickMedia.hpp3
-rw-r--r--include/RoundedRectangle.hpp5
3 files changed, 27 insertions, 9 deletions
diff --git a/include/Body.hpp b/include/Body.hpp
index 388d825..4846b59 100644
--- a/include/Body.hpp
+++ b/include/Body.hpp
@@ -30,7 +30,13 @@ namespace QuickMedia {
enum class ThumbnailMaskType {
NONE,
- CIRCLE
+ CIRCLE,
+ ROUNDED_RECTANGLE
+ };
+
+ enum BodyTheme : int {
+ BODY_THEME_MINIMAL,
+ BODY_THEME_MODERN_SPACIOUS
};
// TODO: Remove and create an Userdata class instead to replace the void* userdata in BodyItem
@@ -183,7 +189,7 @@ namespace QuickMedia {
class Body {
public:
- Body(Program *program, sf::Texture &loading_icon_texture, sf::Shader *rounded_rectangle_shader);
+ Body(BodyTheme body_theme, sf::Texture &loading_icon_texture, sf::Shader *rounded_rectangle_shader, sf::Shader *rounded_rectangle_mask_shader);
~Body();
// Select previous page, ignoring invisible items. Returns true if the item was changed. This can be used to check if the top was hit when wrap_around is set to false
@@ -231,7 +237,6 @@ namespace QuickMedia {
void draw_item(sf::RenderWindow &window, BodyItem *item, sf::Vector2f pos, sf::Vector2f size, bool include_embedded_item = true, bool is_embedded = false);
float get_item_height(BodyItem *item, float width, bool load_texture = true, bool include_embedded_item = true, bool merge_with_previous = false, int item_index = -1);
- float get_spacing_y() const;
// TODO: Highlight the part of the text that matches the search.
void filter_search_fuzzy(const std::string &text);
@@ -254,14 +259,10 @@ namespace QuickMedia {
void apply_search_filter_for_item(BodyItem *body_item);
- sf::Text progress_text;
- sf::Text replies_text;
- sf::Text embedded_item_load_text;
BodyItems items;
bool draw_thumbnails;
// Set to {0, 0} to disable resizing
sf::Vector2i thumbnail_max_size;
- sf::Color line_separator_color;
BodyItemRenderCallback body_item_render_callback;
BodyItemMergeHandler body_item_merge_handler;
std::function<void(BodyItem*)> body_item_select_callback;
@@ -269,10 +270,12 @@ namespace QuickMedia {
AttachSide attach_side = AttachSide::TOP;
bool title_mark_urls = false;
bool swiping_enabled = false;
+ bool show_drop_shadow = true;
std::function<void()> on_top_reached = nullptr;
std::function<void()> on_bottom_reached = nullptr;
private:
+ void draw_drop_shadow(sf::RenderWindow &window);
void filter_search_fuzzy_item(const std::string &text, BodyItem *body_item);
void handle_item_render(BodyItem *item, const sf::Vector2f pos, const sf::Vector2f size, const float item_height, int item_index);
void draw_item(sf::RenderWindow &window, BodyItem *item, const sf::Vector2f &pos, const sf::Vector2f &size, const float item_height, const int item_index, const Json::Value &content_progress, bool include_embedded_item = true, bool merge_with_previous = false);
@@ -302,7 +305,8 @@ namespace QuickMedia {
BOTTOM
};
- Program *program;
+ BodyTheme body_theme;
+
int selected_item;
int prev_selected_item;
double page_scroll = 0.0;
@@ -312,6 +316,11 @@ namespace QuickMedia {
//sf::RectangleShape item_separator;
sf::Sprite image;
sf::Sprite loading_icon;
+
+ sf::Text progress_text;
+ sf::Text replies_text;
+ sf::Text embedded_item_load_text;
+
int num_visible_items;
bool top_cut_off;
bool bottom_cut_off;
@@ -345,12 +354,15 @@ namespace QuickMedia {
RoundedRectangle item_background;
RoundedRectangle reaction_background;
bool render_selected_item_bg = true;
+ float item_background_prev_pos_y = 0.0f;
float item_background_target_pos_y = 0.0f;
+ float item_background_prev_height = 0.0f;
float item_background_target_height = 0.0f;
TargetSetState target_y_set = TargetSetState::NOT_SET;
// TODO: Instead of using this, add functions for modifying |items| and apply the filter on those new items
DirtyState items_dirty = DirtyState::FALSE;
std::string current_filter;
bool using_filter = false;
+ sf::Shader *rounded_rectangle_mask_shader;
};
} \ No newline at end of file
diff --git a/include/QuickMedia.hpp b/include/QuickMedia.hpp
index 82b2ee4..09b0806 100644
--- a/include/QuickMedia.hpp
+++ b/include/QuickMedia.hpp
@@ -79,7 +79,7 @@ namespace QuickMedia {
~Program();
int run(int argc, char **argv);
- std::unique_ptr<Body> create_body();
+ std::unique_ptr<Body> create_body(bool plain_text_list = false);
std::unique_ptr<SearchBar> create_search_bar(const std::string &placeholder, int search_delay);
bool load_manga_content_storage(const char *service_name, const std::string &manga_title, const std::string &manga_id);
@@ -179,6 +179,7 @@ namespace QuickMedia {
std::string resources_root;
sf::Shader circle_mask_shader;
sf::Shader rounded_rectangle_shader;
+ sf::Shader rounded_rectangle_mask_shader;
bool no_video = false;
bool force_no_video = false;
bool use_system_mpv_config = false;
diff --git a/include/RoundedRectangle.hpp b/include/RoundedRectangle.hpp
index 96e57fd..b9d0754 100644
--- a/include/RoundedRectangle.hpp
+++ b/include/RoundedRectangle.hpp
@@ -17,6 +17,8 @@ namespace QuickMedia {
void set_color(sf::Color color);
sf::Vector2f get_position() const;
sf::Vector2f get_size() const;
+ void set_band(float y, float height);
+ void set_band_color(sf::Color color);
void draw(sf::RenderTarget &target);
private:
float radius;
@@ -24,5 +26,8 @@ namespace QuickMedia {
sf::Vector2f size;
sf::Vertex vertices[4];
sf::Shader *rounded_rectangle_shader;
+ float band_y;
+ float band_height;
+ sf::Color band_color;
};
} \ No newline at end of file