Commit 00182818 authored by hjk's avatar hjk
Browse files

QtVersionManager: Inline functions into QtFeatureProvider implementation



Also remove duplicated isValid() checks. This can be sped up further
be removing some unused sorting.

Change-Id: Iaa8b8d2f66f0fdc8bff234cfdd8e81e04fc0c436
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 57342b94
......@@ -519,37 +519,6 @@ bool QtVersionManager::isValidId(int id)
return m_versions.contains(id);
}
Core::FeatureSet QtVersionManager::availableFeatures(const QString &platformName)
{
Core::FeatureSet features;
foreach (BaseQtVersion *const qtVersion, validVersions()) {
if (qtVersion->isValid() && ((qtVersion->platformName() == platformName) || platformName.isEmpty()))
features |= qtVersion->availableFeatures();
}
return features;
}
QStringList QtVersionManager::availablePlatforms()
{
QStringList platforms;
foreach (BaseQtVersion *const qtVersion, validVersions()) {
if (qtVersion->isValid() && !qtVersion->platformName().isEmpty())
platforms.append(qtVersion->platformName());
}
platforms.removeDuplicates();
return platforms;
}
QString QtVersionManager::displayNameForPlatform(const QString &string)
{
foreach (BaseQtVersion *const qtVersion, validVersions()) {
if (qtVersion->platformName() == string)
return qtVersion->platformDisplayName();
}
return QString();
}
BaseQtVersion *QtVersionManager::version(int id)
{
QTC_ASSERT(isLoaded(), return 0);
......@@ -851,17 +820,33 @@ static BaseQtVersion::QmakeBuildConfigs qmakeBuildConfigFromCmdArgs(QList<QMakeA
Core::FeatureSet QtFeatureProvider::availableFeatures(const QString &platformName) const
{
return QtVersionManager::availableFeatures(platformName);
Core::FeatureSet features;
foreach (BaseQtVersion *const qtVersion, QtVersionManager::validVersions()) {
if (qtVersion->platformName() == platformName || platformName.isEmpty())
features |= qtVersion->availableFeatures();
}
return features;
}
QStringList QtFeatureProvider::availablePlatforms() const
{
return QtVersionManager::availablePlatforms();
QStringList platforms;
foreach (BaseQtVersion *const qtVersion, QtVersionManager::validVersions()) {
if (!qtVersion->platformName().isEmpty())
platforms.append(qtVersion->platformName());
}
platforms.removeDuplicates();
return platforms;
}
QString QtFeatureProvider::displayNameForPlatform(const QString &string) const
{
return QtVersionManager::displayNameForPlatform(string);
foreach (BaseQtVersion *const qtVersion, QtVersionManager::validVersions()) {
if (qtVersion->platformName() == string)
return qtVersion->platformDisplayName();
}
return QString();
}
} // namespace QtVersion
......@@ -33,9 +33,6 @@
#include "qtsupport_global.h"
#include "baseqtversion.h"
QT_FORWARD_DECLARE_CLASS(QStringList)
namespace QtSupport {
class QTSUPPORT_EXPORT QtVersionManager : public QObject
......@@ -75,10 +72,6 @@ public:
static Utils::FileName findQMakeBinaryFromMakefile(const QString &directory);
static bool isValidId(int id);
static Core::FeatureSet availableFeatures(const QString &platformName);
static QStringList availablePlatforms();
static QString displayNameForPlatform(const QString &string);
signals:
// content of BaseQtVersion objects with qmake path might have changed
void dumpUpdatedFor(const Utils::FileName &qmakeCommand);
......
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