QmlProfiler: New event list with caching, load, save

Change-Id: I640a16649156a49f2d7e7006d6b2ea38fe218620
Reviewed-on: http://codereview.qt.nokia.com/3043
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-26 13:56:14 +02:00
parent 8fbaa0d10a
commit d2911d70f3
17 changed files with 1417 additions and 489 deletions

View File

@@ -33,6 +33,7 @@
#include "tracewindow.h"
#include "qmlprofilerplugin.h"
#include "qmlprofilereventlist.h"
#include <qmljsdebugclient/qdeclarativedebugclient.h>
#include <qmljsdebugclient/qmlprofilertraceclient.h>
@@ -43,6 +44,7 @@
#include <QtGui/QVBoxLayout>
#include <QtGui/QToolButton>
#include <QtGui/QGraphicsObject>
#include <QtGui/QContextMenuEvent>
using namespace QmlJsDebugClient;
@@ -97,14 +99,17 @@ TraceWindow::TraceWindow(QWidget *parent)
toolBarLayout->addWidget(buttonZoomIn);
toolBarLayout->addWidget(buttonZoomOut);
m_view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
m_view->setFocus();
groupLayout->addWidget(m_view);
setLayout(groupLayout);
m_eventList = new QmlProfilerEventList(this);
connect(this,SIGNAL(range(int,qint64,qint64,QStringList,QString,int)), m_eventList, SLOT(addRangedEvent(int,qint64,qint64,QStringList,QString,int)));
connect(this,SIGNAL(viewUpdated()), m_eventList, SLOT(complete()));
m_view->rootContext()->setContextProperty("qmlEventList", m_eventList);
// Minimum height: 5 rows of 20 pixels + scrollbar of 50 pixels + 20 pixels margin
setMinimumHeight(170);
}
@@ -121,8 +126,8 @@ void TraceWindow::reset(QDeclarativeDebugConnection *conn)
delete m_plugin.data();
m_plugin = new QmlProfilerTraceClient(conn);
connect(m_plugin.data(), SIGNAL(complete()), this, SIGNAL(viewUpdated()));
connect(m_plugin.data(), SIGNAL(range(int,int,int,qint64,qint64,QStringList,QString,int)),
this, SIGNAL(range(int,int,int,qint64,qint64,QStringList,QString,int)));
connect(m_plugin.data(), SIGNAL(range(int,qint64,qint64,QStringList,QString,int)),
this, SIGNAL(range(int,qint64,qint64,QStringList,QString,int)));
m_view->rootContext()->setContextProperty("connection", m_plugin.data());
m_view->setSource(QUrl("qrc:/qmlprofiler/MainView.qml"));
@@ -131,7 +136,7 @@ void TraceWindow::reset(QDeclarativeDebugConnection *conn)
connect(m_view->rootObject(), SIGNAL(updateCursorPosition()), this, SLOT(updateCursorPosition()));
connect(m_view->rootObject(), SIGNAL(updateTimer()), this, SLOT(updateTimer()));
connect(m_view->rootObject(), SIGNAL(dataAvailableChanged()), this, SLOT(updateToolbar()));
connect(m_eventList, SIGNAL(countChanged()), this, SLOT(updateToolbar()));
connect(this, SIGNAL(jumpToPrev()), m_view->rootObject(), SLOT(prevEvent()));
connect(this, SIGNAL(jumpToNext()), m_view->rootObject(), SLOT(nextEvent()));
connect(this, SIGNAL(zoomIn()), m_view->rootObject(), SLOT(zoomIn()));
@@ -140,6 +145,16 @@ void TraceWindow::reset(QDeclarativeDebugConnection *conn)
connect(this, SIGNAL(internalClearDisplay()), m_view->rootObject(), SLOT(clearAll()));
}
QmlProfilerEventList *TraceWindow::getEventList() const
{
return m_eventList;
}
void TraceWindow::contextMenuEvent(QContextMenuEvent *ev)
{
emit contextMenuRequested(ev->globalPos());
}
void TraceWindow::updateCursorPosition()
{
emit gotoSourceLocation(m_view->rootObject()->property("fileName").toString(),
@@ -153,17 +168,17 @@ void TraceWindow::updateTimer()
void TraceWindow::clearDisplay()
{
m_eventList->clear();
if (m_plugin)
m_plugin.data()->clearData();
else
emit internalClearDisplay();
emit internalClearDisplay();
}
void TraceWindow::updateToolbar()
{
bool dataAvailable = m_view->rootObject()->property("dataAvailable").toBool() &&
m_view->rootObject()->property("eventCount").toInt() > 0;
emit enableToolbar(dataAvailable);
emit enableToolbar(m_eventList && m_eventList->count()>0);
}
void TraceWindow::setRecording(bool recording)