1 | // Copyright (C) 2009 Marco Martin <notmart@gmail.com> |
2 | // Copyright (C) 2016 The Qt Company Ltd. |
3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
4 | |
5 | #ifndef QDBUSTRAYTYPES_P_H |
6 | #define QDBUSTRAYTYPES_P_H |
7 | |
8 | // |
9 | // W A R N I N G |
10 | // ------------- |
11 | // |
12 | // This file is not part of the Qt API. It exists for the convenience |
13 | // of other Qt classes. This header file may change from version to |
14 | // version without notice, or even be removed. |
15 | // |
16 | // We mean it. |
17 | // |
18 | |
19 | #include <QtGui/private/qtguiglobal_p.h> |
20 | |
21 | QT_REQUIRE_CONFIG(systemtrayicon); |
22 | |
23 | #include <QObject> |
24 | #include <QString> |
25 | #include <QDBusArgument> |
26 | #include <QDBusConnection> |
27 | #include <QDBusObjectPath> |
28 | #include <QPixmap> |
29 | |
30 | QT_BEGIN_NAMESPACE |
31 | |
32 | // Custom message type to send icons across D-Bus |
33 | struct QXdgDBusImageStruct |
34 | { |
35 | QXdgDBusImageStruct() { } |
36 | QXdgDBusImageStruct(int w, int h) |
37 | : width(w), height(h), data(width * height * 4, 0) { } |
38 | int width; |
39 | int height; |
40 | QByteArray data; |
41 | }; |
42 | Q_DECLARE_TYPEINFO(QXdgDBusImageStruct, Q_RELOCATABLE_TYPE); |
43 | |
44 | using QXdgDBusImageVector = QList<QXdgDBusImageStruct>; |
45 | |
46 | QXdgDBusImageVector iconToQXdgDBusImageVector(const QIcon &icon); |
47 | |
48 | // Custom message type to send tooltips across D-Bus |
49 | struct QXdgDBusToolTipStruct |
50 | { |
51 | QString icon; |
52 | QXdgDBusImageVector image; |
53 | QString title; |
54 | QString subTitle; |
55 | }; |
56 | Q_DECLARE_TYPEINFO(QXdgDBusToolTipStruct, Q_RELOCATABLE_TYPE); |
57 | |
58 | const QDBusArgument &operator<<(QDBusArgument &argument, const QXdgDBusImageStruct &icon); |
59 | const QDBusArgument &operator>>(const QDBusArgument &argument, QXdgDBusImageStruct &icon); |
60 | |
61 | const QDBusArgument &operator<<(QDBusArgument &argument, const QXdgDBusImageVector &iconVector); |
62 | const QDBusArgument &operator>>(const QDBusArgument &argument, QXdgDBusImageVector &iconVector); |
63 | |
64 | const QDBusArgument &operator<<(QDBusArgument &argument, const QXdgDBusToolTipStruct &toolTip); |
65 | const QDBusArgument &operator>>(const QDBusArgument &argument, QXdgDBusToolTipStruct &toolTip); |
66 | |
67 | QT_END_NAMESPACE |
68 | |
69 | QT_DECL_METATYPE_EXTERN(QXdgDBusImageStruct, Q_GUI_EXPORT) |
70 | QT_DECL_METATYPE_EXTERN(QXdgDBusImageVector, Q_GUI_EXPORT) |
71 | QT_DECL_METATYPE_EXTERN(QXdgDBusToolTipStruct, Q_GUI_EXPORT) |
72 | |
73 | #endif // QDBUSTRAYTYPES_P_H |
74 | |