--- a/camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -17,11 +17,11 @@
#include <QDebug>
#include <QTimer>
#include <hbmainwindow.h>
-#include <coemain.h>
#include <QGraphicsSceneEvent>
#include <hbstyleloader.h>
#include <hbactivitymanager.h>
#include <hbaction.h>
+#include <xqserviceutil.h>
#include "cxuiapplication.h"
#include "cxuiapplicationstate.h"
@@ -43,11 +43,16 @@
#include "cxuiserviceprovider.h"
#include "cxuiscenemodeview.h"
+
+#ifdef Q_OS_SYMBIAN
#include "OstTraceDefinitions.h"
+
#ifdef OST_TRACE_COMPILER_IN_USE
#include "cxuiviewmanagerTraces.h"
#endif
+#endif //Q_OS_SYMBIAN
+
using namespace Cxe;
using namespace CxUiLayout;
@@ -68,8 +73,7 @@
mKeyHandler(NULL),
mCameraDocumentLoader(NULL),
mApplicationState(NULL),
- mErrorManager(NULL),
- mSceneModeView(NULL)
+ mErrorManager(NULL)
{
CX_DEBUG_ENTER_FUNCTION();
@@ -77,18 +81,18 @@
mDocmlFilesByView.insert(STILL_PRE_CAPTURE_VIEW, STILL_1ST_XML);
mDocmlFilesByView.insert(VIDEO_PRE_CAPTURE_VIEW, VIDEO_1ST_XML);
mDocmlFilesByView.insert(POSTCAPTURE_VIEW, POSTCAPTURE_XML);
- mDocmlFilesByView.insert(STILL_SCENES_VIEW, SCENEMODE_SETTING_XML);
+ mDocmlFilesByView.insert(SCENE_MODE_VIEW, SCENEMODE_SETTING_XML);
// Key handler
mKeyHandler = new CxuiCaptureKeyHandler(mEngine);
// Document loader
- OstTrace0( camerax_performance, CXUIVIEWMANAGER_CXUIVIEWMANAGER, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 1" );
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CXUIVIEWMANAGER_1, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 1");
mCameraDocumentLoader = new CxuiDocumentLoader(&engine);
- OstTrace0( camerax_performance, DUP1_CXUIVIEWMANAGER_CXUIVIEWMANAGER, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 0" );
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CXUIVIEWMANAGER_2, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 0");
// Application state
- mApplicationState = new CxuiApplicationState(mApplication, mEngine.settings(), *mKeyHandler, mCameraDocumentLoader);
+ mApplicationState = new CxuiApplicationState(mApplication, mEngine.settings(), mCameraDocumentLoader);
CX_ASSERT_ALWAYS(mApplicationState);
bool ok = connect(mApplicationState, SIGNAL(stateChanged(CxuiApplicationState::State, CxuiApplicationState::State)),
this, SLOT(handleApplicationStateChanged(CxuiApplicationState::State, CxuiApplicationState::State)));
@@ -160,7 +164,7 @@
Q_UNUSED(oldState);
CX_DEBUG_ENTER_FUNCTION();
- CxuiView *view = qobject_cast<CxuiView *>(mMainWindow.currentView());
+ CxuiView *view = currentView();
CX_DEBUG(("CxuiViewManager - current view %d", view));
switch (newState) {
@@ -206,7 +210,7 @@
{
CX_DEBUG_ENTER_FUNCTION();
// Store view that is active now.
- CxuiView *view = qobject_cast<CxuiView *>(mMainWindow.currentView());
+ CxuiView *view = currentView();
CX_DEBUG(("CxuiViewManager - current view %d", view));
// Emit signal so current view can enter standby.
@@ -217,6 +221,7 @@
disconnectSignals(view);
// Make sure standby timer is not running.
stopStandbyTimer();
+
CX_DEBUG_EXIT_FUNCTION();
}
@@ -240,35 +245,12 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/**
- * Init engine to correct mode based on activity being restored.
- */
-void CxuiViewManager::initEngine()
-{
- Cxe::CameraMode mode = Cxe::ImageMode;
- QString activityId = mApplication.activateId();
- if (activityId == CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY ||
- activityId == CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY) {
- mode = Cxe::VideoMode;
- }
- if (activityId == CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY ||
- activityId == CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY) {
- // init engine only if going to pre-capture
- mEngine.initMode(mode);
- } else {
- // in post-capture don't init but set the correct mode to engine
- // so init can be done later
- mEngine.setMode(mode);
- }
-}
-
/*!
* Helper function to return current view cast to CxuiView.
*/
CxuiView* CxuiViewManager::currentView() const
{
CxuiView *view = qobject_cast<CxuiView*> (mMainWindow.currentView());
- CX_ASSERT_ALWAYS(view);
return view;
}
@@ -279,7 +261,12 @@
{
CX_DEBUG_ENTER_FUNCTION();
- if (mApplication.activateReason() == Hb::ActivationReasonService) {
+ if (mApplication.activateReason() == Hb::ActivationReasonService ||
+ // @todo: There's a bug in orbit and we never get Hb::ActivationReasonService as
+ // activation reason. Use XQServiceUtil to determine if starting service as
+ // a workaround for now
+ XQServiceUtil::isService()) {
+
// For embedded mode: don't create view yet, create when engine inits to correct mode.
// Connect signals to set up the view after image/video prepare
connect(&mEngine.stillCaptureControl(), SIGNAL(imagePrepareComplete(CxeError::Id)),
@@ -287,7 +274,7 @@
connect(&mEngine.videoCaptureControl(), SIGNAL(videoPrepareComplete(CxeError::Id)),
this, SLOT(changeToPrecaptureView()));
- } else if (mApplication.activateReason() == Hb::ActivationReasonActivity ) {
+ } else if (mApplication.activateReason() == Hb::ActivationReasonActivity) {
// restoring activity, read startup view from stored activity
// view to start in
@@ -308,16 +295,12 @@
}
CxuiView *view = createView(viewName);
- mMainWindow.setCurrentView(view, false);
-
if (preCapture) {
- connectPreCaptureSignals();
+ connectPreCaptureSignals(static_cast<CxuiPrecaptureView *>(view));
} else {
connectPostCaptureSignals();
}
-
- // Check the current application state, signalled to handleApplicationStateChanged.
- mApplicationState->startMonitoring();
+ mMainWindow.setCurrentView(view, false);
// restore view from activity
bool ok = mApplication.activityManager()->waitActivity();
@@ -335,16 +318,15 @@
} else {
view = createView(STILL_PRE_CAPTURE_VIEW);
}
-
+ connectPreCaptureSignals(static_cast<CxuiPrecaptureView *>(view));
mMainWindow.setCurrentView(view, false);
- connectPreCaptureSignals();
-
- // Check the current application state, signalled to handleApplicationStateChanged.
- mApplicationState->startMonitoring();
clearAllActivities();
}
+ // Check the current application state, signalled to handleApplicationStateChanged.
+ mApplicationState->startMonitoring();
+
CX_DEBUG_EXIT_FUNCTION();
}
@@ -355,7 +337,7 @@
{
CX_DEBUG_ENTER_FUNCTION();
- OstTrace0( camerax_performance, CXUIVIEWMANAGER_CREATEVIEW, "msg: e_CX_CREATE_VIEW 1" );
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_IN, "msg: e_CX_CREATE_VIEW 1");
CX_DEBUG(("View name: %s", viewName.toAscii().data()));
@@ -366,56 +348,38 @@
// Use document loader to create widgets and layouts
// (non-sectioned parts are parsed and loaded)
QString docmlFile = mDocmlFilesByView[viewName];
- CX_DEBUG_ASSERT(mCameraDocumentLoader);
+ CX_ASSERT_ALWAYS(mCameraDocumentLoader);
CX_ASSERT_ALWAYS(!docmlFile.isNull());
- OstTrace0( camerax_performance, DUP2_CXUIVIEWMANAGER_ADDPRECAPTUREVIEWS, "msg: e_CX_DOCLOADER_LOAD 1" );
-
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_2, "msg: e_CX_DOCUMENTLOADER_LOAD 1");
mCameraDocumentLoader->load(docmlFile, &ok);
-
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_4, "msg: e_CX_DOCUMENTLOADER_LOAD 0");
Q_ASSERT_X(ok, "createView", "error in xml file parsing");
- OstTrace0( camerax_performance, DUP2_CXUIVIEWMANAGER_CREATEVIEW, "msg: e_CX_DOCLOADER_LOAD 0" );
-
- OstTrace0( camerax_performance, DUP4_CXUIVIEWMANAGER_ADDVIEWS, "msg: e_CX_DOCLOADER_FINDWIDGET 1" );
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_6, "msg: e_CX_DOCUMENTLOADER_FINDWIDGET 1");
QGraphicsWidget *widget = NULL;
// ask for the view widget pointer
widget = mCameraDocumentLoader->findWidget(viewName);
view = qobject_cast<CxuiView *> (widget);
- CX_DEBUG_ASSERT(view);
- OstTrace0( camerax_performance, DUP5_CXUIVIEWMANAGER_ADDVIEWS, "msg: e_CX_DOCLOADER_FINDWIDGET 0" );
+ CX_ASSERT_ALWAYS(view);
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_8, "msg: e_CX_DOCUMENTLOADER_FINDWIDGET 1");
// call for needed consturction methods
view->construct(&mMainWindow, &mEngine, mCameraDocumentLoader, mKeyHandler, mApplication.activityManager());
// .. and add to main window (which also takes ownership)
- OstTrace0( camerax_performance, DUP1_CXUIVIEWMANAGER_MAINWINDOW_ADDVIEW, "msg: e_CX_MAINWINDOW_ADDVIEW 1" );
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_10, "msg: e_CX_MAINWINDOW_ADDVIEW 1");
mMainWindow.addView(view);
mViews.insert(viewName, view);
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_12, "msg: e_CX_MAINWINDOW_ADDVIEW 0");
+ }
- OstTrace0( camerax_performance, DUP2_CXUIVIEWMANAGER_MAINWINDOW_ADDVIEW, "msg: e_CX_MAINWINDOW_ADDVIEW 0" );
- OstTrace0( camerax_performance, DUP1_CXUIVIEWMANAGER_CREATEVIEW, "msg: e_CX_CREATE_STILLPRECAPTUREVIEW 0" );
-
- }
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_OUT, "msg: e_CX_CREATE_VIEW 0");
CX_DEBUG_EXIT_FUNCTION();
return view;
}
/*!
-* Create scene mode view.
-*/
-CxuiView* CxuiViewManager::createSceneModesView()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- mSceneModeView = qobject_cast<CxuiSceneModeView*>(createView(STILL_SCENES_VIEW));
- mSceneModeView->loadBackgroundImages();
-
- CX_DEBUG_EXIT_FUNCTION();
- return mSceneModeView;
-}
-
-/*!
* CxuiViewManager::showScenesView
* A private method for displaying Scene Modes selection view
*/
@@ -425,16 +389,13 @@
// Disconnect signals from old view.
disconnectSignals();
- if (!mSceneModeView) {
- createSceneModesView();
- }
- else {
- mSceneModeView->loadBackgroundImages();
- }
- CX_DEBUG_ASSERT(mSceneModeView);
- mMainWindow.setCurrentView(mSceneModeView, false);
+ CxuiSceneModeView *view = qobject_cast<CxuiSceneModeView*>(createView(SCENE_MODE_VIEW));
+ CX_ASSERT_ALWAYS(view);
+ view->loadBackgroundImages();
+
stopStandbyTimer();
connectSceneModeSignals();
+ mMainWindow.setCurrentView(view, false);
CX_DEBUG_EXIT_FUNCTION();
}
@@ -464,23 +425,6 @@
}
/*!
-* Get a pointer to the document loader instance.
-*/
-CxuiDocumentLoader *CxuiViewManager::documentLoader()
-{
- return mCameraDocumentLoader;
-}
-
-/*!
-* Get reference to application state instance.
-*/
-CxuiApplicationState &CxuiViewManager::applicationState()
-{
- return *mApplicationState;
-}
-
-
-/*!
* Move to post-capture view.
*/
void CxuiViewManager::changeToPostcaptureView()
@@ -491,8 +435,6 @@
CxuiView *postCaptureView = createView(POSTCAPTURE_VIEW);
- mMainWindow.setCurrentView(postCaptureView, false);
-
// Connecting all necessary signals for postcapture view.
// Not connected yet if not in normal state. We connect the signals
// once we enter normal state again.
@@ -500,6 +442,11 @@
connectPostCaptureSignals();
}
+ // Connect signals before we set the post-capture view as current view.
+ // We need to have signals connected if post-capture view for example
+ // needs to move back to pre-capture view already in showEvent.
+ mMainWindow.setCurrentView(postCaptureView, false);
+
CX_DEBUG_EXIT_FUNCTION();
}
@@ -526,17 +473,23 @@
// Disconnect signals from old view.
disconnectSignals();
- HbView *view = getPrecaptureView(mEngine.mode(),
- mEngine.cameraDeviceControl().cameraIndex());
+ CxuiPrecaptureView *view =
+ getPrecaptureView(mEngine.mode(), mEngine.cameraDeviceControl().cameraIndex());
+
+ // Connect necessary pre-capture view signals.
+ connectPreCaptureSignals(view);
+
mMainWindow.setCurrentView(view, false);
- if (mSceneModeView){
- mViews.remove(STILL_SCENES_VIEW);
- delete mSceneModeView;
- mSceneModeView = NULL;
+ // Release resources needed by scene view.
+ HbView *sceneView = mViews.take(SCENE_MODE_VIEW);
+ if (sceneView) {
+ // This will not delete the view.
+ mMainWindow.removeView(sceneView);
+ // We can get to this slot from scene view, so don't delete the object too early.
+ sceneView->deleteLater();
+ sceneView = NULL;
}
- // connecting necessary pre-capture view signals
- connectPreCaptureSignals();
// Make sure engine prepares for new image/video if necessary
mEngine.initMode(mEngine.mode());
@@ -566,11 +519,10 @@
}
CxuiPrecaptureView* view = getPrecaptureView(mEngine.mode(), nextCamera);
+ connectPreCaptureSignals(view);
mMainWindow.setCurrentView(view, false);
view->updateOrientation(nextViewOrientation);
- connectPreCaptureSignals();
-
mEngine.cameraDeviceControl().switchCamera(nextCamera);
CX_DEBUG_EXIT_FUNCTION();
@@ -628,18 +580,22 @@
/*!
* Connect signals specific to given view.
*/
-void CxuiViewManager::connectSignals(QObject *view)
+void CxuiViewManager::connectSignals(CxuiView *view)
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CONNECTSIGNALS_1, "msg: e_CX_VIEWMANAGER_CONNECT_SIGNALS 1");
+
if (view) {
if (view == mViews[POSTCAPTURE_VIEW]) {
connectPostCaptureSignals();
- } else if (view == mSceneModeView) {
+ } else if (view == mViews[SCENE_MODE_VIEW]) {
connectSceneModeSignals();
} else {
- connectPreCaptureSignals();
+ connectPreCaptureSignals(static_cast<CxuiPrecaptureView *>(view));
}
}
+
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CONNECTSIGNALS_2, "msg: e_CX_VIEWMANAGER_CONNECT_SIGNALS 0");
CX_DEBUG_EXIT_FUNCTION();
}
@@ -648,16 +604,17 @@
* We don't want to send or receive signals with inactive views, so this is done every time changing a view.
* @param view View object from which signals are disconnected. If NULL is given, current view is used.
*/
-void CxuiViewManager::disconnectSignals(QObject *view)
+void CxuiViewManager::disconnectSignals(CxuiView *view)
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_DISCONNECT_1, "msg: e_CX_VIEWMANAGER_DISCONNECT_SIGNALS 1");
// Disconnect all existing capture key signals
mKeyHandler->disconnect();
if (!view) {
// If view is not given, take current view.
- view = mMainWindow.currentView();
+ view = currentView();
}
CX_DEBUG(("CxuiViewManager - disconnecting from view %d", view));
@@ -668,48 +625,46 @@
disconnect(this, 0, view, 0);
}
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_DISCONNECT_2, "msg: e_CX_VIEWMANAGER_DISCONNECT_SIGNALS 0");
CX_DEBUG_EXIT_FUNCTION();
}
/*!
* Connect signals to pre-capture view.
*/
-void CxuiViewManager::connectPreCaptureSignals()
+void CxuiViewManager::connectPreCaptureSignals(CxuiPrecaptureView *view)
{
CX_DEBUG_ENTER_FUNCTION();
+ // Disconnect from the current, "old" view
disconnectSignals();
- HbView *currentView = mMainWindow.currentView();
-
- if (currentView != mViews[POSTCAPTURE_VIEW]) {
- // connects all capture key signals.
- connectCaptureKeySignals();
+ // connecting pre-capture view signals to standby timer.
+ connect(view, SIGNAL(startStandbyTimer()), this, SLOT(startStandbyTimer()), Qt::UniqueConnection);
+ connect(view, SIGNAL(stopStandbyTimer()), this, SLOT(stopStandbyTimer()), Qt::UniqueConnection);
+ connect(view, SIGNAL(changeToPrecaptureView()), this, SLOT(startStandbyTimer()), Qt::UniqueConnection);
+ connect(view, SIGNAL(changeToPostcaptureView()), this, SLOT(stopStandbyTimer()), Qt::UniqueConnection);
- // connecting pre-capture view signals to standby timer.
- connect(currentView, SIGNAL(startStandbyTimer()), this, SLOT(startStandbyTimer()), Qt::UniqueConnection);
- connect(currentView, SIGNAL(stopStandbyTimer()), this, SLOT(stopStandbyTimer()), Qt::UniqueConnection);
- connect(currentView, SIGNAL(changeToPrecaptureView()), this, SLOT(startStandbyTimer()), Qt::UniqueConnection);
- connect(currentView, SIGNAL(changeToPostcaptureView()), this, SLOT(stopStandbyTimer()), Qt::UniqueConnection);
+ // connecting pre-capture view signals to viewmanager slots
+ connect(view, SIGNAL(changeToPostcaptureView()), this, SLOT(changeToPostcaptureView()), Qt::UniqueConnection);
+ connect(view, SIGNAL(changeToPrecaptureView()), this, SLOT(changeToPrecaptureView()), Qt::UniqueConnection);
+
+ //connecting scene modes signal
+ connect(view, SIGNAL(showScenesView()), this, SLOT(showScenesView()), Qt::UniqueConnection);
- // connecting pre-capture view signals to viewmanager slots
- connect(currentView, SIGNAL(changeToPostcaptureView()), this, SLOT(changeToPostcaptureView()), Qt::UniqueConnection);
- connect(currentView, SIGNAL(changeToPrecaptureView()), this, SLOT(changeToPrecaptureView()), Qt::UniqueConnection);
+ connect(view, SIGNAL(switchCamera()), this, SLOT(switchCamera()), Qt::UniqueConnection);
- //connecting scene modes signal
- connect(currentView, SIGNAL(showScenesView()), this, SLOT(showScenesView()), Qt::UniqueConnection);
-
- connect(currentView, SIGNAL(switchCamera()), this, SLOT(switchCamera()), Qt::UniqueConnection);
+ // connecting error signals from precapture view to application state.
+ connect(view, SIGNAL(errorEncountered(CxeError::Id)),
+ mApplicationState, SLOT(handleApplicationError(CxeError::Id)),
+ Qt::UniqueConnection);
- // connecting error signals from precapture view to application state.
- connect(currentView, SIGNAL(errorEncountered(CxeError::Id)),
- mApplicationState, SLOT(handleApplicationError(CxeError::Id)),
- Qt::UniqueConnection);
+ // Standby signals
+ connect(this, SIGNAL(normalStateEntered()), view, SLOT(exitStandby()), Qt::UniqueConnection);
+ connect(this, SIGNAL(normalStateExited()), view, SLOT(enterStandby()), Qt::UniqueConnection);
- // Standby signals
- connect(this, SIGNAL(normalStateEntered()), currentView, SLOT(exitStandby()), Qt::UniqueConnection);
- connect(this, SIGNAL(normalStateExited()), currentView, SLOT(enterStandby()), Qt::UniqueConnection);
- }
+ // connects all capture key signals.
+ connectCaptureKeySignals(view);
CX_DEBUG_EXIT_FUNCTION();
}
@@ -721,19 +676,20 @@
{
CX_DEBUG_ENTER_FUNCTION();
+ // Disconnect from the current, "old" view
disconnectSignals();
- QObject *currentView = mMainWindow.currentView();
- if (currentView == mViews[POSTCAPTURE_VIEW]) {
- connect(currentView, SIGNAL(changeToPrecaptureView()), this, SLOT(changeToPrecaptureView()), Qt::UniqueConnection);
+
+ CxuiView *view = mViews[POSTCAPTURE_VIEW];
+ if (view) {
+ connect(view, SIGNAL(changeToPrecaptureView()), this, SLOT(changeToPrecaptureView()), Qt::UniqueConnection);
// Standby signals
- connect(this, SIGNAL(normalStateEntered()), currentView, SLOT(exitStandby()), Qt::UniqueConnection);
- connect(this, SIGNAL(normalStateExited()), currentView, SLOT(enterStandby()), Qt::UniqueConnection);
+ connect(this, SIGNAL(normalStateEntered()), view, SLOT(exitStandby()), Qt::UniqueConnection);
+ connect(this, SIGNAL(normalStateExited()), view, SLOT(enterStandby()), Qt::UniqueConnection);
// connect necessary capturekey signals
- connectCaptureKeySignals();
+ connectCaptureKeySignals(view);
}
-
CX_DEBUG_EXIT_FUNCTION();
}
@@ -743,39 +699,41 @@
void CxuiViewManager::connectSceneModeSignals()
{
CX_DEBUG_ENTER_FUNCTION();
+
+ // Disconnect from the current, "old" view
disconnectSignals();
- connectCaptureKeySignals();
+ CxuiView *view = mViews[SCENE_MODE_VIEW];
+ if (view) {
+ // Standby signals for releasing camera
+ connect(this, SIGNAL(normalStateEntered()), view, SLOT(exitStandby()));
+ connect(this, SIGNAL(normalStateExited()), view, SLOT(enterStandby()));
- // Standby signals for releasing camera
- connect(this, SIGNAL(normalStateEntered()), mSceneModeView, SLOT(exitStandby()));
- connect(this, SIGNAL(normalStateExited()), mSceneModeView, SLOT(enterStandby()));
+ // Moving back to pre-capture view
+ connect(view, SIGNAL(viewCloseEvent()), this, SLOT(changeToPrecaptureView()));
- // Moving back to pre-capture view
- connect(mSceneModeView, SIGNAL(viewCloseEvent()), this, SLOT(changeToPrecaptureView()));
-
+ connectCaptureKeySignals(view);
+ }
CX_DEBUG_EXIT_FUNCTION();
}
/*!
* Connect key handler capture key signals.
*/
-void CxuiViewManager::connectCaptureKeySignals()
+void CxuiViewManager::connectCaptureKeySignals(CxuiView *view)
{
CX_DEBUG_ENTER_FUNCTION();
// Disconnect all existing capture key signals
mKeyHandler->disconnect();
- QObject *currentView = mMainWindow.currentView();
-
- if (currentView) {
+ if (view) {
// If the view class does not implement the named slot, the connect will fail
// and output some warnings as debug prints. This is by design.
- connect(mKeyHandler, SIGNAL(autofocusKeyPressed()), currentView, SLOT(handleAutofocusKeyPressed()));
- connect(mKeyHandler, SIGNAL(autofocusKeyReleased()), currentView, SLOT(handleAutofocusKeyReleased()));
- connect(mKeyHandler, SIGNAL(captureKeyPressed()), currentView, SLOT(handleCaptureKeyPressed()));
- connect(mKeyHandler, SIGNAL(captureKeyReleased()), currentView, SLOT(handleCaptureKeyReleased()));
+ connect(mKeyHandler, SIGNAL(autofocusKeyPressed()), view, SLOT(handleAutofocusKeyPressed()));
+ connect(mKeyHandler, SIGNAL(autofocusKeyReleased()), view, SLOT(handleAutofocusKeyReleased()));
+ connect(mKeyHandler, SIGNAL(captureKeyPressed()), view, SLOT(handleCaptureKeyPressed()));
+ connect(mKeyHandler, SIGNAL(captureKeyReleased()), view, SLOT(handleCaptureKeyReleased()));
}
CX_DEBUG_EXIT_FUNCTION();