Qt 4.8
qkbddriverfactory_qws.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "qkbddriverfactory_qws.h"
43 
44 #ifndef QT_NO_QWS_KEYBOARD
45 
46 #include "qapplication.h"
47 #include "qkbdtty_qws.h"
48 #include "qkbdlinuxinput_qws.h"
49 #include "qkbdum_qws.h"
50 #include "qkbdvfb_qws.h"
51 #include "qkbdqnx_qws.h"
52 #include "qkbdintegrity_qws.h"
53 #include <stdlib.h>
54 #include "private/qfactoryloader_p.h"
55 #include "qkbddriverplugin_qws.h"
56 
58 
59 #if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
60 #ifndef QT_NO_LIBRARY
63  QLatin1String("/kbddrivers"), Qt::CaseInsensitive))
64 
65 #endif //QT_NO_LIBRARY
66 #endif //QT_MAKEDLL
67 
107 {
108  QString driver = key.toLower();
109 #if defined(Q_OS_QNX) && !defined(QT_NO_QWS_KBD_QNX)
110  if (driver == QLatin1String("qnx") || driver.isEmpty())
111  return new QWSQnxKeyboardHandler(device);
112 #endif
113 #if defined(Q_OS_INTEGRITY)
114  if (driver == QLatin1String("integrity") || driver.isEmpty())
115  return new QWSIntKeyboardHandler(device);
116 #endif
117 #ifndef QT_NO_QWS_KEYBOARD
118 # ifndef QT_NO_QWS_KBD_TTY
119  if (driver == QLatin1String("tty") || driver.isEmpty())
120  return new QWSTtyKeyboardHandler(device);
121 # endif
122 # ifndef QT_NO_QWS_KBD_LINUXINPUT
123  if (driver == QLatin1String("linuxinput") || \
124  driver == QLatin1String("usb") || \
125  driver == QLatin1String("linuxis"))
126  return new QWSLinuxInputKeyboardHandler(device);
127 # endif
128 # ifndef QT_NO_QWS_KBD_UM
129  if (driver == QLatin1String("um") || driver == QLatin1String("qvfbkeyboard"))
130  return new QWSUmKeyboardHandler(device);
131 # endif
132 # ifndef QT_NO_QWS_KBD_QVFB
133  if (driver == QLatin1String("qvfbkbd")
134  || driver == QLatin1String("qvfbkeyboard")
135  || driver == QLatin1String("qvfb"))
136  return new QVFbKeyboardHandler(device);
137 # endif
138 #endif
139 
140 #if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
141 #ifndef QT_NO_LIBRARY
142  if (QWSKeyboardHandlerFactoryInterface *factory = qobject_cast<QWSKeyboardHandlerFactoryInterface*>(loader()->instance(driver)))
143  return factory->create(driver, device);
144 #endif
145 #endif
146  return 0;
147 }
148 
156 {
157  QStringList list;
158 
159 #if defined(Q_OS_QNX) && !defined(QT_NO_QWS_KBD_QNX)
160  list << QLatin1String("QNX");
161 #endif
162 #if defined(Q_OS_INTEGRITY) && !defined(QT_NO_QWS_KBD_INTEGRITY)
163  list << QLatin1String("INTEGRITY");
164 #endif
165 #ifndef QT_NO_QWS_KBD_TTY
166  list << QLatin1String("TTY");
167 #endif
168 #ifndef QT_NO_QWS_KBD_LINUXINPUT
169  list << QLatin1String("LinuxInput");
170 #endif
171 #ifndef QT_NO_QWS_KBD_UM
172  list << QLatin1String("UM");
173 #endif
174 
175 #if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
176 #ifndef QT_NO_LIBRARY
177  QStringList plugins = loader()->keys();
178  for (int i = 0; i < plugins.size(); ++i) {
179  if (!list.contains(plugins.at(i)))
180  list += plugins.at(i);
181  }
182 #endif //QT_NO_LIBRARY
183 #endif //QT_MAKEDLL
184 
185  return list;
186 }
187 
189 
190 #endif // QT_NO_QWS_KEYBOARD
#define QWSKeyboardHandlerFactoryInterface_iid
The QWSKeyboardHandler class is a base class for keyboard drivers in Qt for Embedded Linux...
Definition: qkbd_qws.h:57
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
static QWSKeyboardHandler * create(const QString &, const QString &)
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
QBool contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the list contains the string str; otherwise returns false.
Definition: qstringlist.h:172
The QWSQnxKeyboardHandler class implements a keyboard driver for the QNX devi-hid input manager...
Definition: qkbdqnx_qws.h:56
static QStringList keys()
Returns the list of valid keys, i.e.
int key
QString toLower() const Q_REQUIRED_RESULT
Returns a lowercase copy of the string.
Definition: qstring.cpp:5389
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS)
Declares a global static variable with the specified type and name.
Definition: qglobal.h:1982