From 3e0aae6872f1fc2a91a67693185ebccf6932da8c Mon Sep 17 00:00:00 2001 From: Christiaan Janssen Date: Wed, 21 Nov 2012 14:28:08 +0100 Subject: [PATCH] Creator Examples: providing custom examples-manifest.xml The user can prevent the default loading of examples and provide a custom example manifest file through the environment variable QTC_EXAMPLE_FILE Change-Id: Id458d321e2c8815312e338e458a5283ac64b5c95 Reviewed-by: hjk --- src/plugins/qtsupport/exampleslistmodel.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp index 31f47223adf..35b3269e8d3 100644 --- a/src/plugins/qtsupport/exampleslistmodel.cpp +++ b/src/plugins/qtsupport/exampleslistmodel.cpp @@ -40,6 +40,7 @@ #include #include +#include #include using QtSupport::QtVersionManager; @@ -309,6 +310,16 @@ QStringList ExamplesListModel::exampleSources(QString *examplesFallback, QString QStringList sources; QString resourceDir = Core::ICore::resourcePath() + QLatin1String("/welcomescreen/"); + // overriding examples with a custom XML file + QString exampleFileEnvKey = QLatin1String("QTC_EXAMPLE_FILE"); + if (Utils::Environment::systemEnvironment().hasKey(exampleFileEnvKey)) { + QString filePath = Utils::Environment::systemEnvironment().value(exampleFileEnvKey); + if (filePath.endsWith(QLatin1String(".xml")) && QFileInfo(filePath).exists()) { + sources.append(filePath); + return sources; + } + } + // Qt Creator shipped tutorials sources << (resourceDir + QLatin1String("/qtcreator_tutorials.xml"));