QmlProfiler: supporting Application Output Pane buttons

Task-Numbers: QTCREATORBUG-5548 5549 5550 5551 5552

Change-Id: I39a18e05967cf50eab2725cb65e6291d66c8af55
Reviewed-on: http://codereview.qt.nokia.com/2112
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
Christiaan Janssen
2011-07-25 10:36:21 +02:00
parent 0ec8817cbe
commit 11f749663c

View File

@@ -69,7 +69,7 @@ class QmlProfilerEngine::QmlProfilerEnginePrivate
{ {
public: public:
QmlProfilerEnginePrivate(QmlProfilerEngine *qq) : q(qq), m_runner(0) {} QmlProfilerEnginePrivate(QmlProfilerEngine *qq) : q(qq), m_runner(0) {}
~QmlProfilerEnginePrivate() {} ~QmlProfilerEnginePrivate() { delete m_runner; }
bool attach(const QString &address, uint port); bool attach(const QString &address, uint port);
static AbstractQmlProfilerRunner *createRunner(ProjectExplorer::RunConfiguration *runConfiguration, static AbstractQmlProfilerRunner *createRunner(ProjectExplorer::RunConfiguration *runConfiguration,
@@ -81,6 +81,7 @@ public:
AbstractQmlProfilerRunner *m_runner; AbstractQmlProfilerRunner *m_runner;
bool m_running; bool m_running;
bool m_fetchingData; bool m_fetchingData;
bool m_fetchDataFromStart;
bool m_delayedDelete; bool m_delayedDelete;
}; };
@@ -132,6 +133,7 @@ QmlProfilerEngine::QmlProfilerEngine(IAnalyzerTool *tool,
{ {
d->m_running = false; d->m_running = false;
d->m_fetchingData = false; d->m_fetchingData = false;
d->m_fetchDataFromStart = false;
d->m_delayedDelete = false; d->m_delayedDelete = false;
} }
@@ -144,7 +146,10 @@ QmlProfilerEngine::~QmlProfilerEngine()
void QmlProfilerEngine::start() void QmlProfilerEngine::start()
{ {
QTC_ASSERT(!d->m_runner, return); if (d->m_runner) {
delete d->m_runner;
d->m_runner = 0;
}
if (QmlProjectManager::QmlProjectRunConfiguration *rc = if (QmlProjectManager::QmlProjectRunConfiguration *rc =
qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration())) { qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration())) {
@@ -174,11 +179,17 @@ void QmlProfilerEngine::start()
d->m_running = true; d->m_running = true;
d->m_delayedDelete = false; d->m_delayedDelete = false;
if (d->m_fetchDataFromStart) {
d->m_fetchingData = true;
}
AnalyzerManager::handleToolStarted(); AnalyzerManager::handleToolStarted();
} }
void QmlProfilerEngine::stop() void QmlProfilerEngine::stop()
{ {
// keep the flag for the next restart
d->m_fetchDataFromStart = d->m_fetchingData;
if (d->m_fetchingData) { if (d->m_fetchingData) {
if (d->m_running) if (d->m_running)
d->m_delayedDelete = true; d->m_delayedDelete = true;
@@ -191,6 +202,10 @@ void QmlProfilerEngine::stop()
void QmlProfilerEngine::stopped() void QmlProfilerEngine::stopped()
{ {
// if it was killed, preserve recording flag
if (d->m_running)
d->m_fetchDataFromStart = d->m_fetchingData;
// user feedback // user feedback
if (d->m_running && d->m_fetchingData) { if (d->m_running && d->m_fetchingData) {
showNonmodalWarning(tr("Application finished before loading profiled data.\n Please use the stop button instead.")); showNonmodalWarning(tr("Application finished before loading profiled data.\n Please use the stop button instead."));
@@ -204,6 +219,8 @@ void QmlProfilerEngine::stopped()
void QmlProfilerEngine::setFetchingData(bool b) void QmlProfilerEngine::setFetchingData(bool b)
{ {
d->m_fetchingData = b; d->m_fetchingData = b;
if (!d->m_running)
d->m_fetchDataFromStart = b;
} }
void QmlProfilerEngine::dataReceived() void QmlProfilerEngine::dataReceived()