Merge remote-tracking branch 'origin/5.4' into 5.5
Conflicts: src/multimedia/playback/playlistfileparser.cpp src/plugins/windowsaudio/qwindowsaudiodeviceinfo.cpp Change-Id: I52950def2b8283ae15797d05d4ead6a1256eba19
This commit is contained in:
@@ -106,6 +106,11 @@ void QDeclarativeAudioSample::componentComplete()
|
||||
m_complete = true;
|
||||
}
|
||||
|
||||
/*!
|
||||
\qmlproperty url QtAudioEngine::AudioSample::source
|
||||
|
||||
This property holds the source URL of the audio sample.
|
||||
*/
|
||||
QUrl QDeclarativeAudioSample::source() const
|
||||
{
|
||||
return m_url;
|
||||
|
||||
@@ -58,6 +58,12 @@ QML_DECLARE_TYPE(QSoundEffect)
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static QObject *multimedia_global_object(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
|
||||
{
|
||||
Q_UNUSED(qmlEngine)
|
||||
return new QDeclarativeMultimediaGlobal(jsEngine);
|
||||
}
|
||||
|
||||
class QMultimediaDeclarativeModule : public QQmlExtensionPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -99,7 +105,7 @@ public:
|
||||
qmlRegisterType<QSoundEffect>(uri, 5, 3, "SoundEffect");
|
||||
|
||||
// 5.4 types
|
||||
qmlRegisterSingletonType(uri, 5, 4, "QtMultimedia", QDeclarativeMultimedia::initGlobalObject);
|
||||
qmlRegisterSingletonType<QDeclarativeMultimediaGlobal>(uri, 5, 4, "QtMultimedia", multimedia_global_object);
|
||||
qmlRegisterRevision<QDeclarativeCamera, 1>(uri, 5, 4);
|
||||
qmlRegisterUncreatableType<QDeclarativeCameraViewfinder>(uri, 5, 4, "CameraViewfinder",
|
||||
trUtf8("CameraViewfinder is provided by Camera"));
|
||||
|
||||
@@ -3,7 +3,8 @@ import QtQuick.tooling 1.1
|
||||
// This file describes the plugin-supplied types contained in the library.
|
||||
// It is used for QML tooling purposes only.
|
||||
//
|
||||
// This file was auto-generated with the command 'qmlplugindump -notrelocatable QtMultimedia 5.0'.
|
||||
// This file was auto-generated by:
|
||||
// 'qmlplugindump -nonrelocatable QtMultimedia 5.4'
|
||||
|
||||
Module {
|
||||
Component {
|
||||
@@ -76,6 +77,14 @@ Module {
|
||||
"LockFocus": 4
|
||||
}
|
||||
}
|
||||
Enum {
|
||||
name: "Position"
|
||||
values: {
|
||||
"UnspecifiedPosition": 0,
|
||||
"BackFace": 1,
|
||||
"FrontFace": 2
|
||||
}
|
||||
}
|
||||
Property { name: "state"; type: "QCamera::State"; isReadonly: true }
|
||||
Property { name: "status"; type: "QCamera::Status"; isReadonly: true }
|
||||
Property { name: "captureMode"; type: "QCamera::CaptureModes" }
|
||||
@@ -232,6 +241,14 @@ Module {
|
||||
prototype: "QObject"
|
||||
exports: ["QtMultimedia/Camera 5.0"]
|
||||
exportMetaObjectRevisions: [0]
|
||||
Enum {
|
||||
name: "Position"
|
||||
values: {
|
||||
"UnspecifiedPosition": 0,
|
||||
"BackFace": 1,
|
||||
"FrontFace": 2
|
||||
}
|
||||
}
|
||||
Enum {
|
||||
name: "CaptureMode"
|
||||
values: {
|
||||
@@ -357,6 +374,10 @@ Module {
|
||||
"ResourceMissing": 3
|
||||
}
|
||||
}
|
||||
Property { name: "deviceId"; revision: 1; type: "string" }
|
||||
Property { name: "position"; revision: 1; type: "Position" }
|
||||
Property { name: "displayName"; revision: 1; type: "string"; isReadonly: true }
|
||||
Property { name: "orientation"; revision: 1; type: "int"; isReadonly: true }
|
||||
Property { name: "captureMode"; type: "CaptureMode" }
|
||||
Property { name: "cameraState"; type: "State" }
|
||||
Property { name: "cameraStatus"; type: "Status"; isReadonly: true }
|
||||
@@ -395,12 +416,30 @@ Module {
|
||||
isReadonly: true
|
||||
isPointer: true
|
||||
}
|
||||
Property {
|
||||
name: "metaData"
|
||||
revision: 1
|
||||
type: "QDeclarativeMediaMetaData"
|
||||
isReadonly: true
|
||||
isPointer: true
|
||||
}
|
||||
Property {
|
||||
name: "viewfinder"
|
||||
revision: 1
|
||||
type: "QDeclarativeCameraViewfinder"
|
||||
isReadonly: true
|
||||
isPointer: true
|
||||
}
|
||||
Signal { name: "errorChanged" }
|
||||
Signal {
|
||||
name: "error"
|
||||
Parameter { name: "errorCode"; type: "QDeclarativeCamera::Error" }
|
||||
Parameter { name: "errorString"; type: "string" }
|
||||
}
|
||||
Signal { name: "deviceIdChanged"; revision: 1 }
|
||||
Signal { name: "positionChanged"; revision: 1 }
|
||||
Signal { name: "displayNameChanged"; revision: 1 }
|
||||
Signal { name: "orientationChanged"; revision: 1 }
|
||||
Signal {
|
||||
name: "cameraStateChanged"
|
||||
Parameter { type: "QDeclarativeCamera::State" }
|
||||
@@ -450,6 +489,7 @@ Module {
|
||||
name: "QDeclarativeCameraCapture"
|
||||
prototype: "QObject"
|
||||
exports: ["QtMultimedia/CameraCapture 5.0"]
|
||||
isCreatable: false
|
||||
exportMetaObjectRevisions: [0]
|
||||
Property { name: "ready"; type: "bool"; isReadonly: true }
|
||||
Property { name: "capturedImagePath"; type: "string"; isReadonly: true }
|
||||
@@ -509,7 +549,33 @@ Module {
|
||||
name: "QDeclarativeCameraExposure"
|
||||
prototype: "QObject"
|
||||
exports: ["QtMultimedia/CameraExposure 5.0"]
|
||||
isCreatable: false
|
||||
exportMetaObjectRevisions: [0]
|
||||
Enum {
|
||||
name: "ExposureMode"
|
||||
values: {
|
||||
"ExposureAuto": 0,
|
||||
"ExposureManual": 1,
|
||||
"ExposurePortrait": 2,
|
||||
"ExposureNight": 3,
|
||||
"ExposureBacklight": 4,
|
||||
"ExposureSpotlight": 5,
|
||||
"ExposureSports": 6,
|
||||
"ExposureSnow": 7,
|
||||
"ExposureBeach": 8,
|
||||
"ExposureLargeAperture": 9,
|
||||
"ExposureSmallAperture": 10,
|
||||
"ExposureModeVendor": 1000
|
||||
}
|
||||
}
|
||||
Enum {
|
||||
name: "MeteringMode"
|
||||
values: {
|
||||
"MeteringMatrix": 1,
|
||||
"MeteringAverage": 2,
|
||||
"MeteringSpot": 3
|
||||
}
|
||||
}
|
||||
Property { name: "exposureCompensation"; type: "double" }
|
||||
Property { name: "iso"; type: "int"; isReadonly: true }
|
||||
Property { name: "shutterSpeed"; type: "double"; isReadonly: true }
|
||||
@@ -517,9 +583,9 @@ Module {
|
||||
Property { name: "manualShutterSpeed"; type: "double" }
|
||||
Property { name: "manualAperture"; type: "double" }
|
||||
Property { name: "manualIso"; type: "double" }
|
||||
Property { name: "exposureMode"; type: "QDeclarativeCamera::ExposureMode" }
|
||||
Property { name: "exposureMode"; type: "ExposureMode" }
|
||||
Property { name: "spotMeteringPoint"; type: "QPointF" }
|
||||
Property { name: "meteringMode"; type: "QDeclarativeCamera::MeteringMode" }
|
||||
Property { name: "meteringMode"; type: "MeteringMode" }
|
||||
Signal {
|
||||
name: "isoSensitivityChanged"
|
||||
Parameter { type: "int" }
|
||||
@@ -550,11 +616,11 @@ Module {
|
||||
}
|
||||
Signal {
|
||||
name: "exposureModeChanged"
|
||||
Parameter { type: "QDeclarativeCamera::ExposureMode" }
|
||||
Parameter { type: "ExposureMode" }
|
||||
}
|
||||
Signal {
|
||||
name: "meteringModeChanged"
|
||||
Parameter { type: "QDeclarativeCamera::MeteringMode" }
|
||||
Parameter { type: "MeteringMode" }
|
||||
}
|
||||
Signal {
|
||||
name: "spotMeteringPointChanged"
|
||||
@@ -562,7 +628,7 @@ Module {
|
||||
}
|
||||
Method {
|
||||
name: "setExposureMode"
|
||||
Parameter { type: "QDeclarativeCamera::ExposureMode" }
|
||||
Parameter { type: "ExposureMode" }
|
||||
}
|
||||
Method {
|
||||
name: "setExposureCompensation"
|
||||
@@ -588,38 +654,75 @@ Module {
|
||||
name: "QDeclarativeCameraFlash"
|
||||
prototype: "QObject"
|
||||
exports: ["QtMultimedia/CameraFlash 5.0"]
|
||||
isCreatable: false
|
||||
exportMetaObjectRevisions: [0]
|
||||
Enum {
|
||||
name: "FlashMode"
|
||||
values: {
|
||||
"FlashAuto": 1,
|
||||
"FlashOff": 2,
|
||||
"FlashOn": 4,
|
||||
"FlashRedEyeReduction": 8,
|
||||
"FlashFill": 16,
|
||||
"FlashTorch": 32,
|
||||
"FlashVideoLight": 64,
|
||||
"FlashSlowSyncFrontCurtain": 128,
|
||||
"FlashSlowSyncRearCurtain": 256,
|
||||
"FlashManual": 512
|
||||
}
|
||||
}
|
||||
Property { name: "ready"; type: "bool"; isReadonly: true }
|
||||
Property { name: "mode"; type: "int" }
|
||||
Property { name: "mode"; type: "FlashMode" }
|
||||
Signal {
|
||||
name: "flashReady"
|
||||
Parameter { name: "status"; type: "bool" }
|
||||
}
|
||||
Signal {
|
||||
name: "flashModeChanged"
|
||||
Parameter { type: "int" }
|
||||
Parameter { type: "FlashMode" }
|
||||
}
|
||||
Method {
|
||||
name: "setFlashMode"
|
||||
Parameter { type: "int" }
|
||||
Parameter { type: "FlashMode" }
|
||||
}
|
||||
}
|
||||
Component {
|
||||
name: "QDeclarativeCameraFocus"
|
||||
prototype: "QObject"
|
||||
exports: ["QtMultimedia/CameraFocus 5.0"]
|
||||
isCreatable: false
|
||||
exportMetaObjectRevisions: [0]
|
||||
Property { name: "focusMode"; type: "QDeclarativeCamera::FocusMode" }
|
||||
Property { name: "focusPointMode"; type: "QDeclarativeCamera::FocusPointMode" }
|
||||
Enum {
|
||||
name: "FocusMode"
|
||||
values: {
|
||||
"FocusManual": 1,
|
||||
"FocusHyperfocal": 2,
|
||||
"FocusInfinity": 4,
|
||||
"FocusAuto": 8,
|
||||
"FocusContinuous": 16,
|
||||
"FocusMacro": 32
|
||||
}
|
||||
}
|
||||
Enum {
|
||||
name: "FocusPointMode"
|
||||
values: {
|
||||
"FocusPointAuto": 0,
|
||||
"FocusPointCenter": 1,
|
||||
"FocusPointFaceDetection": 2,
|
||||
"FocusPointCustom": 3
|
||||
}
|
||||
}
|
||||
Property { name: "focusMode"; type: "FocusMode" }
|
||||
Property { name: "focusPointMode"; type: "FocusPointMode" }
|
||||
Property { name: "customFocusPoint"; type: "QPointF" }
|
||||
Property { name: "focusZones"; type: "QObject"; isReadonly: true; isPointer: true }
|
||||
Signal {
|
||||
name: "focusModeChanged"
|
||||
Parameter { type: "QDeclarativeCamera::FocusMode" }
|
||||
Parameter { type: "FocusMode" }
|
||||
}
|
||||
Signal {
|
||||
name: "focusPointModeChanged"
|
||||
Parameter { type: "QDeclarativeCamera::FocusPointMode" }
|
||||
Parameter { type: "FocusPointMode" }
|
||||
}
|
||||
Signal {
|
||||
name: "customFocusPointChanged"
|
||||
@@ -627,11 +730,11 @@ Module {
|
||||
}
|
||||
Method {
|
||||
name: "setFocusMode"
|
||||
Parameter { type: "QDeclarativeCamera::FocusMode" }
|
||||
Parameter { type: "FocusMode" }
|
||||
}
|
||||
Method {
|
||||
name: "setFocusPointMode"
|
||||
Parameter { name: "mode"; type: "QDeclarativeCamera::FocusPointMode" }
|
||||
Parameter { name: "mode"; type: "FocusPointMode" }
|
||||
}
|
||||
Method {
|
||||
name: "setCustomFocusPoint"
|
||||
@@ -640,18 +743,19 @@ Module {
|
||||
Method {
|
||||
name: "isFocusModeSupported"
|
||||
type: "bool"
|
||||
Parameter { name: "mode"; type: "QDeclarativeCamera::FocusMode" }
|
||||
Parameter { name: "mode"; type: "FocusMode" }
|
||||
}
|
||||
Method {
|
||||
name: "isFocusPointModeSupported"
|
||||
type: "bool"
|
||||
Parameter { name: "mode"; type: "QDeclarativeCamera::FocusPointMode" }
|
||||
Parameter { name: "mode"; type: "FocusPointMode" }
|
||||
}
|
||||
}
|
||||
Component {
|
||||
name: "QDeclarativeCameraImageProcessing"
|
||||
prototype: "QObject"
|
||||
exports: ["QtMultimedia/CameraImageProcessing 5.0"]
|
||||
isCreatable: false
|
||||
exportMetaObjectRevisions: [0]
|
||||
Enum {
|
||||
name: "WhiteBalanceMode"
|
||||
@@ -727,6 +831,7 @@ Module {
|
||||
name: "QDeclarativeCameraRecorder"
|
||||
prototype: "QObject"
|
||||
exports: ["QtMultimedia/CameraRecorder 5.0"]
|
||||
isCreatable: false
|
||||
exportMetaObjectRevisions: [0]
|
||||
Enum {
|
||||
name: "RecorderState"
|
||||
@@ -922,6 +1027,119 @@ Module {
|
||||
Parameter { name: "encodingMode"; type: "EncodingMode" }
|
||||
}
|
||||
}
|
||||
Component {
|
||||
name: "QDeclarativeCameraViewfinder"
|
||||
prototype: "QObject"
|
||||
exports: ["QtMultimedia/CameraViewfinder 5.4"]
|
||||
isCreatable: false
|
||||
exportMetaObjectRevisions: [0]
|
||||
Property { name: "resolution"; type: "QSize" }
|
||||
Property { name: "minimumFrameRate"; type: "double" }
|
||||
Property { name: "maximumFrameRate"; type: "double" }
|
||||
}
|
||||
Component {
|
||||
name: "QDeclarativeMediaMetaData"
|
||||
prototype: "QObject"
|
||||
Property { name: "title"; type: "QVariant" }
|
||||
Property { name: "subTitle"; type: "QVariant" }
|
||||
Property { name: "author"; type: "QVariant" }
|
||||
Property { name: "comment"; type: "QVariant" }
|
||||
Property { name: "description"; type: "QVariant" }
|
||||
Property { name: "category"; type: "QVariant" }
|
||||
Property { name: "genre"; type: "QVariant" }
|
||||
Property { name: "year"; type: "QVariant" }
|
||||
Property { name: "date"; type: "QVariant" }
|
||||
Property { name: "userRating"; type: "QVariant" }
|
||||
Property { name: "keywords"; type: "QVariant" }
|
||||
Property { name: "language"; type: "QVariant" }
|
||||
Property { name: "publisher"; type: "QVariant" }
|
||||
Property { name: "copyright"; type: "QVariant" }
|
||||
Property { name: "parentalRating"; type: "QVariant" }
|
||||
Property { name: "ratingOrganization"; type: "QVariant" }
|
||||
Property { name: "size"; type: "QVariant" }
|
||||
Property { name: "mediaType"; type: "QVariant" }
|
||||
Property { name: "duration"; type: "QVariant" }
|
||||
Property { name: "audioBitRate"; type: "QVariant" }
|
||||
Property { name: "audioCodec"; type: "QVariant" }
|
||||
Property { name: "averageLevel"; type: "QVariant" }
|
||||
Property { name: "channelCount"; type: "QVariant" }
|
||||
Property { name: "peakValue"; type: "QVariant" }
|
||||
Property { name: "sampleRate"; type: "QVariant" }
|
||||
Property { name: "albumTitle"; type: "QVariant" }
|
||||
Property { name: "albumArtist"; type: "QVariant" }
|
||||
Property { name: "contributingArtist"; type: "QVariant" }
|
||||
Property { name: "composer"; type: "QVariant" }
|
||||
Property { name: "conductor"; type: "QVariant" }
|
||||
Property { name: "lyrics"; type: "QVariant" }
|
||||
Property { name: "mood"; type: "QVariant" }
|
||||
Property { name: "trackNumber"; type: "QVariant" }
|
||||
Property { name: "trackCount"; type: "QVariant" }
|
||||
Property { name: "coverArtUrlSmall"; type: "QVariant" }
|
||||
Property { name: "coverArtUrlLarge"; type: "QVariant" }
|
||||
Property { name: "resolution"; type: "QVariant" }
|
||||
Property { name: "pixelAspectRatio"; type: "QVariant" }
|
||||
Property { name: "videoFrameRate"; type: "QVariant" }
|
||||
Property { name: "videoBitRate"; type: "QVariant" }
|
||||
Property { name: "videoCodec"; type: "QVariant" }
|
||||
Property { name: "posterUrl"; type: "QVariant" }
|
||||
Property { name: "chapterNumber"; type: "QVariant" }
|
||||
Property { name: "director"; type: "QVariant" }
|
||||
Property { name: "leadPerformer"; type: "QVariant" }
|
||||
Property { name: "writer"; type: "QVariant" }
|
||||
Property { name: "cameraManufacturer"; type: "QVariant" }
|
||||
Property { name: "cameraModel"; type: "QVariant" }
|
||||
Property { name: "event"; type: "QVariant" }
|
||||
Property { name: "subject"; type: "QVariant" }
|
||||
Property { name: "orientation"; type: "QVariant" }
|
||||
Property { name: "exposureTime"; type: "QVariant" }
|
||||
Property { name: "fNumber"; type: "QVariant" }
|
||||
Property { name: "exposureProgram"; type: "QVariant" }
|
||||
Property { name: "isoSpeedRatings"; type: "QVariant" }
|
||||
Property { name: "exposureBiasValue"; type: "QVariant" }
|
||||
Property { name: "dateTimeOriginal"; type: "QVariant" }
|
||||
Property { name: "dateTimeDigitized"; type: "QVariant" }
|
||||
Property { name: "subjectDistance"; type: "QVariant" }
|
||||
Property { name: "meteringMode"; type: "QVariant" }
|
||||
Property { name: "lightSource"; type: "QVariant" }
|
||||
Property { name: "flash"; type: "QVariant" }
|
||||
Property { name: "focalLength"; type: "QVariant" }
|
||||
Property { name: "exposureMode"; type: "QVariant" }
|
||||
Property { name: "whiteBalance"; type: "QVariant" }
|
||||
Property { name: "digitalZoomRatio"; type: "QVariant" }
|
||||
Property { name: "focalLengthIn35mmFilm"; type: "QVariant" }
|
||||
Property { name: "sceneCaptureType"; type: "QVariant" }
|
||||
Property { name: "gainControl"; type: "QVariant" }
|
||||
Property { name: "contrast"; type: "QVariant" }
|
||||
Property { name: "saturation"; type: "QVariant" }
|
||||
Property { name: "sharpness"; type: "QVariant" }
|
||||
Property { name: "deviceSettingDescription"; type: "QVariant" }
|
||||
Property { name: "gpsLatitude"; type: "QVariant" }
|
||||
Property { name: "gpsLongitude"; type: "QVariant" }
|
||||
Property { name: "gpsAltitude"; type: "QVariant" }
|
||||
Property { name: "gpsTimeStamp"; type: "QVariant" }
|
||||
Property { name: "gpsSatellites"; type: "QVariant" }
|
||||
Property { name: "gpsStatus"; type: "QVariant" }
|
||||
Property { name: "gpsDOP"; type: "QVariant" }
|
||||
Property { name: "gpsSpeed"; type: "QVariant" }
|
||||
Property { name: "gpsTrack"; type: "QVariant" }
|
||||
Property { name: "gpsTrackRef"; type: "QVariant" }
|
||||
Property { name: "gpsImgDirection"; type: "QVariant" }
|
||||
Property { name: "gpsImgDirectionRef"; type: "QVariant" }
|
||||
Property { name: "gpsMapDatum"; type: "QVariant" }
|
||||
Property { name: "gpsProcessingMethod"; type: "QVariant" }
|
||||
Property { name: "gpsAreaInformation"; type: "QVariant" }
|
||||
Signal { name: "metaDataChanged" }
|
||||
}
|
||||
Component {
|
||||
name: "QDeclarativeMultimediaGlobal"
|
||||
prototype: "QObject"
|
||||
exports: ["QtMultimedia/QtMultimedia 5.4"]
|
||||
isCreatable: false
|
||||
isSingleton: true
|
||||
exportMetaObjectRevisions: [0]
|
||||
Property { name: "defaultCamera"; type: "QJSValue"; isReadonly: true }
|
||||
Property { name: "availableCameras"; type: "QJSValue"; isReadonly: true }
|
||||
}
|
||||
Component {
|
||||
name: "QDeclarativeRadio"
|
||||
prototype: "QObject"
|
||||
@@ -1223,6 +1441,7 @@ Module {
|
||||
Property { name: "source"; type: "QObject"; isPointer: true }
|
||||
Property { name: "fillMode"; type: "FillMode" }
|
||||
Property { name: "orientation"; type: "int" }
|
||||
Property { name: "autoOrientation"; revision: 2; type: "bool" }
|
||||
Property { name: "sourceRect"; type: "QRectF"; isReadonly: true }
|
||||
Property { name: "contentRect"; type: "QRectF"; isReadonly: true }
|
||||
Property { name: "filters"; isList: true; isReadonly: true }
|
||||
@@ -1301,8 +1520,11 @@ Module {
|
||||
Component {
|
||||
name: "QSoundEffect"
|
||||
prototype: "QObject"
|
||||
exports: ["QtMultimedia/SoundEffect 5.0"]
|
||||
exportMetaObjectRevisions: [0]
|
||||
exports: [
|
||||
"QtMultimedia/SoundEffect 5.0",
|
||||
"QtMultimedia/SoundEffect 5.3"
|
||||
]
|
||||
exportMetaObjectRevisions: [0, 0]
|
||||
Enum {
|
||||
name: "Loop"
|
||||
values: {
|
||||
|
||||
@@ -83,7 +83,7 @@ class QDeclarativeCameraRecorder : public QObject
|
||||
Q_PROPERTY(QString actualLocation READ actualLocation NOTIFY actualLocationChanged)
|
||||
Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
|
||||
Q_PROPERTY(QString errorString READ errorString NOTIFY error)
|
||||
Q_PROPERTY(QString errorCode READ errorCode NOTIFY error)
|
||||
Q_PROPERTY(Error errorCode READ errorCode NOTIFY error)
|
||||
|
||||
public:
|
||||
enum RecorderState
|
||||
|
||||
@@ -153,27 +153,6 @@ Camera {
|
||||
\endqml
|
||||
*/
|
||||
|
||||
namespace QDeclarativeMultimedia {
|
||||
|
||||
#define FREEZE_SOURCE "(function deepFreeze(o) { "\
|
||||
" var prop, propKey;" \
|
||||
" Object.freeze(o);" \
|
||||
" for (propKey in o) {" \
|
||||
" prop = o[propKey];" \
|
||||
" if (!o.hasOwnProperty(propKey) || !(typeof prop === \"object\") || " \
|
||||
" Object.isFrozen(prop)) {" \
|
||||
" continue;" \
|
||||
" }" \
|
||||
" deepFreeze(prop);" \
|
||||
" }" \
|
||||
"})"
|
||||
|
||||
static void deepFreeze(QJSEngine *jsEngine, const QJSValue &obj)
|
||||
{
|
||||
QJSValue freezeFunc = jsEngine->evaluate(QString::fromUtf8(FREEZE_SOURCE));
|
||||
freezeFunc.call(QJSValueList() << obj);
|
||||
}
|
||||
|
||||
static QJSValue cameraInfoToJSValue(QJSEngine *jsEngine, const QCameraInfo &camera)
|
||||
{
|
||||
QJSValue o = jsEngine->newObject();
|
||||
@@ -184,29 +163,24 @@ static QJSValue cameraInfoToJSValue(QJSEngine *jsEngine, const QCameraInfo &came
|
||||
return o;
|
||||
}
|
||||
|
||||
QJSValue initGlobalObject(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
|
||||
QDeclarativeMultimediaGlobal::QDeclarativeMultimediaGlobal(QJSEngine *engine, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_engine(engine)
|
||||
{
|
||||
Q_UNUSED(qmlEngine)
|
||||
|
||||
QJSValue globalObject = jsEngine->newObject();
|
||||
|
||||
// property object defaultCamera
|
||||
globalObject.setProperty(QStringLiteral("defaultCamera"),
|
||||
cameraInfoToJSValue(jsEngine, QCameraInfo::defaultCamera()));
|
||||
|
||||
// property list<object> availableCameras
|
||||
QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
|
||||
QJSValue availableCameras = jsEngine->newArray(cameras.count());
|
||||
for (int i = 0; i < cameras.count(); ++i)
|
||||
availableCameras.setProperty(i, cameraInfoToJSValue(jsEngine, cameras.at(i)));
|
||||
globalObject.setProperty(QStringLiteral("availableCameras"), availableCameras);
|
||||
|
||||
// freeze global object to prevent properties to be modified from QML
|
||||
deepFreeze(jsEngine, globalObject);
|
||||
|
||||
return globalObject;
|
||||
}
|
||||
|
||||
QJSValue QDeclarativeMultimediaGlobal::defaultCamera() const
|
||||
{
|
||||
return cameraInfoToJSValue(m_engine, QCameraInfo::defaultCamera());
|
||||
}
|
||||
|
||||
QJSValue QDeclarativeMultimediaGlobal::availableCameras() const
|
||||
{
|
||||
QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
|
||||
QJSValue availableCameras = m_engine->newArray(cameras.count());
|
||||
for (int i = 0; i < cameras.count(); ++i)
|
||||
availableCameras.setProperty(i, cameraInfoToJSValue(m_engine, cameras.at(i)));
|
||||
return availableCameras;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@@ -46,12 +46,32 @@
|
||||
//
|
||||
|
||||
#include <QtQml/qqml.h>
|
||||
#include <QtQml/qjsvalue.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QDeclarativeMultimedia {
|
||||
QJSValue initGlobalObject(QQmlEngine *, QJSEngine *);
|
||||
}
|
||||
class QDeclarativeMultimediaGlobal : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QJSValue defaultCamera READ defaultCamera NOTIFY defaultCameraChanged)
|
||||
Q_PROPERTY(QJSValue availableCameras READ availableCameras NOTIFY availableCamerasChanged)
|
||||
|
||||
public:
|
||||
explicit QDeclarativeMultimediaGlobal(QJSEngine *engine, QObject *parent = 0);
|
||||
|
||||
QJSValue defaultCamera() const;
|
||||
QJSValue availableCameras() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
// Unused at the moment. QCameraInfo doesn't notify when cameras are added or removed,
|
||||
// but it might change in the future.
|
||||
void defaultCameraChanged();
|
||||
void availableCamerasChanged();
|
||||
|
||||
private:
|
||||
QJSEngine *m_engine;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ QDeclarativeTorch::QDeclarativeTorch(QObject *parent)
|
||||
m_flash = service ? service->requestControl<QCameraFlashControl*>() : 0;
|
||||
|
||||
if (m_exposure)
|
||||
connect(m_exposure, SIGNAL(valueChanged(int)), SLOT(parameterChanged(int)));
|
||||
connect(m_exposure, SIGNAL(actualValueChanged(int)), SLOT(parameterChanged(int)));
|
||||
|
||||
// XXX There's no signal for flash mode changed
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user