camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp
changeset 38 0f0b4c1d7744
parent 28 3075d9b614e6
child 32 5c1e3c6aa4ef
equal deleted inserted replaced
28:3075d9b614e6 38:0f0b4c1d7744
    17 #include <QDebug>
    17 #include <QDebug>
    18 #include <QTimer>
    18 #include <QTimer>
    19 #include <hbmainwindow.h>
    19 #include <hbmainwindow.h>
    20 #include <coemain.h>
    20 #include <coemain.h>
    21 #include <QGraphicsSceneEvent>
    21 #include <QGraphicsSceneEvent>
    22 
    22 #include <hbstyleloader.h>
    23 
    23 
    24 #include "cxuiapplication.h"
    24 #include "cxuiapplication.h"
    25 #include "cxuiapplicationframeworkmonitor.h"
    25 #include "cxuiapplicationframeworkmonitor.h"
    26 #include "cxuiviewmanager.h"
    26 #include "cxuiviewmanager.h"
    27 #include "cxuivideoprecaptureview.h"
    27 #include "cxuivideoprecaptureview.h"
   142 
   142 
   143         // start standby timer now because view will not be ready when viewfinder is started
   143         // start standby timer now because view will not be ready when viewfinder is started
   144         mStandbyHandler->startTimer();
   144         mStandbyHandler->startTimer();
   145     }
   145     }
   146 
   146 
       
   147     // Register stylesheet. It will be automatically destroyed on application
       
   148     // exit.
       
   149     HbStyleLoader::registerFilePath(":/camerax/cxui.css");
       
   150 
   147     CX_DEBUG_EXIT_FUNCTION();
   151     CX_DEBUG_EXIT_FUNCTION();
   148 }
   152 }
   149 
   153 
   150 // ---------------------------------------------------------------------------
   154 // ---------------------------------------------------------------------------
   151 // CxuiViewManager::~CxuiViewManager
   155 // CxuiViewManager::~CxuiViewManager
   225 {
   229 {
   226     CX_DEBUG_ENTER_FUNCTION();
   230     CX_DEBUG_ENTER_FUNCTION();
   227 
   231 
   228     bool ok = false;
   232     bool ok = false;
   229     CX_DEBUG_ASSERT(mCameraDocumentLoader);
   233     CX_DEBUG_ASSERT(mCameraDocumentLoader);
   230 
   234     CxuiDocumentLoader *documentLoader = new CxuiDocumentLoader(&mEngine);
   231     // Use document loader to create widgets and layouts
   235     // Use document loader to create widgets and layouts
   232     // (non-sectioned parts are parsed and loaded)
   236     // (non-sectioned parts are parsed and loaded)
   233     mCameraDocumentLoader->load(SCENEMODE_SETTING_XML, &ok);
   237     documentLoader->load(SCENEMODE_SETTING_XML, &ok);
   234 
   238 
   235     QGraphicsWidget *widget = NULL;
   239     QGraphicsWidget *widget = NULL;
   236 
   240 
   237     // ask for the scenes mode view widget pointer
   241     // ask for the scenes mode view widget pointer
   238     widget = mCameraDocumentLoader->findWidget(STILL_SCENES_VIEW);
   242     widget = documentLoader->findWidget(STILL_SCENES_VIEW);
   239     Q_ASSERT_X(ok && (widget != 0), "camerax ui", "invalid xml file");
   243     Q_ASSERT_X(ok && (widget != 0), "camerax ui", "invalid xml file");
   240     mSceneModeView = qobject_cast<CxuiSceneModeView *> (widget);
   244     mSceneModeView = qobject_cast<CxuiSceneModeView *> (widget);
   241 
   245 
   242     // call for needed construction methods
   246     // call for needed construction methods
   243     mSceneModeView->construct(&mMainWindow, &mEngine, mCameraDocumentLoader, mKeyHandler);
   247     mSceneModeView->construct(&mMainWindow, &mEngine, documentLoader, mKeyHandler);
   244     // .. and add to main window (which also takes ownership)
   248     // .. and add to main window (which also takes ownership)
   245     mMainWindow.addView(widget);
   249     mMainWindow.addView(widget);
   246     mSceneModeView->loadBackgroundImages();
   250     mSceneModeView->loadBackgroundImages();
   247 
   251 
   248     connect(mSceneModeView, SIGNAL(viewCloseEvent()), this, SLOT(changeToPrecaptureView()));
   252     connect(mSceneModeView, SIGNAL(viewCloseEvent()), this, SLOT(changeToPrecaptureView()));
       
   253     delete documentLoader;
   249     CX_DEBUG_EXIT_FUNCTION();
   254     CX_DEBUG_EXIT_FUNCTION();
   250 }
   255 }
   251 
   256 
   252 /*!
   257 /*!
   253 * CxuiViewManager::showScenesView
   258 * CxuiViewManager::showScenesView
   415 
   420 
   416     mMainWindow.blockSignals(true);
   421     mMainWindow.blockSignals(true);
   417     mMainWindow.setCurrentView(view, false);
   422     mMainWindow.setCurrentView(view, false);
   418     mMainWindow.blockSignals(false);
   423     mMainWindow.blockSignals(false);
   419 
   424 
       
   425     if (mSceneModeView){
       
   426         delete mSceneModeView;
       
   427         mSceneModeView = NULL;
       
   428     }
   420     // connecting necessary pre-capture view signals
   429     // connecting necessary pre-capture view signals
   421     connectPreCaptureSignals();
   430     connectPreCaptureSignals();
   422     emit startStandbyTimer();
   431     emit startStandbyTimer();
   423 
   432 
   424     CX_DEBUG_EXIT_FUNCTION();
   433     CX_DEBUG_EXIT_FUNCTION();