From 0c73c7457409d23aa83907f1a0a2bf6386084f31 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 3 May 2020 22:30:51 +0200 Subject: [PATCH] Speed up initial load a bit --- src/RoomList.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/RoomList.cpp b/src/RoomList.cpp index 09250387..981b1f11 100644 --- a/src/RoomList.cpp +++ b/src/RoomList.cpp @@ -160,7 +160,12 @@ RoomList::initialize(const QMap &info) rooms_.clear(); + // prevent flickering and save time sorting over and over again setUpdatesEnabled(false); + disconnect(settings.data(), + &UserSettings::roomSortingChanged, + this, + &RoomList::sortRoomsByLastMessage); for (auto it = info.begin(); it != info.end(); it++) { if (it.value().is_invite) @@ -172,6 +177,10 @@ RoomList::initialize(const QMap &info) for (auto it = info.begin(); it != info.end(); it++) updateRoomDescription(it.key(), it.value().msgInfo); + connect(settings.data(), + &UserSettings::roomSortingChanged, + this, + &RoomList::sortRoomsByLastMessage); setUpdatesEnabled(true); if (rooms_.empty())