author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:31:22 +0300 | |
branch | RCL_3 |
changeset 81 | c26cc2a7c548 |
parent 62 | 5266b1f337bd |
permissions | -rw-r--r-- |
62 | 1 |
/* |
2 |
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: Implementation of CVideoDTMFDialer class. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDE FILES |
|
20 |
||
21 |
#include <avkon.rsg> |
|
22 |
#include <apgcli.h> |
|
23 |
#include <apacmdln.h> |
|
24 |
#include <eikspane.h> |
|
25 |
#include <aknenv.h> // AKN_LAF_COLOR |
|
26 |
#include <AknUtils.h> |
|
27 |
#include <AknsUtils.h> |
|
28 |
#include <aknappui.h> |
|
29 |
#include <aknlayoutscalable_apps.cdl.h> |
|
30 |
#include <layoutmetadata.cdl.h> |
|
31 |
#include <data_caging_path_literals.hrh> // for KDC_APP_RESOURCE_DIR |
|
32 |
#include <bautils.h> // for BaflUtils |
|
33 |
||
34 |
#include "cvideodtmfdialer.h" |
|
35 |
#include "dialercommon.h" |
|
36 |
#include <dialer.rsg> |
|
37 |
#include "dialer.hrh" |
|
38 |
#include "cdialerkeypadcontainer.h" |
|
39 |
#include "cdialervideocontainer.h" |
|
40 |
#include "dialertrace.h" |
|
41 |
||
42 |
||
43 |
_LIT( KDialerResourceFile, "dialer.rsc" ); |
|
44 |
||
45 |
// Video and keypad areas |
|
46 |
const TInt KContainedControlsInVideoDTMFMode = 2; |
|
47 |
||
48 |
// ========================= MEMBER FUNCTIONS ================================ |
|
49 |
||
50 |
// --------------------------------------------------------------------------- |
|
51 |
// CVideoDTMFDialer::NewL |
|
52 |
// |
|
53 |
// Symbian OS two phased constructor for video dtmf mode |
|
54 |
// --------------------------------------------------------------------------- |
|
55 |
// |
|
56 |
EXPORT_C CVideoDTMFDialer* CVideoDTMFDialer::NewL( const CCoeControl& aContainer, |
|
57 |
CCoeControl& aVideoWindow, |
|
58 |
const TRect& aRect ) |
|
59 |
{ |
|
60 |
CVideoDTMFDialer* self = new( ELeave )CVideoDTMFDialer ( ); |
|
61 |
CleanupStack::PushL( self ); |
|
62 |
self->ConstructL( aContainer , aVideoWindow, aRect ); |
|
63 |
CleanupStack::Pop(); // self |
|
64 |
return self; |
|
65 |
} |
|
66 |
||
67 |
// Destructor |
|
68 |
EXPORT_C CVideoDTMFDialer::~CVideoDTMFDialer() |
|
69 |
{ |
|
70 |
DIALER_PRINT("CVideoDTMFDialer::~CVideoDTMFDialer<"); |
|
71 |
AknsUtils::DeregisterControlPosition( this ); |
|
72 |
||
73 |
delete iKeypadArea; |
|
74 |
delete iVideoWindow; |
|
75 |
||
76 |
UnLoadResources(); |
|
77 |
||
78 |
DIALER_PRINT("CVideoDTMFDialer::~CVideoDTMFDialer>"); |
|
79 |
} |
|
80 |
||
81 |
// --------------------------------------------------------------------------- |
|
82 |
// CVideoDTMFDialer::ConstructL |
|
83 |
// |
|
84 |
// Symbian OS two phased constructor for video telephony mode. |
|
85 |
// |
|
86 |
// --------------------------------------------------------------------------- |
|
87 |
// |
|
88 |
void CVideoDTMFDialer::ConstructL( |
|
89 |
const CCoeControl& aContainer, |
|
90 |
CCoeControl& aVideoWindow, |
|
91 |
const TRect& aRect ) |
|
92 |
{ |
|
93 |
DIALER_PRINT("CVideoDTMFDialer::ConstructL<"); |
|
94 |
LoadResourceL(); |
|
95 |
// set window |
|
96 |
SetContainerWindowL( aContainer ); |
|
97 |
SetParent( const_cast<CCoeControl*>(&aContainer) ); |
|
98 |
iParentControl = &aContainer; |
|
99 |
||
100 |
iVideoWindow = CDialerVideoContainer::NewL( *this, aVideoWindow ); |
|
101 |
iKeypadArea = CDialerKeyPadContainer::NewL( *this, EModeVideoDTMF ); |
|
102 |
||
103 |
SetRect( aRect ); |
|
104 |
DIALER_PRINT("CVideoDTMFDialer::ConstructL>"); |
|
105 |
} |
|
106 |
||
107 |
// Constructor |
|
108 |
CVideoDTMFDialer::CVideoDTMFDialer( ) : |
|
81
c26cc2a7c548
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
109 |
iEikEnv( *CEikonEnv::Static() ) |
62 | 110 |
{ |
111 |
// Empty |
|
112 |
} |
|
113 |
||
114 |
// Functions from CCoeControl |
|
115 |
||
116 |
// --------------------------------------------------------------------------- |
|
117 |
// CVideoDTMFDialer::SizeChanged |
|
118 |
// |
|
119 |
// Called by framework when the view size is changed |
|
120 |
// |
|
121 |
// --------------------------------------------------------------------------- |
|
122 |
// |
|
123 |
void CVideoDTMFDialer::SizeChanged() |
|
124 |
{ |
|
125 |
AknsUtils::RegisterControlPosition( this ); |
|
126 |
TRect parentRect(Rect()); |
|
127 |
||
128 |
// Method is called before containers are created. |
|
129 |
if ( !iKeypadArea ) |
|
130 |
{ |
|
131 |
return; |
|
132 |
} |
|
133 |
||
134 |
TVideoVariety variety( EVideoVarietyLandscape ); |
|
135 |
if ( !Layout_Meta_Data::IsLandscapeOrientation() ) |
|
136 |
{ |
|
137 |
variety = EVideoVarietyPortrait; |
|
138 |
} |
|
139 |
||
140 |
// Layout video window. |
|
141 |
AknLayoutUtils::LayoutControl( |
|
142 |
iVideoWindow, parentRect, |
|
143 |
AknLayoutScalable_Apps::video_down_pane_cp( variety ).LayoutLine() ); |
|
144 |
||
145 |
// layout keypad area. |
|
146 |
AknLayoutUtils::LayoutControl( |
|
147 |
iKeypadArea, parentRect, |
|
148 |
AknLayoutScalable_Apps::grid_video_dialer_keypad_pane( variety ).LayoutLine() ); |
|
149 |
} |
|
150 |
||
151 |
// --------------------------------------------------------------------------- |
|
152 |
// CVideoDTMFDialer::PositionChanged |
|
153 |
// |
|
154 |
// --------------------------------------------------------------------------- |
|
155 |
// |
|
156 |
void CVideoDTMFDialer::PositionChanged() |
|
157 |
{ |
|
158 |
AknsUtils::RegisterControlPosition( this ); |
|
159 |
} |
|
160 |
||
161 |
// --------------------------------------------------------------------------- |
|
162 |
// CVideoDTMFDialer::CountComponentControls |
|
163 |
// |
|
164 |
// Returns contained controls in phone dialer mode or in video dtmf mode. |
|
165 |
// |
|
166 |
// --------------------------------------------------------------------------- |
|
167 |
// |
|
168 |
TInt CVideoDTMFDialer::CountComponentControls() const |
|
169 |
{ |
|
170 |
TInt count( 0 ); |
|
171 |
count = KContainedControlsInVideoDTMFMode; |
|
172 |
return count; |
|
173 |
} |
|
174 |
||
175 |
// --------------------------------------------------------------------------- |
|
176 |
// CVideoDTMFDialer::ComponentControl |
|
177 |
// |
|
178 |
// Returns contained control by given index. |
|
179 |
// |
|
180 |
// --------------------------------------------------------------------------- |
|
181 |
// |
|
182 |
CCoeControl* CVideoDTMFDialer::ComponentControl( TInt aIndex ) const |
|
183 |
{ |
|
184 |
CCoeControl* currentControl( NULL ); |
|
185 |
||
186 |
currentControl = ComponentControlForVideoMode( aIndex); |
|
187 |
||
188 |
return currentControl; |
|
189 |
} |
|
190 |
||
191 |
// --------------------------------------------------------------------------- |
|
192 |
// CVideoDTMFDialer::Draw |
|
193 |
// |
|
194 |
// --------------------------------------------------------------------------- |
|
195 |
// |
|
196 |
void CVideoDTMFDialer::Draw( const TRect& /*aRect*/ ) const |
|
197 |
{ |
|
198 |
} |
|
199 |
||
200 |
// --------------------------------------------------------------------------- |
|
201 |
// CVideoDTMFDialer::HandleResourceChange |
|
202 |
// |
|
203 |
// --------------------------------------------------------------------------- |
|
204 |
// |
|
205 |
void CVideoDTMFDialer::HandleResourceChange( TInt aType ) |
|
206 |
{ |
|
207 |
if ( aType == KEikDynamicLayoutVariantSwitch ) |
|
208 |
{ |
|
209 |
SizeChanged(); |
|
210 |
} |
|
211 |
CCoeControl::HandleResourceChange( aType ); |
|
212 |
} |
|
213 |
||
214 |
// ----------------------------------------------------------------------------- |
|
215 |
// CVideoDTMFDialer::HandlePointerEventL |
|
216 |
// |
|
217 |
// ----------------------------------------------------------------------------- |
|
218 |
// |
|
219 |
void CVideoDTMFDialer::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
220 |
{ |
|
221 |
// Calling base class implementation |
|
222 |
CCoeControl::HandlePointerEventL(aPointerEvent); |
|
223 |
} |
|
224 |
||
225 |
// Private methods |
|
226 |
||
227 |
// ----------------------------------------------------------------------------- |
|
228 |
// CVideoDTMFDialer::LoadResourceL |
|
229 |
// |
|
230 |
// ----------------------------------------------------------------------------- |
|
231 |
// |
|
232 |
void CVideoDTMFDialer::LoadResourceL() |
|
233 |
{ |
|
234 |
TFileName path( KDriveZ ); |
|
235 |
path.Append( KDC_RESOURCE_FILES_DIR ); |
|
236 |
path.Append( KDialerResourceFile ); |
|
237 |
||
238 |
RFs &fsSession= iEikEnv.FsSession(); |
|
239 |
BaflUtils::NearestLanguageFile( fsSession, path ); |
|
240 |
iResourceOffset = iEikEnv.AddResourceFileL( path ); |
|
241 |
} |
|
242 |
||
243 |
// ----------------------------------------------------------------------------- |
|
244 |
// CVideoDTMFDialer::UnLoadResources |
|
245 |
// |
|
246 |
// ----------------------------------------------------------------------------- |
|
247 |
// |
|
248 |
void CVideoDTMFDialer::UnLoadResources() |
|
249 |
{ |
|
250 |
if ( iResourceOffset > 0 ) |
|
251 |
{ |
|
252 |
iEikEnv.DeleteResourceFile( iResourceOffset ); |
|
253 |
iResourceOffset = 0; |
|
254 |
} |
|
255 |
} |
|
256 |
||
257 |
// --------------------------------------------------------------------------- |
|
258 |
// CVideoDTMFDialer::ComponentControlForVideoMode |
|
259 |
// |
|
260 |
// Returns contained control by given index in video DTMF mode. |
|
261 |
// |
|
262 |
// --------------------------------------------------------------------------- |
|
263 |
// |
|
264 |
CCoeControl* CVideoDTMFDialer::ComponentControlForVideoMode( const TInt aIndex ) const |
|
265 |
{ |
|
266 |
CCoeControl* currentControl(NULL); |
|
267 |
||
268 |
switch ( aIndex ) |
|
269 |
{ |
|
270 |
case 0: |
|
271 |
{ |
|
272 |
currentControl = iKeypadArea; |
|
273 |
break; |
|
274 |
} |
|
275 |
case 1: |
|
276 |
{ |
|
277 |
currentControl = iVideoWindow; |
|
278 |
break; |
|
279 |
} |
|
280 |
default: |
|
281 |
{ |
|
282 |
__ASSERT_DEBUG( EFalse, |
|
283 |
_L("CVideoDTMFDialer::ComponentControl no such component defined")); |
|
284 |
} |
|
285 |
} |
|
286 |
||
287 |
return currentControl; |
|
288 |
} |
|
289 |
||
290 |
// End of File |