From 9ba63d1460db41c219b638212b42476164fcfdff Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 24 Jul 2018 13:08:25 +0200 Subject: Update code style, fix compiler warnings - Use nullptr instead of NULL for better warnings in case of mistakes - Get rid of VLAs which are not in C++11 actually - Fix implicit signed <-> unsigned mismatches by adding checks and casts --- src/server/connectionframe/connectionframe.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/server/connectionframe/connectionframe.cpp') diff --git a/src/server/connectionframe/connectionframe.cpp b/src/server/connectionframe/connectionframe.cpp index 875e031..e8d8349 100644 --- a/src/server/connectionframe/connectionframe.cpp +++ b/src/server/connectionframe/connectionframe.cpp @@ -58,7 +58,7 @@ static QString style_disconnected( QGroupBox { background-color: #7F7F7F; margin: 1px; border-radius: 4px}" ); -static QIcon *term = NULL, *cam = NULL, *eye = NULL, *lock = NULL; +static QIcon *term = nullptr, *cam = nullptr, *eye = nullptr, *lock = nullptr; bool ConnectionFrame::paintDisabled = false; @@ -69,13 +69,13 @@ bool ConnectionFrame::paintDisabled = false; * @param height */ ConnectionFrame::ConnectionFrame(MainWindow* main, QWidget *parent, bool fromRoomplan) : - QGroupBox(parent), _client(NULL), _timerId(0), _timerCounter(0), _isSelected(false), _isTutor(false), + QGroupBox(parent), _client(nullptr), _timerId(0), _timerCounter(0), _isSelected(false), _isTutor(false), _isFromRoomplan(fromRoomplan), _mainWindow(main) { //defines the ui-stuff // load icons first - if (term == NULL) { + if (term == nullptr) { term = new QIcon(":terminal"); cam = new QIcon(":cf_cam"); eye = new QIcon(":cf_eye"); @@ -88,7 +88,7 @@ ConnectionFrame::ConnectionFrame(MainWindow* main, QWidget *parent, bool fromRoo _mainLayout->setAlignment(Qt::AlignHCenter); this->setStyleSheet(style_student); - _iconLayout = new QBoxLayout(QBoxLayout::RightToLeft, NULL); + _iconLayout = new QBoxLayout(QBoxLayout::RightToLeft, nullptr); _iconLayout->setSpacing(1); _iconLayout->setMargin(3); @@ -124,7 +124,7 @@ ConnectionFrame::ConnectionFrame(MainWindow* main, QWidget *parent, bool fromRoo ConnectionFrame::~ConnectionFrame() { - if (_client != NULL) { + if (_client != nullptr) { _client->deleteLater(); } _iconLayout->deleteLater(); @@ -145,7 +145,7 @@ void ConnectionFrame::updateGeometry() { const QRect rect = _mainWindow->calcFrameGeometry(this); setGeometry(rect); - if (this->_client == NULL) + if (this->_client == nullptr) showDefaultThumb(); } @@ -171,7 +171,7 @@ QLabel* ConnectionFrame::addIcon(const QIcon* icon) */ void ConnectionFrame::assignClient(Client* client) { - assert(_client == NULL); + assert(_client == nullptr); connect( client, SIGNAL(disconnected()), this, SLOT(onClientDisconnected()) ); connect( client, SIGNAL(thumbUpdated(Client*, const QImage&)), this, SLOT(onThumbUpdated(Client*, const QImage&)) ); connect( client, SIGNAL(vncServerStateChange(Client*)), this, SLOT(updateAppearance())); @@ -206,7 +206,7 @@ void ConnectionFrame::calcDesiredThumbSize(const QSize &frameSize) void ConnectionFrame::updateLabels() { _lblHostName->setText(_computerId); - if (_client == NULL) { + if (_client == nullptr) { _lblUserName->setText(QString()); _lblUserName->hide(); } else { @@ -331,7 +331,7 @@ void ConnectionFrame::paintEvent(QPaintEvent *event) */ void ConnectionFrame::timerEvent(QTimerEvent* /* event */ ) { - if (_client == NULL) + if (_client == nullptr) return; ++_timerCounter; if (_client->isActiveVncServer() && _timerCounter % 5 != 0) @@ -357,7 +357,7 @@ void ConnectionFrame::setSelection(bool selected) */ void ConnectionFrame::setTutor(bool b) { - if (_isTutor != b && _client != NULL) + if (_isTutor != b && _client != nullptr) _client->setTutor(b); _isTutor = b; this->updateAppearance(); @@ -369,7 +369,7 @@ void ConnectionFrame::setTutor(bool b) */ void ConnectionFrame::updateAppearance() { - if (_client == NULL) { + if (_client == nullptr) { // Unconnected Frame if (_isSelected) { this->setStyleSheet(style_selectedStudent); @@ -426,7 +426,7 @@ void ConnectionFrame::onClientDisconnected() killTimer(_timerId); _timerId = 0; } - _client = NULL; + _client = nullptr; updateLabels(); updateAppearance(); showDefaultThumb(); -- cgit v1.2.3-55-g7522