1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
/*
* Copyright (C) 2012 Canonical Ltd.
*
* Authors:
* Guenter Schwann <guenter.schwann@canonical.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ADVANCEDCAMERASETTINGS_H
#define ADVANCEDCAMERASETTINGS_H
#include <QObject>
#include <QMultimedia>
#include <QtMultimedia/QCamera>
#include <QtMultimedia/QCameraInfoControl>
#include <QtMultimedia/QVideoDeviceSelectorControl>
#include <QtMultimedia/QCameraViewfinderSettingsControl>
#include <QtMultimedia/QCameraExposureControl>
#include <QtMultimedia/QMediaControl>
#include <QtMultimedia/QImageEncoderControl>
#include <QtMultimedia/QVideoEncoderSettingsControl>
class QCameraControl;
class QCameraFlashControl;
class AdvancedCameraSettings : public QObject
{
Q_OBJECT
Q_PROPERTY (QObject* camera READ camera WRITE setCamera NOTIFY cameraChanged)
Q_PROPERTY (QSize resolution READ resolution NOTIFY resolutionChanged)
Q_PROPERTY (QSize imageCaptureResolution READ imageCaptureResolution)
Q_PROPERTY (QSize videoRecorderResolution READ videoRecorderResolution)
Q_PROPERTY (QSize maximumResolution READ maximumResolution NOTIFY maximumResolutionChanged)
Q_PROPERTY (QSize fittingResolution READ fittingResolution NOTIFY fittingResolutionChanged)
Q_PROPERTY (QStringList videoSupportedResolutions READ videoSupportedResolutions NOTIFY videoSupportedResolutionsChanged)
Q_PROPERTY (QStringList imageSupportedResolutions READ imageSupportedResolutions NOTIFY imageSupportedResolutionsChanged)
Q_PROPERTY (bool hasFlash READ hasFlash NOTIFY hasFlashChanged)
Q_PROPERTY (bool hdrEnabled READ hdrEnabled WRITE setHdrEnabled NOTIFY hdrEnabledChanged)
Q_PROPERTY (bool hasHdr READ hasHdr NOTIFY hasHdrChanged)
Q_PROPERTY (int encodingQuality READ encodingQuality WRITE setEncodingQuality NOTIFY encodingQualityChanged)
public:
explicit AdvancedCameraSettings(QObject *parent = 0);
QObject* camera() const;
void setCamera(QObject* camera);
QSize resolution() const;
QSize imageCaptureResolution() const;
QSize videoRecorderResolution() const;
QSize maximumResolution() const;
QSize fittingResolution() const;
float getScreenAspectRatio() const;
QStringList videoSupportedResolutions();
QStringList imageSupportedResolutions();
bool hasFlash() const;
bool hasHdr() const;
bool hdrEnabled() const;
void setHdrEnabled(bool enabled);
int encodingQuality() const;
void setEncodingQuality(int quality);
void readCapabilities();
Q_SIGNALS:
void cameraChanged();
void resolutionChanged();
void maximumResolutionChanged();
void fittingResolutionChanged();
void hasFlashChanged();
void hasHdrChanged();
void hdrEnabledChanged();
void encodingQualityChanged();
void videoSupportedResolutionsChanged();
void imageSupportedResolutionsChanged();
private Q_SLOTS:
void onCameraStatusChanged(QCamera::Status status);
void onExposureValueChanged(int parameter);
void onSelectedDeviceChanged(int index);
private:
QVideoDeviceSelectorControl* selectorFromCamera(QCamera *camera) const;
QCameraViewfinderSettingsControl* viewfinderFromCamera(QCamera *camera) const;
QCameraControl *camcontrolFromCamera(QCamera *camera) const;
QCameraFlashControl* flashControlFromCamera(QCamera* camera) const;
QCameraExposureControl* exposureControlFromCamera(QCamera *camera) const;
QCamera* cameraFromCameraObject(QObject* cameraObject) const;
QMediaControl* mediaControlFromCamera(QCamera *camera, const char* iid) const;
QImageEncoderControl* imageEncoderControlFromCamera(QCamera *camera) const;
QVideoEncoderSettingsControl* videoEncoderControlFromCamera(QCamera *camera) const;
QCameraInfoControl* cameraInfoControlFromCamera(QCamera *camera) const;
QObject* m_cameraObject;
QCamera* m_camera;
QVideoDeviceSelectorControl* m_deviceSelector;
QCameraViewfinderSettingsControl* m_viewFinderControl;
QCameraControl* m_cameraControl;
QCameraFlashControl* m_cameraFlashControl;
QCameraExposureControl* m_cameraExposureControl;
QImageEncoderControl* m_imageEncoderControl;
QVideoEncoderSettingsControl* m_videoEncoderControl;
QCameraInfoControl* m_cameraInfoControl;
bool m_hdrEnabled;
QStringList m_videoSupportedResolutions;
QStringList m_imageSupportedResolutions;
};
#endif // ADVANCEDCAMERASETTINGS_H
|