forked from qt-creator/qt-creator
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:
@@ -61,6 +61,7 @@ Rectangle {
|
|||||||
target: statusText
|
target: statusText
|
||||||
text: qsTr("No QML events recorded");
|
text: qsTr("No QML events recorded");
|
||||||
}
|
}
|
||||||
|
onCompleted: root.clearAll();
|
||||||
},
|
},
|
||||||
// running app
|
// running app
|
||||||
State {
|
State {
|
||||||
|
@@ -193,6 +193,7 @@ bool QmlProfilerEngine::start()
|
|||||||
}
|
}
|
||||||
|
|
||||||
AnalyzerManager::handleToolStarted();
|
AnalyzerManager::handleToolStarted();
|
||||||
|
emit starting(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -106,6 +106,7 @@ public:
|
|||||||
QToolButton *m_recordButton;
|
QToolButton *m_recordButton;
|
||||||
QToolButton *m_clearButton;
|
QToolButton *m_clearButton;
|
||||||
bool m_recordingEnabled;
|
bool m_recordingEnabled;
|
||||||
|
bool m_appIsRunning;
|
||||||
|
|
||||||
enum ConnectMode {
|
enum ConnectMode {
|
||||||
TcpConnection, OstConnection
|
TcpConnection, OstConnection
|
||||||
@@ -128,6 +129,7 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent)
|
|||||||
d->m_runConfiguration = 0;
|
d->m_runConfiguration = 0;
|
||||||
d->m_isAttached = false;
|
d->m_isAttached = false;
|
||||||
d->m_recordingEnabled = true;
|
d->m_recordingEnabled = true;
|
||||||
|
d->m_appIsRunning = false;
|
||||||
|
|
||||||
d->m_connectionTimer.setInterval(200);
|
d->m_connectionTimer.setInterval(200);
|
||||||
connect(&d->m_connectionTimer, SIGNAL(timeout()), SLOT(tryToConnect()));
|
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(d->m_traceWindow, SIGNAL(viewUpdated()), engine, SLOT(dataReceived()));
|
||||||
connect(this, SIGNAL(connectionFailed()), engine, SLOT(finishProcess()));
|
connect(this, SIGNAL(connectionFailed()), engine, SLOT(finishProcess()));
|
||||||
connect(this, SIGNAL(fetchingData(bool)), engine, SLOT(setFetchingData(bool)));
|
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());
|
emit fetchingData(d->m_recordButton->isChecked());
|
||||||
|
|
||||||
return engine;
|
return engine;
|
||||||
@@ -395,6 +400,10 @@ void QmlProfilerTool::stopRecording()
|
|||||||
{
|
{
|
||||||
d->m_traceWindow->setRecording(false);
|
d->m_traceWindow->setRecording(false);
|
||||||
emit fetchingData(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)
|
void QmlProfilerTool::setRecording(bool recording)
|
||||||
@@ -412,6 +421,16 @@ void QmlProfilerTool::setRecording(bool recording)
|
|||||||
stopRecording();
|
stopRecording();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlProfilerTool::setAppIsRunning()
|
||||||
|
{
|
||||||
|
d->m_appIsRunning = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QmlProfilerTool::setAppIsStopped()
|
||||||
|
{
|
||||||
|
d->m_appIsRunning = false;
|
||||||
|
}
|
||||||
|
|
||||||
void QmlProfilerTool::gotoSourceLocation(const QString &fileUrl, int lineNumber)
|
void QmlProfilerTool::gotoSourceLocation(const QString &fileUrl, int lineNumber)
|
||||||
{
|
{
|
||||||
if (lineNumber < 0 || fileUrl.isEmpty())
|
if (lineNumber < 0 || fileUrl.isEmpty())
|
||||||
|
@@ -72,6 +72,9 @@ public slots:
|
|||||||
void stopRecording();
|
void stopRecording();
|
||||||
void setRecording(bool recording);
|
void setRecording(bool recording);
|
||||||
|
|
||||||
|
void setAppIsRunning();
|
||||||
|
void setAppIsStopped();
|
||||||
|
|
||||||
void gotoSourceLocation(const QString &fileUrl, int lineNumber);
|
void gotoSourceLocation(const QString &fileUrl, int lineNumber);
|
||||||
void updateTimer(qreal elapsedSeconds);
|
void updateTimer(qreal elapsedSeconds);
|
||||||
void correctTimer();
|
void correctTimer();
|
||||||
@@ -84,6 +87,7 @@ signals:
|
|||||||
void setTimeLabel(const QString &);
|
void setTimeLabel(const QString &);
|
||||||
void fetchingData(bool);
|
void fetchingData(bool);
|
||||||
void connectionFailed();
|
void connectionFailed();
|
||||||
|
void cancelRun();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateProjectFileList();
|
void updateProjectFileList();
|
||||||
|
Reference in New Issue
Block a user