| 18 | namespace TitleBarStyle { |
| 19 | |
| 20 | static bool isLightTheme(const QString& themeName) |
| 21 | { |
| 22 | QString themeFile = ":/themes/" + themeName; |
| 23 | QFile file(themeFile); |
| 24 | |
| 25 | if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) |
| 26 | return false; |
| 27 | |
| 28 | QString content = QString::fromUtf8(file.read(500)); |
| 29 | file.close(); |
| 30 | |
| 31 | QRegularExpression regex(R"(@theme-type:\s*(light|dark))"); |
| 32 | QRegularExpressionMatch match = regex.match(content); |
| 33 | |
| 34 | if (match.hasMatch()) |
| 35 | return match.captured(1).toLower() == "light"; |
| 36 | |
| 37 | return false; |
| 38 | } |
| 39 | |
| 40 | void applyForTheme(QWidget* window, const QString& themeName) |
| 41 | { |
no test coverage detected