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 updateVerticalScroll(int newPosition)
|
||||
|
||||
property bool applicationDied : false
|
||||
|
||||
// ***** connections with external objects
|
||||
Connections {
|
||||
target: zoomControl
|
||||
@@ -149,6 +151,7 @@ Rectangle {
|
||||
function clearData() {
|
||||
view.clearData();
|
||||
dataAvailable = false;
|
||||
applicationDied = false;
|
||||
eventCount = 0;
|
||||
hideRangeDetails();
|
||||
selectionRangeMode = false;
|
||||
|
||||
@@ -99,7 +99,7 @@ Item {
|
||||
// loading data
|
||||
State {
|
||||
name: "loading"
|
||||
when: (!root.dataAvailable) && (root.eventCount > 0)
|
||||
when: (!root.dataAvailable) && (root.eventCount > 0) && !root.applicationDied
|
||||
PropertyChanges {
|
||||
target: statusDisplay
|
||||
visible: true
|
||||
@@ -110,6 +110,23 @@ Item {
|
||||
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 {
|
||||
target: progressBar
|
||||
visible: true
|
||||
|
||||
@@ -80,6 +80,7 @@ public:
|
||||
AbstractQmlProfilerRunner *m_runner;
|
||||
bool m_running;
|
||||
bool m_fetchingData;
|
||||
bool m_hasData;
|
||||
bool m_fetchDataFromStart;
|
||||
bool m_delayedDelete;
|
||||
QTimer m_noDebugOutputTimer;
|
||||
@@ -209,6 +210,7 @@ bool QmlProfilerEngine::start()
|
||||
|
||||
if (d->m_fetchDataFromStart) {
|
||||
d->m_fetchingData = true;
|
||||
d->m_hasData = false;
|
||||
}
|
||||
|
||||
emit starting(this);
|
||||
@@ -236,8 +238,9 @@ void QmlProfilerEngine::stopped()
|
||||
d->m_fetchDataFromStart = d->m_fetchingData;
|
||||
|
||||
// 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."));
|
||||
emit applicationDied();
|
||||
}
|
||||
|
||||
d->m_running = false;
|
||||
@@ -250,6 +253,8 @@ void QmlProfilerEngine::stopped()
|
||||
void QmlProfilerEngine::setFetchingData(bool b)
|
||||
{
|
||||
d->m_fetchingData = b;
|
||||
if (d->m_running && b)
|
||||
d->m_hasData = false;
|
||||
if (!d->m_running)
|
||||
d->m_fetchDataFromStart = b;
|
||||
}
|
||||
@@ -259,6 +264,7 @@ void QmlProfilerEngine::dataReceived()
|
||||
if (d->m_delayedDelete)
|
||||
finishProcess();
|
||||
d->m_delayedDelete = false;
|
||||
d->m_hasData = true;
|
||||
}
|
||||
|
||||
void QmlProfilerEngine::finishProcess()
|
||||
|
||||
@@ -55,6 +55,7 @@ signals:
|
||||
void stopRecording();
|
||||
void timeUpdate();
|
||||
void recordingChanged(bool recording);
|
||||
void applicationDied();
|
||||
|
||||
public slots:
|
||||
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(finished()), this, SLOT(setAppIsStopped()));
|
||||
connect(this, SIGNAL(cancelRun()), engine, SLOT(finishProcess()));
|
||||
connect(engine, SIGNAL(applicationDied()), d->m_traceWindow, SLOT(applicationDied()));
|
||||
emit fetchingData(d->m_recordButton->isChecked());
|
||||
|
||||
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 QmlProfiler
|
||||
|
||||
@@ -133,6 +133,7 @@ private slots:
|
||||
void eventListStateChanged();
|
||||
void manageTraceStart(qint64 traceStart);
|
||||
void firstDataReceived();
|
||||
void applicationDied();
|
||||
void correctTimer();
|
||||
|
||||
signals:
|
||||
|
||||
Reference in New Issue
Block a user