10 #include <QtCore/QObject>
14 class RoomMemberEvent;
34 Q_PROPERTY(
bool isEmpty READ isEmpty CONSTANT)
35 Q_PROPERTY(QString id READ id CONSTANT)
36 Q_PROPERTY(Uri uri READ uri CONSTANT)
37 Q_PROPERTY(
bool isLocalMember READ isLocalMember CONSTANT)
38 Q_PROPERTY(QString displayName READ displayName CONSTANT)
39 Q_PROPERTY(QString htmlSafeDisplayName READ htmlSafeDisplayName CONSTANT)
40 Q_PROPERTY(QString fullName READ fullName CONSTANT)
41 Q_PROPERTY(QString htmlSafeFullName READ htmlSafeFullName CONSTANT)
42 Q_PROPERTY(QString disambiguatedName READ disambiguatedName CONSTANT)
43 Q_PROPERTY(QString htmlSafeDisambiguatedName READ htmlSafeDisambiguatedName CONSTANT)
44 Q_PROPERTY(
int hue READ hue CONSTANT)
45 Q_PROPERTY(qreal hueF READ hueF CONSTANT)
46 Q_PROPERTY(QColor color READ color CONSTANT)
47 Q_PROPERTY(QUrl avatarUrl READ avatarUrl CONSTANT)
48 Q_PROPERTY(
int powerLevel READ powerLevel CONSTANT)
51 RoomMember() =
default;
53 explicit RoomMember(
const Room* room,
const RoomMemberEvent* member);
55 bool isEmpty()
const {
return _member ==
nullptr; }
57 bool operator==(
const RoomMember& other)
const;
73 bool isLocalMember()
const;
76 Membership membershipState()
const;
99 QString displayName()
const;
110 QString htmlSafeDisplayName()
const;
123 QString fullName()
const;
136 QString htmlSafeFullName()
const;
149 QString disambiguatedName()
const;
162 QString htmlSafeDisambiguatedName()
const;
168 Q_INVOKABLE
bool matches(QStringView substr, Qt::CaseSensitivity cs = Qt::CaseSensitive)
const;
190 QColor color()
const;
192 const Avatar& avatarObject()
const;
197 QString avatarMediaId()
const;
202 QUrl avatarUrl()
const;
204 QImage avatar(
int width,
int height, Avatar::get_callback_t callback)
const;
206 QImage avatar(
int dimension, Avatar::get_callback_t callback)
const;
212 int powerLevel()
const;
215 const Room* _room =
nullptr;
216 const RoomMemberEvent* _member =
nullptr;
224 inline auto memberMatcher(
auto substr, Qt::CaseSensitivity cs = Qt::CaseSensitive)
226 #ifdef __cpp_lib_bind_back
227 return std::bind_back(&RoomMember::matches, substr, cs);
229 return [substr, cs](
const RoomMember& m) {
return m.matches(substr, cs); };
234 bool operator()(
const RoomMember& u1,
const RoomMember& u2)
const
236 return operator()(u1.displayName(), u2.displayName());
238 bool operator()(
const RoomMember& u1, QStringView u2name)
const
240 return operator()(u1.displayName(), u2name);
242 bool operator()(QStringView u1name,
const RoomMember& u2)
const
244 return operator()(u1name, u2.displayName());
246 bool operator()(QStringView u1name, QStringView u2name)
const;
248 #if Quotient_VERSION_MAJOR == 0
&& Quotient_VERSION_MINOR < 10
249 template <
template <
class>
class ContT>
250 [[deprecated(
"Use Quotient::lowerBoundIndex() or std::ranges::lower_bound() instead")]]
251 typename ContT<RoomMember>::size_type
252 lowerBoundIndex(
const ContT<RoomMember>& c,
const auto& v)
const
254 return std::ranges::lower_bound(c, v, *
this) - c.begin();