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_OVERLAYEDITORSCENE_H_ 7 #define MUMBLE_MUMBLE_OVERLAYEDITORSCENE_H_ 8 9 #include <QtCore/QtGlobal> 10 #if QT_VERSION >= 0x050000 11 # include <QtWidgets/QGraphicsScene> 12 #else 13 # include <QtGui/QGraphicsScene> 14 #endif 15 16 #include "Settings.h" 17 18 class OverlayEditorScene : public QGraphicsScene { 19 private: 20 Q_OBJECT 21 Q_DISABLE_COPY(OverlayEditorScene) 22 23 protected: 24 QGraphicsItem *qgiGroup; 25 26 QGraphicsPixmapItem *qgpiMuted; 27 QGraphicsPixmapItem *qgpiAvatar; 28 QGraphicsPixmapItem *qgpiName; 29 QGraphicsPixmapItem *qgpiChannel; 30 QGraphicsPathItem *qgpiBox; 31 QGraphicsRectItem *qgriSelected; 32 QGraphicsPixmapItem *qgpiSelected; 33 int iDragCorner; 34 35 Qt::WindowFrameSection wfsHover; 36 37 unsigned int uiSize; 38 39 void setup(); 40 41 void contextMenuEvent(QGraphicsSceneContextMenuEvent *e) Q_DECL_OVERRIDE; 42 void mousePressEvent(QGraphicsSceneMouseEvent *e) Q_DECL_OVERRIDE; 43 void mouseMoveEvent(QGraphicsSceneMouseEvent *e) Q_DECL_OVERRIDE; 44 void mouseReleaseEvent(QGraphicsSceneMouseEvent *e) Q_DECL_OVERRIDE; 45 void updateCursorShape(const QPointF &point); 46 47 void drawBackground(QPainter *, const QRectF &) Q_DECL_OVERRIDE; 48 49 QGraphicsPixmapItem *childAt(const QPointF &); 50 QRectF selectedRect() const; 51 52 static Qt::WindowFrameSection rectSection(const QRectF &rect, const QPointF &point, qreal dist = 3.0f); 53 public: 54 Settings::TalkState tsColor; 55 unsigned int uiZoom; 56 OverlaySettings os; 57 58 OverlayEditorScene(const OverlaySettings &, QObject *p = NULL); 59 public slots: 60 void resync(); 61 void updateSelected(); 62 63 void updateMuted(); 64 void updateUserName(); 65 void updateChannel(); 66 void updateAvatar(); 67 68 void moveMuted(); 69 void moveUserName(); 70 void moveChannel(); 71 void moveAvatar(); 72 void moveBox(); 73 }; 74 75 #endif 76