Added the ability to control playback volume from post capture
[harmattan/cameraplus] / src / cameraresources.cpp
index 59a8138..cbaed5c 100644 (file)
@@ -1,7 +1,7 @@
 /*!
  * This file is part of CameraPlus.
  *
- * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
+ * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -19,7 +19,9 @@
  */
 
 #include "cameraresources.h"
+#if defined(QT4)
 #include <dbusconnectioneventloop.h>
+#endif
 #include <QDebug>
 
 #define APPLICATION_CLASS "camera"
@@ -29,7 +31,10 @@ CameraResources::CameraResources(QObject *parent) :
   m_worker(new CameraResourcesWorker) {
 
   m_worker->moveToThread(&m_thread);
+
+#if defined(QT4)
   DBUSConnectionEventLoop::getInstance().moveToThread(&m_thread);
+#endif
 
   QObject::connect(&m_thread, SIGNAL(started()), m_worker, SLOT(init()));
   m_thread.start();
@@ -216,8 +221,12 @@ void CameraResourcesWorker::acquire(bool *ok, const CameraResources::Mode& mode)
                    << ResourcePolicy::AudioPlaybackType);
     break;
 
-  case CameraResources::PostCapture:
-    *ok = release();
+  case CameraResources::Player:
+    *ok = updateSet(QList<ResourcePolicy::ResourceType>()
+                   << ResourcePolicy::VideoPlaybackType
+                   << ResourcePolicy::AudioPlaybackType,
+                   QList<ResourcePolicy::ResourceType>()
+                   << ResourcePolicy::ScaleButtonType);
     break;
 
   default:
@@ -270,6 +279,7 @@ bool CameraResourcesWorker::updateSet(const QList<ResourcePolicy::ResourceType>&
 
     ResourcePolicy::AudioResource *audio = new ResourcePolicy::AudioResource(APPLICATION_CLASS);
     audio->setProcessID(QCoreApplication::applicationPid());
+    audio->setStreamTag("media.name", "*");
     audio->setOptional(isOptional);
     m_set->addResourceObject(audio);
   }