WelcomeScreen: Show content even for incorrectly capitalized application dir

Work around QTBUG-17529 by normalizing paths first.

Task-number: QTCREATORBUG-6126
Task-number: QTBUG-28230
Change-Id: Ib7a52c81cf546d022b9db8402e225c8d3c10c0ca
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Kai Koehne
2012-11-28 14:25:18 +01:00
parent 2b0c1fb376
commit 50c3e774bb
4 changed files with 62 additions and 7 deletions

View File

@@ -44,6 +44,10 @@
#include <utils/iwelcomepage.h>
#include <utils/networkaccessmanager.h>
#ifdef Q_OS_WIN
#include <utils/winutils.h>
#endif
#include <QScrollArea>
#include <QDesktopServices>
#include <QPainter>
@@ -193,6 +197,26 @@ void WelcomeMode::facilitateQml(QDeclarativeEngine * /*engine*/)
{
}
static QString applicationDirPath()
{
#ifdef Q_OS_WIN
// normalize paths so QML doesn't freak out if it's wrongly capitalized on Windows
return Utils::normalizePathName(QCoreApplication::applicationDirPath());
#else
return QCoreApplication::applicationDirPath();
#endif
}
static QString resourcePath()
{
#ifdef Q_OS_WIN
// normalize paths so QML doesn't freak out if it's wrongly capitalized on Windows
return Utils::normalizePathName(Core::ICore::resourcePath());
#else
return Core::ICore::resourcePath();
#endif
}
void WelcomeMode::initPlugins()
{
QSettings *settings = Core::ICore::settings();
@@ -232,12 +256,12 @@ void WelcomeMode::initPlugins()
QDeclarativeEngine *engine = m_welcomePage->engine();
QStringList importPathList = engine->importPathList();
importPathList << Core::ICore::resourcePath() + QLatin1String("/welcomescreen");
importPathList << resourcePath() + QLatin1String("/welcomescreen");
engine->setImportPathList(importPathList);
if (!debug)
engine->setOutputWarningsToStandardError(false);
engine->setNetworkAccessManagerFactory(m_networkAccessManagerFactory);
QString pluginPath = QCoreApplication::applicationDirPath();
QString pluginPath = applicationDirPath();
#ifdef Q_OS_MAC
pluginPath += QLatin1String("/../PlugIns");
#else
@@ -252,9 +276,11 @@ void WelcomeMode::initPlugins()
ctx->setContextProperty(QLatin1String("pagesModel"), QVariant::fromValue(m_pluginList));
QString path = resourcePath() + QLatin1String("/welcomescreen/welcomescreen.qml");
// finally, load the root page
m_welcomePage->setSource(
QUrl::fromLocalFile(Core::ICore::resourcePath() + QLatin1String("/welcomescreen/welcomescreen.qml")));
QUrl::fromLocalFile(path));
}
QString WelcomeMode::platform() const