diff --git a/src/plugins/projectexplorer/projectwelcomepage.cpp b/src/plugins/projectexplorer/projectwelcomepage.cpp index a23efe52897..e1a682a4ae3 100644 --- a/src/plugins/projectexplorer/projectwelcomepage.cpp +++ b/src/plugins/projectexplorer/projectwelcomepage.cpp @@ -42,6 +42,10 @@ #include #include +#ifdef Q_OS_WIN +#include +#endif + namespace ProjectExplorer { namespace Internal { @@ -215,6 +219,16 @@ void ProjectWelcomePage::facilitateQml(QDeclarativeEngine *engine) ctx->setContextProperty(QLatin1String("projectWelcomePage"), this); } +QUrl ProjectWelcomePage::pageLocation() const +{ + QString resourcePath = Core::ICore::resourcePath(); +#ifdef Q_OS_WIN + // normalize paths so QML doesn't freak out if it's wrongly capitalized on Windows + resourcePath = Utils::normalizePathName(resourcePath); +#endif + return QUrl::fromLocalFile(resourcePath + QLatin1String("/welcomescreen/develop.qml")); +} + ProjectWelcomePage::Id ProjectWelcomePage::id() const { return Develop; diff --git a/src/plugins/projectexplorer/projectwelcomepage.h b/src/plugins/projectexplorer/projectwelcomepage.h index 4d747ec8d93..82bdb22a48f 100644 --- a/src/plugins/projectexplorer/projectwelcomepage.h +++ b/src/plugins/projectexplorer/projectwelcomepage.h @@ -94,7 +94,7 @@ public: ProjectWelcomePage(); void facilitateQml(QDeclarativeEngine *engine); - QUrl pageLocation() const { return QUrl::fromLocalFile(Core::ICore::resourcePath() + QLatin1String("/welcomescreen/develop.qml")); } + QUrl pageLocation() const; QWidget *page() { return 0; } QString title() const { return tr("Develop"); } int priority() const { return 20; } diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp index fbc5a159ddd..30beae5bedb 100644 --- a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp +++ b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp @@ -37,6 +37,10 @@ #include #include +#ifdef Q_OS_WIN +#include +#endif + #include #include #include @@ -203,7 +207,13 @@ GettingStartedWelcomePage::GettingStartedWelcomePage() : m_engine(0) QUrl GettingStartedWelcomePage::pageLocation() const { - return QUrl::fromLocalFile(Core::ICore::resourcePath() + QLatin1String("/welcomescreen/gettingstarted.qml")); + QString resourcePath = Core::ICore::resourcePath(); +#ifdef Q_OS_WIN + // normalize paths so QML doesn't freak out if it's wrongly capitalized on Windows + resourcePath = Utils::normalizePathName(resourcePath); +#endif + + return QUrl::fromLocalFile(resourcePath + QLatin1String("/welcomescreen/gettingstarted.qml")); } QString GettingStartedWelcomePage::title() const @@ -262,10 +272,15 @@ QString ExamplesWelcomePage::title() const QUrl ExamplesWelcomePage::pageLocation() const { + QString resourcePath = Core::ICore::resourcePath(); +#ifdef Q_OS_WIN + // normalize paths so QML doesn't freak out if it's wrongly capitalized on Windows + resourcePath = Utils::normalizePathName(resourcePath); +#endif if (m_showExamples) - return QUrl::fromLocalFile(Core::ICore::resourcePath() + QLatin1String("/welcomescreen/examples.qml")); + return QUrl::fromLocalFile(resourcePath + QLatin1String("/welcomescreen/examples.qml")); else - return QUrl::fromLocalFile(Core::ICore::resourcePath() + QLatin1String("/welcomescreen/tutorials.qml")); + return QUrl::fromLocalFile(resourcePath + QLatin1String("/welcomescreen/tutorials.qml")); } void ExamplesWelcomePage::facilitateQml(QDeclarativeEngine *engine) diff --git a/src/plugins/welcome/welcomeplugin.cpp b/src/plugins/welcome/welcomeplugin.cpp index 75d80cf909f..e14d85f144d 100644 --- a/src/plugins/welcome/welcomeplugin.cpp +++ b/src/plugins/welcome/welcomeplugin.cpp @@ -44,6 +44,10 @@ #include #include +#ifdef Q_OS_WIN +#include +#endif + #include #include #include @@ -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