author | hgs |
Thu, 15 Jul 2010 01:53:45 +0300 | |
changeset 42 | feebad15db8c |
parent 41 | 67457b2ffb33 |
child 46 | c826656d6714 |
permissions | -rw-r--r-- |
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
28 | 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 | 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 | 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 | 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 | 49 |
#include "cxuiserviceprovider.h" |
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 | 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 | 81 |
mToolbarIdle(NULL), |
82 |
mToolbarRec(NULL), |
|
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 | 100 |
/*! |
101 |
* Construct-method handles initialisation tasks for this class. |
|
102 |
* @param mainwindow |
|
103 |
* @param engine |
|
104 |
* @param documentLoader |
|
105 |
* @param keyHandler |
|
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 | 109 |
CxuiCaptureKeyHandler *keyHandler, |
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 | 114 |
CxuiPrecaptureView::construct(mainwindow, engine, documentLoader, keyHandler, activityManager); |
39 | 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 | 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 | 124 |
connect(&(mEngine->settings()), SIGNAL(sceneChanged(CxeScene&)), |
125 |
this, SLOT(handleSceneChanged(CxeScene&))); |
|
28 | 126 |
connect(mVideoCaptureControl, SIGNAL(remainingTimeChanged()), |
127 |
this, SLOT(updateTimeLabels())); |
|
128 |
||
129 |
mPauseTimer.setSingleShot(true); |
|
130 |
connect(&mPauseTimer, SIGNAL(timeout()), this, SLOT(stop())); |
|
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 | 145 |
/*! |
146 |
* Loads widgets that are needed right from the start. |
|
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 | 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 | 157 |
CX_ASSERT_ALWAYS(mViewfinder); |
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
158 |
|
42 | 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 | 164 |
/*! |
165 |
* Loads default indicators from docml and modifies the visibility |
|
166 |
* according to current settings. |
|
167 |
*/ |
|
168 |
void CxuiVideoPrecaptureView::reloadIndicatorWidgets() |
|
169 |
{ |
|
170 |
CX_DEBUG_ENTER_FUNCTION(); |
|
171 |
CX_ASSERT_ALWAYS(mDocumentLoader); |
|
172 |
||
173 |
bool ok = false; |
|
174 |
mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_INDICATORS_SECTION, &ok); |
|
175 |
CX_ASSERT_ALWAYS(ok); |
|
176 |
||
177 |
QGraphicsWidget *widget = NULL; |
|
178 |
widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_QUALITY_ICON); |
|
179 |
mQualityIcon = qobject_cast<HbLabel *> (widget); |
|
180 |
CX_ASSERT_ALWAYS(mQualityIcon); |
|
181 |
||
182 |
widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_VIDEOAUDIOMUTE_INDICATOR_ICON); |
|
183 |
HbLabel *videoaudiomuteIndicatorIcon = qobject_cast<HbLabel *>(widget); |
|
184 |
CX_ASSERT_ALWAYS(videoaudiomuteIndicatorIcon); |
|
185 |
||
186 |
widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_STABILITY_INDICATOR_ICON); |
|
187 |
HbLabel *videoStabilityIndicatorIcon = qobject_cast<HbLabel *>(widget); |
|
188 |
CX_ASSERT_ALWAYS(videoStabilityIndicatorIcon); |
|
189 |
||
190 |
widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_INDICATOR_CONTAINER_TOP); |
|
191 |
mIndicators = qobject_cast<HbWidget *>(widget); |
|
192 |
CX_ASSERT_ALWAYS(mIndicators); |
|
193 |
||
194 |
QGraphicsLayout *layout = mIndicators->layout(); |
|
195 |
QGraphicsLayoutItem *graphicsLayoutItem = NULL; |
|
196 |
QGraphicsItem *graphicsItem = NULL; |
|
197 |
QString key = ""; |
|
198 |
int currentSettingValue = -1; |
|
199 |
bool isSettingOff = false; |
|
200 |
// Go through the items in the layout to check whether they should be |
|
201 |
// shown or not in the indicator pane. Start from the last towards |
|
202 |
// the first, so that removing items from between works correctly. |
|
203 |
for (int i = layout->count() - 1; i >= 0; i--) { |
|
204 |
graphicsLayoutItem = layout->itemAt(i); |
|
205 |
isSettingOff = false; |
|
206 |
if (graphicsLayoutItem) { |
|
207 |
graphicsItem = graphicsLayoutItem->graphicsItem(); |
|
208 |
currentSettingValue = -1; |
|
209 |
if (graphicsItem == videoaudiomuteIndicatorIcon) { |
|
210 |
key = CxeSettingIds::VIDEO_MUTE_SETTING; |
|
211 |
mEngine->settings().get(key, currentSettingValue); |
|
212 |
// video mute implementation does not use |
|
213 |
// enum for on/off values but instead |
|
214 |
// 0 for off and 1 for on. |
|
215 |
if (currentSettingValue == 0) { |
|
216 |
isSettingOff = true; |
|
217 |
} |
|
218 |
} else if (graphicsItem == videoStabilityIndicatorIcon) { |
|
219 |
// remove video stability indicator. |
|
220 |
isSettingOff = true; |
|
221 |
} |
|
222 |
if (isSettingOff) { |
|
223 |
layout->removeAt(i); |
|
224 |
} |
|
225 |
} |
|
226 |
} |
|
227 |
||
228 |
// Create background graphics for indicator container |
|
229 |
createWidgetBackgroundGraphic(mIndicators, TRANSPARENT_BACKGROUND_GRAPHIC); |
|
230 |
||
231 |
mIndicators->setVisible(true); |
|
232 |
||
233 |
CX_DEBUG_EXIT_FUNCTION(); |
|
234 |
} |
|
235 |
||
236 |
/*! |
|
237 |
* Loads widgets that are not part of the default section in layouts xml. |
|
238 |
* Widgets are created at the time they are first loaded. |
|
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 | 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 | 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 | 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 | 268 |
mSlider = qobject_cast<CxuiZoomSlider *> (widget); |
42 | 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 | 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 | 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 | 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 | 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 | 282 |
mToolbar = mToolbarIdle; |
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
283 |
|
42 | 284 |
CX_ASSERT_ALWAYS(mToolbarIdle); |
285 |
CX_ASSERT_ALWAYS(mToolbarRec); |
|
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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 347 |
mRecordingAnimation->setEasingCurve(QEasingCurve::OutInQuad); |
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
348 |
|
38 | 349 |
|
350 |
// Update toolbar scene mode icon. |
|
351 |
QString sceneId; |
|
352 |
if (mEngine->settings().get(CxeSettingIds::SCENE_ID, sceneId) == CxeError::None) { |
|
353 |
updateSceneIcon(sceneId); |
|
354 |
} |
|
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 | 359 |
// View is ready. Needed for startup performance automated testing. |
360 |
emit viewReady(); |
|
38 | 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 | 366 |
* Restore view state from activity. |
367 |
*/ |
|
368 |
void CxuiVideoPrecaptureView::restoreActivity(const QString &activityId, const QVariant &data) |
|
369 |
{ |
|
370 |
Q_UNUSED(activityId); |
|
371 |
Q_UNUSED(data); |
|
372 |
||
373 |
CX_DEBUG_ENTER_FUNCTION(); |
|
374 |
// no need to restore any state |
|
375 |
CX_DEBUG_EXIT_FUNCTION(); |
|
376 |
} |
|
377 |
||
378 |
/*! |
|
379 |
* Save view state to activity. |
|
380 |
*/ |
|
381 |
void CxuiVideoPrecaptureView::saveActivity() |
|
382 |
{ |
|
383 |
CX_DEBUG_ENTER_FUNCTION(); |
|
384 |
QVariantMap data; |
|
385 |
QVariantHash params; |
|
386 |
//@todo: add pre-capture icon as screenshot |
|
387 |
mActivityManager->removeActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY); |
|
388 |
mActivityManager->addActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY, data, params); |
|
389 |
CX_DEBUG_EXIT_FUNCTION(); |
|
390 |
} |
|
391 |
||
392 |
/*! |
|
393 |
* Clear activity from activity manager. |
|
394 |
*/ |
|
395 |
void CxuiVideoPrecaptureView::clearActivity() |
|
396 |
{ |
|
397 |
CX_DEBUG_ENTER_FUNCTION(); |
|
398 |
mActivityManager->removeActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY); |
|
399 |
CX_DEBUG_EXIT_FUNCTION(); |
|
400 |
} |
|
401 |
||
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 | 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 | 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 | 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 | 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 | 428 |
/** |
429 |
* Get if postcapture view should be shown or not. |
|
430 |
* Postcapture view may be shown for a predefined time or |
|
431 |
* until user dismisses it, or it may be completely disabled. |
|
432 |
*/ |
|
433 |
bool CxuiVideoPrecaptureView::isPostcaptureOn() const |
|
434 |
{ |
|
435 |
CX_DEBUG_ENTER_FUNCTION(); |
|
436 |
if (CxuiServiceProvider::isCameraEmbedded()) { |
|
437 |
// always show post capture in embedded mode |
|
438 |
CX_DEBUG_EXIT_FUNCTION(); |
|
439 |
return true; |
|
440 |
} |
|
441 |
||
442 |
// Read the value from settings. Ignoring reading error. |
|
443 |
// On error (missing settings) default to "postcapture on". |
|
444 |
int showPostcapture(-1); |
|
445 |
if(mEngine) { |
|
446 |
mEngine->settings().get(CxeSettingIds::VIDEO_SHOWCAPTURED, showPostcapture); |
|
447 |
} |
|
448 |
||
449 |
CX_DEBUG_EXIT_FUNCTION(); |
|
450 |
return showPostcapture != 0; // 0 == no postcapture |
|
451 |
} |
|
452 |
||
453 |
/*! |
|
454 |
* Update the scene mode icon. |
|
455 |
* @param sceneId The new scene id. |
|
456 |
*/ |
|
457 |
void CxuiVideoPrecaptureView::updateSceneIcon(const QString& sceneId) |
|
458 |
{ |
|
459 |
CX_DEBUG_ENTER_FUNCTION(); |
|
460 |
||
461 |
if (mEngine->mode() == Cxe::VideoMode) { |
|
462 |
CX_DEBUG(("CxuiPrecaptureView - scene: %s", sceneId.toAscii().constData())); |
|
463 |
||
464 |
// No need to update icon, if widgets are not even loaded yet. |
|
465 |
// We'll update the icon once the widgets are loaded. |
|
466 |
if (mWidgetsLoaded) { |
|
467 |
QString iconObjectName = VIDEO_PRE_CAPTURE_SCENE_MODE_ACTION; |
|
468 |
QString icon = getSettingItemIcon(CxeSettingIds::VIDEO_SCENE, sceneId); |
|
469 |
||
470 |
CX_DEBUG(("CxuiVideoPrecaptureView - icon: %s", icon.toAscii().constData())); |
|
471 |
||
472 |
if (mDocumentLoader) { |
|
473 |
QObject *obj = mDocumentLoader->findObject(iconObjectName); |
|
42 | 474 |
CX_ASSERT_ALWAYS(obj); |
41 | 475 |
qobject_cast<HbAction *>(obj)->setIcon(HbIcon(icon)); |
476 |
} |
|
477 |
} else { |
|
478 |
CX_DEBUG(("CxuiVideoPrecaptureView - widgets not loaded yet, ignored!")); |
|
479 |
} |
|
480 |
} |
|
481 |
CX_DEBUG_EXIT_FUNCTION(); |
|
482 |
} |
|
483 |
||
484 |
/*! |
|
485 |
Update the quality indicator |
|
486 |
*/ |
|
487 |
void CxuiVideoPrecaptureView::updateQualityIcon() |
|
488 |
{ |
|
489 |
CX_DEBUG_ENTER_FUNCTION(); |
|
490 |
||
491 |
if (mQualityIcon && mEngine) { |
|
492 |
QString icon = ""; |
|
493 |
int currentValue = -1; |
|
494 |
||
495 |
mEngine->settings().get(CxeSettingIds::VIDEO_QUALITY, currentValue); |
|
496 |
icon = getSettingItemIcon(CxeSettingIds::VIDEO_QUALITY, currentValue); |
|
497 |
||
498 |
mQualityIcon->setIcon(HbIcon(icon)); |
|
499 |
} |
|
500 |
||
501 |
CX_DEBUG_EXIT_FUNCTION(); |
|
502 |
} |
|
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 | 515 |
int time(0); |
516 |
mVideoCaptureControl->remainingTime(time); |
|
517 |
||
518 |
if (time) { |
|
519 |
mMenu = takeMenu(); |
|
520 |
mVideoCaptureControl->record(); |
|
521 |
} else { |
|
41 | 522 |
emit errorEncountered(CxeError::DiskFull); |
28 | 523 |
} |
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 | 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 | 545 |
|
546 |
CxeVideoCaptureControl::State state = mVideoCaptureControl->state(); |
|
547 |
if (state == CxeVideoCaptureControl::Recording || |
|
548 |
state == CxeVideoCaptureControl::Paused) { |
|
549 |
mVideoCaptureControl->stop(); |
|
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 | 556 |
|
557 |
/*! |
|
558 |
* Allow showing UI controls? |
|
559 |
*/ |
|
560 |
bool CxuiVideoPrecaptureView::allowShowControls() const |
|
561 |
{ |
|
562 |
bool show(false); |
|
563 |
if (mEngine) { |
|
564 |
CxeVideoCaptureControl::State state(mEngine->videoCaptureControl().state()); |
|
565 |
||
566 |
show = (mEngine->isEngineReady() |
|
567 |
|| state == CxeVideoCaptureControl::Recording |
|
568 |
|| state == CxeVideoCaptureControl::Paused); |
|
569 |
} |
|
570 |
return show; |
|
571 |
} |
|
572 |
||
41 | 573 |
/*! |
574 |
* Play feedback when touching view outside of any widget? |
|
575 |
* If video is paused feedback is off. Otherwise on. |
|
576 |
*/ |
|
577 |
bool CxuiVideoPrecaptureView::isFeedbackEnabled() const |
|
578 |
{ |
|
579 |
CxeVideoCaptureControl::State state(mEngine->videoCaptureControl().state()); |
|
580 |
if (state == CxeVideoCaptureControl::Paused) { |
|
581 |
return false; |
|
582 |
} else { |
|
583 |
return true; |
|
584 |
} |
|
585 |
} |
|
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 | 594 |
if (mToolbar != mToolbarRec) { |
595 |
mToolbar->hide(); |
|
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 | 599 |
if (mToolbar != mToolbarIdle) { |
600 |
mToolbar->hide(); |
|
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 | 604 |
if (mToolbar != mToolbarPaused) { |
605 |
mToolbar->hide(); |
|
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 | 617 |
HbFeedbackSettings settings; |
618 |
settings.disableFeedback(); |
|
619 |
||
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 | 628 |
HbFeedbackSettings settings; |
629 |
settings.enableFeedback(); |
|
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 | 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 | 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 | 688 |
setVideoTime(mRemainingTimeText, mTimeRemaining); |
689 |
setVideoTime(mElapsedTimeText, mTimeElapsed); |
|
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 | 695 |
Overridded version of hideControls() that doesn't hide the controls when video recording |
696 |
is paused. |
|
697 |
*/ |
|
698 |
void CxuiVideoPrecaptureView::hideControls() |
|
699 |
{ |
|
700 |
if (mVideoCaptureControl && mVideoCaptureControl->state() == CxeVideoCaptureControl::Paused) { |
|
701 |
// never hide controls in paused state |
|
702 |
return; |
|
703 |
} |
|
704 |
||
705 |
CxuiPrecaptureView::hideControls(); |
|
706 |
||
707 |
} |
|
708 |
||
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 | 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 | 757 |
/*! |
758 |
* Slot to handle video capture control state change. |
|
759 |
* Update visible items and stop / start timers. |
|
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 | 769 |
mPauseTimer.stop(); |
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 | 773 |
if (mDocumentLoader){ |
774 |
mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_IDLE); |
|
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 | 782 |
hideControls(); |
41 | 783 |
emit stopStandbyTimer(); |
28 | 784 |
if (mDocumentLoader){ |
785 |
mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_RECORDING); |
|
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 | 789 |
|
790 |
// commented out the activation of the recording animation because |
|
791 |
// it is causing issues when using SW rendering |
|
792 |
//if (mRecordingAnimation && mRecordingIcon) { |
|
793 |
// mRecordingAnimation->start(); |
|
794 |
//} |
|
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 | 799 |
if (mDocumentLoader){ |
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 | 802 |
showControls(); |
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
803 |
enableFeedback(); |
28 | 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 | 807 |
if (mDocumentLoader){ |
808 |
mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_PAUSED); |
|
809 |
} |
|
810 |
||
40 | 811 |
// commented out the stopping of the recording animation since the activation |
812 |
// is commented out also couple lines earlier |
|
813 |
//if (mRecordingAnimation && mRecordingIcon) { |
|
814 |
// mRecordingAnimation->stop(); |
|
815 |
//} |
|
816 |
||
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
817 |
enableFeedback(); |
41 | 818 |
emit startStandbyTimer(); |
38 | 819 |
mElapsedTimer.stop(); |
820 |
hideControls(); |
|
821 |
||
822 |
if (mMenu) { |
|
823 |
setMenu(mMenu); |
|
824 |
mMenu = NULL; |
|
825 |
} |
|
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
826 |
|
38 | 827 |
if (isPostcaptureOn()) { |
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
828 |
emit changeToPostcaptureView(); |
38 | 829 |
} else { |
830 |
// post capture off, we need prepare new video |
|
831 |
// do the prepare when the previous video is ready |
|
832 |
connect(mVideoCaptureControl, SIGNAL(videoComposed(CxeError::Id, const QString&)), |
|
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 | 836 |
case CxeVideoCaptureControl::PlayingStartSound: |
837 |
// don't change anything |
|
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 | 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 | 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 | 888 |
if (state == CxeVideoCaptureControl::Recording || |
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 | 905 |
hideControls(); |
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 | 945 |
} else if (key == CxeSettingIds::GEOTAGGING) { |
946 |
reloadIndicatorWidgets(); |
|
947 |
} else if (key == CxeSettingIds::VIDEO_MUTE_SETTING) { |
|
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 | 956 |
* Handle scene mode change. |
957 |
* @param scene The new active scene mode. |
|
958 |
*/ |
|
959 |
void CxuiVideoPrecaptureView::handleSceneChanged(CxeScene &scene) |
|
960 |
{ |
|
961 |
CX_DEBUG_ENTER_FUNCTION(); |
|
962 |
// Ignore if not in video mode. |
|
963 |
if (mEngine->mode() == Cxe::VideoMode) { |
|
964 |
// Update toolbar scene mode icon. |
|
965 |
updateSceneIcon(scene[CxeSettingIds::SCENE_ID].toString()); |
|
966 |
} |
|
967 |
||
968 |
CX_DEBUG_EXIT_FUNCTION(); |
|
969 |
} |
|
970 |
||
971 |
||
972 |
||
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 | 989 |
/*! |
990 |
* Overridden eventFilter() to restart the pause timer. |
|
991 |
*/ |
|
992 |
bool CxuiVideoPrecaptureView::eventFilter(QObject *object, QEvent *event) |
|
993 |
{ |
|
994 |
||
995 |
if (mVideoCaptureControl && mVideoCaptureControl->state() == CxeVideoCaptureControl::Paused) { |
|
996 |
// restart the timer if the screen is touched and we are in paused state |
|
997 |
switch (event->type()) |
|
998 |
{ |
|
999 |
case QEvent::GraphicsSceneMouseRelease: |
|
1000 |
mPauseTimer.start(); |
|
1001 |
break; |
|
1002 |
case QEvent::GraphicsSceneMousePress: |
|
1003 |
mPauseTimer.stop(); |
|
1004 |
break; |
|
1005 |
default: |
|
1006 |
break; |
|
1007 |
} |
|
1008 |
} |
|
1009 |
return CxuiPrecaptureView::eventFilter(object, event); |
|
1010 |
} |
|
1011 |
||
19
d9aefe59d544
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1012 |
//end of file |
41 | 1013 |