aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-08-18 20:37:48 +0200
committerdec05eba <dec05eba@protonmail.com>2021-08-18 20:37:48 +0200
commit24335ceccbf81e9a1bf49c1a2878c8ee31c63b69 (patch)
tree4ff1d0af2ace37f26b4a3ca36859cec2fde354c8
parentdf95eccc5e8ef62ad9c83a925adc83926491dfb3 (diff)
Show line at top/bottom when there are items above/below that are not visible
-rw-r--r--TODO4
-rw-r--r--include/Theme.hpp1
-rw-r--r--src/QuickMedia.cpp44
-rw-r--r--src/SearchBar.cpp2
-rw-r--r--src/Theme.cpp2
-rw-r--r--src/plugins/Matrix.cpp2
6 files changed, 50 insertions, 5 deletions
diff --git a/TODO b/TODO
index 003a7ea..0dbf3c8 100644
--- a/TODO
+++ b/TODO
@@ -201,4 +201,6 @@ Opening a media url should display it directly in quickmedia.
Automatically resize body item thumbnail if body is small, or move thumbnail above the text.
Support &nbsp?.
Add option to navigate studios/producers/author in AniList/MAL.
-Renable throttle detection after fixing it (it doesn't detect throttling well and it breaks for very long videos, such as 8 hour long videos). \ No newline at end of file
+Renable throttle detection after fixing it (it doesn't detect throttling well and it breaks for very long videos, such as 8 hour long videos).
+Show who deleted a message in matrix.
+Sync should replace all messages in the room (except for the selected room?) to reduce ram usage when in many rooms and when quickmedia has been running for a long time doing sync. \ No newline at end of file
diff --git a/include/Theme.hpp b/include/Theme.hpp
index 0e7b67d..3b49b4f 100644
--- a/include/Theme.hpp
+++ b/include/Theme.hpp
@@ -29,6 +29,7 @@ namespace QuickMedia {
sf::Color arrow_color;
sf::Color url_text_color;
sf::Color loading_page_color;
+ sf::Color more_items_color;
bool blur_enabled;
};
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 6be7dab..050ae01 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -59,6 +59,7 @@
static int FPS_IDLE;
static const double IDLE_TIMEOUT_SEC = 2.0;
static const sf::Vector2i AVATAR_THUMBNAIL_SIZE(std::floor(32), std::floor(32));
+static const float more_items_height = 2.0f;
static const std::pair<const char*, const char*> valid_plugins[] = {
std::make_pair("launcher", nullptr),
@@ -1988,6 +1989,12 @@ namespace QuickMedia {
}
}
+ sf::RectangleShape more_items_above_rect;
+ more_items_above_rect.setFillColor(get_current_theme().more_items_color);
+
+ sf::RectangleShape more_items_below_rect;
+ more_items_below_rect.setFillColor(get_current_theme().more_items_color);
+
sf::Event event;
sf::Clock frame_timer;
@@ -2093,6 +2100,12 @@ namespace QuickMedia {
gradient_points[3].position.x = 0.0f;
gradient_points[3].position.y = body_pos.y + gradient_height;
}
+
+ more_items_above_rect.setPosition(sf::Vector2f(0.0f, body_pos.y));
+ more_items_above_rect.setSize(sf::Vector2f(window_size.x, more_items_height));
+
+ more_items_below_rect.setPosition(sf::Vector2f(0.0f, window_size.y - more_items_height));
+ more_items_below_rect.setSize(sf::Vector2f(window_size.y, more_items_height));
}
if(tab_associated_data[selected_tab].fetching_next_page_running) {
@@ -2265,16 +2278,23 @@ namespace QuickMedia {
window.clear(get_current_theme().background_color);
page_loop_render(window, tabs, selected_tab, tab_associated_data[selected_tab], json_chapters, ui_tabs);
- AsyncImageLoader::get_instance().update();
- window.display();
if(tabs[selected_tab].body->get_num_items() > 0) {
if(tabs[selected_tab].body->attach_side == AttachSide::TOP && !tabs[selected_tab].body->is_bottom_cut_off())
on_reached_end();
else if(tabs[selected_tab].body->attach_side == AttachSide::BOTTOM && !tabs[selected_tab].body->is_top_cut_off())
on_reached_end();
+
+ if(tabs[selected_tab].body->is_top_cut_off())
+ window.draw(more_items_above_rect);
+
+ if(tabs[selected_tab].body->is_bottom_cut_off())
+ window.draw(more_items_below_rect);
}
+ AsyncImageLoader::get_instance().update();
+ window.display();
+
if(go_to_previous_page) {
go_to_previous_page = false;
return true;
@@ -3862,6 +3882,12 @@ namespace QuickMedia {
const float chat_input_padding_x = std::floor(10.0f * get_ui_scale());
const float chat_input_padding_y = std::floor(10.0f * get_ui_scale());
+ sf::RectangleShape more_items_above_rect;
+ more_items_above_rect.setFillColor(get_current_theme().more_items_color);
+
+ sf::RectangleShape more_items_below_rect;
+ more_items_below_rect.setFillColor(get_current_theme().more_items_color);
+
sf::Vector2f body_pos;
sf::Vector2f body_size;
sf::Event event;
@@ -4229,6 +4255,12 @@ namespace QuickMedia {
logo_sprite.setPosition(logo_padding_x, chat_input_padding_y);
file_to_upload_sprite.setPosition(logo_sprite.getPosition() + sf::Vector2f(0.0f, logo_size.y + logo_file_to_upload_spacing));
+
+ more_items_above_rect.setPosition(sf::Vector2f(0.0f, body_pos.y));
+ more_items_above_rect.setSize(sf::Vector2f(window_size.x, more_items_height));
+
+ more_items_below_rect.setPosition(sf::Vector2f(0.0f, window_size.y - more_items_height));
+ more_items_below_rect.setSize(sf::Vector2f(window_size.y, more_items_height));
}
//comment_input.update();
@@ -4367,6 +4399,14 @@ namespace QuickMedia {
}
}
+ if(navigation_stage == NavigationStage::REPLYING || navigation_stage == NavigationStage::VIEWING_COMMENTS) {
+ if(thread_body->is_top_cut_off())
+ window.draw(more_items_above_rect);
+
+ if(thread_body->is_bottom_cut_off())
+ window.draw(more_items_below_rect);
+ }
+
AsyncImageLoader::get_instance().update();
window.display();
}
diff --git a/src/SearchBar.cpp b/src/SearchBar.cpp
index c1f9ceb..31e54fb 100644
--- a/src/SearchBar.cpp
+++ b/src/SearchBar.cpp
@@ -268,7 +268,7 @@ namespace QuickMedia {
float SearchBar::getBottomWithoutShadow() const {
float font_height = text.getCharacterSize() + 7.0f;
- return std::floor(font_height + background_margin_vertical * 2.0f) + padding_top + padding_bottom;
+ return std::floor(font_height + background_margin_vertical * 2.0f + padding_top + padding_bottom);
}
std::string SearchBar::get_text() const {
diff --git a/src/Theme.cpp b/src/Theme.cpp
index 987ba3a..18581ff 100644
--- a/src/Theme.cpp
+++ b/src/Theme.cpp
@@ -38,6 +38,7 @@ namespace QuickMedia {
themes[THEME_DARK].arrow_color = sf::Color(255, 255, 255, 175);
themes[THEME_DARK].url_text_color = sf::Color(35, 140, 245);
themes[THEME_DARK].loading_page_color = sf::Color(175, 180, 188);
+ themes[THEME_DARK].more_items_color = sf::Color(150, 175, 255, 100);
themes[THEME_DARK].blur_enabled = false;
}
@@ -63,6 +64,7 @@ namespace QuickMedia {
themes[THEME_NORD].arrow_color = sf::Color(236, 239, 244);
themes[THEME_NORD].url_text_color = sf::Color(136, 192, 208);
themes[THEME_NORD].loading_page_color = sf::Color(229, 233, 240);
+ themes[THEME_NORD].more_items_color = sf::Color(150, 175, 255, 100);
themes[THEME_NORD].blur_enabled = false;
}
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 35442ed..c5c7921 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -4208,7 +4208,7 @@ namespace QuickMedia {
if(!avatar_url.empty())
room_body_item->thumbnail_url = std::move(avatar_url);
}
- room_body_item->thumbnail_size = sf::Vector2i(32 * get_ui_scale(), 32 * get_ui_scale());
+ room_body_item->thumbnail_size = {32, 32};
room_body_item->thumbnail_mask_type = ThumbnailMaskType::CIRCLE;
rooms.push_back(std::move(room_body_item));