Qt 4.8
qscreendriverfactory_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 "qscreen_qws.h"
45 #include "qapplication.h"
46 #include "qscreenlinuxfb_qws.h"
47 #include "qscreentransformed_qws.h"
48 #include "qscreenvfb_qws.h"
49 #include "qscreenmulti_qws_p.h"
50 #include "qscreenqnx_qws.h"
51 #include "qscreenintegrityfb_qws.h"
52 #include <stdlib.h>
53 #include "private/qfactoryloader_p.h"
55 #ifndef QT_NO_QWS_DIRECTFB
56 #include "qdirectfbscreen.h"
57 #endif
58 #ifndef QT_NO_QWS_VNC
59 #include "qscreenvnc_qws.h"
60 #endif
61 
63 
64 #if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
65 #ifndef QT_NO_LIBRARY
66 
69  QLatin1String("/gfxdrivers"), Qt::CaseInsensitive))
70 
71 #endif //QT_NO_LIBRARY
72 #endif //QT_MAKEDLL
73 
113 {
114  QString driver = key.toLower();
115 #if defined(Q_OS_QNX) && !defined(QT_NO_QWS_QNX)
116  if (driver == QLatin1String("qnx") || driver.isEmpty())
117  return new QQnxScreen(displayId);
118 #endif
119 #if defined(Q_OS_INTEGRITY) && !defined(QT_NO_QWS_INTEGRITY)
120  if (driver == QLatin1String("integrityfb") || driver.isEmpty())
121  return new QIntfbScreen(displayId);
122 #endif
123 #ifndef QT_NO_QWS_QVFB
124  if (driver == QLatin1String("qvfb") || driver.isEmpty())
125  return new QVFbScreen(displayId);
126 #endif
127 #ifndef QT_NO_QWS_LINUXFB
128  if (driver == QLatin1String("linuxfb") || driver.isEmpty())
129  return new QLinuxFbScreen(displayId);
130 #endif
131 #ifndef QT_NO_QWS_DIRECTFB
132  if (driver == QLatin1String("directfb") || driver.isEmpty())
133  return new QDirectFBScreen(displayId);
134 #endif
135 #ifndef QT_NO_QWS_TRANSFORMED
136  if (driver == QLatin1String("transformed"))
137  return new QTransformedScreen(displayId);
138 #endif
139 #ifndef QT_NO_QWS_VNC
140  if (driver == QLatin1String("vnc"))
141  return new QVNCScreen(displayId);
142 #endif
143 #ifndef QT_NO_QWS_MULTISCREEN
144  if (driver == QLatin1String("multi"))
145  return new QMultiScreen(displayId);
146 #endif
147 #if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
148 #ifndef QT_NO_LIBRARY
149 
150  if (QScreenDriverFactoryInterface *factory = qobject_cast<QScreenDriverFactoryInterface*>(loader()->instance(key)))
151  return factory->create(driver, displayId);
152 
153 #endif
154 #endif
155  return 0;
156 }
157 
164 {
165  QStringList list;
166 
167 #if defined(Q_OS_QNX) && !defined(QT_NO_QWS_QNX)
168  list << QLatin1String("QNX");
169 #endif
170 #if defined(Q_OS_INTEGRITY) && !defined(QT_NO_QWS_INTEGRITY)
171  list << QLatin1String("INTEGRITYFB");
172 #endif
173 #ifndef QT_NO_QWS_QVFB
174  list << QLatin1String("QVFb");
175 #endif
176 #ifndef QT_NO_QWS_LINUXFB
177  list << QLatin1String("LinuxFb");
178 #endif
179 #ifndef QT_NO_QWS_TRANSFORMED
180  list << QLatin1String("Transformed");
181 #endif
182 #ifndef QT_NO_QWS_VNC
183  list << QLatin1String("VNC");
184 #endif
185 #ifndef QT_NO_QWS_MULTISCREEN
186  list << QLatin1String("Multi");
187 #endif
188 
189 #if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
190 #ifndef QT_NO_LIBRARY
191  QStringList plugins = loader()->keys();
192  for (int i = 0; i < plugins.size(); ++i) {
193 # ifdef QT_NO_QWS_QVFB
194  // give QVFb top priority for autodetection
195  if (plugins.at(i) == QLatin1String("QVFb"))
196  list.prepend(plugins.at(i));
197  else
198 # endif
199  if (!list.contains(plugins.at(i)))
200  list += plugins.at(i);
201  }
202 #endif //QT_NO_LIBRARY
203 #endif //QT_MAKEDLL
204  return list;
205 }
206 
friend class QVNCScreen
Definition: qscreen_qws.h:357
friend class QQnxScreen
Definition: qscreen_qws.h:360
friend class QVFbScreen
Definition: qscreen_qws.h:359
#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 QScreenDriverFactoryInterface_iid
#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
void prepend(const T &t)
Inserts value at the beginning of the list.
Definition: qlist.h:541
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
static QScreen * create(const QString &, int)
static QScreen * instance()
Returns a pointer to the application&#39;s QScreen instance.
Definition: qscreen_qws.h:201
friend class QLinuxFbScreen
Definition: qscreen_qws.h:358
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
int displayId
Definition: qscreen_qws.h:337
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
QIntfbScreen(int display_id)
Constructs a QVNCScreen object.
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS)
Declares a global static variable with the specified type and name.
Definition: qglobal.h:1982
The QTransformedScreen class implements a screen driver for a transformed screen. ...