kernel/qplatforminputcontextfactory.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/qplatforminputcontextfactory_p.h> -
43#include <qpa/qplatforminputcontextplugin_p.h> -
44#include <qpa/qplatforminputcontext.h> -
45#include "private/qfactoryloader_p.h" -
46 -
47#include "qguiapplication.h" -
48#include "qdebug.h" -
49#include <stdlib.h> -
50 -
51QT_BEGIN_NAMESPACE -
52 -
53#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) -
54Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:1156
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:969
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:187
no
Evaluation Count:0
0-1156
55 (QPlatformInputContextFactoryInterface_iid, QLatin1String("/platforminputcontexts"), Qt::CaseInsensitive)) -
56#endif -
57 -
58QStringList QPlatformInputContextFactory::keys() -
59{ -
60#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) -
61 return loader()->keyMap().values();
executed: return loader()->keyMap().values();
Execution Count:289
289
62#else -
63 return QStringList(); -
64#endif -
65} -
66 -
67QPlatformInputContext *QPlatformInputContextFactory::create(const QString& key) -
68{ -
69 QStringList paramList = key.split(QLatin1Char(':'));
executed (the execution status of this line is deduced): QStringList paramList = key.split(QLatin1Char(':'));
-
70 const QString platform = paramList.takeFirst().toLower();
executed (the execution status of this line is deduced): const QString platform = paramList.takeFirst().toLower();
-
71 -
72#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) -
73 if (QPlatformInputContext *ret = qLoadPlugin1<QPlatformInputContext, QPlatformInputContextPlugin>(loader(), platform, paramList))
evaluated: QPlatformInputContext *ret = qLoadPlugin1<QPlatformInputContext, QPlatformInputContextPlugin>(loader(), platform, paramList)
TRUEFALSE
yes
Evaluation Count:578
yes
Evaluation Count:289
289-578
74 return ret;
executed: return ret;
Execution Count:578
578
75#endif -
76 return 0;
executed: return 0;
Execution Count:289
289
77} -
78 -
79QPlatformInputContext *QPlatformInputContextFactory::create() -
80{ -
81 QPlatformInputContext *ic = 0;
executed (the execution status of this line is deduced): QPlatformInputContext *ic = 0;
-
82 -
83 QString icString = QString::fromLatin1(qgetenv("QT_IM_MODULE"));
executed (the execution status of this line is deduced): QString icString = QString::fromLatin1(qgetenv("QT_IM_MODULE"));
-
84 -
85 if (icString == QStringLiteral("none"))
partially evaluated: icString == QString::fromUtf8("" "none" "", sizeof("none") - 1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:289
0-289
86 return 0;
never executed: return 0;
0
87 -
88 ic = create(icString);
executed (the execution status of this line is deduced): ic = create(icString);
-
89 if (ic && ic->isValid())
partially evaluated: ic
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:289
never evaluated: ic->isValid()
0-289
90 return ic;
never executed: return ic;
0
91 -
92 delete ic;
executed (the execution status of this line is deduced): delete ic;
-
93 ic = 0;
executed (the execution status of this line is deduced): ic = 0;
-
94 -
95 QStringList k = keys();
executed (the execution status of this line is deduced): QStringList k = keys();
-
96 for (int i = 0; i < k.size(); ++i) {
evaluated: i < k.size()
TRUEFALSE
yes
Evaluation Count:578
yes
Evaluation Count:289
289-578
97 if (k.at(i) == icString)
partially evaluated: k.at(i) == icString
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:578
0-578
98 continue;
never executed: continue;
0
99 ic = create(k.at(i));
executed (the execution status of this line is deduced): ic = create(k.at(i));
-
100 if (ic && ic->isValid())
partially evaluated: ic
TRUEFALSE
yes
Evaluation Count:578
no
Evaluation Count:0
partially evaluated: ic->isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:578
0-578
101 return ic;
never executed: return ic;
0
102 delete ic;
executed (the execution status of this line is deduced): delete ic;
-
103 ic = 0;
executed (the execution status of this line is deduced): ic = 0;
-
104 }
executed: }
Execution Count:578
578
105 -
106 return 0;
executed: return 0;
Execution Count:289
289
107} -
108 -
109 -
110QT_END_NAMESPACE -
111 -
112 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial