Age | Commit message (Collapse) | Author |
|
Don't use pointers and explicit operator new() for Avatars now that we store them in a separate container from the avatar(url)-to-room mapping. Less heap wasted.
|
|
Slightly safer for the case (probably).
|
|
Closes #177.
|
|
Plugs some memory leaks reported by Valgrind.
|
|
avatars-to-rooms mapping
Because they are uncopiable, unlike pointers to them; and a combination of QHash of avatars and a QMultiHash of rooms is much more convenient than a std::vector<std::pair<...>>.
|
|
Enables to address QMatrixClient/Quaternion#284. Also fixes a gibberish condition in Room::Private::renameMember() that led to improper warnings and a too early return.
|
|
User::Private stores two new maps (for display names and avatars respectively) and is able to retrieve and store names/avatars on a per-room basis. The "most used" trait is stored separately and room lists are not kept for it (because most people have a single name and a single avatar across all or most rooms).
TODO: The avatar container should be replaced with something less clumsy; the current code doesn't even compile with MSVC. A "handle" copyable structure that would hold the Avatar is one of options.
Closes #141.
|
|
Although the setting part of the work is class(User or Room)-specific, the uploading part is common, so Avatar provides it now.
Also: there's no need to store Connection, as it's only used in get() and upload() - just pass it as the parameter to the methods.
|
|
|
|
Did two QChar::isDigit() overloads, one static and one member, confuse it?
|
|
|
|
User::fullName() is used in Room::roomMembername now. That string
construction may be further cached now if it ever becomes a bottleneck.
|
|
To make it easy to use User objects and fetch room and user avatars from QML. Closes #155.
|
|
To make debugging (including QML debugging) more convenient.
|
|
|
|
and User
The switch is necessary because MediaThumbnailJob is supposed to return something that can be worked on in non-GUI threads (as is the case of QML image providers), and QPixmap is not supposed for usage out of the main thread.
|
|
|
|
|
|
The events are detected in /sync output, and avatars for rooms are loaded from respective URLs. Clients can use Room::avatar() method to request a pixmap of a certain size, and react to avatarChanged() in order to update the UI when new pixmaps/avatars arrive. avatarChanged() signal is overloaded with two tasks - the first firing merely indicates that a new avatar is available (without actual pixmap yet available) while the second firing means that an actual pixmap has arrived (all this is entirely transparent for clients, they just should update their pixmaps from Room::avatar() every time when Room::avatarChanged() is emitted).
|
|
Avatars are also a property of rooms, and the supporting code is basically
the same. The only thing different will be emitted signals, and the cleanest
thing to support that (aside from making Avatar a QObject) seems to be to
parameterise the thumbnail-updating logic with a continuation invoked upon
completion of the thumbnail job.
|
|
This causes enormous traffic in the logs upon every startup when
main.debug logs are on.
|
|
If all users suddenly don't have names, update to this commit, delete your cache and run again. Issue since 2bf912d6e6ddd9ff81a92ff28ac8c4c1d8f2d7e1.
|
|
Note that although the mechanism is generic enough to change any user's
display name, The Spec states that power rules are very strict about it.
|
|
avatarUrl() is not yet invokable from QML; I'm considering to make all the simple things in User Q_PROPERTies instead.
|
|
Also use scaledThumbnail() in User::requestAvatar()
|
|
|
|
|
|
Mainly it's about const-ification (in particular, passing const-refs instead of values) and deleting unneeded declarations/#includes. Since the changes alter the external interface, this is submitted as a PR for peer review.
One of unneeded declarations/definitions is a virtual destructor in BaseJob descendants. Since a job object should be deleted through QObject::deleteLater() anyway (and it's the only correct way of disposing of the object), all deletions will call the stack of destructors through virtual QObject::~QObject(). Therefore even BaseJob could get on with a non-virtual destructor but for the sake of clarity BaseJob::~BaseJob() is still declared virtual.
|
|
This greatly reduces the noise made by quaternion.
To enable full logging, export the following variable:
QT_LOGGING_RULES="libqmatrixclient.*.debug=true"
|
|
Same workaround as in commit 836f35dc7d, but this time also for avatars.
|
|
Otherwise the following QJsonObject will discard a valid display name in
RoomMemberEvent::fromJson():
QJsonObject({"content":{"membership":"leave"},"event_id":"$14905359301189950PoADM:matrix.org","membership":"leave","origin_server_ts":1490535930821,"sender":"@elvisangelaccio:matrix.org","state_key":"@elvisangelaccio:matrix.org","type":"m.room.member","unsigned":{"age":1887090448,"prev_content":{"avatar_url":"mxc://matrix.org/PuDxgBQfeplXbCQFvOGpTEmC","displayname":"eang","membership":"join"},"prev_sender":"@elvisangelaccio:matrix.org","replaces_state":"$14905358091189487gXwtE:matrix.org"}})
|
|
If the user doesn't have a custom avatar set, show a default avatar
instead of nothing. This fixes a misalignment in the tableview
between users with and without a custom avatar.
Since libqmatrixclient doesn't recognize yet if a user is online or offline,
just use the `user-available` standard [1] icon for now.
[1]: https://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.htmli
|
|
|
|
|
|
Connection::getThumbnail() is now overloaded to provide compatibility with the previous interface.
|
|
|
|
1. Introduce QDebug manipulators and formatJson manipulator in particular - this allows to accommodate some changes in Qt's debug printing behaviour between versions.
2. Show JSON for some questionable objects (UnknownEvents, events with no event_id etc.)
3. Log the list of typing users and the user id when getting an avatar.
|
|
|
|
|
|
|
|
|