OpenCoverage

qgenericunixthemes.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the plugins 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 The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://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 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qgenericunixthemes_p.h"-
41#include "../../services/genericunix/qgenericunixservices_p.h"-
42-
43#include "qpa/qplatformtheme_p.h"-
44-
45#include <QtGui/QPalette>-
46#include <QtGui/QFont>-
47#include <QtGui/QGuiApplication>-
48#include <QtCore/QDir>-
49#include <QtCore/QFileInfo>-
50#include <QtCore/QFile>-
51#include <QtCore/QDebug>-
52#include <QtCore/QHash>-
53#include <QtCore/QLoggingCategory>-
54#include <QtCore/QSettings>-
55#include <QtCore/QVariant>-
56#include <QtCore/QStandardPaths>-
57#include <QtCore/QStringList>-
58#include <private/qguiapplication_p.h>-
59#include <qpa/qplatformintegration.h>-
60#include <qpa/qplatformservices.h>-
61#include <qpa/qplatformdialoghelper.h>-
62#ifndef QT_NO_DBUS-
63#include "QtPlatformSupport/private/qdbusplatformmenu_p.h"-
64#include "QtPlatformSupport/private/qdbusmenubar_p.h"-
65#endif-
66#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)-
67#include "QtPlatformSupport/private/qdbustrayicon_p.h"-
68#endif-
69-
70#include <algorithm>-
71-
72QT_BEGIN_NAMESPACE-
73-
74Q_DECLARE_LOGGING_CATEGORY(qLcTray)-
75-
76ResourceHelper::ResourceHelper()-
77{-
78 std::fill(palettes, palettes + QPlatformTheme::NPalettes, static_cast<QPalette *>(0));-
79 std::fill(fonts, fonts + QPlatformTheme::NFonts, static_cast<QFont *>(0));-
80}
never executed: end of block
0
81-
82void ResourceHelper::clear()-
83{-
84 qDeleteAll(palettes, palettes + QPlatformTheme::NPalettes);-
85 qDeleteAll(fonts, fonts + QPlatformTheme::NFonts);-
86 std::fill(palettes, palettes + QPlatformTheme::NPalettes, static_cast<QPalette *>(0));-
87 std::fill(fonts, fonts + QPlatformTheme::NFonts, static_cast<QFont *>(0));-
88}
never executed: end of block
0
89-
90/*!-
91 \class QGenericX11ThemeQKdeTheme-
92 \brief QGenericX11Theme is a generic theme implementation for X11.-
93 \since 5.0-
94 \internal-
95 \ingroup qpa-
96*/-
97-
98const char *QGenericUnixTheme::name = "generic";-
99-
100// Default system font, corresponding to the value returned by 4.8 for-
101// XRender/FontConfig which we can now assume as default.-
102static const char defaultSystemFontNameC[] = "Sans Serif";-
103enum { defaultSystemFontSize = 9 };-
104-
105#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)-
106static bool isDBusTrayAvailable() {-
107 static bool dbusTrayAvailable = false;-
108 static bool dbusTrayAvailableKnown = false;-
109 if (!dbusTrayAvailableKnown) {
!dbusTrayAvailableKnownDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSystemTrayIcon
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QSystemTrayIcon
1-4
110 QDBusMenuConnection conn;-
111 if (conn.isStatusNotifierHostRegistered())
conn.isStatusN...stRegistered()Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSystemTrayIcon
0-1
112 dbusTrayAvailable = true;
never executed: dbusTrayAvailable = true;
0
113 dbusTrayAvailableKnown = true;-
114 qCDebug(qLcTray) << "D-Bus tray available:" << dbusTrayAvailable;
never executed: QMessageLogger(__FILE__, 114, __PRETTY_FUNCTION__, qLcTray().categoryName()).debug() << "D-Bus tray available:" << dbusTrayAvailable;
qt_category_enabledDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSystemTrayIcon
0-1
115 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QSystemTrayIcon
1
116 return dbusTrayAvailable;
executed 5 times by 1 test: return dbusTrayAvailable;
Executed by:
  • tst_QSystemTrayIcon
5
117}-
118#endif-
119-
120#ifndef QT_NO_DBUS-
121static bool checkDBusGlobalMenuAvailable()-
122{-
123 QDBusConnection connection = QDBusConnection::sessionBus();-
124 QString registrarService = QStringLiteral("com.canonical.AppMenu.Registrar");
executed 8 times by 8 tests: return qstring_literal_temp;
Executed by:
  • tst_QAccessibility
  • tst_QLayout
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QWidgetAction
8
125 return connection.interface()->isServiceRegistered(registrarService);
executed 8 times by 8 tests: return connection.interface()->isServiceRegistered(registrarService);
Executed by:
  • tst_QAccessibility
  • tst_QLayout
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QWidgetAction
8
126}-
127-
128static bool isDBusGlobalMenuAvailable()-
129{-
130 static bool dbusGlobalMenuAvailable = checkDBusGlobalMenuAvailable();-
131 return dbusGlobalMenuAvailable;
executed 70 times by 8 tests: return dbusGlobalMenuAvailable;
Executed by:
  • tst_QAccessibility
  • tst_QLayout
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QWidgetAction
70
132}-
133#endif-
134-
135class QGenericUnixThemePrivate : public QPlatformThemePrivate-
136{-
137public:-
138 QGenericUnixThemePrivate()-
139 : QPlatformThemePrivate()-
140 , systemFont(QLatin1String(defaultSystemFontNameC), defaultSystemFontSize)-
141 , fixedFont(QStringLiteral("monospace"), systemFont.pointSize())-
142 {-
143 fixedFont.setStyleHint(QFont::TypeWriter);-
144 }
executed 135 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
135
145-
146 const QFont systemFont;-
147 QFont fixedFont;-
148};-
149-
150QGenericUnixTheme::QGenericUnixTheme()-
151 : QPlatformTheme(new QGenericUnixThemePrivate())-
152{-
153}
executed 135 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
135
154-
155const QFont *QGenericUnixTheme::font(Font type) const-
156{-
157 Q_D(const QGenericUnixTheme);-
158 switch (type) {-
159 case QPlatformTheme::SystemFont:
executed 205 times by 170 tests: case QPlatformTheme::SystemFont:
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QComplexText
  • tst_QCssParser
  • ...
205
160 return &d->systemFont;
executed 205 times by 170 tests: return &d->systemFont;
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QComplexText
  • tst_QCssParser
  • ...
205
161 case QPlatformTheme::FixedFont:
executed 275 times by 2 tests: case QPlatformTheme::FixedFont:
Executed by:
  • tst_QTextDocument
  • tst_QTextDocumentFragment
275
162 return &d->fixedFont;
executed 275 times by 2 tests: return &d->fixedFont;
Executed by:
  • tst_QTextDocument
  • tst_QTextDocumentFragment
275
163 default:
executed 5038 times by 14 tests: default:
Executed by:
  • tst_QAbstractItemView
  • tst_QAbstractSpinBox
  • tst_QApplication
  • tst_QComboBox
  • tst_QFontDialog
  • tst_QGraphicsLinearLayout
  • tst_QGridLayout
  • tst_QLayout
  • tst_QPushButton
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QToolTip
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
5038
164 return 0;
executed 5038 times by 14 tests: return 0;
Executed by:
  • tst_QAbstractItemView
  • tst_QAbstractSpinBox
  • tst_QApplication
  • tst_QComboBox
  • tst_QFontDialog
  • tst_QGraphicsLinearLayout
  • tst_QGridLayout
  • tst_QLayout
  • tst_QPushButton
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QToolTip
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
5038
165 }-
166}-
167-
168// Helper to return the icon theme paths from XDG.-
169QStringList QGenericUnixTheme::xdgIconThemePaths()-
170{-
171 QStringList paths;-
172 // Add home directory first in search path-
173 const QFileInfo homeIconDir(QDir::homePath() + QLatin1String("/.icons"));-
174 if (homeIconDir.isDir())
homeIconDir.isDir()Description
TRUEnever evaluated
FALSEevaluated 25 times by 25 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLabel
  • tst_QLineEdit
  • tst_QMessageBox
  • tst_QPlainTextEdit
  • tst_QPrinter
  • tst_QSidebar
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QSystemTrayIcon
  • tst_QTextEdit
  • tst_QToolButton
  • tst_QTreeWidget
  • tst_languageChange
0-25
175 paths.prepend(homeIconDir.absoluteFilePath());
never executed: paths.prepend(homeIconDir.absoluteFilePath());
0
176-
177 QString xdgDirString = QFile::decodeName(qgetenv("XDG_DATA_DIRS"));-
178 if (xdgDirString.isEmpty())
xdgDirString.isEmpty()Description
TRUEevaluated 25 times by 25 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLabel
  • tst_QLineEdit
  • tst_QMessageBox
  • tst_QPlainTextEdit
  • tst_QPrinter
  • tst_QSidebar
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QSystemTrayIcon
  • tst_QTextEdit
  • tst_QToolButton
  • tst_QTreeWidget
  • tst_languageChange
FALSEnever evaluated
0-25
179 xdgDirString = QLatin1String("/usr/local/share/:/usr/share/");
executed 25 times by 25 tests: xdgDirString = QLatin1String("/usr/local/share/:/usr/share/");
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLabel
  • tst_QLineEdit
  • tst_QMessageBox
  • tst_QPlainTextEdit
  • tst_QPrinter
  • tst_QSidebar
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QSystemTrayIcon
  • tst_QTextEdit
  • tst_QToolButton
  • tst_QTreeWidget
  • tst_languageChange
25
180 const auto xdgDirs = xdgDirString.splitRef(QLatin1Char(':'));-
181 for (const QStringRef &xdgDir : xdgDirs) {-
182 const QFileInfo xdgIconsDir(xdgDir + QLatin1String("/icons"));-
183 if (xdgIconsDir.isDir())
xdgIconsDir.isDir()Description
TRUEevaluated 25 times by 25 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLabel
  • tst_QLineEdit
  • tst_QMessageBox
  • tst_QPlainTextEdit
  • tst_QPrinter
  • tst_QSidebar
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QSystemTrayIcon
  • tst_QTextEdit
  • tst_QToolButton
  • tst_QTreeWidget
  • tst_languageChange
FALSEevaluated 25 times by 25 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLabel
  • tst_QLineEdit
  • tst_QMessageBox
  • tst_QPlainTextEdit
  • tst_QPrinter
  • tst_QSidebar
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QSystemTrayIcon
  • tst_QTextEdit
  • tst_QToolButton
  • tst_QTreeWidget
  • tst_languageChange
25
184 paths.append(xdgIconsDir.absoluteFilePath());
executed 25 times by 25 tests: paths.append(xdgIconsDir.absoluteFilePath());
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLabel
  • tst_QLineEdit
  • tst_QMessageBox
  • tst_QPlainTextEdit
  • tst_QPrinter
  • tst_QSidebar
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QSystemTrayIcon
  • tst_QTextEdit
  • tst_QToolButton
  • tst_QTreeWidget
  • tst_languageChange
25
185 }
executed 50 times by 25 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLabel
  • tst_QLineEdit
  • tst_QMessageBox
  • tst_QPlainTextEdit
  • tst_QPrinter
  • tst_QSidebar
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QSystemTrayIcon
  • tst_QTextEdit
  • tst_QToolButton
  • tst_QTreeWidget
  • tst_languageChange
50
186-
187 const QFileInfo pixmapsIconsDir(QStringLiteral("/usr/share/pixmaps"));
executed 25 times by 25 tests: return qstring_literal_temp;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLabel
  • tst_QLineEdit
  • tst_QMessageBox
  • tst_QPlainTextEdit
  • tst_QPrinter
  • tst_QSidebar
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QSystemTrayIcon
  • tst_QTextEdit
  • tst_QToolButton
  • tst_QTreeWidget
  • tst_languageChange
25
188 if (pixmapsIconsDir.isDir())
pixmapsIconsDir.isDir()Description
TRUEevaluated 25 times by 25 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLabel
  • tst_QLineEdit
  • tst_QMessageBox
  • tst_QPlainTextEdit
  • tst_QPrinter
  • tst_QSidebar
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QSystemTrayIcon
  • tst_QTextEdit
  • tst_QToolButton
  • tst_QTreeWidget
  • tst_languageChange
FALSEnever evaluated
0-25
189 paths.append(pixmapsIconsDir.absoluteFilePath());
executed 25 times by 25 tests: paths.append(pixmapsIconsDir.absoluteFilePath());
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLabel
  • tst_QLineEdit
  • tst_QMessageBox
  • tst_QPlainTextEdit
  • tst_QPrinter
  • tst_QSidebar
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QSystemTrayIcon
  • tst_QTextEdit
  • tst_QToolButton
  • tst_QTreeWidget
  • tst_languageChange
25
190-
191 return paths;
executed 25 times by 25 tests: return paths;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLabel
  • tst_QLineEdit
  • tst_QMessageBox
  • tst_QPlainTextEdit
  • tst_QPrinter
  • tst_QSidebar
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QSystemTrayIcon
  • tst_QTextEdit
  • tst_QToolButton
  • tst_QTreeWidget
  • tst_languageChange
25
192}-
193-
194#ifndef QT_NO_DBUS-
195QPlatformMenuBar *QGenericUnixTheme::createPlatformMenuBar() const-
196{-
197 if (isDBusGlobalMenuAvailable())
isDBusGlobalMenuAvailable()Description
TRUEnever evaluated
FALSEevaluated 70 times by 8 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QLayout
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QWidgetAction
0-70
198 return new QDBusMenuBar();
never executed: return new QDBusMenuBar();
0
199 return nullptr;
executed 70 times by 8 tests: return nullptr;
Executed by:
  • tst_QAccessibility
  • tst_QLayout
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • tst_QWidgetAction
70
200}-
201#endif-
202-
203#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)-
204QPlatformSystemTrayIcon *QGenericUnixTheme::createPlatformSystemTrayIcon() const-
205{-
206 if (isDBusTrayAvailable())
isDBusTrayAvailable()Description
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QSystemTrayIcon
0-5
207 return new QDBusTrayIcon();
never executed: return new QDBusTrayIcon();
0
208 return Q_NULLPTR;
executed 5 times by 1 test: return nullptr;
Executed by:
  • tst_QSystemTrayIcon
5
209}-
210#endif-
211-
212QVariant QGenericUnixTheme::themeHint(ThemeHint hint) const-
213{-
214 switch (hint) {-
215 case QPlatformTheme::SystemIconFallbackThemeName:
executed 84 times by 43 tests: case QPlatformTheme::SystemIconFallbackThemeName:
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsWidget
  • tst_QIcon
  • tst_QLabel
  • tst_QLayout
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • ...
84
216 return QVariant(QString(QStringLiteral("hicolor")));
executed 84 times by 43 tests: return QVariant(QString(([]() -> QString { enum { Size = sizeof(u"" "hicolor")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "hicolor" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())));
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsWidget
  • tst_QIcon
  • tst_QLabel
  • tst_QLayout
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • ...
executed 84 times by 43 tests: return qstring_literal_temp;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDockWidget
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsItem
  • tst_QGraphicsLinearLayout
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsWidget
  • tst_QIcon
  • tst_QLabel
  • tst_QLayout
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QMenuBar
  • ...
84
217 case QPlatformTheme::IconThemeSearchPaths:
executed 25 times by 25 tests: case QPlatformTheme::IconThemeSearchPaths:
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLabel
  • tst_QLineEdit
  • tst_QMessageBox
  • tst_QPlainTextEdit
  • tst_QPrinter
  • tst_QSidebar
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QSystemTrayIcon
  • tst_QTextEdit
  • tst_QToolButton
  • tst_QTreeWidget
  • tst_languageChange
25
218 return xdgIconThemePaths();
executed 25 times by 25 tests: return xdgIconThemePaths();
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QLabel
  • tst_QLineEdit
  • tst_QMessageBox
  • tst_QPlainTextEdit
  • tst_QPrinter
  • tst_QSidebar
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QSystemTrayIcon
  • tst_QTextEdit
  • tst_QToolButton
  • tst_QTreeWidget
  • tst_languageChange
25
219 case QPlatformTheme::DialogButtonBoxButtonsHaveIcons:
executed 2 times by 1 test: case QPlatformTheme::DialogButtonBoxButtonsHaveIcons:
Executed by:
  • tst_QStyle
2
220 return QVariant(true);
executed 2 times by 1 test: return QVariant(true);
Executed by:
  • tst_QStyle
2
221 case QPlatformTheme::StyleNames: {
executed 201 times by 17 tests: case QPlatformTheme::StyleNames:
Executed by:
  • tst_QAbstractItemView
  • tst_QAbstractSpinBox
  • tst_QApplication
  • tst_QComboBox
  • tst_QFontDialog
  • tst_QGraphicsLinearLayout
  • tst_QGridLayout
  • tst_QHeaderView
  • tst_QLayout
  • tst_QPushButton
  • tst_QSplitter
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QToolTip
  • tst_QTreeView
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
201
222 QStringList styleNames;-
223 styleNames << QStringLiteral("Fusion") << QStringLiteral("Windows");
executed 201 times by 17 tests: return qstring_literal_temp;
Executed by:
  • tst_QAbstractItemView
  • tst_QAbstractSpinBox
  • tst_QApplication
  • tst_QComboBox
  • tst_QFontDialog
  • tst_QGraphicsLinearLayout
  • tst_QGridLayout
  • tst_QHeaderView
  • tst_QLayout
  • tst_QPushButton
  • tst_QSplitter
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QToolTip
  • tst_QTreeView
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
executed 201 times by 17 tests: return qstring_literal_temp;
Executed by:
  • tst_QAbstractItemView
  • tst_QAbstractSpinBox
  • tst_QApplication
  • tst_QComboBox
  • tst_QFontDialog
  • tst_QGraphicsLinearLayout
  • tst_QGridLayout
  • tst_QHeaderView
  • tst_QLayout
  • tst_QPushButton
  • tst_QSplitter
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QToolTip
  • tst_QTreeView
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
201
224 return QVariant(styleNames);
executed 201 times by 17 tests: return QVariant(styleNames);
Executed by:
  • tst_QAbstractItemView
  • tst_QAbstractSpinBox
  • tst_QApplication
  • tst_QComboBox
  • tst_QFontDialog
  • tst_QGraphicsLinearLayout
  • tst_QGridLayout
  • tst_QHeaderView
  • tst_QLayout
  • tst_QPushButton
  • tst_QSplitter
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QToolTip
  • tst_QTreeView
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
201
225 }-
226 case QPlatformTheme::KeyboardScheme:
executed 211900 times by 75 tests: case QPlatformTheme::KeyboardScheme:
Executed by:
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QApplication
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDialogButtonBox
  • tst_QDockWidget
  • tst_QDoubleSpinBox
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFocusEvent
  • tst_QFontComboBox
  • tst_QFontDialog
  • ...
211900
227 return QVariant(int(X11KeyboardScheme));
executed 211900 times by 75 tests: return QVariant(int(X11KeyboardScheme));
Executed by:
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QApplication
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDialogButtonBox
  • tst_QDockWidget
  • tst_QDoubleSpinBox
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFocusEvent
  • tst_QFontComboBox
  • tst_QFontDialog
  • ...
211900
228 default:
executed 24437 times by 118 tests: default:
Executed by:
  • tst_Gestures
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDesktopWidget
  • tst_QDialog
  • tst_QDialogButtonBox
  • tst_QDockWidget
  • tst_QDoubleSpinBox
  • ...
24437
229 break;
executed 24437 times by 118 tests: break;
Executed by:
  • tst_Gestures
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDesktopWidget
  • tst_QDialog
  • tst_QDialogButtonBox
  • tst_QDockWidget
  • tst_QDoubleSpinBox
  • ...
24437
230 }-
231 return QPlatformTheme::themeHint(hint);
executed 24437 times by 118 tests: return QPlatformTheme::themeHint(hint);
Executed by:
  • tst_Gestures
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDesktopWidget
  • tst_QDialog
  • tst_QDialogButtonBox
  • tst_QDockWidget
  • tst_QDoubleSpinBox
  • ...
24437
232}-
233-
234#ifndef QT_NO_SETTINGS-
235class QKdeThemePrivate : public QPlatformThemePrivate-
236{-
237public:-
238 QKdeThemePrivate(const QStringList &kdeDirs, int kdeVersion)-
239 : kdeDirs(kdeDirs)-
240 , kdeVersion(kdeVersion)-
241 , toolButtonStyle(Qt::ToolButtonTextBesideIcon)-
242 , toolBarIconSize(0)-
243 , singleClick(true)-
244 , wheelScrollLines(3)-
245 { }
never executed: end of block
0
246-
247 static QString kdeGlobals(const QString &kdeDir, int kdeVersion)-
248 {-
249 if (kdeVersion > 4)
kdeVersion > 4Description
TRUEnever evaluated
FALSEnever evaluated
0
250 return kdeDir + QLatin1String("/kdeglobals");
never executed: return kdeDir + QLatin1String("/kdeglobals");
0
251 return kdeDir + QLatin1String("/share/config/kdeglobals");
never executed: return kdeDir + QLatin1String("/share/config/kdeglobals");
0
252 }-
253-
254 void refresh();-
255 static QVariant readKdeSetting(const QString &key, const QStringList &kdeDirs, int kdeVersion, QHash<QString, QSettings*> &kdeSettings);-
256 static void readKdeSystemPalette(const QStringList &kdeDirs, int kdeVersion, QHash<QString, QSettings*> &kdeSettings, QPalette *pal);-
257 static QFont *kdeFont(const QVariant &fontValue);-
258 static QStringList kdeIconThemeSearchPaths(const QStringList &kdeDirs);-
259-
260 const QStringList kdeDirs;-
261 const int kdeVersion;-
262-
263 ResourceHelper resources;-
264 QString iconThemeName;-
265 QString iconFallbackThemeName;-
266 QStringList styleNames;-
267 int toolButtonStyle;-
268 int toolBarIconSize;-
269 bool singleClick;-
270 int wheelScrollLines;-
271};-
272-
273void QKdeThemePrivate::refresh()-
274{-
275 resources.clear();-
276-
277 toolButtonStyle = Qt::ToolButtonTextBesideIcon;-
278 toolBarIconSize = 0;-
279 styleNames.clear();-
280 if (kdeVersion >= 5)
kdeVersion >= 5Description
TRUEnever evaluated
FALSEnever evaluated
0
281 styleNames << QStringLiteral("breeze");
never executed: styleNames << ([]() -> QString { enum { Size = sizeof(u"" "breeze")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "breeze" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
never executed: return qstring_literal_temp;
0
282 styleNames << QStringLiteral("Oxygen") << QStringLiteral("fusion") << QStringLiteral("windows");
never executed: return qstring_literal_temp;
never executed: return qstring_literal_temp;
never executed: return qstring_literal_temp;
0
283 if (kdeVersion >= 5)
kdeVersion >= 5Description
TRUEnever evaluated
FALSEnever evaluated
0
284 iconFallbackThemeName = iconThemeName = QStringLiteral("breeze");
never executed: iconFallbackThemeName = iconThemeName = ([]() -> QString { enum { Size = sizeof(u"" "breeze")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "breeze" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
never executed: return qstring_literal_temp;
0
285 else-
286 iconFallbackThemeName = iconThemeName = QStringLiteral("oxygen");
never executed: iconFallbackThemeName = iconThemeName = ([]() -> QString { enum { Size = sizeof(u"" "oxygen")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "oxygen" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
never executed: return qstring_literal_temp;
0
287-
288 QHash<QString, QSettings*> kdeSettings;-
289-
290 QPalette systemPalette = QPalette();-
291 readKdeSystemPalette(kdeDirs, kdeVersion, kdeSettings, &systemPalette);-
292 resources.palettes[QPlatformTheme::SystemPalette] = new QPalette(systemPalette);-
293 //## TODO tooltip color-
294-
295 const QVariant styleValue = readKdeSetting(QStringLiteral("widgetStyle"), kdeDirs, kdeVersion, kdeSettings);
never executed: return qstring_literal_temp;
0
296 if (styleValue.isValid()) {
styleValue.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
297 const QString style = styleValue.toString();-
298 if (style != styleNames.front())
style != styleNames.front()Description
TRUEnever evaluated
FALSEnever evaluated
0
299 styleNames.push_front(style);
never executed: styleNames.push_front(style);
0
300 }
never executed: end of block
0
301-
302 const QVariant singleClickValue = readKdeSetting(QStringLiteral("KDE/SingleClick"), kdeDirs, kdeVersion, kdeSettings);
never executed: return qstring_literal_temp;
0
303 if (singleClickValue.isValid())
singleClickValue.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
304 singleClick = singleClickValue.toBool();
never executed: singleClick = singleClickValue.toBool();
0
305-
306 const QVariant themeValue = readKdeSetting(QStringLiteral("Icons/Theme"), kdeDirs, kdeVersion, kdeSettings);
never executed: return qstring_literal_temp;
0
307 if (themeValue.isValid())
themeValue.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
308 iconThemeName = themeValue.toString();
never executed: iconThemeName = themeValue.toString();
0
309-
310 const QVariant toolBarIconSizeValue = readKdeSetting(QStringLiteral("ToolbarIcons/Size"), kdeDirs, kdeVersion, kdeSettings);
never executed: return qstring_literal_temp;
0
311 if (toolBarIconSizeValue.isValid())
toolBarIconSizeValue.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
312 toolBarIconSize = toolBarIconSizeValue.toInt();
never executed: toolBarIconSize = toolBarIconSizeValue.toInt();
0
313-
314 const QVariant toolbarStyleValue = readKdeSetting(QStringLiteral("Toolbar style/ToolButtonStyle"), kdeDirs, kdeVersion, kdeSettings);
never executed: return qstring_literal_temp;
0
315 if (toolbarStyleValue.isValid()) {
toolbarStyleValue.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
316 const QString toolBarStyle = toolbarStyleValue.toString();-
317 if (toolBarStyle == QLatin1String("TextBesideIcon"))
toolBarStyle =...xtBesideIcon")Description
TRUEnever evaluated
FALSEnever evaluated
0
318 toolButtonStyle = Qt::ToolButtonTextBesideIcon;
never executed: toolButtonStyle = Qt::ToolButtonTextBesideIcon;
0
319 else if (toolBarStyle == QLatin1String("TextOnly"))
toolBarStyle =...ng("TextOnly")Description
TRUEnever evaluated
FALSEnever evaluated
0
320 toolButtonStyle = Qt::ToolButtonTextOnly;
never executed: toolButtonStyle = Qt::ToolButtonTextOnly;
0
321 else if (toolBarStyle == QLatin1String("TextUnderIcon"))
toolBarStyle =...extUnderIcon")Description
TRUEnever evaluated
FALSEnever evaluated
0
322 toolButtonStyle = Qt::ToolButtonTextUnderIcon;
never executed: toolButtonStyle = Qt::ToolButtonTextUnderIcon;
0
323 }
never executed: end of block
0
324-
325 const QVariant wheelScrollLinesValue = readKdeSetting(QStringLiteral("KDE/WheelScrollLines"), kdeDirs, kdeVersion, kdeSettings);
never executed: return qstring_literal_temp;
0
326 if (wheelScrollLinesValue.isValid())
wheelScrollLin...alue.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
327 wheelScrollLines = wheelScrollLinesValue.toInt();
never executed: wheelScrollLines = wheelScrollLinesValue.toInt();
0
328-
329 // Read system font, ignore 'smallestReadableFont'-
330 if (QFont *systemFont = kdeFont(readKdeSetting(QStringLiteral("font"), kdeDirs, kdeVersion, kdeSettings)))
never executed: return qstring_literal_temp;
QFont *systemF... kdeSettings))Description
TRUEnever evaluated
FALSEnever evaluated
0
331 resources.fonts[QPlatformTheme::SystemFont] = systemFont;
never executed: resources.fonts[QPlatformTheme::SystemFont] = systemFont;
0
332 else-
333 resources.fonts[QPlatformTheme::SystemFont] = new QFont(QLatin1String(defaultSystemFontNameC), defaultSystemFontSize);
never executed: resources.fonts[QPlatformTheme::SystemFont] = new QFont(QLatin1String(defaultSystemFontNameC), defaultSystemFontSize);
0
334-
335 if (QFont *fixedFont = kdeFont(readKdeSetting(QStringLiteral("fixed"), kdeDirs, kdeVersion, kdeSettings))) {
never executed: return qstring_literal_temp;
QFont *fixedFo... kdeSettings))Description
TRUEnever evaluated
FALSEnever evaluated
0
336 resources.fonts[QPlatformTheme::FixedFont] = fixedFont;-
337 } else {
never executed: end of block
0
338 fixedFont = new QFont(QLatin1String(defaultSystemFontNameC), defaultSystemFontSize);-
339 fixedFont->setStyleHint(QFont::TypeWriter);-
340 resources.fonts[QPlatformTheme::FixedFont] = fixedFont;-
341 }
never executed: end of block
0
342-
343 qDeleteAll(kdeSettings);-
344}
never executed: end of block
0
345-
346QVariant QKdeThemePrivate::readKdeSetting(const QString &key, const QStringList &kdeDirs, int kdeVersion, QHash<QString, QSettings*> &kdeSettings)-
347{-
348 foreach (const QString &kdeDir, kdeDirs) {-
349 QSettings *settings = kdeSettings.value(kdeDir);-
350 if (!settings) {
!settingsDescription
TRUEnever evaluated
FALSEnever evaluated
0
351 const QString kdeGlobalsPath = kdeGlobals(kdeDir, kdeVersion);-
352 if (QFileInfo(kdeGlobalsPath).isReadable()) {
QFileInfo(kdeG...).isReadable()Description
TRUEnever evaluated
FALSEnever evaluated
0
353 settings = new QSettings(kdeGlobalsPath, QSettings::IniFormat);-
354 kdeSettings.insert(kdeDir, settings);-
355 }
never executed: end of block
0
356 }
never executed: end of block
0
357 if (settings) {
settingsDescription
TRUEnever evaluated
FALSEnever evaluated
0
358 const QVariant value = settings->value(key);-
359 if (value.isValid())
value.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
360 return value;
never executed: return value;
0
361 }
never executed: end of block
0
362 }
never executed: end of block
0
363 return QVariant();
never executed: return QVariant();
0
364}-
365-
366// Reads the color from the KDE configuration, and store it in the-
367// palette with the given color role if found.-
368static inline bool kdeColor(QPalette *pal, QPalette::ColorRole role, const QVariant &value)-
369{-
370 if (!value.isValid())
!value.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
371 return false;
never executed: return false;
0
372 const QStringList values = value.toStringList();-
373 if (values.size() != 3)
values.size() != 3Description
TRUEnever evaluated
FALSEnever evaluated
0
374 return false;
never executed: return false;
0
375 pal->setBrush(role, QColor(values.at(0).toInt(), values.at(1).toInt(), values.at(2).toInt()));-
376 return true;
never executed: return true;
0
377}-
378-
379void QKdeThemePrivate::readKdeSystemPalette(const QStringList &kdeDirs, int kdeVersion, QHash<QString, QSettings*> &kdeSettings, QPalette *pal)-
380{-
381 if (!kdeColor(pal, QPalette::Button, readKdeSetting(QStringLiteral("Colors:Button/BackgroundNormal"), kdeDirs, kdeVersion, kdeSettings))) {
never executed: return qstring_literal_temp;
!kdeColor(pal,... kdeSettings))Description
TRUEnever evaluated
FALSEnever evaluated
0
382 // kcolorscheme.cpp: SetDefaultColors-
383 const QColor defaultWindowBackground(214, 210, 208);-
384 const QColor defaultButtonBackground(223, 220, 217);-
385 *pal = QPalette(defaultButtonBackground, defaultWindowBackground);-
386 return;
never executed: return;
0
387 }-
388-
389 kdeColor(pal, QPalette::Window, readKdeSetting(QStringLiteral("Colors:Window/BackgroundNormal"), kdeDirs, kdeVersion, kdeSettings));
never executed: return qstring_literal_temp;
0
390 kdeColor(pal, QPalette::Text, readKdeSetting(QStringLiteral("Colors:View/ForegroundNormal"), kdeDirs, kdeVersion, kdeSettings));
never executed: return qstring_literal_temp;
0
391 kdeColor(pal, QPalette::WindowText, readKdeSetting(QStringLiteral("Colors:Window/ForegroundNormal"), kdeDirs, kdeVersion, kdeSettings));
never executed: return qstring_literal_temp;
0
392 kdeColor(pal, QPalette::Base, readKdeSetting(QStringLiteral("Colors:View/BackgroundNormal"), kdeDirs, kdeVersion, kdeSettings));
never executed: return qstring_literal_temp;
0
393 kdeColor(pal, QPalette::Highlight, readKdeSetting(QStringLiteral("Colors:Selection/BackgroundNormal"), kdeDirs, kdeVersion, kdeSettings));
never executed: return qstring_literal_temp;
0
394 kdeColor(pal, QPalette::HighlightedText, readKdeSetting(QStringLiteral("Colors:Selection/ForegroundNormal"), kdeDirs, kdeVersion, kdeSettings));
never executed: return qstring_literal_temp;
0
395 kdeColor(pal, QPalette::AlternateBase, readKdeSetting(QStringLiteral("Colors:View/BackgroundAlternate"), kdeDirs, kdeVersion, kdeSettings));
never executed: return qstring_literal_temp;
0
396 kdeColor(pal, QPalette::ButtonText, readKdeSetting(QStringLiteral("Colors:Button/ForegroundNormal"), kdeDirs, kdeVersion, kdeSettings));
never executed: return qstring_literal_temp;
0
397 kdeColor(pal, QPalette::Link, readKdeSetting(QStringLiteral("Colors:View/ForegroundLink"), kdeDirs, kdeVersion, kdeSettings));
never executed: return qstring_literal_temp;
0
398 kdeColor(pal, QPalette::LinkVisited, readKdeSetting(QStringLiteral("Colors:View/ForegroundVisited"), kdeDirs, kdeVersion, kdeSettings));
never executed: return qstring_literal_temp;
0
399 kdeColor(pal, QPalette::ToolTipBase, readKdeSetting(QStringLiteral("Colors:Tooltip/BackgroundNormal"), kdeDirs, kdeVersion, kdeSettings));
never executed: return qstring_literal_temp;
0
400 kdeColor(pal, QPalette::ToolTipText, readKdeSetting(QStringLiteral("Colors:Tooltip/ForegroundNormal"), kdeDirs, kdeVersion, kdeSettings));
never executed: return qstring_literal_temp;
0
401-
402 // The above code sets _all_ color roles to "normal" colors. In KDE, the disabled-
403 // color roles are calculated by applying various effects described in kdeglobals.-
404 // We use a bit simpler approach here, similar logic than in qt_palette_from_color().-
405 const QColor button = pal->color(QPalette::Button);-
406 int h, s, v;-
407 button.getHsv(&h, &s, &v);-
408-
409 const QBrush whiteBrush = QBrush(Qt::white);-
410 const QBrush buttonBrush = QBrush(button);-
411 const QBrush buttonBrushDark = QBrush(button.darker(v > 128 ? 200 : 50));-
412 const QBrush buttonBrushDark150 = QBrush(button.darker(v > 128 ? 150 : 75));-
413 const QBrush buttonBrushLight150 = QBrush(button.lighter(v > 128 ? 150 : 75));-
414 const QBrush buttonBrushLight = QBrush(button.lighter(v > 128 ? 200 : 50));-
415-
416 pal->setBrush(QPalette::Disabled, QPalette::WindowText, buttonBrushDark);-
417 pal->setBrush(QPalette::Disabled, QPalette::ButtonText, buttonBrushDark);-
418 pal->setBrush(QPalette::Disabled, QPalette::Button, buttonBrush);-
419 pal->setBrush(QPalette::Disabled, QPalette::Text, buttonBrushDark);-
420 pal->setBrush(QPalette::Disabled, QPalette::BrightText, whiteBrush);-
421 pal->setBrush(QPalette::Disabled, QPalette::Base, buttonBrush);-
422 pal->setBrush(QPalette::Disabled, QPalette::Window, buttonBrush);-
423 pal->setBrush(QPalette::Disabled, QPalette::Highlight, buttonBrushDark150);-
424 pal->setBrush(QPalette::Disabled, QPalette::HighlightedText, buttonBrushLight150);-
425-
426 // set calculated colors for all groups-
427 pal->setBrush(QPalette::Light, buttonBrushLight);-
428 pal->setBrush(QPalette::Midlight, buttonBrushLight150);-
429 pal->setBrush(QPalette::Mid, buttonBrushDark150);-
430 pal->setBrush(QPalette::Dark, buttonBrushDark);-
431}
never executed: end of block
0
432-
433/*!-
434 \class QKdeTheme-
435 \brief QKdeTheme is a theme implementation for the KDE desktop (version 4 or higher).-
436 \since 5.0-
437 \internal-
438 \ingroup qpa-
439*/-
440-
441const char *QKdeTheme::name = "kde";-
442-
443QKdeTheme::QKdeTheme(const QStringList& kdeDirs, int kdeVersion)-
444 : QPlatformTheme(new QKdeThemePrivate(kdeDirs,kdeVersion))-
445{-
446 d_func()->refresh();-
447}
never executed: end of block
0
448-
449QFont *QKdeThemePrivate::kdeFont(const QVariant &fontValue)-
450{-
451 if (fontValue.isValid()) {
fontValue.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
452 // Read font value: Might be a QStringList as KDE stores fonts without quotes.-
453 // Also retrieve the family for the constructor since we cannot use the-
454 // default constructor of QFont, which accesses QGuiApplication::systemFont()-
455 // causing recursion.-
456 QString fontDescription;-
457 QString fontFamily;-
458 if (fontValue.type() == QVariant::StringList) {
fontValue.type...nt::StringListDescription
TRUEnever evaluated
FALSEnever evaluated
0
459 const QStringList list = fontValue.toStringList();-
460 if (!list.isEmpty()) {
!list.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
461 fontFamily = list.first();-
462 fontDescription = list.join(QLatin1Char(','));-
463 }
never executed: end of block
0
464 } else {
never executed: end of block
0
465 fontDescription = fontFamily = fontValue.toString();-
466 }
never executed: end of block
0
467 if (!fontDescription.isEmpty()) {
!fontDescription.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
468 QFont font(fontFamily);-
469 if (font.fromString(fontDescription))
font.fromStrin...ntDescription)Description
TRUEnever evaluated
FALSEnever evaluated
0
470 return new QFont(font);
never executed: return new QFont(font);
0
471 }
never executed: end of block
0
472 }
never executed: end of block
0
473 return 0;
never executed: return 0;
0
474}-
475-
476-
477QStringList QKdeThemePrivate::kdeIconThemeSearchPaths(const QStringList &kdeDirs)-
478{-
479 QStringList paths = QGenericUnixTheme::xdgIconThemePaths();-
480 const QString iconPath = QStringLiteral("/share/icons");
never executed: return qstring_literal_temp;
0
481 foreach (const QString &candidate, kdeDirs) {-
482 const QFileInfo fi(candidate + iconPath);-
483 if (fi.isDir())
fi.isDir()Description
TRUEnever evaluated
FALSEnever evaluated
0
484 paths.append(fi.absoluteFilePath());
never executed: paths.append(fi.absoluteFilePath());
0
485 }
never executed: end of block
0
486 return paths;
never executed: return paths;
0
487}-
488-
489QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const-
490{-
491 Q_D(const QKdeTheme);-
492 switch (hint) {-
493 case QPlatformTheme::UseFullScreenForPopupMenu:
never executed: case QPlatformTheme::UseFullScreenForPopupMenu:
0
494 return QVariant(true);
never executed: return QVariant(true);
0
495 case QPlatformTheme::DialogButtonBoxButtonsHaveIcons:
never executed: case QPlatformTheme::DialogButtonBoxButtonsHaveIcons:
0
496 return QVariant(true);
never executed: return QVariant(true);
0
497 case QPlatformTheme::DialogButtonBoxLayout:
never executed: case QPlatformTheme::DialogButtonBoxLayout:
0
498 return QVariant(QPlatformDialogHelper::KdeLayout);
never executed: return QVariant(QPlatformDialogHelper::KdeLayout);
0
499 case QPlatformTheme::ToolButtonStyle:
never executed: case QPlatformTheme::ToolButtonStyle:
0
500 return QVariant(d->toolButtonStyle);
never executed: return QVariant(d->toolButtonStyle);
0
501 case QPlatformTheme::ToolBarIconSize:
never executed: case QPlatformTheme::ToolBarIconSize:
0
502 return QVariant(d->toolBarIconSize);
never executed: return QVariant(d->toolBarIconSize);
0
503 case QPlatformTheme::SystemIconThemeName:
never executed: case QPlatformTheme::SystemIconThemeName:
0
504 return QVariant(d->iconThemeName);
never executed: return QVariant(d->iconThemeName);
0
505 case QPlatformTheme::SystemIconFallbackThemeName:
never executed: case QPlatformTheme::SystemIconFallbackThemeName:
0
506 return QVariant(d->iconFallbackThemeName);
never executed: return QVariant(d->iconFallbackThemeName);
0
507 case QPlatformTheme::IconThemeSearchPaths:
never executed: case QPlatformTheme::IconThemeSearchPaths:
0
508 return QVariant(d->kdeIconThemeSearchPaths(d->kdeDirs));
never executed: return QVariant(d->kdeIconThemeSearchPaths(d->kdeDirs));
0
509 case QPlatformTheme::StyleNames:
never executed: case QPlatformTheme::StyleNames:
0
510 return QVariant(d->styleNames);
never executed: return QVariant(d->styleNames);
0
511 case QPlatformTheme::KeyboardScheme:
never executed: case QPlatformTheme::KeyboardScheme:
0
512 return QVariant(int(KdeKeyboardScheme));
never executed: return QVariant(int(KdeKeyboardScheme));
0
513 case QPlatformTheme::ItemViewActivateItemOnSingleClick:
never executed: case QPlatformTheme::ItemViewActivateItemOnSingleClick:
0
514 return QVariant(d->singleClick);
never executed: return QVariant(d->singleClick);
0
515 case QPlatformTheme::WheelScrollLines:
never executed: case QPlatformTheme::WheelScrollLines:
0
516 return QVariant(d->wheelScrollLines);
never executed: return QVariant(d->wheelScrollLines);
0
517 default:
never executed: default:
0
518 break;
never executed: break;
0
519 }-
520 return QPlatformTheme::themeHint(hint);
never executed: return QPlatformTheme::themeHint(hint);
0
521}-
522-
523const QPalette *QKdeTheme::palette(Palette type) const-
524{-
525 Q_D(const QKdeTheme);-
526 return d->resources.palettes[type];
never executed: return d->resources.palettes[type];
0
527}-
528-
529const QFont *QKdeTheme::font(Font type) const-
530{-
531 Q_D(const QKdeTheme);-
532 return d->resources.fonts[type];
never executed: return d->resources.fonts[type];
0
533}-
534-
535QPlatformTheme *QKdeTheme::createKdeTheme()-
536{-
537 const QByteArray kdeVersionBA = qgetenv("KDE_SESSION_VERSION");-
538 const int kdeVersion = kdeVersionBA.toInt();-
539 if (kdeVersion < 4)
kdeVersion < 4Description
TRUEnever evaluated
FALSEnever evaluated
0
540 return 0;
never executed: return 0;
0
541-
542 if (kdeVersion > 4)
kdeVersion > 4Description
TRUEnever evaluated
FALSEnever evaluated
0
543 // Plasma 5 follows XDG spec-
544 // but uses the same config file format:-
545 return new QKdeTheme(QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation), kdeVersion);
never executed: return new QKdeTheme(QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation), kdeVersion);
0
546-
547 // Determine KDE prefixes in the following priority order:-
548 // - KDEHOME and KDEDIRS environment variables-
549 // - ~/.kde(<version>)-
550 // - read prefixes from /etc/kde<version>rc-
551 // - fallback to /etc/kde<version>-
552-
553 QStringList kdeDirs;-
554 const QString kdeHomePathVar = QFile::decodeName(qgetenv("KDEHOME"));-
555 if (!kdeHomePathVar.isEmpty())
!kdeHomePathVar.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
556 kdeDirs += kdeHomePathVar;
never executed: kdeDirs += kdeHomePathVar;
0
557-
558 const QString kdeDirsVar = QFile::decodeName(qgetenv("KDEDIRS"));-
559 if (!kdeDirsVar.isEmpty())
!kdeDirsVar.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
560 kdeDirs += kdeDirsVar.split(QLatin1Char(':'), QString::SkipEmptyParts);
never executed: kdeDirs += kdeDirsVar.split(QLatin1Char(':'), QString::SkipEmptyParts);
0
561-
562 const QString kdeVersionHomePath = QDir::homePath() + QLatin1String("/.kde") + QLatin1String(kdeVersionBA);-
563 if (QFileInfo(kdeVersionHomePath).isDir())
QFileInfo(kdeV...ePath).isDir()Description
TRUEnever evaluated
FALSEnever evaluated
0
564 kdeDirs += kdeVersionHomePath;
never executed: kdeDirs += kdeVersionHomePath;
0
565-
566 const QString kdeHomePath = QDir::homePath() + QLatin1String("/.kde");-
567 if (QFileInfo(kdeHomePath).isDir())
QFileInfo(kdeHomePath).isDir()Description
TRUEnever evaluated
FALSEnever evaluated
0
568 kdeDirs += kdeHomePath;
never executed: kdeDirs += kdeHomePath;
0
569-
570 const QString kdeRcPath = QLatin1String("/etc/kde") + QLatin1String(kdeVersionBA) + QLatin1String("rc");-
571 if (QFileInfo(kdeRcPath).isReadable()) {
QFileInfo(kdeR...).isReadable()Description
TRUEnever evaluated
FALSEnever evaluated
0
572 QSettings kdeSettings(kdeRcPath, QSettings::IniFormat);-
573 kdeSettings.beginGroup(QStringLiteral("Directories-default"));
never executed: return qstring_literal_temp;
0
574 kdeDirs += kdeSettings.value(QStringLiteral("prefixes")).toStringList();
never executed: return qstring_literal_temp;
0
575 }
never executed: end of block
0
576-
577 const QString kdeVersionPrefix = QLatin1String("/etc/kde") + QLatin1String(kdeVersionBA);-
578 if (QFileInfo(kdeVersionPrefix).isDir())
QFileInfo(kdeV...refix).isDir()Description
TRUEnever evaluated
FALSEnever evaluated
0
579 kdeDirs += kdeVersionPrefix;
never executed: kdeDirs += kdeVersionPrefix;
0
580-
581 kdeDirs.removeDuplicates();-
582 if (kdeDirs.isEmpty()) {
kdeDirs.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
583 qWarning("Unable to determine KDE dirs");-
584 return 0;
never executed: return 0;
0
585 }-
586-
587 return new QKdeTheme(kdeDirs, kdeVersion);
never executed: return new QKdeTheme(kdeDirs, kdeVersion);
0
588}-
589-
590#ifndef QT_NO_DBUS-
591QPlatformMenuBar *QKdeTheme::createPlatformMenuBar() const-
592{-
593 if (isDBusGlobalMenuAvailable())
isDBusGlobalMenuAvailable()Description
TRUEnever evaluated
FALSEnever evaluated
0
594 return new QDBusMenuBar();
never executed: return new QDBusMenuBar();
0
595 return nullptr;
never executed: return nullptr;
0
596}-
597#endif-
598-
599#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)-
600QPlatformSystemTrayIcon *QKdeTheme::createPlatformSystemTrayIcon() const-
601{-
602 if (isDBusTrayAvailable())
isDBusTrayAvailable()Description
TRUEnever evaluated
FALSEnever evaluated
0
603 return new QDBusTrayIcon();
never executed: return new QDBusTrayIcon();
0
604 return Q_NULLPTR;
never executed: return nullptr;
0
605}-
606#endif-
607-
608#endif // QT_NO_SETTINGS-
609-
610/*!-
611 \class QGnomeTheme-
612 \brief QGnomeTheme is a theme implementation for the Gnome desktop.-
613 \since 5.0-
614 \internal-
615 \ingroup qpa-
616*/-
617-
618const char *QGnomeTheme::name = "gnome";-
619-
620class QGnomeThemePrivate : public QPlatformThemePrivate-
621{-
622public:-
623 QGnomeThemePrivate() : systemFont(Q_NULLPTR), fixedFont(Q_NULLPTR) {}
never executed: end of block
0
624 ~QGnomeThemePrivate() { delete systemFont; delete fixedFont; }
never executed: end of block
0
625-
626 void configureFonts(const QString &gtkFontName) const-
627 {-
628 Q_ASSERT(!systemFont);-
629 const int split = gtkFontName.lastIndexOf(QChar::Space);-
630 float size = gtkFontName.midRef(split + 1).toFloat();-
631 QString fontName = gtkFontName.left(split);-
632-
633 systemFont = new QFont(fontName, size);-
634 fixedFont = new QFont(QLatin1String("monospace"), systemFont->pointSize());-
635 fixedFont->setStyleHint(QFont::TypeWriter);-
636 }
never executed: end of block
0
637-
638 mutable QFont *systemFont;-
639 mutable QFont *fixedFont;-
640};-
641-
642QGnomeTheme::QGnomeTheme()-
643 : QPlatformTheme(new QGnomeThemePrivate())-
644{-
645}
never executed: end of block
0
646-
647QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const-
648{-
649 switch (hint) {-
650 case QPlatformTheme::DialogButtonBoxButtonsHaveIcons:
never executed: case QPlatformTheme::DialogButtonBoxButtonsHaveIcons:
0
651 return QVariant(true);
never executed: return QVariant(true);
0
652 case QPlatformTheme::DialogButtonBoxLayout:
never executed: case QPlatformTheme::DialogButtonBoxLayout:
0
653 return QVariant(QPlatformDialogHelper::GnomeLayout);
never executed: return QVariant(QPlatformDialogHelper::GnomeLayout);
0
654 case QPlatformTheme::SystemIconThemeName:
never executed: case QPlatformTheme::SystemIconThemeName:
0
655 return QVariant(QStringLiteral("Adwaita"));
never executed: return QVariant(([]() -> QString { enum { Size = sizeof(u"" "Adwaita")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Adwaita" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()));
never executed: return qstring_literal_temp;
0
656 case QPlatformTheme::SystemIconFallbackThemeName:
never executed: case QPlatformTheme::SystemIconFallbackThemeName:
0
657 return QVariant(QStringLiteral("gnome"));
never executed: return QVariant(([]() -> QString { enum { Size = sizeof(u"" "gnome")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "gnome" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()));
never executed: return qstring_literal_temp;
0
658 case QPlatformTheme::IconThemeSearchPaths:
never executed: case QPlatformTheme::IconThemeSearchPaths:
0
659 return QVariant(QGenericUnixTheme::xdgIconThemePaths());
never executed: return QVariant(QGenericUnixTheme::xdgIconThemePaths());
0
660 case QPlatformTheme::StyleNames: {
never executed: case QPlatformTheme::StyleNames:
0
661 QStringList styleNames;-
662 styleNames << QStringLiteral("fusion") << QStringLiteral("windows");
never executed: return qstring_literal_temp;
never executed: return qstring_literal_temp;
0
663 return QVariant(styleNames);
never executed: return QVariant(styleNames);
0
664 }-
665 case QPlatformTheme::KeyboardScheme:
never executed: case QPlatformTheme::KeyboardScheme:
0
666 return QVariant(int(GnomeKeyboardScheme));
never executed: return QVariant(int(GnomeKeyboardScheme));
0
667 case QPlatformTheme::PasswordMaskCharacter:
never executed: case QPlatformTheme::PasswordMaskCharacter:
0
668 return QVariant(QChar(0x2022));
never executed: return QVariant(QChar(0x2022));
0
669 default:
never executed: default:
0
670 break;
never executed: break;
0
671 }-
672 return QPlatformTheme::themeHint(hint);
never executed: return QPlatformTheme::themeHint(hint);
0
673}-
674-
675const QFont *QGnomeTheme::font(Font type) const-
676{-
677 Q_D(const QGnomeTheme);-
678 if (!d->systemFont)
!d->systemFontDescription
TRUEnever evaluated
FALSEnever evaluated
0
679 d->configureFonts(gtkFontName());
never executed: d->configureFonts(gtkFontName());
0
680 switch (type) {-
681 case QPlatformTheme::SystemFont:
never executed: case QPlatformTheme::SystemFont:
0
682 return d->systemFont;
never executed: return d->systemFont;
0
683 case QPlatformTheme::FixedFont:
never executed: case QPlatformTheme::FixedFont:
0
684 return d->fixedFont;
never executed: return d->fixedFont;
0
685 default:
never executed: default:
0
686 return 0;
never executed: return 0;
0
687 }-
688}-
689-
690QString QGnomeTheme::gtkFontName() const-
691{-
692 return QStringLiteral("%1 %2").arg(QLatin1String(defaultSystemFontNameC)).arg(defaultSystemFontSize);
never executed: return ([]() -> QString { enum { Size = sizeof(u"" "%1 %2")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "%1 %2" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()).arg(QLatin1String(defaultSystemFontNameC)).arg(defaultSystemFontSize);
never executed: return qstring_literal_temp;
0
693}-
694-
695#ifndef QT_NO_DBUS-
696QPlatformMenuBar *QGnomeTheme::createPlatformMenuBar() const-
697{-
698 if (isDBusGlobalMenuAvailable())
isDBusGlobalMenuAvailable()Description
TRUEnever evaluated
FALSEnever evaluated
0
699 return new QDBusMenuBar();
never executed: return new QDBusMenuBar();
0
700 return nullptr;
never executed: return nullptr;
0
701}-
702#endif-
703-
704#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)-
705QPlatformSystemTrayIcon *QGnomeTheme::createPlatformSystemTrayIcon() const-
706{-
707 if (isDBusTrayAvailable())
isDBusTrayAvailable()Description
TRUEnever evaluated
FALSEnever evaluated
0
708 return new QDBusTrayIcon();
never executed: return new QDBusTrayIcon();
0
709 return Q_NULLPTR;
never executed: return nullptr;
0
710}-
711#endif-
712-
713QString QGnomeTheme::standardButtonText(int button) const-
714{-
715 switch (button) {-
716 case QPlatformDialogHelper::Ok:
never executed: case QPlatformDialogHelper::Ok:
0
717 return QCoreApplication::translate("QGnomeTheme", "&OK");
never executed: return QCoreApplication::translate("QGnomeTheme", "&OK");
0
718 case QPlatformDialogHelper::Save:
never executed: case QPlatformDialogHelper::Save:
0
719 return QCoreApplication::translate("QGnomeTheme", "&Save");
never executed: return QCoreApplication::translate("QGnomeTheme", "&Save");
0
720 case QPlatformDialogHelper::Cancel:
never executed: case QPlatformDialogHelper::Cancel:
0
721 return QCoreApplication::translate("QGnomeTheme", "&Cancel");
never executed: return QCoreApplication::translate("QGnomeTheme", "&Cancel");
0
722 case QPlatformDialogHelper::Close:
never executed: case QPlatformDialogHelper::Close:
0
723 return QCoreApplication::translate("QGnomeTheme", "&Close");
never executed: return QCoreApplication::translate("QGnomeTheme", "&Close");
0
724 case QPlatformDialogHelper::Discard:
never executed: case QPlatformDialogHelper::Discard:
0
725 return QCoreApplication::translate("QGnomeTheme", "Close without Saving");
never executed: return QCoreApplication::translate("QGnomeTheme", "Close without Saving");
0
726 default:
never executed: default:
0
727 break;
never executed: break;
0
728 }-
729 return QPlatformTheme::standardButtonText(button);
never executed: return QPlatformTheme::standardButtonText(button);
0
730}-
731-
732/*!-
733 \brief Creates a UNIX theme according to the detected desktop environment.-
734*/-
735-
736QPlatformTheme *QGenericUnixTheme::createUnixTheme(const QString &name)-
737{-
738 if (name == QLatin1String(QGenericUnixTheme::name))
name == QLatin...ixTheme::name)Description
TRUEevaluated 135 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEnever evaluated
0-135
739 return new QGenericUnixTheme;
executed 135 times by 5 tests: return new QGenericUnixTheme;
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
135
740#ifndef QT_NO_SETTINGS-
741 if (name == QLatin1String(QKdeTheme::name))
name == QLatin...deTheme::name)Description
TRUEnever evaluated
FALSEnever evaluated
0
742 if (QPlatformTheme *kdeTheme = QKdeTheme::createKdeTheme())
QPlatformTheme...eateKdeTheme()Description
TRUEnever evaluated
FALSEnever evaluated
0
743 return kdeTheme;
never executed: return kdeTheme;
0
744#endif-
745 if (name == QLatin1String(QGnomeTheme::name))
name == QLatin...meTheme::name)Description
TRUEnever evaluated
FALSEnever evaluated
0
746 return new QGnomeTheme;
never executed: return new QGnomeTheme;
0
747 return Q_NULLPTR;
never executed: return nullptr;
0
748}-
749-
750QStringList QGenericUnixTheme::themeNames()-
751{-
752 QStringList result;-
753 if (QGuiApplication::desktopSettingsAware()) {
QGuiApplicatio...ettingsAware()Description
TRUEevaluated 134 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qapplication - unknown status
1-134
754 const QByteArray desktopEnvironment = QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment();-
755 QList<QByteArray> gtkBasedEnvironments;-
756 gtkBasedEnvironments << "GNOME"-
757 << "X-CINNAMON"-
758 << "UNITY"-
759 << "MATE"-
760 << "XFCE"-
761 << "LXDE";-
762 QList<QByteArray> desktopNames = desktopEnvironment.split(':');-
763 Q_FOREACH (const QByteArray &desktopName, desktopNames) {-
764 if (desktopEnvironment == "KDE") {
desktopEnvironment == "KDE"Description
TRUEnever evaluated
FALSEevaluated 134 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
0-134
765#ifndef QT_NO_SETTINGS-
766 result.push_back(QLatin1String(QKdeTheme::name));-
767#endif-
768 } else if (gtkBasedEnvironments.contains(desktopName)) {
never executed: end of block
gtkBasedEnviro...s(desktopName)Description
TRUEnever evaluated
FALSEevaluated 134 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
0-134
769 // prefer the GTK3 theme implementation with native dialogs etc.-
770 result.push_back(QStringLiteral("gtk3"));
never executed: return qstring_literal_temp;
0
771 // fallback to the generic Gnome theme if loading the GTK3 theme fails-
772 result.push_back(QLatin1String(QGnomeTheme::name));-
773 }
never executed: end of block
0
774 }
executed 134 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
134
775 const QString session = QString::fromLocal8Bit(qgetenv("DESKTOP_SESSION"));-
776 if (!session.isEmpty() && session != QLatin1String("default") && !result.contains(session))
!session.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 134 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
session != QLa...ing("default")Description
TRUEnever evaluated
FALSEnever evaluated
!result.contains(session)Description
TRUEnever evaluated
FALSEnever evaluated
0-134
777 result.push_back(session);
never executed: result.push_back(session);
0
778 } // desktopSettingsAware
executed 134 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
134
779 result.append(QLatin1String(QGenericUnixTheme::name));-
780 return result;
executed 135 times by 5 tests: return result;
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
135
781}-
782-
783QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

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