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