35
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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: Fixed toolbar UI feature implementation.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
|
|
21 |
#include "cvtuifixedtoolbar.h"
|
|
22 |
#include "cvtuifeaturemanager.h"
|
|
23 |
#include "mvtuicomponentmanager.h"
|
|
24 |
#include "mvtuicommandmanager.h"
|
|
25 |
#include "videotelui.hrh"
|
|
26 |
#include "tvtuistates.h"
|
|
27 |
#include "cvtuitoolbarcmdpolicy.h"
|
|
28 |
#include "cvtuitoolbarskmodifier.h"
|
|
29 |
#include "CVtUiAppUi.h"
|
|
30 |
#include <videotelui.rsg>
|
|
31 |
#include <cvtlogger.h>
|
|
32 |
#include <akntoolbar.h>
|
|
33 |
#include "tvtuistates.h"
|
|
34 |
#include <layoutmetadata.cdl.h>
|
|
35 |
|
|
36 |
// -----------------------------------------------------------------------------
|
|
37 |
// CVtUiFixedToolbar::NewL
|
|
38 |
// -----------------------------------------------------------------------------
|
|
39 |
//
|
|
40 |
CVtUiFixedToolbar* CVtUiFixedToolbar::NewL( CVtUiFeatureManager&
|
|
41 |
aFeatureManager )
|
|
42 |
{
|
|
43 |
__VTPRINTENTER( "FixedToolbar.NewL" )
|
|
44 |
CVtUiFixedToolbar* self = new ( ELeave ) CVtUiFixedToolbar(
|
|
45 |
aFeatureManager );
|
|
46 |
CleanupStack::PushL( self );
|
|
47 |
self->ConstructL();
|
|
48 |
CleanupStack::Pop( self );
|
|
49 |
__VTPRINTEXIT( "FixedToolbar.NewL" )
|
|
50 |
return self;
|
|
51 |
}
|
|
52 |
|
|
53 |
// -----------------------------------------------------------------------------
|
|
54 |
// CVtUiFixedToolbar::CVtUiFixedToolbar
|
|
55 |
// C++ constructor can NOT contain any code, that
|
|
56 |
// might leave.
|
|
57 |
// -----------------------------------------------------------------------------
|
|
58 |
//
|
|
59 |
CVtUiFixedToolbar::CVtUiFixedToolbar( CVtUiFeatureManager&
|
|
60 |
aFeatureManager ) : CVtUiToolbarBase( aFeatureManager )
|
|
61 |
{
|
|
62 |
}
|
|
63 |
|
|
64 |
// -----------------------------------------------------------------------------
|
|
65 |
// CVtUiFixedToolbar::ConstructL
|
|
66 |
// Symbian 2nd phase constructor.
|
|
67 |
// -----------------------------------------------------------------------------
|
|
68 |
//
|
|
69 |
void CVtUiFixedToolbar::ConstructL()
|
|
70 |
{
|
|
71 |
__VTPRINTENTER( "FixedToolbar.ConstructL" )
|
|
72 |
BaseConstructL();
|
|
73 |
|
|
74 |
//create toolbar
|
|
75 |
iToolbar = iFeatureManager.AppUi().CurrentFixedToolbar();
|
|
76 |
|
|
77 |
// create and add items into the toolbar
|
|
78 |
CreateToolbarButtonsL();
|
|
79 |
|
|
80 |
// Dim all toolbar buttons until first refresh is called
|
|
81 |
DimToolbarbuttons( ETrue );
|
|
82 |
|
|
83 |
if ( !Layout_Meta_Data::IsLandscapeOrientation() )
|
|
84 |
{
|
|
85 |
MakeToolbarVisible( EFalse );
|
|
86 |
}
|
|
87 |
|
|
88 |
__VTPRINTEXIT( "FixedToolbar.ConstructL" )
|
|
89 |
}
|
|
90 |
|
|
91 |
// -----------------------------------------------------------------------------
|
|
92 |
// CVtUiFixedToolbar::~CVtUiFixedToolbar
|
|
93 |
// Destructor.
|
|
94 |
// -----------------------------------------------------------------------------
|
|
95 |
//
|
|
96 |
CVtUiFixedToolbar::~CVtUiFixedToolbar()
|
|
97 |
{
|
|
98 |
__VTPRINTENTER( "FixedToolbar.~" )
|
|
99 |
delete iIdle;
|
|
100 |
__VTPRINTEXIT( "FixedToolbar.~" )
|
|
101 |
}
|
|
102 |
|
|
103 |
// -----------------------------------------------------------------------------
|
|
104 |
// CVtUiFixedToolbar::CreateToolbarButtons
|
|
105 |
// -----------------------------------------------------------------------------
|
|
106 |
//
|
|
107 |
void CVtUiFixedToolbar::CreateToolbarButtonsL()
|
|
108 |
{
|
|
109 |
__VTPRINTENTER( "FixedToolbar.CreateToolbarButtons" )
|
|
110 |
// Default buttons created in base clase
|
|
111 |
CVtUiToolbarBase::CreateToolbarButtonsL();
|
|
112 |
|
|
113 |
// toggle microphone
|
|
114 |
CreateToolbarItemL( R_AVKONBUTTON_AUDIO_ROUTING_BUTTON,
|
|
115 |
EVtUiCmdToolbarAudioRouting, iFeatureManager.AppUi() );
|
|
116 |
|
|
117 |
|
|
118 |
__VTPRINTEXIT( "FixedToolbar.CreateToolbarButtons" )
|
|
119 |
}
|
|
120 |
|
|
121 |
// -----------------------------------------------------------------------------
|
|
122 |
// CVtUiFixedToolbar::PopulateCmdsIdsL
|
|
123 |
// -----------------------------------------------------------------------------
|
|
124 |
//
|
|
125 |
void CVtUiFixedToolbar::PopulateCmdsIdsL()
|
|
126 |
{
|
|
127 |
__VTPRINTENTER( "FixedToolbar.PopulateCmdsIdsL" )
|
|
128 |
// Default commands populated in base clase
|
|
129 |
CVtUiToolbarBase::PopulateCmdsIdsL();
|
|
130 |
|
|
131 |
CVtUiAppUi& appUi = iFeatureManager.AppUi();
|
|
132 |
|
|
133 |
iCmdIds.AppendL( EVtUiCmdActivateBT );
|
|
134 |
iCmdIds.AppendL( EVtUiCmdSwitchFromBTToIHF );
|
|
135 |
iCmdIds.AppendL( EVtUiCmdActivateLoudspeaker );
|
|
136 |
iCmdIds.AppendL( EVtUiCmdDeactivateLoudspeaker );
|
|
137 |
|
|
138 |
__VTPRINTEXIT( "FixedToolbar.PopulateCmdsIdsL" )
|
|
139 |
}
|
|
140 |
|
|
141 |
// -----------------------------------------------------------------------------
|
|
142 |
// CVtUiFixedToolbar::SetToolbarVisibilityAfterLayoutChangeL
|
|
143 |
// -----------------------------------------------------------------------------
|
|
144 |
//
|
|
145 |
void CVtUiFixedToolbar::SetToolbarVisibilityAfterLayoutChangeL( TBool aVisible )
|
|
146 |
{
|
|
147 |
// Portrait to landscape show tb
|
|
148 |
__VTPRINTENTER( "FixedToolbar.SetToolbarVisibilityAfterLayoutChangeL" )
|
|
149 |
if( aVisible )
|
|
150 |
{
|
|
151 |
__VTPRINT(DEBUG_GEN, "FixedToolbar.SetToolbarVisibilityAfterLayoutChangeL.1" )
|
|
152 |
DimToolbarbuttons( ETrue );
|
|
153 |
// Set flag
|
|
154 |
iFeatureManager.UiStates().SetIsFixedToolbarVisible( ETrue );
|
|
155 |
// set visible
|
|
156 |
iFeatureManager.AppUi().CurrentFixedToolbar()
|
|
157 |
->SetToolbarVisibility( ETrue );
|
|
158 |
// Set callback to dim toolbarbuttons
|
|
159 |
// if ( !iIdle )
|
|
160 |
// {
|
|
161 |
// iIdle = CIdle::NewL( CActive::EPriorityIdle );
|
|
162 |
// }
|
|
163 |
//
|
|
164 |
// if ( !iIdle->IsActive() )
|
|
165 |
// {
|
|
166 |
// iIdle->Start( TCallBack( &DoDimToolbarButtons, this ) );
|
|
167 |
// }
|
|
168 |
}
|
|
169 |
// Landsacpe to portrait hide tb
|
|
170 |
else
|
|
171 |
{
|
|
172 |
__VTPRINT(DEBUG_GEN, "FixedToolbar.SetToolbarVisibilityAfterLayoutChangeL.2" )
|
|
173 |
DimToolbarbuttons( EFalse );
|
|
174 |
iFeatureManager.AppUi().CurrentFixedToolbar()
|
|
175 |
->SetToolbarVisibility( EFalse );
|
|
176 |
// Set flag
|
|
177 |
iFeatureManager.UiStates().SetIsFixedToolbarVisible( EFalse );
|
|
178 |
}
|
|
179 |
__VTPRINTEXIT( "FixedToolbar.SetToolbarVisibilityAfterLayoutChangeL" )
|
|
180 |
}
|
|
181 |
|
|
182 |
// -----------------------------------------------------------------------------
|
|
183 |
// CVtUiFixedToolbar::DimToolbarbuttons
|
|
184 |
// -----------------------------------------------------------------------------
|
|
185 |
//
|
|
186 |
void CVtUiFixedToolbar::DimToolbarbuttons( TBool aIsDimmed )
|
|
187 |
{
|
|
188 |
__VTPRINTENTER( "FixedToolbar.DimToolbarbuttons" )
|
|
189 |
iToolbar->SetItemDimmed( EVtUiCmdToolbarToggleVideo, aIsDimmed, ETrue );
|
|
190 |
iToolbar->SetItemDimmed( EVtUiCmdToolbarToggleMicrophone, aIsDimmed, ETrue );
|
|
191 |
iToolbar->SetItemDimmed( EVtUiCmdToolbarAudioRouting, aIsDimmed, ETrue );
|
|
192 |
__VTPRINTEXITR( "FixedToolbar.DimToolbarbuttons %d", aIsDimmed )
|
|
193 |
}
|
|
194 |
|
|
195 |
// -----------------------------------------------------------------------------
|
|
196 |
// CVtUiFixedToolbar::MakeToolbarVisible
|
|
197 |
// -----------------------------------------------------------------------------
|
|
198 |
//
|
|
199 |
void CVtUiFixedToolbar::MakeToolbarVisible( const TBool aVisible )
|
|
200 |
{
|
|
201 |
__VTPRINTENTER( "FixedToolbar.MakeToolbarVisible" )
|
|
202 |
iFeatureManager.AppUi().CurrentFixedToolbar()->
|
|
203 |
SetToolbarVisibility( aVisible );
|
|
204 |
iFeatureManager.UiStates().SetIsFixedToolbarVisible( aVisible );
|
|
205 |
__VTPRINTEXITR( "FixedToolbar.MakeToolbarVisible %d", aVisible )
|
|
206 |
}
|
|
207 |
|
|
208 |
// -----------------------------------------------------------------------------
|
|
209 |
// CVtUiFixedToolbar::DoShowToolbarL
|
|
210 |
// -----------------------------------------------------------------------------
|
|
211 |
//
|
|
212 |
TInt CVtUiFixedToolbar::DoShowToolbarL( TAny* aAny )
|
|
213 |
{
|
|
214 |
__VTPRINTENTER( "FixedToolbar.DoShowToolbarL" )
|
|
215 |
CVtUiFixedToolbar* self = static_cast< CVtUiFixedToolbar* >( aAny );
|
|
216 |
self->iFeatureManager.AppUi().CurrentFixedToolbar()
|
|
217 |
->SetToolbarVisibility( ETrue );
|
|
218 |
__VTPRINTEXIT( "FixedToolbar.DoShowToolbarL" )
|
|
219 |
return KErrNone;
|
|
220 |
}
|
|
221 |
|
|
222 |
// -----------------------------------------------------------------------------
|
|
223 |
// CVtUiFixedToolbar::DoToolbarButton
|
|
224 |
// -----------------------------------------------------------------------------
|
|
225 |
//
|
|
226 |
TInt CVtUiFixedToolbar::DoDimToolbarButtons( TAny* aAny )
|
|
227 |
{
|
|
228 |
__VTPRINTENTER( "FixedToolbar.DoDimToolbarButtons" )
|
|
229 |
CVtUiFixedToolbar* self = static_cast< CVtUiFixedToolbar* >( aAny );
|
|
230 |
self->DimToolbarbuttons( ETrue );
|
|
231 |
__VTPRINTEXIT( "FixedToolbar.DoDimToolbarButtons" )
|
|
232 |
return EFalse;
|
|
233 |
}
|
|
234 |
|
|
235 |
// -----------------------------------------------------------------------------
|
|
236 |
// CVtUiFixedToolbar::DoActivateL
|
|
237 |
// -----------------------------------------------------------------------------
|
|
238 |
//
|
|
239 |
void CVtUiFixedToolbar::DoActivateL()
|
|
240 |
{
|
|
241 |
__VTPRINTENTER( "FixedToolbar.DoActivateL" )
|
|
242 |
if ( !iFeatureManager.UiStates().IsFixedToolbarVisible() &&
|
|
243 |
!Layout_Meta_Data::IsLandscapeOrientation() )
|
|
244 |
{
|
|
245 |
// reset flag
|
|
246 |
iFeatureManager.UiStates().SetIsFixedToolbarVisible( ETrue );
|
|
247 |
// Show toolbar with delay in order to prevent overdrawing
|
|
248 |
// witht other components.
|
|
249 |
iAsyncCallback->Cancel();
|
|
250 |
iAsyncCallback->Set( TCallBack( &DoShowToolbarL, this ) );
|
|
251 |
iAsyncCallback->CallBack();
|
|
252 |
}
|
|
253 |
else
|
|
254 |
{
|
|
255 |
// Undim buttons
|
|
256 |
__VTPRINT( DEBUG_GEN, "FixedToolbar.DoDeactivateL.DTB EFalse" )
|
|
257 |
// toolbar might be unvisible, because condition in the contructor
|
|
258 |
// "if ( !Layout_Meta_Data::IsLandscapeOrientation() )"
|
|
259 |
// will be evaluated ture eventhough the orientation is forced to be landsacepe
|
|
260 |
// because it seems that the orientation is still portrait in the constructor phase
|
|
261 |
MakeToolbarVisible( ETrue );
|
|
262 |
DimToolbarbuttons( EFalse );
|
|
263 |
}
|
|
264 |
// Start blocking pointer events
|
|
265 |
BlockPointerEvents( ETrue );
|
|
266 |
// Base class
|
|
267 |
CVtUiToolbarBase::DoActivateL();
|
|
268 |
__VTPRINTEXIT( "FixedToolbar.DoActivateL" )
|
|
269 |
}
|
|
270 |
|
|
271 |
// -----------------------------------------------------------------------------
|
|
272 |
// CVtUiFixedToolbar::DoDeactivateL
|
|
273 |
// -----------------------------------------------------------------------------
|
|
274 |
//
|
|
275 |
void CVtUiFixedToolbar::DoDeactivateL()
|
|
276 |
{
|
|
277 |
__VTPRINTENTER( "FixedToolbar.DoDeactivateL" )
|
|
278 |
iAsyncCallback->Cancel();
|
|
279 |
if ( !iFeatureManager.UiStates().IsFixedToolbarVisible() &&
|
|
280 |
!Layout_Meta_Data::IsLandscapeOrientation() )
|
|
281 |
{
|
|
282 |
iFeatureManager.AppUi().CurrentFixedToolbar()
|
|
283 |
->SetToolbarVisibility( EFalse );
|
|
284 |
__VTPRINT( DEBUG_GEN, "FixedToolbar.DoDeactivateL.Vs" )
|
|
285 |
}
|
|
286 |
else
|
|
287 |
{
|
|
288 |
// Dim all buttons
|
|
289 |
__VTPRINT( DEBUG_GEN, "FixedToolbar.DoDeactivateL.DTB ETrue" )
|
|
290 |
DimToolbarbuttons( ETrue );
|
|
291 |
}
|
|
292 |
// Stop blocking pointer events
|
|
293 |
BlockPointerEvents( EFalse );
|
|
294 |
// Base class
|
|
295 |
CVtUiToolbarBase::DoDeactivateL();
|
|
296 |
__VTPRINTEXIT( "FixedToolbar.DoDeactivateL" )
|
|
297 |
}
|
|
298 |
|
|
299 |
// End of File
|