]> git.zarvox.org Git - shareboard.git/blob - action.h
Implement image insertion and placement, tool selection, and eraser.
[shareboard.git] / action.h
1 #ifndef __ACTION_H__
2 #define __ACTION_H__
3
4 #include <QDateTime>
5 #include <QPointF>
6 #include <QTextStream>
7 #include <QColor>
8 #include <QVector>
9 #include <QString>
10 #include <QImage>
11
12 class Action {
13 public:
14         enum Type {
15                 INVALID=0,
16                 UserJoin=1,
17                 UserPart=2,
18                 MouseMove=3,
19                 DrawLine=4,
20                 AddImage=5,
21                 UserChat=6,
22                 UserSynced=7,
23                 ClearBoard=8
24         };
25
26         Action();
27         Action(Type t);
28         virtual ~Action();
29
30         Type type;
31         qint32 mesgID; // Unique id for this 
32         qint32 userID; // Which user does this refer to?
33         QDateTime timestamp; // Time at which the server made this event official
34
35 };
36
37 class UserJoinAction : public Action {
38 public:
39         UserJoinAction();
40         ~UserJoinAction();
41         QString username; // What's their username?
42 };
43
44 class UserPartAction : public Action {
45 public:
46         UserPartAction();
47         ~UserPartAction();
48 };
49
50 class MouseMoveAction : public Action {
51 public:
52         MouseMoveAction();
53         ~MouseMoveAction();
54         QPointF pos;
55 };
56
57 class DrawLineAction : public Action {
58 public:
59         DrawLineAction();
60         ~DrawLineAction();
61         QColor color;
62         int width;
63         QVector<QPointF> points;
64         
65 };
66
67 class AddImageAction : public Action {
68 public:
69         AddImageAction();
70         ~AddImageAction();
71         QPointF topLeft;
72         QImage image;
73 };
74
75 class UserChatAction : public Action {
76 public:
77         UserChatAction();
78         ~UserChatAction();
79         QString text;
80 };
81
82 class ClearBoardAction : public Action {
83 public:
84         ClearBoardAction();
85         ~ClearBoardAction();
86 };
87
88 QTextStream& operator<<(QTextStream& out, const Action& action);
89
90 #endif //__ACTION_H__