author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 21:19:17 +0300 | |
branch | RCL_3 |
changeset 27 | 34937ec34dac |
parent 26 | 5b3385a43d68 |
permissions | -rw-r--r-- |
26 | 1 |
/* |
2 |
* Copyright (c) 2008-2009 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: Interface to Alf Objects |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
#include "glxmulmodelproviderbase.h" |
|
22 |
||
23 |
#include <alf/alfenv.h> |
|
24 |
#include <alf/alfevent.h> |
|
25 |
#include <alf/ialfwidgetfactory.h> |
|
26 |
#include <alf/alfwidgetenvextension.h> |
|
27 |
#include <mul/imulwidget.h> |
|
28 |
#include <mul/mulevent.h> |
|
29 |
#include <mul/mulvisualitem.h> |
|
30 |
#include <mul/imulcoverflowwidget.h> // An interface for Multimedia coverflow Widget |
|
31 |
#include <glxlog.h> //Logging |
|
32 |
#include <glxtracer.h> |
|
33 |
#include <glxnavigationalstate.h> |
|
34 |
#include <glxnavigationalstatedefs.h> |
|
35 |
||
36 |
#include <data_caging_path_literals.hrh>// for KDC_APP_RESOURCE_DIR |
|
37 |
#include <glxuiutilities.rsg> |
|
38 |
#include <glxgeneraluiutilities.h> |
|
39 |
#include <glxtexturemanager.h> |
|
40 |
#include <glxicons.mbg> |
|
41 |
#include <glxuistd.h> |
|
42 |
#include "glxdrmgiftexturecreator.h" |
|
43 |
#include "glxbinding.h" |
|
44 |
#include "glxcommandbindingutility.h" |
|
45 |
||
46 |
using namespace Alf; |
|
47 |
||
48 |
static const char* const KListWidget = "ListWidget"; |
|
49 |
static const char* const KGridWidget = "GridWidget"; |
|
50 |
static const char* const KCoverFlowWidget = "CoverflowWidget"; |
|
51 |
||
52 |
// ---------------------------------------------------------------------------- |
|
53 |
// BaseConstructL |
|
54 |
// ---------------------------------------------------------------------------- |
|
55 |
// |
|
56 |
void CGlxMulModelProviderBase::BaseConstructL( |
|
57 |
CAlfEnv& aEnv, |
|
58 |
Alf::mulwidget::TLogicalTemplate aDefaultTemplate, |
|
59 |
TInt aDataWindowSize ) |
|
60 |
{ |
|
61 |
TRACER("CGlxMulModelProviderBase::BaseConstructL"); |
|
62 |
||
63 |
// Create navigational state |
|
64 |
iNavigationalState = CGlxNavigationalState::InstanceL(); |
|
65 |
||
66 |
iEnv = &aEnv; |
|
67 |
||
68 |
iDefaultTemplate = aDefaultTemplate; |
|
69 |
||
70 |
iDataWindowSize = aDataWindowSize; |
|
71 |
||
72 |
} |
|
73 |
||
74 |
// ---------------------------------------------------------------------------- |
|
75 |
// Constructor |
|
76 |
// ---------------------------------------------------------------------------- |
|
77 |
// |
|
78 |
CGlxMulModelProviderBase::CGlxMulModelProviderBase( IMulWidget& aWidget ) |
|
79 |
: iWidget( aWidget ),iPreviousFocusIndex(-1) |
|
80 |
{ |
|
81 |
} |
|
82 |
||
83 |
// ---------------------------------------------------------------------------- |
|
84 |
// Destructor |
|
85 |
// ---------------------------------------------------------------------------- |
|
86 |
// |
|
87 |
CGlxMulModelProviderBase::~CGlxMulModelProviderBase() |
|
88 |
{ |
|
89 |
TRACER("CGlxMulModelProviderBase::~CGlxMulModelProviderBase"); |
|
90 |
if(iDrmGifTextureCreator) |
|
91 |
{ |
|
92 |
delete iDrmGifTextureCreator; |
|
93 |
iDrmGifTextureCreator = NULL; |
|
94 |
} |
|
95 |
// remove event handler |
|
96 |
iWidget.RemoveEventHandler( *this ); |
|
97 |
if ( iNavigationalState ) |
|
98 |
{ |
|
99 |
iNavigationalState->Close(); |
|
100 |
} |
|
101 |
} |
|
102 |
||
103 |
// ---------------------------------------------------------------------------- |
|
104 |
// HandleItemAddedL |
|
105 |
// ---------------------------------------------------------------------------- |
|
106 |
// |
|
107 |
void CGlxMulModelProviderBase::HandleItemAddedL( TInt /*aStartIndex*/, TInt |
|
108 |
/*aEndIndex*/, MGlxMediaList* /*aList*/ ) |
|
109 |
{ |
|
110 |
||
111 |
} |
|
112 |
||
113 |
// ---------------------------------------------------------------------------- |
|
114 |
// HandleItemRemoved |
|
115 |
// ---------------------------------------------------------------------------- |
|
116 |
// |
|
117 |
void CGlxMulModelProviderBase::HandleItemRemovedL( TInt /*aStartIndex*/, TInt |
|
118 |
/*aEndIndex*/, MGlxMediaList* /*aList*/ ) |
|
119 |
{ |
|
120 |
||
121 |
} |
|
122 |
||
123 |
// ---------------------------------------------------------------------------- |
|
124 |
// HandleAttributesAvailableL |
|
125 |
// ---------------------------------------------------------------------------- |
|
126 |
// |
|
127 |
void CGlxMulModelProviderBase::HandleAttributesAvailableL( TInt /*aItemIndex*/, |
|
128 |
const RArray<TMPXAttribute>& /*aAttributes*/, MGlxMediaList* /*aList*/ ) |
|
129 |
{ |
|
130 |
||
131 |
} |
|
132 |
||
133 |
// ---------------------------------------------------------------------------- |
|
134 |
// HandleFocusChangedL |
|
135 |
// ---------------------------------------------------------------------------- |
|
136 |
// |
|
137 |
void CGlxMulModelProviderBase::HandleFocusChangedL( NGlxListDefs:: |
|
138 |
TFocusChangeType /*aType*/, TInt /*aNewIndex*/, TInt /*aOldIndex*/, MGlxMediaList* /*aList*/ ) |
|
139 |
{ |
|
140 |
||
141 |
} |
|
142 |
||
143 |
// ---------------------------------------------------------------------------- |
|
144 |
// HandleItemSelected |
|
145 |
// ---------------------------------------------------------------------------- |
|
146 |
// |
|
147 |
void CGlxMulModelProviderBase::HandleItemSelectedL(TInt aIndex, |
|
148 |
TBool aSelected, MGlxMediaList* /*aList*/ ) |
|
149 |
{ |
|
150 |
TRACER("CGlxMulModelProviderBase::HandleItemSelectedL"); |
|
151 |
std::vector<int> itemIndex; |
|
152 |
itemIndex.push_back( aIndex); |
|
153 |
// changed code ---statr |
|
154 |
if(aSelected) |
|
155 |
{ |
|
156 |
iModel->SetMarkedIndices(MulWidgetDef::EMulMark,itemIndex); |
|
157 |
} |
|
158 |
else |
|
159 |
{ |
|
160 |
iModel->SetMarkedIndices(MulWidgetDef::EMulUnmark,itemIndex); |
|
161 |
} |
|
162 |
} |
|
163 |
||
164 |
// ---------------------------------------------------------------------------- |
|
165 |
// accept |
|
166 |
// ---------------------------------------------------------------------------- |
|
167 |
// |
|
168 |
bool CGlxMulModelProviderBase::accept( Alf::CAlfWidgetControl& /*aControl*/, const |
|
169 |
TAlfEvent& /*aEvent*/ ) const |
|
170 |
{ |
|
171 |
TRACER("CGlxMulModelProviderBase::accept"); |
|
172 |
//Need implementation |
|
173 |
return NULL; |
|
174 |
} |
|
175 |
||
176 |
// ---------------------------------------------------------------------------- |
|
177 |
// offerEvent |
|
178 |
// ---------------------------------------------------------------------------- |
|
179 |
// |
|
180 |
AlfEventStatus CGlxMulModelProviderBase::offerEvent( Alf::CAlfWidgetControl& |
|
181 |
/*aControl*/, const TAlfEvent& aEvent ) |
|
182 |
{ |
|
183 |
TRACER("CGlxMulModelProviderBase::offerEvent"); |
|
184 |
AlfEventStatus response = EEventNotHandled; |
|
185 |
if ( aEvent.IsCustomEvent() ) |
|
186 |
{ |
|
187 |
GLX_LOG_INFO1("CGlxMulModelProviderBase::offerEvent() aEvent.CustomParameter(%d)", aEvent.CustomParameter()); |
|
188 |
switch ( aEvent.CustomParameter() ) |
|
189 |
{ |
|
190 |
case KAlfActionIdDeviceLayoutChanged: |
|
191 |
{ |
|
192 |
HandleOrientationChanged(); |
|
193 |
response = EEventNotHandled; |
|
194 |
} |
|
195 |
break; |
|
196 |
case Alf::ETypeHighlight: |
|
197 |
{ |
|
198 |
if ( !iWithinFocusChangeCall ) |
|
199 |
{ |
|
200 |
HandleFocusChanged( FocusIndex(), iPreviousFocusIndex ); |
|
201 |
} |
|
202 |
response = EEventHandled; |
|
203 |
} |
|
204 |
break; |
|
205 |
case Alf::ETypeItemRemoved: |
|
206 |
{ |
|
207 |
GLX_LOG_INFO("CGlxMulModelProviderBase::offerEvent - ETypeItemRemoved!"); |
|
208 |
CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); |
|
209 |
CleanupClosePushL(*uiUtility); |
|
210 |
if (iModel->Count() == 0 && UString(KCoverFlowWidget) |
|
211 |
== UString(iWidget.widgetName()) |
|
212 |
&& iNavigationalState->ViewingMode() |
|
213 |
== NGlxNavigationalState::EView |
|
214 |
&& uiUtility->GetForegroundStatus()) |
|
215 |
{ |
|
216 |
uiUtility->SetViewNavigationDirection( |
|
217 |
EGlxNavigationBackwards); |
|
218 |
||
219 |
iNavigationalState->ActivatePreviousViewL(); |
|
220 |
response = EEventHandled; |
|
221 |
} |
|
222 |
CleanupStack::PopAndDestroy(uiUtility); |
|
223 |
} |
|
224 |
break; |
|
225 |
default: |
|
226 |
break; |
|
227 |
} |
|
228 |
} |
|
229 |
return response; |
|
230 |
} |
|
231 |
||
232 |
// ---------------------------------------------------------------------------- |
|
233 |
// setActiveStates |
|
234 |
// ---------------------------------------------------------------------------- |
|
235 |
// |
|
236 |
void CGlxMulModelProviderBase::setActiveStates( unsigned int /*aStates*/ ) |
|
237 |
{ |
|
238 |
||
239 |
} |
|
240 |
||
241 |
// ---------------------------------------------------------------------------- |
|
242 |
// setEventHandlerData |
|
243 |
// ---------------------------------------------------------------------------- |
|
244 |
// |
|
245 |
void CGlxMulModelProviderBase::setEventHandlerData( const Alf::AlfWidgetEventHandlerInitData& /*aData*/ ) |
|
246 |
{ |
|
247 |
||
248 |
} |
|
249 |
||
250 |
// ---------------------------------------------------------------------------- |
|
251 |
// eventHandlerData |
|
252 |
// ---------------------------------------------------------------------------- |
|
253 |
// |
|
254 |
Alf::AlfWidgetEventHandlerInitData* CGlxMulModelProviderBase::eventHandlerData() |
|
255 |
{ |
|
256 |
TRACER("CGlxMulModelProviderBase::eventHandlerData"); |
|
257 |
return NULL; |
|
258 |
} |
|
259 |
||
260 |
// ---------------------------------------------------------------------------- |
|
261 |
// makeInterface |
|
262 |
// ---------------------------------------------------------------------------- |
|
263 |
// |
|
264 |
Alf::IAlfInterfaceBase* CGlxMulModelProviderBase::makeInterface(const Alf::IfId& /*aType */) |
|
265 |
{ |
|
266 |
TRACER("CGlxMulModelProviderBase::makeInterface"); |
|
267 |
return this; |
|
268 |
} |
|
269 |
||
270 |
// ---------------------------------------------------------------------------- |
|
271 |
// eventHandlerType |
|
272 |
// ---------------------------------------------------------------------------- |
|
273 |
// |
|
274 |
IAlfWidgetEventHandler::AlfEventHandlerType CGlxMulModelProviderBase:: |
|
275 |
eventHandlerType() |
|
276 |
{ |
|
277 |
TRACER("CGlxMulModelProviderBase::eventHandlerType"); |
|
278 |
// To Avoid Compiler warning |
|
279 |
return IAlfWidgetEventHandler::ELogicalEventHandler; |
|
280 |
} |
|
281 |
||
282 |
// ---------------------------------------------------------------------------- |
|
283 |
// eventExecutionPhase |
|
284 |
// ---------------------------------------------------------------------------- |
|
285 |
// |
|
286 |
IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase |
|
287 |
CGlxMulModelProviderBase::eventExecutionPhase() |
|
288 |
{ |
|
289 |
TRACER("CGlxMulModelProviderBase::eventExecutionPhase"); |
|
290 |
return EBubblingPhaseEventHandler; |
|
291 |
} |
|
292 |
||
293 |
// ---------------------------------------------------------------------------- |
|
294 |
// UpdateItemL |
|
295 |
// ---------------------------------------------------------------------------- |
|
296 |
// |
|
297 |
void CGlxMulModelProviderBase::UpdateItems( TInt aIndex, TInt aCount ) |
|
298 |
{ |
|
299 |
TRACER("CGlxMulModelProviderBase::UpdateItems"); |
|
300 |
try |
|
301 |
{ |
|
302 |
iModel->Update( aIndex, aCount ); |
|
303 |
} |
|
304 |
catch (...) |
|
305 |
{ |
|
306 |
throw std::bad_alloc(); |
|
307 |
} |
|
308 |
} |
|
309 |
||
310 |
// ---------------------------------------------------------------------------- |
|
311 |
// SetDataT |
|
312 |
// ---------------------------------------------------------------------------- |
|
313 |
// |
|
314 |
void CGlxMulModelProviderBase::SetDataT( const CGlxBinding& aBinding, |
|
27
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
315 |
const TGlxMedia& aMedia, TInt aAtIndex, MGlxMediaList& aMediaList ) |
26 | 316 |
{ |
317 |
TRACER("CGlxMulModelProviderBase::SetDataT"); |
|
318 |
||
319 |
if(IsFocused(aAtIndex)) |
|
320 |
{ |
|
321 |
TBool drm = EFalse; |
|
322 |
TGlxMediaGeneralRightsValidity isValid = EGlxDrmRightsValidityUnknown; |
|
323 |
if (aMedia.GetDrmProtected(drm)) |
|
324 |
{ |
|
325 |
aMedia.GetDrmValidity(isValid); |
|
326 |
GLX_DEBUG2("CGlxMulModelProviderBase::SetDataT DrmValidity(%d)", isValid); |
|
327 |
} |
|
328 |
TInt frameCount; |
|
329 |
aMedia.GetFrameCount(frameCount); |
|
330 |
GLX_DEBUG2("CGlxMulModelProviderBase::SetDataT framecount=%d", frameCount); |
|
331 |
//Create the DRM gif texture intance only if the DRM gif image is |
|
332 |
//valid and focused |
|
333 |
if (frameCount > 1 && drm && isValid == EGlxDrmRightsValid) |
|
334 |
{ |
|
335 |
if (!iDrmGifTextureCreator) |
|
336 |
{ |
|
337 |
iDrmGifTextureCreator = CGlxDrmGifTextureCreator::NewL( |
|
27
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
338 |
aBinding, aMedia, aAtIndex, iModel, aMediaList); |
26 | 339 |
} |
340 |
else |
|
341 |
{ |
|
342 |
iDrmGifTextureCreator->UpdateNewImageL(aMedia, aAtIndex); |
|
343 |
} |
|
344 |
} |
|
345 |
else |
|
346 |
{ |
|
347 |
//if the focus is changed then delete the DRMGifTextureCreator |
|
348 |
//instance if any |
|
349 |
if (iDrmGifTextureCreator) |
|
350 |
{ |
|
351 |
delete iDrmGifTextureCreator; |
|
352 |
iDrmGifTextureCreator = NULL; |
|
353 |
} |
|
354 |
iModel->SetData(aAtIndex, CreateItemT(aBinding, aMedia, |
|
355 |
IsFocused(aAtIndex))); |
|
356 |
} |
|
357 |
} |
|
358 |
else |
|
359 |
{ |
|
360 |
iModel->SetData( aAtIndex, CreateItemT( aBinding, aMedia, |
|
361 |
IsFocused( aAtIndex ) ) ); |
|
362 |
} |
|
363 |
} |
|
364 |
||
365 |
// ---------------------------------------------------------------------------- |
|
366 |
// CreateItemT |
|
367 |
// ---------------------------------------------------------------------------- |
|
368 |
// |
|
369 |
auto_ptr<MulVisualItem> CGlxMulModelProviderBase::CreateItemT( |
|
370 |
const CGlxBinding& aBinding, const TGlxMedia& aMedia, TBool aIsFocused ) |
|
371 |
{ |
|
372 |
TRACER("CGlxMulModelProviderBase::CreateItemT"); |
|
373 |
auto_ptr<MulVisualItem> item( new ( EMM ) MulVisualItem() ); |
|
374 |
aBinding.PopulateT( *item, aMedia, aIsFocused ); |
|
375 |
return item; |
|
376 |
} |
|
377 |
// ---------------------------------------------------------------------------- |
|
378 |
// CreateModelL |
|
379 |
// ---------------------------------------------------------------------------- |
|
380 |
// |
|
381 |
||
382 |
void CGlxMulModelProviderBase::CreateModelL() |
|
383 |
{ |
|
384 |
||
385 |
const char* KLoadNameModel( "mulmodel" ); |
|
386 |
try |
|
387 |
{ |
|
388 |
||
389 |
IAlfWidgetFactory& widgetFactory = AlfWidgetEnvExtension::widgetFactory(*iEnv); |
|
390 |
||
391 |
std::auto_ptr< Alf::IMulModel > model( |
|
392 |
widgetFactory.createModel< IMulModel >( KLoadNameModel ) ); |
|
393 |
iModel = model.release(); |
|
394 |
if( iDataWindowSize > 0 ) |
|
395 |
{ |
|
396 |
iModel->SetDataWindow(iDataWindowSize); |
|
397 |
} |
|
398 |
iModel->SetDataProvider( *this ); |
|
399 |
iModel->SetTemplate( iDefaultTemplate ); |
|
400 |
} |
|
401 |
catch (...) |
|
402 |
{ |
|
403 |
User::Leave( KErrNoMemory ); |
|
404 |
} |
|
405 |
} |
|
406 |
// ---------------------------------------------------------------------------- |
|
407 |
// InsertItemsL |
|
408 |
// ---------------------------------------------------------------------------- |
|
409 |
// |
|
410 |
||
411 |
void CGlxMulModelProviderBase::InsertItemsL( TInt aIndex, TInt aCount, TInt aMediaListFocusIndex ) |
|
412 |
{ |
|
413 |
TRACER("CGlxMulModelProviderBase::InsertItemsL"); |
|
414 |
// The order of calling should be Model->Insert(..), |
|
415 |
// Model->SetHighlight(..) and Widget.SetModel(..) |
|
416 |
// Change the order once bug EPBA-7JRDXV ( SetModel Crashes if highlight |
|
417 |
// index is set >0 before setting model. )is fixed. |
|
418 |
if(!iWidget.model()) |
|
419 |
{ |
|
420 |
CreateModelL(); |
|
421 |
} |
|
422 |
||
423 |
if(iWidget.model()) |
|
424 |
{ |
|
425 |
iModel->SetTemplate( iDefaultTemplate ); |
|
426 |
} |
|
427 |
||
428 |
iModel->Insert( aIndex, aCount ); |
|
429 |
||
430 |
if( aMediaListFocusIndex >= 0 ) |
|
431 |
{ |
|
432 |
SetFocusIndex( aMediaListFocusIndex ); |
|
433 |
} |
|
434 |
||
435 |
if(!iWidget.model()) |
|
436 |
{ |
|
437 |
iWidget.SetModel( iModel->Accessor() ); |
|
438 |
||
439 |
CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); |
|
440 |
CleanupClosePushL( *uiUtility ); |
|
441 |
TSize defaultIconSize = uiUtility->GetGridIconSize(); |
|
442 |
TFileName resFile(KDC_APP_BITMAP_DIR); |
|
443 |
resFile.Append(KGlxIconsFilename); |
|
444 |
TInt defaultTextureId = uiUtility-> |
|
445 |
GlxTextureManager().CreateIconTextureL( |
|
446 |
EMbmGlxiconsQgn_prop_image_notcreated, resFile, |
|
447 |
defaultIconSize ).Id(); |
|
448 |
||
449 |
static_cast<IMulCoverFlowWidget&>(iWidget).SetDefaultImage( defaultTextureId ) ; |
|
450 |
CleanupStack::PopAndDestroy( uiUtility ); |
|
451 |
} |
|
452 |
||
453 |
} |
|
454 |
||
455 |
// ---------------------------------------------------------------------------- |
|
456 |
// RemoveItem |
|
457 |
// ---------------------------------------------------------------------------- |
|
458 |
// |
|
459 |
void CGlxMulModelProviderBase::RemoveItems( TInt aIndex, TInt aCount ) |
|
460 |
{ |
|
461 |
TRACER("CGlxMulModelProviderBase::RemoveItems"); |
|
462 |
// RemoveItems does not throw according to model documentation |
|
463 |
GLX_LOG_INFO2("CGlxMulModelProviderBase::RemoveItems() aIndex(%d), aCount(%d)", aIndex, aCount); |
|
464 |
iModel->Remove( aIndex, aCount ); |
|
465 |
} |
|
466 |
||
467 |
// ---------------------------------------------------------------------------- |
|
468 |
// SetFocusIndex |
|
469 |
// ---------------------------------------------------------------------------- |
|
470 |
// |
|
471 |
void CGlxMulModelProviderBase::SetFocusIndex( TInt aIndex ) |
|
472 |
{ |
|
473 |
TRACER("CGlxMulModelProviderBase::SetFocusIndex"); |
|
474 |
iModel->SetHighlight( aIndex ); |
|
475 |
} |
|
476 |
// ---------------------------------------------------------------------------- |
|
477 |
// IsFocused |
|
478 |
// ---------------------------------------------------------------------------- |
|
479 |
// |
|
480 |
||
481 |
TBool CGlxMulModelProviderBase::IsFocused( TInt aIndex ) const |
|
482 |
{ |
|
483 |
TRACER("CGlxMulModelProviderBase::IsFocused"); |
|
484 |
return aIndex == FocusIndex() && aIndex != LAST_INDEX; |
|
485 |
} |
|
486 |
||
487 |
||
488 |
||
489 |
// ---------------------------------------------------------------------------- |
|
490 |
// FocusIndex |
|
491 |
// ---------------------------------------------------------------------------- |
|
492 |
// |
|
493 |
||
494 |
TInt CGlxMulModelProviderBase::FocusIndex() const |
|
495 |
{ |
|
496 |
TRACER("CGlxMulModelProviderBase::FocusIndex"); |
|
497 |
TInt index = 0; |
|
498 |
/// @todo use multiline widget instead of this widget hack. Currently model does not have interface for highlight. |
|
499 |
||
500 |
// We are comparing depending on teh widget name which we are setting during the |
|
501 |
// widget creation, but for that we had to do dynamic_cast which fails on hardware |
|
502 |
// and is not the preffered way of doing, so as of now we have to check using widget name |
|
503 |
||
504 |
if(UString(KListWidget) == UString(iWidget.widgetName() ) ) |
|
505 |
{ |
|
506 |
index = iModel->Highlight(); |
|
507 |
} |
|
508 |
else if ( UString(KGridWidget) == UString(iWidget.widgetName() ) ) |
|
509 |
{ |
|
510 |
index = iModel->Highlight(); |
|
511 |
} |
|
512 |
else if (UString(KCoverFlowWidget) == UString(iWidget.widgetName() ) ) |
|
513 |
{ |
|
514 |
index = iModel->Highlight(); |
|
515 |
} |
|
516 |
else |
|
517 |
{ |
|
518 |
return KErrGeneral; |
|
519 |
} |
|
520 |
||
521 |
return index; |
|
522 |
} |
|
523 |
||
524 |
// ---------------------------------------------------------------------------- |
|
525 |
// HandleMessageL |
|
526 |
// ---------------------------------------------------------------------------- |
|
527 |
// |
|
528 |
void CGlxMulModelProviderBase::HandleMessageL( const CMPXMessage& /*aMessage*/, |
|
529 |
MGlxMediaList* /*aList*/ ) |
|
530 |
{ |
|
531 |
||
532 |
} |
|
533 |
||
534 |
// ---------------------------------------------------------------------------- |
|
535 |
// HandleError |
|
536 |
// ---------------------------------------------------------------------------- |
|
537 |
// |
|
538 |
void CGlxMulModelProviderBase::HandleError( TInt /*aError*/ ) |
|
539 |
{ |
|
540 |
||
541 |
} |
|
542 |
||
543 |
// ---------------------------------------------------------------------------- |
|
544 |
// HandleCommandCompleteL |
|
545 |
// ---------------------------------------------------------------------------- |
|
546 |
// |
|
547 |
void CGlxMulModelProviderBase::HandleCommandCompleteL( TAny* /*aSessionId*/, CMPXCommand* /*aCommandResult*/, |
|
548 |
TInt /*aError*/, MGlxMediaList* /*aList*/ ) |
|
549 |
{ |
|
550 |
||
551 |
} |
|
552 |
||
553 |
// ---------------------------------------------------------------------------- |
|
554 |
// HandleMediaL |
|
555 |
// ---------------------------------------------------------------------------- |
|
556 |
// |
|
557 |
void CGlxMulModelProviderBase::HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ ) |
|
558 |
{ |
|
559 |
||
560 |
} |
|
561 |
||
562 |
// ---------------------------------------------------------------------------- |
|
563 |
// HandleItemModifiedL |
|
564 |
// ---------------------------------------------------------------------------- |
|
565 |
// |
|
566 |
void CGlxMulModelProviderBase::HandleItemModifiedL( const RArray<TInt>& /*aItemIndexes*/, |
|
567 |
MGlxMediaList* /*aList*/ ) |
|
568 |
{ |
|
569 |
||
570 |
} |
|
571 |
||
572 |
// ---------------------------------------------------------------------------- |
|
573 |
// HandleFocusChanged |
|
574 |
// ---------------------------------------------------------------------------- |
|
575 |
// |
|
576 |
//@todo: Implementation to be done later depending on the scenario |
|
577 |
void CGlxMulModelProviderBase::HandleFocusChanged( TInt /*aNewFocusIndex*/, |
|
578 |
TInt /*aPreviousFocusIndex*/ ) |
|
579 |
{ |
|
580 |
// default implementation empty |
|
581 |
} |
|
582 |
||
583 |
||
584 |
||
585 |
// ---------------------------------------------------------------------------- |
|
586 |
// BoundCommand |
|
587 |
// ---------------------------------------------------------------------------- |
|
588 |
// |
|
589 |
MGlxBoundCommand* CGlxMulModelProviderBase::BoundCommand( TInt aVisualItemIndex ) const |
|
590 |
{ |
|
591 |
TRACER("CGlxMulModelProviderBase::BoundCommand"); |
|
592 |
if ( iModel->Count() > 0 ) |
|
593 |
{ |
|
594 |
return GlxCommandBindingUtility::Get( Item( aVisualItemIndex ) ); |
|
595 |
} |
|
596 |
return NULL; |
|
597 |
} |
|
598 |
||
599 |
// ---------------------------------------------------------------------------- |
|
600 |
// Item |
|
601 |
// ---------------------------------------------------------------------------- |
|
602 |
// |
|
603 |
const Alf::MulVisualItem& CGlxMulModelProviderBase::Item( TInt aIndex ) const |
|
604 |
{ |
|
605 |
TRACER("CGlxMulModelProviderBase::Item"); |
|
606 |
ASSERT( aIndex >= 0 && aIndex < iModel->Count() ); |
|
607 |
return *(iModel->Data( aIndex )); |
|
608 |
} |
|
609 |
||
610 |
//----------------------------------------------------------------------------- |
|
611 |
// HandleResolutionChanged |
|
612 |
//----------------------------------------------------------------------------- |
|
613 |
// |
|
614 |
void CGlxMulModelProviderBase::HandleOrientationChanged() |
|
615 |
{ |
|
616 |
||
617 |
} |
|
618 |
||
619 |
//----------------------------------------------------------------------------- |
|
620 |
// HandleResolutionChanged |
|
621 |
//----------------------------------------------------------------------------- |
|
622 |
// |
|
623 |
void CGlxMulModelProviderBase::AddWidgetEventHandler() |
|
624 |
{ |
|
625 |
iWidget.AddEventHandler( *this ); |
|
626 |
} |
|
627 |
||
628 |
//----------------------------------------------------------------------------- |
|
629 |
// AnimateDRMGifItem |
|
630 |
//----------------------------------------------------------------------------- |
|
631 |
// |
|
632 |
void CGlxMulModelProviderBase::AnimateDRMGifItem( TBool aAnimate ) |
|
633 |
{ |
|
634 |
TRACER("CGlxMulModelProviderBase::AnimateDRMGifItem"); |
|
635 |
if(iDrmGifTextureCreator) |
|
636 |
{ |
|
637 |
iDrmGifTextureCreator->AnimateDRMGifItem(aAnimate); |
|
638 |
} |
|
639 |
} |
|
640 |
//EOF |