aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r--src/QuickMedia.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index f1f983e..ddeacab 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3278,11 +3278,14 @@ namespace QuickMedia {
}
BodyItem *selected_item = thread_body->get_selected();
- if(event.key.code == sf::Keyboard::Enter && selected_item && (comment_navigation_stack.empty() || thread_body->get_selected_item() != comment_navigation_stack.top()) && !selected_item->replies.empty()) {
+ if(event.key.code == sf::Keyboard::Enter && selected_item && (comment_navigation_stack.empty() || thread_body->get_selected_item() != comment_navigation_stack.top()) && (!selected_item->replies_to.empty() || !selected_item->replies.empty())) {
for(auto &body_item : thread_body->items) {
body_item->visible = false;
}
selected_item->visible = true;
+ for(size_t reply_to_index : selected_item->replies_to) {
+ thread_body->items[reply_to_index]->visible = true;
+ }
for(size_t reply_index : selected_item->replies) {
thread_body->items[reply_index]->visible = true;
}
@@ -3308,6 +3311,9 @@ namespace QuickMedia {
thread_body->set_selected_item(previous_selected);
selected_item = thread_body->items[comment_navigation_stack.top()].get();
selected_item->visible = true;
+ for(size_t reply_to_index : selected_item->replies_to) {
+ thread_body->items[reply_to_index]->visible = true;
+ }
for(size_t reply_index : selected_item->replies) {
thread_body->items[reply_index]->visible = true;
}
@@ -3493,10 +3499,9 @@ namespace QuickMedia {
// TODO: Show "Posting..." when posting comment
} else if(navigation_stage == NavigationStage::VIEWING_ATTACHED_IMAGE) {
// TODO: Use image instead of data with string. texture->loadFromMemory creates a temporary image anyways that parses the string.
- std::string image_data;
if(downloading_image && load_image_future.ready()) {
downloading_image = false;
- image_data = load_image_future.get();
+ std::string image_data = load_image_future.get();
sf::Image attached_image;
if(load_image_from_memory(attached_image, image_data.data(), image_data.size()) && attached_image_texture->loadFromImage(attached_image)) {
@@ -3512,7 +3517,6 @@ namespace QuickMedia {
}
}
- // TODO: Show a white image with the text "Downloading..." while the image is downloading and loading
if(attached_image_texture->getNativeHandle() != 0) {
auto content_size = window_size;
sf::Vector2u texture_size = attached_image_texture->getSize();
@@ -3527,12 +3531,16 @@ namespace QuickMedia {
window.draw(attached_image_sprite);
} else {
sf::RectangleShape rect(sf::Vector2f(640.0f, 480.0f));
- rect.setFillColor(sf::Color::White);
+ rect.setFillColor(sf::Color(52, 58, 70));
auto content_size = window_size;
auto rect_size = clamp_to_size(rect.getSize(), content_size);
rect.setSize(rect_size);
rect.setPosition(std::floor(content_size.x * 0.5f - rect_size.x * 0.5f), std::floor(content_size.y * 0.5f - rect_size.y * 0.5f));
window.draw(rect);
+
+ load_sprite.setPosition(window_size.x * 0.5f, window_size.y * 0.5f);
+ load_sprite.setRotation(load_sprite_timer.getElapsedTime().asSeconds() * 400.0);
+ window.draw(load_sprite);
}
} else if(navigation_stage == NavigationStage::REPLYING) {
window.draw(comment_input_shade);