mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 03:00:46 +03:00
Fix notification images
This commit is contained in:
parent
04cbbd2837
commit
f145c2a41a
2 changed files with 9 additions and 19 deletions
|
@ -190,20 +190,17 @@ operator<<(QDBusArgument &arg, const QImage &image)
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage i = image.height() > 100 || image.width() > 100
|
QImage i = image.height() > 100 || image.width() > 100
|
||||||
? image.scaledToHeight(100, Qt::SmoothTransformation)
|
? image.scaledToHeight(100, Qt::SmoothTransformation)
|
||||||
: image;
|
: image;
|
||||||
i = std::move(i).convertToFormat(QImage::Format_RGBA8888);
|
bool hasAlpha = i.hasAlphaChannel();
|
||||||
|
i = std::move(i).convertToFormat(hasAlpha ? QImage::Format_RGBA8888 : QImage::Format_RGB888);
|
||||||
|
|
||||||
|
int channels = hasAlpha ? 4 : 3;
|
||||||
|
QByteArray arr(reinterpret_cast<const char *>(i.bits()), static_cast<int>(i.sizeInBytes()));
|
||||||
arg.beginStructure();
|
arg.beginStructure();
|
||||||
arg << i.width();
|
arg << i.width() << i.height() << (int)i.bytesPerLine() << i.hasAlphaChannel()
|
||||||
arg << i.height();
|
<< i.depth() / channels << channels << arr;
|
||||||
arg << i.bytesPerLine();
|
|
||||||
arg << i.hasAlphaChannel();
|
|
||||||
int channels = i.hasAlphaChannel() ? 4 : 3;
|
|
||||||
arg << i.depth() / channels;
|
|
||||||
arg << channels;
|
|
||||||
arg << QByteArray(reinterpret_cast<const char *>(i.bits()), static_cast<int>(i.sizeInBytes()));
|
|
||||||
arg.endStructure();
|
arg.endStructure();
|
||||||
|
|
||||||
return arg;
|
return arg;
|
||||||
|
|
|
@ -111,10 +111,3 @@ private:
|
||||||
// Only populated on Linux atm
|
// Only populated on Linux atm
|
||||||
QMap<uint, roomEventId> notificationIds;
|
QMap<uint, roomEventId> notificationIds;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(NHEKO_DBUS_SYS)
|
|
||||||
QDBusArgument &
|
|
||||||
operator<<(QDBusArgument &arg, const QImage &image);
|
|
||||||
const QDBusArgument &
|
|
||||||
operator>>(const QDBusArgument &arg, QImage &);
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in a new issue