Add image caching && update libqmatrixclient.
This commit is contained in:
parent
cb2f7daa17
commit
3fa14d3c4b
|
@ -1 +1 @@
|
|||
Subproject commit 4e45218924babe6708fe2128574a3cf6341fe3c6
|
||||
Subproject commit d9ff200ff62fb7f5b6b51082dc3979d5454a1bec
|
|
@ -1,6 +1,8 @@
|
|||
#include "imageprovider.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QMetaObject>
|
||||
#include <QStandardPaths>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QWaitCondition>
|
||||
|
||||
|
@ -30,6 +32,14 @@ QImage ImageProvider::requestImage(const QString& id, QSize* pSize,
|
|||
|
||||
QUrl mxcUri{id};
|
||||
|
||||
QUrl tempfilePath = QUrl::fromLocalFile(
|
||||
QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/" +
|
||||
mxcUri.fileName() + "-" + QString::number(requestedSize.width()) +
|
||||
"x" + QString::number(requestedSize.height()) + ".png");
|
||||
|
||||
QImage cachedImage;
|
||||
if (cachedImage.load(tempfilePath.toLocalFile())) return cachedImage;
|
||||
|
||||
MediaThumbnailJob* job = nullptr;
|
||||
QReadLocker locker(&m_lock);
|
||||
|
||||
|
@ -63,5 +73,7 @@ QImage ImageProvider::requestImage(const QString& id, QSize* pSize,
|
|||
|
||||
if (pSize != nullptr) *pSize = result.size();
|
||||
|
||||
result.save(tempfilePath.toLocalFile());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue