aboutsummaryrefslogtreecommitdiff
path: root/avatar.cpp
AgeCommit message (Collapse)Author
2018-02-23Avatar: provide common logic for uploading; don't store ConnectionKitsune Ral
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.
2018-01-25Room, User: expose avatarMediaId(); declare User for the metatype systemKitsune Ral
To make it easy to use User objects and fetch room and user avatars from QML. Closes #155.
2018-01-24Typo fixes for the previous commitKitsune Ral
Requires deleting the cache :(
2018-01-24Avatar: Only allow mxc:// links for avatarsKitsune Ral
Otherwise an attempt to use a possibly insecure link goes to Connection::getThumbnail(), leading to an assertion failure in splitMediaId(). See also the discussion in QMatrixClient/Quaternion#265.
2018-01-09Avatar: Use QPointer<> and isJobRunning()Kitsune Ral
2018-01-09Avatar: Mark get() as const operationKitsune Ral
With all the liberty that pimpl idiom gives it's easy to get away without proper const's; but let's be consistent :)
2018-01-09Avatar: Use Connection::getThumbnail instead of callApi<>Kitsune Ral
2017-12-28Switch from QPixmap to QImage; add convenience avatar() overloads to Room ↵Kitsune Ral
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.
2017-12-25Use pimpl for AvatarsKitsune Ral
2017-11-21Eliminate race condition in Avatar::get()Kitsune Ral
The race occurred because _ongoingRequest wasn't properly reinitialized if another request on a bigger size arrives while a request for a smaller size is in the air. The old request is now abandoned and continuations are collected inside the Avatar object rather than in the lambda connected to the job. Closes #124. Along the way, _scaledPixmaps is now std::vector instead of QHash since usually it only contains very few (1 or 2) entries and QHash is a waste of memory for that.
2017-10-26Move out the avatar code from UserKitsune Ral
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.