summaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
authorSimon Rettberg2016-02-08 16:48:29 +0100
committerSimon Rettberg2016-02-08 16:48:29 +0100
commitde708185c77aa451682fa96fbca4dcc6c8091c44 (patch)
treee925e32649545dad8a4e373326da9314b4f1dd28 /src/server
parent[client] Remove jpeg quality debug message (diff)
downloadpvs2-de708185c77aa451682fa96fbca4dcc6c8091c44.tar.gz
pvs2-de708185c77aa451682fa96fbca4dcc6c8091c44.tar.xz
pvs2-de708185c77aa451682fa96fbca4dcc6c8091c44.zip
[*] Use thumbnail on vnc viewer window until connection is up
Diffstat (limited to 'src/server')
-rw-r--r--src/server/connectionframe/connectionframe.cpp5
-rw-r--r--src/server/connectionframe/connectionframe.h2
-rw-r--r--src/server/net/client.cpp12
-rw-r--r--src/server/net/client.h3
4 files changed, 15 insertions, 7 deletions
diff --git a/src/server/connectionframe/connectionframe.cpp b/src/server/connectionframe/connectionframe.cpp
index 39aba12..82e949a 100644
--- a/src/server/connectionframe/connectionframe.cpp
+++ b/src/server/connectionframe/connectionframe.cpp
@@ -144,7 +144,7 @@ void ConnectionFrame::assignClient(Client* client)
{
assert(_client == NULL);
connect( client, SIGNAL(disconnected()), this, SLOT(onClientDisconnected()) );
- connect( client, SIGNAL(thumbUpdated(Client*, const QPixmap&)), this, SLOT(onThumbUpdated(Client*, const QPixmap&)) );
+ connect( client, SIGNAL(thumbUpdated(Client*, const QPixmap&, const QByteArray&)), this, SLOT(onThumbUpdated(Client*, const QPixmap&, const QByteArray&)) );
connect( client, SIGNAL(vncServerStateChange(Client*)), this, SLOT(updateAppearance()));
connect( client, SIGNAL(vncClientStateChange(Client*)), this, SLOT(updateAppearance()));
connect( client, SIGNAL(stateChanged()), this, SLOT(updateAppearance()));
@@ -383,10 +383,11 @@ void ConnectionFrame::onClientDisconnected()
* @param client
* @param thumb
*/
-void ConnectionFrame::onThumbUpdated(Client* client, const QPixmap& thumb)
+void ConnectionFrame::onThumbUpdated(Client* client, const QPixmap& thumb, const QByteArray&)
{
assert(client == _client);
_remoteScreen = thumb;
//_imgScreen->setPixmap(_remoteScreen);
this->repaint();
}
+
diff --git a/src/server/connectionframe/connectionframe.h b/src/server/connectionframe/connectionframe.h
index 188cdc7..42a07f0 100644
--- a/src/server/connectionframe/connectionframe.h
+++ b/src/server/connectionframe/connectionframe.h
@@ -84,7 +84,7 @@ signals:
private slots:
void onClientDisconnected();
- void onThumbUpdated(Client* client, const QPixmap& thumb);
+ void onThumbUpdated(Client* client, const QPixmap& thumb, const QByteArray& rawImage);
void updateAppearance();
};
diff --git a/src/server/net/client.cpp b/src/server/net/client.cpp
index 5fb030e..029b88a 100644
--- a/src/server/net/client.cpp
+++ b/src/server/net/client.cpp
@@ -156,12 +156,14 @@ void Client::handleMsg()
if (id == _THUMB)
{
QPixmap pixmap;
- if (!pixmap.loadFromData(_fromClient.getFieldBytes("IMG")))
+ const QByteArray& rawImage = _fromClient.getFieldBytes("IMG");
+ if (!pixmap.loadFromData(rawImage))
{
qDebug("Could not decode thumbnail image from client.");
return;
}
- emit thumbUpdated(this, pixmap);
+ _rawRemoteScreen = QByteArray(rawImage);
+ emit thumbUpdated(this, pixmap, rawImage);
}
else if (id == _VNCSERVER)
{
@@ -298,10 +300,14 @@ void Client::startVncClient(const Client * const to)
NetworkMessage msg;
msg.setField(_ID, _VNCCLIENT);
msg.setField("HOST", to->_socket->peerAddress().toString());
- msg.setField("PORT", QString::number(to->_vncPort));
+ msg.setField(_PORT, QString::number(to->_vncPort));
msg.setField("ROPASS", to->_vncRoPass);
msg.setField("CLIENTID", QString::number(to->_id));
msg.setField("CAPTION", to->_name + " @ " + to->_host);
+ if (!to->_rawRemoteScreen.isEmpty())
+ {
+ msg.setField(_THUMB, to->_rawRemoteScreen);
+ }
sendMessage(msg);
}
diff --git a/src/server/net/client.h b/src/server/net/client.h
index 5e1b8b4..d2097ad 100644
--- a/src/server/net/client.h
+++ b/src/server/net/client.h
@@ -71,6 +71,7 @@ private:
int _projectionSource; // 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
+ QByteArray _rawRemoteScreen;
static int _clientIdCounter;
@@ -85,7 +86,7 @@ protected:
signals:
void authenticating(Client* client, ClientLogin* request);
void authenticated(Client* client);
- void thumbUpdated(Client* client, const QPixmap& thumb);
+ void thumbUpdated(Client* client, const QPixmap& thumb, const QByteArray& rawImage);
void vncServerStateChange(Client* client);
void vncClientStateChange(Client* client);
void stateChanged();