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())
|
||||
return QString();
|
||||
if (m_designerCommand.isNull())
|
||||
m_designerCommand = findQtBinary(possibleGuiBinaries(QLatin1String("designer")));
|
||||
m_designerCommand = findQtBinary(Designer);
|
||||
return m_designerCommand;
|
||||
}
|
||||
|
||||
@@ -497,7 +497,7 @@ QString BaseQtVersion::linguistCommand() const
|
||||
if (!isValid())
|
||||
return QString();
|
||||
if (m_linguistCommand.isNull())
|
||||
m_linguistCommand = findQtBinary(possibleGuiBinaries(QLatin1String("linguist")));
|
||||
m_linguistCommand = findQtBinary(Linguist);
|
||||
return m_linguistCommand;
|
||||
}
|
||||
|
||||
@@ -506,27 +506,67 @@ QString BaseQtVersion::qmlviewerCommand() const
|
||||
if (!isValid())
|
||||
return QString();
|
||||
|
||||
if (m_qmlviewerCommand.isNull()) {
|
||||
#ifdef Q_OS_MAC
|
||||
const QString qmlViewerName = QLatin1String("QMLViewer");
|
||||
#else
|
||||
const QString qmlViewerName = QLatin1String("qmlviewer");
|
||||
#endif
|
||||
|
||||
m_qmlviewerCommand = findQtBinary(possibleGuiBinaries(qmlViewerName));
|
||||
}
|
||||
if (m_qmlviewerCommand.isNull())
|
||||
m_qmlviewerCommand = findQtBinary(QmlViewer);
|
||||
return m_qmlviewerCommand;
|
||||
}
|
||||
|
||||
QString BaseQtVersion::findQtBinary(const QStringList &possibleCommands) const
|
||||
QString BaseQtVersion::findQtBinary(BINARIES binary) const
|
||||
{
|
||||
QString qtdirbin = versionInfo().value(QLatin1String("QT_INSTALL_BINS"));
|
||||
if (qtdirbin.isEmpty())
|
||||
return QString();
|
||||
qtdirbin += QLatin1Char('/');
|
||||
QString baseDir;
|
||||
if (qtVersion() < QtVersionNumber(5, 0, 0)) {
|
||||
baseDir = versionInfo().value(QLatin1String("QT_INSTALL_BINS"));
|
||||
} 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) {
|
||||
const QString fullPath = qtdirbin + possibleCommand;
|
||||
const QString fullPath = baseDir + possibleCommand;
|
||||
if (QFileInfo(fullPath).isFile())
|
||||
return QDir::cleanPath(fullPath);
|
||||
}
|
||||
@@ -539,13 +579,7 @@ QString BaseQtVersion::uicCommand() const
|
||||
return QString();
|
||||
if (!m_uicCommand.isNull())
|
||||
return m_uicCommand;
|
||||
#ifdef Q_OS_WIN
|
||||
const QStringList possibleCommands(QLatin1String("uic.exe"));
|
||||
#else
|
||||
QStringList possibleCommands;
|
||||
possibleCommands << QLatin1String("uic-qt4") << QLatin1String("uic4") << QLatin1String("uic");
|
||||
#endif
|
||||
m_uicCommand = findQtBinary(possibleCommands);
|
||||
m_uicCommand = findQtBinary(Uic);
|
||||
return m_uicCommand;
|
||||
}
|
||||
|
||||
@@ -625,6 +659,9 @@ void BaseQtVersion::parseMkSpec(ProFileEvaluator *evaluator) const
|
||||
else if (value == "build_all")
|
||||
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
|
||||
|
@@ -228,7 +228,8 @@ private:
|
||||
void ctor(const QString &qmakePath);
|
||||
void updateSourcePath() 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 setId(int id); // used by the qtversionmanager for legacy restore
|
||||
// and by the qtoptionspage to replace qt versions
|
||||
@@ -250,6 +251,7 @@ private:
|
||||
mutable bool m_mkspecReadUpToDate;
|
||||
mutable bool m_defaultConfigIsDebug;
|
||||
mutable bool m_defaultConfigIsDebugAndRelease;
|
||||
mutable QHash<QString, QString> m_mkspecValues;
|
||||
|
||||
mutable bool m_versionInfoUpToDate;
|
||||
mutable QHash<QString,QString> m_versionInfo;
|
||||
|
Reference in New Issue
Block a user