summaryrefslogtreecommitdiff
path: root/src/plugins/qtsupport
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2019-02-14 15:13:01 +0100
committerhjk <hjk@qt.io>2019-02-14 15:53:26 +0000
commit4d5c0a5f2ea02e993f6e9742f351170a066e603f (patch)
treea6edc59ca1d0a78cd39a906ed146edb0fc171cc0 /src/plugins/qtsupport
parent153c0c6d785783ffe84552563439664b081ebeb3 (diff)
downloadqt-creator-4d5c0a5f2ea02e993f6e9742f351170a066e603f.tar.gz
QtSupport: Code cosmetics around DesktopQtVersion
Change-Id: I407348d58e1b2128bc82f2e2f0da2a52984da92b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/plugins/qtsupport')
-rw-r--r--src/plugins/qtsupport/desktopqtversion.cpp28
-rw-r--r--src/plugins/qtsupport/desktopqtversion.h4
2 files changed, 10 insertions, 22 deletions
diff --git a/src/plugins/qtsupport/desktopqtversion.cpp b/src/plugins/qtsupport/desktopqtversion.cpp
index fa7ae205bc..e70cf84e0e 100644
--- a/src/plugins/qtsupport/desktopqtversion.cpp
+++ b/src/plugins/qtsupport/desktopqtversion.cpp
@@ -101,6 +101,7 @@ QSet<Core::Id> 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);
- return m_qmlsceneCommand;
-}
-DesktopQtVersion::DesktopQtVersion(const DesktopQtVersion &other) = default;
+ ensureMkSpecParsed();
-QString DesktopQtVersion::findTargetBinary(TargetBinaries binary) const
-{
- QString path;
+ QString path =
+ qmlBinPath().appendPath(Utils::HostOsInfo::withExecutableSuffix("qmlscene")).toString();
- ensureMkSpecParsed();
- switch (binary) {
- case QmlScene:
- path = qmlBinPath().appendPath(
- Utils::HostOsInfo::withExecutableSuffix("qmlscene")).toString();
- break;
- default:
- // Can't happen
- QTC_ASSERT(false, return QString());
- }
+ m_qmlsceneCommand = QFileInfo(path).isFile() ? path : QString();
- return QFileInfo(path).isFile() ? path : QString();
+ return m_qmlsceneCommand;
}
+
+DesktopQtVersion::DesktopQtVersion(const DesktopQtVersion &other) = default;
+
diff --git a/src/plugins/qtsupport/desktopqtversion.h b/src/plugins/qtsupport/desktopqtversion.h
index 3ab82689ae..2ab966bc24 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;
};