aboutsummaryrefslogtreecommitdiff
path: root/src/Body.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-05-19 23:45:27 +0200
committerdec05eba <dec05eba@protonmail.com>2021-05-20 01:16:46 +0200
commit8e79b2e10827f42d76ec61621f2c484f9cdc2551 (patch)
tree2f55f23bdebace14d4c56d15f72a40cbafd0ca3e /src/Body.cpp
parent6beaa000d590db342bc0198590686cbbd6304eb4 (diff)
Start on notifications
run matrix delegate on main (ui) thread instead of mutex hell
Diffstat (limited to 'src/Body.cpp')
-rw-r--r--src/Body.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Body.cpp b/src/Body.cpp
index 4f2e816..d51ea29 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -314,10 +314,12 @@ namespace QuickMedia {
void Body::prepend_items(BodyItems new_items) {
items.insert(items.begin(), std::make_move_iterator(new_items.begin()), std::make_move_iterator(new_items.end()));
+ items_set_dirty();
}
void Body::append_items(BodyItems new_items) {
items.insert(items.end(), std::make_move_iterator(new_items.begin()), std::make_move_iterator(new_items.end()));
+ items_set_dirty();
}
// TODO: Binary search and use hint to start search from start or end (for example when adding "previous" items or "next" items)
@@ -336,6 +338,7 @@ namespace QuickMedia {
for(auto &new_item : new_items) {
insert_item_by_timestamp(new_item);
}
+ items_set_dirty();
}
void Body::clear_cache() {
@@ -486,7 +489,8 @@ namespace QuickMedia {
void Body::draw(sf::RenderWindow &window, sf::Vector2f pos, sf::Vector2f size, const Json::Value &content_progress) {
if(items_dirty) {
items_dirty = false;
- filter_search_fuzzy(current_filter);
+ if(using_filter)
+ filter_search_fuzzy(current_filter, false);
}
sf::Vector2f scissor_pos = pos;
@@ -1490,7 +1494,7 @@ namespace QuickMedia {
return full_match;
}
- void Body::filter_search_fuzzy(const std::string &text) {
+ void Body::filter_search_fuzzy(const std::string &text, bool select_first_if_empty) {
current_filter = text;
if(text.empty()) {
@@ -1498,7 +1502,8 @@ namespace QuickMedia {
item->visible = true;
}
- select_first_item();
+ if(select_first_if_empty)
+ select_first_item();
return;
}
@@ -1507,6 +1512,7 @@ namespace QuickMedia {
}
select_first_item();
+ using_filter = true;
}
void Body::filter_search_fuzzy_item(const std::string &text, BodyItem *body_item) {