Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | - | |||||||||||||||||||
5 | - | |||||||||||||||||||
6 | - | |||||||||||||||||||
7 | - | |||||||||||||||||||
8 | - | |||||||||||||||||||
9 | - | |||||||||||||||||||
10 | - | |||||||||||||||||||
11 | - | |||||||||||||||||||
12 | extern const QLoggingCategory &qLcTray(); | - | ||||||||||||||||||
13 | - | |||||||||||||||||||
14 | ResourceHelper::ResourceHelper() | - | ||||||||||||||||||
15 | { | - | ||||||||||||||||||
16 | std::fill(palettes, palettes + QPlatformTheme::NPalettes, static_cast<QPalette *>(0)); | - | ||||||||||||||||||
17 | std::fill(fonts, fonts + QPlatformTheme::NFonts, static_cast<QFont *>(0)); | - | ||||||||||||||||||
18 | } never executed: end of block | 0 | ||||||||||||||||||
19 | - | |||||||||||||||||||
20 | void ResourceHelper::clear() | - | ||||||||||||||||||
21 | { | - | ||||||||||||||||||
22 | qDeleteAll(palettes, palettes + QPlatformTheme::NPalettes); | - | ||||||||||||||||||
23 | qDeleteAll(fonts, fonts + QPlatformTheme::NFonts); | - | ||||||||||||||||||
24 | std::fill(palettes, palettes + QPlatformTheme::NPalettes, static_cast<QPalette *>(0)); | - | ||||||||||||||||||
25 | std::fill(fonts, fonts + QPlatformTheme::NFonts, static_cast<QFont *>(0)); | - | ||||||||||||||||||
26 | } never executed: end of block | 0 | ||||||||||||||||||
27 | const char *QGenericUnixTheme::name = "generic"; | - | ||||||||||||||||||
28 | - | |||||||||||||||||||
29 | - | |||||||||||||||||||
30 | - | |||||||||||||||||||
31 | static const char defaultSystemFontNameC[] = "Sans Serif"; | - | ||||||||||||||||||
32 | enum { defaultSystemFontSize = 9 }; | - | ||||||||||||||||||
33 | - | |||||||||||||||||||
34 | - | |||||||||||||||||||
35 | static bool isDBusTrayAvailable() { | - | ||||||||||||||||||
36 | static bool dbusTrayAvailable = false; | - | ||||||||||||||||||
37 | static bool dbusTrayAvailableKnown = false; | - | ||||||||||||||||||
38 | if (!dbusTrayAvailableKnown
| 1-4 | ||||||||||||||||||
39 | QDBusMenuConnection conn; | - | ||||||||||||||||||
40 | if (conn.isStatusNotifierHostRegistered()
| 0-1 | ||||||||||||||||||
41 | dbusTrayAvailable = true; never executed: dbusTrayAvailable = true; | 0 | ||||||||||||||||||
42 | dbusTrayAvailableKnown = true; | - | ||||||||||||||||||
43 | for (bool qt_category_enabled = qLcTray().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 114, __PRETTY_FUNCTION__, qLcTray().categoryName()).debug() << "D-Bus tray available:" << dbusTrayAvailable; | 0-1 | ||||||||||||||||||
44 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||
45 | return executed 5 times by 1 test: dbusTrayAvailable;return dbusTrayAvailable; Executed by:
executed 5 times by 1 test: return dbusTrayAvailable; Executed by:
| 5 | ||||||||||||||||||
46 | } | - | ||||||||||||||||||
47 | - | |||||||||||||||||||
48 | - | |||||||||||||||||||
49 | - | |||||||||||||||||||
50 | static bool checkDBusGlobalMenuAvailable() | - | ||||||||||||||||||
51 | { | - | ||||||||||||||||||
52 | QDBusConnection connection = QDBusConnection::sessionBus(); | - | ||||||||||||||||||
53 | QString registrarService = ([]() -> QString { enum { Size = sizeof(u"" "com.canonical.AppMenu.Registrar")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "com.canonical.AppMenu.Registrar" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 8 times by 8 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 8 times by 8 tests: }());return qstring_literal_temp; Executed by:
| 8 | ||||||||||||||||||
54 | return executed 8 times by 8 tests: connection.interface()->isServiceRegistered(registrarService);return connection.interface()->isServiceRegistered(registrarService); Executed by:
executed 8 times by 8 tests: return connection.interface()->isServiceRegistered(registrarService); Executed by:
| 8 | ||||||||||||||||||
55 | } | - | ||||||||||||||||||
56 | - | |||||||||||||||||||
57 | static bool isDBusGlobalMenuAvailable() | - | ||||||||||||||||||
58 | { | - | ||||||||||||||||||
59 | static bool dbusGlobalMenuAvailable = checkDBusGlobalMenuAvailable(); | - | ||||||||||||||||||
60 | return executed 70 times by 8 tests: dbusGlobalMenuAvailable;return dbusGlobalMenuAvailable; Executed by:
executed 70 times by 8 tests: return dbusGlobalMenuAvailable; Executed by:
| 70 | ||||||||||||||||||
61 | } | - | ||||||||||||||||||
62 | - | |||||||||||||||||||
63 | - | |||||||||||||||||||
64 | class QGenericUnixThemePrivate : public QPlatformThemePrivate | - | ||||||||||||||||||
65 | { | - | ||||||||||||||||||
66 | public: | - | ||||||||||||||||||
67 | QGenericUnixThemePrivate() | - | ||||||||||||||||||
68 | : QPlatformThemePrivate() | - | ||||||||||||||||||
69 | , systemFont(QLatin1String(defaultSystemFontNameC), defaultSystemFontSize) | - | ||||||||||||||||||
70 | , fixedFont(([]() -> QString { enum { Size = sizeof(u"" "monospace")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "monospace" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()), systemFont.pointSize()) | - | ||||||||||||||||||
71 | { | - | ||||||||||||||||||
72 | fixedFont.setStyleHint(QFont::TypeWriter); | - | ||||||||||||||||||
73 | } executed 135 times by 5 tests: end of block Executed by:
| 135 | ||||||||||||||||||
74 | - | |||||||||||||||||||
75 | const QFont systemFont; | - | ||||||||||||||||||
76 | QFont fixedFont; | - | ||||||||||||||||||
77 | }; | - | ||||||||||||||||||
78 | - | |||||||||||||||||||
79 | QGenericUnixTheme::QGenericUnixTheme() | - | ||||||||||||||||||
80 | : QPlatformTheme(new QGenericUnixThemePrivate()) | - | ||||||||||||||||||
81 | { | - | ||||||||||||||||||
82 | } executed 135 times by 5 tests: end of block Executed by:
| 135 | ||||||||||||||||||
83 | - | |||||||||||||||||||
84 | const QFont *QGenericUnixTheme::font(Font type) const | - | ||||||||||||||||||
85 | { | - | ||||||||||||||||||
86 | const QGenericUnixThemePrivate * const d = d_func(); | - | ||||||||||||||||||
87 | switch (type) { | - | ||||||||||||||||||
88 | case executed 205 times by 170 tests: QPlatformTheme::SystemFont:case QPlatformTheme::SystemFont: Executed by:
executed 205 times by 170 tests: case QPlatformTheme::SystemFont: Executed by:
| 205 | ||||||||||||||||||
89 | return executed 205 times by 170 tests: &d->systemFont;return &d->systemFont; Executed by:
executed 205 times by 170 tests: return &d->systemFont; Executed by:
| 205 | ||||||||||||||||||
90 | case executed 275 times by 2 tests: QPlatformTheme::FixedFont:case QPlatformTheme::FixedFont: Executed by:
executed 275 times by 2 tests: case QPlatformTheme::FixedFont: Executed by:
| 275 | ||||||||||||||||||
91 | return executed 275 times by 2 tests: &d->fixedFont;return &d->fixedFont; Executed by:
executed 275 times by 2 tests: return &d->fixedFont; Executed by:
| 275 | ||||||||||||||||||
92 | default executed 5038 times by 14 tests: :default: Executed by:
executed 5038 times by 14 tests: default: Executed by:
| 5038 | ||||||||||||||||||
93 | return executed 5038 times by 14 tests: 0;return 0; Executed by:
executed 5038 times by 14 tests: return 0; Executed by:
| 5038 | ||||||||||||||||||
94 | } | - | ||||||||||||||||||
95 | } | - | ||||||||||||||||||
96 | - | |||||||||||||||||||
97 | - | |||||||||||||||||||
98 | QStringList QGenericUnixTheme::xdgIconThemePaths() | - | ||||||||||||||||||
99 | { | - | ||||||||||||||||||
100 | QStringList paths; | - | ||||||||||||||||||
101 | - | |||||||||||||||||||
102 | const QFileInfo homeIconDir(QDir::homePath() + QLatin1String("/.icons")); | - | ||||||||||||||||||
103 | if (homeIconDir.isDir()
| 0-25 | ||||||||||||||||||
104 | paths.prepend(homeIconDir.absoluteFilePath()); never executed: paths.prepend(homeIconDir.absoluteFilePath()); | 0 | ||||||||||||||||||
105 | - | |||||||||||||||||||
106 | QString xdgDirString = QFile::decodeName(qgetenv("XDG_DATA_DIRS")); | - | ||||||||||||||||||
107 | if (xdgDirString.isEmpty()
| 0-25 | ||||||||||||||||||
108 | xdgDirString = QLatin1String("/usr/local/share/:/usr/share/"); executed 25 times by 25 tests: xdgDirString = QLatin1String("/usr/local/share/:/usr/share/"); Executed by:
| 25 | ||||||||||||||||||
109 | const auto xdgDirs = xdgDirString.splitRef(QLatin1Char(':')); | - | ||||||||||||||||||
110 | for (const QStringRef &xdgDir : xdgDirs) { | - | ||||||||||||||||||
111 | const QFileInfo xdgIconsDir(xdgDir + QLatin1String("/icons")); | - | ||||||||||||||||||
112 | if (xdgIconsDir.isDir()
| 25 | ||||||||||||||||||
113 | paths.append(xdgIconsDir.absoluteFilePath()); executed 25 times by 25 tests: paths.append(xdgIconsDir.absoluteFilePath()); Executed by:
| 25 | ||||||||||||||||||
114 | } executed 50 times by 25 tests: end of block Executed by:
| 50 | ||||||||||||||||||
115 | - | |||||||||||||||||||
116 | const QFileInfo pixmapsIconsDir(([]() -> QString { enum { Size = sizeof(u"" "/usr/share/pixmaps")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "/usr/share/pixmaps" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 25 times by 25 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 25 times by 25 tests: }()));return qstring_literal_temp; Executed by:
| 25 | ||||||||||||||||||
117 | if (pixmapsIconsDir.isDir()
| 0-25 | ||||||||||||||||||
118 | paths.append(pixmapsIconsDir.absoluteFilePath()); executed 25 times by 25 tests: paths.append(pixmapsIconsDir.absoluteFilePath()); Executed by:
| 25 | ||||||||||||||||||
119 | - | |||||||||||||||||||
120 | return executed 25 times by 25 tests: paths;return paths; Executed by:
executed 25 times by 25 tests: return paths; Executed by:
| 25 | ||||||||||||||||||
121 | } | - | ||||||||||||||||||
122 | - | |||||||||||||||||||
123 | - | |||||||||||||||||||
124 | QPlatformMenuBar *QGenericUnixTheme::createPlatformMenuBar() const | - | ||||||||||||||||||
125 | { | - | ||||||||||||||||||
126 | if (isDBusGlobalMenuAvailable()
| 0-70 | ||||||||||||||||||
127 | return never executed: new QDBusMenuBar();return new QDBusMenuBar(); never executed: return new QDBusMenuBar(); | 0 | ||||||||||||||||||
128 | return executed 70 times by 8 tests: nullptr;return nullptr; Executed by:
executed 70 times by 8 tests: return nullptr; Executed by:
| 70 | ||||||||||||||||||
129 | } | - | ||||||||||||||||||
130 | - | |||||||||||||||||||
131 | - | |||||||||||||||||||
132 | - | |||||||||||||||||||
133 | QPlatformSystemTrayIcon *QGenericUnixTheme::createPlatformSystemTrayIcon() const | - | ||||||||||||||||||
134 | { | - | ||||||||||||||||||
135 | if (isDBusTrayAvailable()
| 0-5 | ||||||||||||||||||
136 | return never executed: new QDBusTrayIcon();return new QDBusTrayIcon(); never executed: return new QDBusTrayIcon(); | 0 | ||||||||||||||||||
137 | return executed 5 times by 1 test: nullptr;return nullptr; Executed by:
executed 5 times by 1 test: return nullptr; Executed by:
| 5 | ||||||||||||||||||
138 | } | - | ||||||||||||||||||
139 | - | |||||||||||||||||||
140 | - | |||||||||||||||||||
141 | QVariant QGenericUnixTheme::themeHint(ThemeHint hint) const | - | ||||||||||||||||||
142 | { | - | ||||||||||||||||||
143 | switch (hint) { | - | ||||||||||||||||||
144 | case executed 84 times by 43 tests: QPlatformTheme::SystemIconFallbackThemeName:case QPlatformTheme::SystemIconFallbackThemeName: Executed by:
executed 84 times by 43 tests: case QPlatformTheme::SystemIconFallbackThemeName: Executed by:
| 84 | ||||||||||||||||||
145 | return executed 84 times by 43 tests: 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); returnreturn 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:
executed 84 times by 43 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 84 times by 43 tests: }())));return qstring_literal_temp; Executed by:
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:
| 84 | ||||||||||||||||||
146 | case executed 25 times by 25 tests: QPlatformTheme::IconThemeSearchPaths:case QPlatformTheme::IconThemeSearchPaths: Executed by:
executed 25 times by 25 tests: case QPlatformTheme::IconThemeSearchPaths: Executed by:
| 25 | ||||||||||||||||||
147 | return executed 25 times by 25 tests: xdgIconThemePaths();return xdgIconThemePaths(); Executed by:
executed 25 times by 25 tests: return xdgIconThemePaths(); Executed by:
| 25 | ||||||||||||||||||
148 | case executed 2 times by 1 test: QPlatformTheme::DialogButtonBoxButtonsHaveIcons:case QPlatformTheme::DialogButtonBoxButtonsHaveIcons: Executed by:
executed 2 times by 1 test: case QPlatformTheme::DialogButtonBoxButtonsHaveIcons: Executed by:
| 2 | ||||||||||||||||||
149 | return executed 2 times by 1 test: QVariant(true);return QVariant(true); Executed by:
executed 2 times by 1 test: return QVariant(true); Executed by:
| 2 | ||||||||||||||||||
150 | case executed 201 times by 17 tests: QPlatformTheme::StyleNames:case QPlatformTheme::StyleNames: Executed by:
executed 201 times by 17 tests: {case QPlatformTheme::StyleNames: Executed by:
| 201 | ||||||||||||||||||
151 | QStringList styleNames; | - | ||||||||||||||||||
152 | styleNames << ([]() -> QString { enum { Size = sizeof(u"" "Fusion")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Fusion" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 201 times by 17 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 201 times by 17 tests: }()) << ([]() -> QString { enum { Size = sizeof(u"" "Windows")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Windows" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); returnreturn qstring_literal_temp; Executed by:
executed 201 times by 17 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 201 times by 17 tests: }());return qstring_literal_temp; Executed by:
| 201 | ||||||||||||||||||
153 | return executed 201 times by 17 tests: QVariant(styleNames);return QVariant(styleNames); Executed by:
executed 201 times by 17 tests: return QVariant(styleNames); Executed by:
| 201 | ||||||||||||||||||
154 | } | - | ||||||||||||||||||
155 | case executed 211900 times by 75 tests: QPlatformTheme::KeyboardScheme:case QPlatformTheme::KeyboardScheme: Executed by:
executed 211900 times by 75 tests: case QPlatformTheme::KeyboardScheme: Executed by:
| 211900 | ||||||||||||||||||
156 | return executed 211900 times by 75 tests: QVariant(int(X11KeyboardScheme));return QVariant(int(X11KeyboardScheme)); Executed by:
executed 211900 times by 75 tests: return QVariant(int(X11KeyboardScheme)); Executed by:
| 211900 | ||||||||||||||||||
157 | default executed 24437 times by 118 tests: :default: Executed by:
executed 24437 times by 118 tests: default: Executed by:
| 24437 | ||||||||||||||||||
158 | break; executed 24437 times by 118 tests: break; Executed by:
| 24437 | ||||||||||||||||||
159 | } | - | ||||||||||||||||||
160 | return executed 24437 times by 118 tests: QPlatformTheme::themeHint(hint);return QPlatformTheme::themeHint(hint); Executed by:
executed 24437 times by 118 tests: return QPlatformTheme::themeHint(hint); Executed by:
| 24437 | ||||||||||||||||||
161 | } | - | ||||||||||||||||||
162 | - | |||||||||||||||||||
163 | - | |||||||||||||||||||
164 | class QKdeThemePrivate : public QPlatformThemePrivate | - | ||||||||||||||||||
165 | { | - | ||||||||||||||||||
166 | public: | - | ||||||||||||||||||
167 | QKdeThemePrivate(const QStringList &kdeDirs, int kdeVersion) | - | ||||||||||||||||||
168 | : kdeDirs(kdeDirs) | - | ||||||||||||||||||
169 | , kdeVersion(kdeVersion) | - | ||||||||||||||||||
170 | , toolButtonStyle(Qt::ToolButtonTextBesideIcon) | - | ||||||||||||||||||
171 | , toolBarIconSize(0) | - | ||||||||||||||||||
172 | , singleClick(true) | - | ||||||||||||||||||
173 | , wheelScrollLines(3) | - | ||||||||||||||||||
174 | { } never executed: end of block | 0 | ||||||||||||||||||
175 | - | |||||||||||||||||||
176 | static QString kdeGlobals(const QString &kdeDir, int kdeVersion) | - | ||||||||||||||||||
177 | { | - | ||||||||||||||||||
178 | if (kdeVersion > 4
| 0 | ||||||||||||||||||
179 | return never executed: kdeDir + QLatin1String("/kdeglobals");return kdeDir + QLatin1String("/kdeglobals"); never executed: return kdeDir + QLatin1String("/kdeglobals"); | 0 | ||||||||||||||||||
180 | return never executed: kdeDir + QLatin1String("/share/config/kdeglobals");return kdeDir + QLatin1String("/share/config/kdeglobals"); never executed: return kdeDir + QLatin1String("/share/config/kdeglobals"); | 0 | ||||||||||||||||||
181 | } | - | ||||||||||||||||||
182 | - | |||||||||||||||||||
183 | void refresh(); | - | ||||||||||||||||||
184 | static QVariant readKdeSetting(const QString &key, const QStringList &kdeDirs, int kdeVersion, QHash<QString, QSettings*> &kdeSettings); | - | ||||||||||||||||||
185 | static void readKdeSystemPalette(const QStringList &kdeDirs, int kdeVersion, QHash<QString, QSettings*> &kdeSettings, QPalette *pal); | - | ||||||||||||||||||
186 | static QFont *kdeFont(const QVariant &fontValue); | - | ||||||||||||||||||
187 | static QStringList kdeIconThemeSearchPaths(const QStringList &kdeDirs); | - | ||||||||||||||||||
188 | - | |||||||||||||||||||
189 | const QStringList kdeDirs; | - | ||||||||||||||||||
190 | const int kdeVersion; | - | ||||||||||||||||||
191 | - | |||||||||||||||||||
192 | ResourceHelper resources; | - | ||||||||||||||||||
193 | QString iconThemeName; | - | ||||||||||||||||||
194 | QString iconFallbackThemeName; | - | ||||||||||||||||||
195 | QStringList styleNames; | - | ||||||||||||||||||
196 | int toolButtonStyle; | - | ||||||||||||||||||
197 | int toolBarIconSize; | - | ||||||||||||||||||
198 | bool singleClick; | - | ||||||||||||||||||
199 | int wheelScrollLines; | - | ||||||||||||||||||
200 | }; | - | ||||||||||||||||||
201 | - | |||||||||||||||||||
202 | void QKdeThemePrivate::refresh() | - | ||||||||||||||||||
203 | { | - | ||||||||||||||||||
204 | resources.clear(); | - | ||||||||||||||||||
205 | - | |||||||||||||||||||
206 | toolButtonStyle = Qt::ToolButtonTextBesideIcon; | - | ||||||||||||||||||
207 | toolBarIconSize = 0; | - | ||||||||||||||||||
208 | styleNames.clear(); | - | ||||||||||||||||||
209 | if (kdeVersion >= 5
| 0 | ||||||||||||||||||
210 | 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 never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }());return qstring_literal_temp; 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; }()); | 0 | ||||||||||||||||||
211 | styleNames << ([]() -> 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 never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()) << ([]() -> QString { enum { Size = sizeof(u"" "fusion")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "fusion" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); returnreturn qstring_literal_temp; never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()) << ([]() -> QString { enum { Size = sizeof(u"" "windows")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "windows" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); returnreturn qstring_literal_temp; never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }());return qstring_literal_temp; | 0 | ||||||||||||||||||
212 | if (kdeVersion >= 5
| 0 | ||||||||||||||||||
213 | 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 never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }());return qstring_literal_temp; 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; }()); | 0 | ||||||||||||||||||
214 | else | - | ||||||||||||||||||
215 | 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 never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }());return qstring_literal_temp; 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; }()); | 0 | ||||||||||||||||||
216 | - | |||||||||||||||||||
217 | QHash<QString, QSettings*> kdeSettings; | - | ||||||||||||||||||
218 | - | |||||||||||||||||||
219 | QPalette systemPalette = QPalette(); | - | ||||||||||||||||||
220 | readKdeSystemPalette(kdeDirs, kdeVersion, kdeSettings, &systemPalette); | - | ||||||||||||||||||
221 | resources.palettes[QPlatformTheme::SystemPalette] = new QPalette(systemPalette); | - | ||||||||||||||||||
222 | - | |||||||||||||||||||
223 | - | |||||||||||||||||||
224 | const QVariant styleValue = readKdeSetting(([]() -> QString { enum { Size = sizeof(u"" "widgetStyle")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "widgetStyle" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()), kdeDirs, kdeVersion, kdeSettings);return qstring_literal_temp; | 0 | ||||||||||||||||||
225 | if (styleValue.isValid()
| 0 | ||||||||||||||||||
226 | const QString style = styleValue.toString(); | - | ||||||||||||||||||
227 | if (style != styleNames.front()
| 0 | ||||||||||||||||||
228 | styleNames.push_front(style); never executed: styleNames.push_front(style); | 0 | ||||||||||||||||||
229 | } never executed: end of block | 0 | ||||||||||||||||||
230 | - | |||||||||||||||||||
231 | const QVariant singleClickValue = readKdeSetting(([]() -> QString { enum { Size = sizeof(u"" "KDE/SingleClick")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "KDE/SingleClick" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()), kdeDirs, kdeVersion, kdeSettings);return qstring_literal_temp; | 0 | ||||||||||||||||||
232 | if (singleClickValue.isValid()
| 0 | ||||||||||||||||||
233 | singleClick = singleClickValue.toBool(); never executed: singleClick = singleClickValue.toBool(); | 0 | ||||||||||||||||||
234 | - | |||||||||||||||||||
235 | const QVariant themeValue = readKdeSetting(([]() -> QString { enum { Size = sizeof(u"" "Icons/Theme")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Icons/Theme" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()), kdeDirs, kdeVersion, kdeSettings);return qstring_literal_temp; | 0 | ||||||||||||||||||
236 | if (themeValue.isValid()
| 0 | ||||||||||||||||||
237 | iconThemeName = themeValue.toString(); never executed: iconThemeName = themeValue.toString(); | 0 | ||||||||||||||||||
238 | - | |||||||||||||||||||
239 | const QVariant toolBarIconSizeValue = readKdeSetting(([]() -> QString { enum { Size = sizeof(u"" "ToolbarIcons/Size")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "ToolbarIcons/Size" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()), kdeDirs, kdeVersion, kdeSettings);return qstring_literal_temp; | 0 | ||||||||||||||||||
240 | if (toolBarIconSizeValue.isValid()
| 0 | ||||||||||||||||||
241 | toolBarIconSize = toolBarIconSizeValue.toInt(); never executed: toolBarIconSize = toolBarIconSizeValue.toInt(); | 0 | ||||||||||||||||||
242 | - | |||||||||||||||||||
243 | const QVariant toolbarStyleValue = readKdeSetting(([]() -> QString { enum { Size = sizeof(u"" "Toolbar style/ToolButtonStyle")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Toolbar style/ToolButtonStyle" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()), kdeDirs, kdeVersion, kdeSettings);return qstring_literal_temp; | 0 | ||||||||||||||||||
244 | if (toolbarStyleValue.isValid()
| 0 | ||||||||||||||||||
245 | const QString toolBarStyle = toolbarStyleValue.toString(); | - | ||||||||||||||||||
246 | if (toolBarStyle == QLatin1String("TextBesideIcon")
| 0 | ||||||||||||||||||
247 | toolButtonStyle = Qt::ToolButtonTextBesideIcon; never executed: toolButtonStyle = Qt::ToolButtonTextBesideIcon; | 0 | ||||||||||||||||||
248 | else if (toolBarStyle == QLatin1String("TextOnly")
| 0 | ||||||||||||||||||
249 | toolButtonStyle = Qt::ToolButtonTextOnly; never executed: toolButtonStyle = Qt::ToolButtonTextOnly; | 0 | ||||||||||||||||||
250 | else if (toolBarStyle == QLatin1String("TextUnderIcon")
| 0 | ||||||||||||||||||
251 | toolButtonStyle = Qt::ToolButtonTextUnderIcon; never executed: toolButtonStyle = Qt::ToolButtonTextUnderIcon; | 0 | ||||||||||||||||||
252 | } never executed: end of block | 0 | ||||||||||||||||||
253 | - | |||||||||||||||||||
254 | const QVariant wheelScrollLinesValue = readKdeSetting(([]() -> QString { enum { Size = sizeof(u"" "KDE/WheelScrollLines")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "KDE/WheelScrollLines" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()), kdeDirs, kdeVersion, kdeSettings);return qstring_literal_temp; | 0 | ||||||||||||||||||
255 | if (wheelScrollLinesValue.isValid()
| 0 | ||||||||||||||||||
256 | wheelScrollLines = wheelScrollLinesValue.toInt(); never executed: wheelScrollLines = wheelScrollLinesValue.toInt(); | 0 | ||||||||||||||||||
257 | - | |||||||||||||||||||
258 | - | |||||||||||||||||||
259 | if (QFont *systemFont = kdeFont(readKdeSetting(([]() -> QString { enum { Size = sizeof(u"" "font")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "font" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()), kdeDirs, kdeVersion, kdeSettings))
| 0 | ||||||||||||||||||
260 | resources.fonts[QPlatformTheme::SystemFont] = systemFont; never executed: resources.fonts[QPlatformTheme::SystemFont] = systemFont; | 0 | ||||||||||||||||||
261 | else | - | ||||||||||||||||||
262 | resources.fonts[QPlatformTheme::SystemFont] = new QFont(QLatin1String(defaultSystemFontNameC), defaultSystemFontSize); never executed: resources.fonts[QPlatformTheme::SystemFont] = new QFont(QLatin1String(defaultSystemFontNameC), defaultSystemFontSize); | 0 | ||||||||||||||||||
263 | - | |||||||||||||||||||
264 | if (QFont *fixedFont = kdeFont(readKdeSetting(([]() -> QString { enum { Size = sizeof(u"" "fixed")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "fixed" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()), kdeDirs, kdeVersion, kdeSettings))
| 0 | ||||||||||||||||||
265 | resources.fonts[QPlatformTheme::FixedFont] = fixedFont; | - | ||||||||||||||||||
266 | } never executed: else {end of block | 0 | ||||||||||||||||||
267 | fixedFont = new QFont(QLatin1String(defaultSystemFontNameC), defaultSystemFontSize); | - | ||||||||||||||||||
268 | fixedFont->setStyleHint(QFont::TypeWriter); | - | ||||||||||||||||||
269 | resources.fonts[QPlatformTheme::FixedFont] = fixedFont; | - | ||||||||||||||||||
270 | } never executed: end of block | 0 | ||||||||||||||||||
271 | - | |||||||||||||||||||
272 | qDeleteAll(kdeSettings); | - | ||||||||||||||||||
273 | } never executed: end of block | 0 | ||||||||||||||||||
274 | - | |||||||||||||||||||
275 | QVariant QKdeThemePrivate::readKdeSetting(const QString &key, const QStringList &kdeDirs, int kdeVersion, QHash<QString, QSettings*> &kdeSettings) | - | ||||||||||||||||||
276 | { | - | ||||||||||||||||||
277 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(kdeDirs)>::type> _container_((kdeDirs)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QString &kdeDir = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||
278 | QSettings *settings = kdeSettings.value(kdeDir); | - | ||||||||||||||||||
279 | if (!settings
| 0 | ||||||||||||||||||
280 | const QString kdeGlobalsPath = kdeGlobals(kdeDir, kdeVersion); | - | ||||||||||||||||||
281 | if (QFileInfo(kdeGlobalsPath).isReadable()
| 0 | ||||||||||||||||||
282 | settings = new QSettings(kdeGlobalsPath, QSettings::IniFormat); | - | ||||||||||||||||||
283 | kdeSettings.insert(kdeDir, settings); | - | ||||||||||||||||||
284 | } never executed: end of block | 0 | ||||||||||||||||||
285 | } never executed: end of block | 0 | ||||||||||||||||||
286 | if (settings
| 0 | ||||||||||||||||||
287 | const QVariant value = settings->value(key); | - | ||||||||||||||||||
288 | if (value.isValid()
| 0 | ||||||||||||||||||
289 | return never executed: value;return value; never executed: return value; | 0 | ||||||||||||||||||
290 | } never executed: end of block | 0 | ||||||||||||||||||
291 | } never executed: end of block | 0 | ||||||||||||||||||
292 | return never executed: QVariant();return QVariant(); never executed: return QVariant(); | 0 | ||||||||||||||||||
293 | } | - | ||||||||||||||||||
294 | - | |||||||||||||||||||
295 | - | |||||||||||||||||||
296 | - | |||||||||||||||||||
297 | static inline bool kdeColor(QPalette *pal, QPalette::ColorRole role, const QVariant &value) | - | ||||||||||||||||||
298 | { | - | ||||||||||||||||||
299 | if (!value.isValid()
| 0 | ||||||||||||||||||
300 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
301 | const QStringList values = value.toStringList(); | - | ||||||||||||||||||
302 | if (values.size() != 3
| 0 | ||||||||||||||||||
303 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
304 | pal->setBrush(role, QColor(values.at(0).toInt(), values.at(1).toInt(), values.at(2).toInt())); | - | ||||||||||||||||||
305 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||
306 | } | - | ||||||||||||||||||
307 | - | |||||||||||||||||||
308 | void QKdeThemePrivate::readKdeSystemPalette(const QStringList &kdeDirs, int kdeVersion, QHash<QString, QSettings*> &kdeSettings, QPalette *pal) | - | ||||||||||||||||||
309 | { | - | ||||||||||||||||||
310 | if (!kdeColor(pal, QPalette::Button, readKdeSetting(([]() -> QString { enum { Size = sizeof(u"" "Colors:Button/BackgroundNormal")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Colors:Button/BackgroundNormal" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()), kdeDirs, kdeVersion, kdeSettings))
| 0 | ||||||||||||||||||
311 | - | |||||||||||||||||||
312 | const QColor defaultWindowBackground(214, 210, 208); | - | ||||||||||||||||||
313 | const QColor defaultButtonBackground(223, 220, 217); | - | ||||||||||||||||||
314 | *pal = QPalette(defaultButtonBackground, defaultWindowBackground); | - | ||||||||||||||||||
315 | return; never executed: return; | 0 | ||||||||||||||||||
316 | } | - | ||||||||||||||||||
317 | - | |||||||||||||||||||
318 | kdeColor(pal, QPalette::Window, readKdeSetting(([]() -> QString { enum { Size = sizeof(u"" "Colors:Window/BackgroundNormal")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Colors:Window/BackgroundNormal" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()), kdeDirs, kdeVersion, kdeSettings));return qstring_literal_temp; | 0 | ||||||||||||||||||
319 | kdeColor(pal, QPalette::Text, readKdeSetting(([]() -> QString { enum { Size = sizeof(u"" "Colors:View/ForegroundNormal")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Colors:View/ForegroundNormal" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()), kdeDirs, kdeVersion, kdeSettings));return qstring_literal_temp; | 0 | ||||||||||||||||||
320 | kdeColor(pal, QPalette::WindowText, readKdeSetting(([]() -> QString { enum { Size = sizeof(u"" "Colors:Window/ForegroundNormal")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Colors:Window/ForegroundNormal" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()), kdeDirs, kdeVersion, kdeSettings));return qstring_literal_temp; | 0 | ||||||||||||||||||
321 | kdeColor(pal, QPalette::Base, readKdeSetting(([]() -> QString { enum { Size = sizeof(u"" "Colors:View/BackgroundNormal")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Colors:View/BackgroundNormal" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()), kdeDirs, kdeVersion, kdeSettings));return qstring_literal_temp; | 0 | ||||||||||||||||||
322 | kdeColor(pal, QPalette::Highlight, readKdeSetting(([]() -> QString { enum { Size = sizeof(u"" "Colors:Selection/BackgroundNormal")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Colors:Selection/BackgroundNormal" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()), kdeDirs, kdeVersion, kdeSettings));return qstring_literal_temp; | 0 | ||||||||||||||||||
323 | kdeColor(pal, QPalette::HighlightedText, readKdeSetting(([]() -> QString { enum { Size = sizeof(u"" "Colors:Selection/ForegroundNormal")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Colors:Selection/ForegroundNormal" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()), kdeDirs, kdeVersion, kdeSettings));return qstring_literal_temp; | 0 | ||||||||||||||||||
324 | kdeColor(pal, QPalette::AlternateBase, readKdeSetting(([]() -> QString { enum { Size = sizeof(u"" "Colors:View/BackgroundAlternate")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Colors:View/BackgroundAlternate" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()), kdeDirs, kdeVersion, kdeSettings));return qstring_literal_temp; | 0 | ||||||||||||||||||
325 | kdeColor(pal, QPalette::ButtonText, readKdeSetting(([]() -> QString { enum { Size = sizeof(u"" "Colors:Button/ForegroundNormal")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Colors:Button/ForegroundNormal" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()), kdeDirs, kdeVersion, kdeSettings));return qstring_literal_temp; | 0 | ||||||||||||||||||
326 | kdeColor(pal, QPalette::Link, readKdeSetting(([]() -> QString { enum { Size = sizeof(u"" "Colors:View/ForegroundLink")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Colors:View/ForegroundLink" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()), kdeDirs, kdeVersion, kdeSettings));return qstring_literal_temp; | 0 | ||||||||||||||||||
327 | kdeColor(pal, QPalette::LinkVisited, readKdeSetting(([]() -> QString { enum { Size = sizeof(u"" "Colors:View/ForegroundVisited")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Colors:View/ForegroundVisited" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()), kdeDirs, kdeVersion, kdeSettings));return qstring_literal_temp; | 0 | ||||||||||||||||||
328 | kdeColor(pal, QPalette::ToolTipBase, readKdeSetting(([]() -> QString { enum { Size = sizeof(u"" "Colors:Tooltip/BackgroundNormal")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Colors:Tooltip/BackgroundNormal" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()), kdeDirs, kdeVersion, kdeSettings));return qstring_literal_temp; | 0 | ||||||||||||||||||
329 | kdeColor(pal, QPalette::ToolTipText, readKdeSetting(([]() -> QString { enum { Size = sizeof(u"" "Colors:Tooltip/ForegroundNormal")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Colors:Tooltip/ForegroundNormal" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()), kdeDirs, kdeVersion, kdeSettings));return qstring_literal_temp; | 0 | ||||||||||||||||||
330 | - | |||||||||||||||||||
331 | - | |||||||||||||||||||
332 | - | |||||||||||||||||||
333 | - | |||||||||||||||||||
334 | const QColor button = pal->color(QPalette::Button); | - | ||||||||||||||||||
335 | int h, s, v; | - | ||||||||||||||||||
336 | button.getHsv(&h, &s, &v); | - | ||||||||||||||||||
337 | - | |||||||||||||||||||
338 | const QBrush whiteBrush = QBrush(Qt::white); | - | ||||||||||||||||||
339 | const QBrush buttonBrush = QBrush(button); | - | ||||||||||||||||||
340 | const QBrush buttonBrushDark = QBrush(button.darker(v > 128 ? 200 : 50)); | - | ||||||||||||||||||
341 | const QBrush buttonBrushDark150 = QBrush(button.darker(v > 128 ? 150 : 75)); | - | ||||||||||||||||||
342 | const QBrush buttonBrushLight150 = QBrush(button.lighter(v > 128 ? 150 : 75)); | - | ||||||||||||||||||
343 | const QBrush buttonBrushLight = QBrush(button.lighter(v > 128 ? 200 : 50)); | - | ||||||||||||||||||
344 | - | |||||||||||||||||||
345 | pal->setBrush(QPalette::Disabled, QPalette::WindowText, buttonBrushDark); | - | ||||||||||||||||||
346 | pal->setBrush(QPalette::Disabled, QPalette::ButtonText, buttonBrushDark); | - | ||||||||||||||||||
347 | pal->setBrush(QPalette::Disabled, QPalette::Button, buttonBrush); | - | ||||||||||||||||||
348 | pal->setBrush(QPalette::Disabled, QPalette::Text, buttonBrushDark); | - | ||||||||||||||||||
349 | pal->setBrush(QPalette::Disabled, QPalette::BrightText, whiteBrush); | - | ||||||||||||||||||
350 | pal->setBrush(QPalette::Disabled, QPalette::Base, buttonBrush); | - | ||||||||||||||||||
351 | pal->setBrush(QPalette::Disabled, QPalette::Window, buttonBrush); | - | ||||||||||||||||||
352 | pal->setBrush(QPalette::Disabled, QPalette::Highlight, buttonBrushDark150); | - | ||||||||||||||||||
353 | pal->setBrush(QPalette::Disabled, QPalette::HighlightedText, buttonBrushLight150); | - | ||||||||||||||||||
354 | - | |||||||||||||||||||
355 | - | |||||||||||||||||||
356 | pal->setBrush(QPalette::Light, buttonBrushLight); | - | ||||||||||||||||||
357 | pal->setBrush(QPalette::Midlight, buttonBrushLight150); | - | ||||||||||||||||||
358 | pal->setBrush(QPalette::Mid, buttonBrushDark150); | - | ||||||||||||||||||
359 | pal->setBrush(QPalette::Dark, buttonBrushDark); | - | ||||||||||||||||||
360 | } never executed: end of block | 0 | ||||||||||||||||||
361 | const char *QKdeTheme::name = "kde"; | - | ||||||||||||||||||
362 | - | |||||||||||||||||||
363 | QKdeTheme::QKdeTheme(const QStringList& kdeDirs, int kdeVersion) | - | ||||||||||||||||||
364 | : QPlatformTheme(new QKdeThemePrivate(kdeDirs,kdeVersion)) | - | ||||||||||||||||||
365 | { | - | ||||||||||||||||||
366 | d_func()->refresh(); | - | ||||||||||||||||||
367 | } never executed: end of block | 0 | ||||||||||||||||||
368 | - | |||||||||||||||||||
369 | QFont *QKdeThemePrivate::kdeFont(const QVariant &fontValue) | - | ||||||||||||||||||
370 | { | - | ||||||||||||||||||
371 | if (fontValue.isValid()
| 0 | ||||||||||||||||||
372 | - | |||||||||||||||||||
373 | - | |||||||||||||||||||
374 | - | |||||||||||||||||||
375 | - | |||||||||||||||||||
376 | QString fontDescription; | - | ||||||||||||||||||
377 | QString fontFamily; | - | ||||||||||||||||||
378 | if (fontValue.type() == QVariant::StringList
| 0 | ||||||||||||||||||
379 | const QStringList list = fontValue.toStringList(); | - | ||||||||||||||||||
380 | if (!list.isEmpty()
| 0 | ||||||||||||||||||
381 | fontFamily = list.first(); | - | ||||||||||||||||||
382 | fontDescription = list.join(QLatin1Char(',')); | - | ||||||||||||||||||
383 | } never executed: end of block | 0 | ||||||||||||||||||
384 | } never executed: else {end of block | 0 | ||||||||||||||||||
385 | fontDescription = fontFamily = fontValue.toString(); | - | ||||||||||||||||||
386 | } never executed: end of block | 0 | ||||||||||||||||||
387 | if (!fontDescription.isEmpty()
| 0 | ||||||||||||||||||
388 | QFont font(fontFamily); | - | ||||||||||||||||||
389 | if (font.fromString(fontDescription)
| 0 | ||||||||||||||||||
390 | return never executed: new QFont(font);return new QFont(font); never executed: return new QFont(font); | 0 | ||||||||||||||||||
391 | } never executed: end of block | 0 | ||||||||||||||||||
392 | } never executed: end of block | 0 | ||||||||||||||||||
393 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
394 | } | - | ||||||||||||||||||
395 | - | |||||||||||||||||||
396 | - | |||||||||||||||||||
397 | QStringList QKdeThemePrivate::kdeIconThemeSearchPaths(const QStringList &kdeDirs) | - | ||||||||||||||||||
398 | { | - | ||||||||||||||||||
399 | QStringList paths = QGenericUnixTheme::xdgIconThemePaths(); | - | ||||||||||||||||||
400 | const QString iconPath = ([]() -> QString { enum { Size = sizeof(u"" "/share/icons")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "/share/icons" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }());return qstring_literal_temp; | 0 | ||||||||||||||||||
401 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(kdeDirs)>::type> _container_((kdeDirs)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QString &candidate = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||
402 | const QFileInfo fi(candidate + iconPath); | - | ||||||||||||||||||
403 | if (fi.isDir()
| 0 | ||||||||||||||||||
404 | paths.append(fi.absoluteFilePath()); never executed: paths.append(fi.absoluteFilePath()); | 0 | ||||||||||||||||||
405 | } never executed: end of block | 0 | ||||||||||||||||||
406 | return never executed: paths;return paths; never executed: return paths; | 0 | ||||||||||||||||||
407 | } | - | ||||||||||||||||||
408 | - | |||||||||||||||||||
409 | QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const | - | ||||||||||||||||||
410 | { | - | ||||||||||||||||||
411 | const QKdeThemePrivate * const d = d_func(); | - | ||||||||||||||||||
412 | switch (hint) { | - | ||||||||||||||||||
413 | case never executed: QPlatformTheme::UseFullScreenForPopupMenu:case QPlatformTheme::UseFullScreenForPopupMenu: never executed: case QPlatformTheme::UseFullScreenForPopupMenu: | 0 | ||||||||||||||||||
414 | return never executed: QVariant(true);return QVariant(true); never executed: return QVariant(true); | 0 | ||||||||||||||||||
415 | case never executed: QPlatformTheme::DialogButtonBoxButtonsHaveIcons:case QPlatformTheme::DialogButtonBoxButtonsHaveIcons: never executed: case QPlatformTheme::DialogButtonBoxButtonsHaveIcons: | 0 | ||||||||||||||||||
416 | return never executed: QVariant(true);return QVariant(true); never executed: return QVariant(true); | 0 | ||||||||||||||||||
417 | case never executed: QPlatformTheme::DialogButtonBoxLayout:case QPlatformTheme::DialogButtonBoxLayout: never executed: case QPlatformTheme::DialogButtonBoxLayout: | 0 | ||||||||||||||||||
418 | return never executed: QVariant(QPlatformDialogHelper::KdeLayout);return QVariant(QPlatformDialogHelper::KdeLayout); never executed: return QVariant(QPlatformDialogHelper::KdeLayout); | 0 | ||||||||||||||||||
419 | case never executed: QPlatformTheme::ToolButtonStyle:case QPlatformTheme::ToolButtonStyle: never executed: case QPlatformTheme::ToolButtonStyle: | 0 | ||||||||||||||||||
420 | return never executed: QVariant(d->toolButtonStyle);return QVariant(d->toolButtonStyle); never executed: return QVariant(d->toolButtonStyle); | 0 | ||||||||||||||||||
421 | case never executed: QPlatformTheme::ToolBarIconSize:case QPlatformTheme::ToolBarIconSize: never executed: case QPlatformTheme::ToolBarIconSize: | 0 | ||||||||||||||||||
422 | return never executed: QVariant(d->toolBarIconSize);return QVariant(d->toolBarIconSize); never executed: return QVariant(d->toolBarIconSize); | 0 | ||||||||||||||||||
423 | case never executed: QPlatformTheme::SystemIconThemeName:case QPlatformTheme::SystemIconThemeName: never executed: case QPlatformTheme::SystemIconThemeName: | 0 | ||||||||||||||||||
424 | return never executed: QVariant(d->iconThemeName);return QVariant(d->iconThemeName); never executed: return QVariant(d->iconThemeName); | 0 | ||||||||||||||||||
425 | case never executed: QPlatformTheme::SystemIconFallbackThemeName:case QPlatformTheme::SystemIconFallbackThemeName: never executed: case QPlatformTheme::SystemIconFallbackThemeName: | 0 | ||||||||||||||||||
426 | return never executed: QVariant(d->iconFallbackThemeName);return QVariant(d->iconFallbackThemeName); never executed: return QVariant(d->iconFallbackThemeName); | 0 | ||||||||||||||||||
427 | case never executed: QPlatformTheme::IconThemeSearchPaths:case QPlatformTheme::IconThemeSearchPaths: never executed: case QPlatformTheme::IconThemeSearchPaths: | 0 | ||||||||||||||||||
428 | return never executed: QVariant(d->kdeIconThemeSearchPaths(d->kdeDirs));return QVariant(d->kdeIconThemeSearchPaths(d->kdeDirs)); never executed: return QVariant(d->kdeIconThemeSearchPaths(d->kdeDirs)); | 0 | ||||||||||||||||||
429 | case never executed: QPlatformTheme::StyleNames:case QPlatformTheme::StyleNames: never executed: case QPlatformTheme::StyleNames: | 0 | ||||||||||||||||||
430 | return never executed: QVariant(d->styleNames);return QVariant(d->styleNames); never executed: return QVariant(d->styleNames); | 0 | ||||||||||||||||||
431 | case never executed: QPlatformTheme::KeyboardScheme:case QPlatformTheme::KeyboardScheme: never executed: case QPlatformTheme::KeyboardScheme: | 0 | ||||||||||||||||||
432 | return never executed: QVariant(int(KdeKeyboardScheme));return QVariant(int(KdeKeyboardScheme)); never executed: return QVariant(int(KdeKeyboardScheme)); | 0 | ||||||||||||||||||
433 | case never executed: QPlatformTheme::ItemViewActivateItemOnSingleClick:case QPlatformTheme::ItemViewActivateItemOnSingleClick: never executed: case QPlatformTheme::ItemViewActivateItemOnSingleClick: | 0 | ||||||||||||||||||
434 | return never executed: QVariant(d->singleClick);return QVariant(d->singleClick); never executed: return QVariant(d->singleClick); | 0 | ||||||||||||||||||
435 | case never executed: QPlatformTheme::WheelScrollLines:case QPlatformTheme::WheelScrollLines: never executed: case QPlatformTheme::WheelScrollLines: | 0 | ||||||||||||||||||
436 | return never executed: QVariant(d->wheelScrollLines);return QVariant(d->wheelScrollLines); never executed: return QVariant(d->wheelScrollLines); | 0 | ||||||||||||||||||
437 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||
438 | break; never executed: break; | 0 | ||||||||||||||||||
439 | } | - | ||||||||||||||||||
440 | return never executed: QPlatformTheme::themeHint(hint);return QPlatformTheme::themeHint(hint); never executed: return QPlatformTheme::themeHint(hint); | 0 | ||||||||||||||||||
441 | } | - | ||||||||||||||||||
442 | - | |||||||||||||||||||
443 | const QPalette *QKdeTheme::palette(Palette type) const | - | ||||||||||||||||||
444 | { | - | ||||||||||||||||||
445 | const QKdeThemePrivate * const d = d_func(); | - | ||||||||||||||||||
446 | return never executed: d->resources.palettes[type];return d->resources.palettes[type]; never executed: return d->resources.palettes[type]; | 0 | ||||||||||||||||||
447 | } | - | ||||||||||||||||||
448 | - | |||||||||||||||||||
449 | const QFont *QKdeTheme::font(Font type) const | - | ||||||||||||||||||
450 | { | - | ||||||||||||||||||
451 | const QKdeThemePrivate * const d = d_func(); | - | ||||||||||||||||||
452 | return never executed: d->resources.fonts[type];return d->resources.fonts[type]; never executed: return d->resources.fonts[type]; | 0 | ||||||||||||||||||
453 | } | - | ||||||||||||||||||
454 | - | |||||||||||||||||||
455 | QPlatformTheme *QKdeTheme::createKdeTheme() | - | ||||||||||||||||||
456 | { | - | ||||||||||||||||||
457 | const QByteArray kdeVersionBA = qgetenv("KDE_SESSION_VERSION"); | - | ||||||||||||||||||
458 | const int kdeVersion = kdeVersionBA.toInt(); | - | ||||||||||||||||||
459 | if (kdeVersion < 4
| 0 | ||||||||||||||||||
460 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
461 | - | |||||||||||||||||||
462 | if (kdeVersion > 4
| 0 | ||||||||||||||||||
463 | - | |||||||||||||||||||
464 | - | |||||||||||||||||||
465 | return never executed: new QKdeTheme(QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation), kdeVersion);return new QKdeTheme(QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation), kdeVersion); never executed: return new QKdeTheme(QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation), kdeVersion); | 0 | ||||||||||||||||||
466 | - | |||||||||||||||||||
467 | - | |||||||||||||||||||
468 | - | |||||||||||||||||||
469 | - | |||||||||||||||||||
470 | - | |||||||||||||||||||
471 | - | |||||||||||||||||||
472 | - | |||||||||||||||||||
473 | QStringList kdeDirs; | - | ||||||||||||||||||
474 | const QString kdeHomePathVar = QFile::decodeName(qgetenv("KDEHOME")); | - | ||||||||||||||||||
475 | if (!kdeHomePathVar.isEmpty()
| 0 | ||||||||||||||||||
476 | kdeDirs += kdeHomePathVar; never executed: kdeDirs += kdeHomePathVar; | 0 | ||||||||||||||||||
477 | - | |||||||||||||||||||
478 | const QString kdeDirsVar = QFile::decodeName(qgetenv("KDEDIRS")); | - | ||||||||||||||||||
479 | if (!kdeDirsVar.isEmpty()
| 0 | ||||||||||||||||||
480 | kdeDirs += kdeDirsVar.split(QLatin1Char(':'), QString::SkipEmptyParts); never executed: kdeDirs += kdeDirsVar.split(QLatin1Char(':'), QString::SkipEmptyParts); | 0 | ||||||||||||||||||
481 | - | |||||||||||||||||||
482 | const QString kdeVersionHomePath = QDir::homePath() + QLatin1String("/.kde") + QLatin1String(kdeVersionBA); | - | ||||||||||||||||||
483 | if (QFileInfo(kdeVersionHomePath).isDir()
| 0 | ||||||||||||||||||
484 | kdeDirs += kdeVersionHomePath; never executed: kdeDirs += kdeVersionHomePath; | 0 | ||||||||||||||||||
485 | - | |||||||||||||||||||
486 | const QString kdeHomePath = QDir::homePath() + QLatin1String("/.kde"); | - | ||||||||||||||||||
487 | if (QFileInfo(kdeHomePath).isDir()
| 0 | ||||||||||||||||||
488 | kdeDirs += kdeHomePath; never executed: kdeDirs += kdeHomePath; | 0 | ||||||||||||||||||
489 | - | |||||||||||||||||||
490 | const QString kdeRcPath = QLatin1String("/etc/kde") + QLatin1String(kdeVersionBA) + QLatin1String("rc"); | - | ||||||||||||||||||
491 | if (QFileInfo(kdeRcPath).isReadable()
| 0 | ||||||||||||||||||
492 | QSettings kdeSettings(kdeRcPath, QSettings::IniFormat); | - | ||||||||||||||||||
493 | kdeSettings.beginGroup(([]() -> QString { enum { Size = sizeof(u"" "Directories-default")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Directories-default" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()));return qstring_literal_temp; | 0 | ||||||||||||||||||
494 | kdeDirs += kdeSettings.value(([]() -> QString { enum { Size = sizeof(u"" "prefixes")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "prefixes" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }())).toStringList();return qstring_literal_temp; | 0 | ||||||||||||||||||
495 | } never executed: end of block | 0 | ||||||||||||||||||
496 | - | |||||||||||||||||||
497 | const QString kdeVersionPrefix = QLatin1String("/etc/kde") + QLatin1String(kdeVersionBA); | - | ||||||||||||||||||
498 | if (QFileInfo(kdeVersionPrefix).isDir()
| 0 | ||||||||||||||||||
499 | kdeDirs += kdeVersionPrefix; never executed: kdeDirs += kdeVersionPrefix; | 0 | ||||||||||||||||||
500 | - | |||||||||||||||||||
501 | kdeDirs.removeDuplicates(); | - | ||||||||||||||||||
502 | if (kdeDirs.isEmpty()
| 0 | ||||||||||||||||||
503 | QMessageLogger(__FILE__, 583, __PRETTY_FUNCTION__).warning("Unable to determine KDE dirs"); | - | ||||||||||||||||||
504 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
505 | } | - | ||||||||||||||||||
506 | - | |||||||||||||||||||
507 | return never executed: new QKdeTheme(kdeDirs, kdeVersion);return new QKdeTheme(kdeDirs, kdeVersion); never executed: return new QKdeTheme(kdeDirs, kdeVersion); | 0 | ||||||||||||||||||
508 | } | - | ||||||||||||||||||
509 | - | |||||||||||||||||||
510 | - | |||||||||||||||||||
511 | QPlatformMenuBar *QKdeTheme::createPlatformMenuBar() const | - | ||||||||||||||||||
512 | { | - | ||||||||||||||||||
513 | if (isDBusGlobalMenuAvailable()
| 0 | ||||||||||||||||||
514 | return never executed: new QDBusMenuBar();return new QDBusMenuBar(); never executed: return new QDBusMenuBar(); | 0 | ||||||||||||||||||
515 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||||||||
516 | } | - | ||||||||||||||||||
517 | - | |||||||||||||||||||
518 | - | |||||||||||||||||||
519 | - | |||||||||||||||||||
520 | QPlatformSystemTrayIcon *QKdeTheme::createPlatformSystemTrayIcon() const | - | ||||||||||||||||||
521 | { | - | ||||||||||||||||||
522 | if (isDBusTrayAvailable()
| 0 | ||||||||||||||||||
523 | return never executed: new QDBusTrayIcon();return new QDBusTrayIcon(); never executed: return new QDBusTrayIcon(); | 0 | ||||||||||||||||||
524 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||||||||
525 | } | - | ||||||||||||||||||
526 | const char *QGnomeTheme::name = "gnome"; | - | ||||||||||||||||||
527 | - | |||||||||||||||||||
528 | class QGnomeThemePrivate : public QPlatformThemePrivate | - | ||||||||||||||||||
529 | { | - | ||||||||||||||||||
530 | public: | - | ||||||||||||||||||
531 | QGnomeThemePrivate() : systemFont(nullptr), fixedFont(nullptr) {} never executed: end of block | 0 | ||||||||||||||||||
532 | ~QGnomeThemePrivate() { delete systemFont; delete fixedFont; } never executed: end of block | 0 | ||||||||||||||||||
533 | - | |||||||||||||||||||
534 | void configureFonts(const QString >kFontName) const | - | ||||||||||||||||||
535 | { | - | ||||||||||||||||||
536 | ((!(!systemFont)) ? qt_assert("!systemFont",__FILE__,628) : qt_noop()); | - | ||||||||||||||||||
537 | const int split = gtkFontName.lastIndexOf(QChar::Space); | - | ||||||||||||||||||
538 | float size = gtkFontName.midRef(split + 1).toFloat(); | - | ||||||||||||||||||
539 | QString fontName = gtkFontName.left(split); | - | ||||||||||||||||||
540 | - | |||||||||||||||||||
541 | systemFont = new QFont(fontName, size); | - | ||||||||||||||||||
542 | fixedFont = new QFont(QLatin1String("monospace"), systemFont->pointSize()); | - | ||||||||||||||||||
543 | fixedFont->setStyleHint(QFont::TypeWriter); | - | ||||||||||||||||||
544 | } never executed: end of block | 0 | ||||||||||||||||||
545 | - | |||||||||||||||||||
546 | mutable QFont *systemFont; | - | ||||||||||||||||||
547 | mutable QFont *fixedFont; | - | ||||||||||||||||||
548 | }; | - | ||||||||||||||||||
549 | - | |||||||||||||||||||
550 | QGnomeTheme::QGnomeTheme() | - | ||||||||||||||||||
551 | : QPlatformTheme(new QGnomeThemePrivate()) | - | ||||||||||||||||||
552 | { | - | ||||||||||||||||||
553 | } never executed: end of block | 0 | ||||||||||||||||||
554 | - | |||||||||||||||||||
555 | QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const | - | ||||||||||||||||||
556 | { | - | ||||||||||||||||||
557 | switch (hint) { | - | ||||||||||||||||||
558 | case never executed: QPlatformTheme::DialogButtonBoxButtonsHaveIcons:case QPlatformTheme::DialogButtonBoxButtonsHaveIcons: never executed: case QPlatformTheme::DialogButtonBoxButtonsHaveIcons: | 0 | ||||||||||||||||||
559 | return never executed: QVariant(true);return QVariant(true); never executed: return QVariant(true); | 0 | ||||||||||||||||||
560 | case never executed: QPlatformTheme::DialogButtonBoxLayout:case QPlatformTheme::DialogButtonBoxLayout: never executed: case QPlatformTheme::DialogButtonBoxLayout: | 0 | ||||||||||||||||||
561 | return never executed: QVariant(QPlatformDialogHelper::GnomeLayout);return QVariant(QPlatformDialogHelper::GnomeLayout); never executed: return QVariant(QPlatformDialogHelper::GnomeLayout); | 0 | ||||||||||||||||||
562 | case never executed: QPlatformTheme::SystemIconThemeName:case QPlatformTheme::SystemIconThemeName: never executed: case QPlatformTheme::SystemIconThemeName: | 0 | ||||||||||||||||||
563 | return never executed: 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); returnreturn 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: qstring_literal_temp;return qstring_literal_temp; never executed: }()));return qstring_literal_temp; 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; }())); | 0 | ||||||||||||||||||
564 | case never executed: QPlatformTheme::SystemIconFallbackThemeName:case QPlatformTheme::SystemIconFallbackThemeName: never executed: case QPlatformTheme::SystemIconFallbackThemeName: | 0 | ||||||||||||||||||
565 | return never executed: 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); returnreturn 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: qstring_literal_temp;return qstring_literal_temp; never executed: }()));return qstring_literal_temp; 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; }())); | 0 | ||||||||||||||||||
566 | case never executed: QPlatformTheme::IconThemeSearchPaths:case QPlatformTheme::IconThemeSearchPaths: never executed: case QPlatformTheme::IconThemeSearchPaths: | 0 | ||||||||||||||||||
567 | return never executed: QVariant(QGenericUnixTheme::xdgIconThemePaths());return QVariant(QGenericUnixTheme::xdgIconThemePaths()); never executed: return QVariant(QGenericUnixTheme::xdgIconThemePaths()); | 0 | ||||||||||||||||||
568 | case never executed: QPlatformTheme::StyleNames:case QPlatformTheme::StyleNames: never executed: {case QPlatformTheme::StyleNames: | 0 | ||||||||||||||||||
569 | QStringList styleNames; | - | ||||||||||||||||||
570 | styleNames << ([]() -> QString { enum { Size = sizeof(u"" "fusion")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "fusion" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()) << ([]() -> QString { enum { Size = sizeof(u"" "windows")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "windows" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); returnreturn qstring_literal_temp; never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }());return qstring_literal_temp; | 0 | ||||||||||||||||||
571 | return never executed: QVariant(styleNames);return QVariant(styleNames); never executed: return QVariant(styleNames); | 0 | ||||||||||||||||||
572 | } | - | ||||||||||||||||||
573 | case never executed: QPlatformTheme::KeyboardScheme:case QPlatformTheme::KeyboardScheme: never executed: case QPlatformTheme::KeyboardScheme: | 0 | ||||||||||||||||||
574 | return never executed: QVariant(int(GnomeKeyboardScheme));return QVariant(int(GnomeKeyboardScheme)); never executed: return QVariant(int(GnomeKeyboardScheme)); | 0 | ||||||||||||||||||
575 | case never executed: QPlatformTheme::PasswordMaskCharacter:case QPlatformTheme::PasswordMaskCharacter: never executed: case QPlatformTheme::PasswordMaskCharacter: | 0 | ||||||||||||||||||
576 | return never executed: QVariant(QChar(0x2022));return QVariant(QChar(0x2022)); never executed: return QVariant(QChar(0x2022)); | 0 | ||||||||||||||||||
577 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||
578 | break; never executed: break; | 0 | ||||||||||||||||||
579 | } | - | ||||||||||||||||||
580 | return never executed: QPlatformTheme::themeHint(hint);return QPlatformTheme::themeHint(hint); never executed: return QPlatformTheme::themeHint(hint); | 0 | ||||||||||||||||||
581 | } | - | ||||||||||||||||||
582 | - | |||||||||||||||||||
583 | const QFont *QGnomeTheme::font(Font type) const | - | ||||||||||||||||||
584 | { | - | ||||||||||||||||||
585 | const QGnomeThemePrivate * const d = d_func(); | - | ||||||||||||||||||
586 | if (!d->systemFont
| 0 | ||||||||||||||||||
587 | d->configureFonts(gtkFontName()); never executed: d->configureFonts(gtkFontName()); | 0 | ||||||||||||||||||
588 | switch (type) { | - | ||||||||||||||||||
589 | case never executed: QPlatformTheme::SystemFont:case QPlatformTheme::SystemFont: never executed: case QPlatformTheme::SystemFont: | 0 | ||||||||||||||||||
590 | return never executed: d->systemFont;return d->systemFont; never executed: return d->systemFont; | 0 | ||||||||||||||||||
591 | case never executed: QPlatformTheme::FixedFont:case QPlatformTheme::FixedFont: never executed: case QPlatformTheme::FixedFont: | 0 | ||||||||||||||||||
592 | return never executed: d->fixedFont;return d->fixedFont; never executed: return d->fixedFont; | 0 | ||||||||||||||||||
593 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||
594 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
595 | } | - | ||||||||||||||||||
596 | } | - | ||||||||||||||||||
597 | - | |||||||||||||||||||
598 | QString QGnomeTheme::gtkFontName() const | - | ||||||||||||||||||
599 | { | - | ||||||||||||||||||
600 | return never executed: ([]() -> 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); returnreturn ([]() -> 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: qstring_literal_temp;return qstring_literal_temp; never executed: }()).arg(QLatin1String(defaultSystemFontNameC)).arg(defaultSystemFontSize);return qstring_literal_temp; 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); | 0 | ||||||||||||||||||
601 | } | - | ||||||||||||||||||
602 | - | |||||||||||||||||||
603 | - | |||||||||||||||||||
604 | QPlatformMenuBar *QGnomeTheme::createPlatformMenuBar() const | - | ||||||||||||||||||
605 | { | - | ||||||||||||||||||
606 | if (isDBusGlobalMenuAvailable()
| 0 | ||||||||||||||||||
607 | return never executed: new QDBusMenuBar();return new QDBusMenuBar(); never executed: return new QDBusMenuBar(); | 0 | ||||||||||||||||||
608 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||||||||
609 | } | - | ||||||||||||||||||
610 | - | |||||||||||||||||||
611 | - | |||||||||||||||||||
612 | - | |||||||||||||||||||
613 | QPlatformSystemTrayIcon *QGnomeTheme::createPlatformSystemTrayIcon() const | - | ||||||||||||||||||
614 | { | - | ||||||||||||||||||
615 | if (isDBusTrayAvailable()
| 0 | ||||||||||||||||||
616 | return never executed: new QDBusTrayIcon();return new QDBusTrayIcon(); never executed: return new QDBusTrayIcon(); | 0 | ||||||||||||||||||
617 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||||||||
618 | } | - | ||||||||||||||||||
619 | - | |||||||||||||||||||
620 | - | |||||||||||||||||||
621 | QString QGnomeTheme::standardButtonText(int button) const | - | ||||||||||||||||||
622 | { | - | ||||||||||||||||||
623 | switch (button) { | - | ||||||||||||||||||
624 | case never executed: QPlatformDialogHelper::Ok:case QPlatformDialogHelper::Ok: never executed: case QPlatformDialogHelper::Ok: | 0 | ||||||||||||||||||
625 | return never executed: QCoreApplication::translate("QGnomeTheme", "&OK");return QCoreApplication::translate("QGnomeTheme", "&OK"); never executed: return QCoreApplication::translate("QGnomeTheme", "&OK"); | 0 | ||||||||||||||||||
626 | case never executed: QPlatformDialogHelper::Save:case QPlatformDialogHelper::Save: never executed: case QPlatformDialogHelper::Save: | 0 | ||||||||||||||||||
627 | return never executed: QCoreApplication::translate("QGnomeTheme", "&Save");return QCoreApplication::translate("QGnomeTheme", "&Save"); never executed: return QCoreApplication::translate("QGnomeTheme", "&Save"); | 0 | ||||||||||||||||||
628 | case never executed: QPlatformDialogHelper::Cancel:case QPlatformDialogHelper::Cancel: never executed: case QPlatformDialogHelper::Cancel: | 0 | ||||||||||||||||||
629 | return never executed: QCoreApplication::translate("QGnomeTheme", "&Cancel");return QCoreApplication::translate("QGnomeTheme", "&Cancel"); never executed: return QCoreApplication::translate("QGnomeTheme", "&Cancel"); | 0 | ||||||||||||||||||
630 | case never executed: QPlatformDialogHelper::Close:case QPlatformDialogHelper::Close: never executed: case QPlatformDialogHelper::Close: | 0 | ||||||||||||||||||
631 | return never executed: QCoreApplication::translate("QGnomeTheme", "&Close");return QCoreApplication::translate("QGnomeTheme", "&Close"); never executed: return QCoreApplication::translate("QGnomeTheme", "&Close"); | 0 | ||||||||||||||||||
632 | case never executed: QPlatformDialogHelper::Discard:case QPlatformDialogHelper::Discard: never executed: case QPlatformDialogHelper::Discard: | 0 | ||||||||||||||||||
633 | return never executed: QCoreApplication::translate("QGnomeTheme", "Close without Saving");return QCoreApplication::translate("QGnomeTheme", "Close without Saving"); never executed: return QCoreApplication::translate("QGnomeTheme", "Close without Saving"); | 0 | ||||||||||||||||||
634 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||
635 | break; never executed: break; | 0 | ||||||||||||||||||
636 | } | - | ||||||||||||||||||
637 | return never executed: QPlatformTheme::standardButtonText(button);return QPlatformTheme::standardButtonText(button); never executed: return QPlatformTheme::standardButtonText(button); | 0 | ||||||||||||||||||
638 | } | - | ||||||||||||||||||
639 | - | |||||||||||||||||||
640 | - | |||||||||||||||||||
641 | - | |||||||||||||||||||
642 | - | |||||||||||||||||||
643 | - | |||||||||||||||||||
644 | QPlatformTheme *QGenericUnixTheme::createUnixTheme(const QString &name) | - | ||||||||||||||||||
645 | { | - | ||||||||||||||||||
646 | if (name == QLatin1String(QGenericUnixTheme::name)
| 0-135 | ||||||||||||||||||
647 | return executed 135 times by 5 tests: new QGenericUnixTheme;return new QGenericUnixTheme; Executed by:
executed 135 times by 5 tests: return new QGenericUnixTheme; Executed by:
| 135 | ||||||||||||||||||
648 | - | |||||||||||||||||||
649 | if (name == QLatin1String(QKdeTheme::name)
| 0 | ||||||||||||||||||
650 | if (QPlatformTheme *kdeTheme = QKdeTheme::createKdeTheme()
| 0 | ||||||||||||||||||
651 | return never executed: kdeTheme;return kdeTheme; never executed: return kdeTheme; | 0 | ||||||||||||||||||
652 | - | |||||||||||||||||||
653 | if (name == QLatin1String(QGnomeTheme::name)
| 0 | ||||||||||||||||||
654 | return never executed: new QGnomeTheme;return new QGnomeTheme; never executed: return new QGnomeTheme; | 0 | ||||||||||||||||||
655 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||||||||
656 | } | - | ||||||||||||||||||
657 | - | |||||||||||||||||||
658 | QStringList QGenericUnixTheme::themeNames() | - | ||||||||||||||||||
659 | { | - | ||||||||||||||||||
660 | QStringList result; | - | ||||||||||||||||||
661 | if (QGuiApplication::desktopSettingsAware()
| 1-134 | ||||||||||||||||||
662 | const QByteArray desktopEnvironment = QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment(); | - | ||||||||||||||||||
663 | QList<QByteArray> gtkBasedEnvironments; | - | ||||||||||||||||||
664 | gtkBasedEnvironments << "GNOME" | - | ||||||||||||||||||
665 | << "X-CINNAMON" | - | ||||||||||||||||||
666 | << "UNITY" | - | ||||||||||||||||||
667 | << "MATE" | - | ||||||||||||||||||
668 | << "XFCE" | - | ||||||||||||||||||
669 | << "LXDE"; | - | ||||||||||||||||||
670 | QList<QByteArray> desktopNames = desktopEnvironment.split(':'); | - | ||||||||||||||||||
671 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(desktopNames)>::type> _container_((desktopNames)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QByteArray &desktopName = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||
672 | if (desktopEnvironment == "KDE"
| 0-134 | ||||||||||||||||||
673 | - | |||||||||||||||||||
674 | result.push_back(QLatin1String(QKdeTheme::name)); | - | ||||||||||||||||||
675 | - | |||||||||||||||||||
676 | } never executed: else if (gtkBasedEnvironments.contains(desktopName)end of block
| 0-134 | ||||||||||||||||||
677 | - | |||||||||||||||||||
678 | result.push_back(([]() -> QString { enum { Size = sizeof(u"" "gtk3")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "gtk3" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp; never executed: }()));return qstring_literal_temp; | 0 | ||||||||||||||||||
679 | - | |||||||||||||||||||
680 | result.push_back(QLatin1String(QGnomeTheme::name)); | - | ||||||||||||||||||
681 | } never executed: end of block | 0 | ||||||||||||||||||
682 | } executed 134 times by 5 tests: end of block Executed by:
| 134 | ||||||||||||||||||
683 | const QString session = QString::fromLocal8Bit(qgetenv("DESKTOP_SESSION")); | - | ||||||||||||||||||
684 | if (!session.isEmpty()
| 0-134 | ||||||||||||||||||
685 | result.push_back(session); never executed: result.push_back(session); | 0 | ||||||||||||||||||
686 | } executed 134 times by 5 tests: end of block Executed by:
| 134 | ||||||||||||||||||
687 | result.append(QLatin1String(QGenericUnixTheme::name)); | - | ||||||||||||||||||
688 | return executed 135 times by 5 tests: result;return result; Executed by:
executed 135 times by 5 tests: return result; Executed by:
| 135 | ||||||||||||||||||
689 | } | - | ||||||||||||||||||
690 | - | |||||||||||||||||||
691 | - | |||||||||||||||||||
Switch to Source code | Preprocessed file |