summaryrefslogtreecommitdiffstats
path: root/src/server/connectionframe/connectionframe.h
diff options
context:
space:
mode:
authorSimon Rettberg2018-07-20 15:41:45 +0200
committerSimon Rettberg2018-07-20 15:41:45 +0200
commite354df7172efbe25e94f1c6ae5516912dad1d114 (patch)
treedab58ddbeb78743ebad07669d932d475ac5ba5df /src/server/connectionframe/connectionframe.h
parent[client] Don't activateWindow VNC viewer on open in multiscreen mode (diff)
downloadpvs2-e354df7172efbe25e94f1c6ae5516912dad1d114.tar.gz
pvs2-e354df7172efbe25e94f1c6ae5516912dad1d114.tar.xz
pvs2-e354df7172efbe25e94f1c6ae5516912dad1d114.zip
[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.
Diffstat (limited to 'src/server/connectionframe/connectionframe.h')
-rw-r--r--src/server/connectionframe/connectionframe.h8
1 files changed, 5 insertions, 3 deletions
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<QLabel*> _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();
};