camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp
changeset 39 c5025ea871a1
parent 28 3075d9b614e6
child 40 2922f70fca82
equal deleted inserted replaced
38:0f0b4c1d7744 39:c5025ea871a1
    47 
    47 
    48 /*!
    48 /*!
    49 * Constructor
    49 * Constructor
    50 */
    50 */
    51 CxuiSceneModeView::CxuiSceneModeView(QGraphicsItem *parent) :
    51 CxuiSceneModeView::CxuiSceneModeView(QGraphicsItem *parent) :
    52     HbView(parent),
    52     CxuiView(parent),
    53     mMainWindow(NULL),
       
    54     mSettingsInfo(NULL),
    53     mSettingsInfo(NULL),
    55     mEngine(NULL),
    54     mScenesBackground(NULL)
    56     mDocumentLoader(NULL),
       
    57     mCaptureKeyHandler(NULL),
       
    58 	mScenesBackground(NULL)
       
    59 {
    55 {
    60     CX_DEBUG_IN_FUNCTION();
    56     CX_DEBUG_IN_FUNCTION();
    61 }
    57 }
    62 
    58 
    63 /*!
    59 /*!
    81                                CxeEngine *engine,
    77                                CxeEngine *engine,
    82                                CxuiDocumentLoader *documentLoader,
    78                                CxuiDocumentLoader *documentLoader,
    83                                CxuiCaptureKeyHandler *keyHandler)
    79                                CxuiCaptureKeyHandler *keyHandler)
    84 {
    80 {
    85     CX_DEBUG_ENTER_FUNCTION();
    81     CX_DEBUG_ENTER_FUNCTION();
    86 
    82     CxuiView::construct(mainwindow, engine, documentLoader, keyHandler);
    87     mMainWindow = mainwindow;
    83 
    88     mDocumentLoader = documentLoader;
       
    89     mCaptureKeyHandler = keyHandler;
       
    90     mEngine = engine;
       
    91     mSettingsInfo = new CxuiSettingsInfo(mEngine);
    84     mSettingsInfo = new CxuiSettingsInfo(mEngine);
    92     setContentFullScreen(true);
    85     setContentFullScreen(true);
    93     loadDefaultWidgets();
    86     loadDefaultWidgets();
    94 
    87 
    95     mCameraReleaseTimer.setInterval(CXUI_SCENES_CAMERA_TIMEOUT);    
    88     mCameraReleaseTimer.setInterval(CXUI_SCENES_CAMERA_TIMEOUT);
    96     connect(&mCameraReleaseTimer, SIGNAL(timeout()), this, SLOT(releaseCameraHw()), Qt::UniqueConnection);
    89     mCameraReleaseTimer.setSingleShot(true);
       
    90     connect(&mCameraReleaseTimer, SIGNAL(timeout()), this, SLOT(releaseCamera()), Qt::UniqueConnection);
    97 
    91 
    98     CX_DEBUG_EXIT_FUNCTION();
    92     CX_DEBUG_EXIT_FUNCTION();
    99 }
    93 }
   100 
    94 
   101 /*!
    95 /*!
   128     mTransitionAnimation = new QPropertyAnimation(mScenesBackground2, "opacity");
   122     mTransitionAnimation = new QPropertyAnimation(mScenesBackground2, "opacity");
   129     mTransitionAnimation->setDuration(CXUI_SCENES_TRANSITION_TIME);
   123     mTransitionAnimation->setDuration(CXUI_SCENES_TRANSITION_TIME);
   130 
   124 
   131     createWidgetBackgroundGraphic(mScenesContainer, TRANSPARENT_BACKGROUND_GRAPHIC);
   125     createWidgetBackgroundGraphic(mScenesContainer, TRANSPARENT_BACKGROUND_GRAPHIC);
   132 
   126 
       
   127     //!@todo: View flags property is missing from HbView,
       
   128     //        so can't properly hide title bar / status bar there.
       
   129     hideControls();
       
   130 
   133     connectSignals();
   131     connectSignals();
   134 
   132 
   135     CX_DEBUG_EXIT_FUNCTION();
   133     CX_DEBUG_EXIT_FUNCTION();
   136 }
   134 }
   137 
   135 
   140 */
   138 */
   141 void CxuiSceneModeView::connectSignals()
   139 void CxuiSceneModeView::connectSignals()
   142 {
   140 {
   143     connect(mScenesList, SIGNAL(itemSelected(int)), this, SLOT(handleSceneRadiobuttonPress(int)));
   141     connect(mScenesList, SIGNAL(itemSelected(int)), this, SLOT(handleSceneRadiobuttonPress(int)));
   144     connect(mTransitionAnimation, SIGNAL(finished()), this, SLOT(finishScenesTransition()));
   142     connect(mTransitionAnimation, SIGNAL(finished()), this, SLOT(finishScenesTransition()));
   145 }
       
   146 
       
   147 /*!
       
   148 * Function can be used to create a graphics item and setting it as a background
       
   149 * item for HbWidget. graphicName refers to system wide graphic name. Given graphic
       
   150 * can consist of one, three or nine pieces. Nine piece graphics are used by default.
       
   151 * See HbFrameDrawer documentation for graphic naming.
       
   152 */
       
   153 void CxuiSceneModeView::createWidgetBackgroundGraphic(HbWidget *widget,
       
   154                                                        const QString &graphicName,
       
   155                                                        HbFrameDrawer::FrameType frameType)
       
   156 {
       
   157     if (widget) {
       
   158         HbFrameDrawer *drawer = new HbFrameDrawer(graphicName, frameType);
       
   159 
       
   160         if (drawer) {
       
   161             HbFrameItem *backgroundItem = new HbFrameItem(drawer, widget);
       
   162             if (backgroundItem) {
       
   163                 // set item to fill the whole widget
       
   164                 backgroundItem->setGeometry(QRectF(QPointF(0, 0), widget->size()));
       
   165                 backgroundItem->setZValue(0);
       
   166                 widget->setBackgroundItem(backgroundItem);
       
   167             }
       
   168         }
       
   169     }
       
   170 }
   143 }
   171 
   144 
   172 /*!
   145 /*!
   173 * This public method assumes that the view is already properly constructed
   146 * This public method assumes that the view is already properly constructed
   174 */
   147 */
   300     QGraphicsWidget::showEvent(event);
   273     QGraphicsWidget::showEvent(event);
   301     CX_DEBUG_EXIT_FUNCTION();
   274     CX_DEBUG_EXIT_FUNCTION();
   302 }
   275 }
   303 
   276 
   304 /*!
   277 /*!
       
   278 * Allow showing UI controls?
       
   279 * Title bar and other UI chrome is never shown in scene mode view.
       
   280 */
       
   281 bool CxuiSceneModeView::allowShowControls() const
       
   282 {
       
   283     return false;
       
   284 }
       
   285 
       
   286 /*!
   305 * Slot to handle capture key full press.
   287 * Slot to handle capture key full press.
   306 */
   288 */
   307 void CxuiSceneModeView::handleCaptureKeyPressed()
   289 void CxuiSceneModeView::handleCaptureKeyPressed()
   308 {
   290 {
   309     CX_DEBUG_ENTER_FUNCTION();
   291     CX_DEBUG_ENTER_FUNCTION();
   333     mEngine->initMode(mEngine->mode());
   315     mEngine->initMode(mEngine->mode());
   334     emit viewCloseEvent();
   316     emit viewCloseEvent();
   335     CX_DEBUG_EXIT_FUNCTION();
   317     CX_DEBUG_EXIT_FUNCTION();
   336 }
   318 }
   337 
   319 
   338 /*!
       
   339 * Slot to handle camera hw release timeout
       
   340 */
       
   341 void CxuiSceneModeView::releaseCameraHw()
       
   342 {
       
   343     CX_DEBUG_ENTER_FUNCTION();
       
   344     mCameraReleaseTimer.stop();
       
   345     mEngine->cameraDeviceControl().release();
       
   346     CX_DEBUG_EXIT_FUNCTION();
       
   347 }
       
   348 
       
   349 // end of file
   320 // end of file
   350 
   321