MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

QCamera Example

Files:

This Qt C++ application demonstrates 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