camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp
author hgs
Fri, 03 Sep 2010 11:00:58 +0300
changeset 55 0da2a5b56583
parent 52 7e18d488ac5f
child 58 ddba9caa7f32
permissions -rw-r--r--
201035_1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
     2
* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
46
hgs
parents: 42
diff changeset
    18
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <QApplication>
42
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
    21
#include <QGraphicsLayout>
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#include <hbmainwindow.h>
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
#include <hbaction.h>
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
#include <hbtoolbar.h>
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
#include <hbtoolbarextension.h>
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
#include <hbtransparentwindow.h>
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
#include <hblabel.h>
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
#include <hbslider.h>
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
#include <hbmenu.h>
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
#include <hbdialog.h>
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
#include <hbnotificationdialog.h>
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
#include <hbfeedbacksettings.h>
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
#include <hbfeedbacknamespace.h>
41
hgs
parents: 40
diff changeset
    35
#include <hbactivitymanager.h>
55
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
    36
#include <hbextendedlocale.h>
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
#include "cxuivideoprecaptureview.h"
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
#include "cxeengine.h"
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
#include "cxeviewfindercontrol.h"
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
#include "cxevideocapturecontrol.h"
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
#include "cxecameradevicecontrol.h"
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
#include "cxenamespace.h"
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
#include "cxesettings.h"
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
#include "cxuienums.h"
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
#include "cxutils.h"
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
    47
#include "cxuizoomslider.h"
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
#include "cxuicapturekeyhandler.h"
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
#include "cxuidocumentloader.h"
42
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
    50
#include "cxuiserviceprovider.h"
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
    51
46
hgs
parents: 42
diff changeset
    52
#ifdef Q_OS_SYMBIAN
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
#include "OstTraceDefinitions.h"
46
hgs
parents: 42
diff changeset
    54
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
#ifdef OST_TRACE_COMPILER_IN_USE
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
#include "cxuivideoprecaptureviewTraces.h"
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
#endif
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
46
hgs
parents: 42
diff changeset
    59
#include <e32keys.h>
hgs
parents: 42
diff changeset
    60
#endif  //Q_OS_SYMBIAN
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    61
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    62
using namespace Cxe;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
using namespace CxUiLayout;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    64
using namespace CxUiInternal;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
namespace
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
    static const int CXUI_ELAPSED_TIME_TIMEOUT = 1000; // 1 second
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
    static const int CXUI_RECORD_ANIMATION_DURATION = 3000; // milliseconds
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
    70
    static const int CXUI_PAUSE_TIMEOUT = 60*1000;   // 60 seconds
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
46
hgs
parents: 42
diff changeset
    72
    const int POSTCAPTURE_ON = -1;
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
CxuiVideoPrecaptureView::CxuiVideoPrecaptureView(QGraphicsItem *parent) :
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
    CxuiPrecaptureView(parent),
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
    mElapsedTimer(this),
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
    mTimeElapsed(0),
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
    mTimeRemaining(0),
46
hgs
parents: 42
diff changeset
    81
    mVideoTimeText(NULL),
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
    mRecordingIcon(NULL),
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
    mGoToStillAction(NULL),
39
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
    84
    mToolbarIdle(NULL),
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
    85
    mToolbarRec(NULL),
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
    86
    mToolbarPaused(NULL),
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
    mVideoScenePopup(NULL),
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
    mVideoCaptureControl(NULL),
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
    mMenu(NULL),
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
    mCapturePending(false)
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
    CX_DEBUG_IN_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
CxuiVideoPrecaptureView::~CxuiVideoPrecaptureView()
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
    CX_DEBUG_IN_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
    mElapsedTimer.stop();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
    delete mMenu;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
    CX_DEBUG_EXIT_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
42
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   103
/*!
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   104
 * Construct-method handles initialisation tasks for this class.
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   105
 * @param mainwindow
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   106
 * @param engine
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   107
 * @param documentLoader
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   108
 * @param keyHandler
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   109
 */
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
void CxuiVideoPrecaptureView::construct(HbMainWindow *mainwindow, CxeEngine *engine,
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   111
                                        CxuiDocumentLoader *documentLoader,
41
hgs
parents: 40
diff changeset
   112
                                        CxuiCaptureKeyHandler *keyHandler,
hgs
parents: 40
diff changeset
   113
                                        HbActivityManager *activityManager)
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
    CX_DEBUG_ENTER_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
41
hgs
parents: 40
diff changeset
   117
    CxuiPrecaptureView::construct(mainwindow, engine, documentLoader, keyHandler, activityManager);
39
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   118
    mCaptureKeyHandler = keyHandler;
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   120
    mVideoCaptureControl = &(engine->videoCaptureControl());
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   122
    connect(&mElapsedTimer, SIGNAL(timeout()), this, SLOT(updateTimeLabels()));
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
    connect(mVideoCaptureControl, SIGNAL(stateChanged(CxeVideoCaptureControl::State, CxeError::Id)),
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
            this, SLOT(handleVideoStateChanged(CxeVideoCaptureControl::State,CxeError::Id)));
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   125
    connect(mVideoCaptureControl, SIGNAL(remainingTimeChanged()),
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   126
            this, SLOT(updateTimeLabels()));
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   127
46
hgs
parents: 42
diff changeset
   128
    mEngine->settings().listenForSetting(CxeSettingIds::VIDEO_SCENE, this, SLOT(handleSceneChanged(const QVariant&)));
hgs
parents: 42
diff changeset
   129
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   130
    mPauseTimer.setSingleShot(true);
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   131
    connect(&mPauseTimer, SIGNAL(timeout()), this, SLOT(stop()));
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   132
    mPauseTimer.setInterval(CXUI_PAUSE_TIMEOUT);
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   133
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   134
    HbAction *quitAction = new HbAction(Hb::QuitNaviAction, this);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   135
    setNavigationAction(quitAction);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   136
    connect(quitAction, SIGNAL(triggered()), this, SLOT(handleQuitClicked()));
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   137
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   138
    loadDefaultWidgets();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
    loadWidgets();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   140
    hideControls();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
    CX_DEBUG_EXIT_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   143
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
42
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   146
/*!
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   147
 * Loads widgets that are needed right from the start.
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   148
 */
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   149
void CxuiVideoPrecaptureView::loadDefaultWidgets()
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
    CX_DEBUG_ENTER_FUNCTION();
42
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   152
    CX_ASSERT_ALWAYS(mDocumentLoader);
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
    // get pointers to ui components from the layout data
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   155
    QGraphicsWidget *widget = NULL;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   156
    widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_VIEWFINDER);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
    mViewfinder = qobject_cast<HbTransparentWindow *> (widget);
42
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   158
    CX_ASSERT_ALWAYS(mViewfinder);
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
42
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   160
    reloadIndicatorWidgets();
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   161
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   162
    CX_DEBUG_EXIT_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   163
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
42
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   165
/*!
46
hgs
parents: 42
diff changeset
   166
 * Loads default indicators from docml and modifies the visibility
42
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   167
 * according to current settings.
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   168
 */
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   169
void CxuiVideoPrecaptureView::reloadIndicatorWidgets()
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   170
{
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   171
    CX_DEBUG_ENTER_FUNCTION();
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   172
    CX_ASSERT_ALWAYS(mDocumentLoader);
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   173
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   174
    bool ok = false;
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   175
    mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_INDICATORS_SECTION, &ok);
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   176
    CX_ASSERT_ALWAYS(ok);
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   177
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   178
    QGraphicsWidget *widget = NULL;
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   179
    widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_QUALITY_ICON);
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   180
    mQualityIcon = qobject_cast<HbLabel *> (widget);
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   181
    CX_ASSERT_ALWAYS(mQualityIcon);
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   182
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   183
    widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_VIDEOAUDIOMUTE_INDICATOR_ICON);
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   184
    HbLabel *videoaudiomuteIndicatorIcon = qobject_cast<HbLabel *>(widget);
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   185
    CX_ASSERT_ALWAYS(videoaudiomuteIndicatorIcon);
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   186
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   187
    widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_STABILITY_INDICATOR_ICON);
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   188
    HbLabel *videoStabilityIndicatorIcon = qobject_cast<HbLabel *>(widget);
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   189
    CX_ASSERT_ALWAYS(videoStabilityIndicatorIcon);
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   190
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   191
    widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_INDICATOR_CONTAINER_TOP);
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   192
    mIndicators = qobject_cast<HbWidget *>(widget);
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   193
    CX_ASSERT_ALWAYS(mIndicators);
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   194
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   195
    QGraphicsLayout *layout = mIndicators->layout();
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   196
    QGraphicsLayoutItem *graphicsLayoutItem = NULL;
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   197
    QGraphicsItem *graphicsItem = NULL;
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   198
    QString key = "";
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   199
    int currentSettingValue = -1;
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   200
    bool isSettingOff = false;
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   201
    // Go through the items in the layout to check whether they should be
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   202
    // shown or not in the indicator pane. Start from the last towards
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   203
    // the first, so that removing items from between works correctly.
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   204
    for (int i = layout->count() - 1; i >= 0; i--) {
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   205
        graphicsLayoutItem = layout->itemAt(i);
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   206
        isSettingOff = false;
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   207
        if (graphicsLayoutItem) {
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   208
            graphicsItem = graphicsLayoutItem->graphicsItem();
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   209
            currentSettingValue = -1;
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   210
            if (graphicsItem == videoaudiomuteIndicatorIcon) {
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   211
                key = CxeSettingIds::VIDEO_MUTE_SETTING;
46
hgs
parents: 42
diff changeset
   212
                currentSettingValue = mEngine->settings().get(key, currentSettingValue);
hgs
parents: 42
diff changeset
   213
                // video mute implementation does not use
hgs
parents: 42
diff changeset
   214
                // enum for on/off values but instead
42
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   215
                // 0 for off and 1 for on.
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   216
                if (currentSettingValue == 0) {
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   217
                    isSettingOff = true;
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   218
                }
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   219
            } else if (graphicsItem == videoStabilityIndicatorIcon) {
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   220
                // remove video stability indicator.
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   221
                isSettingOff = true;
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   222
            }
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   223
            if (isSettingOff) {
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   224
                layout->removeAt(i);
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   225
            }
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   226
        }
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   227
    }
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   228
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   229
    // Create background graphics for indicator container
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   230
    createWidgetBackgroundGraphic(mIndicators, TRANSPARENT_BACKGROUND_GRAPHIC);
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   231
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   232
    mIndicators->setVisible(true);
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   233
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   234
    CX_DEBUG_EXIT_FUNCTION();
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   235
}
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   236
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   237
/*!
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   238
 * Loads widgets that are not part of the default section in layouts xml.
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   239
 * Widgets are created at the time they are first loaded.
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   240
 */
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   241
void CxuiVideoPrecaptureView::loadWidgets()
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   242
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   243
    CX_DEBUG_ENTER_FUNCTION();
42
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   244
    CX_ASSERT_ALWAYS(mDocumentLoader);
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   245
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   246
    if (mWidgetsLoaded) {
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   247
        CX_DEBUG(("Widgets already loaded"));
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   248
        CX_DEBUG_EXIT_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   249
        return;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   250
    }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   251
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   252
    // get pointers to ui components from the layout data
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   253
    QGraphicsWidget *widget = NULL;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   254
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
    // load the "secondary" widgets
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
    bool ok = false;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   257
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   258
    // load widgets section (creates the widgets)
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   259
    mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_WIDGETS_SECTION, &ok);
42
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   260
    CX_ASSERT_ALWAYS(ok);
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   261
    if (CxuiServiceProvider::isCameraEmbedded()) {
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   262
        mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_EMBEDDED_SECTION, &ok);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   263
    } else {
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   264
        mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_STANDALONE_SECTION, &ok);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   265
    }
42
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   266
    CX_ASSERT_ALWAYS(ok);
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   267
    // get needed pointers to some of the widgets
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   268
    widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_ZOOM_SLIDER);
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   269
    mSlider = qobject_cast<CxuiZoomSlider *> (widget);
42
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   270
    CX_ASSERT_ALWAYS(mSlider);
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   271
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   272
    //Let's add a plus and minus buttons to the slider
39
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   273
    mSlider->addZoomButtons();
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   274
    createWidgetBackgroundGraphic(mSlider, TRANSPARENT_BACKGROUND_GRAPHIC);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   275
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
    widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_TOOLBAR);
39
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   277
    mToolbarIdle = qobject_cast<HbToolBar *> (widget);
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   278
    widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_TOOLBAR_REC);
39
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   279
    mToolbarRec = qobject_cast<HbToolBar *> (widget);
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   280
    widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_TOOLBAR_PAUSED);
39
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   281
    mToolbarPaused = qobject_cast<HbToolBar *> (widget);
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   282
39
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   283
    mToolbar = mToolbarIdle;
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   284
42
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   285
    CX_ASSERT_ALWAYS(mToolbarIdle);
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   286
    CX_ASSERT_ALWAYS(mToolbarRec);
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   287
    CX_ASSERT_ALWAYS(mToolbarPaused);
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   288
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   289
    hideControls();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   290
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   291
    if (CxuiServiceProvider::isCameraEmbedded()) {
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   292
        CX_DEBUG(("EMBEDDED: camera in embedded mode"));
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   293
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   294
        if (!CxuiServiceProvider::instance()->allowQualityChange()) {
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   295
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   296
            CX_DEBUG(("EMBEDDED: don't allow quality change"));
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   297
            HbAction* vq = qobject_cast<HbAction*> (mDocumentLoader->findObject(VIDEO_PRE_CAPTURE_VIDEO_QUALITY_ACTION));
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   298
            if (vq) {
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   299
                CX_DEBUG(("EMBEDDED: setting image quality setting to disabled"));
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   300
                vq->setEnabled(false);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   301
            }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   302
        }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   303
        if (!CxuiServiceProvider::instance()->allowModeSwitching()) {
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   304
            CX_DEBUG(("EMBEDDED: don't allow mode switching"));
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   305
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   306
            HbAction *still = qobject_cast<HbAction*> (mDocumentLoader->findObject(VIDEO_PRE_CAPTURE_GOTO_STILL_ACTION));
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   307
            if (still) {
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   308
                CX_DEBUG(("EMBEDDED: setting mode switch to disabled"));
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   309
                still->setEnabled(false);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   310
            }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   311
        }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   312
        if (!CxuiServiceProvider::instance()->allowCameraSwitching()) {
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   313
            CX_DEBUG(("EMBEDDED: don't allow camera switching"));
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   314
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   315
        }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   316
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   317
    }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   318
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   319
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   320
    // Create background graphic for indicator container
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   321
    HbWidget *indicatorContainer;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   322
    widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_INDICATOR_CONTAINER_BOTTOM);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   323
    indicatorContainer = qobject_cast<HbWidget *>(widget);
42
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   324
    CX_ASSERT_ALWAYS(indicatorContainer);
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   325
    createWidgetBackgroundGraphic(indicatorContainer, TRANSPARENT_BACKGROUND_GRAPHIC);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   326
46
hgs
parents: 42
diff changeset
   327
    widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_VIDEO_TIME_LABEL);
hgs
parents: 42
diff changeset
   328
    mVideoTimeText = qobject_cast<HbLabel *> (widget);
hgs
parents: 42
diff changeset
   329
    CX_ASSERT_ALWAYS(mVideoTimeText);
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   330
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   331
    widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_RECORDING_ICON);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   332
    mRecordingIcon = qobject_cast<HbLabel *> (widget);
42
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   333
    CX_ASSERT_ALWAYS(mRecordingIcon);
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   334
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   335
    mWidgetsLoaded = true;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   336
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   337
    // Initializing recording indicator animation
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   338
    mRecordingAnimation = new QPropertyAnimation(mRecordingIcon, "opacity");
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   339
    mRecordingAnimation->setStartValue(0.2);
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   340
    mRecordingAnimation->setKeyValueAt(0.5, 1.0);
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   341
    mRecordingAnimation->setEndValue(0.2);
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   342
    mRecordingAnimation->setDuration(CXUI_RECORD_ANIMATION_DURATION);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   343
    mRecordingAnimation->setLoopCount(-1);
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   344
    mRecordingAnimation->setEasingCurve(QEasingCurve::OutInQuad);
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   345
38
hgs
parents: 28
diff changeset
   346
hgs
parents: 28
diff changeset
   347
    // Update toolbar scene mode icon.
46
hgs
parents: 42
diff changeset
   348
    try {
hgs
parents: 42
diff changeset
   349
        updateSceneIcon(mEngine->settings().get<QString>(CxeSettingIds::VIDEO_SCENE));
hgs
parents: 42
diff changeset
   350
    } catch (CxeException &e) {
hgs
parents: 42
diff changeset
   351
        // ignore error
38
hgs
parents: 28
diff changeset
   352
    }
hgs
parents: 28
diff changeset
   353
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   354
    // Initialize the video time counters.
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   355
    updateTimeLabels();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   356
41
hgs
parents: 40
diff changeset
   357
    // View is ready. Needed for startup performance automated testing.
hgs
parents: 40
diff changeset
   358
    emit viewReady();
38
hgs
parents: 28
diff changeset
   359
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   360
    CX_DEBUG_EXIT_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   361
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   362
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   363
/*!
41
hgs
parents: 40
diff changeset
   364
 * Restore view state from activity.
hgs
parents: 40
diff changeset
   365
 */
hgs
parents: 40
diff changeset
   366
void CxuiVideoPrecaptureView::restoreActivity(const QString &activityId, const QVariant &data)
hgs
parents: 40
diff changeset
   367
{
hgs
parents: 40
diff changeset
   368
    Q_UNUSED(activityId);
hgs
parents: 40
diff changeset
   369
    Q_UNUSED(data);
hgs
parents: 40
diff changeset
   370
hgs
parents: 40
diff changeset
   371
    CX_DEBUG_ENTER_FUNCTION();
hgs
parents: 40
diff changeset
   372
    // no need to restore any state
hgs
parents: 40
diff changeset
   373
    CX_DEBUG_EXIT_FUNCTION();
hgs
parents: 40
diff changeset
   374
}
hgs
parents: 40
diff changeset
   375
hgs
parents: 40
diff changeset
   376
/*!
hgs
parents: 40
diff changeset
   377
 * Save view state to activity.
hgs
parents: 40
diff changeset
   378
 */
hgs
parents: 40
diff changeset
   379
void CxuiVideoPrecaptureView::saveActivity()
hgs
parents: 40
diff changeset
   380
{
hgs
parents: 40
diff changeset
   381
    CX_DEBUG_ENTER_FUNCTION();
hgs
parents: 40
diff changeset
   382
    QVariantMap data;
hgs
parents: 40
diff changeset
   383
    QVariantHash params;
52
hgs
parents: 46
diff changeset
   384
hgs
parents: 46
diff changeset
   385
    HbIcon activityScreenshot("qtg_graf_taskswitcher_camcorder");
hgs
parents: 46
diff changeset
   386
    QPixmap screenshot = activityScreenshot.pixmap();
hgs
parents: 46
diff changeset
   387
    params.insert("screenshot", screenshot);
hgs
parents: 46
diff changeset
   388
hgs
parents: 46
diff changeset
   389
    mActivityManager->removeActivity(
hgs
parents: 46
diff changeset
   390
            CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY);
hgs
parents: 46
diff changeset
   391
    mActivityManager->addActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY,
hgs
parents: 46
diff changeset
   392
                                  data, params);
41
hgs
parents: 40
diff changeset
   393
    CX_DEBUG_EXIT_FUNCTION();
hgs
parents: 40
diff changeset
   394
}
hgs
parents: 40
diff changeset
   395
hgs
parents: 40
diff changeset
   396
/*!
hgs
parents: 40
diff changeset
   397
 * Clear activity from activity manager.
hgs
parents: 40
diff changeset
   398
 */
hgs
parents: 40
diff changeset
   399
void CxuiVideoPrecaptureView::clearActivity()
hgs
parents: 40
diff changeset
   400
{
hgs
parents: 40
diff changeset
   401
    CX_DEBUG_ENTER_FUNCTION();
hgs
parents: 40
diff changeset
   402
    mActivityManager->removeActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY);
hgs
parents: 40
diff changeset
   403
    CX_DEBUG_EXIT_FUNCTION();
hgs
parents: 40
diff changeset
   404
}
hgs
parents: 40
diff changeset
   405
hgs
parents: 40
diff changeset
   406
/*!
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   407
* Initialize settings grid.
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   408
*/
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   409
void CxuiVideoPrecaptureView::initializeSettingsGrid()
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   410
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   411
    if(!mSettingsGrid) {
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   412
        HbAction* action(NULL);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   413
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   414
        mSettingsGrid = new HbToolBarExtension;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   415
38
hgs
parents: 28
diff changeset
   416
        action = mSettingsGrid->addAction(HbIcon("qtg_mono_exposure"), hbTrId("txt_cam_button_exposure_compensation"), this, SLOT(launchSliderSetting()));
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   417
        action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::EV_COMPENSATION_VALUE);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   418
        action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   419
38
hgs
parents: 28
diff changeset
   420
        action = mSettingsGrid->addAction(HbIcon("qtg_small_rgb"), hbTrId("txt_cam_button_color_tone"), this, SLOT(launchSetting()));
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   421
        action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::COLOR_TONE);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   422
        action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   423
38
hgs
parents: 28
diff changeset
   424
        action = mSettingsGrid->addAction(HbIcon("qtg_mono_white_balance"), hbTrId("txt_cam_button_white_balance"), this, SLOT(launchSetting()));
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   425
        action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::WHITE_BALANCE);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   426
        action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   427
39
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   428
        connect(mCaptureKeyHandler, SIGNAL(autofocusKeyPressed()), mSettingsGrid, SLOT(close()));
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   429
    }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   430
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   431
46
hgs
parents: 42
diff changeset
   432
41
hgs
parents: 40
diff changeset
   433
/**
hgs
parents: 40
diff changeset
   434
* Get if postcapture view should be shown or not.
hgs
parents: 40
diff changeset
   435
* Postcapture view may be shown for a predefined time or
hgs
parents: 40
diff changeset
   436
* until user dismisses it, or it may be completely disabled.
hgs
parents: 40
diff changeset
   437
*/
hgs
parents: 40
diff changeset
   438
bool CxuiVideoPrecaptureView::isPostcaptureOn() const
hgs
parents: 40
diff changeset
   439
{
hgs
parents: 40
diff changeset
   440
    CX_DEBUG_ENTER_FUNCTION();
hgs
parents: 40
diff changeset
   441
    if (CxuiServiceProvider::isCameraEmbedded()) {
hgs
parents: 40
diff changeset
   442
        // always show post capture in embedded mode
hgs
parents: 40
diff changeset
   443
        CX_DEBUG_EXIT_FUNCTION();
hgs
parents: 40
diff changeset
   444
        return true;
hgs
parents: 40
diff changeset
   445
    }
hgs
parents: 40
diff changeset
   446
hgs
parents: 40
diff changeset
   447
    // Read the value from settings. Ignoring reading error.
hgs
parents: 40
diff changeset
   448
    // On error (missing settings) default to "postcapture on".
46
hgs
parents: 42
diff changeset
   449
    int showPostcapture(POSTCAPTURE_ON);
41
hgs
parents: 40
diff changeset
   450
    if(mEngine) {
46
hgs
parents: 42
diff changeset
   451
        showPostcapture = mEngine->settings().get<int>(CxeSettingIds::VIDEO_SHOWCAPTURED, POSTCAPTURE_ON);
41
hgs
parents: 40
diff changeset
   452
    }
hgs
parents: 40
diff changeset
   453
hgs
parents: 40
diff changeset
   454
    CX_DEBUG_EXIT_FUNCTION();
hgs
parents: 40
diff changeset
   455
    return showPostcapture != 0; // 0 == no postcapture
hgs
parents: 40
diff changeset
   456
}
hgs
parents: 40
diff changeset
   457
hgs
parents: 40
diff changeset
   458
/*!
hgs
parents: 40
diff changeset
   459
* Update the scene mode icon.
hgs
parents: 40
diff changeset
   460
* @param sceneId The new scene id.
hgs
parents: 40
diff changeset
   461
*/
hgs
parents: 40
diff changeset
   462
void CxuiVideoPrecaptureView::updateSceneIcon(const QString& sceneId)
hgs
parents: 40
diff changeset
   463
{
hgs
parents: 40
diff changeset
   464
    CX_DEBUG_ENTER_FUNCTION();
hgs
parents: 40
diff changeset
   465
hgs
parents: 40
diff changeset
   466
    if (mEngine->mode() == Cxe::VideoMode) {
hgs
parents: 40
diff changeset
   467
        CX_DEBUG(("CxuiPrecaptureView - scene: %s", sceneId.toAscii().constData()));
hgs
parents: 40
diff changeset
   468
hgs
parents: 40
diff changeset
   469
        // No need to update icon, if widgets are not even loaded yet.
hgs
parents: 40
diff changeset
   470
        // We'll update the icon once the widgets are loaded.
hgs
parents: 40
diff changeset
   471
        if (mWidgetsLoaded) {
hgs
parents: 40
diff changeset
   472
            QString iconObjectName = VIDEO_PRE_CAPTURE_SCENE_MODE_ACTION;
hgs
parents: 40
diff changeset
   473
            QString icon = getSettingItemIcon(CxeSettingIds::VIDEO_SCENE, sceneId);
hgs
parents: 40
diff changeset
   474
hgs
parents: 40
diff changeset
   475
            CX_DEBUG(("CxuiVideoPrecaptureView - icon: %s", icon.toAscii().constData()));
hgs
parents: 40
diff changeset
   476
hgs
parents: 40
diff changeset
   477
            if (mDocumentLoader) {
hgs
parents: 40
diff changeset
   478
                QObject *obj = mDocumentLoader->findObject(iconObjectName);
42
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   479
                CX_ASSERT_ALWAYS(obj);
41
hgs
parents: 40
diff changeset
   480
                qobject_cast<HbAction *>(obj)->setIcon(HbIcon(icon));
hgs
parents: 40
diff changeset
   481
            }
hgs
parents: 40
diff changeset
   482
        } else {
hgs
parents: 40
diff changeset
   483
            CX_DEBUG(("CxuiVideoPrecaptureView - widgets not loaded yet, ignored!"));
hgs
parents: 40
diff changeset
   484
        }
hgs
parents: 40
diff changeset
   485
    }
hgs
parents: 40
diff changeset
   486
    CX_DEBUG_EXIT_FUNCTION();
hgs
parents: 40
diff changeset
   487
}
hgs
parents: 40
diff changeset
   488
hgs
parents: 40
diff changeset
   489
/*!
hgs
parents: 40
diff changeset
   490
    Update the quality indicator
hgs
parents: 40
diff changeset
   491
*/
hgs
parents: 40
diff changeset
   492
void CxuiVideoPrecaptureView::updateQualityIcon()
hgs
parents: 40
diff changeset
   493
{
hgs
parents: 40
diff changeset
   494
    CX_DEBUG_ENTER_FUNCTION();
hgs
parents: 40
diff changeset
   495
hgs
parents: 40
diff changeset
   496
    if (mQualityIcon && mEngine) {
hgs
parents: 40
diff changeset
   497
        QString icon = "";
hgs
parents: 40
diff changeset
   498
46
hgs
parents: 42
diff changeset
   499
        int currentValue = mEngine->settings().get<int>(CxeSettingIds::VIDEO_QUALITY, -1);
41
hgs
parents: 40
diff changeset
   500
        icon = getSettingItemIcon(CxeSettingIds::VIDEO_QUALITY, currentValue);
hgs
parents: 40
diff changeset
   501
hgs
parents: 40
diff changeset
   502
        mQualityIcon->setIcon(HbIcon(icon));
hgs
parents: 40
diff changeset
   503
    }
hgs
parents: 40
diff changeset
   504
hgs
parents: 40
diff changeset
   505
    CX_DEBUG_EXIT_FUNCTION();
hgs
parents: 40
diff changeset
   506
}
hgs
parents: 40
diff changeset
   507
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   508
void CxuiVideoPrecaptureView::record()
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   509
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   510
    CX_DEBUG_ENTER_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   511
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   512
    int time(0);
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   513
    mVideoCaptureControl->remainingTime(time);
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   514
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   515
    if (time) {
46
hgs
parents: 42
diff changeset
   516
        if (!mMenu){ // Only take out menu, if we have not already done it
hgs
parents: 42
diff changeset
   517
            mMenu = takeMenu();
hgs
parents: 42
diff changeset
   518
        }
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   519
        mVideoCaptureControl->record();
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   520
    } else {
41
hgs
parents: 40
diff changeset
   521
        emit errorEncountered(CxeError::DiskFull);
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   522
    }
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   523
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   524
    CX_DEBUG_EXIT_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   525
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   526
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   527
void CxuiVideoPrecaptureView::pause()
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   528
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   529
    CX_DEBUG_ENTER_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   530
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   531
    CxeVideoCaptureControl::State state = mVideoCaptureControl->state();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   532
    if (state == CxeVideoCaptureControl::Recording) {
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   533
        mVideoCaptureControl->pause();
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   534
    } else if (state == CxeVideoCaptureControl::Paused) {
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   535
        mVideoCaptureControl->record();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   536
    }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   537
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   538
    CX_DEBUG_EXIT_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   539
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   540
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   541
void CxuiVideoPrecaptureView::stop()
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   542
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   543
    CX_DEBUG_ENTER_FUNCTION();
38
hgs
parents: 28
diff changeset
   544
hgs
parents: 28
diff changeset
   545
    CxeVideoCaptureControl::State state = mVideoCaptureControl->state();
hgs
parents: 28
diff changeset
   546
    if (state == CxeVideoCaptureControl::Recording ||
hgs
parents: 28
diff changeset
   547
        state == CxeVideoCaptureControl::Paused) {
hgs
parents: 28
diff changeset
   548
        mVideoCaptureControl->stop();
hgs
parents: 28
diff changeset
   549
        // Continue in handleVideoStateChanged().
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   550
    }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   551
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   552
    CX_DEBUG_EXIT_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   553
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   554
39
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   555
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   556
/*!
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   557
* Allow showing UI controls?
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   558
*/
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   559
bool CxuiVideoPrecaptureView::allowShowControls() const
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   560
{
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   561
    bool show(false);
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   562
    if (mEngine) {
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   563
        CxeVideoCaptureControl::State state(mEngine->videoCaptureControl().state());
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   564
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   565
        show = (mEngine->isEngineReady()
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   566
             || state == CxeVideoCaptureControl::Recording
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   567
             || state == CxeVideoCaptureControl::Paused);
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   568
    }
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   569
    return show;
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   570
}
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   571
41
hgs
parents: 40
diff changeset
   572
/*!
hgs
parents: 40
diff changeset
   573
 * Play feedback when touching view outside of any widget?
hgs
parents: 40
diff changeset
   574
 * If video is paused feedback is off.  Otherwise on.
hgs
parents: 40
diff changeset
   575
 */
hgs
parents: 40
diff changeset
   576
bool CxuiVideoPrecaptureView::isFeedbackEnabled() const
hgs
parents: 40
diff changeset
   577
{
hgs
parents: 40
diff changeset
   578
    CxeVideoCaptureControl::State state(mEngine->videoCaptureControl().state());
hgs
parents: 40
diff changeset
   579
    if (state == CxeVideoCaptureControl::Paused) {
hgs
parents: 40
diff changeset
   580
        return false;
hgs
parents: 40
diff changeset
   581
    } else {
hgs
parents: 40
diff changeset
   582
        return true;
hgs
parents: 40
diff changeset
   583
    }
hgs
parents: 40
diff changeset
   584
}
hgs
parents: 40
diff changeset
   585
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   586
// CxuiPrecaptureView::showToolbar()
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   587
// Shows toolbar. Calls the base class implementation if not recording
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   588
// since toolbar is not shown during recording
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   589
void CxuiVideoPrecaptureView::showToolbar()
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   590
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   591
    CxeVideoCaptureControl::State state = mVideoCaptureControl->state();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   592
    if (state == CxeVideoCaptureControl::Recording) {
39
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   593
        if (mToolbar != mToolbarRec) {
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   594
            mToolbar->hide();
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   595
            mToolbar = mToolbarRec;
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   596
        }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   597
    } else if (state ==CxeVideoCaptureControl::Ready) {
39
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   598
        if (mToolbar != mToolbarIdle) {
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   599
            mToolbar->hide();
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   600
            mToolbar = mToolbarIdle;
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   601
        }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   602
    } else if (state == CxeVideoCaptureControl::Paused) {
39
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   603
        if (mToolbar != mToolbarPaused) {
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   604
            mToolbar->hide();
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   605
            mToolbar = mToolbarPaused;
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   606
        }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   607
    }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   608
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   609
    CxuiPrecaptureView::showToolbar();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   610
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   611
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   612
void CxuiVideoPrecaptureView::disableFeedback()
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   613
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   614
    CX_DEBUG_ENTER_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   615
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   616
    HbFeedbackSettings settings;
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   617
    settings.disableFeedback();
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   618
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   619
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   620
    CX_DEBUG_EXIT_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   621
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   622
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   623
void CxuiVideoPrecaptureView::enableFeedback()
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   624
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   625
    CX_DEBUG_ENTER_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   626
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   627
    HbFeedbackSettings settings;
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   628
    settings.enableFeedback();
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   629
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   630
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   631
    CX_DEBUG_EXIT_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   632
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   633
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   634
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   635
void CxuiVideoPrecaptureView::goToStill()
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   636
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   637
    CX_DEBUG_ENTER_FUNCTION();
42
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   638
    OstTrace0( camerax_performance, CXUIVIDEOPRECAPTUREVIEW_GOTOSTILL, "msg: e_CX_GO_TO_STILL_MODE 1" );
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   639
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   640
    hideControls();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   641
    mEngine->initMode(ImageMode);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   642
    emit changeToPrecaptureView();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   643
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   644
    CX_DEBUG_EXIT_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   645
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   646
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   647
/*!
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   648
* Update the remaining and elapsed time labels.
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   649
*/
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   650
void CxuiVideoPrecaptureView::updateTimeLabels()
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   651
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   652
    CX_DEBUG_IN_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   653
46
hgs
parents: 42
diff changeset
   654
    if (!mVideoTimeText) {
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   655
        // Section not loaded yet. Skip update until created.
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   656
        CX_DEBUG(("CxuiVideoPrecaptureView: video time labels not loaded yet!"));
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   657
        CX_DEBUG_EXIT_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   658
        return;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   659
    }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   660
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   661
    CxeVideoCaptureControl::State state = mVideoCaptureControl->state();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   662
    switch (state) {
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   663
        case CxeVideoCaptureControl::Ready:
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   664
            getRemainingTime();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   665
            // Not recording => elapsed time is zero
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   666
            mTimeElapsed = 0;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   667
            break;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   668
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   669
        case CxeVideoCaptureControl::Recording:
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   670
        case CxeVideoCaptureControl::Paused:
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   671
            getRemainingTime();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   672
            getElapsedTime();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   673
            break;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   674
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   675
        case CxeVideoCaptureControl::Idle:
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   676
        case CxeVideoCaptureControl::Initialized:
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   677
        case CxeVideoCaptureControl::Preparing:
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   678
        default:
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   679
            // Minimize processing during initialization phase.
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   680
            // Calculating remaining time involves checking disk space, avoiding that.
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   681
            // which
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   682
            mTimeRemaining = 0;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   683
            mTimeElapsed = 0;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   684
            break;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   685
    }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   686
46
hgs
parents: 42
diff changeset
   687
    setVideoTime(mVideoTimeText, mTimeElapsed, mTimeRemaining);
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   688
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   689
    CX_DEBUG_EXIT_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   690
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   691
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   692
/*!
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   693
  Overridded version of hideControls() that doesn't hide the controls when video recording
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   694
  is paused.
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   695
 */
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   696
void CxuiVideoPrecaptureView::hideControls()
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   697
{
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   698
    if (mVideoCaptureControl && mVideoCaptureControl->state() == CxeVideoCaptureControl::Paused) {
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   699
        // never hide controls in paused state
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   700
        return;
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   701
    }
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   702
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   703
    CxuiPrecaptureView::hideControls();
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   704
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   705
}
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   706
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   707
/*!
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   708
* Helper method for formatting video time to requested label.
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   709
* @param label Text label to show the time.
46
hgs
parents: 42
diff changeset
   710
* @param elapsedTime Elapsed time in seconds to be formatted to the label text.
hgs
parents: 42
diff changeset
   711
* @param remainingTime Remaining time in seconds to be formatted to the label text.
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   712
*/
46
hgs
parents: 42
diff changeset
   713
void CxuiVideoPrecaptureView::setVideoTime(HbLabel* label,
hgs
parents: 42
diff changeset
   714
                                           int elapsedTime,
hgs
parents: 42
diff changeset
   715
                                           int remainingTime)
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   716
{
55
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   717
    QString elapsed;
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   718
    QString remaining;
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   719
    QString number;
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   720
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   721
    // Convert time (seconds) into mm:ss in localised form
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   722
    // Since we need to show also times over 1 hour (upto "90:00")
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   723
    // we cannot use time to string conversions directly
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   724
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   725
    HbExtendedLocale locale = HbExtendedLocale::system();
46
hgs
parents: 42
diff changeset
   726
55
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   727
    number = locale.toString(elapsedTime/60);
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   728
    if (number.length() <= 1) {
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   729
        number.prepend(locale.zeroDigit());
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   730
    }
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   731
    elapsed.append(number);
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   732
    elapsed.append(locale.timeSeparator(2));
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   733
    number = locale.toString(elapsedTime%60);
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   734
    if (number.length() <= 1) {
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   735
        number.prepend(locale.zeroDigit());
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   736
    }
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   737
    elapsed.append(number);
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   738
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   739
    number = locale.toString(remainingTime/60);
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   740
    if (number.length() <= 1) {
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   741
        number.prepend(locale.zeroDigit());
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   742
    }
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   743
    remaining.append(number);
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   744
    remaining.append(locale.timeSeparator(2));
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   745
    number = locale.toString(remainingTime%60);
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   746
    if (number.length() <= 1) {
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   747
        number.prepend(locale.zeroDigit());
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   748
    }
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   749
    remaining.append(number);
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   750
0da2a5b56583 201035_1
hgs
parents: 52
diff changeset
   751
    label->setPlainText(hbTrId("txt_cam_info_recording_time").arg(elapsed).arg(remaining));
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   752
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   753
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   754
bool CxuiVideoPrecaptureView::getElapsedTime()
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   755
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   756
    CX_DEBUG_ENTER_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   757
42
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   758
    bool status = mVideoCaptureControl->elapsedTime(mTimeElapsed);
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   759
    CX_DEBUG(("Elapsed time: %d", mTimeElapsed));
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   760
    CX_DEBUG(("status: %d", status));
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   761
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   762
    CX_DEBUG_EXIT_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   763
    return status;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   764
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   765
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   766
void CxuiVideoPrecaptureView::getRemainingTime()
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   767
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   768
    CX_DEBUG_ENTER_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   769
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   770
    mVideoCaptureControl->remainingTime(mTimeRemaining);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   771
    CX_DEBUG(("getRemainingTime time: %d", mTimeRemaining));
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   772
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   773
    CX_DEBUG_EXIT_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   774
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   775
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   776
void CxuiVideoPrecaptureView::showEvent(QShowEvent *event)
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   777
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   778
    CxuiPrecaptureView::showEvent(event);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   779
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   780
    updateQualityIcon();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   781
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   782
    if (event->type() == QEvent::Show) {
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   783
        event->accept();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   784
    }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   785
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   786
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   787
/*!
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   788
* Slot to handle video capture control state change.
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   789
* Update visible items and stop / start timers.
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   790
*/
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   791
void CxuiVideoPrecaptureView::handleVideoStateChanged(CxeVideoCaptureControl::State newState,
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   792
        CxeError::Id error)
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   793
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   794
    CX_DEBUG_ENTER_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   795
    Q_UNUSED(error);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   796
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   797
    updateTimeLabels();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   798
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   799
    mPauseTimer.stop();
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   800
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   801
    switch (newState) {
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   802
    case CxeVideoCaptureControl::Ready:
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   803
        if (mDocumentLoader){
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   804
            mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_IDLE);
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   805
        }
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   806
        if (mCapturePending) {
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   807
            mCapturePending = false;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   808
            record();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   809
        }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   810
        break;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   811
    case CxeVideoCaptureControl::Recording:
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   812
        hideControls();
41
hgs
parents: 40
diff changeset
   813
        emit stopStandbyTimer();
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   814
        if (mDocumentLoader){
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   815
            mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_RECORDING);
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   816
        }
46
hgs
parents: 42
diff changeset
   817
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   818
        mElapsedTimer.start(CXUI_ELAPSED_TIME_TIMEOUT);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   819
        disableFeedback();
40
hgs
parents: 39
diff changeset
   820
hgs
parents: 39
diff changeset
   821
        // commented out the activation of the recording animation because
hgs
parents: 39
diff changeset
   822
        // it is causing issues when using SW rendering
hgs
parents: 39
diff changeset
   823
        //if (mRecordingAnimation && mRecordingIcon) {
hgs
parents: 39
diff changeset
   824
        //  mRecordingAnimation->start();
hgs
parents: 39
diff changeset
   825
        //}
hgs
parents: 39
diff changeset
   826
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   827
        break;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   828
    case CxeVideoCaptureControl::Paused:
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   829
        mElapsedTimer.stop();
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   830
        if (mDocumentLoader){
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   831
            mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_PAUSED);
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   832
        }
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   833
        showControls();
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   834
        enableFeedback();
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   835
        mPauseTimer.start();
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   836
        break;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   837
    case CxeVideoCaptureControl::Stopping:
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   838
        if (mDocumentLoader){
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   839
            mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_PAUSED);
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   840
        }
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   841
40
hgs
parents: 39
diff changeset
   842
        // commented out the stopping of the recording animation since the activation
hgs
parents: 39
diff changeset
   843
        // is commented out also couple lines earlier
hgs
parents: 39
diff changeset
   844
        //if (mRecordingAnimation && mRecordingIcon) {
hgs
parents: 39
diff changeset
   845
        //    mRecordingAnimation->stop();
hgs
parents: 39
diff changeset
   846
        //}
hgs
parents: 39
diff changeset
   847
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   848
        enableFeedback();
41
hgs
parents: 40
diff changeset
   849
        emit startStandbyTimer();
38
hgs
parents: 28
diff changeset
   850
        mElapsedTimer.stop();
hgs
parents: 28
diff changeset
   851
        hideControls();
hgs
parents: 28
diff changeset
   852
hgs
parents: 28
diff changeset
   853
        if (mMenu) {
hgs
parents: 28
diff changeset
   854
            setMenu(mMenu);
hgs
parents: 28
diff changeset
   855
            mMenu = NULL;
hgs
parents: 28
diff changeset
   856
        }
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   857
38
hgs
parents: 28
diff changeset
   858
        if (isPostcaptureOn()) {
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   859
            emit changeToPostcaptureView();
38
hgs
parents: 28
diff changeset
   860
        } else {
hgs
parents: 28
diff changeset
   861
            // post capture off, we need prepare new video
hgs
parents: 28
diff changeset
   862
            // do the prepare when the previous video is ready
hgs
parents: 28
diff changeset
   863
            connect(mVideoCaptureControl, SIGNAL(videoComposed(CxeError::Id, const QString&)),
hgs
parents: 28
diff changeset
   864
                    this, SLOT(prepareNewVideo(CxeError::Id)));
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   865
        }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   866
        break;
39
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   867
    case CxeVideoCaptureControl::PlayingStartSound:
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   868
        // don't change anything
c5025ea871a1 201021_1
hgs
parents: 38
diff changeset
   869
        break;
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   870
    default:
46
hgs
parents: 42
diff changeset
   871
        // don't change anything
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   872
        break;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   873
    }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   874
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   875
    CX_DEBUG_EXIT_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   876
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   877
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   878
void CxuiVideoPrecaptureView::handleCaptureKeyPressed()
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   879
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   880
    CX_DEBUG_ENTER_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   881
    CxeVideoCaptureControl::State state = mVideoCaptureControl->state();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   882
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   883
    switch (state) {
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   884
        case CxeVideoCaptureControl::Ready:
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   885
            record();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   886
            break;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   887
        case CxeVideoCaptureControl::Recording:
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   888
        case CxeVideoCaptureControl::Paused:
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   889
            stop();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   890
            break;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   891
        case CxeVideoCaptureControl::Idle:
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   892
        case CxeVideoCaptureControl::Initialized:
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   893
        case CxeVideoCaptureControl::Preparing:
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   894
            mCapturePending = true;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   895
            break;
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   896
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   897
    }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   898
    CX_DEBUG_EXIT_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   899
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   900
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   901
void CxuiVideoPrecaptureView::prepareNewVideo(CxeError::Id error)
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   902
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   903
    if (!error) {
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   904
        mEngine->initMode(Cxe::VideoMode);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   905
        disconnect(mVideoCaptureControl, SIGNAL(videoComposed(CxeError::Id, const QString&)),
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   906
                   this, SLOT(prepareNewVideo(CxeError::Id)));
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   907
    } else {
41
hgs
parents: 40
diff changeset
   908
        emit errorEncountered(error);
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   909
    }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   910
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   911
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   912
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   913
void CxuiVideoPrecaptureView::handleQuitClicked()
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   914
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   915
    CX_DEBUG_ENTER_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   916
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   917
    CxeVideoCaptureControl::State state = mVideoCaptureControl->state();
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   918
    if (state == CxeVideoCaptureControl::Recording ||
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   919
        state == CxeVideoCaptureControl::Paused) {
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   920
        // Disable going to post-capture when video capture control goes to stopping state.
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   921
        disconnect(mVideoCaptureControl, SIGNAL(stateChanged(CxeVideoCaptureControl::State, CxeError::Id)),
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   922
                   this, SLOT(handleVideoStateChanged(CxeVideoCaptureControl::State,CxeError::Id)));
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   923
        mVideoCaptureControl->stop();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   924
        mElapsedTimer.stop();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   925
    }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   926
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   927
    QCoreApplication::exit();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   928
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   929
    CX_DEBUG_EXIT_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   930
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   931
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   932
void CxuiVideoPrecaptureView::launchVideoScenePopup()
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   933
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   934
    CX_DEBUG_ENTER_FUNCTION();
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   935
    hideControls();
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
   936
    emit showScenesView();
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   937
    CX_DEBUG_EXIT_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   938
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   939
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   940
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   941
/*!
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   942
* Launches show-postcapture setting pop-up
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   943
*/
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   944
void CxuiVideoPrecaptureView::launchSetting()
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   945
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   946
    CX_DEBUG_ENTER_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   947
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   948
    QObject *action = sender();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   949
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   950
    if (action) {
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   951
        QString settingsKey = action->property(PROPERTY_KEY_SETTING_ID).toString();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   952
        CX_DEBUG(("settingsKey=%s", settingsKey.toAscii().constData()));
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   953
        launchSettingsDialog(action);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   954
    }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   955
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   956
    CX_DEBUG_EXIT_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   957
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   958
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   959
/*!
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   960
* Handle change in setting value. Update UI to reflect new value.
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   961
*/
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   962
void CxuiVideoPrecaptureView::handleSettingValueChanged(const QString& key, QVariant newValue)
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   963
{
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   964
    CX_DEBUG_ENTER_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   965
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   966
    Q_UNUSED(newValue);
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   967
    // Ignored if not in video mode.
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   968
    if (mEngine->mode() == Cxe::VideoMode) {
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   969
        if (key == CxeSettingIds::VIDEO_QUALITY) {
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   970
            // update the quality indicator on screen
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   971
            updateQualityIcon();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   972
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   973
            // update video remaining time counter when video quality is changed
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   974
            updateTimeLabels();
42
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   975
        } else if (key == CxeSettingIds::GEOTAGGING) {
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   976
            reloadIndicatorWidgets();
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   977
        } else if (key == CxeSettingIds::VIDEO_MUTE_SETTING) {
feebad15db8c 201027_1
hgs
parents: 41
diff changeset
   978
            reloadIndicatorWidgets();
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   979
        }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   980
    }
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   981
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   982
    CX_DEBUG_EXIT_FUNCTION();
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   983
}
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   984
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   985
/*!
38
hgs
parents: 28
diff changeset
   986
* Handle scene mode change.
hgs
parents: 28
diff changeset
   987
* @param scene The new active scene mode.
hgs
parents: 28
diff changeset
   988
*/
46
hgs
parents: 42
diff changeset
   989
void CxuiVideoPrecaptureView::handleSceneChanged(const QVariant &scene)
38
hgs
parents: 28
diff changeset
   990
{
hgs
parents: 28
diff changeset
   991
    CX_DEBUG_ENTER_FUNCTION();
hgs
parents: 28
diff changeset
   992
    // Ignore if not in video mode.
hgs
parents: 28
diff changeset
   993
    if (mEngine->mode() == Cxe::VideoMode) {
hgs
parents: 28
diff changeset
   994
        // Update toolbar scene mode icon.
46
hgs
parents: 42
diff changeset
   995
        updateSceneIcon(scene.toString());
38
hgs
parents: 28
diff changeset
   996
    }
hgs
parents: 28
diff changeset
   997
hgs
parents: 28
diff changeset
   998
    CX_DEBUG_EXIT_FUNCTION();
hgs
parents: 28
diff changeset
   999
}
hgs
parents: 28
diff changeset
  1000
28
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1001
/*!
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1002
 * Overridden eventFilter() to restart the pause timer.
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1003
 */
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1004
bool CxuiVideoPrecaptureView::eventFilter(QObject *object, QEvent *event)
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1005
{
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1006
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1007
    if (mVideoCaptureControl && mVideoCaptureControl->state() == CxeVideoCaptureControl::Paused) {
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1008
        // restart the timer if the screen is touched and we are in paused state
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1009
        switch (event->type())
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1010
        {
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1011
        case QEvent::GraphicsSceneMouseRelease:
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1012
            mPauseTimer.start();
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1013
            break;
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1014
        case QEvent::GraphicsSceneMousePress:
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1015
            mPauseTimer.stop();
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1016
            break;
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1017
        default:
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1018
            break;
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1019
        }
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1020
    }
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1021
    return CxuiPrecaptureView::eventFilter(object, event);
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1022
}
3075d9b614e6 201017_1
hgs
parents: 19
diff changeset
  1023
19
d9aefe59d544 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1024
//end of file
41
hgs
parents: 40
diff changeset
  1025