diff options
Diffstat (limited to 'tools/qmlprofiler/main.cpp')
-rw-r--r-- | tools/qmlprofiler/main.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/tools/qmlprofiler/main.cpp b/tools/qmlprofiler/main.cpp index a1bd1b38b4..12fcc79efa 100644 --- a/tools/qmlprofiler/main.cpp +++ b/tools/qmlprofiler/main.cpp @@ -38,19 +38,23 @@ int main(int argc, char *argv[]) { QmlProfilerApplication app(argc, argv); - if (!app.parseArguments()) { - app.printUsage(); - return 1; - } - - CommandListener listener; - QObject::connect(&listener, SIGNAL(command(QString)), &app, SLOT(userCommand(QString))); - listener.start(); - - int exitValue = app.exec(); - // wait for listener to exit - listener.wait(); + app.parseArguments(); - - return exitValue; + if (app.isInteractive()) { + QThread listenerThread; + CommandListener listener; + listener.moveToThread(&listenerThread); + QObject::connect(&listener, SIGNAL(command(QString)), &app, SLOT(userCommand(QString))); + QObject::connect(&app, SIGNAL(readyForCommand()), &listener, SLOT(readCommand())); + listenerThread.start(); + int exitValue = app.exec(); + listenerThread.quit(); + // wait for listener to exit + listenerThread.wait(); + return exitValue; + } else { + int exitValue = app.exec(); + app.outputData(); + return exitValue; + } } |