Imported Upstream version 1.0.5
Aron Xu
8 years ago
15 | 15 | include(ECMSetupVersion) |
16 | 16 | include(ECMGenerateHeaders) |
17 | 17 | |
18 | include(CheckCXXCompilerFlag) | |
19 | ||
20 | check_cxx_compiler_flag("-std=c++11" SUPPORT_CXX11) | |
21 | ||
22 | if(NOT SUPPORT_CXX11) | |
23 | message(FATAL_ERROR "need c++ 11 compatible compiler to compile") | |
24 | endif() | |
25 | ||
26 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall") | |
27 | ||
18 | 28 | find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Core DBus Widgets) |
19 | 29 | find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED Private) |
20 | 30 | find_package(XKBCommon 0.5.0 REQUIRED COMPONENTS XKBCommon) |
0 | 0 | /* |
1 | 1 | * This file was generated by qdbusxml2cpp version 0.8 |
2 | * Command line was: qdbusxml2cpp -N -p fcitxqtinputcontextproxy -c FcitxQtInputContextProxy interfaces/org.fcitx.Fcitx.InputContext.xml -i fcitxqtformattedpreedit.h -i fcitxqt_export.h | |
2 | * Command line was: qdbusxml2cpp -N -p fcitxqtinputcontextproxy -c FcitxQtInputContextProxy interfaces/org.fcitx.Fcitx.InputContext.xml -i fcitxqtformattedpreedit.h -i fcitxqtdbusaddons_export.h | |
3 | 3 | * |
4 | * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). | |
4 | * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd. | |
5 | 5 | * |
6 | 6 | * This is an auto-generated file. |
7 | 7 | * This file may have been hand-edited. Look for HAND-EDIT comments |
0 | 0 | /* |
1 | 1 | * This file was generated by qdbusxml2cpp version 0.8 |
2 | * Command line was: qdbusxml2cpp -N -p fcitxqtinputcontextproxy -c FcitxQtInputContextProxy interfaces/org.fcitx.Fcitx.InputContext.xml -i fcitxqtformattedpreedit.h -i fcitxqt_export.h | |
2 | * Command line was: qdbusxml2cpp -N -p fcitxqtinputcontextproxy -c FcitxQtInputContextProxy interfaces/org.fcitx.Fcitx.InputContext.xml -i fcitxqtformattedpreedit.h -i fcitxqtdbusaddons_export.h | |
3 | 3 | * |
4 | * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). | |
4 | * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd. | |
5 | 5 | * |
6 | 6 | * This is an auto-generated file. |
7 | 7 | * Do not edit! All changes made to it will be lost. |
8 | 8 | */ |
9 | 9 | |
10 | #ifndef FCITXQTINPUTCONTEXTPROXY_H_1409252990 | |
11 | #define FCITXQTINPUTCONTEXTPROXY_H_1409252990 | |
10 | #ifndef FCITXQTINPUTCONTEXTPROXY_H | |
11 | #define FCITXQTINPUTCONTEXTPROXY_H | |
12 | 12 | |
13 | 13 | #include <QtCore/QObject> |
14 | 14 | #include <QtCore/QByteArray> |
40 | 40 | inline QDBusPendingReply<> CloseIC() |
41 | 41 | { |
42 | 42 | QList<QVariant> argumentList; |
43 | return asyncCallWithArgumentList(QLatin1String("CloseIC"), argumentList); | |
43 | return asyncCallWithArgumentList(QStringLiteral("CloseIC"), argumentList); | |
44 | 44 | } |
45 | 45 | |
46 | 46 | inline QDBusPendingReply<> DestroyIC() |
47 | 47 | { |
48 | 48 | QList<QVariant> argumentList; |
49 | return asyncCallWithArgumentList(QLatin1String("DestroyIC"), argumentList); | |
49 | return asyncCallWithArgumentList(QStringLiteral("DestroyIC"), argumentList); | |
50 | 50 | } |
51 | 51 | |
52 | 52 | inline QDBusPendingReply<> EnableIC() |
53 | 53 | { |
54 | 54 | QList<QVariant> argumentList; |
55 | return asyncCallWithArgumentList(QLatin1String("EnableIC"), argumentList); | |
55 | return asyncCallWithArgumentList(QStringLiteral("EnableIC"), argumentList); | |
56 | 56 | } |
57 | 57 | |
58 | 58 | inline QDBusPendingReply<> FocusIn() |
59 | 59 | { |
60 | 60 | QList<QVariant> argumentList; |
61 | return asyncCallWithArgumentList(QLatin1String("FocusIn"), argumentList); | |
61 | return asyncCallWithArgumentList(QStringLiteral("FocusIn"), argumentList); | |
62 | 62 | } |
63 | 63 | |
64 | 64 | inline QDBusPendingReply<> FocusOut() |
65 | 65 | { |
66 | 66 | QList<QVariant> argumentList; |
67 | return asyncCallWithArgumentList(QLatin1String("FocusOut"), argumentList); | |
67 | return asyncCallWithArgumentList(QStringLiteral("FocusOut"), argumentList); | |
68 | 68 | } |
69 | 69 | |
70 | 70 | inline QDBusPendingReply<> MouseEvent(int x) |
71 | 71 | { |
72 | 72 | QList<QVariant> argumentList; |
73 | 73 | argumentList << QVariant::fromValue(x); |
74 | return asyncCallWithArgumentList(QLatin1String("MouseEvent"), argumentList); | |
74 | return asyncCallWithArgumentList(QStringLiteral("MouseEvent"), argumentList); | |
75 | 75 | } |
76 | 76 | |
77 | 77 | inline QDBusPendingReply<int> ProcessKeyEvent(uint keyval, uint keycode, uint state, int type, uint time) |
78 | 78 | { |
79 | 79 | QList<QVariant> argumentList; |
80 | 80 | argumentList << QVariant::fromValue(keyval) << QVariant::fromValue(keycode) << QVariant::fromValue(state) << QVariant::fromValue(type) << QVariant::fromValue(time); |
81 | return asyncCallWithArgumentList(QLatin1String("ProcessKeyEvent"), argumentList); | |
81 | return asyncCallWithArgumentList(QStringLiteral("ProcessKeyEvent"), argumentList); | |
82 | 82 | } |
83 | 83 | |
84 | 84 | inline QDBusPendingReply<> Reset() |
85 | 85 | { |
86 | 86 | QList<QVariant> argumentList; |
87 | return asyncCallWithArgumentList(QLatin1String("Reset"), argumentList); | |
87 | return asyncCallWithArgumentList(QStringLiteral("Reset"), argumentList); | |
88 | 88 | } |
89 | 89 | |
90 | 90 | inline QDBusPendingReply<> SetCapacity(uint caps) |
91 | 91 | { |
92 | 92 | QList<QVariant> argumentList; |
93 | 93 | argumentList << QVariant::fromValue(caps); |
94 | return asyncCallWithArgumentList(QLatin1String("SetCapacity"), argumentList); | |
94 | return asyncCallWithArgumentList(QStringLiteral("SetCapacity"), argumentList); | |
95 | 95 | } |
96 | 96 | |
97 | 97 | inline QDBusPendingReply<> SetCursorLocation(int x, int y) |
98 | 98 | { |
99 | 99 | QList<QVariant> argumentList; |
100 | 100 | argumentList << QVariant::fromValue(x) << QVariant::fromValue(y); |
101 | return asyncCallWithArgumentList(QLatin1String("SetCursorLocation"), argumentList); | |
101 | return asyncCallWithArgumentList(QStringLiteral("SetCursorLocation"), argumentList); | |
102 | 102 | } |
103 | 103 | |
104 | 104 | inline QDBusPendingReply<> SetCursorRect(int x, int y, int w, int h) |
105 | 105 | { |
106 | 106 | QList<QVariant> argumentList; |
107 | 107 | argumentList << QVariant::fromValue(x) << QVariant::fromValue(y) << QVariant::fromValue(w) << QVariant::fromValue(h); |
108 | return asyncCallWithArgumentList(QLatin1String("SetCursorRect"), argumentList); | |
108 | return asyncCallWithArgumentList(QStringLiteral("SetCursorRect"), argumentList); | |
109 | 109 | } |
110 | 110 | |
111 | 111 | inline QDBusPendingReply<> SetSurroundingText(const QString &text, uint cursor, uint anchor) |
112 | 112 | { |
113 | 113 | QList<QVariant> argumentList; |
114 | 114 | argumentList << QVariant::fromValue(text) << QVariant::fromValue(cursor) << QVariant::fromValue(anchor); |
115 | return asyncCallWithArgumentList(QLatin1String("SetSurroundingText"), argumentList); | |
115 | return asyncCallWithArgumentList(QStringLiteral("SetSurroundingText"), argumentList); | |
116 | 116 | } |
117 | 117 | |
118 | 118 | inline QDBusPendingReply<> SetSurroundingTextPosition(uint cursor, uint anchor) |
119 | 119 | { |
120 | 120 | QList<QVariant> argumentList; |
121 | 121 | argumentList << QVariant::fromValue(cursor) << QVariant::fromValue(anchor); |
122 | return asyncCallWithArgumentList(QLatin1String("SetSurroundingTextPosition"), argumentList); | |
122 | return asyncCallWithArgumentList(QStringLiteral("SetSurroundingTextPosition"), argumentList); | |
123 | 123 | } |
124 | 124 | |
125 | 125 | Q_SIGNALS: // SIGNALS |
126 | 126 | void CloseIM(); |
127 | 127 | void CommitString(const QString &str); |
128 | void CurrentIM(const QString &name, const QString &uniqueName, const QString &langCode); | |
128 | 129 | void DeleteSurroundingText(int offset, uint nchar); |
129 | 130 | void EnableIM(); |
130 | 131 | void ForwardKey(uint keyval, uint state, int type); |
0 | 0 | /* |
1 | 1 | * This file was generated by qdbusxml2cpp version 0.8 |
2 | * Command line was: qdbusxml2cpp -N -p fcitxqtinputmethodproxy -c FcitxQtInputMethodProxy interfaces/org.fcitx.Fcitx.InputMethod.xml -i fcitxqtinputmethoditem.h -i fcitxqt_export.h | |
2 | * Command line was: qdbusxml2cpp -N -p fcitxqtinputmethodproxy -c FcitxQtInputMethodProxy interfaces/org.fcitx.Fcitx.InputMethod.xml -i fcitxqtinputmethoditem.h -i fcitxqtdbusaddons_export.h | |
3 | 3 | * |
4 | * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). | |
4 | * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd. | |
5 | 5 | * |
6 | 6 | * This is an auto-generated file. |
7 | 7 | * This file may have been hand-edited. Look for HAND-EDIT comments |
0 | 0 | /* |
1 | 1 | * This file was generated by qdbusxml2cpp version 0.8 |
2 | * Command line was: qdbusxml2cpp -N -p fcitxqtinputmethodproxy -c FcitxQtInputMethodProxy interfaces/org.fcitx.Fcitx.InputMethod.xml -i fcitxqtinputmethoditem.h -i fcitxqt_export.h | |
2 | * Command line was: qdbusxml2cpp -N -p fcitxqtinputmethodproxy -c FcitxQtInputMethodProxy interfaces/org.fcitx.Fcitx.InputMethod.xml -i fcitxqtinputmethoditem.h -i fcitxqtdbusaddons_export.h | |
3 | 3 | * |
4 | * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). | |
4 | * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd. | |
5 | 5 | * |
6 | 6 | * This is an auto-generated file. |
7 | 7 | * Do not edit! All changes made to it will be lost. |
8 | 8 | */ |
9 | 9 | |
10 | #ifndef FCITXQTINPUTMETHODPROXY_H_1409252990 | |
11 | #define FCITXQTINPUTMETHODPROXY_H_1409252990 | |
10 | #ifndef FCITXQTINPUTMETHODPROXY_H | |
11 | #define FCITXQTINPUTMETHODPROXY_H | |
12 | 12 | |
13 | 13 | #include <QtCore/QObject> |
14 | 14 | #include <QtCore/QByteArray> |
52 | 52 | inline QDBusPendingReply<> ActivateIM() |
53 | 53 | { |
54 | 54 | QList<QVariant> argumentList; |
55 | return asyncCallWithArgumentList(QLatin1String("ActivateIM"), argumentList); | |
55 | return asyncCallWithArgumentList(QStringLiteral("ActivateIM"), argumentList); | |
56 | 56 | } |
57 | 57 | |
58 | 58 | inline QDBusPendingReply<> Configure() |
59 | 59 | { |
60 | 60 | QList<QVariant> argumentList; |
61 | return asyncCallWithArgumentList(QLatin1String("Configure"), argumentList); | |
61 | return asyncCallWithArgumentList(QStringLiteral("Configure"), argumentList); | |
62 | 62 | } |
63 | 63 | |
64 | 64 | inline QDBusPendingReply<> ConfigureAddon(const QString &addon) |
65 | 65 | { |
66 | 66 | QList<QVariant> argumentList; |
67 | 67 | argumentList << QVariant::fromValue(addon); |
68 | return asyncCallWithArgumentList(QLatin1String("ConfigureAddon"), argumentList); | |
68 | return asyncCallWithArgumentList(QStringLiteral("ConfigureAddon"), argumentList); | |
69 | 69 | } |
70 | 70 | |
71 | 71 | inline QDBusPendingReply<> ConfigureIM(const QString &im) |
72 | 72 | { |
73 | 73 | QList<QVariant> argumentList; |
74 | 74 | argumentList << QVariant::fromValue(im); |
75 | return asyncCallWithArgumentList(QLatin1String("ConfigureIM"), argumentList); | |
75 | return asyncCallWithArgumentList(QStringLiteral("ConfigureIM"), argumentList); | |
76 | 76 | } |
77 | 77 | |
78 | 78 | inline QDBusPendingReply<int, uint, uint, uint, uint> CreateIC() |
79 | 79 | { |
80 | 80 | QList<QVariant> argumentList; |
81 | return asyncCallWithArgumentList(QLatin1String("CreateIC"), argumentList); | |
81 | return asyncCallWithArgumentList(QStringLiteral("CreateIC"), argumentList); | |
82 | 82 | } |
83 | 83 | inline QDBusReply<int> CreateIC(uint &keyval1, uint &state1, uint &keyval2, uint &state2) |
84 | 84 | { |
85 | 85 | QList<QVariant> argumentList; |
86 | QDBusMessage reply = callWithArgumentList(QDBus::Block, QLatin1String("CreateIC"), argumentList); | |
86 | QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("CreateIC"), argumentList); | |
87 | 87 | if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 5) { |
88 | 88 | keyval1 = qdbus_cast<uint>(reply.arguments().at(1)); |
89 | 89 | state1 = qdbus_cast<uint>(reply.arguments().at(2)); |
97 | 97 | { |
98 | 98 | QList<QVariant> argumentList; |
99 | 99 | argumentList << QVariant::fromValue(appname); |
100 | return asyncCallWithArgumentList(QLatin1String("CreateICv2"), argumentList); | |
100 | return asyncCallWithArgumentList(QStringLiteral("CreateICv2"), argumentList); | |
101 | 101 | } |
102 | 102 | inline QDBusReply<int> CreateICv2(const QString &appname, bool &enable, uint &keyval1, uint &state1, uint &keyval2, uint &state2) |
103 | 103 | { |
104 | 104 | QList<QVariant> argumentList; |
105 | 105 | argumentList << QVariant::fromValue(appname); |
106 | QDBusMessage reply = callWithArgumentList(QDBus::Block, QLatin1String("CreateICv2"), argumentList); | |
106 | QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("CreateICv2"), argumentList); | |
107 | 107 | if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 6) { |
108 | 108 | enable = qdbus_cast<bool>(reply.arguments().at(1)); |
109 | 109 | keyval1 = qdbus_cast<uint>(reply.arguments().at(2)); |
118 | 118 | { |
119 | 119 | QList<QVariant> argumentList; |
120 | 120 | argumentList << QVariant::fromValue(appname) << QVariant::fromValue(pid); |
121 | return asyncCallWithArgumentList(QLatin1String("CreateICv3"), argumentList); | |
121 | return asyncCallWithArgumentList(QStringLiteral("CreateICv3"), argumentList); | |
122 | 122 | } |
123 | 123 | inline QDBusReply<int> CreateICv3(const QString &appname, int pid, bool &enable, uint &keyval1, uint &state1, uint &keyval2, uint &state2) |
124 | 124 | { |
125 | 125 | QList<QVariant> argumentList; |
126 | 126 | argumentList << QVariant::fromValue(appname) << QVariant::fromValue(pid); |
127 | QDBusMessage reply = callWithArgumentList(QDBus::Block, QLatin1String("CreateICv3"), argumentList); | |
127 | QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("CreateICv3"), argumentList); | |
128 | 128 | if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 6) { |
129 | 129 | enable = qdbus_cast<bool>(reply.arguments().at(1)); |
130 | 130 | keyval1 = qdbus_cast<uint>(reply.arguments().at(2)); |
138 | 138 | inline QDBusPendingReply<> Exit() |
139 | 139 | { |
140 | 140 | QList<QVariant> argumentList; |
141 | return asyncCallWithArgumentList(QLatin1String("Exit"), argumentList); | |
141 | return asyncCallWithArgumentList(QStringLiteral("Exit"), argumentList); | |
142 | 142 | } |
143 | 143 | |
144 | 144 | inline QDBusPendingReply<QString> GetCurrentIM() |
145 | 145 | { |
146 | 146 | QList<QVariant> argumentList; |
147 | return asyncCallWithArgumentList(QLatin1String("GetCurrentIM"), argumentList); | |
147 | return asyncCallWithArgumentList(QStringLiteral("GetCurrentIM"), argumentList); | |
148 | 148 | } |
149 | 149 | |
150 | 150 | inline QDBusPendingReply<int> GetCurrentState() |
151 | 151 | { |
152 | 152 | QList<QVariant> argumentList; |
153 | return asyncCallWithArgumentList(QLatin1String("GetCurrentState"), argumentList); | |
153 | return asyncCallWithArgumentList(QStringLiteral("GetCurrentState"), argumentList); | |
154 | 154 | } |
155 | 155 | |
156 | 156 | inline QDBusPendingReply<QString> GetCurrentUI() |
157 | 157 | { |
158 | 158 | QList<QVariant> argumentList; |
159 | return asyncCallWithArgumentList(QLatin1String("GetCurrentUI"), argumentList); | |
159 | return asyncCallWithArgumentList(QStringLiteral("GetCurrentUI"), argumentList); | |
160 | 160 | } |
161 | 161 | |
162 | 162 | inline QDBusPendingReply<QString> GetIMAddon(const QString &im) |
163 | 163 | { |
164 | 164 | QList<QVariant> argumentList; |
165 | 165 | argumentList << QVariant::fromValue(im); |
166 | return asyncCallWithArgumentList(QLatin1String("GetIMAddon"), argumentList); | |
166 | return asyncCallWithArgumentList(QStringLiteral("GetIMAddon"), argumentList); | |
167 | 167 | } |
168 | 168 | |
169 | 169 | inline QDBusPendingReply<> InactivateIM() |
170 | 170 | { |
171 | 171 | QList<QVariant> argumentList; |
172 | return asyncCallWithArgumentList(QLatin1String("InactivateIM"), argumentList); | |
172 | return asyncCallWithArgumentList(QStringLiteral("InactivateIM"), argumentList); | |
173 | 173 | } |
174 | 174 | |
175 | 175 | inline QDBusPendingReply<> ReloadAddonConfig(const QString &addon) |
176 | 176 | { |
177 | 177 | QList<QVariant> argumentList; |
178 | 178 | argumentList << QVariant::fromValue(addon); |
179 | return asyncCallWithArgumentList(QLatin1String("ReloadAddonConfig"), argumentList); | |
179 | return asyncCallWithArgumentList(QStringLiteral("ReloadAddonConfig"), argumentList); | |
180 | 180 | } |
181 | 181 | |
182 | 182 | inline QDBusPendingReply<> ReloadConfig() |
183 | 183 | { |
184 | 184 | QList<QVariant> argumentList; |
185 | return asyncCallWithArgumentList(QLatin1String("ReloadConfig"), argumentList); | |
185 | return asyncCallWithArgumentList(QStringLiteral("ReloadConfig"), argumentList); | |
186 | 186 | } |
187 | 187 | |
188 | 188 | inline QDBusPendingReply<> ResetIMList() |
189 | 189 | { |
190 | 190 | QList<QVariant> argumentList; |
191 | return asyncCallWithArgumentList(QLatin1String("ResetIMList"), argumentList); | |
191 | return asyncCallWithArgumentList(QStringLiteral("ResetIMList"), argumentList); | |
192 | 192 | } |
193 | 193 | |
194 | 194 | inline QDBusPendingReply<> Restart() |
195 | 195 | { |
196 | 196 | QList<QVariant> argumentList; |
197 | return asyncCallWithArgumentList(QLatin1String("Restart"), argumentList); | |
197 | return asyncCallWithArgumentList(QStringLiteral("Restart"), argumentList); | |
198 | 198 | } |
199 | 199 | |
200 | 200 | inline QDBusPendingReply<> SetCurrentIM(const QString &im) |
201 | 201 | { |
202 | 202 | QList<QVariant> argumentList; |
203 | 203 | argumentList << QVariant::fromValue(im); |
204 | return asyncCallWithArgumentList(QLatin1String("SetCurrentIM"), argumentList); | |
204 | return asyncCallWithArgumentList(QStringLiteral("SetCurrentIM"), argumentList); | |
205 | 205 | } |
206 | 206 | |
207 | 207 | inline QDBusPendingReply<> ToggleIM() |
208 | 208 | { |
209 | 209 | QList<QVariant> argumentList; |
210 | return asyncCallWithArgumentList(QLatin1String("ToggleIM"), argumentList); | |
210 | return asyncCallWithArgumentList(QStringLiteral("ToggleIM"), argumentList); | |
211 | 211 | } |
212 | 212 | |
213 | 213 | Q_SIGNALS: // SIGNALS |
0 | 0 | /* |
1 | 1 | * This file was generated by qdbusxml2cpp version 0.8 |
2 | * Command line was: qdbusxml2cpp -N -p fcitxqtkeyboardproxy -c FcitxQtKeyboardProxy interfaces/org.fcitx.Fcitx.Keyboard.xml -i fcitxqtkeyboardlayout.h -i fcitxqt_export.h | |
2 | * Command line was: qdbusxml2cpp -N -p fcitxqtkeyboardproxy -c FcitxQtKeyboardProxy interfaces/org.fcitx.Fcitx.Keyboard.xml -i fcitxqtkeyboardlayout.h -i fcitxqtdbusaddons_export.h | |
3 | 3 | * |
4 | * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). | |
4 | * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd. | |
5 | 5 | * |
6 | 6 | * This is an auto-generated file. |
7 | 7 | * This file may have been hand-edited. Look for HAND-EDIT comments |
0 | 0 | /* |
1 | 1 | * This file was generated by qdbusxml2cpp version 0.8 |
2 | * Command line was: qdbusxml2cpp -N -p fcitxqtkeyboardproxy -c FcitxQtKeyboardProxy interfaces/org.fcitx.Fcitx.Keyboard.xml -i fcitxqtkeyboardlayout.h -i fcitxqt_export.h | |
2 | * Command line was: qdbusxml2cpp -N -p fcitxqtkeyboardproxy -c FcitxQtKeyboardProxy interfaces/org.fcitx.Fcitx.Keyboard.xml -i fcitxqtkeyboardlayout.h -i fcitxqtdbusaddons_export.h | |
3 | 3 | * |
4 | * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). | |
4 | * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd. | |
5 | 5 | * |
6 | 6 | * This is an auto-generated file. |
7 | 7 | * Do not edit! All changes made to it will be lost. |
8 | 8 | */ |
9 | 9 | |
10 | #ifndef FCITXQTKEYBOARDPROXY_H_1409252990 | |
11 | #define FCITXQTKEYBOARDPROXY_H_1409252990 | |
10 | #ifndef FCITXQTKEYBOARDPROXY_H | |
11 | #define FCITXQTKEYBOARDPROXY_H | |
12 | 12 | |
13 | 13 | #include <QtCore/QObject> |
14 | 14 | #include <QtCore/QByteArray> |
41 | 41 | { |
42 | 42 | QList<QVariant> argumentList; |
43 | 43 | argumentList << QVariant::fromValue(im); |
44 | return asyncCallWithArgumentList(QLatin1String("GetLayoutForIM"), argumentList); | |
44 | return asyncCallWithArgumentList(QStringLiteral("GetLayoutForIM"), argumentList); | |
45 | 45 | } |
46 | 46 | inline QDBusReply<QString> GetLayoutForIM(const QString &im, QString &variant) |
47 | 47 | { |
48 | 48 | QList<QVariant> argumentList; |
49 | 49 | argumentList << QVariant::fromValue(im); |
50 | QDBusMessage reply = callWithArgumentList(QDBus::Block, QLatin1String("GetLayoutForIM"), argumentList); | |
50 | QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("GetLayoutForIM"), argumentList); | |
51 | 51 | if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 2) { |
52 | 52 | variant = qdbus_cast<QString>(reply.arguments().at(1)); |
53 | 53 | } |
57 | 57 | inline QDBusPendingReply<FcitxQtKeyboardLayoutList> GetLayouts() |
58 | 58 | { |
59 | 59 | QList<QVariant> argumentList; |
60 | return asyncCallWithArgumentList(QLatin1String("GetLayouts"), argumentList); | |
60 | return asyncCallWithArgumentList(QStringLiteral("GetLayouts"), argumentList); | |
61 | 61 | } |
62 | 62 | |
63 | 63 | inline QDBusPendingReply<> SetLayoutForIM(const QString &im, const QString &layout, const QString &variant) |
64 | 64 | { |
65 | 65 | QList<QVariant> argumentList; |
66 | 66 | argumentList << QVariant::fromValue(im) << QVariant::fromValue(layout) << QVariant::fromValue(variant); |
67 | return asyncCallWithArgumentList(QLatin1String("SetLayoutForIM"), argumentList); | |
67 | return asyncCallWithArgumentList(QStringLiteral("SetLayoutForIM"), argumentList); | |
68 | 68 | } |
69 | 69 | |
70 | 70 | Q_SIGNALS: // SIGNALS |
0 | 0 | #!/bin/sh |
1 | 1 | |
2 | qdbusxml2cpp-qt5 -N -p fcitxqtinputcontextproxy -c FcitxQtInputContextProxy interfaces/org.fcitx.Fcitx.InputContext.xml -i fcitxqtformattedpreedit.h -i fcitxqt_export.h | |
3 | qdbusxml2cpp-qt5 -N -p fcitxqtinputmethodproxy -c FcitxQtInputMethodProxy interfaces/org.fcitx.Fcitx.InputMethod.xml -i fcitxqtinputmethoditem.h -i fcitxqt_export.h | |
4 | qdbusxml2cpp-qt5 -N -p fcitxqtkeyboardproxy -c FcitxQtKeyboardProxy interfaces/org.fcitx.Fcitx.Keyboard.xml -i fcitxqtkeyboardlayout.h -i fcitxqt_export.h | |
2 | qdbusxml2cpp-qt5 -N -p fcitxqtinputcontextproxy -c FcitxQtInputContextProxy interfaces/org.fcitx.Fcitx.InputContext.xml -i fcitxqtformattedpreedit.h -i fcitxqtdbusaddons_export.h | |
3 | qdbusxml2cpp-qt5 -N -p fcitxqtinputmethodproxy -c FcitxQtInputMethodProxy interfaces/org.fcitx.Fcitx.InputMethod.xml -i fcitxqtinputmethoditem.h -i fcitxqtdbusaddons_export.h | |
4 | qdbusxml2cpp-qt5 -N -p fcitxqtkeyboardproxy -c FcitxQtKeyboardProxy interfaces/org.fcitx.Fcitx.Keyboard.xml -i fcitxqtkeyboardlayout.h -i fcitxqtdbusaddons_export.h |
53 | 53 | <signal name="CommitString"> |
54 | 54 | <arg name="str" type="s"/> |
55 | 55 | </signal> |
56 | <signal name="CurrentIM"> | |
57 | <arg name="name" type="s"/> | |
58 | <arg name="uniqueName" type="s"/> | |
59 | <arg name="langCode" type="s"/> | |
60 | </signal> | |
56 | 61 | <signal name="UpdateFormattedPreedit"> |
57 | 62 | <arg name="str" type="a(si)" /> |
58 | 63 | <arg name="cursorpos" type="i"/> |
48 | 48 | { |
49 | 49 | const char *value = getenv(name); |
50 | 50 | |
51 | if (value == NULL) | |
51 | if (value == nullptr) | |
52 | 52 | return defval; |
53 | 53 | |
54 | 54 | if (strcmp(value, "") == 0 || |
87 | 87 | |
88 | 88 | QFcitxPlatformInputContext::QFcitxPlatformInputContext() : |
89 | 89 | m_connection(new FcitxQtConnection(this)), |
90 | m_improxy(0), | |
91 | m_n_compose(0), | |
90 | m_improxy(nullptr), | |
92 | 91 | m_cursorPos(0), |
93 | 92 | m_useSurroundingText(false), |
94 | m_syncMode(true), | |
93 | m_syncMode(get_boolean_env("FCITX_QT_USE_SYNC", false)), | |
95 | 94 | m_lastWId(0), |
96 | 95 | m_destroy(false), |
97 | 96 | m_xkbContext(_xkb_context_new_helper()), |
100 | 99 | { |
101 | 100 | FcitxQtFormattedPreedit::registerMetaType(); |
102 | 101 | |
103 | memset(m_compose_buffer, 0, sizeof(uint) * (MAX_COMPOSE_LEN + 1)); | |
104 | 102 | connect(m_connection, SIGNAL(connected()), this, SLOT(connected())); |
105 | 103 | connect(m_connection, SIGNAL(disconnected()), this, SLOT(cleanUp())); |
106 | 104 | |
121 | 119 | // qDebug() << "create Input Context" << m_connection->name(); |
122 | 120 | if (m_improxy) { |
123 | 121 | delete m_improxy; |
124 | m_improxy = 0; | |
122 | m_improxy = nullptr; | |
125 | 123 | } |
126 | 124 | m_improxy = new FcitxQtInputMethodProxy(m_connection->serviceName(), QLatin1String("/inputmethod"), *m_connection->connection(), this); |
127 | 125 | |
132 | 130 | |
133 | 131 | void QFcitxPlatformInputContext::cleanUp() |
134 | 132 | { |
135 | for(QHash<WId, FcitxQtICData *>::const_iterator i = m_icMap.constBegin(), | |
136 | e = m_icMap.constEnd(); i != e; ++i) { | |
137 | FcitxQtICData* data = i.value(); | |
138 | ||
139 | if (data->proxy) | |
140 | delete data->proxy; | |
141 | } | |
142 | ||
143 | 133 | m_icMap.clear(); |
144 | 134 | |
145 | 135 | if (m_improxy) { |
146 | 136 | delete m_improxy; |
147 | m_improxy = 0; | |
137 | m_improxy = nullptr; | |
148 | 138 | } |
149 | 139 | |
150 | 140 | if (!m_destroy) { |
201 | 191 | if (!proxy) |
202 | 192 | return; |
203 | 193 | |
204 | FcitxQtICData* data = m_icMap.value(window->winId()); | |
205 | ||
206 | QInputMethod *method = qApp->inputMethod(); | |
194 | auto &data = m_icMap[window->winId()]; | |
195 | ||
207 | 196 | QObject *input = qApp->focusObject(); |
208 | 197 | if (!input) |
209 | 198 | return; |
244 | 233 | break; |
245 | 234 | if (!((queries & Qt::ImSurroundingText) && (queries & Qt::ImCursorPosition))) |
246 | 235 | break; |
247 | if (data->capacity.testFlag(CAPACITY_PASSWORD)) | |
236 | if (data.capacity.testFlag(CAPACITY_PASSWORD)) | |
248 | 237 | break; |
249 | 238 | QVariant var = query.value(Qt::ImSurroundingText); |
250 | 239 | QVariant var1 = query.value(Qt::ImCursorPosition); |
264 | 253 | anchor = var2.toInt(); |
265 | 254 | else |
266 | 255 | anchor = cursor; |
267 | if (data->surroundingText != text) { | |
268 | data->surroundingText = text; | |
256 | if (data.surroundingText != text) { | |
257 | data.surroundingText = text; | |
269 | 258 | proxy->SetSurroundingText(text, cursor, anchor); |
270 | 259 | } |
271 | 260 | else { |
272 | if (data->surroundingAnchor != anchor || | |
273 | data->surroundingCursor != cursor) | |
261 | if (data.surroundingAnchor != anchor || | |
262 | data.surroundingCursor != cursor) | |
274 | 263 | proxy->SetSurroundingTextPosition(cursor, anchor); |
275 | 264 | } |
276 | data->surroundingCursor = cursor; | |
277 | data->surroundingAnchor = anchor; | |
265 | data.surroundingCursor = cursor; | |
266 | data.surroundingAnchor = anchor; | |
278 | 267 | setSurrounding = true; |
279 | 268 | } |
280 | 269 | } |
281 | 270 | if (!setSurrounding) { |
282 | data->surroundingAnchor = -1; | |
283 | data->surroundingCursor = -1; | |
284 | data->surroundingText = QString::null; | |
271 | data.surroundingAnchor = -1; | |
272 | data.surroundingCursor = -1; | |
273 | data.surroundingText = QString::null; | |
285 | 274 | removeCapacity(data, CAPACITY_SURROUNDING_TEXT); |
286 | 275 | } |
287 | 276 | } while(0); |
310 | 299 | if (proxy) |
311 | 300 | proxy->FocusIn(); |
312 | 301 | else { |
313 | FcitxQtICData* data = m_icMap.value(window->winId()); | |
314 | if (!data) { | |
315 | createICData(window); | |
316 | return; | |
317 | } | |
302 | createICData(window); | |
318 | 303 | } |
319 | 304 | } |
320 | 305 | |
321 | 306 | void QFcitxPlatformInputContext::windowDestroyed(QObject* object) |
322 | 307 | { |
323 | 308 | /* access QWindow is not possible here, so we use our own map to do so */ |
324 | WId wid = m_windowToWidMap.take(object); | |
325 | if (!wid) | |
326 | return; | |
327 | FcitxQtICData* data = m_icMap.take(wid); | |
328 | if (!data) | |
329 | return; | |
330 | ||
331 | delete data; | |
309 | auto iter = m_windowToWidMap.find(object); | |
310 | if (iter == m_windowToWidMap.end()) | |
311 | return; | |
312 | auto wid = iter->second; | |
313 | m_windowToWidMap.erase(iter); | |
314 | m_icMap.erase(wid); | |
332 | 315 | // qDebug() << "Window Destroyed and we destroy IC correctly, horray!"; |
333 | 316 | } |
334 | 317 | |
341 | 324 | if (!proxy) |
342 | 325 | return; |
343 | 326 | |
344 | FcitxQtICData* data = m_icMap.value(inputWindow->winId()); | |
327 | auto& data = m_icMap[inputWindow->winId()]; | |
345 | 328 | |
346 | 329 | QRect r = qApp->inputMethod()->cursorRectangle().toRect(); |
347 | 330 | if(!r.isValid()) |
350 | 333 | r.moveTopLeft(inputWindow->mapToGlobal(r.topLeft())); |
351 | 334 | |
352 | 335 | qreal scale = inputWindow->devicePixelRatio(); |
353 | if (data->rect != r) { | |
354 | data->rect = r; | |
336 | if (data.rect != r) { | |
337 | data.rect = r; | |
355 | 338 | proxy->SetCursorRect(r.x() * scale, r.y() * scale, |
356 | 339 | r.width() * scale, r.height() * scale); |
357 | 340 | } |
364 | 347 | |
365 | 348 | // qDebug() << "create Input Context" << m_connection->connection()->name(); |
366 | 349 | |
367 | if (m_improxy) { | |
368 | delete m_improxy; | |
369 | m_improxy = NULL; | |
370 | } | |
371 | m_improxy = new FcitxQtInputMethodProxy(m_connection->serviceName(), QLatin1String("/inputmethod"), *m_connection->connection(), this); | |
350 | if (!m_improxy) { | |
351 | m_improxy = new FcitxQtInputMethodProxy(m_connection->serviceName(), QLatin1String("/inputmethod"), *m_connection->connection(), this); | |
352 | } | |
372 | 353 | |
373 | 354 | if (!m_improxy->isValid()) |
374 | 355 | return; |
383 | 364 | void QFcitxPlatformInputContext::createInputContextFinished(QDBusPendingCallWatcher* watcher) |
384 | 365 | { |
385 | 366 | WId w = watcher->property("wid").toULongLong(); |
386 | FcitxQtICData* data = m_icMap.value(w); | |
387 | if (!data) | |
388 | return; | |
367 | auto iter = m_icMap.find(w); | |
368 | if (iter == m_icMap.end()) { | |
369 | return; | |
370 | } | |
371 | ||
372 | auto &data = iter->second; | |
389 | 373 | |
390 | 374 | QDBusPendingReply< int, bool, uint, uint, uint, uint > result = *watcher; |
391 | 375 | |
399 | 383 | |
400 | 384 | int id = qdbus_cast<int>(result.argumentAt(0)); |
401 | 385 | QString path = QString("/inputcontext_%1").arg(id); |
402 | if (data->proxy) { | |
403 | delete data->proxy; | |
404 | } | |
405 | data->proxy = new FcitxQtInputContextProxy(m_connection->serviceName(), path, *m_connection->connection(), this); | |
406 | connect(data->proxy, SIGNAL(CommitString(QString)), this, SLOT(commitString(QString))); | |
407 | connect(data->proxy, SIGNAL(ForwardKey(uint, uint, int)), this, SLOT(forwardKey(uint, uint, int))); | |
408 | connect(data->proxy, SIGNAL(UpdateFormattedPreedit(FcitxQtFormattedPreeditList,int)), this, SLOT(updateFormattedPreedit(FcitxQtFormattedPreeditList,int))); | |
409 | connect(data->proxy, SIGNAL(DeleteSurroundingText(int,uint)), this, SLOT(deleteSurroundingText(int,uint))); | |
410 | ||
411 | if (data->proxy->isValid()) { | |
386 | if (data.proxy) { | |
387 | delete data.proxy; | |
388 | } | |
389 | data.proxy = new FcitxQtInputContextProxy(m_connection->serviceName(), path, *m_connection->connection(), this); | |
390 | connect(data.proxy, SIGNAL(CommitString(QString)), this, SLOT(commitString(QString))); | |
391 | connect(data.proxy, SIGNAL(ForwardKey(uint, uint, int)), this, SLOT(forwardKey(uint, uint, int))); | |
392 | connect(data.proxy, SIGNAL(UpdateFormattedPreedit(FcitxQtFormattedPreeditList,int)), this, SLOT(updateFormattedPreedit(FcitxQtFormattedPreeditList,int))); | |
393 | connect(data.proxy, SIGNAL(DeleteSurroundingText(int,uint)), this, SLOT(deleteSurroundingText(int,uint))); | |
394 | connect(data.proxy, SIGNAL(CurrentIM(QString,QString,QString)), this, SLOT(updateCurrentIM(QString,QString,QString))); | |
395 | ||
396 | if (data.proxy->isValid()) { | |
412 | 397 | QWindow* window = qApp->focusWindow(); |
413 | 398 | if (window && window->winId() == w) |
414 | data->proxy->FocusIn(); | |
399 | data.proxy->FocusIn(); | |
415 | 400 | } |
416 | 401 | |
417 | 402 | QFlags<FcitxCapacityFlags> flag; |
418 | 403 | flag |= CAPACITY_PREEDIT; |
419 | 404 | flag |= CAPACITY_FORMATTED_PREEDIT; |
420 | 405 | flag |= CAPACITY_CLIENT_UNFOCUS_COMMIT; |
406 | flag |= CAPACITY_GET_IM_INFO_ON_FOCUS; | |
421 | 407 | m_useSurroundingText = get_boolean_env("FCITX_QT_ENABLE_SURROUNDING_TEXT", true); |
422 | 408 | if (m_useSurroundingText) |
423 | 409 | flag |= CAPACITY_SURROUNDING_TEXT; |
424 | 410 | |
425 | /* | |
426 | * event loop will cause some problem, so we tries to use async way. | |
427 | */ | |
428 | m_syncMode = get_boolean_env("FCITX_QT_USE_SYNC", false); | |
429 | ||
430 | 411 | addCapacity(data, flag, true); |
431 | 412 | } while(0); |
432 | 413 | delete watcher; |
433 | 414 | } |
434 | 415 | |
435 | void QFcitxPlatformInputContext::updateCapacity(FcitxQtICData* data) | |
436 | { | |
437 | if (!data->proxy || !data->proxy->isValid()) | |
438 | return; | |
439 | ||
440 | QDBusPendingReply< void > result = data->proxy->SetCapacity((uint) data->capacity); | |
416 | void QFcitxPlatformInputContext::updateCapacity(const FcitxQtICData &data) | |
417 | { | |
418 | if (!data.proxy || !data.proxy->isValid()) | |
419 | return; | |
420 | ||
421 | QDBusPendingReply< void > result = data.proxy->SetCapacity((uint) data.capacity); | |
441 | 422 | } |
442 | 423 | |
443 | 424 | void QFcitxPlatformInputContext::commitString(const QString& str) |
512 | 493 | void QFcitxPlatformInputContext::forwardKey(uint keyval, uint state, int type) |
513 | 494 | { |
514 | 495 | QObject *input = qApp->focusObject(); |
515 | if (input != NULL) { | |
496 | if (input != nullptr) { | |
516 | 497 | key_filtered = true; |
517 | 498 | QKeyEvent *keyevent = createKeyEvent(keyval, state, type); |
518 | 499 | QCoreApplication::sendEvent(input, keyevent); |
521 | 502 | } |
522 | 503 | } |
523 | 504 | |
505 | void QFcitxPlatformInputContext::updateCurrentIM(const QString& name, const QString& uniqueName, const QString& langCode) | |
506 | { | |
507 | Q_UNUSED(name); | |
508 | Q_UNUSED(uniqueName); | |
509 | QLocale newLocale(langCode); | |
510 | if (m_locale != newLocale) { | |
511 | m_locale = newLocale; | |
512 | emitLocaleChanged(); | |
513 | } | |
514 | } | |
515 | ||
516 | QLocale QFcitxPlatformInputContext::locale() const | |
517 | { | |
518 | return m_locale; | |
519 | } | |
520 | ||
524 | 521 | void QFcitxPlatformInputContext::createICData(QWindow* w) |
525 | 522 | { |
526 | FcitxQtICData* data = m_icMap.value(w->winId()); | |
527 | if (!data) { | |
528 | data = new FcitxQtICData; | |
529 | m_icMap[w->winId()] = data; | |
523 | auto iter = m_icMap.find(w->winId()); | |
524 | if (iter == m_icMap.end()) { | |
525 | m_icMap.emplace(std::piecewise_construct, std::forward_as_tuple(w->winId()), std::forward_as_tuple()); | |
530 | 526 | m_windowToWidMap[w] = w->winId(); |
531 | 527 | connect(w, SIGNAL(destroyed(QObject*)), this, SLOT(windowDestroyed(QObject*))); |
532 | 528 | } |
697 | 693 | |
698 | 694 | FcitxQtInputContextProxy* QFcitxPlatformInputContext::validIC() |
699 | 695 | { |
700 | if (m_icMap.isEmpty()) { | |
696 | if (m_icMap.empty()) { | |
701 | 697 | return 0; |
702 | 698 | } |
703 | 699 | QWindow* window = qApp->focusWindow(); |
706 | 702 | |
707 | 703 | FcitxQtInputContextProxy* QFcitxPlatformInputContext::validICByWId(WId wid) |
708 | 704 | { |
709 | if (m_icMap.isEmpty()) { | |
710 | return 0; | |
711 | } | |
712 | FcitxQtICData* icData = m_icMap.value(wid); | |
713 | if (!icData) | |
714 | return 0; | |
715 | if (icData->proxy.isNull()) { | |
716 | return 0; | |
717 | } else if (icData->proxy->isValid()) { | |
718 | return icData->proxy.data(); | |
719 | } | |
720 | return 0; | |
705 | if (m_icMap.empty()) { | |
706 | return nullptr; | |
707 | } | |
708 | auto iter = m_icMap.find(wid); | |
709 | if (iter == m_icMap.end()) | |
710 | return nullptr; | |
711 | auto &data = iter->second; | |
712 | if (data.proxy.isNull()) { | |
713 | return nullptr; | |
714 | } else if (data.proxy->isValid()) { | |
715 | return data.proxy.data(); | |
716 | } | |
717 | return nullptr; | |
721 | 718 | } |
722 | 719 | |
723 | 720 | FcitxQtInputContextProxy* QFcitxPlatformInputContext::validICByWindow(QWindow* w) |
726 | 723 | return 0; |
727 | 724 | } |
728 | 725 | |
729 | if (m_icMap.isEmpty()) { | |
726 | if (m_icMap.empty()) { | |
730 | 727 | return 0; |
731 | 728 | } |
732 | 729 | return validICByWId(w->winId()); |
27 | 27 | #include <QPointer> |
28 | 28 | #include <QFileSystemWatcher> |
29 | 29 | #include <QRect> |
30 | #include <unordered_map> | |
30 | 31 | #include <xkbcommon/xkbcommon-compose.h> |
31 | 32 | #include "fcitxqtformattedpreedit.h" |
32 | 33 | #include "fcitxqtinputcontextproxy.h" |
33 | ||
34 | #define MAX_COMPOSE_LEN 7 | |
35 | 34 | |
36 | 35 | class FcitxQtConnection; |
37 | 36 | class QFileSystemWatcher; |
64 | 63 | CAPACITY_UPPERCASE_WORDS = (1 << 19), |
65 | 64 | CAPACITY_UPPERCASE_SENTENCES = (1 << 20), |
66 | 65 | CAPACITY_ALPHA = (1 << 21), |
67 | CAPACITY_NAME = (1 << 22) | |
66 | CAPACITY_NAME = (1 << 22), | |
67 | CAPACITY_GET_IM_INFO_ON_FOCUS = (1 << 23), | |
68 | 68 | } ; |
69 | 69 | |
70 | 70 | /** message type and flags */ |
109 | 109 | |
110 | 110 | struct FcitxQtICData { |
111 | 111 | FcitxQtICData() : capacity(0), proxy(0), surroundingAnchor(-1), surroundingCursor(-1) {} |
112 | FcitxQtICData(const FcitxQtICData& that) = delete; | |
112 | 113 | ~FcitxQtICData() { |
113 | if (proxy && proxy->isValid()) { | |
114 | proxy->DestroyIC(); | |
114 | if (proxy) { | |
115 | if (proxy->isValid()) { | |
116 | proxy->DestroyIC(); | |
117 | } | |
115 | 118 | delete proxy; |
116 | 119 | } |
117 | 120 | } |
186 | 189 | QFcitxPlatformInputContext(); |
187 | 190 | virtual ~QFcitxPlatformInputContext(); |
188 | 191 | |
189 | virtual bool filterEvent(const QEvent* event); | |
190 | virtual bool isValid() const; | |
191 | virtual void invokeAction(QInputMethod::Action , int cursorPosition); | |
192 | virtual void reset(); | |
193 | virtual void commit(); | |
194 | virtual void update(Qt::InputMethodQueries quries ); | |
195 | virtual void setFocusObject(QObject* object); | |
196 | ||
192 | virtual bool filterEvent(const QEvent* event) Q_DECL_OVERRIDE; | |
193 | virtual bool isValid() const Q_DECL_OVERRIDE; | |
194 | virtual void invokeAction(QInputMethod::Action , int cursorPosition) Q_DECL_OVERRIDE; | |
195 | virtual void reset() Q_DECL_OVERRIDE; | |
196 | virtual void commit() Q_DECL_OVERRIDE; | |
197 | virtual void update(Qt::InputMethodQueries quries ) Q_DECL_OVERRIDE; | |
198 | virtual void setFocusObject(QObject* object) Q_DECL_OVERRIDE; | |
199 | virtual QLocale locale() const Q_DECL_OVERRIDE; | |
197 | 200 | |
198 | 201 | public Q_SLOTS: |
199 | 202 | void cursorRectChanged(); |
205 | 208 | void connected(); |
206 | 209 | void cleanUp(); |
207 | 210 | void windowDestroyed(QObject* object); |
211 | void updateCurrentIM(const QString &name, const QString &uniqueName, const QString &langCode); | |
208 | 212 | |
209 | 213 | |
210 | 214 | private: |
211 | 215 | void createInputContext(WId w); |
212 | 216 | bool processCompose(uint keyval, uint state, FcitxKeyEventType event); |
213 | bool checkAlgorithmically(); | |
214 | bool checkCompactTable(const struct _FcitxComposeTableCompact *table); | |
215 | 217 | QKeyEvent* createKeyEvent(uint keyval, uint state, int type); |
216 | 218 | |
217 | ||
218 | void addCapacity(FcitxQtICData* data, QFlags<FcitxCapacityFlags> capacity, bool forceUpdate = false) | |
219 | { | |
220 | QFlags< FcitxCapacityFlags > newcaps = data->capacity | capacity; | |
221 | if (data->capacity != newcaps || forceUpdate) { | |
222 | data->capacity = newcaps; | |
219 | void addCapacity(FcitxQtICData &data, QFlags<FcitxCapacityFlags> capacity, bool forceUpdate = false) | |
220 | { | |
221 | QFlags< FcitxCapacityFlags > newcaps = data.capacity | capacity; | |
222 | if (data.capacity != newcaps || forceUpdate) { | |
223 | data.capacity = newcaps; | |
223 | 224 | updateCapacity(data); |
224 | 225 | } |
225 | 226 | } |
226 | 227 | |
227 | void removeCapacity(FcitxQtICData* data, QFlags<FcitxCapacityFlags> capacity, bool forceUpdate = false) | |
228 | { | |
229 | QFlags< FcitxCapacityFlags > newcaps = data->capacity & (~capacity); | |
230 | if (data->capacity != newcaps || forceUpdate) { | |
231 | data->capacity = newcaps; | |
228 | void removeCapacity(FcitxQtICData &data, QFlags<FcitxCapacityFlags> capacity, bool forceUpdate = false) | |
229 | { | |
230 | QFlags< FcitxCapacityFlags > newcaps = data.capacity & (~capacity); | |
231 | if (data.capacity != newcaps || forceUpdate) { | |
232 | data.capacity = newcaps; | |
232 | 233 | updateCapacity(data); |
233 | 234 | } |
234 | 235 | } |
235 | 236 | |
236 | void updateCapacity(FcitxQtICData* data); | |
237 | void updateCapacity(const FcitxQtICData &data); | |
237 | 238 | void commitPreedit(); |
238 | 239 | void createICData(QWindow* w); |
239 | 240 | FcitxQtInputContextProxy* validIC(); |
241 | 242 | FcitxQtInputContextProxy* validICByWId(WId wid); |
242 | 243 | bool filterEventFallback(uint keyval, uint keycode, uint state, bool press); |
243 | 244 | |
245 | FcitxQtConnection* m_connection; | |
244 | 246 | FcitxQtInputMethodProxy* m_improxy; |
245 | uint m_compose_buffer[MAX_COMPOSE_LEN + 1]; | |
246 | int m_n_compose; | |
247 | 247 | QString m_preedit; |
248 | 248 | QString m_commitPreedit; |
249 | 249 | FcitxQtFormattedPreeditList m_preeditList; |
250 | 250 | int m_cursorPos; |
251 | 251 | bool m_useSurroundingText; |
252 | 252 | bool m_syncMode; |
253 | FcitxQtConnection* m_connection; | |
254 | 253 | QString m_lastSurroundingText; |
255 | 254 | int m_lastSurroundingAnchor; |
256 | 255 | int m_lastSurroundingCursor; |
257 | QHash<WId, FcitxQtICData*> m_icMap; | |
258 | QHash<QObject*, WId> m_windowToWidMap; | |
256 | std::unordered_map<WId, FcitxQtICData> m_icMap; | |
257 | std::unordered_map<QObject*, WId> m_windowToWidMap; | |
259 | 258 | WId m_lastWId; |
260 | 259 | bool m_destroy; |
261 | 260 | QScopedPointer<struct xkb_context, XkbContextDeleter> m_xkbContext; |
262 | 261 | QScopedPointer<struct xkb_compose_table, XkbComposeTableDeleter> m_xkbComposeTable; |
263 | 262 | QScopedPointer<struct xkb_compose_state, XkbComposeStateDeleter> m_xkbComposeState; |
263 | QLocale m_locale; | |
264 | 264 | private slots: |
265 | 265 | void processKeyEventFinished(QDBusPendingCallWatcher*); |
266 | 266 | }; |
0 | link_directories( | |
1 | ${FCITX_UTILS_LIBRARY_DIRS} | |
2 | ${FCITX_CONFIG_LIBRARY_DIRS} | |
3 | ) | |
4 | ||
0 | 5 | ecm_setup_version(${FcitxQt5_VERSION} VARIABLE_PREFIX FCITXQT5WIDGETSADDONS |
1 | 6 | VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/fcitxqtwidgetsaddons_version.h" |
2 | 7 | PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/FcitxQt5WidgetsAddonsConfigVersion.cmake" |