summaryrefslogtreecommitdiffstats
path: root/doc/src/examples
diff options
context:
space:
mode:
authorMichael Goddard <michael.goddard@nokia.com>2011-06-29 13:38:46 +1000
committerMichael Goddard <michael.goddard@nokia.com>2011-06-29 13:38:46 +1000
commit2a34e88c1e1ced28e75c487cd13402e1c9cf9fa3 (patch)
treee6c1b770c5c47212792a1f9344fa034ea3e54c44 /doc/src/examples
Initial copy of QtMultimediaKit.
Comes from original repo, with SHA1: 2c82d5611655e5967f5c5095af50c0991c4378b2
Diffstat (limited to 'doc/src/examples')
-rw-r--r--doc/src/examples/audiodevices.qdoc42
-rw-r--r--doc/src/examples/audiorecorder.qdoc68
-rw-r--r--doc/src/examples/camera.qdoc79
-rw-r--r--doc/src/examples/declarative-camera.qdoc69
-rw-r--r--doc/src/examples/hapticsplayer.qdoc73
-rw-r--r--doc/src/examples/player.qdoc95
-rw-r--r--doc/src/examples/slideshow.qdoc75
7 files changed, 501 insertions, 0 deletions
diff --git a/doc/src/examples/audiodevices.qdoc b/doc/src/examples/audiodevices.qdoc
new file mode 100644
index 000000000..e629c5bd1
--- /dev/null
+++ b/doc/src/examples/audiodevices.qdoc
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example audiodevices
+ \title Audio Devices Example
+
+
+
+ This example shows how to create a simple application to list and test
+ the configuration for the various audio devices available on the device
+ or machine. This is done using the QtMobility Multimedia API.
+
+ \image audiodevices.png
+
+*/
+
+
diff --git a/doc/src/examples/audiorecorder.qdoc b/doc/src/examples/audiorecorder.qdoc
new file mode 100644
index 000000000..cc518c927
--- /dev/null
+++ b/doc/src/examples/audiorecorder.qdoc
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example audiorecorder
+ \title Audio Recorder Example
+
+
+
+ This example shows how to create a simple audio recorder using the QtMobility
+ Multimedia API.
+
+ We can easily setup the capture when we create the objects using a
+ QMediaRecorder initialized with a QAudioCaptureSource object.
+
+ \snippet snippets/multimedia-snippets/audiorecorder.cpp create-objs-1
+
+ Then we set up the display of a list of available sources to use
+
+ \snippet snippets/multimedia-snippets/audiorecorder.cpp device-list
+
+ And available codecs
+
+ \snippet snippets/multimedia-snippets/audiorecorder.cpp codec-list
+
+ We display a dialog for the user to select the appropriate codec and the
+ input device to capture. Once selected we can use user interface objects
+ like buttons to start and stop the recording and display elapsed time.
+
+ \snippet snippets/multimedia-snippets/audiorecorder.cpp get-device
+
+ Then use signals to indicate a change to the output filename, the codec
+ and the audio source.
+
+ When the button to record is pushed the toggleRecord() slot will start
+ or stop the recording process using the \l{QMediaRecorder::record()}
+ and \l{QMediaRecorder::stop()} functions of the QMediaRecorder object.
+
+ \snippet snippets/multimedia-snippets/audiorecorder.cpp toggle-record
+
+
+*/
+
+
diff --git a/doc/src/examples/camera.qdoc b/doc/src/examples/camera.qdoc
new file mode 100644
index 000000000..dcf4dadfc
--- /dev/null
+++ b/doc/src/examples/camera.qdoc
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+
+/*!
+
+\example camera
+\title Camera Example
+\brief The Camera Example shows how to use the API to capture a still image
+or video.
+
+
+
+The Camera Example demonstrates how you can use the QtMultimediaKit to implement
+some basic Camera functionality to take still images and record video clips
+with audio.
+
+A Camera class is created that will act as our Camera. It has a user interface,
+control functions, setting values and a means of defining the location where
+the image or video clip is to be saved. It will also store the image and video
+settings.
+
+The Camera class contains an instance of \l {QCamera}, the API class interface to
+the hardware. It also has an instance of \l {QCameraImageCapture} to take still images
+and an instance of \l {QMediaRecorder} to record video. It also contains the user
+interface object.
+
+The Camera constructor does some basic initialization. The camera object is
+set to '0', the user interface is initialized and UI signal are connected to
+slots that react to the triggering event. However, most of the work is done when
+the \i {setCamera()} function is called, passing in a \l {QByteArray}.
+
+\i {setCamera()} sets up various connections between the user interface and the functionality
+of the Camera class using signals and slots. It also instantiates and initializes the \l {QCamera},
+\l {QCameraImageCapture} and \l {QMediaRecorder} objects mentioned above. The still
+and video recording visual tabs are enabled and finally the
+\l {QCamera::start()}{start()} function of the \l{QCamera} object is called.
+
+Now that the camera is ready for user commands it waits for a suitable event.
+Such an event will be the key press of either the \l {Qt::Key_CameraFocus} or
+\l {Qt::Key_Camera} buttons on the application window. Camera focus will
+simply display the viewfinder and lock the camera settings. Key_Camera will
+either call \i {takeImage()} if the \l {QCamera::captureMode()}{captureMode()}
+is QCamera::CaptureStillImage, or if the capture mode is for video then one
+of two actions will occur. If the recording state shows that we are currently
+recording then the \i {stop()} function is called resulting in a call to
+\l {QCamera::stop()}, whereas if we are not recording then a video recording
+is started with a call to \l {QMediaRecorder::record()}.
+
+\image camera-example.png
+
+*/
+
+
diff --git a/doc/src/examples/declarative-camera.qdoc b/doc/src/examples/declarative-camera.qdoc
new file mode 100644
index 000000000..b37e656f3
--- /dev/null
+++ b/doc/src/examples/declarative-camera.qdoc
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\example declarative-camera
+\title QML Camera Example
+
+\brief The Camera Example shows how to use the API to capture a still image
+or video.
+
+\image qml-camera.png
+
+This example demonstrates the basic use of the Camera QML Plugin elements. The
+plugin provides access to the API functionality for camera settings and
+capturing an image.
+
+Most of the QML code supports the user interface for this application with the
+Camera elements being mostly found in \i {declarative-camera.qml} and
+\i {CaptureControls.qml}.
+
+In \i {declarative-camera.qml} the Camera element is initialized with an id
+of \i {camera }, a photo preview is setup, states are implemented for image
+preview or capture and a CaptureControls element is initialized. The initial
+\i state is \i PhotoCapture. The camera element includes a handler, \i onImageCaptured,
+for the \l {imageCaptured} signal. The handler sets up the application to process
+the preview including a change in the user interface state. The PhotoPreview
+element now becomes visible with any key press being picked up by the handler
+in PhotoPreview and returning the state to \i PhotoCapture.
+
+The \i CaptureControls element, which is implemented in \i {CaptureControls.qml},
+generates a column on the right hand side of the screen which includes control
+buttons for \i focus (not initially visible), \i {capture}, \i {flash modes},
+\i {white balance}, \i {exposure compensation}, and if a preview is
+available a \i {preview} button. The last button exits from the application.
+
+When the Capture button is pressed the \i onClicked handler calls
+\l {Camera::captureImage()}{captureImage()}
+
+
+
+
+
+
+
+*/
diff --git a/doc/src/examples/hapticsplayer.qdoc b/doc/src/examples/hapticsplayer.qdoc
new file mode 100644
index 000000000..e3743ba6f
--- /dev/null
+++ b/doc/src/examples/hapticsplayer.qdoc
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example hapticsplayer
+ \title Haptics Player
+
+ \tableofcontents
+
+ \section1 Overview
+
+ This example shows how to use various haptic effects in an application via
+ the \l{Feedback}{QtMobility Feedback API}.
+
+ It provides an example of how to use the QtMobility libraries to:
+ \list
+ \o play "system theme" haptic effects corresponding to certain predefined events
+ \o play a dynamic custom effect, single or repeating
+ \o play a custom effect which is stored in a file
+ \endlist
+
+ \section2 Use Case
+
+ This example is more feature complete than the \l{hapticsquare}{Haptic Square} example,
+ but is intended more as a way to test the haptics provider plugins which
+ are available on a system, than as an example for application developers.
+
+ It is useful for people who wish to learn how to use the API to create and
+ play custom effects dynamically, or to allow users of an application to
+ select which haptic effect to play when a particular event occurs. It is also useful
+ to test how effects are implemented on specific devices.
+
+ It is a more complex example than the \l{hapticsquare}{Haptic Square} example, so it is
+ suggested that developers look at that example first.
+
+ \section2 Interface
+ The application is designed to work on desktop and mobile platforms with
+ minimal differences in code between the platforms. The interface consists
+ of three tabs which allow the user to select and play different custom,
+ system theme, and file effects, respectively. The custom effect tab also
+ allows the user to modify the custom effect dynamically, and see the effect
+ of attack and fade, intensity and duration, and periodicity, on the user
+ experience.
+
+ \section2 Known Issues
+ The example will not work correctly on platforms which do not have a
+ QFeedbackHapticInterface (haptic effect provider) plugin loaded. On such
+ platforms, the example will do nothing.
+*/
diff --git a/doc/src/examples/player.qdoc b/doc/src/examples/player.qdoc
new file mode 100644
index 000000000..8aad56f25
--- /dev/null
+++ b/doc/src/examples/player.qdoc
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example player
+ \title Media Player Example
+
+
+ This example creates a simple multimedia player. We can play audio and
+ or video files using various codecs.
+
+ The example uses a QMediaPlayer object passed into a QVideoWidget to
+ control the video output. To give the application playlist capability
+ we also use a QPlayList object.
+
+ To activate the various functions such as play and stop on the dialog
+ we connect clicked() signals to slots that emit the play() and stop()
+ signals and in turn which we connect to the play() and stop() slots in
+ QMediaPlayer.
+
+ \code
+ connect(controls, SIGNAL(play()), player, SLOT(play()));
+ connect(controls, SIGNAL(pause()), player, SLOT(pause()));
+ connect(controls, SIGNAL(stop()), player, SLOT(stop()));
+ \endcode
+
+ We can get the volume (and set our user interface representation)
+
+ \code
+ controls->setVolume(player->volume());
+ \endcode
+
+ and we can make widget 'volume' changes change the volume
+
+ \code
+ connect(controls, SIGNAL(changeVolume(int)), player, SLOT(setVolume(int)));
+ \endcode
+
+ The example also allows us to change various video properties by means
+ of the QVideoWidget object. We can go to Full Screen mode with a single
+ button click, and back again. Or if we press the "Color Options" dialog
+ button we can have access to more subtle influences. The dialog has a
+ set of sliders so that we can change the brightness, contrast, hue and
+ saturation of the video being watched. The connect() statements are in
+ pairs so that changes to either the user interface widget (the relevant
+ slider) or the QVideoWidget object will update the other object.
+
+ \code
+ connect(brightnessSlider, SIGNAL(sliderMoved(int)), videoWidget,
+ SLOT(setBrightness(int)));
+ connect(videoWidget, SIGNAL(brightnessChanged(int)),
+ brightnessSlider, SLOT(setValue(int)));
+
+ connect(contrastSlider, SIGNAL(sliderMoved(int)), videoWidget,
+ SLOT(setContrast(int)));
+ connect(videoWidget, SIGNAL(contrastChanged(int)), contrastSlider,
+ SLOT(setValue(int)));
+
+ connect(hueSlider, SIGNAL(sliderMoved(int)), videoWidget,
+ SLOT(setHue(int)));
+ connect(videoWidget, SIGNAL(hueChanged(int)), hueSlider,
+ SLOT(setValue(int)));
+
+ connect(saturationSlider, SIGNAL(sliderMoved(int)), videoWidget,
+ SLOT(setSaturation(int)));
+ connect(videoWidget, SIGNAL(saturationChanged(int)),
+ saturationSlider, SLOT(setValue(int)));
+ \endcode
+
+*/
+
diff --git a/doc/src/examples/slideshow.qdoc b/doc/src/examples/slideshow.qdoc
new file mode 100644
index 000000000..6537e59e0
--- /dev/null
+++ b/doc/src/examples/slideshow.qdoc
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example slideshow
+ \title SlideShow Example
+
+
+ \image slideshow-img1.png
+
+
+ Slideshow displays a series of time delayed images after you select a
+ source image directory to use. The folder button presents a list of three
+ options: browse for a directory, load a playlist or enter a location.
+
+ This implementation uses a QMediaImageViewer object for the image with
+ a QVideoWidget used to do the display. Whether the the source is a
+ browsed directory, a playlist file or a URL to a local or remote
+ location the playlist object in Slideshow is updated with the file or
+ multiple file locations.
+
+ \code
+ connect(imageViewer, SIGNAL(stateChanged(QMediaImageViewer::State)),
+ this, SLOT(stateChanged(QMediaImageViewer::State)));
+
+ playlist = new QMediaPlaylist;
+ playlist->setMediaObject(imageViewer);
+ \endcode
+
+ We create a QVideoWidget to display the viewer and add it to the dialog.
+
+ \code
+ QVideoWidget *videoWidget = new QVideoWidget;
+ videoWidget->setMediaObject(imageViewer);
+ \endcode
+
+
+ \code
+ layout->addWidget(videoWidget, Qt::AlignCenter);
+ \endcode
+
+
+ The timeout between images is set by changing the timeout property in
+ QMediaImageViewer which is in milliseconds. So to change the timeout
+ to five seconds
+ \code
+ imageViewer->setTimeout( 5000 );
+ \endcode
+
+
+*/