forked from qt-creator/qt-creator
QtSupport: Code cosmetics around DesktopQtVersion
Change-Id: I407348d58e1b2128bc82f2e2f0da2a52984da92b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
@@ -101,6 +101,7 @@ QSet<Core::Id> DesktopQtVersion::targetDeviceTypes() const
|
|||||||
void DesktopQtVersion::fromMap(const QVariantMap &map)
|
void DesktopQtVersion::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
BaseQtVersion::fromMap(map);
|
BaseQtVersion::fromMap(map);
|
||||||
|
// Clear the cached qmlscene command, it might not match the restored path anymore.
|
||||||
m_qmlsceneCommand.clear();
|
m_qmlsceneCommand.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,28 +109,19 @@ QString DesktopQtVersion::qmlsceneCommand() const
|
|||||||
{
|
{
|
||||||
if (!isValid())
|
if (!isValid())
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
if (!m_qmlsceneCommand.isNull())
|
if (!m_qmlsceneCommand.isNull())
|
||||||
return m_qmlsceneCommand;
|
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;
|
return m_qmlsceneCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
DesktopQtVersion::DesktopQtVersion(const DesktopQtVersion &other) = default;
|
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();
|
|
||||||
}
|
|
||||||
|
@@ -55,10 +55,6 @@ protected:
|
|||||||
DesktopQtVersion(const DesktopQtVersion &other);
|
DesktopQtVersion(const DesktopQtVersion &other);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
enum TargetBinaries { QmlScene };
|
|
||||||
QString findTargetBinary(TargetBinaries binary) const;
|
|
||||||
|
|
||||||
mutable QString m_qmlsceneCommand;
|
mutable QString m_qmlsceneCommand;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user