forked from qt-creator/qt-creator
Fix BaseQtVersion::qmlViewer and others with qt 5
Task-number: QTCREATORBUG-5254 Change-Id: Ic25378dbfed5c55a4f09e1fbd5d99c313dac4cf8 Reviewed-on: http://codereview.qt.nokia.com/3611 Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
@@ -488,7 +488,7 @@ QString BaseQtVersion::designerCommand() const
|
|||||||
if (!isValid())
|
if (!isValid())
|
||||||
return QString();
|
return QString();
|
||||||
if (m_designerCommand.isNull())
|
if (m_designerCommand.isNull())
|
||||||
m_designerCommand = findQtBinary(possibleGuiBinaries(QLatin1String("designer")));
|
m_designerCommand = findQtBinary(Designer);
|
||||||
return m_designerCommand;
|
return m_designerCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,7 +497,7 @@ QString BaseQtVersion::linguistCommand() const
|
|||||||
if (!isValid())
|
if (!isValid())
|
||||||
return QString();
|
return QString();
|
||||||
if (m_linguistCommand.isNull())
|
if (m_linguistCommand.isNull())
|
||||||
m_linguistCommand = findQtBinary(possibleGuiBinaries(QLatin1String("linguist")));
|
m_linguistCommand = findQtBinary(Linguist);
|
||||||
return m_linguistCommand;
|
return m_linguistCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -506,27 +506,67 @@ QString BaseQtVersion::qmlviewerCommand() const
|
|||||||
if (!isValid())
|
if (!isValid())
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
if (m_qmlviewerCommand.isNull()) {
|
if (m_qmlviewerCommand.isNull())
|
||||||
#ifdef Q_OS_MAC
|
m_qmlviewerCommand = findQtBinary(QmlViewer);
|
||||||
const QString qmlViewerName = QLatin1String("QMLViewer");
|
|
||||||
#else
|
|
||||||
const QString qmlViewerName = QLatin1String("qmlviewer");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
m_qmlviewerCommand = findQtBinary(possibleGuiBinaries(qmlViewerName));
|
|
||||||
}
|
|
||||||
return m_qmlviewerCommand;
|
return m_qmlviewerCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BaseQtVersion::findQtBinary(const QStringList &possibleCommands) const
|
QString BaseQtVersion::findQtBinary(BINARIES binary) const
|
||||||
{
|
{
|
||||||
QString qtdirbin = versionInfo().value(QLatin1String("QT_INSTALL_BINS"));
|
QString baseDir;
|
||||||
if (qtdirbin.isEmpty())
|
if (qtVersion() < QtVersionNumber(5, 0, 0)) {
|
||||||
return QString();
|
baseDir = versionInfo().value(QLatin1String("QT_INSTALL_BINS"));
|
||||||
qtdirbin += QLatin1Char('/');
|
} else {
|
||||||
|
ensureMkSpecParsed();
|
||||||
|
switch (binary) {
|
||||||
|
case QmlViewer:
|
||||||
|
baseDir = m_mkspecValues.value("QT.declarative.bins");
|
||||||
|
break;
|
||||||
|
case Designer:
|
||||||
|
case Linguist:
|
||||||
|
baseDir = m_mkspecValues.value("QT.designer.bins");
|
||||||
|
break;
|
||||||
|
case Uic:
|
||||||
|
baseDir = versionInfo().value(QLatin1String("QT_INSTALL_BINS"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Can't happen
|
||||||
|
Q_ASSERT(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (baseDir.isEmpty())
|
||||||
|
return QString();
|
||||||
|
if (!baseDir.endsWith('/'))
|
||||||
|
baseDir += QLatin1Char('/');
|
||||||
|
|
||||||
|
QStringList possibleCommands;
|
||||||
|
switch (binary) {
|
||||||
|
case QmlViewer:
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
possibleCommands << QLatin1String("QMLViewer");
|
||||||
|
#else
|
||||||
|
possibleCommands << QLatin1String("qmlviewer");
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case Designer:
|
||||||
|
possibleCommands << possibleGuiBinaries(QLatin1String("designer"));
|
||||||
|
break;
|
||||||
|
case Linguist:
|
||||||
|
possibleCommands << possibleGuiBinaries(QLatin1String("linguist"));
|
||||||
|
break;
|
||||||
|
case Uic:
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
possibleCommands << QLatin1String("uic.exe");
|
||||||
|
#else
|
||||||
|
possibleCommands << QLatin1String("uic-qt4") << QLatin1String("uic4") << QLatin1String("uic");
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Q_ASSERT(false);
|
||||||
|
}
|
||||||
foreach (const QString &possibleCommand, possibleCommands) {
|
foreach (const QString &possibleCommand, possibleCommands) {
|
||||||
const QString fullPath = qtdirbin + possibleCommand;
|
const QString fullPath = baseDir + possibleCommand;
|
||||||
if (QFileInfo(fullPath).isFile())
|
if (QFileInfo(fullPath).isFile())
|
||||||
return QDir::cleanPath(fullPath);
|
return QDir::cleanPath(fullPath);
|
||||||
}
|
}
|
||||||
@@ -539,13 +579,7 @@ QString BaseQtVersion::uicCommand() const
|
|||||||
return QString();
|
return QString();
|
||||||
if (!m_uicCommand.isNull())
|
if (!m_uicCommand.isNull())
|
||||||
return m_uicCommand;
|
return m_uicCommand;
|
||||||
#ifdef Q_OS_WIN
|
m_uicCommand = findQtBinary(Uic);
|
||||||
const QStringList possibleCommands(QLatin1String("uic.exe"));
|
|
||||||
#else
|
|
||||||
QStringList possibleCommands;
|
|
||||||
possibleCommands << QLatin1String("uic-qt4") << QLatin1String("uic4") << QLatin1String("uic");
|
|
||||||
#endif
|
|
||||||
m_uicCommand = findQtBinary(possibleCommands);
|
|
||||||
return m_uicCommand;
|
return m_uicCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -625,6 +659,9 @@ void BaseQtVersion::parseMkSpec(ProFileEvaluator *evaluator) const
|
|||||||
else if (value == "build_all")
|
else if (value == "build_all")
|
||||||
m_defaultConfigIsDebugAndRelease = true;
|
m_defaultConfigIsDebugAndRelease = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_mkspecValues.insert("QT.designer.bins", evaluator->value("QT.designer.bins"));
|
||||||
|
m_mkspecValues.insert("QT.declarative.bins", evaluator->value("QT.declarative.bins"));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BaseQtVersion::mkspec() const
|
QString BaseQtVersion::mkspec() const
|
||||||
|
@@ -228,7 +228,8 @@ private:
|
|||||||
void ctor(const QString &qmakePath);
|
void ctor(const QString &qmakePath);
|
||||||
void updateSourcePath() const;
|
void updateSourcePath() const;
|
||||||
void updateVersionInfo() const;
|
void updateVersionInfo() const;
|
||||||
QString findQtBinary(const QStringList &possibleName) const;
|
enum BINARIES { QmlViewer, Designer, Linguist, Uic };
|
||||||
|
QString findQtBinary(BINARIES binary) const;
|
||||||
void updateMkspec() const;
|
void updateMkspec() const;
|
||||||
void setId(int id); // used by the qtversionmanager for legacy restore
|
void setId(int id); // used by the qtversionmanager for legacy restore
|
||||||
// and by the qtoptionspage to replace qt versions
|
// and by the qtoptionspage to replace qt versions
|
||||||
@@ -250,6 +251,7 @@ private:
|
|||||||
mutable bool m_mkspecReadUpToDate;
|
mutable bool m_mkspecReadUpToDate;
|
||||||
mutable bool m_defaultConfigIsDebug;
|
mutable bool m_defaultConfigIsDebug;
|
||||||
mutable bool m_defaultConfigIsDebugAndRelease;
|
mutable bool m_defaultConfigIsDebugAndRelease;
|
||||||
|
mutable QHash<QString, QString> m_mkspecValues;
|
||||||
|
|
||||||
mutable bool m_versionInfoUpToDate;
|
mutable bool m_versionInfoUpToDate;
|
||||||
mutable QHash<QString,QString> m_versionInfo;
|
mutable QHash<QString,QString> m_versionInfo;
|
||||||
|
Reference in New Issue
Block a user