ProjectExplorer: Reduce ProjectExplorer::configureAsExampleProject()

... to the bits that are actually used.

Change-Id: I39a6ed1f4136d75b776bb89eec6165479097a4ec
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-06-27 16:21:12 +02:00
parent 10098b2508
commit b9d6721be8
8 changed files with 20 additions and 30 deletions

View File

@@ -234,7 +234,7 @@ bool OpenProjectCommand::run()
QTC_ASSERT(openProjectSucceeded, return false);
Project *project = openProjectSucceeded.project();
project->configureAsExampleProject({});
project->configureAsExampleProject();
return CppTools::Tests::TestCase::waitUntilCppModelManagerIsAwareOf(project, timeOutInMs());
}

View File

@@ -291,7 +291,7 @@ ProjectInfo ProjectOpenerAndCloser::open(const QString &projectFile, bool config
Project *project = result.project();
if (configureAsExampleProject)
project->configureAsExampleProject({ });
project->configureAsExampleProject();
if (TestCase::waitUntilCppModelManagerIsAwareOf(project)) {
m_openProjects.append(project);

View File

@@ -844,9 +844,8 @@ bool Project::needsBuildConfigurations() const
return true;
}
void Project::configureAsExampleProject(const QSet<Core::Id> &platforms)
void Project::configureAsExampleProject()
{
Q_UNUSED(platforms);
}
bool Project::knowsAllBuildExecutables() const

View File

@@ -156,7 +156,7 @@ public:
virtual bool needsConfiguration() const;
virtual bool needsBuildConfigurations() const;
virtual void configureAsExampleProject(const QSet<Core::Id> &platforms);
virtual void configureAsExampleProject();
virtual ProjectImporter *projectImporter() const;

View File

@@ -713,20 +713,15 @@ QString QbsProject::uniqueProductName(const qbs::ProductData &product)
return product.name() + QLatin1Char('.') + product.multiplexConfigurationId();
}
void QbsProject::configureAsExampleProject(const QSet<Id> &platforms)
void QbsProject::configureAsExampleProject()
{
QList<BuildInfo> infoList;
QList<Kit *> kits = KitManager::kits();
const auto qtVersionMatchesPlatform = [platforms](const QtSupport::BaseQtVersion *version) {
return platforms.isEmpty() || platforms.intersects(version->targetDeviceTypes());
};
foreach (Kit *k, kits) {
const QtSupport::BaseQtVersion * const qtVersion
= QtSupport::QtKitAspect::qtVersion(k);
if (!qtVersion || !qtVersionMatchesPlatform(qtVersion))
continue;
if (auto factory = BuildConfigurationFactory::find(k, projectFilePath()))
infoList << factory->allAvailableSetups(k, projectFilePath());
const QList<Kit *> kits = KitManager::kits();
for (Kit *k : kits) {
if (QtSupport::QtKitAspect::qtVersion(k) != nullptr) {
if (auto factory = BuildConfigurationFactory::find(k, projectFilePath()))
infoList << factory->allAvailableSetups(k, projectFilePath());
}
}
setup(infoList);
prepareForParsing();

View File

@@ -98,7 +98,7 @@ public:
static QString uniqueProductName(const qbs::ProductData &product);
void configureAsExampleProject(const QSet<Core::Id> &platforms) final;
void configureAsExampleProject() final;
void delayParsing();

View File

@@ -938,19 +938,15 @@ void CentralizedFolderWatcher::delayedFolderChanged(const QString &folder)
m_project->updateCodeModels();
}
void QmakeProject::configureAsExampleProject(const QSet<Core::Id> &platforms)
void QmakeProject::configureAsExampleProject()
{
QList<BuildInfo> infoList;
QList<Kit *> kits = KitManager::kits();
foreach (Kit *k, kits) {
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(k);
if (!version
|| (!platforms.isEmpty()
&& !Utils::contains(version->targetDeviceTypes(), [platforms](Core::Id i) { return platforms.contains(i); })))
continue;
if (auto factory = BuildConfigurationFactory::find(k, projectFilePath()))
infoList << factory->allAvailableSetups(k, projectFilePath());
const QList<Kit *> kits = KitManager::kits();
for (Kit *k : kits) {
if (QtSupport::QtKitAspect::qtVersion(k) != nullptr) {
if (auto factory = BuildConfigurationFactory::find(k, projectFilePath()))
infoList << factory->allAvailableSetups(k, projectFilePath());
}
}
setup(infoList);
}

View File

@@ -95,7 +95,7 @@ public:
void watchFolders(const QStringList &l, QmakePriFile *file);
void unwatchFolders(const QStringList &l, QmakePriFile *file);
void configureAsExampleProject(const QSet<Core::Id> &platforms) final;
void configureAsExampleProject() final;
void emitBuildDirectoryInitialized();
static void proFileParseError(const QString &errorMessage);