|
1 /* |
|
2 * Copyright (c) 2004 - 2006 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 the CVtUiMainControl control class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CVtUiMainControl.h" |
|
22 #include "VtUiLayout.h" |
|
23 #include <aknsutils.h> |
|
24 #include <aknsdrawutils.h> |
|
25 #include <cvtlogger.h> |
|
26 #include <featmgr.h> |
|
27 #include "CVtUiAppUi.h" |
|
28 #include "tvtuistates.h" |
|
29 #include <aknsutils.h> |
|
30 #include "tVtuifeaturevariation.h" |
|
31 |
|
32 // ============================ MEMBER FUNCTIONS =============================== |
|
33 |
|
34 // ----------------------------------------------------------------------------- |
|
35 // CVtUiMainControl::NewL |
|
36 // ----------------------------------------------------------------------------- |
|
37 CVtUiMainControl* CVtUiMainControl::NewL( CVtUiBitmapManager& aBitmapManager, |
|
38 TVtUiStates& aUiStates ) |
|
39 { |
|
40 __VTPRINTENTER( "MainCtrl.NewL" ) |
|
41 CVtUiMainControl* self = |
|
42 new ( ELeave ) CVtUiMainControl( aBitmapManager, aUiStates ); |
|
43 CleanupStack::PushL( self ); |
|
44 self->ConstructL(); |
|
45 CleanupStack::Pop(); // self |
|
46 __VTPRINTEXIT( "MainCtrl.NewL" ) |
|
47 return self; |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CVtUiMainControl::CVtUiMainControl |
|
52 // C++ constructor can NOT contain any code, that |
|
53 // might leave. |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 CVtUiMainControl::CVtUiMainControl( CVtUiBitmapManager& aBitmapManager, |
|
57 TVtUiStates& aUiStates ) : CVtUiVideoControlBase( aBitmapManager ), |
|
58 iUiStates ( aUiStates ) |
|
59 { |
|
60 __VTPRINTENTER( "MainCtrl.Ctor" ) |
|
61 SetRenderingHint( ESkinnedBackground ); |
|
62 __VTPRINTEXIT( "MainCtrl.Ctor" ) |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // CVtUiMainControl::ConstructL |
|
67 // Symbian 2nd phase constructor. |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 void CVtUiMainControl::ConstructL() |
|
71 { |
|
72 __VTPRINTENTER( "MainCtrl.ConstructL" ) |
|
73 BaseConstructL(); |
|
74 iBlindId = |
|
75 BitmapManager().AddBitmapL( |
|
76 EVtUiBitmap_qgn_indi_call_video_blind_in, |
|
77 EFalse ); |
|
78 BitmapManager().SetAspectRatio( iBlindId, EFalse ); |
|
79 iBlindMaskId = |
|
80 BitmapManager().AddBitmapL( |
|
81 EVtUiBitmap_qgn_indi_call_video_blind_in_mask_icon, |
|
82 EFalse ); |
|
83 BitmapManager().SetAspectRatio( iBlindMaskId, EFalse ); |
|
84 __VTPRINTEXIT( "MainCtrl.ConstructL" ) |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // CVtUiMainControl::~CVtUiMainControl |
|
89 // Destructor. |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 CVtUiMainControl::~CVtUiMainControl() |
|
93 { |
|
94 __VTPRINTENTER( "MainCtrl.~" ) |
|
95 BitmapManager().RemoveBitmap( iBlindId ); |
|
96 BitmapManager().RemoveBitmap( iBlindMaskId ); |
|
97 __VTPRINTEXIT( "MainCtrl.~" ) |
|
98 } |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CVtUiMainControl::HandleSizeChanged |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 void CVtUiMainControl::HandleSizeChanged() |
|
105 { |
|
106 __VTPRINTENTER( "MainCtrl.HandleSizeChanged" ) |
|
107 const TRect mainPaneRect( Rect() ); |
|
108 |
|
109 // blind icon and mask |
|
110 TAknWindowLineLayout blind; |
|
111 VtUiLayout::GetSecondWindowDisabledIconLayout( blind ); |
|
112 iBlindLayout.LayoutRect( mainPaneRect, blind ); |
|
113 const TSize blindSize( iBlindLayout.Rect().Size() ); |
|
114 BitmapManager().SetSize( iBlindId, blindSize ); |
|
115 BitmapManager().SetSize( iBlindMaskId, blindSize ); |
|
116 |
|
117 // stream |
|
118 TAknWindowLineLayout stream; |
|
119 VtUiLayout::GetSecondWindowStreamWholeLayout( stream, |
|
120 iUiStates.IsToolbarAvailable(), iSQCifRemote ); |
|
121 |
|
122 iStreamLayoutRect.LayoutRect( mainPaneRect, stream ); |
|
123 |
|
124 __VTPRINTEXIT( "MainCtrl.HandleSizeChanged" ) |
|
125 } |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // CVtUiMainControl::DrawWaitingText |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 TBool CVtUiMainControl::DrawWaitingText( CWindowGc& aGc ) const |
|
132 { |
|
133 __VTPRINTENTER( "MainCtrl.DrawWaitingText" ) |
|
134 TBool wasDrawn( EFalse ); |
|
135 if ( !iSQCifRemote) |
|
136 { |
|
137 wasDrawn = CVtUiVideoControlBase::DrawWaitingText( aGc ); |
|
138 } |
|
139 __VTPRINTEXITR( "MainCtrl.DrawWaitingText %d", wasDrawn ) |
|
140 return wasDrawn; |
|
141 } |
|
142 |
|
143 // ----------------------------------------------------------------------------- |
|
144 // CVtUiMainControl::StreamBlitPosition |
|
145 // ----------------------------------------------------------------------------- |
|
146 // |
|
147 TPoint CVtUiMainControl::StreamBlitPosition() const |
|
148 { |
|
149 __VTPRINTENTER( "MainCtrl.StreamBlitPosition" ) |
|
150 const TSize videoSize( iStreamBitmap->SizeInPixels() ); |
|
151 const TSize streamSize( iStreamLayoutRect.Rect().Size() ); |
|
152 __VTPRINTEXIT( "MainCtrl.StreamBlitPosition" ) |
|
153 return AdjustPointForDP( iStreamLayoutRect.Rect().iTl ); |
|
154 } |
|
155 |
|
156 // ----------------------------------------------------------------------------- |
|
157 // CVtUiMainControl::StreamClippingRect |
|
158 // ----------------------------------------------------------------------------- |
|
159 // |
|
160 TRect CVtUiMainControl::StreamClippingRect() const |
|
161 { |
|
162 __VTPRINTENTER( "MainCtrl.StreamClippingRect" ) |
|
163 __VTPRINTEXIT( "MainCtrl.StreamClippingRect" ) |
|
164 return AdjustRectForDP( iStreamLayoutRect.Rect() ); |
|
165 } |
|
166 |
|
167 // ----------------------------------------------------------------------------- |
|
168 // CVtUiMainControl::BlindImage |
|
169 // ----------------------------------------------------------------------------- |
|
170 // |
|
171 CFbsBitmap* CVtUiMainControl::BlindImage() const |
|
172 { |
|
173 __VTPRINTENTER( "MainCtrl.BlindImage" ) |
|
174 __VTPRINTEXIT( "MainCtrl.BlindImage" ) |
|
175 return Bitmap( iBlindId ); |
|
176 } |
|
177 |
|
178 // ----------------------------------------------------------------------------- |
|
179 // CVtUiMainControl::BlindMask |
|
180 // ----------------------------------------------------------------------------- |
|
181 // |
|
182 CFbsBitmap* CVtUiMainControl::BlindMask() const |
|
183 { |
|
184 __VTPRINTENTER( "MainCtrl.BlindMask" ) |
|
185 __VTPRINTEXIT( "MainCtrl.BlindMask" ) |
|
186 return Bitmap( iBlindMaskId ); |
|
187 } |
|
188 |
|
189 // --------------------------------------------------------------------------- |
|
190 // CVtUiMainControl::BlindBlitPosition |
|
191 // --------------------------------------------------------------------------- |
|
192 // |
|
193 TPoint CVtUiMainControl::BlindBlitPosition() const |
|
194 { |
|
195 __VTPRINTENTER( "CVtUiMainControl.BlindBlitPosition" ) |
|
196 __VTPRINTEXIT( "CVtUiMainControl.BlindBlitPosition" ) |
|
197 return iBlindLayout.Rect().iTl; |
|
198 } |
|
199 |
|
200 // --------------------------------------------------------------------------- |
|
201 // CVtUiMainControl::WaitingTextLayout |
|
202 // --------------------------------------------------------------------------- |
|
203 // |
|
204 TAknTextLineLayout CVtUiMainControl::WaitingTextLayout( TInt aLine ) |
|
205 { |
|
206 __VTPRINTENTER( "MainCtrl.WaitingTextLayout" ) |
|
207 TAknTextLineLayout textLayout; |
|
208 VtUiLayout::GetSecondWindowWaitingTextLayout( textLayout, |
|
209 aLine ? EFalse : ETrue ); |
|
210 __VTPRINTEXIT( "MainCtrl.WaitingTextLayout" ) |
|
211 return textLayout; |
|
212 } |
|
213 |
|
214 // ----------------------------------------------------------------------------- |
|
215 // CVtUiMainControl::SupportSQCif |
|
216 // ----------------------------------------------------------------------------- |
|
217 // |
|
218 void CVtUiMainControl::SupportSQCif( TBool aIsSupported ) |
|
219 { |
|
220 __VTPRINTENTER( "MainCtrl.SupportSQCif" ) |
|
221 const TBool layoutUpdateRequired( aIsSupported != iSQCifRemote ); |
|
222 iSQCifRemote = aIsSupported; |
|
223 if ( layoutUpdateRequired ) |
|
224 { |
|
225 HandleSizeChanged(); |
|
226 } |
|
227 __VTPRINTEXITR( "MainCtrl.SupportSQCif %d", iSQCifRemote ) |
|
228 } |
|
229 |
|
230 // ----------------------------------------------------------------------------- |
|
231 // CVtUiMainControl::LayoutRemoteVideo |
|
232 // ----------------------------------------------------------------------------- |
|
233 // |
|
234 void CVtUiMainControl::LayoutRemoteVideo( ) |
|
235 { |
|
236 __VTPRINTENTER( "MainCtrl.LayoutRemoteVideo" ) |
|
237 if ( NULL != iRemoteVideoControl ) |
|
238 { |
|
239 TRect rectRemoteVideo(StreamClippingRect()); |
|
240 rectRemoteVideo.Move(PositionRelativeToScreen()); |
|
241 iRemoteVideoControl->SetExtent(rectRemoteVideo.iTl,rectRemoteVideo.Size()); |
|
242 } |
|
243 __VTPRINTEXIT( "MainCtrl.LayoutRemoteVideo" ) |
|
244 } |
|
245 // End of File |