Qt Reference Documentation

# QCamera Demo

Files:

- demos/mobile/qcamera/businesscardhandling.cpp
- demos/mobile/qcamera/businesscardhandling.h
- demos/mobile/qcamera/button.cpp
- demos/mobile/qcamera/button.h
- demos/mobile/qcamera/cameraexample.cpp
- demos/mobile/qcamera/cameraexample.h
- demos/mobile/qcamera/contactsdlg.cpp
- demos/mobile/qcamera/contactsdlg.h
- demos/mobile/qcamera/messagehandling.cpp
- demos/mobile/qcamera/messagehandling.h
- demos/mobile/qcamera/icons/cameramms_icon.svg
- demos/mobile/qcamera/main.cpp
- demos/mobile/qcamera/qcamera.pro
- demos/mobile/qcamera/resources.qrc

The QCamera demo shows how to use Multimedia, Messaging and Contacts modules from Qt Mobility.

The application shows the viewfinder picture from the device camera and allows the user to capture images. Captured images are stored into the gallery and can be sent as an MMS message to a friend. Application listens for incoming MMS messages in the Inbox folder. If the MMS message contains a picture, the application asks the user whether he or she wants to add the picture as an avatar of the sender. The person's general contact information has to exist in the device phonebook in order to store the avatar in it.

The application uses own MyVideoSurface video surface derived from QAbstractVideoSurface for showing camera view finder pictures. A video surface presents a continuous stream of identically formatted frames.

     QMediaService* ms = m_camera->service();
     QVideoRendererControl* vrc = ms->requestControl<QVideoRendererControl*>();
     m_myVideoSurface = new MyVideoSurface(this,this,this);
     vrc->setSurface(m_myVideoSurface);

The application handles Graphics Out Of Memory (GOOM) events in it's QApplication::symbianEventFilter() method.

       bool symbianEventFilter( const QSymbianEvent* symbianEvent )
       {
         const TWsEvent *event = symbianEvent->windowServerEvent();
         if ( !event ) {
           return false;
         }
         switch ( event->Type() ) {
           // GOOM handling enabled
           // http://wiki.forum.nokia.com/index.php/Graphics_memory_handling
           case EEventUser: {
             TApaSystemEvent* eventData = reinterpret_cast<TApaSystemEvent*>(event->EventData());
             if ((*eventData) == EApaSystemEventShutdown) {
                 eventData++;
                 if ((*eventData) == KGoomMemoryLowEvent) {
                  return true;
                 }
             }
             break;
           }
           default:
             break;
         };

         // Always return false so we don't stop
         // the event from being processed
         return false;
       }

## Required capabilities

Application can be self-signed.

After enabling Qt Mobility Messaging module (MESSAGING_ENABLED flag in .pro file) from the project file is ReadDeviceData WriteDeviceData capabilities also needed and application have to be Developer Signed. Enabling Messaging adds MMS sending feature for the application.

## Compatibility

Qt SDK 1.1

Qt 4.7.2 for Symbian

QtMobility 1.1.1

Tested on: Nokia N8, Nokia E7

Developed with: Qt SDK 1.1