diff options
author | Simon Rettberg | 2016-10-28 19:46:28 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-10-28 19:46:28 +0200 |
commit | 0923de46e6dfa4dc8485ead55a1ce1f3d0c27577 (patch) | |
tree | d140c98efc01d4a88f10dd1fa8796682ae4b04be /src/server/connectionframe/connectionframe.cpp | |
parent | Fix compile warnings (diff) | |
download | pvs2-0923de46e6dfa4dc8485ead55a1ce1f3d0c27577.tar.gz pvs2-0923de46e6dfa4dc8485ead55a1ce1f3d0c27577.tar.xz pvs2-0923de46e6dfa4dc8485ead55a1ce1f3d0c27577.zip |
[server] Show IP address in room layout right after loading it
Diffstat (limited to 'src/server/connectionframe/connectionframe.cpp')
-rw-r--r-- | src/server/connectionframe/connectionframe.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
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(); } /** |