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