18 #include "../mainwindow/mainwindow.h"
19 #include "../../shared/util.h"
20 #include "../net/client.h"
23 #include <QResizeEvent>
26 #include <QApplication>
30 "QLabel{ background-color: #FFF; border-radius: 2px; color: black;}"
31 " QGroupBox { background-color: #AAA; margin: 2px; border-radius: 4px}"
34 "QLabel{ background-color: #FFF; border-radius: 2px; color: black;}"
35 " QGroupBox { background-color: #70C670; margin: 2px; border-radius: 4px}"
38 "QLabel{ background-color: #FFF; border-radius: 2px; color: black;}"
39 " QGroupBox { background-color: #C88; margin: 2px; border-radius: 4px}"
42 "QLabel{ background-color: #FFF; border-radius: 2px; color: black; }"
43 " QGroupBox { background-color: #ccebff; margin: 0px; border-radius: 4px; border: 4px solid #6C8CF0;}"
46 "QLabel{ background-color: #FFF; border-radius: 2px; color: black;}"
47 " QGroupBox { background-color: #9f9; margin: 0px; border-radius: 4px; border: 4px solid #6C8CF0;}"
50 "QLabel{ background-color: #FFF; border-radius: 2px; color: black;}"
51 " QGroupBox { background-color: #E99; margin: 0px; border-radius: 4px; border: 4px solid #6C8CF0;}"
54 "QLabel{ background-color: #919191; color: black; }"
55 " QGroupBox { background-color: #d35400; margin: 1px; border-radius: 4px}"
58 "QLabel{ background-color: #919191; color: black; }"
59 " QGroupBox { background-color: #cc743a; margin: 1px; border-radius: 4px}"
62 "QLabel{ background-color: #919191; border-radius: 2px; color: black; }"
63 " QGroupBox { background-color: #7F7F7F; margin: 1px; border-radius: 4px}"
66 static QIcon *
term =
nullptr, *
cam =
nullptr, *
eye =
nullptr, *
lock =
nullptr;
80 , _isFromRoomplan(fromRoomplan)
86 if (
term ==
nullptr) {
87 term =
new QIcon(
":terminal");
88 cam =
new QIcon(
":cf_cam");
89 eye =
new QIcon(
":cf_eye");
90 lock =
new QIcon(
":cf_lock");
93 _mainLayout =
new QBoxLayout(QBoxLayout::TopToBottom,
this);
99 _iconLayout =
new QBoxLayout(QBoxLayout::RightToLeft,
nullptr);
167 auto *label =
new QLabel(
this);
168 label->setPixmap(icon->pixmap(24, 24, QIcon::Normal, QIcon::On));
169 label->setAttribute(Qt::WA_TranslucentBackground);
209 const int width = frameSize.width() - 10;
234 QApplication::setOverrideCursor(QCursor(Qt::OpenHandCursor));
244 QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
255 if (event->button() == Qt::RightButton) {
257 }
else if (event->button() == Qt::LeftButton) {
260 QApplication::setOverrideCursor(QCursor(Qt::ClosedHandCursor));
274 QApplication::setOverrideCursor(QCursor(Qt::ClosedHandCursor));
289 QApplication::setOverrideCursor(QCursor(Qt::OpenHandCursor));
290 if (event->button() == Qt::LeftButton) {
320 QGroupBox::paintEvent(event);
333 QPainter painter(
this);
391 for (
auto *_icon :
_icons) {
459 QGroupBox::resizeEvent(event);
QRect calcFrameGeometry(ConnectionFrame *frame) const
void setTutor(bool enable)
void onClientDisconnected()
Handle if client was disconnected.
void leaveEvent(QEvent *event) override
Handle mouse leaves frame.
const QString & host() const
~ConnectionFrame() override
void setTutor(bool b)
Set tutor status of frame.
void timerEvent(QTimerEvent *event) override
Handle timer event.
void onThumbUpdated(Client *client, const QImage &thumb)
Update thumb of specific client.
void paintEvent(QPaintEvent *event) override
Draw remote screen in frame.
void setGridPosition(int x, int y)
void doubleClicked(ConnectionFrame *frame)
void mousePressEvent(QMouseEvent *event) override
Handle mouse press on frame.
static const QString style_selectedAttention("QLabel{ background-color: #FFF; border-radius: 2px; color: black;}"" QGroupBox { background-color: #E99; margin: 0px; border-radius: 4px; border: 4px solid #6C8CF0;}")
void resizeEvent(QResizeEvent *event) override
static const QString style_disconnected("QLabel{ background-color: #919191; border-radius: 2px; color: black; }"" QGroupBox { background-color: #7F7F7F; margin: 1px; border-radius: 4px}")
static const QString style_selectedTutor("QLabel{ background-color: #FFF; border-radius: 2px; color: black;}"" QGroupBox { background-color: #9f9; margin: 0px; border-radius: 4px; border: 4px solid #6C8CF0;}")
void showDefaultThumb()
Show default thumg instead of remote screen in connectionFrame.
QLabel * addIcon(const QIcon *icon)
Add icon to connection frame.
static bool paintDisabled
static const QString style_student("QLabel{ background-color: #FFF; border-radius: 2px; color: black;}"" QGroupBox { background-color: #AAA; margin: 2px; border-radius: 4px}")
bool wantsAttention() const
void updateAppearance()
Update appearence of frame.
static const QString style_exam("QLabel{ background-color: #919191; color: black; }"" QGroupBox { background-color: #d35400; margin: 1px; border-radius: 4px}")
static const QString style_selectedStudent("QLabel{ background-color: #FFF; border-radius: 2px; color: black; }"" QGroupBox { background-color: #ccebff; margin: 0px; border-radius: 4px; border: 4px solid #6C8CF0;}")
void mouseMoveEvent(QMouseEvent *event) override
Hanle mouse movement over frame.
static const QString style_attention("QLabel{ background-color: #FFF; border-radius: 2px; color: black;}"" QGroupBox { background-color: #C88; margin: 2px; border-radius: 4px}")
bool isActiveVncClient() const
const QString & name() const
void thumbUpdated(Client *client, const QImage &thumb)
void requestThumb(const QSize &size)
void setSelection(bool selected)
Set frame as selected or not.
bool isActiveVncServer() const
void enterEvent(QEvent *event) override
Handle if mouse reaches frame.
void frameMoved(ConnectionFrame *frame)
static const QString style_tutor("QLabel{ background-color: #FFF; border-radius: 2px; color: black;}"" QGroupBox { background-color: #70C670; margin: 2px; border-radius: 4px}")
void vncClientStateChange(Client *client)
void calcDesiredThumbSize(const QSize &frameSize)
void clicked(ConnectionFrame *frame)
void vncServerStateChange(Client *client)
ConnectionFrame(MainWindow *main, QWidget *parent, bool fromRoomplan=false)
Initialize frame for connected client.
void assignClient(Client *client)
Assign client to connectionFrame.
static const int START_DRAG_DISTANCE
static const QString style_exam_selected("QLabel{ background-color: #919191; color: black; }"" QGroupBox { background-color: #cc743a; margin: 1px; border-radius: 4px}")
void mouseDoubleClickEvent(QMouseEvent *event) override
Handle double click event on frame.
void frameMoving(ConnectionFrame *frame)
void mouseReleaseEvent(QMouseEvent *e) override
Handle mouse release event on frame.
int main(int argc, char **argv)