summaryrefslogtreecommitdiffstats
path: root/src/server/connectionframe/connectionframe.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/connectionframe/connectionframe.cpp')
-rw-r--r--src/server/connectionframe/connectionframe.cpp24
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();
}
/**