From e354df7172efbe25e94f1c6ae5516912dad1d114 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 20 Jul 2018 15:41:45 +0200 Subject: [server] Resize thumbs server side on mismatch The server requests the appropriate size thumbnail from the client so no bandwidth will be wasted. However, due to privacy concerns, the client might actually send a thumb that's smaller than requested, resulting in a tiny thumbnail on the server with huge gray borders. The server will now scale up the image in those cases. We'd actually also scale the image down now if it were too large, but this doesn't happen under normal circumstances. --- src/server/connectionframe/connectionframe.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/server/connectionframe/connectionframe.h') diff --git a/src/server/connectionframe/connectionframe.h b/src/server/connectionframe/connectionframe.h index 4558406..898d97a 100644 --- a/src/server/connectionframe/connectionframe.h +++ b/src/server/connectionframe/connectionframe.h @@ -27,11 +27,12 @@ private: QLabel *_icoCam, *_icoEye, *_icoLock; QList _icons; - QPixmap _remoteScreen; + QImage _remoteScreen; QPoint _clickPoint; QPoint _previousPosition; QPoint _gridPosition; + QSize _desiredThumbSize; Client *_client; @@ -43,6 +44,7 @@ private: static const int _startDragDistance = 40; void showDefaultThumb(); + void calcDesiredThumbSize(const QSize &frameSize); QLabel* addIcon(const QIcon* icon); MainWindow *_mainWindow; @@ -59,7 +61,6 @@ public: void setGridPosition(const QPoint& pos); void updateGeometry(); - const QPixmap& getFramePixmap() const { return _remoteScreen; } void assignClient(Client *client); void setSelection(bool selected); inline bool isSelected() { return _isSelected; } @@ -73,6 +74,7 @@ public: void setTutor(bool b); protected: + void resizeEvent(QResizeEvent* event) { calcDesiredThumbSize(event->size()); } void mouseDoubleClickEvent(QMouseEvent* event); void mouseReleaseEvent(QMouseEvent* e); void enterEvent(QEvent* event); @@ -89,7 +91,7 @@ signals: private slots: void onClientDisconnected(); - void onThumbUpdated(Client* client, const QPixmap& thumb, const QByteArray& rawImage); + void onThumbUpdated(Client* client, const QImage& thumb); void updateAppearance(); void updateLabels(); }; -- cgit v1.2.3-55-g7522