summary refs log tree commit diff
path: root/src/notifications
diff options
context:
space:
mode:
authorLoren Burkholder <computersemiexpert@outlook.com>2021-03-01 19:56:11 -0500
committerNicolas Werner <nicolas.werner@hotmail.de>2021-03-17 19:18:06 +0100
commit82bbdfb92943cffcf62eee7bd8466765e40d5632 (patch)
tree4239e015860cd845f48c1dedd32115f026f6402e /src/notifications
parentSwitch readImage to take a reference instead of a pointer (diff)
downloadnheko-82bbdfb92943cffcf62eee7bd8466765e40d5632.tar.xz
Use better method of resizing images
Diffstat (limited to 'src/notifications')
-rw-r--r--src/notifications/Manager.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/notifications/Manager.cpp b/src/notifications/Manager.cpp

index 6fa06cb2..8a3576c5 100644 --- a/src/notifications/Manager.cpp +++ b/src/notifications/Manager.cpp
@@ -49,22 +49,22 @@ NotificationsManager::cacheImage(const mtx::events::collections::TimelineEvents // delete any existing file content file.resize(0); - file.write(QByteArray(temp.data(), (int)temp.size())); - // resize the image (really inefficient, I know, but I can't find any - // better way right off - QImage img{path}; - - // delete existing contents - file.resize(0); + // resize the image + QImage img{utils::readImage(QByteArray{temp.data()})}; // make sure to save as PNG (because Plasma doesn't do JPEG in // notifications) // if (!file.fileName().endsWith(".png")) // file.rename(file.fileName() + ".png"); +#ifdef NHEKO_DBUS_SYS // the images in D-Bus notifications are to be 200x100 max img.scaled(200, 100, Qt::KeepAspectRatio, Qt::SmoothTransformation) .save(&file); +#else + img.save(&file); +#endif // NHEKO_DBUS_SYS + file.close(); return;