summaryrefslogtreecommitdiff
path: root/src/imports
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/multimedia/multimedia.cpp2
-rw-r--r--src/imports/multimedia/qdeclarativecameraimageprocessing.cpp62
-rw-r--r--src/imports/multimedia/qdeclarativecameraimageprocessing_p.h13
3 files changed, 77 insertions, 0 deletions
diff --git a/src/imports/multimedia/multimedia.cpp b/src/imports/multimedia/multimedia.cpp
index 28829adfb..6d9292221 100644
--- a/src/imports/multimedia/multimedia.cpp
+++ b/src/imports/multimedia/multimedia.cpp
@@ -158,6 +158,8 @@ public:
trUtf8("CameraFocus is provided by Camera"));
qmlRegisterUncreatableType<QDeclarativeCameraExposure, 1>(uri, 5, 11, "CameraExposure",
trUtf8("CameraExposure is provided by Camera"));
+ qmlRegisterUncreatableType<QDeclarativeCameraImageProcessing, 3>(uri, 5, 11, "CameraImageProcessing",
+ trUtf8("CameraImageProcessing is provided by Camera"));
qmlRegisterType<QDeclarativeMediaMetaData>();
qmlRegisterType<QAbstractVideoFilter>();
diff --git a/src/imports/multimedia/qdeclarativecameraimageprocessing.cpp b/src/imports/multimedia/qdeclarativecameraimageprocessing.cpp
index e8a816727..8e14a7945 100644
--- a/src/imports/multimedia/qdeclarativecameraimageprocessing.cpp
+++ b/src/imports/multimedia/qdeclarativecameraimageprocessing.cpp
@@ -84,6 +84,18 @@ QDeclarativeCameraImageProcessing::QDeclarativeCameraImageProcessing(QCamera *ca
QObject(parent)
{
m_imageProcessing = camera->imageProcessing();
+
+ connect(camera, QOverload<bool>::of(&QCamera::availabilityChanged),
+ this, &QDeclarativeCameraImageProcessing::availableChanged);
+ connect(camera, &QCamera::statusChanged, [this](QCamera::Status status) {
+ if (status != QCamera::UnloadedStatus && status != QCamera::LoadedStatus
+ && status != QCamera::ActiveStatus) {
+ return;
+ }
+
+ emit supportedColorFiltersChanged();
+ emit supportedWhiteBalanceModesChanged();
+ });
}
QDeclarativeCameraImageProcessing::~QDeclarativeCameraImageProcessing()
@@ -272,6 +284,56 @@ QDeclarativeCameraImageProcessing::ColorFilter QDeclarativeCameraImageProcessing
return ColorFilter(m_imageProcessing->colorFilter());
}
+/*!
+ \qmlproperty bool QtMultimedia::CameraImageProcessing::isAvailable
+
+ This property holds if image processing related settings are supported by this camera.
+
+ \since 5.11
+*/
+bool QDeclarativeCameraImageProcessing::isAvailable() const
+{
+ return m_imageProcessing->isAvailable();
+}
+
+/*!
+ \qmlproperty list<ColorFilter> QtMultimedia::CameraImageProcessing::supportedColorFilters
+
+ This property holds the supported color filters by this camera.
+
+ \since 5.11
+*/
+QVariantList QDeclarativeCameraImageProcessing::supportedColorFilters() const
+{
+ QVariantList supportedFilters;
+
+ for (int i = int(ColorFilterNone); i <= int(ColorFilterVendor); ++i) {
+ if (m_imageProcessing->isColorFilterSupported((QCameraImageProcessing::ColorFilter) i))
+ supportedFilters.append(i);
+ }
+
+ return supportedFilters;
+}
+
+/*!
+ \qmlproperty list<WhiteBalanceMode> QtMultimedia::CameraImageProcessing::supportedWhiteBalanceModes
+
+ This property holds the supported white balance modes by this camera.
+
+ \since 5.11
+*/
+QVariantList QDeclarativeCameraImageProcessing::supportedWhiteBalanceModes() const
+{
+ QVariantList supportedModes;
+
+ for (int i = int(WhiteBalanceAuto); i <= int(WhiteBalanceVendor); i++) {
+ if (m_imageProcessing->isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceMode(i)))
+ supportedModes.append(i);
+ }
+
+ return supportedModes;
+}
+
void QDeclarativeCameraImageProcessing::setColorFilter(ColorFilter filter)
{
if (this->colorFilter() != filter) {
diff --git a/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h b/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h
index eb755d87c..390164250 100644
--- a/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h
+++ b/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h
@@ -72,6 +72,11 @@ class QDeclarativeCameraImageProcessing : public QObject
Q_PROPERTY(qreal sharpeningLevel READ sharpeningLevel WRITE setSharpeningLevel NOTIFY sharpeningLevelChanged)
Q_PROPERTY(qreal denoisingLevel READ denoisingLevel WRITE setDenoisingLevel NOTIFY denoisingLevelChanged)
Q_PROPERTY(ColorFilter colorFilter READ colorFilter WRITE setColorFilter NOTIFY colorFilterChanged REVISION 1)
+ Q_PROPERTY(bool available READ isAvailable NOTIFY availableChanged REVISION 3)
+ Q_PROPERTY(QVariantList supportedColorFilters READ supportedColorFilters
+ NOTIFY supportedColorFiltersChanged REVISION 3)
+ Q_PROPERTY(QVariantList supportedWhiteBalanceModes READ supportedWhiteBalanceModes
+ NOTIFY supportedWhiteBalanceModesChanged REVISION 3)
public:
enum WhiteBalanceMode {
WhiteBalanceAuto = QCameraImageProcessing::WhiteBalanceAuto,
@@ -112,6 +117,10 @@ public:
ColorFilter colorFilter() const;
+ bool isAvailable() const;
+ QVariantList supportedColorFilters() const;
+ QVariantList supportedWhiteBalanceModes() const;
+
public Q_SLOTS:
void setWhiteBalanceMode(QDeclarativeCameraImageProcessing::WhiteBalanceMode mode) const;
void setManualWhiteBalance(qreal colorTemp) const;
@@ -136,6 +145,10 @@ Q_SIGNALS:
void colorFilterChanged();
+ void availableChanged();
+ void supportedColorFiltersChanged();
+ void supportedWhiteBalanceModesChanged();
+
private:
friend class QDeclarativeCamera;
QDeclarativeCameraImageProcessing(QCamera *camera, QObject *parent = 0);