forked from dparker2/StudyGroup
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwhiteboard.cpp
More file actions
63 lines (52 loc) · 1.93 KB
/
whiteboard.cpp
File metadata and controls
63 lines (52 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "whiteboard.h"
#include "whiteboard_p.h"
#include <QDebug>
#include <QCursor>
Whiteboard::Whiteboard(QWidget *parent, QWidget* save_button) : QScrollArea(parent)
{
this->setStyleSheet("background-color: #ffffff");
this->setFrameShadow(QFrame::Plain);
this->setCursor(QCursor(Qt::CrossCursor));
drawing_board = new my_whiteboard;
drawing_board->resize(2000, 1000);
this->save_button = save_button;
saved = true;
// Connections to send the drawing messages up the chain to the server object
connect(dynamic_cast<my_whiteboard*>(drawing_board), SIGNAL(line_drawn(QPoint,QPoint,QColor,int)), this, SIGNAL(line_drawn(QPoint,QPoint,QColor,int)));
this->setWidget(drawing_board);
}
QByteArray* Whiteboard::whiteboard_ba()
{
return dynamic_cast<my_whiteboard*>(drawing_board)->get_whiteboard();
}
void Whiteboard::draw_line(const QPoint &point1, const QPoint &point2, const QColor& pen_color, const int& pen_size)
{
save_button->setEnabled(true);
dynamic_cast<my_whiteboard*>(drawing_board)->draw_line(point1, point2, pen_color, pen_size);
}
void Whiteboard::get_whiteboard(QString ip)
{
qDebug() << "whiteboard.cpp emitting send_whiteboard";
emit send_whiteboard(ip, dynamic_cast<my_whiteboard*>(drawing_board)->get_whiteboard());
}
void Whiteboard::update_whiteboard(QByteArray *wb_data)
{
qDebug() << "hello from whiteboard.cpp update_whiteboard";
dynamic_cast<my_whiteboard*>(drawing_board)->update_whiteboard(wb_data);
}
QColor Whiteboard::get_pen_color()
{
return dynamic_cast<my_whiteboard*>(drawing_board)->get_pen_color();
}
int Whiteboard::get_pen_size()
{
return dynamic_cast<my_whiteboard*>(drawing_board)->get_pen_size();
}
void Whiteboard::set_pen_color(QColor color_arg)
{
dynamic_cast<my_whiteboard*>(drawing_board)->set_pen_color(color_arg);
}
void Whiteboard::set_pen_size(int size_arg)
{
dynamic_cast<my_whiteboard*>(drawing_board)->set_pen_size(size_arg);
}