-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathqmlview.h
97 lines (78 loc) · 2.23 KB
/
qmlview.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include <QtQuick>
#include <QtWidgets/QtWidgets>
#include <QtQuickWidgets/QQuickWidget>
#include <QMutex>
#include <QPointer>
#include <obs-module.h>
#include <obs-source.h>
#include <util/dstr.h>
#include <graphics/graphics.h>
class WindowSingleThreaded;
class FrameCounter;
class OBSQuickview : public QObject
{
Q_OBJECT
QUrl m_source;
QStringList m_messages;
QSize m_size;
QMutex m_mutex;
QImage m_canvas;
bool m_enabled;
bool m_ready;
bool m_sceneRendered;
// Or... just... shared context stuff:
GLuint m_texid;
quint8 *m_bits;
private:
void addPluginsPath();
public:
OBSQuickview(QObject *parent=NULL);
~OBSQuickview();
WindowSingleThreaded *m_quickView;
obs_source_t *source;
gs_texture *texture;
bool m_persistent;
FrameCounter *m_renderCounter, *m_drawCounter, *m_qmlFrameCounter;
// Limit FPS to a specific rate:
bool m_frameLimited;
double m_nextFrame;
quint32 m_fps;
void obsshow();
void obshide();
bool obsdraw();
void renderFrame(gs_effect_t *effect);
void renderFrameCustom(gs_effect_t *effect);
void makeWidget();
void makeTexture();
void loadUrl(QUrl url);
void resize( quint32 w, quint32 h );
void tick(quint64 seconds);
bool frameDue(); // is it time for a new frame?
void frameSynced(); // mark last frame time as now
// Interaction:
void sendMouseClick(quint32 x, quint32 y, qint32 type, bool onoff, quint8 click_count);
void sendMouseMove(quint32 x, quint32 y, bool leaving);
void sendMouseWheel(qint32 xdelta, qint32 ydelta);
void sendKey(quint32 keycode, bool updown);
public slots:
quint32 width() { return m_canvas.width(); }
quint32 height() { return m_canvas.height(); }
signals:
void wantLoad();
void wantUnload();
void wantResize(quint32 w, quint32 h);
void frameRendered();
void qmlWarnings(QStringList warnings);
private slots:
void doSnap();
void doLoad();
void doUnload();
void doResize(quint32 w, quint32 h);
/*
void qmlStatus(QQuickWidget::Status status);
void qmlWarning(const QList<QQmlError> &warnings);
*/
void qmlFrame();
void qmlCheckFrame();
void qmlCopy();
};