MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / Initial

Method Initial

Plugins/ScreenCapture/ScreenCapture.cpp:32–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32int CScreenCapture::Initial()
33{
34 bool check = false;
35 qDebug(log) << Q_FUNC_INFO;
36 Q_ASSERT(!m_pWidget);
37 m_pWidget = new QVideoWidget();
38 if(!m_pWidget) {
39 qCritical(log) << "new QVideoWidget() fail";
40 return -1;
41 }
42 m_pWidget->setFocusPolicy(Qt::WheelFocus);
43 m_pWidget->installEventFilter(this);
44
45 CPlugin* plugin = GetPlugin();
46 QString szTitle(plugin->DisplayName());
47 m_Menu.setTitle(szTitle);
48 m_Menu.setToolTip(szTitle);
49 m_Menu.setStatusTip(szTitle);
50 m_Menu.setWhatsThis(szTitle);
51 m_Menu.setIcon(plugin->Icon());
52 check = m_Menu.addAction(
53 QIcon::fromTheme("media-playback-start"), tr("Start"),
54 this, SLOT(slotStart()));
55 Q_ASSERT(check);
56 check = m_Menu.addAction(
57 QIcon::fromTheme("media-playback-stop"), tr("Stop"),
58 this, SLOT(slotStop()));
59 Q_ASSERT(check);
60
61 check = connect(
62 &m_ScreenCapture, &QScreenCapture::errorOccurred,
63 this, [&](QScreenCapture::Error error, const QString &errorString){
64 qDebug(log) << "Capture screen error occurred:" << error << errorString;
65 slotStop();
66 emit sigError(error, errorString);
67 });
68 Q_ASSERT(check);
69 check = connect(
70 &m_WindowCapture, &QWindowCapture::errorOccurred,
71 this, [&](QWindowCapture::Error error, const QString &errorString){
72 qDebug(log) << "Capture windows error occurred:" << error << errorString;
73 slotStop();
74 emit sigError(error, errorString);
75 });
76 Q_ASSERT(check);
77
78 check = connect(
79 &m_Recorder, &QMediaRecorder::errorOccurred,
80 this, [&](QMediaRecorder::Error error, const QString &errorString) {
81 qDebug(log) << "Recorder error occurred:" << error << errorString;
82 slotStop();
83 emit sigError(error, errorString);
84 });
85 Q_ASSERT(check);
86 check = connect(
87 &m_Recorder, &QMediaRecorder::recorderStateChanged,
88 this, [&](QMediaRecorder::RecorderState state){
89 qDebug(log) << "Recorder state changed:" << state;

Callers

nothing calls this directly

Calls 4

GetEndActionMethod · 0.80
GetImageFileMethod · 0.80
DisplayNameMethod · 0.45
IconMethod · 0.45

Tested by

no test coverage detected