aboutsummaryrefslogtreecommitdiff
path: root/src/Body.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-09-08 17:04:31 +0200
committerdec05eba <dec05eba@protonmail.com>2021-09-08 17:04:57 +0200
commitda2988c4356d2756e86037b1c7e859f49583c109 (patch)
tree73ca076fa1a0f46fa3e3f1e6016d7bf479113491 /src/Body.cpp
parent24b0ed2ae8a0d52ceee647e34a943213e9d3bc89 (diff)
Load theme from file (~/.config/quickmedia/themes/<theme-name>.json and /usr/share/quickmedia/themes/<theme-name>.json)
Diffstat (limited to 'src/Body.cpp')
-rw-r--r--src/Body.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/Body.cpp b/src/Body.cpp
index 68e34e8..10e31dd 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -106,16 +106,16 @@ namespace QuickMedia {
num_visible_items(0),
top_cut_off(false),
bottom_cut_off(false),
- item_background(sf::Vector2f(1.0f, 1.0f), 10.0f, get_current_theme().selected_color, rounded_rectangle_shader),
- reaction_background(sf::Vector2f(1.0f, 1.0f), 10.0f, get_current_theme().shade_color, rounded_rectangle_shader),
+ item_background(sf::Vector2f(1.0f, 1.0f), 10.0f, get_theme().selected_color, rounded_rectangle_shader),
+ reaction_background(sf::Vector2f(1.0f, 1.0f), 10.0f, get_theme().shade_color, rounded_rectangle_shader),
rounded_rectangle_mask_shader(rounded_rectangle_mask_shader)
{
assert(rounded_rectangle_shader);
assert(rounded_rectangle_mask_shader);
init_body_themes();
embedded_item_load_text = sf::Text("", *FontLoader::get_font(FontLoader::FontType::LATIN), body_spacing[body_theme].embedded_item_font_size);
- progress_text.setFillColor(get_current_theme().text_color);
- replies_text.setFillColor(get_current_theme().replies_text_color);
+ progress_text.setFillColor(get_theme().text_color);
+ replies_text.setFillColor(get_theme().replies_text_color);
thumbnail_max_size.x = 600;
thumbnail_max_size.y = 337;
sf::Vector2f loading_icon_size(loading_icon.getTexture()->getSize().x, loading_icon.getTexture()->getSize().y);
@@ -905,7 +905,7 @@ namespace QuickMedia {
body_item->timestamp_text = std::make_unique<sf::Text>(time_str, *FontLoader::get_font(FontLoader::FontType::LATIN), std::floor(get_config().body.timestamp_font_size * get_config().scale * get_config().font_scale));
}
- body_item->timestamp_text->setFillColor(get_current_theme().timestamp_text_color);
+ body_item->timestamp_text->setFillColor(get_theme().timestamp_text_color);
}
}
}
@@ -1006,7 +1006,7 @@ namespace QuickMedia {
if(prev_num_visible_items > 0 && render_selected_item_bg && body_theme == BODY_THEME_MINIMAL) {
item_background.set_position(sf::Vector2f(pos.x, item_background_prev_pos.y));
item_background.set_size(item_background_prev_size);
- item_background.set_color(get_current_theme().selected_color);
+ item_background.set_color(get_theme().selected_color);
item_background.set_band(sf::Vector2f(0.0f, 0.0f), sf::Vector2f(0.0f, 0.0f));
item_background.draw(window);
}
@@ -1218,9 +1218,9 @@ namespace QuickMedia {
item_background.set_position(pos + pos_offset);
item_background.set_size(sf::Vector2f(card_width, item_height));
- item_background.set_color(get_current_theme().card_item_background_color);
+ item_background.set_color(get_theme().card_item_background_color);
item_background.set_band(item_background_prev_pos - (pos + pos_offset), item_background_prev_size);
- item_background.set_band_color(get_current_theme().selected_color);
+ item_background.set_band_color(get_theme().selected_color);
item_background.draw(window);
{
@@ -1290,7 +1290,7 @@ namespace QuickMedia {
const float gradient_height = 5.0f;
if(text_offset_y >= text_height - gradient_height && std::abs(item_height - card_height) < 1) {
const sf::Vector2f card_bottom(text_pos.x, text_height);
- const sf::Color color = item_index == selected_item ? get_current_theme().selected_color : get_current_theme().card_item_background_color;
+ const sf::Color color = item_index == selected_item ? get_theme().selected_color : get_theme().card_item_background_color;
sf::Vertex gradient_points[4];
gradient_points[0] = sf::Vertex(card_bottom + sf::Vector2f(0.0f, -gradient_height), sf::Color(color.r, color.g, color.b, 0));
@@ -1362,9 +1362,9 @@ namespace QuickMedia {
if(item_index != -1 && body_theme == BODY_THEME_MODERN_SPACIOUS) {
item_background.set_size(sf::Vector2f(size.x, item_height));
item_background.set_position(item_pos);
- item_background.set_color(get_current_theme().shade_color);
+ item_background.set_color(get_theme().shade_color);
item_background.set_band(item_background_prev_pos - pos, item_background_prev_size);
- item_background.set_band_color(get_current_theme().selected_color);
+ item_background.set_band_color(get_theme().selected_color);
item_background.draw(window);
}
@@ -1403,12 +1403,12 @@ namespace QuickMedia {
// shapes dont have texture coordinates.
// TODO: Cache circle shape
sf::CircleShape circle_shape(content_size.x * 0.5f);
- circle_shape.setFillColor(get_current_theme().image_loading_background_color);
+ circle_shape.setFillColor(get_theme().image_loading_background_color);
circle_shape.setPosition(item_pos + sf::Vector2f(body_spacing[body_theme].image_padding_x, padding_y));
window.draw(circle_shape);
} else {
image_fallback.setSize(content_size);
- image_fallback.setFillColor(get_current_theme().image_loading_background_color);
+ image_fallback.setFillColor(get_theme().image_loading_background_color);
image_fallback.setPosition(item_pos + sf::Vector2f(body_spacing[body_theme].image_padding_x, padding_y));
window.draw(image_fallback);
}
@@ -1452,7 +1452,7 @@ namespace QuickMedia {
const float embedded_item_width = std::floor(size.x - text_offset_x - embedded_item_border_width - body_spacing[body_theme].padding_x);
float embedded_item_height = item->embedded_item ? get_item_height(item->embedded_item.get(), embedded_item_width, true, false) : ((body_spacing[body_theme].embedded_item_font_size + 5.0f) + body_spacing[body_theme].embedded_item_padding_y * 2.0f);
sf::RectangleShape border_left(sf::Vector2f(embedded_item_border_width, std::floor(embedded_item_height)));
- border_left.setFillColor(get_current_theme().embedded_item_border_color);
+ border_left.setFillColor(get_theme().embedded_item_border_color);
border_left.setPosition(std::floor(item_pos.x + text_offset_x), std::floor(item_pos.y + body_spacing[body_theme].embedded_item_padding_y + 2.0f));
window.draw(border_left);