Commit 71b4ce66 authored by Tobias Hunger's avatar Tobias Hunger

Qt: Remove platformName and platformDisplayName methods

Fix fallout of this in KitInformation/Kit/KitManager and the wizards.

Change-Id: I5cb88cc381dc04409401909b810940ab6dccf86a
Reviewed-by: default avatarTim Jenssen <tim.jenssen@theqtcompany.com>
parent d323d595
......@@ -106,7 +106,7 @@ static QString loadLocal(ProjectExplorer::Target *target, int apiLevel, ItemType
bool AndroidManager::supportsAndroid(const ProjectExplorer::Kit *kit)
{
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit);
return version && version->platformName() == QLatin1String(QtSupport::Constants::ANDROID_PLATFORM);
return version && version->targetDeviceTypes().contains(Constants::ANDROID_DEVICE_TYPE);
}
bool AndroidManager::supportsAndroid(const ProjectExplorer::Target *target)
......
......@@ -147,13 +147,3 @@ QSet<Core::Id> AndroidQtVersion::targetDeviceTypes() const
{
return { Constants::ANDROID_DEVICE_TYPE };
}
QString AndroidQtVersion::platformName() const
{
return QLatin1String(QtSupport::Constants::ANDROID_PLATFORM);
}
QString AndroidQtVersion::platformDisplayName() const
{
return QLatin1String(QtSupport::Constants::ANDROID_PLATFORM_TR);
}
......@@ -58,8 +58,6 @@ public:
QSet<Core::Id> availableFeatures() const;
QSet<Core::Id> targetDeviceTypes() const;
QString platformName() const;
QString platformDisplayName() const;
QString description() const;
QString targetArch() const;
......
......@@ -354,7 +354,6 @@ void IWizardFactory::registerFactoryCreator(const IWizardFactory::FactoryCreator
QSet<Id> IWizardFactory::allAvailablePlatforms()
{
QSet<Id> platforms;
foreach (const IFeatureProvider *featureManager, s_providerList)
platforms.unite(featureManager->availablePlatforms());
......
......@@ -294,7 +294,7 @@ ProjectInfo ProjectOpenerAndCloser::open(const QString &projectFile, bool config
Project *project = result.project();
if (configureAsExampleProject)
project->configureAsExampleProject(QStringList());
project->configureAsExampleProject({ });
if (TestCase::waitUntilCppModelManagerIsAwareOf(project)) {
m_openProjects.append(project);
......
......@@ -3244,7 +3244,7 @@ void DebuggerPluginPrivate::testProjectLoaded(Project *project)
}
m_testProject = project;
connect(project, SIGNAL(proFilesEvaluated()), SLOT(testProjectEvaluated()));
project->configureAsExampleProject(QStringList());
project->configureAsExampleProject({ });
}
void DebuggerPluginPrivate::testProjectEvaluated()
......
......@@ -123,13 +123,3 @@ QSet<Core::Id> IosQtVersion::targetDeviceTypes() const
{
return { Constants::IOS_DEVICE_TYPE };
}
QString IosQtVersion::platformName() const
{
return QLatin1String(QtSupport::Constants::IOS_PLATFORM);
}
QString IosQtVersion::platformDisplayName() const
{
return QLatin1String(QtSupport::Constants::IOS_PLATFORM_TR);
}
......@@ -57,8 +57,6 @@ public:
QSet<Core::Id> availableFeatures() const override;
QSet<Core::Id> targetDeviceTypes() const override;
QString platformName() const override;
QString platformDisplayName() const override;
QString description() const override;
};
......
......@@ -69,7 +69,7 @@ void JsonKitsPage::initializePage()
= evaluate(m_requiredFeatures, wiz->value(QLatin1String("RequiredFeatures")), wiz);
setRequiredKitMatcher(KitMatcher([required](const Kit *k) { return k->hasFeatures(required); }));
setPreferredKitMatcher(KitMatcher([platform, preferred](const Kit *k) { return k->hasPlatform(platform) && k->hasFeatures(preferred); }));
setPreferredKitMatcher(KitMatcher([platform, preferred](const Kit *k) { return k->supportedPlatforms().contains(platform) && k->hasFeatures(preferred); }));
setProjectPath(wiz->expander()->expand(unexpandedProjectPath()));
TargetSetupPage::initializePage();
......
......@@ -613,30 +613,19 @@ bool Kit::isMutable(Id id) const
return d->m_mutable.contains(id);
}
QSet<Id> Kit::availablePlatforms() const
QSet<Id> Kit::supportedPlatforms() const
{
QSet<Id> platforms;
foreach (const KitInformation *ki, KitManager::kitInformation())
platforms.unite(ki->availablePlatforms(this));
return platforms;
}
bool Kit::hasPlatform(Id platform) const
{
if (!platform.isValid())
return true;
return availablePlatforms().contains(platform);
}
QString Kit::displayNameForPlatform(Id platform) const
{
foreach (const KitInformation *ki, KitManager::kitInformation()) {
const QString displayName = ki->displayNameForPlatform(this, platform);
if (!displayName.isEmpty())
return displayName;
const QSet<Id> ip = ki->supportedPlatforms(this);
if (ip.isEmpty())
continue;
if (platforms.isEmpty())
platforms = ip;
else
platforms.intersect(ip);
}
return QString();
return platforms;
}
QSet<Id> Kit::availableFeatures() const
......
......@@ -121,9 +121,7 @@ public:
void setMutable(Core::Id id, bool b);
bool isMutable(Core::Id id) const;
QSet<Core::Id> availablePlatforms() const;
bool hasPlatform(Core::Id platform) const;
QString displayNameForPlatform(Core::Id platform) const;
QSet<Core::Id> supportedPlatforms() const;
QSet<Core::Id> availableFeatures() const;
bool hasFeatures(const QSet<Core::Id> &features) const;
Utils::MacroExpander *macroExpander() const;
......
......@@ -341,13 +341,17 @@ KitMatcher DeviceTypeKitInformation::deviceTypeMatcher(Core::Id type)
});
}
QSet<Core::Id> DeviceTypeKitInformation::supportedPlatforms(const Kit *k) const
{
return { deviceTypeId(k) };
}
QSet<Core::Id> DeviceTypeKitInformation::availableFeatures(const Kit *k) const
{
Core::Id id = DeviceTypeKitInformation::deviceTypeId(k);
QSet<Core::Id> result;
if (id.isValid())
result |= Core::Id::fromString(QString::fromLatin1("DeviceType.") + id.toString());
return result;
return { Core::Id::fromString(QString::fromLatin1("DeviceType.") + id.toString()) };
return QSet<Core::Id>();
}
// --------------------------------------------------------------------------
......
......@@ -133,6 +133,7 @@ public:
static KitMatcher deviceTypeMatcher(Core::Id type);
QSet<Core::Id> supportedPlatforms(const Kit *k) const;
QSet<Core::Id> availableFeatures(const Kit *k) const;
};
......
......@@ -30,6 +30,7 @@
#include "kitmanager.h"
#include "devicesupport/idevicefactory.h"
#include "kit.h"
#include "kitfeatureprovider.h"
#include "kitmanagerconfigwidget.h"
......@@ -302,31 +303,21 @@ void KitManager::deregisterKitInformation(KitInformation *ki)
delete ki;
}
QSet<Id> KitManager::availablePlatforms()
QSet<Id> KitManager::supportedPlatforms()
{
QSet<Id> platforms;
foreach (const Kit *k, kits())
platforms.unite(k->availablePlatforms());
platforms.unite(k->supportedPlatforms());
return platforms;
}
QString KitManager::displayNameForPlatform(Id platform)
{
foreach (const Kit *k, kits()) {
const QString displayName = k->displayNameForPlatform(platform);
if (!displayName.isEmpty())
return displayName;
}
return QString();
}
QSet<Id> KitManager::availableFeatures(Id platform)
QSet<Id> KitManager::availableFeatures(Core::Id platformId)
{
QSet<Id> features;
foreach (const Kit *k, kits()) {
QSet<Id> kitPlatforms = k->availablePlatforms();
if (kitPlatforms.isEmpty() || kitPlatforms.contains(platform) || !platform.isValid())
features.unite(k->availableFeatures());
if (!k->supportedPlatforms().contains(platformId))
continue;
features.unite(k->availableFeatures());
}
return features;
}
......@@ -553,19 +544,12 @@ QString KitInformation::displayNamePostfix(const Kit *k) const
return QString();
}
QSet<Id> KitInformation::availablePlatforms(const Kit *k) const
QSet<Id> KitInformation::supportedPlatforms(const Kit *k) const
{
Q_UNUSED(k);
return QSet<Id>();
}
QString KitInformation::displayNameForPlatform(const Kit *k, Id platform) const
{
Q_UNUSED(k);
Q_UNUSED(platform);
return QString();
}
QSet<Id> KitInformation::availableFeatures(const Kit *k) const
{
Q_UNUSED(k);
......@@ -588,6 +572,8 @@ void KitInformation::notifyAboutUpdate(Kit *k)
// KitFeatureProvider:
// --------------------------------------------------------------------
// This FeatureProvider maps the platforms onto the device types.
QSet<Id> KitFeatureProvider::availableFeatures(Id id) const
{
return KitManager::availableFeatures(id);
......@@ -595,12 +581,17 @@ QSet<Id> KitFeatureProvider::availableFeatures(Id id) const
QSet<Id> KitFeatureProvider::availablePlatforms() const
{
return KitManager::availablePlatforms();
return KitManager::supportedPlatforms();
}
QString KitFeatureProvider::displayNameForPlatform(Id id) const
{
return KitManager::displayNameForPlatform(id);
foreach (const IDeviceFactory *f, ExtensionSystem::PluginManager::getObjects<IDeviceFactory>()) {
const QString dn = f->displayNameForId(id);
if (!dn.isEmpty())
return dn;
}
return QString();
}
} // namespace ProjectExplorer
......@@ -95,8 +95,7 @@ public:
virtual QString displayNamePostfix(const Kit *k) const;
virtual QSet<Core::Id> availablePlatforms(const Kit *k) const;
virtual QString displayNameForPlatform(const Kit *k, Core::Id platform) const;
virtual QSet<Core::Id> supportedPlatforms(const Kit *k) const;
virtual QSet<Core::Id> availableFeatures(const Kit *k) const;
virtual void addToMacroExpander(ProjectExplorer::Kit *kit, Utils::MacroExpander *expander) const;
......@@ -152,9 +151,8 @@ public:
static void registerKitInformation(KitInformation *ki);
static void deregisterKitInformation(KitInformation *ki);
static QSet<Core::Id> availablePlatforms();
static QString displayNameForPlatform(Core::Id platform);
static QSet<Core::Id> availableFeatures(Core::Id platform);
static QSet<Core::Id> supportedPlatforms();
static QSet<Core::Id> availableFeatures(Core::Id platformId);
static QList<Kit *> sortKits(const QList<Kit *> kits); // Avoid sorting whenever possible!
......
......@@ -616,7 +616,7 @@ bool Project::needsConfiguration() const
return false;
}
void Project::configureAsExampleProject(const QStringList &platforms)
void Project::configureAsExampleProject(const QSet<Core::Id> &platforms)
{
Q_UNUSED(platforms);
}
......
......@@ -131,7 +131,7 @@ public:
void setNamedSettings(const QString &name, const QVariant &value);
virtual bool needsConfiguration() const;
virtual void configureAsExampleProject(const QStringList &platforms);
virtual void configureAsExampleProject(const QSet<Core::Id> &platforms);
virtual bool requiresTargetPanel() const;
virtual ProjectImporter *createProjectImporter() const;
......
......@@ -1339,15 +1339,15 @@ bool QmakeProject::needsConfiguration() const
return targets().isEmpty();
}
void QmakeProject::configureAsExampleProject(const QStringList &platforms)
void QmakeProject::configureAsExampleProject(const QSet<Core::Id> &platforms)
{
QList<const BuildInfo *> infoList;
QList<Kit *> kits = KitManager::kits();
foreach (Kit *k, kits) {
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
if (!version)
if (!version || platforms.isEmpty())
continue;
if (!platforms.isEmpty() && !platforms.contains(version->platformName()))
if (!Utils::contains(version->targetDeviceTypes(), [platforms](Core::Id i) { return platforms.contains(i); }))
continue;
IBuildConfigurationFactory *factory = IBuildConfigurationFactory::find(k, projectFilePath().toString());
......
......@@ -125,7 +125,7 @@ public:
bool needsConfiguration() const;
void configureAsExampleProject(const QStringList &platforms);
void configureAsExampleProject(const QSet<Core::Id> &platforms);
bool requiresTargetPanel() const;
......
......@@ -32,8 +32,6 @@
#include "filespage.h"
#include <qtsupport/qtsupportconstants.h>
#include <projectexplorer/projectexplorerconstants.h>
namespace QmakeProjectManager {
......@@ -109,8 +107,8 @@ GuiAppParameters GuiAppWizardDialog::parameters() const
rc.headerFileName = m_filesPage->headerFileName();
rc.formFileName = m_filesPage->formFileName();
rc.designerForm = m_filesPage->formInputChecked();
rc.isMobileApplication = true;
if (isQtPlatformSelected(QtSupport::Constants::ANDROID_PLATFORM)) {
if (isQtPlatformSelected("Android.Device.Type")) { // FIXME: Is this really necessary?
rc.isMobileApplication = true;
rc.widgetWidth = 800;
rc.widgetHeight = 480;
} else {
......
......@@ -58,8 +58,6 @@ const char QNX_QNX_RUNCONFIGURATION_PREFIX[] = "Qt4ProjectManager.QNX.QNXRunConf
const char QNX_QNX_OS_TYPE[] = "QnxOsType";
const char QNX_QNX_PLATFORM_NAME[] = "QNX";
const char QNX_DEBUG_EXECUTABLE[] = "pdebug";
const char QNX_TOOLCHAIN_ID[] = "Qnx.QccToolChain";
......
......@@ -90,16 +90,6 @@ QSet<Core::Id> QnxQtVersion::targetDeviceTypes() const
return { Constants::QNX_QNX_OS_TYPE };
}
QString QnxQtVersion::platformName() const
{
return QString::fromLatin1(Constants::QNX_QNX_PLATFORM_NAME);
}
QString QnxQtVersion::platformDisplayName() const
{
return QCoreApplication::translate("Qnx::Internal::QnxQtVersion", "QNX");
}
QString QnxQtVersion::qnxHost() const
{
if (!m_environmentUpToDate)
......
......@@ -58,8 +58,6 @@ public:
QSet<Core::Id> availableFeatures() const override;
QSet<Core::Id> targetDeviceTypes() const override;
QString platformName() const override;
QString platformDisplayName() const override;
QString qnxHost() const;
QString qnxTarget() const;
......
......@@ -456,23 +456,6 @@ QSet<Id> BaseQtVersion::availableFeatures() const
return features;
}
QString BaseQtVersion::platformName() const
{
return QString();
}
QString BaseQtVersion::platformDisplayName() const
{
return platformName();
}
bool BaseQtVersion::supportsPlatform(const QString &platform) const
{
if (platform.isEmpty()) // empty target == target independent
return true;
return platform == platformName();
}
QList<Task> BaseQtVersion::validateKit(const Kit *k)
{
QList<Task> result;
......
......@@ -208,9 +208,6 @@ public:
virtual QSet<Core::Id> availableFeatures() const;
virtual QSet<Core::Id> targetDeviceTypes() const = 0;
virtual QString platformName() const;
virtual QString platformDisplayName() const;
virtual bool supportsPlatform(const QString &platformName) const;
virtual QList<ProjectExplorer::Task> validateKit(const ProjectExplorer::Kit *k);
......
......@@ -103,13 +103,3 @@ QSet<Core::Id> DesktopQtVersion::targetDeviceTypes() const
result.insert(RemoteLinux::Constants::GenericLinuxOsType);
return result;
}
QString DesktopQtVersion::platformName() const
{
return QLatin1String(Constants::DESKTOP_PLATFORM);
}
QString DesktopQtVersion::platformDisplayName() const
{
return QLatin1String(Constants::DESKTOP_PLATFORM_TR);
}
......@@ -53,8 +53,6 @@ public:
QSet<Core::Id> availableFeatures() const;
QSet<Core::Id> targetDeviceTypes() const;
QString platformName() const;
QString platformDisplayName() const;
};
} // Internal
......
......@@ -227,7 +227,7 @@ KitMatcher QtKitInformation::platformMatcher(Core::Id platform)
{
return std::function<bool(const Kit *)>([platform](const Kit *kit) -> bool {
BaseQtVersion *version = QtKitInformation::qtVersion(kit);
return version && Core::Id::fromString(version->platformName()) == platform;
return version && version->targetDeviceTypes().contains(platform);
});
}
......@@ -247,21 +247,10 @@ KitMatcher QtKitInformation::qtVersionMatcher(const QSet<Core::Id> &required,
});
}
QSet<Core::Id> QtKitInformation::availablePlatforms(const Kit *k) const
QSet<Core::Id> QtKitInformation::supportedPlatforms(const Kit *k) const
{
BaseQtVersion *version = QtKitInformation::qtVersion(k);
const QString platform = version ? version->platformName() : QString();
if (!platform.isEmpty())
return { Core::Id::fromString(platform) };
return QSet<Core::Id>();
}
QString QtKitInformation::displayNameForPlatform(const Kit *k, Core::Id platform) const
{
BaseQtVersion *version = QtKitInformation::qtVersion(k);
if (version && Core::Id::fromString(version->platformName()) == platform)
return version->platformDisplayName();
return QString();
return version ? version->targetDeviceTypes() : QSet<Core::Id>();
}
QSet<Core::Id> QtKitInformation::availableFeatures(const Kit *k) const
......
......@@ -74,8 +74,7 @@ public:
const QtVersionNumber &min = QtVersionNumber(0, 0, 0),
const QtVersionNumber &max = QtVersionNumber(INT_MAX, INT_MAX, INT_MAX));
QSet<Core::Id> availablePlatforms(const ProjectExplorer::Kit *k) const;
QString displayNameForPlatform(const ProjectExplorer::Kit *k, Core::Id platform) const;
QSet<Core::Id> supportedPlatforms(const ProjectExplorer::Kit *k) const;
QSet<Core::Id> availableFeatures(const ProjectExplorer::Kit *k) const;
private slots:
......
......@@ -63,23 +63,7 @@ const char FEATURE_QT_CONSOLE[] = "QtSupport.Wizards.FeatureQtConsole";
const char FEATURE_MOBILE[] = "QtSupport.Wizards.FeatureMobile";
const char FEATURE_DESKTOP[] = "QtSupport.Wizards.FeatureDesktop";
// Platforms
const char DESKTOP_PLATFORM[] = "Desktop";
const char EMBEDDED_LINUX_PLATFORM[] = "Embedded Linux";
const char WINDOWS_CE_PLATFORM[] = "Windows CE";
const char WINDOWS_RT_PLATFORM[] = "Windows Runtime";
const char WINDOWS_PHONE_PLATFORM[] = "Windows Phone";
const char ANDROID_PLATFORM[] = "Android";
const char IOS_PLATFORM[] = "iOS";
const char DESKTOP_PLATFORM_TR[] = QT_TRANSLATE_NOOP("QtSupport", "Desktop");
const char EMBEDDED_LINUX_PLATFORM_TR[] = QT_TRANSLATE_NOOP("QtSupport", "Embedded Linux");
const char WINDOWS_CE_PLATFORM_TR[] = QT_TRANSLATE_NOOP("QtSupport", "Windows CE");
const char WINDOWS_RT_PLATFORM_TR[] = QT_TRANSLATE_NOOP("QtSupport", "Windows Runtime");
const char WINDOWS_PHONE_PLATFORM_TR[] = QT_TRANSLATE_NOOP("QtSupport", "Windows Phone");
const char ANDROID_PLATFORM_TR[] = QT_TRANSLATE_NOOP("QtSupport", "Android");
const char IOS_PLATFORM_TR[] = QT_TRANSLATE_NOOP("QtSupport", "iOS");
// Icon:
const char ICON_QT_PROJECT[] = ":/qtsupport/images/qt_project.png";
} // namepsace Constants
......
......@@ -96,16 +96,6 @@ void WinCeQtVersion::fromMap(const QVariantMap &map)
}
}
QString WinCeQtVersion::platformName() const
{
return QLatin1String(Constants::WINDOWS_CE_PLATFORM);
}
QString WinCeQtVersion::platformDisplayName() const
{
return QLatin1String(Constants::WINDOWS_CE_PLATFORM_TR);
}
QSet<Core::Id> WinCeQtVersion::targetDeviceTypes() const
{
return QSet<Core::Id>();
......
......@@ -53,8 +53,6 @@ public:
void fromMap(const QVariantMap &data);
QString platformName() const;
QString platformDisplayName() const;
QSet<Core::Id> targetDeviceTypes() const;
private:
......
......@@ -71,15 +71,5 @@ QSet<Core::Id> EmbeddedLinuxQtVersion::targetDeviceTypes() const
return { Constants::GenericLinuxOsType };
}
QString EmbeddedLinuxQtVersion::platformName() const
{
return QLatin1String(QtSupport::Constants::EMBEDDED_LINUX_PLATFORM);
}
QString EmbeddedLinuxQtVersion::platformDisplayName() const
{
return QLatin1String(QtSupport::Constants::EMBEDDED_LINUX_PLATFORM_TR);
}
} // namespace Internal
} // namespace RemoteLinux
......@@ -51,8 +51,6 @@ public:
QString description() const;
QSet<Core::Id> targetDeviceTypes() const;
QString platformName() const;
QString platformDisplayName() const;
};
} // namespace Internal
......
......@@ -61,16 +61,6 @@ QString WinRtPhoneQtVersion::type() const
return QLatin1String(Constants::WINRT_WINPHONEQT);
}
QString WinRtPhoneQtVersion::platformName() const
{
return QLatin1String(QtSupport::Constants::WINDOWS_PHONE_PLATFORM);
}
QString WinRtPhoneQtVersion::platformDisplayName() const
{
return QLatin1String(QtSupport::Constants::WINDOWS_PHONE_PLATFORM_TR);
}
QSet<Core::Id> WinRtPhoneQtVersion::targetDeviceTypes() const
{
return { Constants::WINRT_DEVICE_TYPE_PHONE, Constants::WINRT_DEVICE_TYPE_EMULATOR };
......
......@@ -47,8 +47,6 @@ public:
QString description() const;
BaseQtVersion *clone() const;
QString type() const;