From f096b53b46dbb6d1dafff7bc44455b9341aebca5 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 16 Nov 2010 20:57:22 +0100 Subject: [PATCH] Fixing the generation of Qt Quick examples --- tests/tools/qtquickappblaster/main.cpp | 17 +- tests/tools/qtquickappblaster/qtquickapps.xml | 442 +++++++----------- 2 files changed, 174 insertions(+), 285 deletions(-) diff --git a/tests/tools/qtquickappblaster/main.cpp b/tests/tools/qtquickappblaster/main.cpp index 470aca4c545..4f1b0668b82 100644 --- a/tests/tools/qtquickappblaster/main.cpp +++ b/tests/tools/qtquickappblaster/main.cpp @@ -28,14 +28,12 @@ bool processXmlFile(const QString &xmlFile) case QXmlStreamReader::StartElement: if (reader.name() == tag_app) { QmlStandaloneApp qmlApp; - if (!reader.attributes().hasAttribute(attrib_projectName)) { - qDebug() << "Error: Project without name"; + QFileInfo projectPath; + if (!reader.attributes().hasAttribute(attrib_projectPath)) { + qDebug() << "Project without path found"; continue; } - qmlApp.setProjectName(reader.attributes().value(attrib_projectName).toString()); - QFileInfo projectPath; - if (reader.attributes().hasAttribute(attrib_projectPath)) - projectPath = qtDir + reader.attributes().value(attrib_projectPath).toString(); + projectPath = qtDir + reader.attributes().value(attrib_projectPath).toString(); qmlApp.setProjectPath(projectPath.absoluteFilePath()); if (reader.attributes().hasAttribute(attrib_mainQmlFile)) { const QFileInfo qmlFileOrigin( @@ -46,8 +44,8 @@ bool processXmlFile(const QString &xmlFile) continue; } const QFileInfo qmlTargetPath(QString(projectPath.absoluteFilePath() - + QLatin1Char('/') + qmlApp.projectName() - + QLatin1String("/qml/") + qmlApp.projectName())); + + QLatin1Char('/') + qmlFileOrigin.baseName() + + QLatin1String("/qml"))); #ifdef Q_OS_WIN const QString sourcePath = QDir::toNativeSeparators(qmlFileOrigin.canonicalPath() + QLatin1String("/*")); @@ -68,6 +66,9 @@ bool processXmlFile(const QString &xmlFile) qmlApp.setMainQmlFile(qmlTargetPath.absoluteFilePath() + QLatin1Char('/') + qmlFileOrigin.fileName()); } + qmlApp.setProjectName(reader.attributes().hasAttribute(attrib_projectName) + ? reader.attributes().value(attrib_projectName).toString() + : QFileInfo(qmlApp.mainQmlFile()).baseName()); if (reader.attributes().hasAttribute(attrib_screenOrientation)) { const QStringRef orientation = reader.attributes().value(attrib_screenOrientation); qmlApp.setOrientation(orientation == value_screenOrientationLockLandscape ? diff --git a/tests/tools/qtquickappblaster/qtquickapps.xml b/tests/tools/qtquickappblaster/qtquickapps.xml index de5e5d73481..9a5d5fd77f5 100644 --- a/tests/tools/qtquickappblaster/qtquickapps.xml +++ b/tests/tools/qtquickappblaster/qtquickapps.xml @@ -1,337 +1,225 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -