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