Commit e732b3c1 authored by Christian Kamm's avatar Christian Kamm Committed by con

QmlDump: Allow building and using with Simulator Qt >= 4.7.1.

Reviewed-by: owolff
Reviewed-by: Kai Koehne
parent fb3524af
......@@ -14,6 +14,9 @@
#include <QtDeclarative/private/qdeclarativemetatype_p.h>
#include <QtDeclarative/private/qdeclarativeopenmetaobject_p.h>
#include <QtDeclarative/QDeclarativeView>
#ifdef QT_SIMULATOR
#include <QtGui/private/qsimulatorconnection_p.h>
#endif
static QHash<QByteArray, QList<const QDeclarativeType *> > qmlTypesByCppName;
static QHash<QByteArray, QByteArray> cppToId;
......@@ -254,6 +257,9 @@ void writeEasingCurve(QXmlStreamWriter *xml)
int main(int argc, char *argv[])
{
#ifdef QT_SIMULATOR
QtSimulatorPrivate::SimulatorConnection::createStubInstance();
#endif
QApplication app(argc, argv);
if (argc != 1 && argc != 3) {
......
......@@ -141,8 +141,10 @@ bool QmlDumpTool::canBuild(const QtVersion *qtVersion)
{
const QString installHeaders = qtVersion->versionInfo().value("QT_INSTALL_HEADERS");
const QString header = installHeaders + QLatin1String("/QtDeclarative/private/qdeclarativemetatype_p.h");
return qtVersion->supportsTargetId(Constants::DESKTOP_TARGET_ID)
&& QFile::exists(header);
return (qtVersion->supportsTargetId(Constants::DESKTOP_TARGET_ID)
|| (qtVersion->supportsTargetId(Constants::QT_SIMULATOR_TARGET_ID)
&& checkMinimumQtVersion(qtVersion->qtVersionString(), 4, 7, 1)))
&& QFile::exists(header);
}
static QtVersion *qtVersionForProject(ProjectExplorer::Project *project)
......@@ -170,24 +172,25 @@ static QtVersion *qtVersionForProject(ProjectExplorer::Project *project)
return 0;
}
// else, find any desktop Qt version that has qmldump, or - if there isn't any -
// one that could build it
QtVersion *desktopQt = 0;
// else, find any desktop or simulator Qt version that has qmldump, or
// - if there isn't any - one that could build it
QtVersion *canBuildQmlDump = 0;
QtVersionManager *qtVersions = QtVersionManager::instance();
foreach (QtVersion *version, qtVersions->validVersions()) {
if (version->supportsTargetId(Constants::DESKTOP_TARGET_ID)) {
if (version->supportsTargetId(Constants::DESKTOP_TARGET_ID)
|| version->supportsTargetId(Constants::QT_SIMULATOR_TARGET_ID)) {
const QString qtInstallData = version->versionInfo().value("QT_INSTALL_DATA");
const QString path = QmlDumpTool::toolByInstallData(qtInstallData);
if (!path.isEmpty())
return version;
if (!desktopQt && QmlDumpTool::canBuild(version)) {
desktopQt = version;
if (!canBuildQmlDump && QmlDumpTool::canBuild(version)) {
canBuildQmlDump = version;
}
}
}
return desktopQt;
return canBuildQmlDump;
}
QString QmlDumpTool::toolForProject(ProjectExplorer::Project *project)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment