diff options
author | Björn Hagemeister | 2014-04-28 19:35:59 +0200 |
---|---|---|
committer | Björn Hagemeister | 2014-04-28 19:35:59 +0200 |
commit | a2fd531c81ba0e895dff319b0597e45b4206273f (patch) | |
tree | 533ea0063eab4d4060f06b732c66e3c21f05ada9 /src/server/connectionframe/connectionframe.cpp | |
parent | recognize a dragmove only if the distance is larger than 40 px (diff) | |
download | pvs2-a2fd531c81ba0e895dff319b0597e45b4206273f.tar.gz pvs2-a2fd531c81ba0e895dff319b0597e45b4206273f.tar.xz pvs2-a2fd531c81ba0e895dff319b0597e45b4206273f.zip |
Adding comments for each method in the .cpp files and class definition in the .h files.
Diffstat (limited to 'src/server/connectionframe/connectionframe.cpp')
-rw-r--r-- | src/server/connectionframe/connectionframe.cpp | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/server/connectionframe/connectionframe.cpp b/src/server/connectionframe/connectionframe.cpp index 7d9376c..b5b754f 100644 --- a/src/server/connectionframe/connectionframe.cpp +++ b/src/server/connectionframe/connectionframe.cpp @@ -24,6 +24,12 @@ static QIcon *term = NULL, *cam = NULL, *eye = NULL; static QString backgroundStyle("background-color: %1; margin: 1px; border: 1px solid black; border-radius: 6px"); +/** + * Initialize frame for connected client. + * @param parent + * @param width + * @param height + */ ConnectionFrame::ConnectionFrame(QWidget *parent, int width, int height) : QGroupBox(parent), _client(NULL), _timerId(0), _timerCounter(0), _selected(false), _isTutor(false) { @@ -79,6 +85,11 @@ ConnectionFrame::~ConnectionFrame() // } +/** + * Add icon to connection frame. + * @param icon + * @return Pointer to new Icon. + */ QLabel* ConnectionFrame::addIcon(const QIcon* icon) { QLabel *label = new QLabel(this); @@ -89,11 +100,21 @@ QLabel* ConnectionFrame::addIcon(const QIcon* icon) return label; } +/** + * Set size of connectionFrame. + * @param width + * @param height + */ void ConnectionFrame::setSize(int width, int height) { this->resize(width, height); } +/** + * Assign client to connectionFrame. + * Set hostName, userName and tutor status to display. + * @param client + */ void ConnectionFrame::assignClient(Client* client) { assert(_client == NULL); @@ -117,6 +138,9 @@ void ConnectionFrame::assignClient(Client* client) _client->setTutor(_isTutor); } +/** + * Show default thumg instead of remote screen in connectionFrame. + */ void ConnectionFrame::showDefaultThumb() { const int width = this->width() - 6; @@ -126,6 +150,11 @@ void ConnectionFrame::showDefaultThumb() //_imgScreen->setPixmap(_remoteScreen); } +/** + * Handle mouse release event on frame. + * Check if frame was clicked or moved, if not moved enough, the event is handled as click. + * @param event + */ void ConnectionFrame::mouseReleaseEvent(QMouseEvent* event) { event->accept(); @@ -147,18 +176,30 @@ void ConnectionFrame::mouseReleaseEvent(QMouseEvent* event) } } +/** + * Handle if mouse reaches frame. + * @param event + */ void ConnectionFrame::enterEvent(QEvent* event) { QApplication::setOverrideCursor(QCursor(Qt::OpenHandCursor)); event->accept(); } +/** + * Handle mouse leaves frame. + * @param event + */ void ConnectionFrame::leaveEvent(QEvent* event) { QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor)); event->accept(); } +/** + * Handle mouse press on frame. + * @param event + */ void ConnectionFrame::mousePressEvent(QMouseEvent *event) { if (event->button() == Qt::RightButton) @@ -178,6 +219,10 @@ void ConnectionFrame::mousePressEvent(QMouseEvent *event) event->accept(); } +/** + * Hanle mouse movement over frame. + * @param event + */ void ConnectionFrame::mouseMoveEvent(QMouseEvent *event) { QApplication::setOverrideCursor(QCursor(Qt::ClosedHandCursor)); @@ -185,12 +230,20 @@ void ConnectionFrame::mouseMoveEvent(QMouseEvent *event) event->accept(); } +/** + * Handle double click event on frame. + * @param event + */ void ConnectionFrame::mouseDoubleClickEvent(QMouseEvent* event) { emit doubleClicked(this); event->accept(); } +/** + * Draw remote screen in frame. + * @param event + */ void ConnectionFrame::paintEvent(QPaintEvent *event) { QGroupBox::paintEvent(event); @@ -201,6 +254,10 @@ void ConnectionFrame::paintEvent(QPaintEvent *event) event->accept(); } +/** + * Handle timer event. + * @param event + */ void ConnectionFrame::timerEvent(QTimerEvent* event) { if (_client == NULL) @@ -213,6 +270,10 @@ void ConnectionFrame::timerEvent(QTimerEvent* event) _client->requestThumb(width, height); } +/** + * Set frame as selected or not. + * @param selected + */ void ConnectionFrame::setSelection(bool selected) { if (_selected == selected) @@ -221,6 +282,10 @@ void ConnectionFrame::setSelection(bool selected) this->updateAppearance(); } +/** + * Set tutor status of frame. + * @param b + */ void ConnectionFrame::setTutor(bool b) { if (_isTutor != b && _client != NULL) @@ -229,6 +294,10 @@ void ConnectionFrame::setTutor(bool b) this->updateAppearance(); } +/** + * Update appearence of frame. + * Check tutor status, vnc status and set background or icon. + */ void ConnectionFrame::updateAppearance() { if (_client == NULL) @@ -261,6 +330,10 @@ void ConnectionFrame::updateAppearance() * Slots */ +/** + * Handle if client was disconnected. + * Kill timer and set appearence to default. + */ void ConnectionFrame::onClientDisconnected() { if (_timerId != 0) @@ -274,6 +347,11 @@ void ConnectionFrame::onClientDisconnected() this->updateAppearance(); } +/** + * Update thumb of specific client. + * @param client + * @param thumb + */ void ConnectionFrame::onThumbUpdated(Client* client, const QPixmap& thumb) { assert(client == _client); @@ -282,11 +360,20 @@ void ConnectionFrame::onThumbUpdated(Client* client, const QPixmap& thumb) this->repaint(); } +/** + * Update appearence if vnc server state has changed. + * @param client + */ void ConnectionFrame::onVncServerStateChange(Client* client) { this->updateAppearance(); } +/** + * Update appearence if vnc client state has changed. + * @param client + * @param lastSource + */ void ConnectionFrame::onVncClientStateChange(Client* client, int lastSource) { this->updateAppearance(); |