Ejemplo n.º 1
0
void QAndroidCameraFocusControl::setFocusMode(QCameraFocus::FocusModes mode)
{
    if (m_focusMode == mode || !m_session->camera() || !isFocusModeSupported(mode))
        return;

    QString focusMode = QLatin1String("fixed");

    if (mode.testFlag(QCameraFocus::HyperfocalFocus)) {
        focusMode = QLatin1String("edof");
    } else if (mode.testFlag(QCameraFocus::ManualFocus)) {
        focusMode = QLatin1String("fixed");
    } else if (mode.testFlag(QCameraFocus::AutoFocus)) {
        focusMode = QLatin1String("auto");
    } else if (mode.testFlag(QCameraFocus::MacroFocus)) {
        focusMode = QLatin1String("macro");
    } else if (mode.testFlag(QCameraFocus::ContinuousFocus)) {
        if ((m_session->captureMode().testFlag(QCamera::CaptureVideo) && m_continuousVideoFocusSupported)
                || !m_continuousPictureFocusSupported) {
            focusMode = QLatin1String("continuous-video");
        } else {
            focusMode = QLatin1String("continuous-picture");
        }
    } else if (mode.testFlag(QCameraFocus::InfinityFocus)) {
        focusMode = QLatin1String("infinity");
    }

    m_session->camera()->setFocusMode(focusMode);

    // reset focus position
    m_session->camera()->cancelAutoFocus();

    m_focusMode = mode;
    emit focusModeChanged(m_focusMode);
}
Ejemplo n.º 2
0
void CameraBinFocus::setFocusMode(QCameraFocus::FocusModes mode)
{
    if (isFocusModeSupported(mode)) {
        m_focusMode = mode;
    }
}