aboutsummaryrefslogtreecommitdiff
path: root/src/Body.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Body.cpp')
-rw-r--r--src/Body.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/Body.cpp b/src/Body.cpp
index 2134a44..260e90d 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -186,6 +186,14 @@ namespace QuickMedia {
//page_scroll = 0.0f;
}
+ int Body::get_index_by_body_item(BodyItem *body_item) {
+ for(int i = 0; i < (int)items.size(); ++i) {
+ if(items[i].get() == body_item)
+ return i;
+ }
+ return -1;
+ }
+
void Body::select_first_item() {
selected_item = 0;
prev_selected_item = selected_item;
@@ -225,6 +233,23 @@ namespace QuickMedia {
}
}
+ void Body::insert_item_by_timestamp(std::shared_ptr<BodyItem> body_item) {
+ for(size_t i = 0; i < items.size(); ++i) {
+ if(body_item->get_timestamp() < items[i]->get_timestamp()) {
+ items.insert(items.begin() + i, std::move(body_item));
+ return;
+ }
+ }
+ items.push_back(std::move(body_item));
+ }
+
+ // TODO: Optimize by resizing |items| before insert
+ void Body::insert_items_by_timestamps(BodyItems new_items) {
+ for(auto &new_item : new_items) {
+ insert_item_by_timestamp(std::move(new_item));
+ }
+ }
+
void Body::clear_thumbnails() {
item_thumbnail_textures.clear();
}