Commit 4c5ce801 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Add method to retreive valid Qt versions only

parent 74ae8314
......@@ -89,12 +89,7 @@ ProjectLoadWizard::ProjectLoadWizard(Qt4Project *project, QWidget *parent, Qt::W
// The default buildConfiguration depends on QmakeBuildConfig::DebugBuild
// Also if the qt version is not yet in the Tools Options dialog we offer to add it there
QList<QtVersion *> validVersions;
foreach (QtVersion * v, vm->versions()) {
if (v->isValid())
validVersions.append(v);
}
QList<QtVersion *> validVersions = vm->validVersions();
if (m_importVersion)
setupImportPage(m_importVersion, m_importBuildConfig, m_additionalArguments);
else if (validVersions.count() > 1)
......
......@@ -159,6 +159,9 @@ QtVersionManager *QtVersionManager::instance()
void QtVersionManager::addVersion(QtVersion *version)
{
QTC_ASSERT(version != 0, return);
if (m_versions.contains(version))
return;
m_versions.append(version);
int uniqueId = version->uniqueId();
m_uniqueIdToIndex.insert(uniqueId, m_versions.count() - 1);
......@@ -278,11 +281,21 @@ void QtVersionManager::writeVersionsIntoSettings()
s->endArray();
}
QList<QtVersion* > QtVersionManager::versions() const
QList<QtVersion *> QtVersionManager::versions() const
{
return m_versions;
}
QList<QtVersion *> QtVersionManager::validVersions() const
{
QList<QtVersion *> results;
foreach(QtVersion *v, m_versions) {
if (v->isValid())
results.append(v);
}
return results;
}
bool QtVersionManager::isValidId(int id) const
{
int pos = m_uniqueIdToIndex.value(id, -1);
......
......@@ -199,6 +199,7 @@ public:
// This will *always* return at least one (Qt in Path), even if that is
// unconfigured.
QList<QtVersion *> versions() const;
QList<QtVersion *> validVersions() const;
// Note: DO NOT STORE THIS POINTER!
// The QtVersionManager will delete it at random times and you will
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment