|
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: Bubble outlook video ringtone. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "BMBubbleManager.h" //for enumerations |
|
21 #include "BMBubbleOutlookVideo.h" |
|
22 #include "BMBubbleImageManager.h" |
|
23 #include "BMResourceManager.h" |
|
24 #include "BMBubbleHeader.h" |
|
25 #include "BMUtils.h" |
|
26 #include "BMLayout3.h" |
|
27 #include "BMVideoController.h" |
|
28 #include "telbubblecustomelement.h" |
|
29 |
|
30 #include <eiklabel.h> |
|
31 #include <eikimage.h> |
|
32 #include <eikenv.h> |
|
33 #include <AknsUtils.h> |
|
34 #include <AknsDrawUtils.h> |
|
35 #include <AknLayout2ScalableDef.h> |
|
36 #include <layoutmetadata.cdl.h> |
|
37 |
|
38 |
|
39 // ========================= MEMBER FUNCTIONS ================================ |
|
40 |
|
41 |
|
42 // --------------------------------------------------------------------------- |
|
43 // CBubbleOutlookVideo |
|
44 // --------------------------------------------------------------------------- |
|
45 // |
|
46 CBubbleOutlookVideo::CBubbleOutlookVideo( CBubbleManager& aBubbleManager ) |
|
47 : CBubbleOutlookTwoLined( aBubbleManager ) |
|
48 { |
|
49 } |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // ConstructL |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 void CBubbleOutlookVideo::ConstructL() |
|
56 { |
|
57 CBubbleOutlookTwoLined::ConstructL(); |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // ~CBubbleOutlookVideo |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 CBubbleOutlookVideo::~CBubbleOutlookVideo() |
|
65 { |
|
66 Reset(); |
|
67 } |
|
68 |
|
69 // --------------------------------------------------------------------------- |
|
70 // ReadBubbleHeader |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 void CBubbleOutlookVideo::ReadBubbleHeader( CBubbleHeader& aHeader ) |
|
74 { |
|
75 iHeader = &aHeader; |
|
76 |
|
77 iBubble = iBubbleManager.ResourceManager().ReserveEikImage( ETrue ); |
|
78 |
|
79 CBubbleOutlookTwoLined::ReadBubbleHeader( aHeader ); |
|
80 } |
|
81 |
|
82 // --------------------------------------------------------------------------- |
|
83 // SizeChanged |
|
84 // --------------------------------------------------------------------------- |
|
85 // |
|
86 void CBubbleOutlookVideo::SizeChanged() |
|
87 { |
|
88 if( !iHeader ) |
|
89 { |
|
90 return; |
|
91 } |
|
92 |
|
93 const TRect rect( Rect() ); |
|
94 |
|
95 // Layout labels |
|
96 BubbleUtils::LayoutLabel( |
|
97 iTextLine1, |
|
98 rect, |
|
99 BubbleLayout3::popup_call3_audio_in_window_text_line_1(1)); |
|
100 |
|
101 BubbleUtils::LayoutLabel( |
|
102 iTextLine2, |
|
103 rect, |
|
104 BubbleLayout3::popup_call3_audio_in_window_text_line_2(1)); |
|
105 |
|
106 // Call indicator |
|
107 BubbleUtils::LayoutCustomElement( |
|
108 iBigCallIndicator, |
|
109 rect, |
|
110 BubbleLayout3::popup_call3_audio_in_window_call_indication(1) ); |
|
111 |
|
112 // Layout number type icon |
|
113 BubbleUtils::LayoutCustomElement( |
|
114 iNumberType, |
|
115 rect, |
|
116 BubbleLayout3::popup_call3_audio_in_window_numbertype_indication(1)); |
|
117 |
|
118 // Layout cyphering indicator |
|
119 BubbleUtils::LayoutControl( |
|
120 iCyphOffImage, |
|
121 rect, |
|
122 BubbleLayout3::popup_call3_audio_in_window_cipheringoff_indication(1)); |
|
123 |
|
124 // Layout and prepare frame |
|
125 TAknLayoutRect bubbleRect; |
|
126 bubbleRect.LayoutRect( |
|
127 rect, |
|
128 BubbleLayout3::popup_call3_audio_in_pane(1)); |
|
129 |
|
130 if ( Layout_Meta_Data::IsMirrored() ) |
|
131 { |
|
132 TAknLayoutRect bubbleTopRight; |
|
133 bubbleTopRight.LayoutRect( |
|
134 bubbleRect.Rect(), |
|
135 BubbleLayout3::popup_call3_audio_in_window_fr_corner_topright()); |
|
136 |
|
137 TAknLayoutRect bubbleBottomLeft; |
|
138 bubbleBottomLeft.LayoutRect( |
|
139 bubbleRect.Rect(), |
|
140 BubbleLayout3::popup_call3_audio_in_window_fr_corner_bottomleft()); |
|
141 |
|
142 iOuterRect = TRect( bubbleTopRight.Rect().iTl, |
|
143 bubbleBottomLeft.Rect().iBr ); |
|
144 iInnerRect = TRect( bubbleTopRight.Rect().iBr, |
|
145 bubbleBottomLeft.Rect().iTl ); |
|
146 } |
|
147 else |
|
148 { |
|
149 TAknLayoutRect bubbleTopLeft; |
|
150 bubbleTopLeft.LayoutRect( |
|
151 bubbleRect.Rect(), |
|
152 BubbleLayout3::popup_call3_audio_in_window_fr_corner_topleft()); |
|
153 |
|
154 TAknLayoutRect bubbleBottomRight; |
|
155 bubbleBottomRight.LayoutRect( |
|
156 bubbleRect.Rect(), |
|
157 BubbleLayout3::popup_call3_audio_in_window_fr_corner_bottomright()); |
|
158 |
|
159 iOuterRect = TRect( bubbleTopLeft.Rect().iTl, |
|
160 bubbleBottomRight.Rect().iBr ); |
|
161 iInnerRect = TRect( bubbleTopLeft.Rect().iBr, |
|
162 bubbleBottomRight.Rect().iTl ); |
|
163 } |
|
164 |
|
165 |
|
166 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
167 CBubbleManager::TPhoneCallState callState = iHeader->CallState(); |
|
168 iFrameId = ( callState == CBubbleManager::EAlertToDisconnected ) ? |
|
169 KAknsIIDQsnFrCall3RectDisconn : |
|
170 KAknsIIDQsnFrCall3Rect; |
|
171 AknsDrawUtils::PrepareFrame( skin, |
|
172 iOuterRect, |
|
173 iInnerRect, |
|
174 iFrameId, |
|
175 KAknsIIDDefault ); |
|
176 |
|
177 // Pass video layouts to video controller. |
|
178 LayoutVideoPanes( rect ); |
|
179 iBubbleManager.VideoController().SetVideoPaneBackgroundFrame( |
|
180 iFrameId, iOuterRect, iInnerRect ); |
|
181 |
|
182 // Layout rectangle for separator line |
|
183 TAknLayoutRect lineRect; |
|
184 lineRect.LayoutRect( rect, |
|
185 BubbleLayout3::popup_call3_audio_in_window_separator_line( 0 )); |
|
186 iLineRect = lineRect.Rect(); |
|
187 } |
|
188 |
|
189 // --------------------------------------------------------------------------- |
|
190 // PositionChanged |
|
191 // --------------------------------------------------------------------------- |
|
192 // |
|
193 void CBubbleOutlookVideo::PositionChanged() |
|
194 { |
|
195 AknsUtils::RegisterControlPosition( this ); |
|
196 } |
|
197 |
|
198 |
|
199 // --------------------------------------------------------------------------- |
|
200 // DrawBitmaps |
|
201 // --------------------------------------------------------------------------- |
|
202 // |
|
203 void CBubbleOutlookVideo::DrawBitmaps( CBitmapContext& aGc ) const |
|
204 { |
|
205 // Check that proper call header is set |
|
206 if ( iHeader == NULL ) |
|
207 { |
|
208 return; |
|
209 } |
|
210 |
|
211 if ( !iHeader->IsUsed() ) |
|
212 { |
|
213 return; |
|
214 } |
|
215 |
|
216 if ( iHeader->IsInConference() ) |
|
217 { |
|
218 return; |
|
219 } |
|
220 |
|
221 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
222 if ( iBubble->Bitmap() ) |
|
223 { |
|
224 BubbleUtils::DrawMaskedImage( aGc , iBubble ); |
|
225 } |
|
226 else |
|
227 { |
|
228 // Draw bubble frame |
|
229 if ( !AknsDrawUtils::DrawFrame( skin, |
|
230 (CWindowGc&) aGc, |
|
231 iOuterRect, |
|
232 iInnerRect, |
|
233 iFrameId, |
|
234 KAknsIIDDefault ) ) |
|
235 { |
|
236 BubbleUtils::DrawBackgroundRect( aGc, Rect() ); |
|
237 } |
|
238 } |
|
239 |
|
240 CFbsBitmap* lineBmp = NULL; |
|
241 CFbsBitmap* lineBmpMask = NULL; |
|
242 AknsUtils::GetCachedMaskedBitmap( skin, |
|
243 KAknsIIDQgnGrafLineSecondaryHorizontal, |
|
244 lineBmp, |
|
245 lineBmpMask); |
|
246 if ( lineBmp ) |
|
247 { |
|
248 AknIconUtils::SetSize( lineBmp, |
|
249 iLineRect.Size(), |
|
250 EAspectRatioNotPreserved); |
|
251 if ( lineBmpMask ) |
|
252 { |
|
253 AknIconUtils::SetSize( lineBmpMask, iLineRect.Size(), |
|
254 EAspectRatioNotPreserved); |
|
255 |
|
256 aGc.BitBltMasked( iLineRect.iTl, lineBmp, TRect( TPoint(0,0), |
|
257 lineBmp->SizeInPixels() ), |
|
258 lineBmpMask, EFalse); |
|
259 } |
|
260 else |
|
261 { |
|
262 aGc.BitBlt( iLineRect.iTl, lineBmp ); |
|
263 } |
|
264 } |
|
265 } |
|
266 |
|
267 // --------------------------------------------------------------------------- |
|
268 // LayoutVideoPanes |
|
269 // --------------------------------------------------------------------------- |
|
270 // |
|
271 void CBubbleOutlookVideo::LayoutVideoPanes( const TRect& aParentRect ) |
|
272 { |
|
273 // Qcif video pane |
|
274 TAknLayoutRect qcifVideoPane; |
|
275 qcifVideoPane.LayoutRect( |
|
276 aParentRect, |
|
277 BubbleLayout3::call3_video_qcif_pane(0) ); |
|
278 |
|
279 // Qcif uncrop pane |
|
280 TAknLayoutRect qcifUncropPane; |
|
281 qcifUncropPane.LayoutRect( |
|
282 aParentRect, |
|
283 BubbleLayout3::call3_video_qcif_uncrop_pane(0) ); |
|
284 |
|
285 // Subqcif video pane |
|
286 TAknLayoutRect subQcifVideoPane; |
|
287 subQcifVideoPane.LayoutRect( |
|
288 aParentRect, |
|
289 BubbleLayout3::call3_video_subqcif_pane(0) ); |
|
290 |
|
291 // Subqcif uncrop pane |
|
292 TAknLayoutRect subQcifUncropPane; |
|
293 subQcifUncropPane.LayoutRect( |
|
294 aParentRect, |
|
295 BubbleLayout3::call3_video_subqcif_uncrop_pane(0) ); |
|
296 |
|
297 // Update video rects to video controller |
|
298 iBubbleManager.VideoController().SetQcifVideoPaneRects( |
|
299 qcifVideoPane.Rect(), |
|
300 qcifUncropPane.Rect() ); |
|
301 |
|
302 iBubbleManager.VideoController().SetSubQcifVideoPaneRects( |
|
303 subQcifVideoPane.Rect(), |
|
304 subQcifUncropPane.Rect() ); |
|
305 } |
|
306 |
|
307 // End of File |