Don't limit to files ending with .qml

Especially useful when the program is invoked indirectly by a shell
running the QML file like an executable.
Such script executable often don't have an extension to make their
invocation look like that of binary executables.

[ChangeLog][QtQml] Make it possible to make script without .qml suffix

Change-Id: I5a569bdea185cfa60ce68afa27ae03278b1acdb8
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
This commit is contained in:
Kevin Ottens 2015-03-05 11:46:46 +01:00
parent 74d33a3958
commit 4dc68ba888
1 changed files with 5 additions and 8 deletions

View File

@ -64,8 +64,8 @@
#include <cstdlib>
#define VERSION_MAJ 1
#define VERSION_MIN 0
#define VERSION_STR "1.0"
#define VERSION_MIN 1
#define VERSION_STR "1.1"
#define FILE_OPEN_EVENT_WAIT_TIME 3000 // ms
@ -251,11 +251,10 @@ void printVersion()
void printUsage()
{
printf("Usage: qml [options] [files]\n");
printf("Usage: qml [options] [files] [-- args]\n");
printf("\n");
printf("Any argument ending in .qml will be treated as a QML file to be loaded.\n");
printf("Any unknown argument before '--' will be treated as a QML file to be loaded.\n");
printf("Any number of QML files can be loaded. They will share the same engine.\n");
printf("Any argument which is not a recognized option and which does not end in .qml will be ignored.\n");
printf("'gui' application type is only available if the QtGui module is available.\n");
printf("'widget' application type is only available if the QtWidgets module is available.\n");
printf("\n");
@ -440,9 +439,7 @@ int main(int argc, char *argv[])
dummyDir = argList[i+1];
i++;
} else {
//If it ends in .qml, treat it as a file. Else ignore it
if (arg.endsWith(".qml"))
files << arg;
files << arg;
}
}