summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorChristian Kamm <christian.d.kamm@nokia.com>2011-03-11 08:14:16 (GMT)
committerKai Koehne <kai.koehne@nokia.com>2011-05-12 09:25:42 (GMT)
commiteca261bd3ec4b0ff1e0f9b2220c2168e7f62a227 (patch)
tree02e3488a817693249be458aa0dbfde2abea30218 /tools
parentbd7109bd2517de14d10e14c689b07f94f174396f (diff)
downloadQt-eca261bd3ec4b0ff1e0f9b2220c2168e7f62a227.zip
Qt-eca261bd3ec4b0ff1e0f9b2220c2168e7f62a227.tar.gz
Qt-eca261bd3ec4b0ff1e0f9b2220c2168e7f62a227.tar.bz2
qmlplugindump: Allow dumping by path without URI.
This migrates b980a9b9646a89b5b24efeca40926408a71334de from the Qt Creator's copy into the qmlplugindump in Qt. Change-Id: I1ab90f491f5df0e6570aa43a91073e7b332e41df (cherry picked from commit 9fcece7b455b6540a67780cc3874b230e586b7c4)
Diffstat (limited to 'tools')
-rw-r--r--tools/qmlplugindump/main.cpp40
1 files changed, 29 insertions, 11 deletions
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index 5ed5e2e..9dcdf06 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -247,8 +247,7 @@ public:
// some qmltype names are missing the actual names, ignore that import
if (qmlTyName.endsWith('/'))
continue;
- if (!relocatableModuleUri.isNull()
- && qmlTyName.startsWith(relocatableModuleUri + QLatin1Char('/'))) {
+ if (qmlTyName.startsWith(relocatableModuleUri + QLatin1Char('/'))) {
qmlTyName.remove(0, relocatableModuleUri.size() + 1);
}
exports += enquote(QString("%1 %2.%3").arg(
@@ -415,6 +414,7 @@ void printUsage(const QString &appName)
{
qWarning() << qPrintable(QString(
"Usage: %1 [--notrelocatable] module.uri version [module/import/path]\n"
+ " %1 --path path/to/qmldir/directory [version]\n"
" %1 --builtins\n"
"Example: %1 Qt.labs.particles 4.7 /home/user/dev/qt-install/imports").arg(
appName));
@@ -450,6 +450,7 @@ int main(int argc, char *argv[])
QString pluginImportVersion;
QString pluginImportPath;
bool relocatable = true;
+ bool pathImport = false;
if (args.size() >= 3) {
QStringList positionalArgs;
foreach (const QString &arg, args) {
@@ -460,20 +461,32 @@ int main(int argc, char *argv[])
if (arg == QLatin1String("--notrelocatable")) {
relocatable = false;
+ } else if (arg == QLatin1String("--path")) {
+ pathImport = true;
} else {
qWarning() << "Invalid argument: " << arg;
return EXIT_INVALIDARGUMENTS;
}
}
- if (positionalArgs.size() != 3 && positionalArgs.size() != 4) {
- qWarning() << "Incorrect number of positional arguments";
- return EXIT_INVALIDARGUMENTS;
+ if (!pathImport) {
+ if (positionalArgs.size() != 3 && positionalArgs.size() != 4) {
+ qWarning() << "Incorrect number of positional arguments";
+ return EXIT_INVALIDARGUMENTS;
+ }
+ pluginImportUri = positionalArgs[1];
+ pluginImportVersion = positionalArgs[2];
+ if (positionalArgs.size() >= 4)
+ pluginImportPath = positionalArgs[3];
+ } else {
+ if (positionalArgs.size() != 2 && positionalArgs.size() != 3) {
+ qWarning() << "Incorrect number of positional arguments";
+ return EXIT_INVALIDARGUMENTS;
+ }
+ pluginImportPath = positionalArgs[1];
+ if (positionalArgs.size() == 3)
+ pluginImportVersion = positionalArgs[2];
}
- pluginImportUri = positionalArgs[1];
- pluginImportVersion = positionalArgs[2];
- if (positionalArgs.size() >= 4)
- pluginImportPath = positionalArgs[3];
}
QDeclarativeView view;
@@ -488,11 +501,16 @@ int main(int argc, char *argv[])
// this will hold the meta objects we want to dump information of
QSet<const QMetaObject *> metas;
- if (pluginImportUri.isEmpty()) {
+ if (pluginImportUri.isEmpty() && !pathImport) {
metas = defaultReachable;
} else {
// find all QMetaObjects reachable when the specified module is imported
- importCode += QString("import %0 %1\n").arg(pluginImportUri, pluginImportVersion).toAscii();
+ if (!pathImport) {
+ importCode += QString("import %0 %1\n").arg(pluginImportUri, pluginImportVersion).toAscii();
+ } else {
+ // pluginImportVersion can be empty
+ importCode += QString("import \"%1\" %2\n").arg(pluginImportPath, pluginImportVersion).toAscii();
+ }
// create a component with these imports to make sure the imports are valid
// and to populate the declarative meta type system