diff options
author | ck <qt-info@nokia.com> | 2009-08-04 11:54:42 (GMT) |
---|---|---|
committer | ck <qt-info@nokia.com> | 2009-08-04 11:54:42 (GMT) |
commit | e888ff9902f193b8797d7993cd7d43e76045dcc1 (patch) | |
tree | e4ccd53ae4e91d4f4b73b834aeec74bd118602de /tools | |
parent | 40d7153ad17d6eca96cb4718486e8e2654b72f00 (diff) | |
download | Qt-e888ff9902f193b8797d7993cd7d43e76045dcc1.zip Qt-e888ff9902f193b8797d7993cd7d43e76045dcc1.tar.gz Qt-e888ff9902f193b8797d7993cd7d43e76045dcc1.tar.bz2 |
Assistant: Use non-GUI version of QApplication for command-line tasks.
Task-number: 259136
Reviewed-by: kh
Diffstat (limited to 'tools')
-rw-r--r-- | tools/assistant/tools/assistant/main.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/assistant/tools/assistant/main.cpp b/tools/assistant/tools/assistant/main.cpp index a0a5a0d..4af2570 100644 --- a/tools/assistant/tools/assistant/main.cpp +++ b/tools/assistant/tools/assistant/main.cpp @@ -181,7 +181,21 @@ QString indexFilesFolder(const QString &collectionFile) int main(int argc, char *argv[]) { - QApplication a(argc, argv); + // First do a quick search for arguments that imply command-line mode. + const char * cmdModeArgs[] = { + "-help", "-register", "-unregister", "-remove-search-index" + }; + bool useGui = true; + for (int i = 1; i < argc; ++i) { + for (size_t j = 0; j < sizeof cmdModeArgs/sizeof *cmdModeArgs; ++j) { + if(strcmp(argv[i], cmdModeArgs[j]) == 0) { + useGui = false; + break; + } + } + } + + QApplication a(argc, argv, useGui); a.addLibraryPath(a.applicationDirPath() + QLatin1String("/plugins")); CmdLineParser cmd; |