1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3#ifndef QIBUSTYPES_H
4#define QIBUSTYPES_H
5
6#include <qlist.h>
7#include <qevent.h>
8#include <QDBusArgument>
9#include <QTextCharFormat>
10#include <QLoggingCategory>
11
12QT_BEGIN_NAMESPACE
13
14Q_DECLARE_LOGGING_CATEGORY(qtQpaInputMethods)
15Q_DECLARE_LOGGING_CATEGORY(qtQpaInputMethodsSerialize)
16
17class QIBusSerializable
18{
19public:
20 QIBusSerializable();
21
22 void serializeTo(QDBusArgument &argument) const;
23 void deserializeFrom(const QDBusArgument &argument);
24
25 QString name;
26 QHash<QString, QDBusArgument> attachments;
27};
28
29class QIBusAttribute : private QIBusSerializable
30{
31public:
32 enum Type {
33 Invalid = 0,
34 Underline = 1,
35 Foreground = 2,
36 Background = 3,
37 };
38
39 enum Underline {
40 UnderlineNone = 0,
41 UnderlineSingle = 1,
42 UnderlineDouble = 2,
43 UnderlineLow = 3,
44 UnderlineError = 4,
45 };
46
47 QIBusAttribute();
48
49 QTextCharFormat format() const;
50
51 void serializeTo(QDBusArgument &argument) const;
52 void deserializeFrom(const QDBusArgument &argument);
53
54 Type type;
55 quint32 value;
56 quint32 start;
57 quint32 end;
58};
59Q_DECLARE_TYPEINFO(QIBusAttribute, Q_RELOCATABLE_TYPE);
60
61class QIBusAttributeList : private QIBusSerializable
62{
63public:
64 QIBusAttributeList();
65
66 QList<QInputMethodEvent::Attribute> imAttributes() const;
67
68 void serializeTo(QDBusArgument &argument) const;
69 void deserializeFrom(const QDBusArgument &argument);
70
71 QList<QIBusAttribute> attributes;
72};
73Q_DECLARE_TYPEINFO(QIBusAttributeList, Q_RELOCATABLE_TYPE);
74
75class QIBusText : private QIBusSerializable
76{
77public:
78 QIBusText();
79
80 void serializeTo(QDBusArgument &argument) const;
81 void deserializeFrom(const QDBusArgument &argument);
82
83 QString text;
84 QIBusAttributeList attributes;
85};
86Q_DECLARE_TYPEINFO(QIBusText, Q_RELOCATABLE_TYPE);
87
88class QIBusEngineDesc : private QIBusSerializable
89{
90public:
91 QIBusEngineDesc();
92
93 void serializeTo(QDBusArgument &argument) const;
94 void deserializeFrom(const QDBusArgument &argument);
95
96 QString engine_name;
97 QString longname;
98 QString description;
99 QString language;
100 QString license;
101 QString author;
102 QString icon;
103 QString layout;
104 unsigned int rank;
105 QString hotkeys;
106 QString symbol;
107 QString setup;
108 QString layout_variant;
109 QString layout_option;
110 QString version;
111 QString textdomain;
112 QString iconpropkey;
113};
114Q_DECLARE_TYPEINFO(QIBusEngineDesc, Q_RELOCATABLE_TYPE);
115
116inline QDBusArgument &operator<<(QDBusArgument &argument, const QIBusAttribute &attribute)
117{ attribute.serializeTo(argument); return argument; }
118inline const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusAttribute &attribute)
119{ attribute.deserializeFrom(argument); return argument; }
120
121inline QDBusArgument &operator<<(QDBusArgument &argument, const QIBusAttributeList &attributeList)
122{ attributeList.serializeTo(argument); return argument; }
123inline const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusAttributeList &attributeList)
124{ attributeList.deserializeFrom(argument); return argument; }
125
126inline QDBusArgument &operator<<(QDBusArgument &argument, const QIBusText &text)
127{ text.serializeTo(argument); return argument; }
128inline const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusText &text)
129{ text.deserializeFrom(argument); return argument; }
130
131inline QDBusArgument &operator<<(QDBusArgument &argument, const QIBusEngineDesc &desc)
132{ desc.serializeTo(argument); return argument; }
133inline const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusEngineDesc &desc)
134{ desc.deserializeFrom(argument); return argument; }
135
136QT_END_NAMESPACE
137
138Q_DECLARE_METATYPE(QIBusAttribute)
139Q_DECLARE_METATYPE(QIBusAttributeList)
140Q_DECLARE_METATYPE(QIBusText)
141Q_DECLARE_METATYPE(QIBusEngineDesc)
142
143#endif
144

source code of qtbase/src/plugins/platforminputcontexts/ibus/qibustypes.h