diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-09-21 07:10:38 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-09-21 07:10:38 (GMT) |
commit | c774d78c350294118c8cd7e075063290dc690a9a (patch) | |
tree | cfd2cbc653abbb056580159f130fcc9ebf072b92 /tools | |
parent | a14765de5b1bb26b4cbc6ebbdee71145e54650a8 (diff) | |
parent | 7423f732ce01ca18788543bd4cfc921b55e2f17c (diff) | |
download | Qt-c774d78c350294118c8cd7e075063290dc690a9a.zip Qt-c774d78c350294118c8cd7e075063290dc690a9a.tar.gz Qt-c774d78c350294118c8cd7e075063290dc690a9a.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qmldebugger/canvasframerate.cpp | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/tools/qmldebugger/canvasframerate.cpp b/tools/qmldebugger/canvasframerate.cpp index d0be579..ae514a5 100644 --- a/tools/qmldebugger/canvasframerate.cpp +++ b/tools/qmldebugger/canvasframerate.cpp @@ -25,7 +25,7 @@ public: void setPosition(int); public slots: - void addSample(int, int, int, int, bool); + void addSample(int, int, int, bool); protected: virtual void paintEvent(QPaintEvent *); @@ -39,7 +39,7 @@ private: void drawSample(QPainter *, int, const QRect &); void drawTime(QPainter *, const QRect &); struct Sample { - int sample[4]; + int sample[3]; bool isBreak; }; QList<Sample> _samples; @@ -95,14 +95,13 @@ void QLineGraph::updateScrollbar() ignoreScroll = false; } -void QLineGraph::addSample(int a, int b, int c, int d, bool isBreak) +void QLineGraph::addSample(int a, int b, int d, bool isBreak) { Sample s; s.isBreak = isBreak; s.sample[0] = a; s.sample[1] = b; - s.sample[2] = c; - s.sample[3] = d; + s.sample[2] = d; _samples << s; updateScrollbar(); update(); @@ -128,7 +127,7 @@ void QLineGraph::drawTime(QPainter *p, const QRect &rect) int t = 0; for(int ii = first; ii <= last; ++ii) { - int sampleTime = _samples.at(ii).sample[3] / 1000; + int sampleTime = _samples.at(ii).sample[2] / 1000; if(sampleTime != t) { int xEnd = rect.left() + scaleX * (ii - first); @@ -136,7 +135,7 @@ void QLineGraph::drawTime(QPainter *p, const QRect &rect) QRect text(xEnd - 30, rect.bottom() + 10, 60, 30); - p->drawText(text, Qt::AlignHCenter | Qt::AlignTop, QString::number(_samples.at(ii).sample[3])); + p->drawText(text, Qt::AlignHCenter | Qt::AlignTop, QString::number(_samples.at(ii).sample[2])); t = sampleTime; } @@ -188,9 +187,6 @@ void QLineGraph::paintEvent(QPaintEvent *) p.setBrush(QColor("pink")); drawSample(&p, 1, r); - p.setBrush(QColor("green")); - drawSample(&p, 2, r); - p.setBrush(Qt::NoBrush); p.drawRect(r); @@ -216,19 +212,18 @@ public: CanvasFrameRatePlugin(QmlDebugConnection *client); signals: - void sample(int, int, int, int, bool); + void sample(int, int, int, bool); protected: virtual void messageReceived(const QByteArray &); private: - int la; int lb; int ld; }; CanvasFrameRatePlugin::CanvasFrameRatePlugin(QmlDebugConnection *client) -: QmlDebugClient(QLatin1String("CanvasFrameRate"), client), la(-1) +: QmlDebugClient(QLatin1String("CanvasFrameRate"), client), lb(-1) { } @@ -237,13 +232,12 @@ void CanvasFrameRatePlugin::messageReceived(const QByteArray &data) QByteArray rwData = data; QDataStream stream(&rwData, QIODevice::ReadOnly); - int a; int b; int c; int d; bool isBreak; - stream >> a >> b >> c >> d >> isBreak; + int b; int c; int d; bool isBreak; + stream >> b >> c >> d >> isBreak; - if (la != -1) - emit sample(c, lb, la, ld, isBreak); + if (lb != -1) + emit sample(c, lb, ld, isBreak); - la = a; lb = b; ld = d; } @@ -281,15 +275,15 @@ void CanvasFrameRate::newTab() { if (m_tabs->count()) { QWidget *w = m_tabs->widget(m_tabs->count() - 1); - QObject::disconnect(m_plugin, SIGNAL(sample(int,int,int,int,bool)), - w, SLOT(addSample(int,int,int,int,bool))); + QObject::disconnect(m_plugin, SIGNAL(sample(int,int,int,bool)), + w, SLOT(addSample(int,int,int,bool))); } int id = m_tabs->count(); QLineGraph *graph = new QLineGraph(this); - QObject::connect(m_plugin, SIGNAL(sample(int,int,int,int,bool)), - graph, SLOT(addSample(int,int,int,int,bool))); + QObject::connect(m_plugin, SIGNAL(sample(int,int,int,bool)), + graph, SLOT(addSample(int,int,int,bool))); QString name = QLatin1String("Graph ") + QString::number(id); m_tabs->addTab(graph, name); |