VideoRecorder::VideoRecorder(QDeclarativeItem *parent) : QDeclarativeItem(parent) { m_camera = new QCamera(this); connect(m_camera, SIGNAL(stateChanged(QCamera::State)), SLOT(cameraStateChanged(QCamera::State))); connect(m_camera, SIGNAL(statusChanged(QCamera::Status)), SLOT(cameraStatusChanged(QCamera::Status))); connect(m_camera, SIGNAL(error(QCamera::Error)), SLOT(cameraError(QCamera::Error))); m_viewFinder = new QGraphicsVideoItem(this); m_viewFinder->setAspectRatioMode(Qt::IgnoreAspectRatio); m_camera->setViewfinder(m_viewFinder); m_camera->setCaptureMode(QCamera::CaptureVideo); m_recorder = new QMediaRecorder(m_camera, this); connect(m_recorder, SIGNAL(stateChanged(QMediaRecorder::State)), SLOT(recorderStateChanged(QMediaRecorder::State))); connect(m_recorder, SIGNAL(error(QMediaRecorder::Error)), SLOT(recorderError(QMediaRecorder::Error))); connect(m_recorder, SIGNAL(durationChanged(qint64)), SLOT(videoDurationChanged(qint64))); }
void QDeclarativeCamera::_q_updateState(QCamera::State state) { emit cameraStateChanged(QDeclarativeCamera::State(state)); }