aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmlprofiler/qmlprofilerapplication.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-05-19 15:54:16 +0200
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-05-21 12:54:48 +0000
commit864b1c498c4257e8790ad8fe13c52c5b06c6a1ac (patch)
treeb8fdb34db30a73549a9c979754208850df9cb5eb /tools/qmlprofiler/qmlprofilerapplication.cpp
parent455e9153eb13399b1b1b711075d77b699aabfbef (diff)
qmlprofiler: Add non-interactive mode and make it the default.
If you just run a test application through the profiler without any further parameters, you want it to record the data the application generates and then terminate itself. [ChangeLog][QtQml][Behavior Change] Make qmlprofiler command line interface better suited for scripting. Task-number: QTBUG-43066 Change-Id: I831e714b9c7b4b984b6450ad5c78ba4fdae6b8f6 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'tools/qmlprofiler/qmlprofilerapplication.cpp')
-rw-r--r--tools/qmlprofiler/qmlprofilerapplication.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/tools/qmlprofiler/qmlprofilerapplication.cpp b/tools/qmlprofiler/qmlprofilerapplication.cpp
index 5142999808..eb67b5f40e 100644
--- a/tools/qmlprofiler/qmlprofilerapplication.cpp
+++ b/tools/qmlprofiler/qmlprofilerapplication.cpp
@@ -43,12 +43,9 @@
#include <QtCore/QCommandLineParser>
static const char commandTextC[] =
- "You can control the recoding interactively with the "
- "following commands:\n"
- " r, record\n"
- " Switch recording on or off.\n"
- " q, quit\n"
- " Terminate program.";
+ "The following commands are available:\n"
+ "\"r\", \"record\" Switch recording on or off.\n"
+ "\"q\", \"quit\" Terminate program.";
static const char TraceFileExtension[] = ".qtd";
@@ -62,6 +59,7 @@ QmlProfilerApplication::QmlProfilerApplication(int &argc, char **argv) :
m_verbose(false),
m_quitAfterSave(false),
m_recording(true),
+ m_interactive(false),
m_qmlProfilerClient(&m_connection),
m_v8profilerClient(&m_connection),
m_connectionAttempts(0),
@@ -134,7 +132,7 @@ void QmlProfilerApplication::parseArguments()
"The QML Profiler retrieves QML tracing data from an application. The data\n"
"collected can then be visualized in Qt Creator. The application to be profiled\n"
"has to enable QML debugging. See the Qt Creator documentation on how to do\n"
- "this for different Qt versions.") + QChar::LineFeed + QChar::LineFeed + tr(commandTextC));
+ "this for different Qt versions."));
QCommandLineOption attach(QStringList() << QLatin1String("a") << QLatin1String("attach"),
tr("Attach to an application already running on <hostname>, "
@@ -155,6 +153,12 @@ void QmlProfilerApplication::parseArguments()
QLatin1String("on|off"), QLatin1String("on"));
parser.addOption(record);
+ QCommandLineOption interactive(QLatin1String("interactive"),
+ tr("Manually control the recording from the command line. The "
+ "profiler will not terminate itself when the application "
+ "does so in this case.") + QChar::Space + tr(commandTextC));
+ parser.addOption(interactive);
+
QCommandLineOption verbose(QStringList() << QLatin1String("verbose"),
tr("Print debugging output."));
parser.addOption(verbose);
@@ -186,6 +190,7 @@ void QmlProfilerApplication::parseArguments()
}
m_recording = (parser.value(record) == QLatin1String("on"));
+ m_interactive = parser.isSet(interactive);
if (parser.isSet(verbose))
m_verbose = true;
@@ -213,6 +218,11 @@ int QmlProfilerApplication::exec()
return QCoreApplication::exec();
}
+bool QmlProfilerApplication::isInteractive() const
+{
+ return m_interactive;
+}
+
void QmlProfilerApplication::printCommands()
{
print(tr(commandTextC));