From 0923de46e6dfa4dc8485ead55a1ce1f3d0c27577 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 28 Oct 2016 19:46:28 +0200 Subject: [server] Show IP address in room layout right after loading it --- src/server/connectionframe/connectionframe.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src/server/connectionframe/connectionframe.cpp') diff --git a/src/server/connectionframe/connectionframe.cpp b/src/server/connectionframe/connectionframe.cpp index 4228441..90d72da 100644 --- a/src/server/connectionframe/connectionframe.cpp +++ b/src/server/connectionframe/connectionframe.cpp @@ -118,6 +118,7 @@ ConnectionFrame::ConnectionFrame(QWidget *parent, int width, int height) : this->setLayout(_mainLayout); this->setSize(width, height); this->updateAppearance(); + this->updateLabels(); } ConnectionFrame::~ConnectionFrame() @@ -170,10 +171,7 @@ void ConnectionFrame::assignClient(Client* client) connect( client, SIGNAL(stateChanged()), this, SLOT(updateAppearance())); _client = client; _computerId = client->ip(); - _lblHostName->setText(client->ip()); - _lblHostName->setToolTip(client->host()); - _lblUserName->setText(client->name()); - _lblUserName->show(); + updateLabels(); showDefaultThumb(); if (_timerId == 0) _timerId = startTimer(1000 + qrand() % 150); @@ -193,6 +191,19 @@ void ConnectionFrame::showDefaultThumb() //_imgScreen->setPixmap(_remoteScreen); } +void ConnectionFrame::updateLabels() +{ + _lblHostName->setText(_computerId); + if (_client == NULL) { + _lblUserName->setText(QString()); + _lblUserName->hide(); + } else { + _lblHostName->setToolTip(_client->host()); + _lblUserName->setText(_client->name()); + _lblUserName->show(); + } +} + /** * Handle mouse release event on frame. * Check if frame was clicked or moved, if not moved enough, the event is handled as click. @@ -395,10 +406,9 @@ void ConnectionFrame::onClientDisconnected() _timerId = 0; } _client = NULL; - _lblUserName->setText(QString()); - _lblUserName->hide(); showDefaultThumb(); - this->updateAppearance(); + updateLabels(); + updateAppearance(); } /** -- cgit v1.2.3-55-g7522