window-projector.hpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #include <obs.hpp>
  3. #include "qt-display.hpp"
  4. enum class ProjectorType {
  5. Source,
  6. Scene,
  7. Preview,
  8. StudioProgram,
  9. Multiview
  10. };
  11. class QMouseEvent;
  12. class OBSProjector : public OBSQTDisplay {
  13. Q_OBJECT
  14. private:
  15. OBSSource source;
  16. OBSSignal removedSignal;
  17. static void OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy);
  18. static void OBSRender(void *data, uint32_t cx, uint32_t cy);
  19. static void OBSSourceRemoved(void *data, calldata_t *params);
  20. void mousePressEvent(QMouseEvent *event) override;
  21. void mouseDoubleClickEvent(QMouseEvent *event) override;
  22. int savedMonitor;
  23. bool isWindow;
  24. QString projectorTitle;
  25. ProjectorType type = ProjectorType::Source;
  26. OBSWeakSource multiviewScenes[8];
  27. OBSSource multiviewLabels[10];
  28. gs_vertbuffer_t *outerBox = nullptr;
  29. gs_vertbuffer_t *innerBox = nullptr;
  30. gs_vertbuffer_t *leftVLine = nullptr;
  31. gs_vertbuffer_t *rightVLine = nullptr;
  32. gs_vertbuffer_t *leftLine = nullptr;
  33. gs_vertbuffer_t *topLine = nullptr;
  34. gs_vertbuffer_t *rightLine = nullptr;
  35. bool ready = false;
  36. void UpdateMultiview();
  37. void UpdateProjectorTitle(QString name);
  38. private slots:
  39. void EscapeTriggered();
  40. public:
  41. OBSProjector(QWidget *widget, obs_source_t *source_, int monitor,
  42. QString title, ProjectorType type_);
  43. ~OBSProjector();
  44. void Init();
  45. OBSSource GetSource();
  46. ProjectorType GetProjectorType();
  47. int GetMonitor();
  48. static void UpdateMultiviewProjectors();
  49. static void RenameProjector(QString oldName, QString newName);
  50. };