camerauis/cameraxui/cxui/src/cxuiview.cpp
changeset 37 64817133cd1d
parent 36 b12f3922a74f
child 42 feebad15db8c
child 48 42ba2d16bf40
--- a/camerauis/cameraxui/cxui/src/cxuiview.cpp	Wed Jun 23 17:59:54 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiview.cpp	Tue Jul 06 14:04:02 2010 +0300
@@ -65,7 +65,8 @@
 */
 void CxuiView::construct(HbMainWindow *mainWindow, CxeEngine *engine,
                          CxuiDocumentLoader *documentLoader,
-                         CxuiCaptureKeyHandler * keyHandler)
+                         CxuiCaptureKeyHandler * keyHandler,
+                         HbActivityManager *activityManager)
 {
     CX_DEBUG_ENTER_FUNCTION();
 
@@ -73,11 +74,13 @@
     CX_ASSERT_ALWAYS(mainWindow);
     CX_ASSERT_ALWAYS(engine);
     CX_ASSERT_ALWAYS(documentLoader);
+    CX_ASSERT_ALWAYS(activityManager);
 
     mMainWindow = mainWindow;
     mDocumentLoader = documentLoader;
     mCaptureKeyHandler = keyHandler;
     mEngine = engine;
+    mActivityManager = activityManager;
 
     // adjust the timer, and connect it to correct slot
     connect(&mHideControlsTimeout, SIGNAL(timeout()), this, SLOT(hideControls()));
@@ -86,6 +89,18 @@
 }
 
 /*!
+* Is standby mode supported / needed by this view.
+* Default implementation returns false.
+* Inherited classes need to re-implement this if standby mode is needed.
+* @return True if standby mode is supported, false otherwise.
+*/
+bool CxuiView::isStandbyModeSupported() const
+{
+    return false;
+}
+
+
+/*!
 * CxuiView::updateOrientation
 */
 void CxuiView::updateOrientation(Qt::Orientation orientation)
@@ -106,6 +121,32 @@
     CX_DEBUG_EXIT_FUNCTION();
 }
 
+
+/*!
+ * Restore view state from activity. Default implementation does nothing.
+ */
+void CxuiView::restoreActivity(const QString &activityId, const QVariant &data)
+{
+    Q_UNUSED(activityId);
+    Q_UNUSED(data);
+}
+
+/*!
+ * Save view state to activity. Default implementation does nothing.
+ */
+void CxuiView::saveActivity()
+{
+
+}
+
+/*!
+ * Clear activity from activity manager. Default implementation does nothing.
+ */
+void CxuiView::clearActivity()
+{
+
+}
+
 /*!
 * Allow showing UI controls?
 * Default behaviour is that controls can be shown at any time.
@@ -116,6 +157,15 @@
 }
 
 /*!
+ * Play feedback when touching view outside of any widget?
+ * Default behaviour is that feedback is always played.
+ */
+bool CxuiView::isFeedbackEnabled() const
+{
+    return true;
+}
+
+/*!
 * Toggle visibility of UI controls.
 */
 void CxuiView::toggleControls()
@@ -132,6 +182,26 @@
 }
 
 /*!
+* Slot for entering standby mode.
+* By default, release camera.
+*/
+void CxuiView::enterStandby()
+{
+    CX_DEBUG_IN_FUNCTION();
+    releaseCamera();
+    CX_DEBUG_IN_FUNCTION();
+}
+
+/*!
+* Slot for exiting standby mode.
+* By default, no action needed.
+*/
+void CxuiView::exitStandby()
+{
+    CX_DEBUG_IN_FUNCTION();
+}
+
+/*!
 * CxuiView::launchNotSupportedNotification
 * Show "not supported" notification.
 */
@@ -158,6 +228,8 @@
  */
 void CxuiView::launchPhotosApp()
 {
+    // Release camera device in order to free resources for Photos application
+    releaseCamera();
     QProcess::startDetached(PhotosAppExe);
 }
 
@@ -167,8 +239,7 @@
  */
 void CxuiView::launchVideosApp()
 {
-    //Releasing cameda device in order to free
-    //graphical memory
+    // Release camera device in order to free resources for Videos application
     releaseCamera();
     QProcess::startDetached(VideosAppExe);
 }
@@ -367,7 +438,8 @@
 void CxuiView::mousePressEvent(QGraphicsSceneMouseEvent *event)
 {
     //! @todo temporary workaround for title bar mouse event handling bug
-    if (event->type() == QEvent::GraphicsSceneMousePress && event->scenePos().y() > 70) {
+    if (event->type() == QEvent::GraphicsSceneMousePress && event->scenePos().y() > 70 &&
+        isFeedbackEnabled()) {
         mControlsFeedback.setModalities(HbFeedback::All);
         mControlsFeedback.play();
         event->accept();
@@ -382,7 +454,8 @@
 void CxuiView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
 {
     //! @todo temporary workaround for title bar mouse event handling bug
-    if (event->type() == QEvent::GraphicsSceneMouseRelease && event->scenePos().y() > 70) {
+    if (event->type() == QEvent::GraphicsSceneMouseRelease && event->scenePos().y() > 70 &&
+        isFeedbackEnabled()) {
         // todo: sound disabling doesn't work in orbit yet so don't do feedback on release
         // needs to be enabled when orbit support is done
         //mControlsFeedback.setModalities(HbFeedback::Tactile);
@@ -391,4 +464,5 @@
         event->accept();
     }
 }
+
 // End of file