aboutsummaryrefslogtreecommitdiffstats
path: root/src/virtualkeyboard/doc/src/build.qdoc
blob: d72236fa7614f067ef6ff8a62cbec58e0b044384 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!

\page qtvirtualkeyboard-build.html
\contentspage {Building Qt Virtual Keyboard} {Contents}

\title Building Qt Virtual Keyboard

\section1 Overview

This document describes how to build the Qt Virtual Keyboard plugin.

The project is split into the following subprojects:
\table
\row
    \li \e examples/virtualkeyboard/basic/basic.pro
    \li Qt Virtual Keyboard Demo application
\row
    \li \e src/virtualkeyboard/virtualkeyboard.pro
    \li Qt Virtual Keyboard plugin
\row
    \li \e src/virtualkeyboard/styles/styles.pro
    \li Qt Virtual Keyboard Style plugin that enables style decorations for the
        keyboard
\row
    \li \e src/virtualkeyboard/3rdparty/hunspell/hunspell.pro
    \li A project file for compiling the Hunspell library.
    \note This project is used if the Hunspell library is built from
          sources rather than depending on the system library. The project
          will be activated when the source code is extracted to this
          directory.
\row
    \li \e src/virtualkeyboard/3rdparty/lipi-toolkit/lipi-toolkit.pro
    \li A project file for compiling the lipi-toolkit library.
\row
    \li \e src/virtualkeyboard/3rdparty/openwnn/openwnn.pro
    \li A project file for compiling the OpenWNN library.
\row
    \li \e src/virtualkeyboard/3rdparty/pinyin/pinyin.pro
    \li A project file for compiling the PinyinIME library.
\row
    \li \e src/virtualkeyboard/3rdparty/t9write/t9write.pro
    \li A project file for including T9 Write dictionaries as resources.
\row
    \li \e src/virtualkeyboard/3rdparty/tcime/tcime.pro
    \li A project file for compiling the TCIME library.
\endtable

The input methods are implemented either in C++ or QML.
Qt Virtual Keyboard provides implementations of \e PlainInputMethod,
\e MultitapInputMethod and \e HunspellInputMethod.
The \e MultitapInputMethod is implemented in QML while the others are implemented
in C++.

\section1 Build Instructions

The Qt Virtual Keyboard can be built for Linux Desktop/X11, Windows Desktop
or Boot2Qt targets.
The target is automatically detected by QMAKE and requires no special
configuration parameters.

Qt Creator is the preferred build environment for Qt Virtual Keyboard as you
can then leverage the shadow build functionality and rapidly switch between
build targets.

\section2 Configuration Options

The table below contains the top-level options for configuring the virtual
keyboard features.

\table
\header
    \li CONFIG
    \li Description
    \li Remarks
\row
    \li \e lang-<code>
    \li Enables the specified language
    \li The specified language can be activated using \e lang-<code> option, which
        has the format "language[_country]", where:
        \list
            \li language is a lowercase, two-letter, ISO 639 language code
            \li country is an uppercase, two-letter, ISO 3166 country code
        \endlist

        This option can be used to define the language support as required. The virtual
        keyboard can support one or more languages at a time.

        For example, \c CONFIG+=lang-fi_FI activates the Finnish language.

        The virtual keyboard automatically includes all languages if no other languages
        are specified.
\row
    \li \e lang-all
    \li Enables all the languages
    \li Enables all the languages supported by the virtual keyboard. This flag is essentially
        an alias for \c {CONFIG+="lang-ar_AR lang-da_DK ..."}

        This option is enabled by default. To build only a specific language, use the
        \c lang-<code> option above.
\row
    \li \e handwriting
    \li Enables handwriting input
    \li This flag enables handwriting input using the first engine available at
        build time in the following order: \c t9write, \c lipi-toolkit. To enable handwriting
        input using a specific engine, use the feature-specific configuration instead.
        For example, \c CONFIG+=lipi-toolkit.
\row
    \li \e arrow-key-navigation
    \li Enables arrow key navigation for the keyboard
    \li Allows controlling the keyboard using the arrow and return keys.
\endtable

\section3 Advanced Configuration Options

The table below shows the advanced configuration options that will be applied
automatically when activating a certain top-level feature. The options can also be
used for enabling or disabling a specific feature.

In most cases, these options are not needed, but there are also cases where their use is
justified. For example, the Traditional Chinese language (CONFIG=lang-zh_TW) will include
both Zhuyin and Cangjie input methods by default. This behavior can be changed by adding
the preferred input method to the configuration, e.g., \c CONFIG+="lang-zh_TW zhuyin".

\table
\header
    \li Advanced CONFIG
    \li Top-level CONFIG
    \li Description
    \li Remarks
\row
    \li \e disable-desktop
    \li \e n/a
    \li Disables Desktop integration
    \li By default, the desktop integration is enabled when the target environment
        is X11 or Windows desktop. With this option, the desktop integration can be
        disabled.
        \note For embedded integration, where the InputPanel is instantitated by
        the application, there is no need to use this option explicitly. The virtual
        keyboard will not create the desktop input panel if the application creates
        InputPanel before the focus is set to an input field.
\row
    \li \e disable-layouts
    \li \e n/a
    \li Disables built-in layouts
    \li By default, the virtual keyboard plugin contains the English keyboard layout.
        By specifiying the \e disable-layouts configuration flag, the built-in layout(s)
        are excluded from the virtual keyboard plugin.
        \note In this scenario, the \c QT_VIRTUALKEYBOARD_LAYOUT_PATH environment
        variable should be set to the file system directory containing the custom keyboard
        layouts before running the application.
\row
    \li \e disable-xcb
    \li \e n/a
    \li Disables X11 integration
    \li \note Deprecated since 1.3. Use \e disable-desktop instead.
\row
    \li \e disable-hunspell
    \li \e n/a
    \li Disables Hunspell integration
    \li Hunspell integration is enabled if the Hunspell library is available on the
        system, or if it is built using the local project file. Integration can be
        disabled using this option.
\row
    \li \e static
    \li Enables static builds of the virtual keyboard
    \li This option enables \l {Static builds}{static builds}.
\row
    \li \e retro-style
    \li \e n/a
    \li Enables Retro style
    \li Changes the default keyboard style to the Retro style. Both styles are still
        included in the package, but this option allows you to change the built-in
        default style.
\row
    \li \e pinyin
    \li \e lang-zh_CN
    \li Enables the Pinyin input method for Simplified Chinese.
    \li This option activates the Pinyin input method for the Simplified Chinese
        language.

        \include build.qdocinc input-method-language-option-note
\row
    \li \e tcime
    \li \e lang-zh_TW
    \li Enables the both Cangjie and Zhuyin input methods for Traditional Chinese.
    \li This option activates the both Cangjie and Zhuyin input methods for the
        Traditional Chinese language.

        \include build.qdocinc input-method-language-option-note
\row
    \li \e cangjie
    \li \e lang-zh_TW
    \li Enables the Cangjie input method for Traditional Chinese.
    \li This option activates the Cangjie input method for the Traditional Chinese
        language.

        \include build.qdocinc input-method-language-option-note
\row
    \li \e zhuyin
    \li \e lang-zh_TW
    \li Enables the Zhuyin input method for Traditional Chinese.
    \li This option activates the Zhuyin input method for the Traditional Chinese
        language.

        \include build.qdocinc input-method-language-option-note
\row
    \li \e hangul
    \li \e lang-ko_KR
    \li Enables the Hangul input method for Korean.
    \li This option activates the Hangul input method for the Korean language.

    \include build.qdocinc input-method-language-option-note
\row
    \li \e openwnn
    \li \e lang-ja_JP
    \li Enables the OpenWnn input method for Japanese.
    \li This option activates the OpenWnn input method for the Japanese language.

    \include build.qdocinc input-method-language-option-note
\row
    \li \e lipi-toolkit
    \li \e handwriting
    \li Enables the handwriting input method using Lipi Toolkit.
    \li Handwriting recognition is based on the open source Lipi Toolkit.
\row
    \li \e t9write
    \li \e handwriting
    \li Enables the handwriting input method using T9 Write.
    \li Handwriting recognition is based on the commercial T9 Write product from Nuance Communications.
\endtable

\section2 Building Documentation

\table
\row
    \li \e {make docs}
    \li Generates documentation
\endtable

\section2 Hunspell Integration

By default, \e HunspellInputMethod will not be available unless the Hunspell
library and development headers are found. For Linux/X11 targets, the Hunspell
library can be provided by installing the libhunspell-dev package.
Alternatively, the Hunspell sources can be extracted into the
\e src/virtualkeyboard/3rdparty/hunspell directory. If Hunspell sources are used,
then the dictionary files must also be copied into the
\e src/virtualkeyboard/3rdparty/hunspell/data directory. Furthermore, if Hunspell
sources are used, \e hunspell.pro will be used for all targets.

An example of how the directory structure should look after copying in the
Hunspell sources and dictionary files is listed below:

\badcode
3rdparty
└── hunspell
    ├── data
    │   ├── en_GB.aff
    │   └── en_GB.dic
    ├── hunspell.pro
    └── src
        └── hunspell
            ├── affentry.cxx
            ├── affentry.hxx
            (etc.)
\endcode

\section2 T9 Write Integration

T9 Write integration supports the T9 Write Alphabetic and T9 Write CJK engines. Both
engines are integrated via T9WriteInputMethod. The input method can be initialized
with either of the engines at runtime. The engine selection happens automatically
based on input locale and input mode from the keyboard.

\section3 T9 Write Compatibility

Qt Virtual Keyboard is compatible with T9 Write v7.5.0 onward.

The latest tested version is v7.8.1.

\section3 T9 Write Build Preparations

The contents of the SDK must be either manually copied to the directory structure
described below, or by using the \e unpack.py script found in the t9write directory.

To unpack the SDK using the script:

\badcode
$ cd src/virtualkeyboard/3rdparty/t9write/
$ python unpack.py T9Write_Alpha_v7-8-0_SDK.zip .
\endcode

\badcode
3rdparty
└── t9write
    ├─── api
    │   ├─── decuma*.h
    │   ├─── t9write*.h
    │   └─── xxt9w*.h
    ├─── data
    │   ├─── arabic
    │   │   └─── *.bin [T9 Write Arabic]
    │   ├─── hebrew
    │   │   └─── *.bin [T9 Write Hebrew]
    │   ├─── *.bin [T9 Write Alphabetic]
    │   ├─── *.hdb
    │   ├─── *.phd
    │   └─── *.ldb [T9 Write v7.5]
    └─── lib
        ├─── arm
        │   ├─── shared
        │   │   ├─── alphabetic
        │   │   │   └─── *.so
        │   │   └─── cjk
        │   │       └─── *.so
        │   └─── static
        │       ├─── alphabetic
        │       │   └─── *.a / *.o
        │       └─── cjk
        │           └─── *.a / *.o
        ├─── linux-x86
        │   ├─── shared
        │   │   ├─── alphabetic
        │   │   │   └─── *.so
        │   │   └─── cjk
        │   │       └─── *.so
        │   └─── static
        │       ├─── alphabetic
        │       │   └─── *.a / *.o
        │       └─── cjk
        │           └─── *.a / *.o
        └─── win32
            ├─── shared
            │   ├─── alphabetic
            │   │   ├─── *.dll
            │   │   └─── *.lib
            │   └─── cjk
            │       ├─── *.dll
            │       └─── *.lib
            └─── static
                ├─── alphabetic
                │   └─── *.lib / *.obj
                └─── cjk
                    └─── *.lib / *.obj
\endcode

\note The above files are from the T9 Write demo SDK for Windows; the contents may vary for other
      platforms.

Where the contents of each directory are:

\table
\header
    \li Directory
    \li Description
    \li Remarks
\row
    \li \e api
    \li This directory should contain all of the API files
    \li The API files usually located in the "api" and "public" directories
        of the SDK, but sometimes in the "demo" directory.

        When using both Alphabetic and CJK engines at the same time, any
        overlapping files can be copied from either SDK.
\row
    \li \e data
    \li This directory should contain all HWR databases and optionally
        XT9 databases.
    \li HWR database for the T9 Write Alphabetic:
        \list
            \li \e _databas_le.bin
        \endlist

        HWR database for the T9 Write CJK:
        \list
            \li \e cjk_HK_std_le.hdb HongKong Chinese
            \li \e cjk_J_std_le.hdb Japanese
            \li \e cjk_K_mkt_le.hdb Korean
            \li \e cjk_S_gb18030_le.hdb Simplified Chinese
            \li \e cjk_T_std_le.hdb Traditional Chinese
        \endlist

        Language database:
        \list
            \li File extension is either \e .ldb or \e .phd
        \endlist
\row
    \li \e lib/<target>/<linkage>/<engine-variant>
    \li Directory structure holding supported target builds.
    \li These directories should hold the desired target libraries.
        If both shared and static libraries are found, shared libraries
        are preferred.

        For example, to enable a static win32 build, copy
        \e t9write_alphabetic_rel.obj to \e lib/win32/static/alphabetic
        directory.
\endtable

Finally, the SDK is included in the build by adding CONFIG+=t9write to the
qmake command line.

\section2 Static builds

The virtual keyboard can be built and linked statically against the application.
This implies that Qt is also built statically (using the -static option in the
configure command line).

Static builds of the virtual keyboard are enabled by adding \c CONFIG+=static to
the qmake command line and then rebuilding.

Some third party modules used by the virtual keyboard are always built as shared
libraries. These modules are Hunspell and Lipi Toolkit.

\section3 Using the static plugin

The following section should be added to the application project file that uses the
statically built virtual keyboard.

\code
static {
    QTPLUGIN += qtvirtualkeyboardplugin
    QT += svg
}
\endcode

\c QTPLUGIN causes qmake to pull linker dependencies for the virtual keyboard
plugin. The SVG module is required as an extra dependency for Qt, since the SVG format is
required by the default styles.

From here on, using a statically built virtual keyboard is no different from the normal
case.

\section1 Deployment

\section2 Desktop Targets

Add a Deploy Step that executes the \e {make install} command, then deploy using
the \e {Deploy All} command.

\section2 Boot2Qt Targets

The installation is done by copying the necessary files to the memory card, or
by using the adb push command.

*/