2022-05-13 13:12:05 +00:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2012-02-09 16:04:43 +00:00
|
|
|
|
|
|
|
#include "commandlistener.h"
|
|
|
|
#include "qmlprofilerapplication.h"
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
QmlProfilerApplication app(argc, argv);
|
|
|
|
|
2015-05-18 15:43:25 +00:00
|
|
|
app.parseArguments();
|
2012-02-09 16:04:43 +00:00
|
|
|
|
2015-05-19 13:54:16 +00:00
|
|
|
if (app.isInteractive()) {
|
2015-05-21 13:39:28 +00:00
|
|
|
QThread listenerThread;
|
2015-05-19 13:54:16 +00:00
|
|
|
CommandListener listener;
|
2015-05-21 13:39:28 +00:00
|
|
|
listener.moveToThread(&listenerThread);
|
2016-07-20 13:35:50 +00:00
|
|
|
QObject::connect(&listener, &CommandListener::command,
|
|
|
|
&app, &QmlProfilerApplication::userCommand);
|
|
|
|
QObject::connect(&app, &QmlProfilerApplication::readyForCommand,
|
|
|
|
&listener, &CommandListener::readCommand);
|
2015-05-21 13:39:28 +00:00
|
|
|
listenerThread.start();
|
2015-05-19 13:54:16 +00:00
|
|
|
int exitValue = app.exec();
|
2015-05-21 13:39:28 +00:00
|
|
|
listenerThread.quit();
|
2015-05-19 13:54:16 +00:00
|
|
|
// wait for listener to exit
|
2015-05-21 13:39:28 +00:00
|
|
|
listenerThread.wait();
|
2015-05-19 13:54:16 +00:00
|
|
|
return exitValue;
|
|
|
|
} else {
|
2015-05-21 13:37:52 +00:00
|
|
|
int exitValue = app.exec();
|
|
|
|
app.outputData();
|
|
|
|
return exitValue;
|
2015-05-19 13:54:16 +00:00
|
|
|
}
|
2012-02-09 16:04:43 +00:00
|
|
|
}
|