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 | |
4 | #include <qpa/qplatforminputcontextplugin_p.h> |
5 | #include <QtCore/QStringList> |
6 | #include <QDBusMetaType> |
7 | #include "qibusplatforminputcontext.h" |
8 | #include "qibustypes.h" |
9 | |
10 | QT_BEGIN_NAMESPACE |
11 | |
12 | using namespace Qt::StringLiterals; |
13 | |
14 | class QIbusPlatformInputContextPlugin : public QPlatformInputContextPlugin |
15 | { |
16 | Q_OBJECT |
17 | Q_PLUGIN_METADATA(IID QPlatformInputContextFactoryInterface_iid FILE "ibus.json") |
18 | |
19 | public: |
20 | QIBusPlatformInputContext *create(const QString&, const QStringList&) override; |
21 | }; |
22 | |
23 | QIBusPlatformInputContext *QIbusPlatformInputContextPlugin::create(const QString& system, const QStringList& paramList) |
24 | { |
25 | Q_UNUSED(paramList); |
26 | |
27 | if (system.compare(s1: system, s2: "ibus"_L1, cs: Qt::CaseInsensitive) == 0) { |
28 | qDBusRegisterMetaType<QIBusAttribute>(); |
29 | qDBusRegisterMetaType<QIBusAttributeList>(); |
30 | qDBusRegisterMetaType<QIBusText>(); |
31 | return new QIBusPlatformInputContext; |
32 | } |
33 | |
34 | return nullptr; |
35 | } |
36 | |
37 | QT_END_NAMESPACE |
38 | |
39 | #include "main.moc" |
40 |