Qt 4.8
qmousedriverfactory_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 
43 
44 #include "qapplication.h"
45 #include "qmousepc_qws.h"
46 #include "qmouselinuxtp_qws.h"
47 #include "qmouselinuxinput_qws.h"
48 #include "qmousevfb_qws.h"
49 #include "qmousetslib_qws.h"
50 #include "qmouseqnx_qws.h"
51 #include "qmouseintegrity_qws.h"
52 #include <stdlib.h>
53 #include "private/qfactoryloader_p.h"
54 #include "qmousedriverplugin_qws.h"
55 #include "qdebug.h"
56 
58 
59 #if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
60 #ifndef QT_NO_LIBRARY
61 
64  QLatin1String("/mousedrivers"), Qt::CaseInsensitive))
65 
66 #endif //QT_NO_LIBRARY
67 #endif //QT_MAKEDLL
68 
108 {
109  QString driver = key.toLower();
110 #if defined(Q_OS_QNX) && !defined(QT_NO_QWS_MOUSE_QNX)
111  if (driver == QLatin1String("qnx") || driver.isEmpty())
112  return new QQnxMouseHandler(key, device);
113 #endif
114 #if defined(Q_OS_INTEGRITY) && !defined(QT_NO_MOUSE_INTEGRITY)
115  if (driver == QLatin1String("integrity") || driver.isEmpty())
116  return new QIntMouseHandler(key, device);
117 #endif
118 #ifndef QT_NO_QWS_MOUSE_LINUXTP
119  if (driver == QLatin1String("linuxtp") || driver.isEmpty())
120  return new QWSLinuxTPMouseHandler(key, device);
121 #endif
122 #ifndef QT_NO_QWS_MOUSE_PC
123  if (driver == QLatin1String("auto")
124  || driver == QLatin1String("intellimouse")
125  || driver == QLatin1String("microsoft")
126  || driver == QLatin1String("mousesystems")
127  || driver == QLatin1String("mouseman")
128  || driver.isEmpty()) {
129  return new QWSPcMouseHandler(key, device);
130  }
131 #endif
132 #ifndef QT_NO_QWS_MOUSE_TSLIB
133  if (driver == QLatin1String("tslib") || driver.isEmpty())
134  return new QWSTslibMouseHandler(key, device);
135 #endif
136 # ifndef QT_NO_QWS_MOUSE_LINUXINPUT
137  if (driver == QLatin1String("linuxinput") || \
138  driver == QLatin1String("usb") || \
139  driver == QLatin1String("linuxis"))
140  return new QWSLinuxInputMouseHandler(device);
141 # endif
142 #ifndef QT_NO_QWS_MOUSE_QVFB
143  if (driver == QLatin1String("qvfbmouse") || driver == QLatin1String("qvfb"))
144  return new QVFbMouseHandler(key, device);
145 #endif
146 
147 #if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
148 #ifndef QT_NO_LIBRARY
149  if (QWSMouseHandlerFactoryInterface *factory = qobject_cast<QWSMouseHandlerFactoryInterface*>(loader()->instance(driver)))
150  return factory->create(driver, device);
151 #endif
152 #endif
153  return 0;
154 }
155 
162 {
163  QStringList list;
164 
165 #if defined(Q_OS_QNX) && !defined(QT_NO_QWS_MOUSE_QNX)
166  list << QLatin1String("QNX");
167 #endif
168 #if defined(Q_OS_INTEGRITY) && !defined(QT_NO_QWS_MOUSE_INTEGRITY)
169  list << QLatin1String("INTEGRITY");
170 #endif
171 #ifndef QT_NO_QWS_MOUSE_LINUXTP
172  list << QLatin1String("LinuxTP");
173 #endif
174 #ifndef QT_NO_QWS_MOUSE_PC
175  list << QLatin1String("Auto")
176  << QLatin1String("IntelliMouse")
177  << QLatin1String("Microsoft")
178  << QLatin1String("MouseSystems")
179  << QLatin1String("MouseMan");
180 #endif
181 #ifndef QT_NO_QWS_MOUSE_TSLIB
182  list << QLatin1String("Tslib");
183 #endif
184 #ifndef QT_NO_QWS_MOUSE_LINUXINPUT
185  list << QLatin1String("LinuxInput");
186 #endif
187 
188 #if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
189 #ifndef QT_NO_LIBRARY
190  QStringList plugins = loader()->keys();
191  for (int i = 0; i < plugins.size(); ++i) {
192  if (!list.contains(plugins.at(i)))
193  list += plugins.at(i);
194  }
195 #endif //QT_NO_LIBRARY
196 #endif //QT_MAKEDLL
197  return list;
198 }
199 
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
The QWSMouseHandler class is a base class for mouse drivers in Qt for Embedded Linux.
Definition: qmouse_qws.h:66
#define QWSMouseHandlerFactoryInterface_iid
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
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 QWSTslibMouseHandler class implements a mouse driver for the Universal Touch Screen Library...
static QWSMouseHandler * create(const QString &, const QString &)
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
The QQnxMouseHandler class implements a mouse driver for the QNX devi-hid input manager.
Definition: qmouseqnx_qws.h:56
#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS)
Declares a global static variable with the specified type and name.
Definition: qglobal.h:1982