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
21QT_REQUIRE_CONFIG(systemtrayicon);
22
23#include <QObject>
24#include <QString>
25#include <QDBusArgument>
26#include <QDBusConnection>
27#include <QDBusObjectPath>
28#include <QPixmap>
29
30QT_BEGIN_NAMESPACE
31
32// Custom message type to send icons across D-Bus
33struct 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};
42Q_DECLARE_TYPEINFO(QXdgDBusImageStruct, Q_RELOCATABLE_TYPE);
43
44using QXdgDBusImageVector = QList<QXdgDBusImageStruct>;
45
46QXdgDBusImageVector iconToQXdgDBusImageVector(const QIcon &icon);
47
48// Custom message type to send tooltips across D-Bus
49struct QXdgDBusToolTipStruct
50{
51 QString icon;
52 QXdgDBusImageVector image;
53 QString title;
54 QString subTitle;
55};
56Q_DECLARE_TYPEINFO(QXdgDBusToolTipStruct, Q_RELOCATABLE_TYPE);
57
58const QDBusArgument &operator<<(QDBusArgument &argument, const QXdgDBusImageStruct &icon);
59const QDBusArgument &operator>>(const QDBusArgument &argument, QXdgDBusImageStruct &icon);
60
61const QDBusArgument &operator<<(QDBusArgument &argument, const QXdgDBusImageVector &iconVector);
62const QDBusArgument &operator>>(const QDBusArgument &argument, QXdgDBusImageVector &iconVector);
63
64const QDBusArgument &operator<<(QDBusArgument &argument, const QXdgDBusToolTipStruct &toolTip);
65const QDBusArgument &operator>>(const QDBusArgument &argument, QXdgDBusToolTipStruct &toolTip);
66
67QT_END_NAMESPACE
68
69QT_DECL_METATYPE_EXTERN(QXdgDBusImageStruct, Q_GUI_EXPORT)
70QT_DECL_METATYPE_EXTERN(QXdgDBusImageVector, Q_GUI_EXPORT)
71QT_DECL_METATYPE_EXTERN(QXdgDBusToolTipStruct, Q_GUI_EXPORT)
72
73#endif // QDBUSTRAYTYPES_P_H
74

source code of qtbase/src/gui/platform/unix/dbustray/qdbustraytypes_p.h