aboutsummaryrefslogtreecommitdiff
path: root/src/Body.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Body.cpp')
-rw-r--r--src/Body.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/Body.cpp b/src/Body.cpp
index ee32b08..20e7404 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -86,7 +86,7 @@ namespace QuickMedia {
progress_text("", *font, 14),
replies_text("", *font, 14),
embedded_item_load_text("", *font, 14),
- draw_thumbnails(false),
+ draw_thumbnails(true),
wrap_around(false),
line_separator_color(sf::Color(32, 37, 43, 255)),
body_item_render_callback(nullptr),
@@ -574,15 +574,15 @@ namespace QuickMedia {
}
// TODO: Better message? maybe fallback to the reply message, or message status (such as message redacted)
- static const char* embedded_item_status_to_string(EmbeddedItemStatus embedded_item_status) {
+ static const char* embedded_item_status_to_string(FetchStatus embedded_item_status) {
switch(embedded_item_status) {
- case EmbeddedItemStatus::NONE:
+ case FetchStatus::NONE:
return "";
- case EmbeddedItemStatus::LOADING:
+ case FetchStatus::LOADING:
return "Loading message...";
- case EmbeddedItemStatus::FINISHED_LOADING:
+ case FetchStatus::FINISHED_LOADING:
return "Finished loading message...";
- case EmbeddedItemStatus::FAILED_TO_LOAD:
+ case FetchStatus::FAILED_TO_LOAD:
return "Failed to load message!";
}
return "";
@@ -591,7 +591,7 @@ namespace QuickMedia {
void Body::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) {
// TODO: Instead of generating a new hash everytime to access textures, cache the hash of the thumbnail url
std::shared_ptr<ThumbnailData> item_thumbnail;
- if(draw_thumbnails) {
+ if(draw_thumbnails && !item->thumbnail_url.empty()) {
auto item_thumbnail_it = item_thumbnail_textures.find(item->thumbnail_url);
if(item_thumbnail_it == item_thumbnail_textures.end()) {
item_thumbnail = std::make_shared<ThumbnailData>();
@@ -620,7 +620,7 @@ namespace QuickMedia {
}
float text_offset_x = padding_x;
- if(draw_thumbnails) {
+ if(draw_thumbnails && !item->thumbnail_url.empty()) {
double elapsed_time_thumbnail = 0.0;
if(item_thumbnail->loading_state == LoadingState::APPLIED_TO_TEXTURE)
elapsed_time_thumbnail = item_thumbnail->texture_applied_time.getElapsedTime().asSeconds(); //thumbnail_fade_duration_sec
@@ -707,7 +707,7 @@ namespace QuickMedia {
item_pos.y += item->author_text->getHeight() - 2.0f;
}
- if(include_embedded_item && item->embedded_item_status != EmbeddedItemStatus::NONE) {
+ if(include_embedded_item && item->embedded_item_status != FetchStatus::NONE) {
float embedded_item_height = item->embedded_item ? get_item_height(item->embedded_item.get(), true, false) : (embedded_item_load_text.getLocalBounds().height + embedded_item_padding_y * 2.0f);
const float border_width = 4.0f;
sf::RectangleShape border_left(sf::Vector2f(border_width, std::floor(embedded_item_height)));
@@ -776,7 +776,7 @@ namespace QuickMedia {
if(item->author_text) {
item_height += item->author_text->getHeight() - 2.0f;
}
- if(include_embedded_item && item->embedded_item_status != EmbeddedItemStatus::NONE) {
+ if(include_embedded_item && item->embedded_item_status != FetchStatus::NONE) {
if(item->embedded_item)
item_height += (get_item_height(item->embedded_item.get(), load_texture, false) + 4.0f + embedded_item_padding_y * 2.0f);
else