QmlProfiler: added 'clear view'

Reviewed-by: Kai Koehne
This commit is contained in:
Christiaan Janssen
2011-04-06 16:04:18 +02:00
parent 54eac56c00
commit e838a3dd7c
5 changed files with 40 additions and 9 deletions

View File

@@ -54,15 +54,19 @@ Rectangle {
root.updateCursorPosition();
}
function clearAll() {
Plotter.reset();
view.clearData();
rangeMover.x = 2
rangeMover.opacity = 0
}
//handle debug data coming from C++
Connections {
target: connection
onEvent: {
if (Plotter.valuesdone) {
Plotter.reset();
view.clearData();
rangeMover.x = 2
rangeMover.opacity = 0
root.clearAll();
}
if (!Plotter.valuesdone && event === 0) //### only handle paint event
@@ -71,10 +75,7 @@ Rectangle {
onRange: {
if (Plotter.valuesdone) {
Plotter.reset();
view.clearData();
rangeMover.x = 2
rangeMover.opacity = 0
root.clearAll();
}
if (!Plotter.valuesdone)
@@ -84,6 +85,7 @@ Rectangle {
onComplete: {
Plotter.valuesdone = true;
Plotter.calcFps();
view.visible = true;
view.setRanges(Plotter.ranges);
view.updateTimeline();
canvas.requestPaint();
@@ -91,6 +93,13 @@ Rectangle {
rangeMover.opacity = 1
}
onClear: {
root.clearAll();
Plotter.valuesdone = false;
canvas.requestPaint();
view.visible = false;
}
}
// Elapsed

View File

@@ -86,7 +86,7 @@ public:
virtual QWidget *toolBarWidget() { return m_tool->createToolBarWidget(); }
virtual QWidget *paneWidget() { return m_tool->createTimeLineWidget(); }
virtual void clearContents() { /*TODO*/ }
virtual void clearContents() { m_tool->clearDisplay(); }
virtual void setFocus() { /*TODO*/ }
virtual bool hasFocus() const { return false; /*TODO*/ }
virtual bool canFocus() const { return false; /*TODO*/ }
@@ -350,6 +350,11 @@ bool QmlProfilerTool::canRunRemotely() const
return true;
}
void QmlProfilerTool::clearDisplay()
{
d->m_traceWindow->clearDisplay();
}
void QmlProfilerTool::attach()
{
if (!d->m_isAttached) {

View File

@@ -63,6 +63,8 @@ public:
bool canRunRemotely() const;
void clearDisplay();
public slots:
void connectClient();
void disconnectClient();

View File

@@ -110,6 +110,7 @@ public:
public slots:
void setRecording(bool);
void clearView();
signals:
void complete();
@@ -122,6 +123,7 @@ signals:
void recordingChanged(bool arg);
void enabled();
void clear();
protected:
virtual void statusChanged(Status);
@@ -149,6 +151,12 @@ TracePlugin::TracePlugin(QDeclarativeDebugConnection *client)
::memset(m_rangeCount, 0, MaximumRangeType * sizeof(int));
}
void TracePlugin::clearView()
{
::memset(m_rangeCount, 0, MaximumRangeType * sizeof(int));
emit clear();
}
void TracePlugin::setRecording(bool v)
{
if (v == m_recording)
@@ -312,6 +320,12 @@ void TraceWindow::updateTimer()
emit timeChanged(m_view->rootObject()->property("elapsedTime").toDouble());
}
void TraceWindow::clearDisplay()
{
if (m_plugin)
m_plugin->clearView();
}
void TraceWindow::setRecordAtStart(bool record)
{
m_recordAtStart = record;

View File

@@ -71,6 +71,7 @@ public:
public slots:
void updateCursorPosition();
void updateTimer();
void clearDisplay();
signals:
void viewUpdated();