2015-04-04 00:37:02 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <obs.hpp>
|
|
|
|
#include "qt-display.hpp"
|
2018-02-28 00:57:54 -03:00
|
|
|
|
|
|
|
enum class ProjectorType {
|
|
|
|
Source,
|
2018-02-28 15:01:31 -03:00
|
|
|
Scene,
|
2018-02-28 00:57:54 -03:00
|
|
|
Preview,
|
|
|
|
StudioProgram,
|
|
|
|
Multiview,
|
|
|
|
};
|
2015-04-04 00:37:02 -07:00
|
|
|
|
2015-04-13 14:31:36 -07:00
|
|
|
class QMouseEvent;
|
|
|
|
|
2018-03-07 06:12:55 -03:00
|
|
|
enum class MultiviewLayout : uint8_t {
|
2018-03-20 21:41:39 -03:00
|
|
|
HORIZONTAL_TOP_8_SCENES = 0,
|
|
|
|
HORIZONTAL_BOTTOM_8_SCENES = 1,
|
|
|
|
VERTICAL_LEFT_8_SCENES = 2,
|
2018-03-23 00:57:15 -03:00
|
|
|
VERTICAL_RIGHT_8_SCENES = 3,
|
|
|
|
HORIZONTAL_TOP_24_SCENES = 4,
|
2018-03-07 06:12:55 -03:00
|
|
|
};
|
|
|
|
|
2015-04-04 00:37:02 -07:00
|
|
|
class OBSProjector : public OBSQTDisplay {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private:
|
|
|
|
OBSSource source;
|
|
|
|
OBSSignal removedSignal;
|
|
|
|
|
2017-10-21 15:51:01 -02:00
|
|
|
static void OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy);
|
2015-04-04 00:37:02 -07:00
|
|
|
static void OBSRender(void *data, uint32_t cx, uint32_t cy);
|
|
|
|
static void OBSSourceRemoved(void *data, calldata_t *params);
|
|
|
|
|
2015-04-13 14:31:36 -07:00
|
|
|
void mousePressEvent(QMouseEvent *event) override;
|
2017-12-12 18:45:15 -02:00
|
|
|
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
2019-10-08 00:43:10 -05:00
|
|
|
void closeEvent(QCloseEvent *event) override;
|
2015-04-13 14:31:36 -07:00
|
|
|
|
2020-04-27 23:26:20 +02:00
|
|
|
bool isAlwaysOnTop;
|
|
|
|
bool isAlwaysOnTopOverridden = false;
|
2019-10-08 00:43:10 -05:00
|
|
|
int savedMonitor = -1;
|
2017-10-21 15:51:01 -02:00
|
|
|
ProjectorType type = ProjectorType::Source;
|
2018-03-23 00:57:15 -03:00
|
|
|
std::vector<OBSWeakSource> multiviewScenes;
|
|
|
|
std::vector<OBSSource> multiviewLabels;
|
2018-03-18 22:00:18 -03:00
|
|
|
gs_vertbuffer_t *actionSafeMargin = nullptr;
|
|
|
|
gs_vertbuffer_t *graphicsSafeMargin = nullptr;
|
|
|
|
gs_vertbuffer_t *fourByThreeSafeMargin = nullptr;
|
|
|
|
gs_vertbuffer_t *leftLine = nullptr;
|
|
|
|
gs_vertbuffer_t *topLine = nullptr;
|
|
|
|
gs_vertbuffer_t *rightLine = nullptr;
|
2018-03-20 03:20:45 -03:00
|
|
|
gs_effect_t *solid = nullptr;
|
|
|
|
gs_eparam_t *color = nullptr;
|
2018-03-22 22:07:59 -03:00
|
|
|
// Multiview position helpers
|
2018-03-20 03:20:45 -03:00
|
|
|
float thickness = 4;
|
2018-03-23 00:57:15 -03:00
|
|
|
float offset, thicknessx2 = thickness * 2, pvwprgCX, pvwprgCY, sourceX,
|
|
|
|
sourceY, labelX, labelY, scenesCX, scenesCY, ppiCX, ppiCY,
|
|
|
|
siX, siY, siCX, siCY, ppiScaleX, ppiScaleY, siScaleX,
|
|
|
|
siScaleY, fw, fh, ratio;
|
2018-03-20 03:20:45 -03:00
|
|
|
|
2018-03-18 22:00:18 -03:00
|
|
|
float lineLength = 0.1f;
|
|
|
|
// Rec. ITU-R BT.1848-1 / EBU R 95
|
|
|
|
float actionSafePercentage = 0.035f; // 3.5%
|
|
|
|
float graphicsSafePercentage = 0.05f; // 5.0%
|
|
|
|
float fourByThreeSafePercentage = 0.1625f; // 16.25%
|
2017-10-21 15:51:01 -02:00
|
|
|
bool ready = false;
|
|
|
|
|
2018-03-08 16:04:22 -03:00
|
|
|
// argb colors
|
|
|
|
static const uint32_t outerColor = 0xFFD0D0D0;
|
|
|
|
static const uint32_t labelColor = 0xD91F1F1F;
|
|
|
|
static const uint32_t backgroundColor = 0xFF000000;
|
2018-03-12 00:34:02 -03:00
|
|
|
static const uint32_t previewColor = 0xFF00D000;
|
|
|
|
static const uint32_t programColor = 0xFFD00000;
|
2018-03-08 16:04:22 -03:00
|
|
|
|
2017-10-21 15:51:01 -02:00
|
|
|
void UpdateMultiview();
|
2018-02-28 21:43:07 -03:00
|
|
|
void UpdateProjectorTitle(QString name);
|
2016-12-29 09:21:53 -06:00
|
|
|
|
2019-10-08 00:43:10 -05:00
|
|
|
QRect prevGeometry;
|
|
|
|
void SetMonitor(int monitor);
|
|
|
|
|
2015-04-04 00:37:02 -07:00
|
|
|
private slots:
|
|
|
|
void EscapeTriggered();
|
2019-10-08 00:43:10 -05:00
|
|
|
void OpenFullScreenProjector();
|
2020-04-10 20:47:06 +10:00
|
|
|
void ResizeToContent();
|
2019-10-08 00:43:10 -05:00
|
|
|
void OpenWindowedProjector();
|
2020-04-27 23:26:20 +02:00
|
|
|
void AlwaysOnTopToggled(bool alwaysOnTop);
|
2015-04-04 00:37:02 -07:00
|
|
|
|
|
|
|
public:
|
2018-02-28 23:34:11 -03:00
|
|
|
OBSProjector(QWidget *widget, obs_source_t *source_, int monitor,
|
2019-10-08 00:43:10 -05:00
|
|
|
ProjectorType type_);
|
2015-04-04 00:37:02 -07:00
|
|
|
~OBSProjector();
|
|
|
|
|
2018-02-28 15:34:17 -03:00
|
|
|
OBSSource GetSource();
|
|
|
|
ProjectorType GetProjectorType();
|
|
|
|
int GetMonitor();
|
2017-10-21 15:51:01 -02:00
|
|
|
static void UpdateMultiviewProjectors();
|
2019-10-08 00:43:10 -05:00
|
|
|
void RenameProjector(QString oldName, QString newName);
|
2020-06-13 21:00:55 -05:00
|
|
|
void SetHideCursor();
|
2020-04-27 23:26:20 +02:00
|
|
|
|
|
|
|
bool IsAlwaysOnTop() const;
|
|
|
|
bool IsAlwaysOnTopOverridden() const;
|
|
|
|
void SetIsAlwaysOnTop(bool isAlwaysOnTop, bool isOverridden);
|
2015-04-04 00:37:02 -07:00
|
|
|
};
|