aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/RoundedRectangle.hpp2
-rw-r--r--src/Body.cpp7
-rw-r--r--src/QuickMedia.cpp2
-rw-r--r--src/RoundedRectangle.cpp5
-rw-r--r--src/SearchBar.cpp1
-rw-r--r--src/Tabs.cpp1
6 files changed, 12 insertions, 6 deletions
diff --git a/include/RoundedRectangle.hpp b/include/RoundedRectangle.hpp
index 3bdb38f..3652b03 100644
--- a/include/RoundedRectangle.hpp
+++ b/include/RoundedRectangle.hpp
@@ -20,6 +20,8 @@ namespace QuickMedia {
void set_band(sf::Vector2f pos, sf::Vector2f size);
void set_band_color(sf::Color color);
void draw(sf::RenderTarget &target);
+
+ bool drop_shadow_enabled = true;
private:
float radius;
sf::Vector2f pos;
diff --git a/src/Body.cpp b/src/Body.cpp
index 76ad110..b3ec7e1 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -1486,13 +1486,14 @@ namespace QuickMedia {
}
float Body::get_item_height(BodyItem *item, float width, bool load_texture, bool include_embedded_item, bool merge_with_previous, int item_index) {
+ const bool rendering_card_view = card_view && card_view_enabled;
sf::Vector2i content_size = get_item_thumbnail_size(item);
float image_height = 0.0f;
float text_offset_x = body_spacing[body_theme].padding_x;
if(draw_thumbnails && load_texture && !item->thumbnail_url.empty() && !merge_with_previous) {
std::shared_ptr<ThumbnailData> item_thumbnail = AsyncImageLoader::get_instance().get_thumbnail(item->thumbnail_url, item->thumbnail_is_local, content_size);
- content_size = clamp_to_size_x(content_size, sf::Vector2i(width - body_spacing[body_theme].image_padding_x * 2.0f, content_size.y));
+ content_size = clamp_to_size_x(content_size, sf::Vector2i(width - (rendering_card_view ? 0.0f : body_spacing[body_theme].image_padding_x * 2.0f), content_size.y));
image_height = content_size.y;
if(item_thumbnail && item_thumbnail->loading_state == LoadingState::FINISHED_LOADING && item_thumbnail->image->getSize().x > 0 && item_thumbnail->image->getSize().y > 0) {
@@ -1526,7 +1527,7 @@ namespace QuickMedia {
// image_height = content_size.y;
}
- const float text_max_width = (card_view && card_view_enabled) ? width : (width - text_offset_x - body_spacing[body_theme].image_padding_x);
+ const float text_max_width = rendering_card_view ? width : (width - text_offset_x - body_spacing[body_theme].image_padding_x);
if(load_texture)
update_dirty_state(item, text_max_width);
@@ -1578,7 +1579,7 @@ namespace QuickMedia {
else
item_height = item->loaded_content_height;
- if(card_view && card_view_enabled) {
+ if(rendering_card_view) {
item_height += item->loaded_image_height;
} else {
const bool has_thumbnail = draw_thumbnails && !item->thumbnail_url.empty() && !merge_with_previous;
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index d1848ca..65a5387 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -2741,7 +2741,7 @@ namespace QuickMedia {
cursor_visible = true;
}
- VideoPlayer::Error update_err = video_player->update();
+ VideoPlayer::Error update_err = video_player ? video_player->update() : VideoPlayer::Error::OK;
if(update_err == VideoPlayer::Error::FAIL_TO_CONNECT_TIMEOUT) {
show_notification("QuickMedia", "Failed to connect to mpv ipc after 10 seconds", Urgency::CRITICAL);
current_page = previous_page;
diff --git a/src/RoundedRectangle.cpp b/src/RoundedRectangle.cpp
index 596d980..5baeac6 100644
--- a/src/RoundedRectangle.cpp
+++ b/src/RoundedRectangle.cpp
@@ -49,7 +49,7 @@ namespace QuickMedia {
vertices[2].position = pos + sf::Vector2f(size.x, size.y);
vertices[3].position = pos + sf::Vector2f(0.0f, size.y);
- const sf::Color shadow_color(0, 0, 0, 50);
+ const sf::Color shadow_color(0, 0, 0, 100);
const float shadow_radius = 5.0f;
// Top
@@ -107,7 +107,8 @@ namespace QuickMedia {
}
void RoundedRectangle::draw(sf::RenderTarget &target) {
- target.draw(drop_shadow_vertices, 16, sf::Quads);
+ if(drop_shadow_enabled)
+ target.draw(drop_shadow_vertices, 16, sf::Quads);
// TODO: Remove these for optimizations. Also do the same in other places where setUniform is called
rounded_rectangle_shader->setUniform("radius", radius);
diff --git a/src/SearchBar.cpp b/src/SearchBar.cpp
index 3fd2296..cb168a9 100644
--- a/src/SearchBar.cpp
+++ b/src/SearchBar.cpp
@@ -42,6 +42,7 @@ namespace QuickMedia {
pos(0.0f, 0.0f),
prev_size(0.0f, 0.0f)
{
+ //background.drop_shadow_enabled = false;
padding_top = padding_top_default;
padding_bottom = padding_bottom_default;
text.setFillColor(text_placeholder_color);
diff --git a/src/Tabs.cpp b/src/Tabs.cpp
index b943615..1224d81 100644
--- a/src/Tabs.cpp
+++ b/src/Tabs.cpp
@@ -26,6 +26,7 @@ namespace QuickMedia {
}
Tabs::Tabs(sf::Shader *rounded_rectangle_shader, sf::Color shade_color) : background(sf::Vector2f(1.0f, 1.0f), 10.0f, tab_selected_color, rounded_rectangle_shader), shade_color(shade_color) {
+ //background.drop_shadow_enabled = false;
shade.setFillColor(shade_color);
}