From c22a2b47bbd955caf25109b276c823b94f2a7c81 Mon Sep 17 00:00:00 2001 From: Manuel Schneider Date: Mon, 21 Jul 2014 23:51:00 +0200 Subject: Correct indenting by tabs --- src/server/clicklabel/clicklabel.h | 6 +- src/server/connectionframe/connectionframe.cpp | 6 +- src/server/mainwindow/mainwindow.cpp | 346 +++++++++++------------ src/server/mainwindow/mainwindow.h | 2 +- src/server/net/client.cpp | 12 +- src/server/net/client.h | 8 +- src/server/net/filedownloader.cpp | 2 +- src/server/net/filedownloader.h | 18 +- src/server/net/sslserver.h | 26 +- src/server/sessionnamewindow/sessionnamewindow.h | 12 +- 10 files changed, 219 insertions(+), 219 deletions(-) (limited to 'src/server') diff --git a/src/server/clicklabel/clicklabel.h b/src/server/clicklabel/clicklabel.h index 297f1dd..4d730a9 100644 --- a/src/server/clicklabel/clicklabel.h +++ b/src/server/clicklabel/clicklabel.h @@ -9,13 +9,13 @@ */ class ClickLabel : public QLabel { - Q_OBJECT + Q_OBJECT public: - ClickLabel(QWidget *parent); + ClickLabel(QWidget *parent); protected: - void mouseReleaseEvent(QMouseEvent* e); + void mouseReleaseEvent(QMouseEvent* e); signals: diff --git a/src/server/connectionframe/connectionframe.cpp b/src/server/connectionframe/connectionframe.cpp index dbe408c..1bf6fb6 100644 --- a/src/server/connectionframe/connectionframe.cpp +++ b/src/server/connectionframe/connectionframe.cpp @@ -231,9 +231,9 @@ void ConnectionFrame::mousePressEvent(QMouseEvent *event) } else { - _clickPoint = event->pos(); - _previousPosition = this->pos(); - QApplication::setOverrideCursor(QCursor(Qt::ClosedHandCursor)); + _clickPoint = event->pos(); + _previousPosition = this->pos(); + QApplication::setOverrideCursor(QCursor(Qt::ClosedHandCursor)); } // On click, the window has to be on the top-level. activateWindow(); diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index 9dee65b..7f59191 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -556,22 +556,22 @@ void MainWindow::onSessionNameUpdate() */ void MainWindow::startVncServerIfNecessary(int from) { - Client* os = getClientFromId(_streamingSource); - Client* ns = getClientFromId(from); + Client* os = getClientFromId(_streamingSource); + Client* ns = getClientFromId(from); // if there is a server running which is not "from" stop it. - if (os != NULL && _streamingSource != from) - os->stopVncServer(); + if (os != NULL && _streamingSource != from) + os->stopVncServer(); - // Set new streaming source - _streamingSource = from; + // Set new streaming source + _streamingSource = from; - // If streaming source is already active avoid a restart - if (ns != NULL) { - if (ns->isActiveVncServer()) - this->onVncServerStateChange(ns); + // If streaming source is already active avoid a restart + if (ns != NULL) { + if (ns->isActiveVncServer()) + this->onVncServerStateChange(ns); else // Could not take shortcut, (re)start VNC server on source - ns->startVncServer(); + ns->startVncServer(); } } @@ -598,30 +598,30 @@ void MainWindow::onButtonTutorToAll() QMessageBox::critical(this, tr("Projection"), sStrTutorOffline); else if (_clientFrames.size() == 1) QMessageBox::critical(this, tr("Projection"), sStrNoDestAv); - else - { - DisableButtons(); - - if (_mode != Mode::Broadcast) - { - // Set all clients as watchers - for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) - { - if ((*it)->client() != NULL && (*it)->client() != getClientFromId(_streamingSource)) - (*it)->client()->setWatcher(true); - } - } - else // If this mode is already active - { - // Stop reset everything - reset(); - _mode = Mode::None; - return; - } - - _mode = Mode::Broadcast; - startVncServerIfNecessary(getTutorFrame()->client()->id()); - } + else + { + DisableButtons(); + + if (_mode != Mode::Broadcast) + { + // Set all clients as watchers + for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) + { + if ((*it)->client() != NULL && (*it)->client() != getClientFromId(_streamingSource)) + (*it)->client()->setWatcher(true); + } + } + else // If this mode is already active + { + // Stop reset everything + reset(); + _mode = Mode::None; + return; + } + + _mode = Mode::Broadcast; + startVncServerIfNecessary(getTutorFrame()->client()->id()); + } } /***************************************************************************//** @@ -637,30 +637,30 @@ void MainWindow::onButtonStudentToAll() QMessageBox::critical(this, tr("Projection"), sStrSourceNdef); if (getSelectedFrame()->client() == NULL) QMessageBox::critical(this, tr("Projection"), sStrSourceOffline); - else - { - DisableButtons(); - - if (_mode != Mode::Broadcast) - { - // Set all clients as watchers - for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) - { - if ((*it)->client() != NULL && (*it)->client() != getClientFromId(_streamingSource)) - (*it)->client()->setWatcher(true); - } - } - else // If this mode is already active - { - // Stop reset everything - reset(); - _mode = Mode::None; - return; - } - - _mode = Mode::Broadcast; - startVncServerIfNecessary(getSelectedFrame()->client()->id()); - } + else + { + DisableButtons(); + + if (_mode != Mode::Broadcast) + { + // Set all clients as watchers + for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) + { + if ((*it)->client() != NULL && (*it)->client() != getClientFromId(_streamingSource)) + (*it)->client()->setWatcher(true); + } + } + else // If this mode is already active + { + // Stop reset everything + reset(); + _mode = Mode::None; + return; + } + + _mode = Mode::Broadcast; + startVncServerIfNecessary(getSelectedFrame()->client()->id()); + } } /***************************************************************************//** @@ -681,37 +681,37 @@ void MainWindow::onButtonTutorToStudent() QMessageBox::critical(this, tr("Projection"), sStrDestOffline); else if (getTutorFrame()->client() == NULL) QMessageBox::critical(this, tr("Projection"), sStrTutorOffline); - else - { - DisableButtons(); - - // If this is the first call in this mode clear the watchers - if (_mode != Mode::Multicast) - { - // _watchers.clear(); - for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) - { - if ((*it)->client() != NULL) - (*it)->client()->setWatcher(false); - } - } - - // If "to" already watches "from" stop it - // if (_watchers.contains(to->id())) - if (getClientFromId(getSelectedFrame()->client()->id())->isWatcher()) - { - // _watchers.remove(to->id()); - getClientFromId(getSelectedFrame()->client()->id())->setWatcher(false); - } - else // list "to" as watcher - { - // _watchers.insert(to->id(), to); - getClientFromId(getSelectedFrame()->client()->id())->setWatcher(true); - } - - _mode = Mode::Multicast; - startVncServerIfNecessary(getTutorFrame()->client()->id()); - } + else + { + DisableButtons(); + + // If this is the first call in this mode clear the watchers + if (_mode != Mode::Multicast) + { + // _watchers.clear(); + for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) + { + if ((*it)->client() != NULL) + (*it)->client()->setWatcher(false); + } + } + + // If "to" already watches "from" stop it + // if (_watchers.contains(to->id())) + if (getClientFromId(getSelectedFrame()->client()->id())->isWatcher()) + { + // _watchers.remove(to->id()); + getClientFromId(getSelectedFrame()->client()->id())->setWatcher(false); + } + else // list "to" as watcher + { + // _watchers.insert(to->id(), to); + getClientFromId(getSelectedFrame()->client()->id())->setWatcher(true); + } + + _mode = Mode::Multicast; + startVncServerIfNecessary(getTutorFrame()->client()->id()); + } } /***************************************************************************//** @@ -732,33 +732,33 @@ void MainWindow::onButtonStudentToTutor() QMessageBox::critical(this, tr("Projection"), sStrSourceOffline); else if (getTutorFrame()->client() == NULL) QMessageBox::critical(this, tr("Projection"), sStrTutorOffline); - else{ - DisableButtons(); - - if (_mode != Mode::Unicast) - { - // If this is the first run in this mode set the tutor as watcher - for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) - if ((*it)->client() != NULL) - (*it)->client()->setWatcher(getTutorFrame()->client()->id() == (*it)->client()->id()); - _mode = Mode::Unicast; - } - else - { - // If this mode is already active and the current source is selected, stop the streaming. - if (getSelectedFrame()->client()->id() == _streamingSource ) - { - // Stop reset everything - _mode = Mode::None; - reset(); - return; - } - // If another client is selected solely the current streaming source shall be changed. - // This should be handled by startVncServerIfNecessary(...). - } - - startVncServerIfNecessary(getSelectedFrame()->client()->id()); - } + else{ + DisableButtons(); + + if (_mode != Mode::Unicast) + { + // If this is the first run in this mode set the tutor as watcher + for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) + if ((*it)->client() != NULL) + (*it)->client()->setWatcher(getTutorFrame()->client()->id() == (*it)->client()->id()); + _mode = Mode::Unicast; + } + else + { + // If this mode is already active and the current source is selected, stop the streaming. + if (getSelectedFrame()->client()->id() == _streamingSource ) + { + // Stop reset everything + _mode = Mode::None; + reset(); + return; + } + // If another client is selected solely the current streaming source shall be changed. + // This should be handled by startVncServerIfNecessary(...). + } + + startVncServerIfNecessary(getSelectedFrame()->client()->id()); + } } @@ -779,33 +779,33 @@ void MainWindow::onButtonStudentToTutorExclusive() QMessageBox::critical(this, tr("Projection"), sStrSourceOffline); else if (getTutorFrame()->client() == NULL) QMessageBox::critical(this, tr("Projection"), sStrTutorOffline); - else - { - DisableButtons(); - - if (_mode != Mode::LockedUnicast) - { - // If this is the first run in this mode set the tutor as watcher - for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) - if ((*it)->client() != NULL) - (*it)->client()->setWatcher(getTutorFrame()->client()->id() == (*it)->client()->id()); - _mode = Mode::LockedUnicast; - } - else - { - // If this mode is already active and the current source is selected, stop the streaming. - if (getSelectedFrame()->client()->id() == _streamingSource ) - { - // Stop reset everything - _mode = Mode::None; - reset(); - return; - } - // If another client is selected solely the current streaming source shall be changed. - // This should be handled by startVncServerIfNecessary(...). - } - - startVncServerIfNecessary(getSelectedFrame()->client()->id()); + else + { + DisableButtons(); + + if (_mode != Mode::LockedUnicast) + { + // If this is the first run in this mode set the tutor as watcher + for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) + if ((*it)->client() != NULL) + (*it)->client()->setWatcher(getTutorFrame()->client()->id() == (*it)->client()->id()); + _mode = Mode::LockedUnicast; + } + else + { + // If this mode is already active and the current source is selected, stop the streaming. + if (getSelectedFrame()->client()->id() == _streamingSource ) + { + // Stop reset everything + _mode = Mode::None; + reset(); + return; + } + // If another client is selected solely the current streaming source shall be changed. + // This should be handled by startVncServerIfNecessary(...). + } + + startVncServerIfNecessary(getSelectedFrame()->client()->id()); } } @@ -1117,40 +1117,40 @@ void MainWindow::onVncServerStateChange(Client* client) */ void MainWindow::onVncClientStateChange(Client* client) { - if (client != NULL) + if (client != NULL) { // VNC Client stopped -> remove from watchers - if (!client->isActiveVncClient()){ + if (!client->isActiveVncClient()){ if (getClientFromId(client->id()) != NULL) getClientFromId(client->id())->setWatcher(false); - /* - * If noboody is watching the multicast stop VNC server - * If the past connection of this client is not the current - * _streamingSource then the manager has to have stopped it - * already. This is necessary for the race condition when a server - * is stopped and another started at the same time, since the new - * server would be killed if all client disconnect before any of - * the new connect. - */ - if (client->projectionSource() == _streamingSource) - { - bool noWatchers = true; - for (QList::iterator it(_clientFrames.begin()); - it != _clientFrames.end(); ++it) - { - if ((*it)->client() != NULL) - { - if ((*it)->client()->isWatcher()) - noWatchers = false; - } - } - if (noWatchers && _mode != Mode::Broadcast) - { - Client* c = getClientFromId(_streamingSource); - if (c != NULL) - c->stopVncServer(); - } + /* + * If noboody is watching the multicast stop VNC server + * If the past connection of this client is not the current + * _streamingSource then the manager has to have stopped it + * already. This is necessary for the race condition when a server + * is stopped and another started at the same time, since the new + * server would be killed if all client disconnect before any of + * the new connect. + */ + if (client->projectionSource() == _streamingSource) + { + bool noWatchers = true; + for (QList::iterator it(_clientFrames.begin()); + it != _clientFrames.end(); ++it) + { + if ((*it)->client() != NULL) + { + if ((*it)->client()->isWatcher()) + noWatchers = false; + } + } + if (noWatchers && _mode != Mode::Broadcast) + { + Client* c = getClientFromId(_streamingSource); + if (c != NULL) + c->stopVncServer(); + } } } } diff --git a/src/server/mainwindow/mainwindow.h b/src/server/mainwindow/mainwindow.h index 009e9d8..5373209 100644 --- a/src/server/mainwindow/mainwindow.h +++ b/src/server/mainwindow/mainwindow.h @@ -78,7 +78,7 @@ private: ConnectionFrame* createFrame(); bool loadPosition(QSettings& settings, const QString& id, int& x, int& y); void savePosition(ConnectionFrame *cf); - void startVncServerIfNecessary(int from); + void startVncServerIfNecessary(int from); void tellClientCurrentSituation(Client* client); void reset(); diff --git a/src/server/net/client.cpp b/src/server/net/client.cpp index dd61b45..a00ef88 100644 --- a/src/server/net/client.cpp +++ b/src/server/net/client.cpp @@ -21,8 +21,8 @@ Client::Client(QSslSocket* socket) : _socket(socket) { assert(socket != NULL); _authed = 0; - _projectionSource = 0; - _isActiveVncClient = false; + _projectionSource = 0; + _isActiveVncClient = false; _vncPort = 0; _isTutor = false; _locked = false; @@ -194,14 +194,14 @@ void Client::handleMsg() if (_fromClient.getFieldString("ENABLED").toInt() != 0) { qDebug() << "Client " << _name << " started its VNC client (watching " << projectionSource << ")"; - _projectionSource = projectionSource; - _isActiveVncClient = true; + _projectionSource = projectionSource; + _isActiveVncClient = true; emit vncClientStateChange(this); } else { qDebug() << "Client " << _name << " stopped its VNC client (watched " << projectionSource << ")"; - _isActiveVncClient = false; + _isActiveVncClient = false; emit vncClientStateChange(this); } emit stateChanged(); @@ -306,7 +306,7 @@ void Client::startVncClient(const Client * const to) /******************************************************************************/ void Client::stopVncClient() { - if (_isActiveVncClient) { + if (_isActiveVncClient) { NetworkMessage msg; msg.setField(_ID, _VNCCLIENT); sendMessage(msg); diff --git a/src/server/net/client.h b/src/server/net/client.h index c4afd16..61b6a5b 100644 --- a/src/server/net/client.h +++ b/src/server/net/client.h @@ -33,8 +33,8 @@ public: inline const QString& host() const { return _host; } inline const QString ip() const { return _socket->peerAddress().toString(); } inline const int id() const { return _id; } - inline const int projectionSource() const { return _projectionSource; } - inline const bool isActiveVncClient() const { return _isActiveVncClient; } + inline const int projectionSource() const { return _projectionSource; } + inline const bool isActiveVncClient() const { return _isActiveVncClient; } inline const bool isActiveVncServer() const { return _vncPort > 0; } inline const bool isLocked() const { return _locked; } inline const bool isWatcher() const { return _isWatcher; } @@ -65,8 +65,8 @@ private: int _id; // this client's unique id QString _vncRwPass, _vncRoPass; int _vncPort; // VNCserver state. Greater 0 -> active on this port. Equals 0 -> no server. - int _projectionSource; // VNCclient state. The source the client was or is connected to (depends on _isActiveVncClient) - bool _isActiveVncClient; // VNCclient state. indicating that the client is displaying a remote screen via VNC + int _projectionSource; // VNCclient state. The source the client was or is connected to (depends on _isActiveVncClient) + bool _isActiveVncClient; // VNCclient state. indicating that the client is displaying a remote screen via VNC bool _isTutor; // Flag indicating that the client has been set as a tutor bool _isWatcher; // Flag indicates that the client should watch to VNC Server. diff --git a/src/server/net/filedownloader.cpp b/src/server/net/filedownloader.cpp index 70e1520..aa27948 100644 --- a/src/server/net/filedownloader.cpp +++ b/src/server/net/filedownloader.cpp @@ -21,7 +21,7 @@ FileDownloader::~FileDownloader() { void FileDownloader::connectSlot(QObject* obj, const char* slot) { QObject::connect(this, SIGNAL(downloaded(QByteArray&)), - obj, slot); + obj, slot); } void FileDownloader::fileDownloaded(QNetworkReply* pReply) { diff --git a/src/server/net/filedownloader.h b/src/server/net/filedownloader.h index 68eaa39..227af50 100644 --- a/src/server/net/filedownloader.h +++ b/src/server/net/filedownloader.h @@ -16,28 +16,28 @@ class FileDownloader : public QObject { - Q_OBJECT + Q_OBJECT public: - explicit FileDownloader(QObject *parent = 0); + explicit FileDownloader(QObject *parent = 0); - virtual ~FileDownloader(); + virtual ~FileDownloader(); - void downloadFile(const QUrl& fileUrl); + void downloadFile(const QUrl& fileUrl); - void connectSlot(QObject* obj, const char* slot); + void connectSlot(QObject* obj, const char* slot); - QByteArray downloadedData() const; + QByteArray downloadedData() const; signals: - void downloaded(QByteArray& downloadedData); + void downloaded(QByteArray& downloadedData); private slots: - void fileDownloaded(QNetworkReply* pReply); + void fileDownloaded(QNetworkReply* pReply); private: - QNetworkAccessManager m_WebCtrl; + QNetworkAccessManager m_WebCtrl; }; diff --git a/src/server/net/sslserver.h b/src/server/net/sslserver.h index cdb12de..0b3120e 100644 --- a/src/server/net/sslserver.h +++ b/src/server/net/sslserver.h @@ -28,26 +28,26 @@ class QSslSocket; */ class SslServer : public QTcpServer { - Q_OBJECT + Q_OBJECT private Q_SLOTS: - void sslErrors ( const QList & errors ); + void sslErrors ( const QList & errors ); public: - SslServer(); - virtual ~SslServer(); + SslServer(); + virtual ~SslServer(); - bool hasPendingConnections (); - // This one has to return a TcpSocket as we're overwriting from the base class - // just cast it to QSslSocket later - virtual QTcpSocket* nextPendingConnection(); + bool hasPendingConnections (); + // This one has to return a TcpSocket as we're overwriting from the base class + // just cast it to QSslSocket later + virtual QTcpSocket* nextPendingConnection(); protected: - void incomingConnection(int socketDescriptor); - void timerEvent (QTimerEvent* event); - QList _pending; - QList _delete; - int _tmr; + void incomingConnection(int socketDescriptor); + void timerEvent (QTimerEvent* event); + QList _pending; + QList _delete; + int _tmr; }; #endif /* SSLSERVER_H_ */ diff --git a/src/server/sessionnamewindow/sessionnamewindow.h b/src/server/sessionnamewindow/sessionnamewindow.h index ee93ea2..761f596 100644 --- a/src/server/sessionnamewindow/sessionnamewindow.h +++ b/src/server/sessionnamewindow/sessionnamewindow.h @@ -10,19 +10,19 @@ class SessionName; class SessionNameWindow : public QDialog { - Q_OBJECT + Q_OBJECT private: - Ui::SessionName *ui; + Ui::SessionName *ui; public: - SessionNameWindow(QWidget *parent = 0); - ~SessionNameWindow(); + SessionNameWindow(QWidget *parent = 0); + ~SessionNameWindow(); - void show(const QString& name); + void show(const QString& name); protected: - void closeEvent(QCloseEvent *e); + void closeEvent(QCloseEvent *e); private slots: void onOkClicked(); -- cgit v1.2.3-55-g7522