camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp
changeset 63 415ff50d2eca
parent 48 42ba2d16bf40
equal deleted inserted replaced
60:a289dde0a1d6 63:415ff50d2eca
    27 #include <hblabel.h>
    27 #include <hblabel.h>
    28 #include <hbmainwindow.h>
    28 #include <hbmainwindow.h>
    29 #include <hbtoolbar.h>
    29 #include <hbtoolbar.h>
    30 #include <hbaction.h>
    30 #include <hbaction.h>
    31 #include <hbmessagebox.h>
    31 #include <hbmessagebox.h>
    32 #include <hbactivitymanager.h>
    32 #include <afactivitystorage.h>
    33 
    33 
    34 #include <xqaiwdecl.h>
    34 #include <xqaiwdecl.h>
    35 #include <shareui.h>
    35 #include <shareui.h>
    36 #include <thumbnailmanager_qt.h>
    36 #include <thumbnailmanager_qt.h>
    37 
    37 
   109 /*!
   109 /*!
   110 * Second phase construction.
   110 * Second phase construction.
   111 */
   111 */
   112 void CxuiPostcaptureView::construct(HbMainWindow *mainwindow, CxeEngine *engine,
   112 void CxuiPostcaptureView::construct(HbMainWindow *mainwindow, CxeEngine *engine,
   113                                     CxuiDocumentLoader *documentLoader,
   113                                     CxuiDocumentLoader *documentLoader,
   114                                     CxuiCaptureKeyHandler *keyHandler,
   114                                     CxuiCaptureKeyHandler *keyHandler)
   115                                     HbActivityManager *activityManager)
       
   116 {
   115 {
   117     Q_UNUSED(keyHandler);
   116     Q_UNUSED(keyHandler);
   118     CX_DEBUG_ENTER_FUNCTION();
   117     CX_DEBUG_ENTER_FUNCTION();
   119 
   118 
   120     CxuiView::construct(mainwindow, engine, documentLoader, NULL, activityManager);
   119     CxuiView::construct(mainwindow, engine, documentLoader, NULL);
   121 
   120 
   122     // set back action to go back to pre-capture
   121     // set back action to go back to pre-capture
   123     HbAction *backAction = new HbAction(Hb::BackNaviAction, this);
   122     HbAction *backAction = new HbAction(Hb::BackNaviAction, this);
   124     connect(backAction, SIGNAL(triggered()), this, SLOT(goToPrecaptureView()));
   123     connect(backAction, SIGNAL(triggered()), this, SLOT(goToPrecaptureView()));
   125     setNavigationAction(backAction);
   124     setNavigationAction(backAction);
   160 
   159 
   161     mReleaseCameraTimer.setSingleShot(true);
   160     mReleaseCameraTimer.setSingleShot(true);
   162     connect(&mReleaseCameraTimer, SIGNAL(timeout()),
   161     connect(&mReleaseCameraTimer, SIGNAL(timeout()),
   163             this, SLOT(releaseCamera()));
   162             this, SLOT(releaseCamera()));
   164 
   163 
   165     mHideControlsTimeout.setSingleShot(true);
       
   166     connect(&mHideControlsTimeout, SIGNAL(timeout()),
       
   167             this, SLOT(hideControls()));
       
   168 
       
   169     mPostcaptureTimer.setSingleShot(true);
   164     mPostcaptureTimer.setSingleShot(true);
   170     connect(&mPostcaptureTimer, SIGNAL(timeout()),
   165     connect(&mPostcaptureTimer, SIGNAL(timeout()),
   171             this, SLOT(goToPrecaptureView()));
   166             this, SLOT(goToPrecaptureView()));
   172 
   167 
   173     // set focus flags
   168     // set focus flags
   174     setFlag(QGraphicsItem::ItemIsFocusable);
   169     setFlag(QGraphicsItem::ItemIsFocusable);
   175     setFocusPolicy(Qt::StrongFocus);
   170     setFocusPolicy(Qt::StrongFocus);
   176 
   171 
   177     QCoreApplication::instance()->installEventFilter(this);
   172     QCoreApplication::instance()->installEventFilter(this);
       
   173 
       
   174     connect(mEngine, SIGNAL(fileSaved(CxeError::Id, const QString&)), this, SLOT(handleFileSaved()));
       
   175 
       
   176     if (CxuiServiceProvider::isCameraEmbedded()) {
       
   177         setTitle(CxuiServiceProvider::instance()->windowTitle());
       
   178     }
       
   179 
   178     CX_DEBUG_EXIT_FUNCTION();
   180     CX_DEBUG_EXIT_FUNCTION();
   179 }
   181 }
   180 
   182 
   181 /*!
   183 /*!
   182 * Handle pressing capture key.
   184 * Handle pressing capture key.
   295     }
   297     }
   296 
   298 
   297     CX_DEBUG_EXIT_FUNCTION();
   299     CX_DEBUG_EXIT_FUNCTION();
   298 }
   300 }
   299 
   301 
       
   302 /*!
       
   303  *  Handle file saving complete event. Toolbar is shown when file is saved.
       
   304  */
       
   305 void CxuiPostcaptureView::handleFileSaved()
       
   306 {
       
   307     CX_DEBUG_ENTER_FUNCTION();
       
   308     showControls();
       
   309     CX_DEBUG_EXIT_FUNCTION();
       
   310 }
   300 
   311 
   301 /*!
   312 /*!
   302     Slot for handling image/video sharing.
   313     Slot for handling image/video sharing.
   303  */
   314  */
   304 void CxuiPostcaptureView::launchShare()
   315 void CxuiPostcaptureView::launchShare()
   439 void CxuiPostcaptureView::saveActivity()
   450 void CxuiPostcaptureView::saveActivity()
   440 {
   451 {
   441     CX_DEBUG_ENTER_FUNCTION();
   452     CX_DEBUG_ENTER_FUNCTION();
   442     QVariantMap data;
   453     QVariantMap data;
   443     QVariantHash params;
   454     QVariantHash params;
       
   455     AfActivityStorage activityStorage;
   444 
   456 
   445     QString filename = getCurrentFilename();
   457     QString filename = getCurrentFilename();
   446     CX_DEBUG(("Saving filename [%s]", qPrintable(filename)));
   458     CX_DEBUG(("Saving filename [%s]", qPrintable(filename)));
   447     data.insert(FILENAME_KEY, filename);
   459     data.insert(FILENAME_KEY, filename);
   448 
   460 
   452 
   464 
   453     QPixmap screenshot = QPixmap::fromImage(img);
   465     QPixmap screenshot = QPixmap::fromImage(img);
   454 
   466 
   455     params.insert("screenshot", screenshot);
   467     params.insert("screenshot", screenshot);
   456     if (mEngine->mode() == Cxe::ImageMode) {
   468     if (mEngine->mode() == Cxe::ImageMode) {
   457         mActivityManager->removeActivity(CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY);
   469         activityStorage.removeActivity(CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY);
   458         mActivityManager->addActivity(CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY, data, params);
   470         activityStorage.saveActivity(CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY, data, params);
   459     } else {
   471     } else {
   460         mActivityManager->removeActivity(CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY);
   472         activityStorage.removeActivity(CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY);
   461         mActivityManager->addActivity(CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY, data, params);
   473         activityStorage.saveActivity(CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY, data, params);
   462     }
   474     }
   463     CX_DEBUG_EXIT_FUNCTION();
   475     CX_DEBUG_EXIT_FUNCTION();
   464 }
   476 }
   465 
   477 
   466 /*!
   478 /*!
   467  * Clear activity from activity manager.
   479  * Clear activity from activity storage.
   468  */
   480  */
   469 void CxuiPostcaptureView::clearActivity()
   481 void CxuiPostcaptureView::clearActivity()
   470 {
   482 {
   471     CX_DEBUG_ENTER_FUNCTION();
   483     CX_DEBUG_ENTER_FUNCTION();
   472     mActivityManager->removeActivity(CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY);
   484     AfActivityStorage activityStorage;
   473     mActivityManager->removeActivity(CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY);
   485     activityStorage.removeActivity(CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY);
       
   486     activityStorage.removeActivity(CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY);
   474     CX_DEBUG_EXIT_FUNCTION();
   487     CX_DEBUG_EXIT_FUNCTION();
   475 }
   488 }
   476 
   489 
   477 /*!
   490 /*!
   478 * Show event for this view.
   491 * Show event for this view.
   492         updateSnapshotImage();
   505         updateSnapshotImage();
   493 
   506 
   494         // If the image / video has been deleted, control returned to pre-capture view.
   507         // If the image / video has been deleted, control returned to pre-capture view.
   495         // No point to start timers or show controls then.
   508         // No point to start timers or show controls then.
   496         if (mMainWindow->currentView() == this) {
   509         if (mMainWindow->currentView() == this) {
   497             showControls();
   510             setTitleBarVisible(true);
       
   511             setStatusBarVisible(true);
   498             startTimers();
   512             startTimers();
   499         }
   513         }
   500 
   514 
   501         event->accept();
   515         event->accept();
   502     }
   516     }