Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||
2 | ** | - | ||||||
3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||
4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||
5 | ** | - | ||||||
6 | ** This file is part of the plugins of the Qt Toolkit. | - | ||||||
7 | ** | - | ||||||
8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||
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 The Qt Company. For licensing terms | - | ||||||
14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||
15 | ** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free | - | ||||||
20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||
21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||
22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||
23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||
24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||
25 | ** | - | ||||||
26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||
27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||
28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||
29 | ** | - | ||||||
30 | ** $QT_END_LICENSE$ | - | ||||||
31 | ** | - | ||||||
32 | ****************************************************************************/ | - | ||||||
33 | - | |||||||
34 | #include "qxcbglintegrationfactory.h" | - | ||||||
35 | #include "qxcbglintegrationplugin.h" | - | ||||||
36 | - | |||||||
37 | #include "qxcbglintegrationplugin.h" | - | ||||||
38 | #include "private/qfactoryloader_p.h" | - | ||||||
39 | #include "qguiapplication.h" | - | ||||||
40 | #include "qdir.h" | - | ||||||
41 | - | |||||||
42 | QT_BEGIN_NAMESPACE | - | ||||||
43 | - | |||||||
44 | #ifndef QT_NO_LIBRARY | - | ||||||
45 | Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, executed 241 times by 219 tests: end of block Executed by:
executed 241 times by 219 tests: guard.store(QtGlobalStatic::Destroyed); Executed by:
executed 129 times by 5 tests: return &holder.value; Executed by:
| 0-241 | ||||||
46 | (QXcbGlIntegrationFactoryInterface_iid, QLatin1String("/xcbglintegrations"), Qt::CaseInsensitive)) | - | ||||||
47 | Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, never executed: end of block never executed: guard.store(QtGlobalStatic::Destroyed); never executed: return &holder.value;
| 0 | ||||||
48 | (QXcbGlIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) | - | ||||||
49 | - | |||||||
50 | static inline QXcbGlIntegration *loadIntegration(QFactoryLoader *loader, const QString &key) | - | ||||||
51 | { | - | ||||||
52 | const int index = loader->indexOf(key); | - | ||||||
53 | if (index != -1) {
| 0-129 | ||||||
54 | if (QXcbGlIntegrationPlugin *factory = qobject_cast<QXcbGlIntegrationPlugin *>(loader->instance(index)))
| 0-129 | ||||||
55 | if (QXcbGlIntegration *result = factory->create())
| 0-129 | ||||||
56 | return result; executed 129 times by 5 tests: return result; Executed by:
| 129 | ||||||
57 | } never executed: end of block | 0 | ||||||
58 | return Q_NULLPTR; never executed: return nullptr; | 0 | ||||||
59 | } | - | ||||||
60 | #endif // !QT_NO_LIBRARY | - | ||||||
61 | - | |||||||
62 | QStringList QXcbGlIntegrationFactory::keys(const QString &pluginPath) | - | ||||||
63 | { | - | ||||||
64 | #ifndef QT_NO_LIBRARY | - | ||||||
65 | QStringList list; | - | ||||||
66 | if (!pluginPath.isEmpty()) {
| 0 | ||||||
67 | QCoreApplication::addLibraryPath(pluginPath); | - | ||||||
68 | list = directLoader()->keyMap().values(); | - | ||||||
69 | if (!list.isEmpty()) {
| 0 | ||||||
70 | const QString postFix = QStringLiteral(" (from ") never executed: return qstring_literal_temp; | 0 | ||||||
71 | + QDir::toNativeSeparators(pluginPath) | - | ||||||
72 | + QLatin1Char(')'); | - | ||||||
73 | const QStringList::iterator end = list.end(); | - | ||||||
74 | for (QStringList::iterator it = list.begin(); it != end; ++it)
| 0 | ||||||
75 | (*it).append(postFix); never executed: (*it).append(postFix); | 0 | ||||||
76 | } never executed: end of block | 0 | ||||||
77 | } never executed: end of block | 0 | ||||||
78 | list.append(loader()->keyMap().values()); | - | ||||||
79 | return list; never executed: return list; | 0 | ||||||
80 | #else | - | ||||||
81 | Q_UNUSED(pluginPath); | - | ||||||
82 | return QStringList(); | - | ||||||
83 | #endif | - | ||||||
84 | } | - | ||||||
85 | - | |||||||
86 | QXcbGlIntegration *QXcbGlIntegrationFactory::create(const QString &platform, const QString &pluginPath) | - | ||||||
87 | { | - | ||||||
88 | #ifndef QT_NO_LIBRARY | - | ||||||
89 | // Try loading the plugin from platformPluginPath first: | - | ||||||
90 | if (!pluginPath.isEmpty()) {
| 0-129 | ||||||
91 | QCoreApplication::addLibraryPath(pluginPath); | - | ||||||
92 | if (QXcbGlIntegration *ret = loadIntegration(directLoader(), platform))
| 0 | ||||||
93 | return ret; never executed: return ret; | 0 | ||||||
94 | } never executed: end of block | 0 | ||||||
95 | if (QXcbGlIntegration *ret = loadIntegration(loader(), platform))
| 0-129 | ||||||
96 | return ret; executed 129 times by 5 tests: return ret; Executed by:
| 129 | ||||||
97 | #else | - | ||||||
98 | Q_UNUSED(platform); | - | ||||||
99 | Q_UNUSED(pluginPath); | - | ||||||
100 | #endif | - | ||||||
101 | return Q_NULLPTR; never executed: return nullptr; | 0 | ||||||
102 | } | - | ||||||
103 | - | |||||||
104 | QT_END_NAMESPACE | - | ||||||
Source code | Switch to Preprocessed file |