mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2025-11-06 19:14:57 +11:00
service/notifications: add notifications service
This commit is contained in:
parent
79cbfba48a
commit
d630cc7f76
15 changed files with 1249 additions and 0 deletions
36
src/services/notifications/dbusimage.hpp
Normal file
36
src/services/notifications/dbusimage.hpp
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#pragma once
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <qdbusargument.h>
|
||||
#include <qimage.h>
|
||||
#include <qobject.h>
|
||||
|
||||
#include "../../core/imageprovider.hpp"
|
||||
|
||||
namespace qs::service::notifications {
|
||||
|
||||
struct DBusNotificationImage {
|
||||
qint32 width = 0;
|
||||
qint32 height = 0;
|
||||
bool hasAlpha = false;
|
||||
QByteArray data;
|
||||
|
||||
// valid only for the lifetime of the pixmap
|
||||
[[nodiscard]] QImage createImage() const;
|
||||
};
|
||||
|
||||
const QDBusArgument& operator>>(const QDBusArgument& argument, DBusNotificationImage& pixmap);
|
||||
const QDBusArgument& operator<<(QDBusArgument& argument, const DBusNotificationImage& pixmap);
|
||||
|
||||
class NotificationImage: public QsImageHandle {
|
||||
public:
|
||||
explicit NotificationImage(DBusNotificationImage image, QObject* parent)
|
||||
: QsImageHandle(QQuickAsyncImageProvider::Image, parent)
|
||||
, image(std::move(image)) {}
|
||||
|
||||
QImage requestImage(const QString& id, QSize* size, const QSize& requestedSize) override;
|
||||
|
||||
DBusNotificationImage image;
|
||||
};
|
||||
} // namespace qs::service::notifications
|
||||
Loading…
Add table
Add a link
Reference in a new issue