From: Drew Fisher Date: Fri, 8 Oct 2010 08:46:35 +0000 (-0700) Subject: Reduce debugging output. X-Git-Url: http://git.zarvox.org/shortlog/static/widgets.js?a=commitdiff_plain;h=8d2c26125a0ac9072923da8b8e005a428a48462d;p=shareboard.git Reduce debugging output. --- diff --git a/connectionmanager.cpp b/connectionmanager.cpp index d1b86f5..8911a24 100644 --- a/connectionmanager.cpp +++ b/connectionmanager.cpp @@ -186,7 +186,7 @@ void ConnectionManager::haveData() { board->postAction(act); - qDebug() << "Dispatched action with type " << act->type << " that was " << data.size() << " bytes long"; + //qDebug() << "Dispatched action with type " << act->type << " that was " << data.size() << " bytes long"; } } diff --git a/shareboard.cpp b/shareboard.cpp index 62831b9..41f39f4 100644 --- a/shareboard.cpp +++ b/shareboard.cpp @@ -69,13 +69,7 @@ void Shareboard::postAction(Action* action) { localHistory.removeFirst(); } history.append(action); - jumpToIndex(history.size()); -/* if(viewIndex+1 == history.size()) { - jumpToIndex(viewIndex+1); - } else { */ - qDebug() << "viewIndex = "<< viewIndex; - qDebug() << "history.size = "<< history.size(); - //} + jumpToIndex(history.size()); // Jump to the most recent state } void Shareboard::postLocalAction(Action* action) { @@ -101,11 +95,11 @@ void Shareboard::jumpToIndex(int index) { viewImage = QImage(1024,768,QImage::Format_ARGB32_Premultiplied); viewImage.fill(Qt::white); viewCursors.clear(); + viewUsers.clear(); } else { i = viewIndex; } QPainter p; - qDebug() << "\t\tjumpToIndex():" << viewImage.valid(0,0) << viewImage.rect(); p.begin(&viewImage); while(i < history.size() && i < index) { viewTime = history[i]->timestamp; @@ -114,11 +108,19 @@ void Shareboard::jumpToIndex(int index) { // Apply action to pixmap switch(action->type) { case Action::INVALID: + break; case Action::UserJoin: + { + UserJoinAction* a = static_cast(action); + viewUsers[a->userID] = a->username; + qDebug() << "Saw user" << a->username << "join"; + } break; case Action::UserPart: { + qDebug() << "Saw user" << viewUsers[action->userID] << "part"; viewCursors.remove(action->userID); + viewUsers.remove(action->userID); } break; case Action::MouseMove: @@ -133,9 +135,7 @@ void Shareboard::jumpToIndex(int index) { QPen pen(a->color); pen.setWidth(a->width); p.setPen(pen); - qDebug() << "Painting line\tcolor: " << a->color << "\twidth:" << a->width; p.drawPolyline(a->points.data(), a->points.size()-1); - qDebug() << a->points; } break; case Action::AddImage: diff --git a/shareboard.h b/shareboard.h index 58f79be..67db295 100644 --- a/shareboard.h +++ b/shareboard.h @@ -47,6 +47,7 @@ class Shareboard : public QWidget { QImage viewImage; int viewIndex; // The index of the first action we haven't applied. QMap viewCursors; + QMap viewUsers; // QPixmap renderAtTime(QDateTime time); // QPixmap renderOneChange(); diff --git a/shareboardcanvas.cpp b/shareboardcanvas.cpp index 51e3e1a..faebffa 100644 --- a/shareboardcanvas.cpp +++ b/shareboardcanvas.cpp @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include #include "shareboard.h" @@ -53,10 +55,17 @@ void ShareboardCanvas::paintEvent(QPaintEvent* event) { QPainter p(this); // Paint the background from the saved state p.drawImage(0, 0, board->view()); - //qDebug() << "ShareboardCanvas:" << board->view().rect(); - //qDebug() << "ShareboardCanvas:" << board->viewIndex; // Now paint our local changes on top of it //p.set // Now paint the set of mouse cursors on top of that + QMap::const_iterator i; + for (i = board->viewCursors.constBegin(); i!=board->viewCursors.constEnd(); ++i) { + p.setPen(QPen(QColor(255,0,0,50))); + p.setBrush(QBrush(QColor(255,0,0,50))); + p.drawEllipse(i.value(),4,4); + p.setPen(Qt::black); + p.setBrush(Qt::black); + p.drawText(i.value(),board->viewUsers[i.key()]); + } }