kernel/qplatformthemefactory.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 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 <qpa/qplatformthemefactory_p.h> -
43#include <qpa/qplatformthemeplugin.h> -
44#include <QDir> -
45#include "private/qfactoryloader_p.h" -
46#include "qmutex.h" -
47 -
48#include "qguiapplication.h" -
49#include "qdebug.h" -
50 -
51QT_BEGIN_NAMESPACE -
52 -
53#ifndef QT_NO_LIBRARY -
54Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:289
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:187
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:187
yes
Evaluation Count:102
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:187
no
Evaluation Count:0
0-289
55 (QPlatformThemeFactoryInterface_iid, QLatin1String("/platformthemes"), Qt::CaseInsensitive)) -
56Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
never executed: delete x;
never executed: return thisGlobalStatic.pointer.load();
never evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
never evaluated: !thisGlobalStatic.pointer.load()
never evaluated: !thisGlobalStatic.destroyed
0
57 (QPlatformThemeFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) -
58#endif -
59 -
60QPlatformTheme *QPlatformThemeFactory::create(const QString& key, const QString &platformPluginPath) -
61{ -
62 QStringList paramList = key.split(QLatin1Char(':'));
executed (the execution status of this line is deduced): QStringList paramList = key.split(QLatin1Char(':'));
-
63 const QString platform = paramList.takeFirst().toLower();
executed (the execution status of this line is deduced): const QString platform = paramList.takeFirst().toLower();
-
64 -
65#ifndef QT_NO_LIBRARY -
66 // Try loading the plugin from platformPluginPath first: -
67 if (!platformPluginPath.isEmpty()) {
partially evaluated: !platformPluginPath.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:289
0-289
68 QCoreApplication::addLibraryPath(platformPluginPath);
never executed (the execution status of this line is deduced): QCoreApplication::addLibraryPath(platformPluginPath);
-
69 if (QPlatformTheme *ret = qLoadPlugin1<QPlatformTheme, QPlatformThemePlugin>(directLoader(), platform, paramList))
never evaluated: QPlatformTheme *ret = qLoadPlugin1<QPlatformTheme, QPlatformThemePlugin>(directLoader(), platform, paramList)
0
70 return ret;
never executed: return ret;
0
71 }
never executed: }
0
72 if (QPlatformTheme *ret = qLoadPlugin1<QPlatformTheme, QPlatformThemePlugin>(loader(), platform, paramList))
partially evaluated: QPlatformTheme *ret = qLoadPlugin1<QPlatformTheme, QPlatformThemePlugin>(loader(), platform, paramList)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:289
0-289
73 return ret;
never executed: return ret;
0
74#endif -
75 return 0;
executed: return 0;
Execution Count:289
289
76} -
77 -
78/*! -
79 Returns the list of valid keys, i.e. the keys this factory can -
80 create styles for. -
81 -
82 \sa create() -
83*/ -
84QStringList QPlatformThemeFactory::keys(const QString &platformPluginPath) -
85{ -
86#ifndef QT_NO_LIBRARY -
87 QStringList list;
never executed (the execution status of this line is deduced): QStringList list;
-
88 -
89 if (!platformPluginPath.isEmpty()) {
never evaluated: !platformPluginPath.isEmpty()
0
90 QCoreApplication::addLibraryPath(platformPluginPath);
never executed (the execution status of this line is deduced): QCoreApplication::addLibraryPath(platformPluginPath);
-
91 list += directLoader()->keyMap().values();
never executed (the execution status of this line is deduced): list += directLoader()->keyMap().values();
-
92 if (!list.isEmpty()) {
never evaluated: !list.isEmpty()
0
93 const QString postFix = QStringLiteral(" (from ")
never executed (the execution status of this line is deduced): const QString postFix = QString::fromUtf8("" " (from " "", sizeof(" (from ") - 1)
-
94 + QDir::toNativeSeparators(platformPluginPath)
never executed (the execution status of this line is deduced): + QDir::toNativeSeparators(platformPluginPath)
-
95 + QLatin1Char(')');
never executed (the execution status of this line is deduced): + QLatin1Char(')');
-
96 const QStringList::iterator end = list.end();
never executed (the execution status of this line is deduced): const QStringList::iterator end = list.end();
-
97 for (QStringList::iterator it = list.begin(); it != end; ++it)
never evaluated: it != end
0
98 (*it).append(postFix);
never executed: (*it).append(postFix);
0
99 }
never executed: }
0
100 }
never executed: }
0
101 list += loader()->keyMap().values();
never executed (the execution status of this line is deduced): list += loader()->keyMap().values();
-
102 return list;
never executed: return list;
0
103#else -
104 return QStringList(); -
105#endif -
106} -
107 -
108QT_END_NAMESPACE -
109 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial