diff options
| author | Michael Goddard <michael.goddard@nokia.com> | 2011-02-28 14:48:10 +1000 |
|---|---|---|
| committer | Michael Goddard <michael.goddard@nokia.com> | 2011-03-02 12:12:16 +1000 |
| commit | 270fd291c4354b06686cd1ad263ec1625193cac4 (patch) | |
| tree | 3a7c8b5a0cfab87c118ad9d73da3bf3e3166ada4 /doc/src/snippets/multimedia-snippets/camera.cpp | |
| parent | d2f4bc928741b9680b87427a27ad7d175b64edcc (diff) | |
Convert snippets of code in docs to a separate snippet C++ file.
So that:
a) it compiles
b) it gets c++ style checked
c) it can be made more consistent
Task-number: QTMOBILITY-1328
Reviewed-by: Jonas Rabbe
Change-Id: Ifdd8d9c41dc375b04c601585470daadb21887758
Diffstat (limited to 'doc/src/snippets/multimedia-snippets/camera.cpp')
| -rw-r--r-- | doc/src/snippets/multimedia-snippets/camera.cpp | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/doc/src/snippets/multimedia-snippets/camera.cpp b/doc/src/snippets/multimedia-snippets/camera.cpp new file mode 100644 index 0000000000..453b44fce4 --- /dev/null +++ b/doc/src/snippets/multimedia-snippets/camera.cpp @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* Camera snippets */ + +#include "qcamera.h" +#include "qcameraviewfinder.h" +#include "qmediarecorder.h" +#include "qcameraimagecapture.h" + +void camera() +{ + QCamera *camera = 0; + QCameraViewfinder *viewfinder = 0; + QMediaRecorder *recorder = 0; + QCameraImageCapture *imageCapture = 0; + + //! [Camera] + camera = new QCamera; + + viewfinder = new QCameraViewfinder(); + viewfinder->show(); + + camera->setViewfinder(viewfinder); + + recorder = new QMediaRecorder(camera); + imageCapture = new QCameraImageCapture(camera); + + camera->setCaptureMode(QCamera::CaptureStillImage); + camera->start(); + //! [Camera] + + //! [Camera keys] + //on half pressed shutter button + camera->searchAndLock(); + + //on shutter button pressed + imageCapture->capture(); + + //on shutter button released + camera->unlock(); + //! [Camera keys] + +} |
