-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
54 lines (46 loc) · 1.67 KB
/
main.cpp
File metadata and controls
54 lines (46 loc) · 1.67 KB
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
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include "librtmp/rtmp.h"
#include "debug.h"
#include "VideoCtrl.h"
#include "CameraFilter.h"
#include "VideoSender.h"
#include "MainCtrl.h"
#include "RecordCtrl.h"
#include <QIcon>
#include "CursorPosProvider.h"
#include <QQmlContext>
#include <ConfigCtrl.h>
int main(int argc, char *argv[])
{
// 初始化网络环境
WORD version;
WSADATA wsaData;
version = MAKEWORD(1, 1);
WSAStartup(version, &wsaData);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
QGuiApplication app(argc, argv);
qmlRegisterType<VideoCtrl>("VideoCtrl", 1, 0, "VideoCtrl");
qmlRegisterType<CameraFilter>("CameraFilter", 1, 0, "CameraFilter");
qmlRegisterType<VideoSender>("VideoSender", 1, 0, "VideoSender");
qmlRegisterType<MainCtrl>("MainCtrl", 1, 0, "MainCtrl");
qmlRegisterType<RecordCtrl>("RecordCtrl", 1, 0, "RecordCtrl");
qmlRegisterType<ConfigCtrl>("ConfigCtrl", 1, 0, "ConfigCtrl");
app.setWindowIcon(QIcon(":/skins/default/icon.png"));
CursorPosProvider mousePosProvider;
QQmlApplicationEngine engine;
engine.rootContext()->setContextProperty("mousePosition", &mousePosProvider);
const QUrl url(QStringLiteral("qrc:/main.qml"));
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
&app, [url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl)
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
engine.load(url);
int ret = app.exec();
// 清理网络环境
WSACleanup();
return ret;
}