Commit 5f9d9910 authored by Daniel Teske's avatar Daniel Teske Committed by Orgad Shaneh
Browse files

Add QtVersionManager::unsortedVersions()



To sort the list, we need to know the version number of all qt
versions. That requires running the qmake. Since in most cases
we don't need the sorted list at startup, add a method for that
and use it.

This prevents almost all calls to queryQmake for me, except for
a few for Android Qt Versions.

Change-Id: I6db89f214d68d07fee4b4dd15ee14c10d1248565
Reviewed-by: default avatarOrgad Shaneh <orgads@gmail.com>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent f54b7d63
......@@ -1302,7 +1302,7 @@ void AndroidConfigurations::updateAutomaticKitList()
}
QHash<Abi, QList<QtSupport::BaseQtVersion *> > qtVersionsForArch;
foreach (QtSupport::BaseQtVersion *qtVersion, QtSupport::QtVersionManager::versions()) {
foreach (QtSupport::BaseQtVersion *qtVersion, QtSupport::QtVersionManager::unsortedVersions()) {
if (qtVersion->type() != QLatin1String(Constants::ANDROIDQT))
continue;
QList<Abi> qtAbis = qtVersion->qtAbis();
......
......@@ -60,7 +60,7 @@ QVariant QtKitInformation::defaultValue(ProjectExplorer::Kit *k) const
Q_UNUSED(k);
// find "Qt in PATH":
QList<BaseQtVersion *> versionList = QtVersionManager::versions();
QList<BaseQtVersion *> versionList = QtVersionManager::unsortedVersions();
BaseQtVersion *result = findOrDefault(versionList, [](const BaseQtVersion *v) {
return v->autodetectionSource() == QLatin1String("PATH");
});
......@@ -174,7 +174,7 @@ int QtKitInformation::qtVersionId(const ProjectExplorer::Kit *k)
id = -1;
} else {
QString source = data.toString();
foreach (BaseQtVersion *v, QtVersionManager::versions()) {
foreach (BaseQtVersion *v, QtVersionManager::unsortedVersions()) {
if (v->autodetectionSource() != source)
continue;
id = v->uniqueId();
......
......@@ -354,7 +354,7 @@ void QtVersionManager::updateFromInstaller(bool emitSignal)
qDebug() << "";
}
}
foreach (BaseQtVersion *qtVersion, QtVersionManager::versions()) {
foreach (BaseQtVersion *qtVersion, m_versions) {
if (qtVersion->autodetectionSource().startsWith(QLatin1String("SDK."))) {
if (!sdkVersions.contains(qtVersion->autodetectionSource())) {
if (debug)
......@@ -515,6 +515,13 @@ int QtVersionManager::getUniqueId()
return m_idcount++;
}
QList<BaseQtVersion *> QtVersionManager::unsortedVersions()
{
QList<BaseQtVersion *> versions;
QTC_ASSERT(isLoaded(), return versions);
return m_versions.values();
}
QList<BaseQtVersion *> QtVersionManager::versions()
{
QList<BaseQtVersion *> versions;
......
......@@ -56,6 +56,9 @@ public:
static QList<BaseQtVersion *> versions();
static QList<BaseQtVersion *> validVersions();
// Sorting is slow due to needing to potentially run qmake --query for each version
static QList<BaseQtVersion *> unsortedVersions();
// Note: DO NOT STORE THIS POINTER!
// The QtVersionManager will delete it at random times and you will
// need to get a new pointer by calling this function again!
......
Supports Markdown
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