From: Drew Fisher Date: Fri, 8 Oct 2010 09:46:40 +0000 (-0700) Subject: Implement ClearBoard call from protocol. X-Git-Url: https://git.zarvox.org/shortlog/month?a=commitdiff_plain;h=4a0aef292dd76770f9d09924102df36fd7f0e3df;p=shareboard.git Implement ClearBoard call from protocol. --- diff --git a/action.cpp b/action.cpp index 436fc0b..a3dce91 100644 --- a/action.cpp +++ b/action.cpp @@ -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(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(&action); out << " " << a->text; } break; + case Action::ClearBoard: + break; // No special data for ClearBoard } out << "\n"; return out; diff --git a/action.h b/action.h index 7241bb4..96b2b33 100644 --- 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__ diff --git a/connectionmanager.cpp b/connectionmanager.cpp index 8911a24..8908c44 100644 --- a/connectionmanager.cpp +++ b/connectionmanager.cpp @@ -178,6 +178,15 @@ void ConnectionManager::haveData() { continue; } break; + case Action::ClearBoard: + { + act = new ClearBoardAction(); + ClearBoardAction* action = static_cast(act); + action->mesgID = mesgID; + action->userID = userID; + action->timestamp = timestamp; + } + break; default: qWarning() << "Received invalid type from server :("; continue; diff --git a/shareboard.cpp b/shareboard.cpp index 930ac30..9240ea3 100644 --- a/shareboard.cpp +++ b/shareboard.cpp @@ -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++; }