1 | // Copyright (C) 2016 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
3 | |
4 | #include "commandlistener.h" |
5 | #include "qmlprofilerapplication.h" |
6 | |
7 | int main(int argc, char *argv[]) |
8 | { |
9 | QmlProfilerApplication app(argc, argv); |
10 | |
11 | app.parseArguments(); |
12 | |
13 | if (app.isInteractive()) { |
14 | QThread listenerThread; |
15 | CommandListener listener; |
16 | listener.moveToThread(thread: &listenerThread); |
17 | QObject::connect(sender: &listener, signal: &CommandListener::command, |
18 | context: &app, slot: &QmlProfilerApplication::userCommand); |
19 | QObject::connect(sender: &app, signal: &QmlProfilerApplication::readyForCommand, |
20 | context: &listener, slot: &CommandListener::readCommand); |
21 | listenerThread.start(); |
22 | int exitValue = app.exec(); |
23 | listenerThread.quit(); |
24 | // wait for listener to exit |
25 | listenerThread.wait(); |
26 | return exitValue; |
27 | } else { |
28 | int exitValue = app.exec(); |
29 | app.outputData(); |
30 | return exitValue; |
31 | } |
32 | } |
33 |