]> git.zarvox.org Git - shareboard.git/blob - shareboard.h
Implement image insertion and placement, tool selection, and eraser.
[shareboard.git] / shareboard.h
1 #ifndef __SHAREBOARD_H__
2 #define __SHAREBOARD_H__
3
4 #include <QWidget>
5 #include <QPointF>
6 #include <QDateTime>
7 #include <QMap>
8
9 class QStackedLayout;
10 class ConnectWidget;
11 class ShareboardCanvas;
12
13 class Action;
14 typedef QList<Action*> History;
15
16 class Shareboard : public QWidget {
17         Q_OBJECT
18         public:
19                 Shareboard(QWidget* parent = 0);
20                 ~Shareboard();
21                 QImage view();
22                 int getDrawState();
23
24         public slots:
25                 void handleMouseMoved(QPointF pos);
26                 void handleSegmentDrawn(QPointF start, QPointF end);
27                 void handleInsertImage(QPointF pos);
28                 void postAction(Action* action);
29                 void postLocalAction(Action* action);
30                 void switchToBoard();
31                 void switchToPrompt();
32                 void setUserID(int id);
33                 void jumpToIndex(int index);
34                 //void jumpToTime(QDateTime time);
35                 void setDrawState(int newstate);
36                 void setInsertImage(QImage newimage);
37
38         signals:
39                 void rangeChanged(int max);
40                 void indexChanged(int index);
41                 void connectToServer(QString, QString);
42                 void actionHappened(Action* action);
43
44         private:
45                 QStackedLayout* layout;
46                 ConnectWidget* prompt;
47                 ShareboardCanvas* canvas;
48                 History history;
49                 History localHistory;
50                 int userID;
51                 int drawState; // if > 0, line width.  If < 0, eraser size.  If == 0, image tool.
52                 QImage insertImage;
53                 // These items represent the present state of the view.
54                 QDateTime viewTime;
55                 QImage viewImage;
56                 int viewIndex; // The index of the first action we haven't applied.
57                 QMap<int, QPointF> viewCursors;
58                 QMap<int, QString> viewUsers;
59
60 //              QPixmap renderAtTime(QDateTime time);
61 //              QPixmap renderOneChange();
62         friend class ShareboardCanvas;
63 };
64
65 #endif // __SHAREBOARD_H__