forked from qt-creator/qt-creator
Automatically configure examples opened from the welcome page.
Each example can now provide a list of platforms by the examples manifest .xml file. This list can control the target configuration of the example when it is opened in the welcomepage. Change-Id: I893230fd2850b7a1272db71a7f589044d52041d1 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -41,6 +41,8 @@
|
||||
#include "qt4projectmanagerconstants.h"
|
||||
#include "qt4buildconfiguration.h"
|
||||
#include "findqt4profiles.h"
|
||||
#include "qt4basetargetfactory.h"
|
||||
#include "buildconfigurationinfo.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
@@ -1334,6 +1336,36 @@ bool Qt4Project::needsConfiguration() const
|
||||
return targets().isEmpty();
|
||||
}
|
||||
|
||||
void Qt4Project::configureAsExampleProject(const QStringList &platforms)
|
||||
{
|
||||
QList<Qt4BaseTargetFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<Qt4BaseTargetFactory>();
|
||||
foreach (Qt4BaseTargetFactory *factory, factories) {
|
||||
foreach (const QString &id, factory->supportedTargetIds()) {
|
||||
QList<BuildConfigurationInfo> infos
|
||||
= factory->availableBuildConfigurations(id, rootProjectNode()->path(),
|
||||
QtSupport::QtVersionNumber(),
|
||||
QtSupport::QtVersionNumber(INT_MAX, INT_MAX, INT_MAX),
|
||||
Core::FeatureSet());
|
||||
if (!platforms.isEmpty()) {
|
||||
QList<BuildConfigurationInfo> filtered;
|
||||
foreach (const BuildConfigurationInfo &info, infos) {
|
||||
foreach (const QString &platform, platforms) {
|
||||
if (info.version()->supportsPlatform(platform)) {
|
||||
filtered << info;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
infos = filtered;
|
||||
}
|
||||
|
||||
if (!infos.isEmpty())
|
||||
addTarget(factory->create(this, id, infos));
|
||||
}
|
||||
}
|
||||
ProjectExplorer::ProjectExplorerPlugin::instance()->requestProjectModeUpdate(this);
|
||||
}
|
||||
|
||||
/*!
|
||||
Handle special case were a subproject of the qt directory is opened, and
|
||||
qt was configured to be built as a shadow build -> also build in the sub-
|
||||
|
Reference in New Issue
Block a user