31 qDebug(log) << Q_FUNC_INFO;
33 m_pWidget =
new QVideoWidget();
40 m_Menu.setTitle(szTitle);
41 m_Menu.setToolTip(szTitle);
42 m_Menu.setStatusTip(szTitle);
43 m_Menu.setWhatsThis(szTitle);
44 m_Menu.setIcon(plugin->Icon());
45 check = m_Menu.addAction(
46 QIcon::fromTheme(
"media-playback-start"), tr(
"Start"),
47 this, SLOT(slotStart()));
49 check = m_Menu.addAction(
50 QIcon::fromTheme(
"media-playback-stop"), tr(
"Stop"),
51 this, SLOT(slotStop()));
55 &m_ScreenCapture, &QScreenCapture::errorOccurred,
56 this, [&](QScreenCapture::Error error,
const QString &errorString){
57 qDebug(log) <<
"Capture screen error occurred:" << error << errorString;
63 &m_WindowCapture, &QWindowCapture::errorOccurred,
64 this, [&](QWindowCapture::Error error,
const QString &errorString){
65 qDebug(log) <<
"Capture windows error occurred:" << error << errorString;
72 &m_Recorder, &QMediaRecorder::errorOccurred,
73 this, [&](QMediaRecorder::Error error,
const QString &errorString) {
74 qDebug(log) <<
"Recorder error occurred:" << error << errorString;
80 &m_Recorder, &QMediaRecorder::recorderStateChanged,
81 this, [&](QMediaRecorder::RecorderState state){
82 qDebug(log) <<
"Recorder state changed:" << state;
83 if(QMediaRecorder::StoppedState == state)
84 switch(m_Parameter.m_Record.GetEndAction())
86 case CParameterRecord::ENDACTION::OpenFile:
87 QDesktopServices::openUrl(QUrl::fromLocalFile(m_szRecordFile));
89 case CParameterRecord::ENDACTION::OpenFolder: {
90 QFileInfo fi(m_szRecordFile);
91 QDesktopServices::openUrl(QUrl::fromLocalFile(fi.absolutePath()));
100 &m_Recorder, &QMediaRecorder::actualLocationChanged,
101 this, [&](
const QUrl &location){
102 qInfo(log) <<
"Recorder actual location changed:" << location;
103 m_szRecordFile = location.toLocalFile();
107 &m_ImageCapture, &QImageCapture::errorOccurred,
108 this, [&](
int id, QImageCapture::Error error,
const QString &errorString) {
109 qDebug(log) <<
"Capture image error occurred:" <<
id << error << errorString;
115 &m_ImageCapture, &QImageCapture::imageCaptured,
116 this, [&](
int id,
const QImage &image){
117 qDebug(log) <<
"Capture image:" <<
id << image;
118 QString szFile = m_Parameter.m_Record.GetImageFile(
true);
119 if(!image.save(szFile,
"PNG"))
121 qCritical(log) <<
"Capture image save to file fail." << szFile;
125 qDebug(log) <<
"Capture image to file:" << szFile;
126 switch(m_Parameter.m_Record.GetEndAction())
128 case CParameterRecord::ENDACTION::OpenFile: {
129 bool bRet = QDesktopServices::openUrl(QUrl::fromLocalFile(szFile));
131 qCritical(log) <<
"Fail: Open capture image file" << szFile;
134 case CParameterRecord::ENDACTION::OpenFolder: {
135 QFileInfo fi(szFile);
136 QDesktopServices::openUrl(QUrl::fromLocalFile(fi.absolutePath()));