Improve avatar look and layouting

Thanks to red_sky for the feedback!
This commit is contained in:
Nicolas Werner 2019-11-03 01:17:40 +01:00
parent bde71a6cbc
commit 4f7a45a0a6
5 changed files with 12 additions and 9 deletions

View file

@ -6,7 +6,7 @@ void
MxcImageResponse::run()
{
if (m_requestedSize.isValid()) {
QString fileName = QString("%1_%2x%3")
QString fileName = QString("%1_%2x%3_crop")
.arg(m_id)
.arg(m_requestedSize.width())
.arg(m_requestedSize.height());
@ -23,7 +23,7 @@ MxcImageResponse::run()
opts.mxc_url = "mxc://" + m_id.toStdString();
opts.width = m_requestedSize.width() > 0 ? m_requestedSize.width() : -1;
opts.height = m_requestedSize.height() > 0 ? m_requestedSize.height() : -1;
opts.method = "scale";
opts.method = "crop";
http::client()->get_thumbnail(
opts, [this, fileName](const std::string &res, mtx::http::RequestErr err) {
if (err) {
@ -38,8 +38,6 @@ MxcImageResponse::run()
auto data = QByteArray(res.data(), res.size());
cache::client()->saveImage(fileName, data);
m_image.loadFromData(data);
m_image = m_image.scaled(
m_requestedSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
m_image.setText("mxc url", "mxc://" + m_id);
emit finished();