diff --git a/imports/Spectral/Component/Avatar.qml b/imports/Spectral/Component/Avatar.qml index 1372525..69108f1 100644 --- a/imports/Spectral/Component/Avatar.qml +++ b/imports/Spectral/Component/Avatar.qml @@ -14,7 +14,7 @@ Item { id: image visible: realSource - source: realSource + source: width < 1 ? "" : realSource sourceSize.width: width sourceSize.height: width fillMode: Image.PreserveAspectCrop diff --git a/include/libqmatrixclient b/include/libqmatrixclient index 23bf0e8..b467b08 160000 --- a/include/libqmatrixclient +++ b/include/libqmatrixclient @@ -1 +1 @@ -Subproject commit 23bf0e83aec1adaf81d9c50ce2385a98c20e3c93 +Subproject commit b467b0816f5f6816778f90b55a9d0b5437310fd5 diff --git a/src/imageprovider.cpp b/src/imageprovider.cpp index 0f3c1b0..c092b3e 100644 --- a/src/imageprovider.cpp +++ b/src/imageprovider.cpp @@ -6,10 +6,10 @@ using QMatrixClient::BaseJob; ThumbnailResponse::ThumbnailResponse(QMatrixClient::Connection* c, - QString mediaId, const QSize& requestedSize) + QString id, const QSize& size) : c(c), - mediaId(std::move(mediaId)), - requestedSize(requestedSize), + mediaId(std::move(id)), + requestedSize(size), errorStr("Image request hasn't started") { if (requestedSize.isEmpty()) { errorStr.clear(); @@ -40,7 +40,7 @@ void ThumbnailResponse::startRequest() { void ThumbnailResponse::prepareResult() { Q_ASSERT(QThread::currentThread() == job->thread()); - Q_ASSERT(job->error() != BaseJob::Pending); + Q_ASSERT(job->error() != BaseJob::Pending); { QWriteLocker _(&lock); if (job->error() == BaseJob::Success) { @@ -48,7 +48,7 @@ void ThumbnailResponse::prepareResult() { errorStr.clear(); } else if (job->error() == BaseJob::Abandoned) { errorStr = tr("Image request has been cancelled"); - qDebug() << "ThumbnailResponse: cancelled for" << mediaId; + qDebug() << "ThumbnailResponse: cancelled for" << mediaId; } else { errorStr = job->errorString(); qWarning() << "ThumbnailResponse: no valid image for" << mediaId << "-" @@ -61,9 +61,10 @@ void ThumbnailResponse::prepareResult() { void ThumbnailResponse::doCancel() { // Runs in the main thread, not QML thread - Q_ASSERT(QThread::currentThread() == job->thread()); - if (job) - job->abandon(); + if (job) { + Q_ASSERT(QThread::currentThread() == job->thread()); + job->abandon(); + } } QQuickTextureFactory* ThumbnailResponse::textureFactory() const { @@ -83,6 +84,6 @@ void ThumbnailResponse::cancel() { QQuickImageResponse* ImageProvider::requestImageResponse( const QString& id, const QSize& requestedSize) { - qDebug() << "ImageProvider: requesting " << id; + qDebug() << "ImageProvider: requesting " << id << "of size" << requestedSize; return new ThumbnailResponse(m_connection.load(), id, requestedSize); }