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 AndroidQtVersion *AndroidQtVersion::clone() const
{ {
return new AndroidQtVersion(*this); return new AndroidQtVersion(*this);

View File

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

View File

@@ -40,14 +40,14 @@ AndroidQtVersionFactory::AndroidQtVersionFactory()
setPriority(90); 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")) if (!evaluator->values(QLatin1String("CONFIG")).contains(QLatin1String("android"))
&& evaluator->value(QLatin1String("QMAKE_PLATFORM")) != QLatin1String("android")) && evaluator->value(QLatin1String("QMAKE_PLATFORM")) != QLatin1String("android"))
return nullptr; return nullptr;
if (evaluator->values(QLatin1String("CONFIG")).contains(QLatin1String("android-no-sdk"))) if (evaluator->values(QLatin1String("CONFIG")).contains(QLatin1String("android-no-sdk")))
return nullptr; return nullptr;
return new AndroidQtVersion(qmakePath); return new AndroidQtVersion;
} }
} // Internal } // Internal

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -193,15 +193,19 @@ bool QtVersionNumber::operator >=(const QtVersionNumber &b) const
// BaseQtVersion // BaseQtVersion
/////////////// ///////////////
BaseQtVersion::BaseQtVersion(const FileName &qmakeCommand)
: m_id(QtVersionManager::getUniqueId()),
m_qmakeCommand(qmakeCommand)
{ }
BaseQtVersion::BaseQtVersion(const BaseQtVersion &other) = default; BaseQtVersion::BaseQtVersion(const BaseQtVersion &other) = default;
BaseQtVersion::BaseQtVersion() = default; BaseQtVersion::BaseQtVersion() = 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 BaseQtVersion::defaultUnexpandedDisplayName(const FileName &qmakePath, bool fromPath)
{ {
QString location; QString location;

View File

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

View File

@@ -33,7 +33,7 @@ class QTSUPPORT_EXPORT DesktopQtVersion : public BaseQtVersion
{ {
public: public:
DesktopQtVersion(); DesktopQtVersion();
explicit DesktopQtVersion(const Utils::FileName &path);
DesktopQtVersion *clone() const override; DesktopQtVersion *clone() const override;
QString type() 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 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); Q_UNUSED(evaluator);
// we are the fallback :) so we don't care what kind of qt it is // 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: public:
DesktopQtVersionFactory(); DesktopQtVersionFactory();
BaseQtVersion *create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator) override; BaseQtVersion *create(ProFileEvaluator *evaluator) override;
}; };
} // Internal } // Internal

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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