]> git.zarvox.org Git - shareboard.git/commitdiff
Implement ClearBoard call from protocol.
authorDrew Fisher <drew.m.fisher@gmail.com>
Fri, 8 Oct 2010 09:46:40 +0000 (02:46 -0700)
committerDrew Fisher <drew.m.fisher@gmail.com>
Fri, 8 Oct 2010 09:46:40 +0000 (02:46 -0700)
action.cpp
action.h
connectionmanager.cpp
shareboard.cpp

index 436fc0b86172df8d82b6b01c42c807a2de15b451..a3dce91bbc819baf4019e3d9474a929327904ba9 100644 (file)
@@ -57,6 +57,11 @@ UserChatAction::UserChatAction() {
 UserChatAction::~UserChatAction() {
 }
 
+ClearBoardAction::ClearBoardAction() {
+}
+ClearBoardAction::~ClearBoardAction() {
+}
+
 QTextStream& operator<<(QTextStream& out, const Action& action) {
        out << "0 " << action.userID << " " << action.timestamp.toString("yyyy-MM-ddThh:mm:ss.zzz") << " " << static_cast<quint16>(action.type) ; // mesgID, userID, timestamp, mesgType
        switch(action.type) {
@@ -100,6 +105,8 @@ QTextStream& operator<<(QTextStream& out, const Action& action) {
                                const UserChatAction* a = static_cast<const UserChatAction*>(&action);
                                out << " " << a->text;
                        } break;
+               case Action::ClearBoard:
+                       break; // No special data for ClearBoard
        }
        out << "\n";
        return out;
index 7241bb423da9b78c1b467610c5dba70813fbf5b3..96b2b335694664af98ecf1a2dd5ee13a260d169f 100644 (file)
--- a/action.h
+++ b/action.h
@@ -19,7 +19,8 @@ public:
                DrawLine=4,
                AddImage=5,
                UserChat=6,
-               UserSynced=7
+               UserSynced=7,
+               ClearBoard=8
        };
 
        Action();
@@ -78,6 +79,12 @@ public:
        QString text;
 };
 
+class ClearBoardAction : public Action {
+public:
+       ClearBoardAction();
+       ~ClearBoardAction();
+};
+
 QTextStream& operator<<(QTextStream& out, const Action& action);
 
 #endif //__ACTION_H__
index 8911a24d49d1eba02a0801dca3219be1c7ca4eb4..8908c44f6402173ac8244a31374be6b3e3ba1549 100644 (file)
@@ -178,6 +178,15 @@ void ConnectionManager::haveData() {
                                continue;
                                }
                                break;
+                       case Action::ClearBoard:
+                               {
+                               act = new ClearBoardAction();
+                               ClearBoardAction* action = static_cast<ClearBoardAction*>(act);
+                               action->mesgID = mesgID;
+                               action->userID = userID;
+                               action->timestamp = timestamp;
+                               }
+                               break;
                        default:
                                qWarning() << "Received invalid type from server :(";
                                continue;
index 930ac3055fc65d9f3f7331d074966f02a13ccabd..9240ea3ca6d58d8de2151ff52868d60fc2736c4d 100644 (file)
@@ -143,6 +143,11 @@ void Shareboard::jumpToIndex(int index) {
                        case Action::UserChat:
                        case Action::UserSynced:
                                break;
+                       case Action::ClearBoard:
+                               {
+                                       viewImage.fill(QColor(Qt::white).rgb());
+                               }
+                               break;
                }
                i++;
        }