From bd1cadb6bb88c9161290962699e32d5046d1afe7 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 1 Nov 2023 21:44:21 +0100 Subject: [PATCH] Spaces are now bold --- resources/qml/Completer.qml | 2 ++ src/Cache.cpp | 1 + src/CacheStructs.h | 1 + src/RoomsModel.cpp | 3 +++ src/RoomsModel.h | 1 + 5 files changed, 8 insertions(+) diff --git a/resources/qml/Completer.qml b/resources/qml/Completer.qml index d8205988..89921ca4 100644 --- a/resources/qml/Completer.qml +++ b/resources/qml/Completer.qml @@ -237,6 +237,7 @@ Control { Label { color: model.index == popup.currentIndex ? palette.highlightedText : palette.text font.italic: model.isTombstoned + font.bold: model.isSpace font.pixelSize: popup.avatarHeight * 0.5 text: model.roomName textFormat: Text.RichText @@ -261,6 +262,7 @@ Control { Label { color: model.index == popup.currentIndex ? palette.highlightedText : palette.text font.italic: model.isTombstoned + font.bold: model.isSpace text: model.roomName textFormat: Text.RichText } diff --git a/src/Cache.cpp b/src/Cache.cpp index e6b7313e..aae7acde 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -2866,6 +2866,7 @@ Cache::roomNamesAndAliases() .alias = std::move(alias), .recent_activity = info.approximate_last_modification_ts, .is_tombstoned = info.is_tombstoned, + .is_space = info.is_space, }); } catch (std::exception &e) { nhlog::db()->warn("Failed to add room {} to result: {}", room_id, e.what()); diff --git a/src/CacheStructs.h b/src/CacheStructs.h index 6e2f800a..f1aafb96 100644 --- a/src/CacheStructs.h +++ b/src/CacheStructs.h @@ -110,6 +110,7 @@ struct RoomNameAlias std::string id, name, alias; std::uint64_t recent_activity; bool is_tombstoned; + bool is_space; }; //! Basic information per member. diff --git a/src/RoomsModel.cpp b/src/RoomsModel.cpp index 7481eb51..fff9cbc6 100644 --- a/src/RoomsModel.cpp +++ b/src/RoomsModel.cpp @@ -36,6 +36,7 @@ RoomsModel::roleNames() const {Roles::RoomID, "roomid"}, {Roles::RoomName, "roomName"}, {Roles::IsTombstoned, "isTombstoned"}, + {Roles::IsSpace, "isSpace"}, }; } @@ -69,6 +70,8 @@ RoomsModel::data(const QModelIndex &index, int role) const return QString::fromStdString(rooms[index.row()].id).toHtmlEscaped(); case Roles::IsTombstoned: return rooms[index.row()].is_tombstoned; + case Roles::IsSpace: + return rooms[index.row()].is_space; } } return {}; diff --git a/src/RoomsModel.h b/src/RoomsModel.h index 3e49ca87..83a21ae0 100644 --- a/src/RoomsModel.h +++ b/src/RoomsModel.h @@ -19,6 +19,7 @@ public: RoomID, RoomName, IsTombstoned, + IsSpace, }; RoomsModel(bool showOnlyRoomWithAliases = false, QObject *parent = nullptr);