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

View File

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

View File

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

View File

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

View File

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