summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-05-03 22:30:51 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2020-05-04 00:57:40 +0200
commit0c73c7457409d23aa83907f1a0a2bf6386084f31 (patch)
treee18246081a4fcd266c26eb08b1fa1a070857979f /src
parentMerge pull request #189 from Nheko-Reborn/db-migrations (diff)
downloadnheko-0c73c7457409d23aa83907f1a0a2bf6386084f31.tar.xz
Speed up initial load a bit
Diffstat (limited to 'src')
-rw-r--r--src/RoomList.cpp9
1 files changed, 9 insertions, 0 deletions
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<QString, RoomInfo> &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<QString, RoomInfo> &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())