forked from qt-creator/qt-creator
QmlProfiler: read trace when application ended by the user
This patch avoids showing the "use the stop button" if the application dies but the trace data was sent in time. Note: with the current implementation in Qt5, the application sometimes closes before all data could be sent. That happens with any non-trivial qml application. Change-Id: Ie7b1568b2d69320d1887587dccac40a4b4d4d788 Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
This commit is contained in:
@@ -77,6 +77,8 @@ Rectangle {
|
|||||||
signal changeToolTip(string text)
|
signal changeToolTip(string text)
|
||||||
signal updateVerticalScroll(int newPosition)
|
signal updateVerticalScroll(int newPosition)
|
||||||
|
|
||||||
|
property bool applicationDied : false
|
||||||
|
|
||||||
// ***** connections with external objects
|
// ***** connections with external objects
|
||||||
Connections {
|
Connections {
|
||||||
target: zoomControl
|
target: zoomControl
|
||||||
@@ -149,6 +151,7 @@ Rectangle {
|
|||||||
function clearData() {
|
function clearData() {
|
||||||
view.clearData();
|
view.clearData();
|
||||||
dataAvailable = false;
|
dataAvailable = false;
|
||||||
|
applicationDied = false;
|
||||||
eventCount = 0;
|
eventCount = 0;
|
||||||
hideRangeDetails();
|
hideRangeDetails();
|
||||||
selectionRangeMode = false;
|
selectionRangeMode = false;
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ Item {
|
|||||||
// loading data
|
// loading data
|
||||||
State {
|
State {
|
||||||
name: "loading"
|
name: "loading"
|
||||||
when: (!root.dataAvailable) && (root.eventCount > 0)
|
when: (!root.dataAvailable) && (root.eventCount > 0) && !root.applicationDied
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: statusDisplay
|
target: statusDisplay
|
||||||
visible: true
|
visible: true
|
||||||
@@ -110,6 +110,23 @@ Item {
|
|||||||
text: qsTr("Loading data")
|
text: qsTr("Loading data")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PropertyChanges {
|
||||||
|
target: progressBar
|
||||||
|
visible: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// application died
|
||||||
|
State {
|
||||||
|
name: "deadApp"
|
||||||
|
when: (!root.dataAvailable) && (root.eventCount > 0) && root.applicationDied
|
||||||
|
PropertyChanges {
|
||||||
|
target: statusDisplay
|
||||||
|
visible: true
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: statusText
|
||||||
|
text: qsTr("Application stopped before loading all data")
|
||||||
|
}
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: progressBar
|
target: progressBar
|
||||||
visible: true
|
visible: true
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ public:
|
|||||||
AbstractQmlProfilerRunner *m_runner;
|
AbstractQmlProfilerRunner *m_runner;
|
||||||
bool m_running;
|
bool m_running;
|
||||||
bool m_fetchingData;
|
bool m_fetchingData;
|
||||||
|
bool m_hasData;
|
||||||
bool m_fetchDataFromStart;
|
bool m_fetchDataFromStart;
|
||||||
bool m_delayedDelete;
|
bool m_delayedDelete;
|
||||||
QTimer m_noDebugOutputTimer;
|
QTimer m_noDebugOutputTimer;
|
||||||
@@ -209,6 +210,7 @@ bool QmlProfilerEngine::start()
|
|||||||
|
|
||||||
if (d->m_fetchDataFromStart) {
|
if (d->m_fetchDataFromStart) {
|
||||||
d->m_fetchingData = true;
|
d->m_fetchingData = true;
|
||||||
|
d->m_hasData = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
emit starting(this);
|
emit starting(this);
|
||||||
@@ -236,8 +238,9 @@ void QmlProfilerEngine::stopped()
|
|||||||
d->m_fetchDataFromStart = d->m_fetchingData;
|
d->m_fetchDataFromStart = d->m_fetchingData;
|
||||||
|
|
||||||
// user feedback
|
// user feedback
|
||||||
if (d->m_running && d->m_fetchingData) {
|
if (d->m_running && d->m_fetchingData && !d->m_hasData) {
|
||||||
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."));
|
||||||
|
emit applicationDied();
|
||||||
}
|
}
|
||||||
|
|
||||||
d->m_running = false;
|
d->m_running = false;
|
||||||
@@ -250,6 +253,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 && b)
|
||||||
|
d->m_hasData = false;
|
||||||
if (!d->m_running)
|
if (!d->m_running)
|
||||||
d->m_fetchDataFromStart = b;
|
d->m_fetchDataFromStart = b;
|
||||||
}
|
}
|
||||||
@@ -259,6 +264,7 @@ void QmlProfilerEngine::dataReceived()
|
|||||||
if (d->m_delayedDelete)
|
if (d->m_delayedDelete)
|
||||||
finishProcess();
|
finishProcess();
|
||||||
d->m_delayedDelete = false;
|
d->m_delayedDelete = false;
|
||||||
|
d->m_hasData = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerEngine::finishProcess()
|
void QmlProfilerEngine::finishProcess()
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ signals:
|
|||||||
void stopRecording();
|
void stopRecording();
|
||||||
void timeUpdate();
|
void timeUpdate();
|
||||||
void recordingChanged(bool recording);
|
void recordingChanged(bool recording);
|
||||||
|
void applicationDied();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
bool start();
|
bool start();
|
||||||
|
|||||||
@@ -376,6 +376,7 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp
|
|||||||
connect(engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)), this, SLOT(setAppIsRunning()));
|
connect(engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)), this, SLOT(setAppIsRunning()));
|
||||||
connect(engine, SIGNAL(finished()), this, SLOT(setAppIsStopped()));
|
connect(engine, SIGNAL(finished()), this, SLOT(setAppIsStopped()));
|
||||||
connect(this, SIGNAL(cancelRun()), engine, SLOT(finishProcess()));
|
connect(this, SIGNAL(cancelRun()), engine, SLOT(finishProcess()));
|
||||||
|
connect(engine, SIGNAL(applicationDied()), d->m_traceWindow, SLOT(applicationDied()));
|
||||||
emit fetchingData(d->m_recordButton->isChecked());
|
emit fetchingData(d->m_recordButton->isChecked());
|
||||||
|
|
||||||
return engine;
|
return engine;
|
||||||
|
|||||||
@@ -639,5 +639,11 @@ void TraceWindow::firstDataReceived()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TraceWindow::applicationDied()
|
||||||
|
{
|
||||||
|
if (m_mainView->rootObject())
|
||||||
|
m_mainView->rootObject()->setProperty("applicationDied",QVariant(true));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace QmlProfiler
|
} // namespace QmlProfiler
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ private slots:
|
|||||||
void eventListStateChanged();
|
void eventListStateChanged();
|
||||||
void manageTraceStart(qint64 traceStart);
|
void manageTraceStart(qint64 traceStart);
|
||||||
void firstDataReceived();
|
void firstDataReceived();
|
||||||
|
void applicationDied();
|
||||||
void correctTimer();
|
void correctTimer();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
Reference in New Issue
Block a user