From a5b388db15ae6fbe22497c458ce2af888e6f27df Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Sat, 14 Mar 2020 09:16:08 -0400 Subject: [PATCH] Appease the linter --- src/RoomInfoListItem.cpp | 6 ++---- src/RoomList.cpp | 18 +++++++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/RoomInfoListItem.cpp b/src/RoomInfoListItem.cpp index 1860881a..5b6840bf 100644 --- a/src/RoomInfoListItem.cpp +++ b/src/RoomInfoListItem.cpp @@ -332,10 +332,8 @@ RoomInfoListItem::calculateImportance() const // 2: Contains unread messages // 3: Contains mentions // 4: Is a room invite - return (hasUnreadMessages_) + - (unreadHighlightedMsgCount_ + unreadMsgCount_ != 0) + - (unreadHighlightedMsgCount_ != 0) + - (isInvite()) * 4; + return (hasUnreadMessages_) + (unreadHighlightedMsgCount_ + unreadMsgCount_ != 0) + + (unreadHighlightedMsgCount_ != 0) + (isInvite()) * 4; } void diff --git a/src/RoomList.cpp b/src/RoomList.cpp index fba910a7..74a7ff6f 100644 --- a/src/RoomList.cpp +++ b/src/RoomList.cpp @@ -331,8 +331,10 @@ RoomList::updateRoomDescription(const QString &roomid, const DescInfo &info) emit sortRoomsByLastMessage(); } -struct room_sort { - bool operator() (const RoomInfoListItem * a, const RoomInfoListItem * b) const { +struct room_sort +{ + bool operator()(const RoomInfoListItem *a, const RoomInfoListItem *b) const + { // Sort by "importance" (i.e. invites before mentions before // notifs before new events before old events), then secondly // by recency. @@ -340,16 +342,18 @@ struct room_sort { // Checking importance first const auto a_importance = a->calculateImportance(); const auto b_importance = b->calculateImportance(); - if(a_importance != b_importance) { + if (a_importance != b_importance) { return a_importance > b_importance; } // Now sort by recency // Zero if empty, otherwise the time that the event occured - const uint64_t a_recency = a->lastMessageInfo().userid.isEmpty() ? 0 : - a->lastMessageInfo().datetime.toMSecsSinceEpoch(); - const uint64_t b_recency = b->lastMessageInfo().userid.isEmpty() ? 0 : - b->lastMessageInfo().datetime.toMSecsSinceEpoch(); + const uint64_t a_recency = a->lastMessageInfo().userid.isEmpty() + ? 0 + : a->lastMessageInfo().datetime.toMSecsSinceEpoch(); + const uint64_t b_recency = b->lastMessageInfo().userid.isEmpty() + ? 0 + : b->lastMessageInfo().datetime.toMSecsSinceEpoch(); return a_recency > b_recency; } };