summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Belyashov <Sergey.Belyashov@gmail.com>2015-02-12 14:58:08 +0200
committerSergey Belyashov <Sergey.Belyashov@gmail.com>2015-02-13 11:28:47 +0000
commit62bffaca9837fb394783be7db0ab69ec291a6fdb (patch)
tree61fbeea603d48576c8cd2d8ba617aac1f0e3079a
parent28971701fd4baa99f294d9393650b83c40754e18 (diff)
downloadqt-creator-62bffaca9837fb394783be7db0ab69ec291a6fdb.tar.gz
Fix theme loading problem
Error caused by any file named as current theme and placed to directory which is used for starting Qt Creator (formely user home directory). For example, create empty file with name 'default', place it to your home directory (for example: /home/user) and run Qt Creator. As result you will see black corrupted screen. To fix this bug I add checks of theme name. Now Qt Creator will only load theme from current directory if name is explicitly provided by the user or it is an absolute path. Change-Id: I0255c8d220d84bd5b51de7ef9d64c66f7f57959c Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
-rw-r--r--src/plugins/coreplugin/coreplugin.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/coreplugin/coreplugin.cpp b/src/plugins/coreplugin/coreplugin.cpp
index 0477ab05ab..e2bd9d30f0 100644
--- a/src/plugins/coreplugin/coreplugin.cpp
+++ b/src/plugins/coreplugin/coreplugin.cpp
@@ -91,21 +91,22 @@ CorePlugin::~CorePlugin()
setCreatorTheme(0);
}
-static QString absoluteThemePath(const QString &themeName)
+static QString absoluteThemePath(const QString &themeName, bool userProvidedTheme)
{
if (themeName.isEmpty())
return themeName;
QString res = QDir::fromNativeSeparators(themeName);
QFileInfo fi(res);
+ bool tryRawName = userProvidedTheme || fi.isAbsolute();
// Try the given name
- if (fi.exists())
+ if (tryRawName && fi.exists())
return fi.absoluteFilePath();
const QString suffix = QLatin1String("creatortheme");
// Try name.creatortheme
if (fi.suffix() != suffix) {
res = themeName + QLatin1Char('.') + suffix;
fi.setFile(res);
- if (fi.exists())
+ if (tryRawName && fi.exists())
return fi.absoluteFilePath();
}
if (fi.path().isEmpty())
@@ -122,6 +123,7 @@ void CorePlugin::parseArguments(const QStringList &arguments)
QLatin1String(Constants::SETTINGS_THEME), defaultTheme).toString();
QColor overrideColor;
bool presentationMode = false;
+ bool userProvidedTheme = false;
for (int i = 0; i < arguments.size(); ++i) {
if (arguments.at(i) == QLatin1String("-color")) {
@@ -133,11 +135,12 @@ void CorePlugin::parseArguments(const QStringList &arguments)
presentationMode = true;
if (arguments.at(i) == QLatin1String("-theme")) {
themeName = arguments.at(i + 1);
+ userProvidedTheme = true;
i++;
}
}
- QString themeURI = absoluteThemePath(themeName);
+ QString themeURI = absoluteThemePath(themeName, userProvidedTheme);
if (themeURI.isEmpty()) {
themeName = defaultTheme;
themeURI = QStringLiteral("%1/themes/%2.creatortheme").arg(ICore::resourcePath()).arg(themeName);