From 4d5c0a5f2ea02e993f6e9742f351170a066e603f Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 14 Feb 2019 15:13:01 +0100 Subject: [PATCH] QtSupport: Code cosmetics around DesktopQtVersion Change-Id: I407348d58e1b2128bc82f2e2f0da2a52984da92b Reviewed-by: Ulf Hermann --- src/plugins/qtsupport/desktopqtversion.cpp | 28 ++++++++-------------- src/plugins/qtsupport/desktopqtversion.h | 4 ---- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/src/plugins/qtsupport/desktopqtversion.cpp b/src/plugins/qtsupport/desktopqtversion.cpp index fa7ae205bc3..e70cf84e0e9 100644 --- a/src/plugins/qtsupport/desktopqtversion.cpp +++ b/src/plugins/qtsupport/desktopqtversion.cpp @@ -101,6 +101,7 @@ QSet DesktopQtVersion::targetDeviceTypes() const void DesktopQtVersion::fromMap(const QVariantMap &map) { BaseQtVersion::fromMap(map); + // Clear the cached qmlscene command, it might not match the restored path anymore. m_qmlsceneCommand.clear(); } @@ -108,28 +109,19 @@ QString DesktopQtVersion::qmlsceneCommand() const { if (!isValid()) return QString(); + if (!m_qmlsceneCommand.isNull()) return m_qmlsceneCommand; - m_qmlsceneCommand = findTargetBinary(QmlScene); + + ensureMkSpecParsed(); + + QString path = + qmlBinPath().appendPath(Utils::HostOsInfo::withExecutableSuffix("qmlscene")).toString(); + + m_qmlsceneCommand = QFileInfo(path).isFile() ? path : QString(); + return m_qmlsceneCommand; } DesktopQtVersion::DesktopQtVersion(const DesktopQtVersion &other) = default; -QString DesktopQtVersion::findTargetBinary(TargetBinaries binary) const -{ - QString path; - - ensureMkSpecParsed(); - switch (binary) { - case QmlScene: - path = qmlBinPath().appendPath( - Utils::HostOsInfo::withExecutableSuffix("qmlscene")).toString(); - break; - default: - // Can't happen - QTC_ASSERT(false, return QString()); - } - - return QFileInfo(path).isFile() ? path : QString(); -} diff --git a/src/plugins/qtsupport/desktopqtversion.h b/src/plugins/qtsupport/desktopqtversion.h index 3ab82689ae0..2ab966bc242 100644 --- a/src/plugins/qtsupport/desktopqtversion.h +++ b/src/plugins/qtsupport/desktopqtversion.h @@ -55,10 +55,6 @@ protected: DesktopQtVersion(const DesktopQtVersion &other); private: - - enum TargetBinaries { QmlScene }; - QString findTargetBinary(TargetBinaries binary) const; - mutable QString m_qmlsceneCommand; };