summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@digia.com>2012-11-28 14:25:18 +0100
committerKai Koehne <kai.koehne@digia.com>2012-11-29 10:38:28 +0100
commit50c3e774bb4d2e790fb44250d6a6a853d9516858 (patch)
treea4f5398d92a6e3a5fd0ce901578eb761f9d3146d /src
parent2b0c1fb376a410df09b85dfd1549f429aa2b9155 (diff)
downloadqt-creator-50c3e774bb4d2e790fb44250d6a6a853d9516858.tar.gz
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>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/projectexplorer/projectwelcomepage.cpp14
-rw-r--r--src/plugins/projectexplorer/projectwelcomepage.h2
-rw-r--r--src/plugins/qtsupport/gettingstartedwelcomepage.cpp21
-rw-r--r--src/plugins/welcome/welcomeplugin.cpp32
4 files changed, 62 insertions, 7 deletions
diff --git a/src/plugins/projectexplorer/projectwelcomepage.cpp b/src/plugins/projectexplorer/projectwelcomepage.cpp
index a23efe5289..e1a682a4ae 100644
--- a/src/plugins/projectexplorer/projectwelcomepage.cpp
+++ b/src/plugins/projectexplorer/projectwelcomepage.cpp
@@ -42,6 +42,10 @@
#include <projectexplorer/projectexplorer.h>
#include <sessiondialog.h>
+#ifdef Q_OS_WIN
+#include <utils/winutils.h>
+#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 4d747ec8d9..82bdb22a48 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 fbc5a159dd..30beae5bed 100644
--- a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp
+++ b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp
@@ -37,6 +37,10 @@
#include <utils/pathchooser.h>
#include <utils/fileutils.h>
+#ifdef Q_OS_WIN
+#include <utils/winutils.h>
+#endif
+
#include <coreplugin/coreconstants.h>
#include <coreplugin/coreplugin.h>
#include <coreplugin/documentmanager.h>
@@ -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 75d80cf909..e14d85f144 100644
--- a/src/plugins/welcome/welcomeplugin.cpp
+++ b/src/plugins/welcome/welcomeplugin.cpp
@@ -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