From 5542a2b5a1c36411fdaa4137a439234c4a4c003e Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 18 Apr 2014 20:07:14 +0200 Subject: Fix comments, add (very few) documentation comments --- src/client/connectwindow/connectwindow.cpp | 8 ++++++-- src/client/net/serverconnection.cpp | 31 +++++++++++++++++++++++++++--- src/client/toolbar/toolbar.cpp | 4 ++-- src/client/vnc/vncserver.cpp | 8 ++++++-- src/client/vnc/vncthread.h | 2 -- 5 files changed, 42 insertions(+), 11 deletions(-) (limited to 'src/client') diff --git a/src/client/connectwindow/connectwindow.cpp b/src/client/connectwindow/connectwindow.cpp index abc33e8..ca01404 100644 --- a/src/client/connectwindow/connectwindow.cpp +++ b/src/client/connectwindow/connectwindow.cpp @@ -116,10 +116,14 @@ void ConnectWindow::updateState() } } -/** +/* * Overrides */ +/** + * Called when a Qt timer fires; used for server discovery and + * auto-hiding the connect dialog. + */ void ConnectWindow::timerEvent(QTimerEvent* event) { if (event->timerId() == _timerDiscover) @@ -188,7 +192,7 @@ void ConnectWindow::showEvent(QShowEvent* event) txtName->setFocus(); } -/** +/* * Slots */ diff --git a/src/client/net/serverconnection.cpp b/src/client/net/serverconnection.cpp index 6f7f22a..530701d 100644 --- a/src/client/net/serverconnection.cpp +++ b/src/client/net/serverconnection.cpp @@ -53,6 +53,9 @@ ServerConnection::~ServerConnection() _blank = NULL; } +/** + * Send the given message to the server. + */ void ServerConnection::sendMessage(NetworkMessage& message) { if (_socket == NULL || _socket->state() != QAbstractSocket::ConnectedState) @@ -64,7 +67,11 @@ void ServerConnection::sendMessage(NetworkMessage& message) } } - +/** + * Disconnect from current server. + * Do some cleanup also, like stopping any VNC server/client + * activity, then finally close the connection. + */ void ServerConnection::disconnectFromServer() { if (_timerDelete == 0) @@ -82,6 +89,11 @@ void ServerConnection::disconnectFromServer() } } +/** + * Handles an incoming message by the server. + * This is somewhat of a long mess, maybe split this up some day or + * make it OOP with a huge amount fancy features. + */ void ServerConnection::handleMsg() { _lastData = QDateTime::currentMSecsSinceEpoch() + PING_TIMEOUT_MS; @@ -245,7 +257,7 @@ void ServerConnection::handleMsg() } } -/** +/* * Override */ @@ -283,10 +295,15 @@ void ServerConnection::timerEvent(QTimerEvent *event) killTimer(event->timerId()); } -/** +/* * Slots */ +/** + * This slot is triggered by the vnc server runner once the external VNC + * server was succesfully started, or was terminated (either planned or + * crashed). + */ void ServerConnection::onVncServerStartStop(int port, QString& ropass, QString& rwpass) { _toServer.reset(); @@ -304,6 +321,10 @@ void ServerConnection::onVncServerStartStop(int port, QString& ropass, QString& sendMessage(_toServer); } +/** + * This slot is triggered once the internal VNC viewer has started or stopped + * displaying a VNC stream. We'll inform the server about the state change. + */ void ServerConnection::onVncViewerStartStop(const bool started, const int clientId) { _toServer.reset(); @@ -316,6 +337,10 @@ void ServerConnection::onVncViewerStartStop(const bool started, const int client sendMessage(_toServer); } +/** + * An ssl error happened. If it's an expected one, we ignore it + * and keep going. Otherwise the connection will be terminated. + */ void ServerConnection::sslErrors(const QList & errors) { for (QList::const_iterator it = errors.begin(); it != errors.end(); it++) diff --git a/src/client/toolbar/toolbar.cpp b/src/client/toolbar/toolbar.cpp index 6fe7432..f016680 100644 --- a/src/client/toolbar/toolbar.cpp +++ b/src/client/toolbar/toolbar.cpp @@ -116,7 +116,7 @@ bool Toolbar::hideBar() return true; } -/** +/* * Override */ @@ -154,7 +154,7 @@ void Toolbar::timerEvent(QTimerEvent* event) } } -/** +/* * Slots */ diff --git a/src/client/vnc/vncserver.cpp b/src/client/vnc/vncserver.cpp index 2b49b8e..82954cb 100644 --- a/src/client/vnc/vncserver.cpp +++ b/src/client/vnc/vncserver.cpp @@ -126,10 +126,14 @@ void VncServer::stop() process->deleteLater(); } -/** +/* * Overrides */ +/** + * Timer event, currently only used to assume VNC server setup failed + * after 3 seconds... + */ void VncServer::timerEvent(QTimerEvent *event) { // Error timeout (3s), tell server that vnc setup failed @@ -137,7 +141,7 @@ void VncServer::timerEvent(QTimerEvent *event) emit started(0, _ropass, _rwpass); } -/** +/* * Slots */ diff --git a/src/client/vnc/vncthread.h b/src/client/vnc/vncthread.h index b6679b3..23530ec 100644 --- a/src/client/vnc/vncthread.h +++ b/src/client/vnc/vncthread.h @@ -26,7 +26,6 @@ extern "C" } /** - * - START - * Event classes. Not my code. Might be useful to implement remote assistance via VNC later. * Code might come from the KDE VNC client. */ @@ -67,7 +66,6 @@ private: int _y; int _buttonMask; }; -/** - END - **/ /** * VncThread - communicate with VNC server, scale image if necessary. -- cgit v1.2.3-55-g7522