camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp
author hgs
Thu, 15 Jul 2010 01:49:11 +0300
changeset 40 2922f70fca82
parent 39 c5025ea871a1
child 41 67457b2ffb33
permissions -rw-r--r--
201023
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28
3075d9b614e6 201017_1
hgs
parents:
diff changeset
     1
/*
3075d9b614e6 201017_1
hgs
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
3075d9b614e6 201017_1
hgs
parents:
diff changeset
     3
* All rights reserved.
3075d9b614e6 201017_1
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
3075d9b614e6 201017_1
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
3075d9b614e6 201017_1
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
3075d9b614e6 201017_1
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
3075d9b614e6 201017_1
hgs
parents:
diff changeset
     8
*
3075d9b614e6 201017_1
hgs
parents:
diff changeset
     9
* Initial Contributors:
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    11
*
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    12
* Contributors:
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    13
*
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    14
* Description:
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    15
*
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    16
*/
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    17
#include <hbframeitem.h>
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    18
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    19
#include "cxenamespace.h"
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    20
#include "cxesettings.h"
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    21
#include "cxuiscenemodeview.h"
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    22
#include "cxuienums.h"
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    23
#include "cxutils.h"
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    24
#include "cxuicapturekeyhandler.h"
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    25
#include "cxuisettingsinfo.h"
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    26
#include "cxeviewfindercontrol.h"
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    27
#include "cxecameradevicecontrol.h"
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    28
#include "cxuidocumentloader.h"
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    29
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    30
using namespace Cxe;
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    31
using namespace CxUi;
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    32
using namespace CxUiLayout;
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    33
using namespace CxUiSettings;
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    34
using namespace CxeSettingIds;
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    35
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    36
const int CXUI_SCENES_TRANSITION_TIME = 350; // 350 milliseconds
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    37
const int CXUI_SCENES_CAMERA_TIMEOUT = 60000; // 60 seconds for the camera hw release timeout
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    38
const QString CXUI_SCENES_AUTOMATIC_IMAGE=":/camerax/scene_automatic.png";
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    39
const QString CXUI_SCENES_LANDSCAPE_IMAGE=":/camerax/scene_landscape.png";
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    40
const QString CXUI_SCENES_CLOSEUP_IMAGE=":/camerax/scene_close-up.png";
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    41
const QString CXUI_SCENES_PORTRAIT_IMAGE=":/camerax/scene_portrait.png";
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    42
const QString CXUI_SCENES_SPORT_IMAGE=":/camerax/scene_sport.png";
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    43
const QString CXUI_SCENES_NIGHT_IMAGE=":/camerax/scene_night.png";
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    44
const QString CXUI_SCENES_NIGHT_PORTRAIT_IMAGE=":/camerax/scene_nightportrait.png";
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    45
const QString CXUI_SCENES_LOW_LIGHT_IMAGE=":/camerax/scene_lowlight.png";
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    46
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    47
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    48
/*!
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    49
* Constructor
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    50
*/
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    51
CxuiSceneModeView::CxuiSceneModeView(QGraphicsItem *parent) :
39
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    52
    CxuiView(parent),
28
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    53
    mSettingsInfo(NULL),
40
hgs
parents: 39
diff changeset
    54
    mScenesBackground(NULL),
hgs
parents: 39
diff changeset
    55
    mScenesHeading(NULL)
28
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    56
{
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    57
    CX_DEBUG_IN_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    58
}
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    59
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    60
/*!
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    61
* Destructor
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    62
*/
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    63
CxuiSceneModeView::~CxuiSceneModeView()
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    64
{
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    65
    CX_DEBUG_ENTER_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    66
    CX_DEBUG_EXIT_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    67
}
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    68
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    69
/*!
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    70
* Construct-method handles initialisation tasks for this class. Needs to be called
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    71
* before the instance of this class is used.
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    72
* @param mainwindow
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    73
* @param engine
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    74
* @param documentLoader
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    75
* @param keyHandler
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    76
*/
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    77
void CxuiSceneModeView::construct(HbMainWindow *mainwindow,
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    78
                               CxeEngine *engine,
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    79
                               CxuiDocumentLoader *documentLoader,
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    80
                               CxuiCaptureKeyHandler *keyHandler)
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    81
{
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    82
    CX_DEBUG_ENTER_FUNCTION();
39
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    83
    CxuiView::construct(mainwindow, engine, documentLoader, keyHandler);
28
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    84
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    85
    mSettingsInfo = new CxuiSettingsInfo(mEngine);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    86
    setContentFullScreen(true);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    87
    loadDefaultWidgets();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    88
39
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    89
    mCameraReleaseTimer.setInterval(CXUI_SCENES_CAMERA_TIMEOUT);
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    90
    mCameraReleaseTimer.setSingleShot(true);
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    91
    connect(&mCameraReleaseTimer, SIGNAL(timeout()), this, SLOT(releaseCamera()), Qt::UniqueConnection);
28
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    92
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    93
    CX_DEBUG_EXIT_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    94
}
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    95
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    96
/*!
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    97
* Load widgets from DocML.
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    98
*/
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    99
void CxuiSceneModeView::loadDefaultWidgets()
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   100
{
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   101
    CX_DEBUG_ENTER_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   102
    CX_DEBUG_ASSERT(mDocumentLoader);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   103
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   104
    QGraphicsWidget *widget = NULL;
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   105
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   106
    widget = mDocumentLoader->findWidget(SCENE_VIEW_CONTAINER);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   107
    mScenesContainer = qobject_cast<HbWidget *> (widget);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   108
40
hgs
parents: 39
diff changeset
   109
    mScenesHeading = qobject_cast<HbLabel *>(
hgs
parents: 39
diff changeset
   110
        mDocumentLoader->findWidget(SCENE_VIEW_HEADING_WIDGET));
hgs
parents: 39
diff changeset
   111
    CX_ASSERT_ALWAYS(mScenesHeading);
hgs
parents: 39
diff changeset
   112
28
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   113
    //Now let's retreive the pointer to icon widget
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   114
    widget = mDocumentLoader->findWidget(SCENE_VIEW_BG_IMAGE);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   115
    mScenesBackground = qobject_cast<HbLabel *> (widget);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   116
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   117
    widget = mDocumentLoader->findWidget(SCENE_VIEW_BG_IMAGE2);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   118
    mScenesBackground2 = qobject_cast<HbLabel *> (widget);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   119
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   120
    //Assuming that the automatic scene mode is always the default one
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   121
    CX_DEBUG(("CxuiSceneModeView::loadDefaultWidgets -> Now setting default image"));
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   122
    mScenesBackground->setIcon(HbIcon(CXUI_SCENES_AUTOMATIC_IMAGE));
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   123
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   124
    widget = mDocumentLoader->findWidget(SCENE_VIEW_RADIOBUTTONS);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   125
    mScenesList = qobject_cast<CxuiSettingRadioButtonList *> (widget);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   126
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   127
    mTransitionAnimation = new QPropertyAnimation(mScenesBackground2, "opacity");
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   128
    mTransitionAnimation->setDuration(CXUI_SCENES_TRANSITION_TIME);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   129
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   130
    createWidgetBackgroundGraphic(mScenesContainer, TRANSPARENT_BACKGROUND_GRAPHIC);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   131
39
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
   132
    //!@todo: View flags property is missing from HbView,
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
   133
    //        so can't properly hide title bar / status bar there.
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
   134
    hideControls();
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
   135
28
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   136
    connectSignals();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   137
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   138
    CX_DEBUG_EXIT_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   139
}
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   140
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   141
/*!
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   142
* Helper function to connect signals needed in this class.
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   143
*/
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   144
void CxuiSceneModeView::connectSignals()
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   145
{
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   146
    connect(mScenesList, SIGNAL(itemSelected(int)), this, SLOT(handleSceneRadiobuttonPress(int)));
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   147
    connect(mTransitionAnimation, SIGNAL(finished()), this, SLOT(finishScenesTransition()));
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   148
}
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   149
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   150
/*!
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   151
* This public method assumes that the view is already properly constructed
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   152
*/
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   153
void CxuiSceneModeView::loadBackgroundImages()
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   154
{
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   155
     CX_DEBUG_ENTER_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   156
    RadioButtonListParams data;
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   157
    if (mEngine->mode() == Cxe::ImageMode) {
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   158
        mSettingsInfo->getSettingsContent(CxeSettingIds::IMAGE_SCENE, data);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   159
    } else {
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   160
        mSettingsInfo->getSettingsContent(CxeSettingIds::VIDEO_SCENE, data);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   161
    }
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   162
    mSettingPairList = data.mSettingPairList;
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   163
    mScenesList->init(&data);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   164
40
hgs
parents: 39
diff changeset
   165
    if (mScenesHeading) {
hgs
parents: 39
diff changeset
   166
        mScenesHeading->setPlainText(data.mHeading);
hgs
parents: 39
diff changeset
   167
    }
hgs
parents: 39
diff changeset
   168
28
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   169
    if (mScenesBackground) {
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   170
        QString sceneId;
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   171
        mEngine->settings().get(data.mSettingId, sceneId);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   172
        mScenesBackground->setIcon(HbIcon(backgroundForScene(sceneId)));
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   173
    } else {
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   174
        //First time displaying a list
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   175
        //Assuming that the automatic scene mode is always the default one and is on top of the list
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   176
        mScenesList->setSelected(0);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   177
    }
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   178
    CX_DEBUG_EXIT_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   179
}
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   180
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   181
/*!
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   182
* Handle selecting value in scene list.
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   183
*/
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   184
void CxuiSceneModeView::handleSceneRadiobuttonPress(int index)
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   185
{
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   186
    CX_DEBUG_ENTER_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   187
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   188
    CxUiSettings::SettingItem item = mSettingPairList.at(index);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   189
    QString sceneId = item.mValue.toString();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   190
    mScenesBackground2->setIcon(HbIcon(backgroundForScene(sceneId)));
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   191
    startBackgroundTransition();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   192
    CX_DEBUG_EXIT_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   193
}
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   194
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   195
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   196
/*!
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   197
* Helper method for getting the background graphic name
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   198
* for each of the scenes.
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   199
*/
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   200
QString CxuiSceneModeView::backgroundForScene(const QString& sceneId)
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   201
{
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   202
    //!@todo: This mapping should be added to the setting xml.
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   203
    if (sceneId == CxeSettingIds::IMAGE_SCENE_AUTO) {
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   204
        return CXUI_SCENES_AUTOMATIC_IMAGE;
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   205
    } else if (sceneId == CxeSettingIds::IMAGE_SCENE_PORTRAIT) {
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   206
        return CXUI_SCENES_PORTRAIT_IMAGE;
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   207
    } else if (sceneId == CxeSettingIds::IMAGE_SCENE_SCENERY) {
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   208
        return CXUI_SCENES_LANDSCAPE_IMAGE;
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   209
    } else if (sceneId == CxeSettingIds::IMAGE_SCENE_MACRO) {
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   210
        return CXUI_SCENES_CLOSEUP_IMAGE;
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   211
    } else if (sceneId == CxeSettingIds::IMAGE_SCENE_SPORTS) {
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   212
        return CXUI_SCENES_SPORT_IMAGE;
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   213
    } else if (sceneId == CxeSettingIds::IMAGE_SCENE_NIGHT) {
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   214
        return CXUI_SCENES_NIGHT_IMAGE;
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   215
    } else if (sceneId == CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT) {
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   216
        return CXUI_SCENES_NIGHT_PORTRAIT_IMAGE;
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   217
    } else if (sceneId == CxeSettingIds::VIDEO_SCENE_AUTO) {
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   218
        return CXUI_SCENES_AUTOMATIC_IMAGE;
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   219
    } else if (sceneId == CxeSettingIds::VIDEO_SCENE_LOWLIGHT) {
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   220
        return CXUI_SCENES_LOW_LIGHT_IMAGE;
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   221
    } else if (sceneId == CxeSettingIds::VIDEO_SCENE_NIGHT) {
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   222
        return CXUI_SCENES_NIGHT_IMAGE;
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   223
    } else {
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   224
        return "";
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   225
    }
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   226
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   227
}
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   228
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   229
/*!
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   230
* Start animation for changing the scene background graphic.
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   231
*/
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   232
void CxuiSceneModeView::startBackgroundTransition()
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   233
{
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   234
    mTransitionAnimation->setStartValue(0.0);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   235
    mTransitionAnimation->setEndValue(1.0);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   236
    mTransitionAnimation->start();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   237
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   238
}
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   239
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   240
/*!
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   241
* Handle scene background graphic animation finishing.
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   242
*/
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   243
void CxuiSceneModeView::finishScenesTransition()
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   244
{
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   245
    mScenesBackground->setIcon(mScenesBackground2->icon());
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   246
    mScenesBackground2->setOpacity(0);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   247
    mScenesBackground2->setIcon(HbIcon());
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   248
}
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   249
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   250
/*!
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   251
* Handle press of ok button.
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   252
*/
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   253
void CxuiSceneModeView::handleOkButtonPress()
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   254
{
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   255
    CX_DEBUG_ENTER_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   256
    mScenesList->handleSelectionAccepted();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   257
    closeView();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   258
    CX_DEBUG_EXIT_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   259
}
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   260
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   261
/*!
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   262
* Handle press of cancel button.
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   263
*/
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   264
void CxuiSceneModeView::handleCancelButtonPress()
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   265
{
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   266
    CX_DEBUG_ENTER_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   267
    closeView();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   268
    CX_DEBUG_EXIT_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   269
}
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   270
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   271
/*!
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   272
* This view is about to be shown.
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   273
* Update the view to match currently selected scene.
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   274
*/
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   275
void CxuiSceneModeView::showEvent(QShowEvent *event)
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   276
{
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   277
    CX_DEBUG_ENTER_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   278
    mScenesList->scrollTo(mScenesList->currentIndex(), HbAbstractItemView::PositionAtTop);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   279
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   280
    mEngine->viewfinderControl().stop();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   281
    mCameraReleaseTimer.start();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   282
    QGraphicsWidget::showEvent(event);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   283
    CX_DEBUG_EXIT_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   284
}
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   285
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   286
/*!
39
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
   287
* Allow showing UI controls?
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
   288
* Title bar and other UI chrome is never shown in scene mode view.
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
   289
*/
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
   290
bool CxuiSceneModeView::allowShowControls() const
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
   291
{
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
   292
    return false;
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
   293
}
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
   294
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
   295
/*!
28
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   296
* Slot to handle capture key full press.
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   297
*/
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   298
void CxuiSceneModeView::handleCaptureKeyPressed()
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   299
{
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   300
    CX_DEBUG_ENTER_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   301
    closeView();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   302
    CX_DEBUG_EXIT_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   303
}
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   304
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   305
/*!
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   306
* Slot to handle capture key half press / autofocus key press.
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   307
*/
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   308
void CxuiSceneModeView::handleAutofocusKeyPressed()
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   309
{
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   310
    CX_DEBUG_ENTER_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   311
    closeView();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   312
    CX_DEBUG_EXIT_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   313
}
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   314
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   315
/*!
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   316
* Closing the view and reactivating camera hw if needed
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   317
*/
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   318
void CxuiSceneModeView::closeView()
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   319
{
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   320
    CX_DEBUG_ENTER_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   321
    mScenesList->handleClose();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   322
    mScenesBackground->setIcon(HbIcon());
40
hgs
parents: 39
diff changeset
   323
    mScenesHeading = NULL;
28
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   324
    // Make sure engine prepares for new image/video if necessary
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   325
    mEngine->initMode(mEngine->mode());
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   326
    emit viewCloseEvent();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   327
    CX_DEBUG_EXIT_FUNCTION();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   328
}
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   329
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   330
// end of file
3075d9b614e6 201017_1
hgs
parents:
diff changeset
   331