diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-09-18 00:22:33 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-09-18 00:45:50 +0200 |
commit | cfca7157b98c9dc8e0852fe6484bc3f75008af7d (patch) | |
tree | 32b92340908a9374214ec7b84c1fac7ea338f56d /src/AvatarProvider.cpp | |
parent | e118f3882d54a6f84885ab492704104848e5d346 (diff) |
Change indentation to 4 spaces
Diffstat (limited to 'src/AvatarProvider.cpp')
-rw-r--r-- | src/AvatarProvider.cpp | 69 |
1 files changed, 34 insertions, 35 deletions
diff --git a/src/AvatarProvider.cpp b/src/AvatarProvider.cpp index b9962cef..177bf903 100644 --- a/src/AvatarProvider.cpp +++ b/src/AvatarProvider.cpp @@ -22,45 +22,44 @@ namespace AvatarProvider { void resolve(QString avatarUrl, int size, QObject *receiver, AvatarCallback callback) { - const auto cacheKey = QString("%1_size_%2").arg(avatarUrl).arg(size); + const auto cacheKey = QString("%1_size_%2").arg(avatarUrl).arg(size); - QPixmap pixmap; - if (avatarUrl.isEmpty()) { - callback(pixmap); - return; - } + QPixmap pixmap; + if (avatarUrl.isEmpty()) { + callback(pixmap); + return; + } - if (avatar_cache.find(cacheKey, &pixmap)) { - callback(pixmap); - return; - } + if (avatar_cache.find(cacheKey, &pixmap)) { + callback(pixmap); + return; + } - MxcImageProvider::download(avatarUrl.remove(QStringLiteral("mxc://")), - QSize(size, size), - [callback, cacheKey, recv = QPointer<QObject>(receiver)]( - QString, QSize, QImage img, QString) { - if (!recv) - return; + MxcImageProvider::download(avatarUrl.remove(QStringLiteral("mxc://")), + QSize(size, size), + [callback, cacheKey, recv = QPointer<QObject>(receiver)]( + QString, QSize, QImage img, QString) { + if (!recv) + return; - auto proxy = std::make_shared<AvatarProxy>(); - QObject::connect(proxy.get(), - &AvatarProxy::avatarDownloaded, - recv, - [callback, cacheKey](QPixmap pm) { - if (!pm.isNull()) - avatar_cache.insert( - cacheKey, pm); - callback(pm); - }); + auto proxy = std::make_shared<AvatarProxy>(); + QObject::connect(proxy.get(), + &AvatarProxy::avatarDownloaded, + recv, + [callback, cacheKey](QPixmap pm) { + if (!pm.isNull()) + avatar_cache.insert(cacheKey, pm); + callback(pm); + }); - if (img.isNull()) { - emit proxy->avatarDownloaded(QPixmap{}); - return; - } + if (img.isNull()) { + emit proxy->avatarDownloaded(QPixmap{}); + return; + } - auto pm = QPixmap::fromImage(std::move(img)); - emit proxy->avatarDownloaded(pm); - }); + auto pm = QPixmap::fromImage(std::move(img)); + emit proxy->avatarDownloaded(pm); + }); } void @@ -70,8 +69,8 @@ resolve(const QString &room_id, QObject *receiver, AvatarCallback callback) { - auto avatarUrl = cache::avatarUrl(room_id, user_id); + auto avatarUrl = cache::avatarUrl(room_id, user_id); - resolve(std::move(avatarUrl), size, receiver, callback); + resolve(std::move(avatarUrl), size, receiver, callback); } } |