From 08125e8c448b43201319242d1f5f4e96ab7c3911 Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Fri, 13 Mar 2020 19:30:50 -0400 Subject: [PATCH 01/15] Sort room list by room priority --- src/RoomInfoListItem.cpp | 9 +++++++++ src/RoomInfoListItem.h | 4 +++- src/RoomList.cpp | 36 +++++++++++++++++++++++++++--------- 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/src/RoomInfoListItem.cpp b/src/RoomInfoListItem.cpp index 61fb5e47..78718285 100644 --- a/src/RoomInfoListItem.cpp +++ b/src/RoomInfoListItem.cpp @@ -324,6 +324,15 @@ RoomInfoListItem::updateUnreadMessageCount(int count, int highlightedCount) update(); } +unsigned short int +RoomInfoListItem::calculateImportance() const +{ + return (hasUnreadMessages_) + + (unreadMsgCount_ != 0) + + (unreadHighlightedMsgCount_ != 0) + + (isInvite()) * 4; +} + void RoomInfoListItem::setPressedState(bool state) { diff --git a/src/RoomInfoListItem.h b/src/RoomInfoListItem.h index c1ee533d..a246e487 100644 --- a/src/RoomInfoListItem.h +++ b/src/RoomInfoListItem.h @@ -68,6 +68,8 @@ public: void updateUnreadMessageCount(int count, int highlightedCount); void clearUnreadMessageCount() { updateUnreadMessageCount(0, 0); }; + unsigned short int calculateImportance() const; + QString roomId() { return roomId_; } bool isPressed() const { return isPressed_; } int unreadMessageCount() const { return unreadMsgCount_; } @@ -128,7 +130,7 @@ public: roomType_ = RoomType::Joined; } - bool isInvite() { return roomType_ == RoomType::Invited; } + bool isInvite() const { return roomType_ == RoomType::Invited; } void setReadState(bool hasUnreadMessages) { if (hasUnreadMessages_ != hasUnreadMessages) { diff --git a/src/RoomList.cpp b/src/RoomList.cpp index 6feb4f76..977cac99 100644 --- a/src/RoomList.cpp +++ b/src/RoomList.cpp @@ -16,6 +16,7 @@ */ #include +#include #include #include @@ -328,30 +329,47 @@ RoomList::updateRoomDescription(const QString &roomid, const DescInfo &info) emit sortRoomsByLastMessage(); } +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. + + // Checking importance first + const auto a_importance = a->calculateImportance(); + const auto b_importance = b->calculateImportance(); + 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(); + return a_recency > b_recency; + } +}; + void RoomList::sortRoomsByLastMessage() { isSortPending_ = false; - std::multimap> times; + std::multiset times; for (int ii = 0; ii < contentsLayout_->count(); ++ii) { auto room = qobject_cast(contentsLayout_->itemAt(ii)->widget()); if (!room) continue; - - // Not a room message. - if (room->isInvite()) - times.emplace(std::numeric_limits::max(), room); - else if (room->lastMessageInfo().userid.isEmpty()) - times.emplace(0, room); else - times.emplace(room->lastMessageInfo().datetime.toMSecsSinceEpoch(), room); + times.insert(room); } for (auto it = times.cbegin(); it != times.cend(); ++it) { - const auto roomWidget = it->second; + const auto roomWidget = *it; const auto currentIndex = contentsLayout_->indexOf(roomWidget); const auto newIndex = std::distance(times.cbegin(), it); From b2a6232eb3470844434b234a23f547b3727fce87 Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Fri, 13 Mar 2020 20:40:52 -0400 Subject: [PATCH 02/15] Fixed channels appearing out of order when only mentions were present, without any non-mentions --- src/RoomInfoListItem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RoomInfoListItem.cpp b/src/RoomInfoListItem.cpp index 78718285..8e4ccbb9 100644 --- a/src/RoomInfoListItem.cpp +++ b/src/RoomInfoListItem.cpp @@ -328,7 +328,7 @@ unsigned short int RoomInfoListItem::calculateImportance() const { return (hasUnreadMessages_) + - (unreadMsgCount_ != 0) + + (unreadHighlightedMsgCount_ + unreadMsgCount_ != 0) + (unreadHighlightedMsgCount_ != 0) + (isInvite()) * 4; } From 0153dc7a390aa8c7f5dc33973e80ef6676b45f1e Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Fri, 13 Mar 2020 20:52:42 -0400 Subject: [PATCH 03/15] Automatically move rooms down in the list once they've been read --- src/RoomList.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/RoomList.cpp b/src/RoomList.cpp index 977cac99..fba910a7 100644 --- a/src/RoomList.cpp +++ b/src/RoomList.cpp @@ -123,6 +123,8 @@ RoomList::updateUnreadMessageCount(const QString &roomid, int count, int highlig rooms_[roomid]->updateUnreadMessageCount(count, highlightedCount); calculateUnreadMessageCount(); + + sortRoomsByLastMessage(); } void From 389117f1e865275f93c5a99524719fc18911e27e Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Fri, 13 Mar 2020 20:59:20 -0400 Subject: [PATCH 04/15] Add a comment explaining room importance --- src/RoomInfoListItem.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/RoomInfoListItem.cpp b/src/RoomInfoListItem.cpp index 8e4ccbb9..1860881a 100644 --- a/src/RoomInfoListItem.cpp +++ b/src/RoomInfoListItem.cpp @@ -327,6 +327,11 @@ RoomInfoListItem::updateUnreadMessageCount(int count, int highlightedCount) unsigned short int RoomInfoListItem::calculateImportance() const { + // 0: All messages and minor events read + // 1: Contains unread minor events (joins/notices/muted messages) + // 2: Contains unread messages + // 3: Contains mentions + // 4: Is a room invite return (hasUnreadMessages_) + (unreadHighlightedMsgCount_ + unreadMsgCount_ != 0) + (unreadHighlightedMsgCount_ != 0) + From a5b388db15ae6fbe22497c458ce2af888e6f27df Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Sat, 14 Mar 2020 09:16:08 -0400 Subject: [PATCH 05/15] 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; } }; From 81c9cb5c79294985856731775aeb8edcef1623b0 Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Sun, 15 Mar 2020 10:38:56 -0400 Subject: [PATCH 06/15] Switched room importance to an enum --- src/RoomInfoListItem.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/RoomInfoListItem.cpp b/src/RoomInfoListItem.cpp index 5b6840bf..26c4e8cf 100644 --- a/src/RoomInfoListItem.cpp +++ b/src/RoomInfoListItem.cpp @@ -324,6 +324,15 @@ RoomInfoListItem::updateUnreadMessageCount(int count, int highlightedCount) update(); } +enum NotificationImportance : unsigned short +{ + AllEventsRead = 0, + NewMinorEvents = 1, + NewMessage = 2, + NewMentions = 3, + Invite = 4 +}; + unsigned short int RoomInfoListItem::calculateImportance() const { @@ -332,8 +341,17 @@ RoomInfoListItem::calculateImportance() const // 2: Contains unread messages // 3: Contains mentions // 4: Is a room invite - return (hasUnreadMessages_) + (unreadHighlightedMsgCount_ + unreadMsgCount_ != 0) + - (unreadHighlightedMsgCount_ != 0) + (isInvite()) * 4; + if (isInvite()) { + return Invite; + } else if (unreadHighlightedMsgCount_) { + return NewMentions; + } else if (unreadMsgCount_) { + return NewMessage; + } else if (hasUnreadMessages_) { + return NewMinorEvents; + } else { + return AllEventsRead; + } } void From b6bd36ac16f3fbc3717385a3c2fe365535206159 Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Sun, 15 Mar 2020 11:19:22 -0400 Subject: [PATCH 07/15] Added toggle in the settings to ignore minor events --- src/ChatPage.cpp | 2 +- src/RoomInfoListItem.cpp | 17 ++++++++++------- src/RoomInfoListItem.h | 8 +++++++- src/RoomList.cpp | 8 +++++--- src/RoomList.h | 6 +++++- src/UserSettingsPage.cpp | 9 +++++++++ src/UserSettingsPage.h | 9 +++++++++ 7 files changed, 46 insertions(+), 13 deletions(-) diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp index 698a4ae2..7674f11c 100644 --- a/src/ChatPage.cpp +++ b/src/ChatPage.cpp @@ -100,7 +100,7 @@ ChatPage::ChatPage(QSharedPointer userSettings, QWidget *parent) user_info_widget_ = new UserInfoWidget(sideBar_); user_mentions_popup_ = new popups::UserMentions(); - room_list_ = new RoomList(sideBar_); + room_list_ = new RoomList(userSettings, sideBar_); connect(room_list_, &RoomList::joinRoom, this, &ChatPage::joinRoom); sideBarLayout_->addWidget(user_info_widget_); diff --git a/src/RoomInfoListItem.cpp b/src/RoomInfoListItem.cpp index 26c4e8cf..d7537d64 100644 --- a/src/RoomInfoListItem.cpp +++ b/src/RoomInfoListItem.cpp @@ -26,6 +26,7 @@ #include "Config.h" #include "RoomInfoListItem.h" #include "Splitter.h" +#include "UserSettingsPage.h" #include "Utils.h" #include "ui/Menu.h" #include "ui/Ripple.h" @@ -99,7 +100,10 @@ RoomInfoListItem::init(QWidget *parent) menu_->addAction(leaveRoom_); } -RoomInfoListItem::RoomInfoListItem(QString room_id, const RoomInfo &info, QWidget *parent) +RoomInfoListItem::RoomInfoListItem(QString room_id, + const RoomInfo &info, + QSharedPointer userSettings, + QWidget *parent) : QWidget(parent) , roomType_{info.is_invite ? RoomType::Invited : RoomType::Joined} , roomId_(std::move(room_id)) @@ -107,6 +111,7 @@ RoomInfoListItem::RoomInfoListItem(QString room_id, const RoomInfo &info, QWidge , isPressed_(false) , unreadMsgCount_(0) , unreadHighlightedMsgCount_(0) + , settings(userSettings) { init(parent); } @@ -336,18 +341,16 @@ enum NotificationImportance : unsigned short unsigned short int RoomInfoListItem::calculateImportance() const { - // 0: All messages and minor events read - // 1: Contains unread minor events (joins/notices/muted messages) - // 2: Contains unread messages - // 3: Contains mentions - // 4: Is a room invite + // Returns the degree of importance of the unread messages in the room. + // If ignoreMinorEvents is set to true in the settings, then + // NewMinorEvents will always be rounded down to AllEventsRead if (isInvite()) { return Invite; } else if (unreadHighlightedMsgCount_) { return NewMentions; } else if (unreadMsgCount_) { return NewMessage; - } else if (hasUnreadMessages_) { + } else if (hasUnreadMessages_ && !settings->isIgnoreMinorEventsEnabled()) { return NewMinorEvents; } else { return AllEventsRead; diff --git a/src/RoomInfoListItem.h b/src/RoomInfoListItem.h index a246e487..9361a20b 100644 --- a/src/RoomInfoListItem.h +++ b/src/RoomInfoListItem.h @@ -25,6 +25,7 @@ #include #include "CacheStructs.h" +#include "UserSettingsPage.h" #include "ui/Avatar.h" class Menu; @@ -63,7 +64,10 @@ class RoomInfoListItem : public QWidget Q_PROPERTY(QColor btnTextColor READ btnTextColor WRITE setBtnTextColor) public: - RoomInfoListItem(QString room_id, const RoomInfo &info, QWidget *parent = nullptr); + RoomInfoListItem(QString room_id, + const RoomInfo &info, + QSharedPointer userSettings, + QWidget *parent = nullptr); void updateUnreadMessageCount(int count, int highlightedCount); void clearUnreadMessageCount() { updateUnreadMessageCount(0, 0); }; @@ -216,4 +220,6 @@ private: QColor bubbleBgColor_; QColor bubbleFgColor_; + + QSharedPointer settings; }; diff --git a/src/RoomList.cpp b/src/RoomList.cpp index 74a7ff6f..a9ce957a 100644 --- a/src/RoomList.cpp +++ b/src/RoomList.cpp @@ -27,11 +27,13 @@ #include "MainWindow.h" #include "RoomInfoListItem.h" #include "RoomList.h" +#include "UserSettingsPage.h" #include "Utils.h" #include "ui/OverlayModal.h" -RoomList::RoomList(QWidget *parent) +RoomList::RoomList(QSharedPointer userSettings, QWidget *parent) : QWidget(parent) + , settings(userSettings) { topLayout_ = new QVBoxLayout(this); topLayout_->setSpacing(0); @@ -68,7 +70,7 @@ RoomList::RoomList(QWidget *parent) void RoomList::addRoom(const QString &room_id, const RoomInfo &info) { - auto room_item = new RoomInfoListItem(room_id, info, scrollArea_); + auto room_item = new RoomInfoListItem(room_id, info, settings, scrollArea_); room_item->setRoomName(QString::fromStdString(std::move(info.name))); connect(room_item, &RoomInfoListItem::clicked, this, &RoomList::highlightSelectedRoom); @@ -492,7 +494,7 @@ RoomList::updateRoom(const QString &room_id, const RoomInfo &info) void RoomList::addInvitedRoom(const QString &room_id, const RoomInfo &info) { - auto room_item = new RoomInfoListItem(room_id, info, scrollArea_); + auto room_item = new RoomInfoListItem(room_id, info, settings, scrollArea_); connect(room_item, &RoomInfoListItem::acceptInvite, this, &RoomList::acceptInvite); connect(room_item, &RoomInfoListItem::declineInvite, this, &RoomList::declineInvite); diff --git a/src/RoomList.h b/src/RoomList.h index fef552c6..a0151f92 100644 --- a/src/RoomList.h +++ b/src/RoomList.h @@ -23,6 +23,9 @@ #include #include +#include "CacheStructs.h" +#include "UserSettingsPage.h" + class LeaveRoomDialog; class OverlayModal; class RoomInfoListItem; @@ -35,7 +38,7 @@ class RoomList : public QWidget Q_OBJECT public: - explicit RoomList(QWidget *parent = nullptr); + explicit RoomList(QSharedPointer userSettings, QWidget *parent = nullptr); void initialize(const QMap &info); void sync(const std::map &info); @@ -100,4 +103,5 @@ private: QString selectedRoom_; bool isSortPending_ = false; + QSharedPointer settings; }; diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index 2cac783c..7bae01a0 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -57,6 +57,7 @@ UserSettings::load() isGroupViewEnabled_ = settings.value("user/group_view", true).toBool(); isMarkdownEnabled_ = settings.value("user/markdown_enabled", true).toBool(); isTypingNotificationsEnabled_ = settings.value("user/typing_notifications", true).toBool(); + ignoreMinorEvents_ = settings.value("user/minor_events", false).toBool(); isReadReceiptsEnabled_ = settings.value("user/read_receipts", true).toBool(); theme_ = settings.value("user/theme", defaultTheme_).toString(); font_ = settings.value("user/font_family", "default").toString(); @@ -130,6 +131,7 @@ UserSettings::save() settings.setValue("font_size", baseFontSize_); settings.setValue("typing_notifications", isTypingNotificationsEnabled_); + settings.setValue("minor_events", ignoreMinorEvents_); settings.setValue("read_receipts", isReadReceiptsEnabled_); settings.setValue("group_view", isGroupViewEnabled_); settings.setValue("markdown_enabled", isMarkdownEnabled_); @@ -191,6 +193,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer settings, QWidge avatarCircles_ = new Toggle{this}; groupViewToggle_ = new Toggle{this}; typingNotifications_ = new Toggle{this}; + ignoreMinorEvents_ = new Toggle{this}; readReceipts_ = new Toggle{this}; markdownEnabled_ = new Toggle{this}; desktopNotifications_ = new Toggle{this}; @@ -293,6 +296,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer settings, QWidge boxWrap(tr("Circular Avatars"), avatarCircles_); boxWrap(tr("Group's sidebar"), groupViewToggle_); boxWrap(tr("Typing notifications"), typingNotifications_); + boxWrap(tr("Ignore minor events in room list"), ignoreMinorEvents_); formLayout_->addRow(new HorizontalLine{this}); boxWrap(tr("Read receipts"), readReceipts_); boxWrap(tr("Send messages as Markdown"), markdownEnabled_); @@ -394,6 +398,10 @@ UserSettingsPage::UserSettingsPage(QSharedPointer settings, QWidge settings_->setTypingNotifications(!isDisabled); }); + connect(ignoreMinorEvents_, &Toggle::toggled, this, [this](bool isDisabled) { + settings_->setIgnoreMinorEvents(!isDisabled); + }); + connect(readReceipts_, &Toggle::toggled, this, [this](bool isDisabled) { settings_->setReadReceipts(!isDisabled); }); @@ -428,6 +436,7 @@ UserSettingsPage::showEvent(QShowEvent *) groupViewToggle_->setState(!settings_->isGroupViewEnabled()); avatarCircles_->setState(!settings_->isAvatarCirclesEnabled()); typingNotifications_->setState(!settings_->isTypingNotificationsEnabled()); + ignoreMinorEvents_->setState(!settings_->isIgnoreMinorEventsEnabled()); readReceipts_->setState(!settings_->isReadReceiptsEnabled()); markdownEnabled_->setState(!settings_->isMarkdownEnabled()); desktopNotifications_->setState(!settings_->hasDesktopNotifications()); diff --git a/src/UserSettingsPage.h b/src/UserSettingsPage.h index a1b7b084..e1c52277 100644 --- a/src/UserSettingsPage.h +++ b/src/UserSettingsPage.h @@ -87,6 +87,12 @@ public: save(); } + void setIgnoreMinorEvents(bool state) + { + ignoreMinorEvents_ = state; + save(); + } + void setDesktopNotifications(bool state) { hasDesktopNotifications_ = state; @@ -106,6 +112,7 @@ public: bool isAvatarCirclesEnabled() const { return avatarCircles_; } bool isMarkdownEnabled() const { return isMarkdownEnabled_; } bool isTypingNotificationsEnabled() const { return isTypingNotificationsEnabled_; } + bool isIgnoreMinorEventsEnabled() const { return ignoreMinorEvents_; } bool isReadReceiptsEnabled() const { return isReadReceiptsEnabled_; } bool hasDesktopNotifications() const { return hasDesktopNotifications_; } double fontSize() const { return baseFontSize_; } @@ -127,6 +134,7 @@ private: bool isGroupViewEnabled_; bool isMarkdownEnabled_; bool isTypingNotificationsEnabled_; + bool ignoreMinorEvents_; bool isReadReceiptsEnabled_; bool hasDesktopNotifications_; bool avatarCircles_; @@ -176,6 +184,7 @@ private: Toggle *startInTrayToggle_; Toggle *groupViewToggle_; Toggle *typingNotifications_; + Toggle *ignoreMinorEvents_; Toggle *readReceipts_; Toggle *markdownEnabled_; Toggle *desktopNotifications_; From 2320bfea260477da0c172c70173024a33aca7340 Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Sun, 15 Mar 2020 12:43:41 -0400 Subject: [PATCH 08/15] Foiled by the linter once more --- src/UserSettingsPage.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/UserSettingsPage.h b/src/UserSettingsPage.h index 9dbe643e..a1bc4ffc 100644 --- a/src/UserSettingsPage.h +++ b/src/UserSettingsPage.h @@ -87,10 +87,7 @@ public: save(); } - void setIgnoreMinorEvents(bool state) - { - ignoreMinorEvents_ = state; - } + void setIgnoreMinorEvents(bool state) { ignoreMinorEvents_ = state; } void setButtonsInTimeline(bool state) { From abac4c8d34db971382c4716dea735f1fd0755fa3 Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Sun, 15 Mar 2020 14:30:21 -0400 Subject: [PATCH 09/15] Sort room list on setting change --- src/RoomList.cpp | 4 ++++ src/UserSettingsPage.h | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/RoomList.cpp b/src/RoomList.cpp index a9ce957a..13a4fa67 100644 --- a/src/RoomList.cpp +++ b/src/RoomList.cpp @@ -65,6 +65,10 @@ RoomList::RoomList(QSharedPointer userSettings, QWidget *parent) topLayout_->addWidget(scrollArea_); connect(this, &RoomList::updateRoomAvatarCb, this, &RoomList::updateRoomAvatar); + connect(userSettings.get(), + &UserSettings::roomSortingChanged, + this, + &RoomList::sortRoomsByLastMessage); } void diff --git a/src/UserSettingsPage.h b/src/UserSettingsPage.h index a1bc4ffc..d47ceb83 100644 --- a/src/UserSettingsPage.h +++ b/src/UserSettingsPage.h @@ -87,7 +87,11 @@ public: save(); } - void setIgnoreMinorEvents(bool state) { ignoreMinorEvents_ = state; } + void setIgnoreMinorEvents(bool state) + { + ignoreMinorEvents_ = state; + emit roomSortingChanged(); + } void setButtonsInTimeline(bool state) { @@ -124,6 +128,7 @@ public: signals: void groupViewStateChanged(bool state); + void roomSortingChanged(); private: // Default to system theme if QT_QPA_PLATFORMTHEME var is set. From bf5ae884de25ee8cd31039de8f9d2d129f64ec66 Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Sun, 15 Mar 2020 14:56:39 -0400 Subject: [PATCH 10/15] Make toggle in settings revert between old behavior and new behavior for sorting by unreads --- src/RoomInfoListItem.cpp | 25 ++++++++++++++----------- src/UserSettingsPage.cpp | 14 +++++++------- src/UserSettingsPage.h | 10 +++++----- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/src/RoomInfoListItem.cpp b/src/RoomInfoListItem.cpp index d7537d64..bac7ce51 100644 --- a/src/RoomInfoListItem.cpp +++ b/src/RoomInfoListItem.cpp @@ -329,29 +329,32 @@ RoomInfoListItem::updateUnreadMessageCount(int count, int highlightedCount) update(); } -enum NotificationImportance : unsigned short +enum NotificationImportance : short { - AllEventsRead = 0, - NewMinorEvents = 1, - NewMessage = 2, - NewMentions = 3, - Invite = 4 + ImportanceDisabled = -1, + AllEventsRead = 0, + NewMinorEvents = 1, // This is currently unused + NewMessage = 2, + NewMentions = 3, + Invite = 4 }; unsigned short int RoomInfoListItem::calculateImportance() const { // Returns the degree of importance of the unread messages in the room. - // If ignoreMinorEvents is set to true in the settings, then - // NewMinorEvents will always be rounded down to AllEventsRead - if (isInvite()) { + // If sorting by importance is disabled in settings, this only ever + // returns ImportanceDisabled + if (!settings->isSortByImportanceEnabled()) { + return ImportanceDisabled; + } else if (isInvite()) { return Invite; } else if (unreadHighlightedMsgCount_) { return NewMentions; } else if (unreadMsgCount_) { return NewMessage; - } else if (hasUnreadMessages_ && !settings->isIgnoreMinorEventsEnabled()) { - return NewMinorEvents; + // } else if (hasUnreadMessages_ && !settings->isIgnoreMinorEventsEnabled()) { + // return NewMinorEvents; } else { return AllEventsRead; } diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index 6a7c5b35..6cd9a95c 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -58,7 +58,7 @@ UserSettings::load() isButtonsInTimelineEnabled_ = settings.value("user/timeline/buttons", true).toBool(); isMarkdownEnabled_ = settings.value("user/markdown_enabled", true).toBool(); isTypingNotificationsEnabled_ = settings.value("user/typing_notifications", true).toBool(); - ignoreMinorEvents_ = settings.value("user/minor_events", false).toBool(); + sortByImportance_ = settings.value("user/sort_by_unread", true).toBool(); isReadReceiptsEnabled_ = settings.value("user/read_receipts", true).toBool(); theme_ = settings.value("user/theme", defaultTheme_).toString(); font_ = settings.value("user/font_family", "default").toString(); @@ -136,7 +136,7 @@ UserSettings::save() settings.setValue("font_size", baseFontSize_); settings.setValue("typing_notifications", isTypingNotificationsEnabled_); - settings.setValue("minor_events", ignoreMinorEvents_); + settings.setValue("minor_events", sortByImportance_); settings.setValue("read_receipts", isReadReceiptsEnabled_); settings.setValue("group_view", isGroupViewEnabled_); settings.setValue("markdown_enabled", isMarkdownEnabled_); @@ -199,7 +199,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer settings, QWidge groupViewToggle_ = new Toggle{this}; timelineButtonsToggle_ = new Toggle{this}; typingNotifications_ = new Toggle{this}; - ignoreMinorEvents_ = new Toggle{this}; + sortByImportance_ = new Toggle{this}; readReceipts_ = new Toggle{this}; markdownEnabled_ = new Toggle{this}; desktopNotifications_ = new Toggle{this}; @@ -303,7 +303,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer settings, QWidge boxWrap(tr("Group's sidebar"), groupViewToggle_); boxWrap(tr("Show buttons in timeline"), timelineButtonsToggle_); boxWrap(tr("Typing notifications"), typingNotifications_); - boxWrap(tr("Ignore minor events in room list"), ignoreMinorEvents_); + boxWrap(tr("Sort rooms by unreads"), sortByImportance_); formLayout_->addRow(new HorizontalLine{this}); boxWrap(tr("Read receipts"), readReceipts_); boxWrap(tr("Send messages as Markdown"), markdownEnabled_); @@ -405,8 +405,8 @@ UserSettingsPage::UserSettingsPage(QSharedPointer settings, QWidge settings_->setTypingNotifications(!isDisabled); }); - connect(ignoreMinorEvents_, &Toggle::toggled, this, [this](bool isDisabled) { - settings_->setIgnoreMinorEvents(!isDisabled); + connect(sortByImportance_, &Toggle::toggled, this, [this](bool isDisabled) { + settings_->setSortByImportance(!isDisabled); }); connect(timelineButtonsToggle_, &Toggle::toggled, this, [this](bool isDisabled) { @@ -447,7 +447,7 @@ UserSettingsPage::showEvent(QShowEvent *) groupViewToggle_->setState(!settings_->isGroupViewEnabled()); avatarCircles_->setState(!settings_->isAvatarCirclesEnabled()); typingNotifications_->setState(!settings_->isTypingNotificationsEnabled()); - ignoreMinorEvents_->setState(!settings_->isIgnoreMinorEventsEnabled()); + sortByImportance_->setState(!settings_->isSortByImportanceEnabled()); timelineButtonsToggle_->setState(!settings_->isButtonsInTimelineEnabled()); readReceipts_->setState(!settings_->isReadReceiptsEnabled()); markdownEnabled_->setState(!settings_->isMarkdownEnabled()); diff --git a/src/UserSettingsPage.h b/src/UserSettingsPage.h index d47ceb83..1c20214e 100644 --- a/src/UserSettingsPage.h +++ b/src/UserSettingsPage.h @@ -87,9 +87,9 @@ public: save(); } - void setIgnoreMinorEvents(bool state) + void setSortByImportance(bool state) { - ignoreMinorEvents_ = state; + sortByImportance_ = state; emit roomSortingChanged(); } @@ -118,7 +118,7 @@ public: bool isAvatarCirclesEnabled() const { return avatarCircles_; } bool isMarkdownEnabled() const { return isMarkdownEnabled_; } bool isTypingNotificationsEnabled() const { return isTypingNotificationsEnabled_; } - bool isIgnoreMinorEventsEnabled() const { return ignoreMinorEvents_; } + bool isSortByImportanceEnabled() const { return sortByImportance_; } bool isButtonsInTimelineEnabled() const { return isButtonsInTimelineEnabled_; } bool isReadReceiptsEnabled() const { return isReadReceiptsEnabled_; } bool hasDesktopNotifications() const { return hasDesktopNotifications_; } @@ -142,7 +142,7 @@ private: bool isGroupViewEnabled_; bool isMarkdownEnabled_; bool isTypingNotificationsEnabled_; - bool ignoreMinorEvents_; + bool sortByImportance_; bool isButtonsInTimelineEnabled_; bool isReadReceiptsEnabled_; bool hasDesktopNotifications_; @@ -194,7 +194,7 @@ private: Toggle *groupViewToggle_; Toggle *timelineButtonsToggle_; Toggle *typingNotifications_; - Toggle *ignoreMinorEvents_; + Toggle *sortByImportance_; Toggle *readReceipts_; Toggle *markdownEnabled_; Toggle *desktopNotifications_; From 12aa94ad9afdeedbf05c785b234c2605c282f0d1 Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Sun, 15 Mar 2020 15:27:30 -0400 Subject: [PATCH 11/15] Fixed compatibility with Qt < 5.11 --- src/RoomList.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RoomList.cpp b/src/RoomList.cpp index 13a4fa67..1c7c340d 100644 --- a/src/RoomList.cpp +++ b/src/RoomList.cpp @@ -65,7 +65,7 @@ RoomList::RoomList(QSharedPointer userSettings, QWidget *parent) topLayout_->addWidget(scrollArea_); connect(this, &RoomList::updateRoomAvatarCb, this, &RoomList::updateRoomAvatar); - connect(userSettings.get(), + connect(userSettings.data(), &UserSettings::roomSortingChanged, this, &RoomList::sortRoomsByLastMessage); From 78ac9025495e8500f831bc492c4c3ac997c88421 Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Sun, 15 Mar 2020 16:19:45 -0400 Subject: [PATCH 12/15] Clean up stray comment --- src/RoomInfoListItem.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/RoomInfoListItem.cpp b/src/RoomInfoListItem.cpp index bac7ce51..eaec34fc 100644 --- a/src/RoomInfoListItem.cpp +++ b/src/RoomInfoListItem.cpp @@ -353,8 +353,6 @@ RoomInfoListItem::calculateImportance() const return NewMentions; } else if (unreadMsgCount_) { return NewMessage; - // } else if (hasUnreadMessages_ && !settings->isIgnoreMinorEventsEnabled()) { - // return NewMinorEvents; } else { return AllEventsRead; } From d51cbe7e32f4ad332baa2a0172867d051ec1a901 Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Sun, 15 Mar 2020 16:28:32 -0400 Subject: [PATCH 13/15] Place invites on top of room list even when sorting by importance is off --- src/RoomInfoListItem.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/RoomInfoListItem.cpp b/src/RoomInfoListItem.cpp index eaec34fc..fa63a36b 100644 --- a/src/RoomInfoListItem.cpp +++ b/src/RoomInfoListItem.cpp @@ -333,10 +333,9 @@ enum NotificationImportance : short { ImportanceDisabled = -1, AllEventsRead = 0, - NewMinorEvents = 1, // This is currently unused - NewMessage = 2, - NewMentions = 3, - Invite = 4 + NewMessage = 1, + NewMentions = 2, + Invite = 3 }; unsigned short int @@ -344,11 +343,11 @@ RoomInfoListItem::calculateImportance() const { // Returns the degree of importance of the unread messages in the room. // If sorting by importance is disabled in settings, this only ever - // returns ImportanceDisabled - if (!settings->isSortByImportanceEnabled()) { - return ImportanceDisabled; - } else if (isInvite()) { + // returns ImportanceDisabled or Invite + if (isInvite()) { return Invite; + } else if (!settings->isSortByImportanceEnabled()) { + return ImportanceDisabled; } else if (unreadHighlightedMsgCount_) { return NewMentions; } else if (unreadMsgCount_) { From 06676cfb338b7094f9fcef275a21b90f8db4087c Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Sun, 15 Mar 2020 16:29:08 -0400 Subject: [PATCH 14/15] Updated translations --- resources/langs/nheko_de.ts | 37 +++++++++++++++++++--------------- resources/langs/nheko_el.ts | 37 +++++++++++++++++++--------------- resources/langs/nheko_en.ts | 37 +++++++++++++++++++--------------- resources/langs/nheko_fi.ts | 37 +++++++++++++++++++--------------- resources/langs/nheko_fr.ts | 37 +++++++++++++++++++--------------- resources/langs/nheko_ja.ts | 37 +++++++++++++++++++--------------- resources/langs/nheko_nl.ts | 37 +++++++++++++++++++--------------- resources/langs/nheko_pl.ts | 37 +++++++++++++++++++--------------- resources/langs/nheko_ru.ts | 37 +++++++++++++++++++--------------- resources/langs/nheko_zh_CN.ts | 37 +++++++++++++++++++--------------- 10 files changed, 210 insertions(+), 160 deletions(-) diff --git a/resources/langs/nheko_de.ts b/resources/langs/nheko_de.ts index cfc58189..ce42242e 100644 --- a/resources/langs/nheko_de.ts +++ b/resources/langs/nheko_de.ts @@ -371,12 +371,12 @@ RoomInfoListItem - + Leave room Raum verlassen - + Accept Akzeptieren @@ -491,7 +491,13 @@ -- Entschlüsselungsfehler (Fehler bei Suche nach megolm Schlüsseln in Datenbank) -- - + + -- Decryption Error (%1) -- + Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1. + -- Entschlüsselungsfehler (%1) -- + + + Message redaction failed: %1 Nachricht zurückziehen fehlgeschlagen: %1 @@ -522,13 +528,7 @@ -- Verschlüsseltes Event (keine Schlüssel zur Entschlüsselung gefunden) -- - - -- Decryption Error (%1) -- - Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed as %1. - -- Entschlüsselungsfehler (%1) -- - - - + -- Encrypted Event (Unknown event type) -- Placeholder, when the message was decrypted, but we couldn't parse it, because Nheko/mtxclient don't support that event type yet. -- Verschlüsseltes Event (Unbekannter Eventtyp) -- @@ -782,7 +782,7 @@ UserSettingsPage - + Minimize to tray Ins Benachrichtigungsfeld minimieren @@ -811,6 +811,11 @@ Typing notifications Schreibbenachrichtigungen + + + Sort rooms by unreads + + Read receipts @@ -857,7 +862,7 @@ Gerätefingerabdruck - + Session Keys Sitzungsschlüssel @@ -877,22 +882,22 @@ VERSCHLÜSSELUNG - + GENERAL ALLGEMEINES - + INTERFACE - + Emoji Font Family - + Open Sessions File Öffne Sessions Datei diff --git a/resources/langs/nheko_el.ts b/resources/langs/nheko_el.ts index 0d374cf5..36297298 100644 --- a/resources/langs/nheko_el.ts +++ b/resources/langs/nheko_el.ts @@ -371,12 +371,12 @@ RoomInfoListItem - + Leave room Βγές - + Accept Αποδοχή @@ -491,7 +491,13 @@ - + + -- Decryption Error (%1) -- + Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1. + + + + Message redaction failed: %1 @@ -522,13 +528,7 @@ - - -- Decryption Error (%1) -- - Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed as %1. - - - - + -- Encrypted Event (Unknown event type) -- Placeholder, when the message was decrypted, but we couldn't parse it, because Nheko/mtxclient don't support that event type yet. @@ -782,7 +782,7 @@ UserSettingsPage - + Minimize to tray Ελαχιστοποίηση @@ -811,6 +811,11 @@ Typing notifications + + + Sort rooms by unreads + + Read receipts @@ -857,7 +862,7 @@ - + Session Keys @@ -877,22 +882,22 @@ - + GENERAL ΓΕΝΙΚΑ - + INTERFACE - + Emoji Font Family - + Open Sessions File diff --git a/resources/langs/nheko_en.ts b/resources/langs/nheko_en.ts index c97a4ac2..a712d979 100644 --- a/resources/langs/nheko_en.ts +++ b/resources/langs/nheko_en.ts @@ -371,12 +371,12 @@ RoomInfoListItem - + Leave room Leave room - + Accept Accept @@ -491,7 +491,13 @@ -- Decryption Error (failed to retrieve megolm keys from db) -- - + + -- Decryption Error (%1) -- + Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1. + -- Decryption Error (%1) -- + + + Message redaction failed: %1 Message redaction failed: %1 @@ -522,13 +528,7 @@ -- Encrypted Event (No keys found for decryption) -- - - -- Decryption Error (%1) -- - Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed as %1. - -- Decryption Error (%1) -- - - - + -- Encrypted Event (Unknown event type) -- Placeholder, when the message was decrypted, but we couldn't parse it, because Nheko/mtxclient don't support that event type yet. -- Encrypted Event (Unknown event type) -- @@ -782,7 +782,7 @@ UserSettingsPage - + Minimize to tray Minimize to tray @@ -811,6 +811,11 @@ Typing notifications Typing notifications + + + Sort rooms by unreads + + Read receipts @@ -857,7 +862,7 @@ Device Fingerprint - + Session Keys Session Keys @@ -877,22 +882,22 @@ ENCRYPTION - + GENERAL GENERAL - + INTERFACE - + Emoji Font Family - + Open Sessions File Open Sessions File diff --git a/resources/langs/nheko_fi.ts b/resources/langs/nheko_fi.ts index 8659d560..08137a43 100644 --- a/resources/langs/nheko_fi.ts +++ b/resources/langs/nheko_fi.ts @@ -371,12 +371,12 @@ RoomInfoListItem - + Leave room Poistu huoneesta - + Accept Hyväksy @@ -491,7 +491,13 @@ -- Virhe purkaessa salausta (megolm-avaimien hakeminen tietokannasta epäonnistui) -- - + + -- Decryption Error (%1) -- + Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1. + -- Virhe purkaessa salausta (%1) -- + + + Message redaction failed: %1 Viestin poisto epäonnistui: %1 @@ -522,13 +528,7 @@ -- Salattu viesti (salauksen purkuavaimia ei löydetty) -- - - -- Decryption Error (%1) -- - Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed as %1. - -- Virhe purkaessa salausta (%1) -- - - - + -- Encrypted Event (Unknown event type) -- Placeholder, when the message was decrypted, but we couldn't parse it, because Nheko/mtxclient don't support that event type yet. -- Salattu viesti (tuntematon viestityyppi) -- @@ -782,7 +782,7 @@ UserSettingsPage - + Minimize to tray Pienennä ilmoitusalueelle @@ -811,6 +811,11 @@ Typing notifications Kirjoitusilmoitukset + + + Sort rooms by unreads + + Read receipts @@ -857,7 +862,7 @@ Laitteen sormenjälki - + Session Keys Istunnon avaimet @@ -877,22 +882,22 @@ SALAUS - + GENERAL YLEISET ASETUKSET - + INTERFACE - + Emoji Font Family - + Open Sessions File Avaa Istuntoavaintiedosto diff --git a/resources/langs/nheko_fr.ts b/resources/langs/nheko_fr.ts index 6efe8252..eb835410 100644 --- a/resources/langs/nheko_fr.ts +++ b/resources/langs/nheko_fr.ts @@ -372,12 +372,12 @@ RoomInfoListItem - + Leave room Quitter le salon - + Accept Accepter @@ -492,7 +492,13 @@ - + + -- Decryption Error (%1) -- + Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1. + + + + Message redaction failed: %1 @@ -523,13 +529,7 @@ - - -- Decryption Error (%1) -- - Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed as %1. - - - - + -- Encrypted Event (Unknown event type) -- Placeholder, when the message was decrypted, but we couldn't parse it, because Nheko/mtxclient don't support that event type yet. @@ -783,7 +783,7 @@ UserSettingsPage - + Minimize to tray Réduire à la barre des tâches @@ -812,6 +812,11 @@ Typing notifications Notifications d'écriture + + + Sort rooms by unreads + + Read receipts @@ -858,7 +863,7 @@ - + Session Keys @@ -878,22 +883,22 @@ - + GENERAL GÉNÉRAL - + INTERFACE - + Emoji Font Family - + Open Sessions File diff --git a/resources/langs/nheko_ja.ts b/resources/langs/nheko_ja.ts index 05528a42..bdde216d 100644 --- a/resources/langs/nheko_ja.ts +++ b/resources/langs/nheko_ja.ts @@ -371,12 +371,12 @@ RoomInfoListItem - + Leave room 部屋を出る - + Accept 容認 @@ -491,7 +491,13 @@ -- 復号エラー (データベースからmegolm鍵を取得できませんでした) -- - + + -- Decryption Error (%1) -- + Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1. + -- 復号エラー (%1) -- + + + Message redaction failed: %1 メッセージを編集できませんでした: %1 @@ -522,13 +528,7 @@ -- 暗号化イベント (復号鍵が見つかりません) -- - - -- Decryption Error (%1) -- - Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed as %1. - -- 復号エラー (%1) -- - - - + -- Encrypted Event (Unknown event type) -- Placeholder, when the message was decrypted, but we couldn't parse it, because Nheko/mtxclient don't support that event type yet. -- 暗号化イベント (不明なイベント型です) -- @@ -781,7 +781,7 @@ UserSettingsPage - + Minimize to tray トレイへ最小化 @@ -810,6 +810,11 @@ Typing notifications 入力状態の通知 + + + Sort rooms by unreads + + Read receipts @@ -856,7 +861,7 @@ デバイスの指紋 - + Session Keys セッション鍵 @@ -876,22 +881,22 @@ 暗号化 - + GENERAL 全般 - + INTERFACE - + Emoji Font Family - + Open Sessions File セッションファイルを開く diff --git a/resources/langs/nheko_nl.ts b/resources/langs/nheko_nl.ts index 79e82714..906b2819 100644 --- a/resources/langs/nheko_nl.ts +++ b/resources/langs/nheko_nl.ts @@ -371,12 +371,12 @@ RoomInfoListItem - + Leave room Kamer verlaten - + Accept Accepteren @@ -491,7 +491,13 @@ - + + -- Decryption Error (%1) -- + Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1. + + + + Message redaction failed: %1 @@ -522,13 +528,7 @@ - - -- Decryption Error (%1) -- - Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed as %1. - - - - + -- Encrypted Event (Unknown event type) -- Placeholder, when the message was decrypted, but we couldn't parse it, because Nheko/mtxclient don't support that event type yet. @@ -782,7 +782,7 @@ UserSettingsPage - + Minimize to tray Minimaliseren naar systeemvak @@ -811,6 +811,11 @@ Typing notifications Meldingen bij typen van berichten + + + Sort rooms by unreads + + Read receipts @@ -857,7 +862,7 @@ - + Session Keys @@ -877,22 +882,22 @@ - + GENERAL ALGEMEEN - + INTERFACE - + Emoji Font Family - + Open Sessions File diff --git a/resources/langs/nheko_pl.ts b/resources/langs/nheko_pl.ts index 774868db..44dbb0e1 100644 --- a/resources/langs/nheko_pl.ts +++ b/resources/langs/nheko_pl.ts @@ -371,12 +371,12 @@ RoomInfoListItem - + Leave room Opuść pokój - + Accept Akceptuj @@ -491,7 +491,13 @@ - + + -- Decryption Error (%1) -- + Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1. + + + + Message redaction failed: %1 Redagowanie wiadomości nie powiodło się: %1 @@ -522,13 +528,7 @@ - - -- Decryption Error (%1) -- - Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed as %1. - - - - + -- Encrypted Event (Unknown event type) -- Placeholder, when the message was decrypted, but we couldn't parse it, because Nheko/mtxclient don't support that event type yet. @@ -783,7 +783,7 @@ UserSettingsPage - + Minimize to tray Zminimalizuj do paska zadań @@ -812,6 +812,11 @@ Typing notifications Powiadomienia o pisaniu + + + Sort rooms by unreads + + Read receipts @@ -858,7 +863,7 @@ Odcisk palca urządzenia - + Session Keys @@ -878,22 +883,22 @@ SZYFROWANIE - + GENERAL OGÓLNE - + INTERFACE - + Emoji Font Family - + Open Sessions File diff --git a/resources/langs/nheko_ru.ts b/resources/langs/nheko_ru.ts index 0dce43f5..5753cc6f 100644 --- a/resources/langs/nheko_ru.ts +++ b/resources/langs/nheko_ru.ts @@ -371,12 +371,12 @@ RoomInfoListItem - + Leave room Покинуть комнату - + Accept Принять @@ -491,7 +491,13 @@ - + + -- Decryption Error (%1) -- + Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1. + + + + Message redaction failed: %1 Ошибка редактирования сообщения: %1 @@ -522,13 +528,7 @@ - - -- Decryption Error (%1) -- - Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed as %1. - - - - + -- Encrypted Event (Unknown event type) -- Placeholder, when the message was decrypted, but we couldn't parse it, because Nheko/mtxclient don't support that event type yet. @@ -783,7 +783,7 @@ UserSettingsPage - + Minimize to tray Сворачивать в системную панель @@ -812,6 +812,11 @@ Typing notifications Сообщать о наборе сообщения + + + Sort rooms by unreads + + Read receipts @@ -858,7 +863,7 @@ Отпечаток устройства - + Session Keys Ключи сеанса @@ -878,22 +883,22 @@ ШИФРОВАНИЕ - + GENERAL ГЛАВНОЕ - + INTERFACE - + Emoji Font Family - + Open Sessions File Открыть файл сеансов diff --git a/resources/langs/nheko_zh_CN.ts b/resources/langs/nheko_zh_CN.ts index 8bd4c750..cd826123 100644 --- a/resources/langs/nheko_zh_CN.ts +++ b/resources/langs/nheko_zh_CN.ts @@ -371,12 +371,12 @@ RoomInfoListItem - + Leave room 离开聊天室 - + Accept 接受 @@ -491,7 +491,13 @@ - + + -- Decryption Error (%1) -- + Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed ad %1. + + + + Message redaction failed: %1 删除消息失败:%1 @@ -522,13 +528,7 @@ - - -- Decryption Error (%1) -- - Placeholder, when the message can't be decrypted. In this case, the Olm decrytion returned an error, which is passed as %1. - - - - + -- Encrypted Event (Unknown event type) -- Placeholder, when the message was decrypted, but we couldn't parse it, because Nheko/mtxclient don't support that event type yet. @@ -781,7 +781,7 @@ UserSettingsPage - + Minimize to tray 最小化至托盘 @@ -810,6 +810,11 @@ Typing notifications 打字通知 + + + Sort rooms by unreads + + Read receipts @@ -856,7 +861,7 @@ 设备指纹 - + Session Keys 会话密钥 @@ -876,22 +881,22 @@ 加密 - + GENERAL 通用 - + INTERFACE - + Emoji Font Family - + Open Sessions File 打开会话文件 From 5c308b1caffc57d28d3a1ae5a61cfe3c50527358 Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Sun, 15 Mar 2020 17:05:21 -0400 Subject: [PATCH 15/15] Fixed bug caused by me forgetting what types im using (invites appearing at the bottom of the list instead of the top when priority sorting was off) --- src/RoomInfoListItem.cpp | 2 +- src/RoomInfoListItem.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/RoomInfoListItem.cpp b/src/RoomInfoListItem.cpp index fa63a36b..cc5f5776 100644 --- a/src/RoomInfoListItem.cpp +++ b/src/RoomInfoListItem.cpp @@ -338,7 +338,7 @@ enum NotificationImportance : short Invite = 3 }; -unsigned short int +short int RoomInfoListItem::calculateImportance() const { // Returns the degree of importance of the unread messages in the room. diff --git a/src/RoomInfoListItem.h b/src/RoomInfoListItem.h index 9361a20b..e609f4d8 100644 --- a/src/RoomInfoListItem.h +++ b/src/RoomInfoListItem.h @@ -72,7 +72,7 @@ public: void updateUnreadMessageCount(int count, int highlightedCount); void clearUnreadMessageCount() { updateUnreadMessageCount(0, 0); }; - unsigned short int calculateImportance() const; + short int calculateImportance() const; QString roomId() { return roomId_; } bool isPressed() const { return isPressed_; }