QtSupport: Drop one suite of QtVersion constructors

Use default plus polish afterwards instead.

Change-Id: Ibd137562128445a5bae5aaa4fc5fcce2df6c3e38
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-02-14 10:28:20 +01:00
parent d9678ceb07
commit 66fd5abe58
30 changed files with 36 additions and 90 deletions

View File

@@ -50,12 +50,6 @@ AndroidQtVersion::AndroidQtVersion()
{
}
AndroidQtVersion::AndroidQtVersion(const Utils::FileName &path)
: QtSupport::BaseQtVersion(path)
{
setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false));
}
AndroidQtVersion *AndroidQtVersion::clone() const
{
return new AndroidQtVersion(*this);

View File

@@ -38,7 +38,6 @@ class AndroidQtVersion : public QtSupport::BaseQtVersion
public:
AndroidQtVersion();
explicit AndroidQtVersion(const Utils::FileName &path);
AndroidQtVersion *clone() const override;
QString type() const override;

View File

@@ -40,14 +40,14 @@ AndroidQtVersionFactory::AndroidQtVersionFactory()
setPriority(90);
}
QtSupport::BaseQtVersion *AndroidQtVersionFactory::create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator)
QtSupport::BaseQtVersion *AndroidQtVersionFactory::create(ProFileEvaluator *evaluator)
{
if (!evaluator->values(QLatin1String("CONFIG")).contains(QLatin1String("android"))
&& evaluator->value(QLatin1String("QMAKE_PLATFORM")) != QLatin1String("android"))
return nullptr;
if (evaluator->values(QLatin1String("CONFIG")).contains(QLatin1String("android-no-sdk")))
return nullptr;
return new AndroidQtVersion(qmakePath);
return new AndroidQtVersion;
}
} // Internal

View File

@@ -35,8 +35,7 @@ class AndroidQtVersionFactory : public QtSupport::QtVersionFactory
public:
AndroidQtVersionFactory();
QtSupport::BaseQtVersion *create(const Utils::FileName &qmakePath,
ProFileEvaluator *evaluator) override;
QtSupport::BaseQtVersion *create(ProFileEvaluator *evaluator) override;
};
} // namespace Internal

View File

@@ -42,12 +42,6 @@ using namespace ProjectExplorer;
IosQtVersion::IosQtVersion() = default;
IosQtVersion::IosQtVersion(const Utils::FileName &path)
: QtSupport::BaseQtVersion(path)
{
setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false));
}
IosQtVersion *IosQtVersion::clone() const
{
return new IosQtVersion(*this);

View File

@@ -38,7 +38,6 @@ class IosQtVersion : public QtSupport::BaseQtVersion
public:
IosQtVersion();
explicit IosQtVersion(const Utils::FileName &path);
IosQtVersion *clone() const override;
QString type() const override;

View File

@@ -39,12 +39,11 @@ IosQtVersionFactory::IosQtVersionFactory()
setPriority(90);
}
QtSupport::BaseQtVersion *IosQtVersionFactory::create(const Utils::FileName &qmakePath,
ProFileEvaluator *evaluator)
QtSupport::BaseQtVersion *IosQtVersionFactory::create(ProFileEvaluator *evaluator)
{
if (!(evaluator->values(QLatin1String("QMAKE_PLATFORM")).contains(QLatin1String("ios"))))
return nullptr;
return new IosQtVersion(qmakePath);
return new IosQtVersion;
}
} // Internal

View File

@@ -35,8 +35,7 @@ class IosQtVersionFactory : public QtSupport::QtVersionFactory
public:
IosQtVersionFactory();
QtSupport::BaseQtVersion *create(const Utils::FileName &qmakePath,
ProFileEvaluator *evaluator) override;
QtSupport::BaseQtVersion *create(ProFileEvaluator *evaluator) override;
};
} // namespace Internal

View File

@@ -46,12 +46,6 @@ static char SDP_PATH_KEY[] = "SDKPath";
QnxQtVersion::QnxQtVersion() = default;
QnxQtVersion::QnxQtVersion(const Utils::FileName &path) :
QtSupport::BaseQtVersion(path)
{
setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false));
}
QnxQtVersion *QnxQtVersion::clone() const
{
return new QnxQtVersion(*this);

View File

@@ -39,7 +39,6 @@ class QnxQtVersion : public QtSupport::BaseQtVersion
{
public:
QnxQtVersion();
explicit QnxQtVersion(const Utils::FileName &path);
QnxQtVersion *clone() const override;

View File

@@ -40,12 +40,10 @@ QnxQtVersionFactory::QnxQtVersionFactory()
setPriority(50);
}
QtSupport::BaseQtVersion *QnxQtVersionFactory::create(const Utils::FileName &qmakePath,
ProFileEvaluator *evaluator)
QtSupport::BaseQtVersion *QnxQtVersionFactory::create(ProFileEvaluator *evaluator)
{
if (evaluator->contains(QLatin1String("QNX_CPUDIR"))) {
return new QnxQtVersion(qmakePath);
}
if (evaluator->contains(QLatin1String("QNX_CPUDIR")))
return new QnxQtVersion;
return nullptr;
}

View File

@@ -35,8 +35,7 @@ class QnxQtVersionFactory : public QtSupport::QtVersionFactory
public:
QnxQtVersionFactory();
QtSupport::BaseQtVersion *create(const Utils::FileName &qmakePath,
ProFileEvaluator *evaluator) override;
QtSupport::BaseQtVersion *create(ProFileEvaluator *evaluator) override;
};
} // namespace Internal

View File

@@ -193,15 +193,19 @@ bool QtVersionNumber::operator >=(const QtVersionNumber &b) const
// BaseQtVersion
///////////////
BaseQtVersion::BaseQtVersion(const FileName &qmakeCommand)
: m_id(QtVersionManager::getUniqueId()),
m_qmakeCommand(qmakeCommand)
{ }
BaseQtVersion::BaseQtVersion(const BaseQtVersion &other) = default;
BaseQtVersion::BaseQtVersion() = default;
BaseQtVersion::~BaseQtVersion() = default;
void BaseQtVersion::setupQmakePathAndId(const FileName &qmakeCommand)
{
m_id = QtVersionManager::getUniqueId();
QTC_CHECK(m_qmakeCommand.isEmpty()); // Should only be used once.
m_qmakeCommand = qmakeCommand;
setUnexpandedDisplayName(defaultUnexpandedDisplayName(m_qmakeCommand, false));
}
QString BaseQtVersion::defaultUnexpandedDisplayName(const FileName &qmakePath, bool fromPath)
{
QString location;

View File

@@ -257,8 +257,8 @@ public:
protected:
virtual QSet<Core::Id> availableFeatures() const;
BaseQtVersion();
explicit BaseQtVersion(const Utils::FileName &path);
BaseQtVersion(const BaseQtVersion &other);
virtual QList<ProjectExplorer::Task> reportIssuesImpl(const QString &proFile, const QString &buildDir) const;
@@ -271,6 +271,7 @@ protected:
virtual void parseMkSpec(ProFileEvaluator *) const;
private:
void setupQmakePathAndId(const Utils::FileName &path);
void setAutoDetectionSource(const QString &autodetectionSource);
void updateVersionInfo() const;
enum HostBinaries { Designer, Linguist, Uic, QScxmlc };

View File

@@ -46,12 +46,6 @@ DesktopQtVersion::DesktopQtVersion()
}
DesktopQtVersion::DesktopQtVersion(const Utils::FileName &path)
: BaseQtVersion(path)
{
setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false));
}
DesktopQtVersion *DesktopQtVersion::clone() const
{
return new DesktopQtVersion(*this);

View File

@@ -33,7 +33,7 @@ class QTSUPPORT_EXPORT DesktopQtVersion : public BaseQtVersion
{
public:
DesktopQtVersion();
explicit DesktopQtVersion(const Utils::FileName &path);
DesktopQtVersion *clone() const override;
QString type() const override;

View File

@@ -37,9 +37,9 @@ DesktopQtVersionFactory::DesktopQtVersionFactory()
setPriority(0); // Lowest of all, we want to be the fallback
}
BaseQtVersion *DesktopQtVersionFactory::create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator)
BaseQtVersion *DesktopQtVersionFactory::create(ProFileEvaluator *evaluator)
{
Q_UNUSED(evaluator);
// we are the fallback :) so we don't care what kind of qt it is
return new DesktopQtVersion(qmakePath);
return new DesktopQtVersion;
}

View File

@@ -35,7 +35,7 @@ class DesktopQtVersionFactory : public QtVersionFactory
public:
DesktopQtVersionFactory();
BaseQtVersion *create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator) override;
BaseQtVersion *create(ProFileEvaluator *evaluator) override;
};
} // Internal

View File

@@ -98,7 +98,8 @@ BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileN
return nullptr;
foreach (QtVersionFactory *factory, factories) {
if (BaseQtVersion *ver = factory->create(qmakePath, &evaluator)) {
if (BaseQtVersion *ver = factory->create(&evaluator)) {
ver->setupQmakePathAndId(qmakePath);
ver->setAutoDetectionSource(autoDetectionSource);
ver->setIsAutodetected(isAutoDetected);
ProFileCacheManager::instance()->decRefCount();

View File

@@ -54,8 +54,7 @@ public:
/// a qtversion, the priority of the desktop factory is 0 and
/// the desktop factory claims to handle all paths
int priority() const { return m_priority; }
virtual BaseQtVersion *create(const Utils::FileName &qmakePath,
ProFileEvaluator *evaluator) = 0;
virtual BaseQtVersion *create(ProFileEvaluator *evaluator) = 0;
static BaseQtVersion *createQtVersionFromQMakePath(
const Utils::FileName &qmakePath, bool isAutoDetected = false,

View File

@@ -35,12 +35,6 @@
namespace RemoteLinux {
namespace Internal {
EmbeddedLinuxQtVersion::EmbeddedLinuxQtVersion(const Utils::FileName &path)
: BaseQtVersion(path)
{
setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false));
}
EmbeddedLinuxQtVersion *EmbeddedLinuxQtVersion::clone() const
{
return new EmbeddedLinuxQtVersion(*this);

View File

@@ -34,7 +34,6 @@ class EmbeddedLinuxQtVersion : public QtSupport::BaseQtVersion
{
public:
EmbeddedLinuxQtVersion() = default;
explicit EmbeddedLinuxQtVersion(const Utils::FileName &path);
EmbeddedLinuxQtVersion *clone() const override;

View File

@@ -40,12 +40,11 @@ EmbeddedLinuxQtVersionFactory::EmbeddedLinuxQtVersionFactory()
setPriority(10);
}
QtSupport::BaseQtVersion *EmbeddedLinuxQtVersionFactory::create(const Utils::FileName &qmakePath,
ProFileEvaluator *evaluator)
QtSupport::BaseQtVersion *EmbeddedLinuxQtVersionFactory::create(ProFileEvaluator *evaluator)
{
Q_UNUSED(evaluator);
auto version = new EmbeddedLinuxQtVersion(qmakePath);
auto version = new EmbeddedLinuxQtVersion;
QList<ProjectExplorer::Abi> abis = version->qtAbis();
// Note: This fails for e.g. intel/meego cross builds on x86 linux machines.

View File

@@ -35,8 +35,7 @@ class EmbeddedLinuxQtVersionFactory : public QtSupport::QtVersionFactory
public:
EmbeddedLinuxQtVersionFactory();
QtSupport::BaseQtVersion *create(const Utils::FileName &qmakePath,
ProFileEvaluator *evaluator) override;
QtSupport::BaseQtVersion *create(ProFileEvaluator *evaluator) override;
};
} // Internal

View File

@@ -35,11 +35,6 @@
namespace WinRt {
namespace Internal {
WinRtPhoneQtVersion::WinRtPhoneQtVersion(const Utils::FileName &path)
: WinRtQtVersion(path)
{
}
QString WinRtPhoneQtVersion::description() const
{
return tr("Windows Phone");

View File

@@ -35,7 +35,6 @@ class WinRtPhoneQtVersion : public WinRtQtVersion
Q_DECLARE_TR_FUNCTIONS(WinRt::Internal::WinRtQtVersion)
public:
WinRtPhoneQtVersion() = default;
explicit WinRtPhoneQtVersion(const Utils::FileName &path);
QString description() const override;
BaseQtVersion *clone() const override;

View File

@@ -33,12 +33,6 @@
namespace WinRt {
namespace Internal {
WinRtQtVersion::WinRtQtVersion(const Utils::FileName &path)
: BaseQtVersion(path)
{
setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false));
}
QtSupport::BaseQtVersion *WinRtQtVersion::clone() const
{
return new WinRtQtVersion(*this);

View File

@@ -35,7 +35,6 @@ class WinRtQtVersion : public QtSupport::BaseQtVersion
Q_DECLARE_TR_FUNCTIONS(WinRt::Internal::WinRtQtVersion)
public:
WinRtQtVersion() = default;
explicit WinRtQtVersion(const Utils::FileName &path);
BaseQtVersion *clone() const override;
QString type() const override;

View File

@@ -40,12 +40,11 @@ WinRtQtVersionFactory::WinRtQtVersionFactory()
setPriority(10);
}
QtSupport::BaseQtVersion *WinRtQtVersionFactory::create(const Utils::FileName &qmakePath,
ProFileEvaluator *evaluator)
QtSupport::BaseQtVersion *WinRtQtVersionFactory::create(ProFileEvaluator *evaluator)
{
foreach (const QString &value, evaluator->values(QLatin1String("QMAKE_PLATFORM"))) {
if (value == QStringLiteral("winrt"))
return new WinRtQtVersion(qmakePath);
return new WinRtQtVersion;
}
return nullptr;
@@ -60,12 +59,11 @@ WinRtPhoneQtVersionFactory::WinRtPhoneQtVersionFactory()
setPriority(10);
}
QtSupport::BaseQtVersion *WinRtPhoneQtVersionFactory::create(const Utils::FileName &qmakePath,
ProFileEvaluator *evaluator)
QtSupport::BaseQtVersion *WinRtPhoneQtVersionFactory::create(ProFileEvaluator *evaluator)
{
foreach (const QString &value, evaluator->values(QLatin1String("QMAKE_PLATFORM"))) {
if (value == QStringLiteral("winphone"))
return new WinRtPhoneQtVersion(qmakePath);
return new WinRtPhoneQtVersion;
}
return nullptr;

View File

@@ -35,8 +35,7 @@ class WinRtQtVersionFactory : public QtSupport::QtVersionFactory
public:
WinRtQtVersionFactory();
QtSupport::BaseQtVersion *create(const Utils::FileName &qmakePath,
ProFileEvaluator *evaluator) override;
QtSupport::BaseQtVersion *create(ProFileEvaluator *evaluator) override;
};
class WinRtPhoneQtVersionFactory : public QtSupport::QtVersionFactory
@@ -44,8 +43,7 @@ class WinRtPhoneQtVersionFactory : public QtSupport::QtVersionFactory
public:
WinRtPhoneQtVersionFactory();
QtSupport::BaseQtVersion *create(const Utils::FileName &qmakePath,
ProFileEvaluator *evaluator) override;
QtSupport::BaseQtVersion *create(ProFileEvaluator *evaluator) override;
};
} // Internal