qplatformintegrationfactory.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qplatformintegrationfactory.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
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 QtGui module 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 <qpa/qplatformintegrationfactory_p.h>-
35#include <qpa/qplatformintegrationplugin.h>-
36#include "private/qfactoryloader_p.h"-
37#include "qmutex.h"-
38#include "qdir.h"-
39-
40#include "qguiapplication.h"-
41#include "qdebug.h"-
42-
43QT_BEGIN_NAMESPACE-
44-
45#ifndef QT_NO_LIBRARY-
46Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
never executed: end of block
never executed: guard.store(QtGlobalStatic::Destroyed);
never executed: return &holder.value;
guard.load() =...c::InitializedDescription
TRUEnever evaluated
FALSEnever evaluated
0
47 (QPlatformIntegrationFactoryInterface_iid, QLatin1String("/platforms"), Qt::CaseInsensitive))-
48Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
never executed: end of block
never executed: guard.store(QtGlobalStatic::Destroyed);
never executed: return &holder.value;
guard.load() =...c::InitializedDescription
TRUEnever evaluated
FALSEnever evaluated
0
49 (QPlatformIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))-
50-
51static inline QPlatformIntegration *loadIntegration(QFactoryLoader *loader, const QString &key, const QStringList &parameters, int &argc, char ** argv)-
52{-
53 const int index = loader->indexOf(key);-
54 if (index != -1) {
index != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
55 if (QPlatformIntegrationPlugin *factory = qobject_cast<QPlatformIntegrationPlugin *>(loader->instance(index)))
QPlatformInteg...stance(index))Description
TRUEnever evaluated
FALSEnever evaluated
0
56 if (QPlatformIntegration *result = factory->create(key, parameters, argc, argv))
QPlatformInteg...s, argc, argv)Description
TRUEnever evaluated
FALSEnever evaluated
0
57 return result;
never executed: return result;
0
58 }
never executed: end of block
0
59 return 0;
never executed: return 0;
0
60}-
61-
62#endif // !QT_NO_LIBRARY-
63-
64QPlatformIntegration *QPlatformIntegrationFactory::create(const QString &platform, const QStringList &paramList, int &argc, char **argv, const QString &platformPluginPath)-
65{-
66#ifndef QT_NO_LIBRARY-
67 // Try loading the plugin from platformPluginPath first:-
68 if (!platformPluginPath.isEmpty()) {
!platformPluginPath.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
69 QCoreApplication::addLibraryPath(platformPluginPath);-
70 if (QPlatformIntegration *ret = loadIntegration(directLoader(), platform, paramList, argc, argv))
QPlatformInteg...t, argc, argv)Description
TRUEnever evaluated
FALSEnever evaluated
0
71 return ret;
never executed: return ret;
0
72 }
never executed: end of block
0
73 if (QPlatformIntegration *ret = loadIntegration(loader(), platform, paramList, argc, argv))
QPlatformInteg...t, argc, argv)Description
TRUEnever evaluated
FALSEnever evaluated
0
74 return ret;
never executed: return ret;
0
75#else-
76 Q_UNUSED(platform);-
77 Q_UNUSED(paramList);-
78 Q_UNUSED(argc);-
79 Q_UNUSED(argv);-
80 Q_UNUSED(platformPluginPath);-
81#endif-
82 return 0;
never executed: return 0;
0
83}-
84-
85/*!-
86 Returns the list of valid keys, i.e. the keys this factory can-
87 create styles for.-
88-
89 \sa create()-
90*/-
91-
92QStringList QPlatformIntegrationFactory::keys(const QString &platformPluginPath)-
93{-
94#ifndef QT_NO_LIBRARY-
95 QStringList list;-
96 if (!platformPluginPath.isEmpty()) {
!platformPluginPath.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
97 QCoreApplication::addLibraryPath(platformPluginPath);-
98 list = directLoader()->keyMap().values();-
99 if (!list.isEmpty()) {
!list.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
100 const QString postFix = QStringLiteral(" (from ")
never executed: return qstring_literal_temp;
0
101 + QDir::toNativeSeparators(platformPluginPath)-
102 + QLatin1Char(')');-
103 const QStringList::iterator end = list.end();-
104 for (QStringList::iterator it = list.begin(); it != end; ++it)
it != endDescription
TRUEnever evaluated
FALSEnever evaluated
0
105 (*it).append(postFix);
never executed: (*it).append(postFix);
0
106 }
never executed: end of block
0
107 }
never executed: end of block
0
108 list.append(loader()->keyMap().values());-
109 return list;
never executed: return list;
0
110#else-
111 Q_UNUSED(platformPluginPath);-
112 return QStringList();-
113#endif-
114}-
115-
116QT_END_NAMESPACE-
117-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9