mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Update cppgir
This commit is contained in:
parent
9414ef5709
commit
c0b612c457
2 changed files with 8 additions and 24 deletions
|
@ -469,29 +469,18 @@ void NotificationData::close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationData::setImage(QImage image) {
|
void NotificationData::setImage(QImage image) {
|
||||||
using DestroyNotify = gi::detail::callback<
|
|
||||||
void(),
|
|
||||||
gi::transfer_full_t,
|
|
||||||
std::tuple<>
|
|
||||||
>;
|
|
||||||
|
|
||||||
if (_notification) {
|
if (_notification) {
|
||||||
const auto imageData = std::make_shared<QByteArray>();
|
const auto imageData = std::make_shared<QByteArray>();
|
||||||
QBuffer buffer(imageData.get());
|
QBuffer buffer(imageData.get());
|
||||||
buffer.open(QIODevice::WriteOnly);
|
buffer.open(QIODevice::WriteOnly);
|
||||||
image.save(&buffer, "PNG");
|
image.save(&buffer, "PNG");
|
||||||
|
|
||||||
const auto callbackWrap = gi::unwrap(
|
|
||||||
DestroyNotify([imageData] {}),
|
|
||||||
gi::scope_notified);
|
|
||||||
|
|
||||||
_notification.set_icon(
|
_notification.set_icon(
|
||||||
Gio::BytesIcon::new_(
|
Gio::BytesIcon::new_(
|
||||||
gi::wrap(g_bytes_new_with_free_func(
|
GLib::Bytes::new_with_free_func(
|
||||||
imageData->constData(),
|
reinterpret_cast<const uchar*>(imageData->constData()),
|
||||||
imageData->size(),
|
imageData->size(),
|
||||||
&callbackWrap->destroy,
|
[imageData] {})));
|
||||||
callbackWrap), gi::transfer_full)));
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -506,10 +495,6 @@ void NotificationData::setImage(QImage image) {
|
||||||
image.convertTo(QImage::Format_RGB888);
|
image.convertTo(QImage::Format_RGB888);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto callbackWrap = gi::unwrap(
|
|
||||||
DestroyNotify([image] {}),
|
|
||||||
gi::scope_notified);
|
|
||||||
|
|
||||||
_hints.insert_value(_imageKey, GLib::Variant::new_tuple({
|
_hints.insert_value(_imageKey, GLib::Variant::new_tuple({
|
||||||
GLib::Variant::new_int32(image.width()),
|
GLib::Variant::new_int32(image.width()),
|
||||||
GLib::Variant::new_int32(image.height()),
|
GLib::Variant::new_int32(image.height()),
|
||||||
|
@ -517,13 +502,12 @@ void NotificationData::setImage(QImage image) {
|
||||||
GLib::Variant::new_boolean(image.hasAlphaChannel()),
|
GLib::Variant::new_boolean(image.hasAlphaChannel()),
|
||||||
GLib::Variant::new_int32(8),
|
GLib::Variant::new_int32(8),
|
||||||
GLib::Variant::new_int32(image.hasAlphaChannel() ? 4 : 3),
|
GLib::Variant::new_int32(image.hasAlphaChannel() ? 4 : 3),
|
||||||
gi::wrap(g_variant_new_from_data(
|
GLib::Variant::new_from_data(
|
||||||
G_VARIANT_TYPE_BYTESTRING,
|
GLib::VariantType::new_("ay"),
|
||||||
image.constBits(),
|
reinterpret_cast<const uchar*>(image.constBits()),
|
||||||
image.sizeInBytes(),
|
image.sizeInBytes(),
|
||||||
true,
|
true,
|
||||||
&callbackWrap->destroy,
|
[image] {}),
|
||||||
callbackWrap), gi::transfer_none),
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
cmake
2
cmake
|
@ -1 +1 @@
|
||||||
Subproject commit c82faf706fd10618ad5f97a7972fb09c56843271
|
Subproject commit 95c83fd26424c26d4fc4454cef601529616683aa
|
Loading…
Add table
Reference in a new issue