]> git.zarvox.org Git - shareboard.git/commitdiff
Reduce debugging output.
authorDrew Fisher <drew.m.fisher@gmail.com>
Fri, 8 Oct 2010 08:46:35 +0000 (01:46 -0700)
committerDrew Fisher <drew.m.fisher@gmail.com>
Fri, 8 Oct 2010 08:46:35 +0000 (01:46 -0700)
connectionmanager.cpp
shareboard.cpp
shareboard.h
shareboardcanvas.cpp

index d1b86f5b3997e6044b175b52bb65a73a5b9b9112..8911a24d49d1eba02a0801dca3219be1c7ca4eb4 100644 (file)
@@ -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";
        }
 }
 
index 62831b956e06c030352584e475a3374a163ccb3d..41f39f48ea827f848e78296d6f280fd32b9d7935 100644 (file)
@@ -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<UserJoinAction*>(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:
index 58f79bed38bfa71aab7e7cbf681df024414b8afe..67db295e94c4bb29c9a1bc69b33e2c5cd38e5cc2 100644 (file)
@@ -47,6 +47,7 @@ class Shareboard : public QWidget {
                QImage viewImage;
                int viewIndex; // The index of the first action we haven't applied.
                QMap<int, QPointF> viewCursors;
+               QMap<int, QString> viewUsers;
 
 //             QPixmap renderAtTime(QDateTime time);
 //             QPixmap renderOneChange();
index 51e3e1a55da3928c00721be3df87ab4ee69e03f9..faebffad499a803435a0d85716206f12b99e9589 100644 (file)
@@ -3,6 +3,8 @@
 #include <QPaintEvent>
 #include <QPainter>
 #include <QPixmap>
+#include <QPen>
+#include <QColor>
 #include <QDebug>
 #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<int, QPointF>::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()]);
+       }
 }