3#include <QLoggingCategory>
4#include "ConnecterPlayer.h"
5#include "ConnectPlayer.h"
7#include "PluginClient.h"
9static Q_LOGGING_CATEGORY(log,
"Player.Connecter")
14 qDebug(log) << Q_FUNC_INFO;
17CConnecterPlayer::~CConnecterPlayer()
19 qDebug(log) << Q_FUNC_INFO;
29 qDebug(log) << Q_FUNC_INFO;
32 nRet = SetParameter(&m_Parameters);
38int CConnecterPlayer::InitialMenu()
44 m_pRecord =
new QAction(
45 QIcon::fromTheme(
"media-record"), tr(
"Record"), &m_Menu);
46 m_pRecord->setCheckable(
true);
47 check = connect(m_pRecord, SIGNAL(toggled(
bool)),
48 this, SLOT(slotRecord(
bool)));
51 m_pRecordPause =
new QAction(
52 QIcon::fromTheme(
"media-playback-pause"), tr(
"Record pause"), &m_Menu);
53 m_pRecordPause->setCheckable(
true);
54 m_pRecordPause->setEnabled(
false);
55 check = connect(m_pRecordPause, SIGNAL(toggled(
bool)),
56 this, SIGNAL(sigRecordPause(
bool)));
60 m_pScreenShot =
new QAction(QIcon::fromTheme(
"camera-photo"),
61 tr(
"ScreenShot"), &m_Menu);
62 check = connect(m_pScreenShot, SIGNAL(triggered()),
63 this, SLOT(slotScreenShot()));
66#ifdef HAVE_QVideoWidget
67 m_Menu.addAction(m_Player.m_paStart);
69 m_Player.m_paStart, &QAction::toggle);
71 check = connect(m_Player.m_paStart, SIGNAL(toggled(
bool)),
72 this, SIGNAL(sigStart(
bool)));
75 m_Menu.addAction(m_Player.m_paPause);
76 check = connect(m_Player.m_paPause, SIGNAL(toggled(
bool)),
77 this, SIGNAL(sigPause(
bool)));
81 m_Menu.addAction(m_Player.m_paRecord);
82 check = connect(m_Player.m_paRecord, SIGNAL(toggled(
bool)),
83 m_pRecord ,SIGNAL(toggled(
bool)));
86 m_Menu.addAction(m_Player.m_paRecordPause);
87 check = connect(m_Player.m_paRecordPause, SIGNAL(toggled(
bool)),
88 m_pRecordPause, SIGNAL(toggled(
bool)));
92 m_Menu.addAction(m_Player.m_paScreenShot);
93 check = connect(m_Player.m_paScreenShot, &QAction::triggered,
94 m_pScreenShot, &QAction::triggered);
97 m_Menu.addSeparator();
99 m_Menu.addAction(m_Player.m_paSettings);
100 check = connect(m_Player.m_paSettings, &QAction::triggered,
101 m_pSettings, &QAction::triggered);
106 m_Player.SetParameter(&m_Parameters);
109 check = connect(&m_Player, SIGNAL(sigChangePosition(qint64)),
110 this, SIGNAL(sigChangePosition(qint64)));
113 QAction* pStart = m_Menu.addAction(
114 QIcon::fromTheme(
"media-playback-start"), tr(
"Start"));
115 pStart->setCheckable(
true);
117 pStart, &QAction::toggle);
119 check = connect(pStart, &QAction::toggled,
120 this, [&](
bool checked){
121 QAction* p = qobject_cast<QAction*>(sender());
124 p->setIcon(QIcon::fromTheme(
"media-playback-stop"));
125 p->setText(tr(
"Stop"));
126 m_pPause->setEnabled(
true);
127 m_pPause->setChecked(
false);
128 m_pScreenShot->setEnabled(
true);
130 m_pRecord->setEnabled(
true);
131 m_pRecord->setChecked(
false);
132 m_pRecordPause->setEnabled(
true);
133 m_pRecordPause->setChecked(
false);
136 p->setIcon(QIcon::fromTheme(
"media-playback-start"));
137 p->setText(tr(
"Start"));
138 m_pPause->setEnabled(
false);
139 m_pPause->setChecked(
false);
140 m_pScreenShot->setEnabled(
false);
142 m_pRecord->setEnabled(
false);
143 m_pRecord->setChecked(
false);
144 m_pRecordPause->setEnabled(
false);
145 m_pRecordPause->setChecked(
false);
148 emit sigStart(checked);
151 m_pPause = m_Menu.addAction(
152 QIcon::fromTheme(
"media-playback-pause"), tr(
"pause"));
153 m_pPause->setCheckable(
true);
154 check = connect(m_pPause, SIGNAL(toggled(
bool)),
155 this, SIGNAL(sigPause(
bool)));
158 m_Menu.addAction(m_pRecord);
159 m_Menu.addAction(m_pRecordPause);
161 m_Menu.addAction(m_pScreenShot);
162 m_Menu.addSeparator();
163 m_Menu.addAction(m_pSettings);
170 qDebug(log) << Q_FUNC_INFO;
178 QDialog* pDlg =
new CDlgPlayer(&m_Parameters, parent);
188void CConnecterPlayer::slotScreenShot()
190 emit sigScreenShot();
199QVideoSink *CConnecterPlayer::GetVideoSink()
201 return m_Player.videoSink();
204void CConnecterPlayer::slotPositionChanged(qint64 pos, qint64 duration)
206 m_Player.slotPositionChanged(pos, duration);
209void CConnecterPlayer::slotPlaybackError(
210 QMediaPlayer::Error error,
const QString &errorString)
212 if(m_Player.m_paStart->isChecked())
213 m_Player.m_paStart->setChecked(
false);
216void CConnecterPlayer::slotPlaybackStateChanged(QMediaPlayer::PlaybackState state)
218 if(QMediaPlayer::StoppedState == state
219 && m_Player.m_paStart->isChecked())
220 m_Player.m_paStart->setChecked(
false);
224void CConnecterPlayer::slotRecordStateChanged(QMediaRecorder::RecorderState state)
226 if(QMediaRecorder::StoppedState == state
227 && m_Player.m_paRecord->isCheckable())
228 m_Player.m_paRecord->setChecked(
false);
virtual qint16 Version() override
Version.
virtual int Clean() override
Clean parameters and resource.
virtual CConnect * InstanceConnect() override
New connect.
virtual QDialog * OnOpenDialogSettings(QWidget *parent) override
Open settgins dialog.
virtual int Initial() override
Initial parameters and resource.
It starts a background thread by default.
virtual int Initial() override
Initial parameters and resource.
virtual int Clean() override
Clean parameters and resource.
void sigConnected()
Successful connection signal.
virtual QWidget * GetViewer()=0
Get Viewer.