#include "sigview.h"
-SigView::SigView(QWidget *parent) :
- QGLWidget(parent)
+#include "sigsession.h"
+#include "signal.h"
+
+#include <boost/foreach.hpp>
+
+using namespace boost;
+using namespace std;
+
+const int SigView::SignalHeight = 50;
+
+SigView::SigView(SigSession &session, QWidget *parent) :
+ QGLWidget(parent),
+ _session(session)
{
+ connect(&_session, SIGNAL(dataUpdated()),
+ this, SLOT(dataUpdated()));
+
setMouseTracking(true);
}
void SigView::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT);
+
+ QRect rect(0, 0, width(), SignalHeight);
+ const vector< shared_ptr<Signal> > &sigs =
+ _session.get_signals();
+ BOOST_FOREACH(const shared_ptr<Signal> s, sigs)
+ {
+ assert(s);
+ s->paint(*this, rect);
+ rect.translate(0, SignalHeight);
+ }
}
+
+void SigView::dataUpdated()
+{
+ update();
+}
+