aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/Matrix.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 32700a7..8abffa7 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -323,6 +323,7 @@ namespace QuickMedia {
}
static void sort_room_body_items(std::vector<std::shared_ptr<BodyItem>> &room_body_items) {
+ #if 0
std::sort(room_body_items.begin(), room_body_items.end(), [](const std::shared_ptr<BodyItem> &body_item1, const std::shared_ptr<BodyItem> &body_item2) {
RoomData *room1 = static_cast<RoomData*>(body_item1->userdata);
RoomData *room2 = static_cast<RoomData*>(body_item2->userdata);
@@ -330,6 +331,11 @@ namespace QuickMedia {
int room2_focus_sum = (int)(room2->unread_notification_count > 0) + (int)!room2->last_message_read;
return room1_focus_sum > room2_focus_sum;
});
+ #else
+ std::sort(room_body_items.begin(), room_body_items.end(), [](const std::shared_ptr<BodyItem> &body_item1, const std::shared_ptr<BodyItem> &body_item2) {
+ return body_item1->get_title() > body_item2->get_title();
+ });
+ #endif
}
void MatrixQuickMedia::update(MatrixPageType page_type) {
@@ -399,8 +405,8 @@ namespace QuickMedia {
room_body_item->set_title_color(sf::Color(255, 100, 100));
room->last_message_read = false;
- rooms_page->move_room_to_top(room);
- room_tags_page->move_room_to_top(room);
+ //rooms_page->move_room_to_top(room);
+ //room_tags_page->move_room_to_top(room);
} else if(is_initial_sync) {
Message *last_message = nullptr;
if(!messages.empty())
@@ -460,6 +466,7 @@ namespace QuickMedia {
void MatrixRoomsPage::on_navigate_to_page(Body *body) {
if(search_bar)
body->filter_search_fuzzy(search_bar->get_text());
+ sort_room_body_items(body->items);
}
void MatrixRoomsPage::update() {
@@ -489,13 +496,14 @@ namespace QuickMedia {
}
if(sort_on_update) {
sort_on_update = false;
- sort_room_body_items(body->items);
+ //sort_room_body_items(body->items);
}
matrix_delegate->update(MatrixPageType::ROOM_LIST);
if(filter_on_update) {
filter_on_update = false;
if(search_bar)
body->filter_search_fuzzy(search_bar->get_text());
+ sort_room_body_items(body->items);
}
}
@@ -557,7 +565,7 @@ namespace QuickMedia {
Body *body_ptr = body.get();
TagData &tag_data = tag_body_items_by_name[url];
body->items = tag_data.room_body_items;
- sort_room_body_items(body->items);
+ //sort_room_body_items(body->items);
auto search_bar = create_search_bar("Search...", SEARCH_DELAY_FILTER);
auto rooms_page = std::make_unique<MatrixRoomsPage>(program, body_ptr, tag_data.tag_item->get_title(), this, search_bar.get());
rooms_page->matrix_delegate = matrix_delegate;