1 // Copyright 2005-2019 The Mumble Developers. All rights reserved. 2 // Use of this source code is governed by a BSD-style license 3 // that can be found in the LICENSE file at the root of the 4 // Mumble source tree or at <https://www.mumble.info/LICENSE>. 5 6 #ifndef MUMBLE_MUMBLE_OVERLAYCLIENT_H_ 7 #define MUMBLE_MUMBLE_OVERLAYCLIENT_H_ 8 9 #include <QtCore/QUrl> 10 #include <QtNetwork/QLocalSocket> 11 12 #include "Timer.h" 13 #include "../../overlay/overlay.h" 14 #include "SharedMemory.h" 15 #include "OverlayUserGroup.h" 16 17 class ClientUser; 18 class Overlay; 19 class QLibrary; 20 class QLocalServer; 21 class OverlayPositionableItem; 22 23 class OverlayClient : public QObject { 24 friend class Overlay; 25 private: 26 Q_OBJECT 27 Q_DISABLE_COPY(OverlayClient) 28 protected: 29 OverlayMsg omMsg; 30 QLocalSocket *qlsSocket; 31 SharedMemory2 *smMem; 32 QRect qrLast; 33 Timer t; 34 35 float framesPerSecond; 36 int iOffsetX, iOffsetY; 37 QGraphicsPixmapItem *qgpiCursor; 38 QGraphicsPixmapItem *qgpiLogo; 39 OverlayPositionableItem *qgpiFPS; 40 OverlayPositionableItem *qgpiTime; 41 42 /// The process ID of the process this OverlayClient is connected to. 43 quint64 uiPid; 44 /// The path to the executable of the process that this OverlayClient is connected to. 45 QString qsExecutablePath; 46 47 QGraphicsScene qgs; 48 OverlayUserGroup ougUsers; 49 50 #ifdef Q_OS_MAC 51 QMap<Qt::CursorShape, QPixmap> qmCursors; 52 #endif 53 54 bool bWasVisible; 55 bool bDelete; 56 57 void setupRender(); 58 void setupScene(bool show); 59 60 bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE; 61 62 void readyReadMsgInit(unsigned int length); 63 64 QList<QRectF> qlDirty; 65 protected slots: 66 void readyRead(); 67 void changed(const QList<QRectF> &); 68 void render(); 69 public: 70 QGraphicsView qgv; 71 unsigned int uiWidth, uiHeight; 72 int iMouseX, iMouseY; 73 74 OverlayClient(QLocalSocket *, QObject *); 75 ~OverlayClient() Q_DECL_OVERRIDE; 76 void reset(); 77 public slots: 78 void showGui(); 79 void hideGui(); 80 void scheduleDelete(); 81 void updateMouse(); 82 void updateFPS(); 83 void updateTime(); 84 bool update(); 85 void openEditor(); 86 }; 87 88 #endif 89