From 0c4e2ada5cd5c9ee621ff11d09bdd12b838bc0db Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 1 Oct 2019 13:34:58 +0200 Subject: [PATCH] BaseQtVersion: Remove setupQmakeAndId method on private object Inline it into its one user or move the code into the constructor of the object. Change-Id: Iae2882a6d82444b2603d4c98159c8ef95c5dd507 Reviewed-by: Eike Ziller --- src/plugins/qtsupport/baseqtversion.cpp | 19 +++++++++---------- src/plugins/qtsupport/qtversionmanager.h | 3 ++- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 93c8015f3e3..0b525f65430 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -130,9 +130,10 @@ enum HostBinaries { Designer, Linguist, Uic, QScxmlc }; class BaseQtVersionPrivate { public: - BaseQtVersionPrivate(BaseQtVersion *parent) : q(parent) {} + BaseQtVersionPrivate(BaseQtVersion *parent) + : q(parent) + {} - void setupQmakePathAndId(const FilePath &path); void updateVersionInfo(); QString findHostBinary(HostBinaries binary) const; @@ -300,13 +301,6 @@ BaseQtVersion::~BaseQtVersion() delete d; } -void BaseQtVersionPrivate::setupQmakePathAndId(const FilePath &qmakeCommand) -{ - m_id = QtVersionManager::getUniqueId(); - QTC_CHECK(m_qmakeCommand.isEmpty()); // Should only be used once. - m_qmakeCommand = qmakeCommand; -} - QString BaseQtVersion::defaultUnexpandedDisplayName() const { QString location; @@ -2213,7 +2207,12 @@ BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath if (!factory->m_restrictionChecker || factory->m_restrictionChecker(setup)) { BaseQtVersion *ver = factory->create(); QTC_ASSERT(ver, continue); - ver->d->setupQmakePathAndId(qmakePath); + ver->d->m_id = QtVersionManager::getUniqueId(); + QTC_CHECK(ver->d->m_qmakeCommand.isEmpty()); // Should only be used once. + ver->d->m_qmakeCommand = qmakePath; + ver->d->m_unexpandedDisplayName = BaseQtVersion::defaultUnexpandedDisplayName(qmakePath, + false); + ver->d->m_autodetectionSource = autoDetectionSource; ver->d->m_isAutodetected = isAutoDetected; ver->updateDefaultDisplayName(); diff --git a/src/plugins/qtsupport/qtversionmanager.h b/src/plugins/qtsupport/qtversionmanager.h index 65695bfff00..bc451f163e8 100644 --- a/src/plugins/qtsupport/qtversionmanager.h +++ b/src/plugins/qtsupport/qtversionmanager.h @@ -35,8 +35,9 @@ class QTSUPPORT_EXPORT QtVersionManager : public QObject Q_OBJECT // for getUniqueId(); friend class BaseQtVersion; - friend class Internal::BaseQtVersionPrivate; + friend class QtVersionFactory; friend class Internal::QtOptionsPageWidget; + public: static QtVersionManager *instance(); QtVersionManager();