QmlProfiler: manage quick stops before connection

Task-number: QTCREATORBUG-5804
Change-Id: I86e9a94c5352d0ac8f9157949afd3b32d60cb05e
Reviewed-on: http://codereview.qt.nokia.com/3606
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-08-25 16:30:36 +02:00
parent 6d5c0c0d78
commit 9fa409cbd9
4 changed files with 25 additions and 0 deletions

View File

@@ -61,6 +61,7 @@ Rectangle {
target: statusText
text: qsTr("No QML events recorded");
}
onCompleted: root.clearAll();
},
// running app
State {

View File

@@ -193,6 +193,7 @@ bool QmlProfilerEngine::start()
}
AnalyzerManager::handleToolStarted();
emit starting(this);
return true;
}

View File

@@ -106,6 +106,7 @@ public:
QToolButton *m_recordButton;
QToolButton *m_clearButton;
bool m_recordingEnabled;
bool m_appIsRunning;
enum ConnectMode {
TcpConnection, OstConnection
@@ -128,6 +129,7 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent)
d->m_runConfiguration = 0;
d->m_isAttached = false;
d->m_recordingEnabled = true;
d->m_appIsRunning = false;
d->m_connectionTimer.setInterval(200);
connect(&d->m_connectionTimer, SIGNAL(timeout()), SLOT(tryToConnect()));
@@ -247,6 +249,9 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp
connect(d->m_traceWindow, SIGNAL(viewUpdated()), engine, SLOT(dataReceived()));
connect(this, SIGNAL(connectionFailed()), engine, SLOT(finishProcess()));
connect(this, SIGNAL(fetchingData(bool)), engine, SLOT(setFetchingData(bool)));
connect(engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)), this, SLOT(setAppIsRunning()));
connect(engine, SIGNAL(finished()), this, SLOT(setAppIsStopped()));
connect(this, SIGNAL(cancelRun()), engine, SLOT(finishProcess()));
emit fetchingData(d->m_recordButton->isChecked());
return engine;
@@ -395,6 +400,10 @@ void QmlProfilerTool::stopRecording()
{
d->m_traceWindow->setRecording(false);
emit fetchingData(false);
// manage early stop
if (d->m_client && !d->m_client->isConnected() && d->m_appIsRunning)
emit cancelRun();
}
void QmlProfilerTool::setRecording(bool recording)
@@ -412,6 +421,16 @@ void QmlProfilerTool::setRecording(bool recording)
stopRecording();
}
void QmlProfilerTool::setAppIsRunning()
{
d->m_appIsRunning = true;
}
void QmlProfilerTool::setAppIsStopped()
{
d->m_appIsRunning = false;
}
void QmlProfilerTool::gotoSourceLocation(const QString &fileUrl, int lineNumber)
{
if (lineNumber < 0 || fileUrl.isEmpty())

View File

@@ -72,6 +72,9 @@ public slots:
void stopRecording();
void setRecording(bool recording);
void setAppIsRunning();
void setAppIsStopped();
void gotoSourceLocation(const QString &fileUrl, int lineNumber);
void updateTimer(qreal elapsedSeconds);
void correctTimer();
@@ -84,6 +87,7 @@ signals:
void setTimeLabel(const QString &);
void fetchingData(bool);
void connectionFailed();
void cancelRun();
private slots:
void updateProjectFileList();