author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 21:19:17 +0300 | |
branch | RCL_3 |
changeset 64 | 34937ec34dac |
parent 60 | 5b3385a43d68 |
child 75 | 01504893d9cb |
permissions | -rw-r--r-- |
60 | 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: Slideshow command handler |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
#include "glxcommandhandlerslideshow.h" |
|
22 |
||
23 |
#include <data_caging_path_literals.hrh> |
|
24 |
#include <mpxcollectionpath.h> |
|
25 |
#include <mpxmediadrmdefs.h> // for KMPXMediaDrmProtected |
|
26 |
#include <mpxviewutility.h> |
|
27 |
#include <aknViewAppUi.h> |
|
28 |
||
29 |
#include <glxuiutilities.rsg> |
|
30 |
#include <mglxmedialist.h> |
|
31 |
#include <glxuistd.h> |
|
32 |
#include <glxcommandhandlers.hrh> |
|
33 |
#include <glxresourceutilities.h> // for CGlxResourceUtilities |
|
34 |
#include <glxattributecontext.h> // for CGlxAttributeContext |
|
35 |
#include <glxmedia.h> // for TGlxMedia |
|
36 |
#include <StringLoader.h> // for stringloader |
|
37 |
#include <glxlog.h> |
|
38 |
#include <glxtracer.h> |
|
39 |
||
40 |
#include "shwslideshowviewplugin.hrh" // for the slideshow view's UID |
|
41 |
#include "shwslideshowsettingsplugin_UID.hrh"// for slideshow setting dlg UID |
|
42 |
#include "glxuiutility.h" |
|
43 |
#include "glxscreenfurniture.h" |
|
44 |
#include <glxicons.mbg> |
|
45 |
#include <glxsetappstate.h> // set PCFW app state |
|
46 |
#include <glxsettingsmodel.h> |
|
47 |
#include <glxupnprenderer.h> // get UPnP state |
|
48 |
#include <glxgeneraluiutilities.h> |
|
64
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
49 |
#include <glxthumbnailattributeinfo.h> |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
50 |
|
60 | 51 |
namespace |
52 |
{ |
|
53 |
const TInt KShwDefaultBufferSize = 128; |
|
54 |
} |
|
55 |
||
56 |
// --------------------------------------------------------------------------- |
|
57 |
// Two-phased constructor. |
|
58 |
// --------------------------------------------------------------------------- |
|
59 |
// |
|
60 |
EXPORT_C CGlxCommandHandlerSlideshow* CGlxCommandHandlerSlideshow::NewL( |
|
61 |
MGlxMediaListProvider* aMediaListProvider, TBool aStepBack, |
|
62 |
TBool aHasToolbarItem, const TDesC& aFileName) |
|
63 |
{ |
|
64 |
TRACER( "CGlxCommandHandlerSlideshow::NewL" ); |
|
65 |
CGlxCommandHandlerSlideshow* self = |
|
66 |
new (ELeave) CGlxCommandHandlerSlideshow(aMediaListProvider, |
|
67 |
aStepBack, aHasToolbarItem); |
|
68 |
CleanupStack::PushL(self); |
|
69 |
self->ConstructL(aFileName); |
|
70 |
CleanupStack::Pop(self); |
|
71 |
return self; |
|
72 |
} |
|
73 |
||
74 |
// --------------------------------------------------------------------------- |
|
75 |
// C++ default constructor can NOT contain any code, that |
|
76 |
// might leave. |
|
77 |
// --------------------------------------------------------------------------- |
|
78 |
// |
|
79 |
CGlxCommandHandlerSlideshow::CGlxCommandHandlerSlideshow( MGlxMediaListProvider* |
|
80 |
aMediaListProvider, TBool aStepBack, TBool aHasToolbarItem ) |
|
81 |
: CGlxMediaListCommandHandler(aMediaListProvider, aHasToolbarItem), iStepBack(aStepBack) |
|
82 |
{ |
|
83 |
// Do nothing |
|
84 |
} |
|
85 |
||
86 |
||
87 |
// --------------------------------------------------------------------------- |
|
88 |
// Symbian 2nd phase constructor can leave. |
|
89 |
// --------------------------------------------------------------------------- |
|
90 |
// |
|
91 |
void CGlxCommandHandlerSlideshow::ConstructL(const TDesC& aFileName) |
|
92 |
{ |
|
93 |
TRACER( "CGlxCommandHandlerSlideshow::ConstructL" ); |
|
94 |
||
95 |
// Get a handle |
|
96 |
iUiUtility = CGlxUiUtility::UtilityL(); |
|
97 |
||
98 |
iResourceOffset = CCoeEnv::Static()->AddResourceFileL(aFileName); |
|
99 |
||
100 |
iShowInToolbar = ETrue; |
|
101 |
||
102 |
// Add supported commands with filter fields |
|
103 |
// Play slideshow forwards |
|
104 |
TCommandInfo info(EGlxCmdSlideshowPlay); |
|
105 |
// Disable for static items and dont enable empty slideshow |
|
106 |
info.iMinSelectionLength = 1; |
|
107 |
// Enable only for albums that have more than one item |
|
108 |
info.iMinSlideshowPlayableContainedItemCount = 1; |
|
109 |
// Disable for animated GIFs |
|
110 |
info.iDisallowAnimatedGIFs = ETrue; |
|
111 |
// Disable DRM protected content |
|
112 |
info.iDisallowDRM = ETrue; |
|
113 |
// Note: cannot just require all to be images as user can also start |
|
114 |
// slideshow for a whole album from list view and in that case |
|
115 |
// selection contains a container |
|
116 |
// Disable all videos |
|
117 |
TMPXGeneralCategory categoryFilter = EMPXVideo; |
|
118 |
// Disable the command for videos |
|
119 |
TCommandInfo::TCategoryRule categoryRule = TCommandInfo::EForbidAll; |
|
120 |
info.iCategoryFilter = categoryFilter; |
|
121 |
info.iCategoryRule = categoryRule; |
|
122 |
AddCommandL(info); |
|
123 |
||
124 |
// new info to get the default filters |
|
125 |
TCommandInfo info_show_always(EGlxCmdSlideshowSettings); |
|
126 |
// Disable for empty views and views with only static items |
|
127 |
info_show_always.iMinSelectionLength = 1; |
|
128 |
// slideshow settings |
|
129 |
AddCommandL(info_show_always); |
|
130 |
||
131 |
// Menu |
|
132 |
info_show_always.iCommandId = EGlxCmdSlideshow; |
|
133 |
AddCommandL(info_show_always); |
|
134 |
||
135 |
// Dummy command to get UPnP state |
|
136 |
TCommandInfo infoUpnpState(EGlxCmdShowViaUpnpStateChanged); |
|
137 |
AddCommandL(infoUpnpState); |
|
138 |
||
139 |
// Buffer |
|
140 |
iBufFlat = CBufFlat::NewL(KShwDefaultBufferSize); |
|
141 |
} |
|
142 |
||
143 |
// --------------------------------------------------------------------------- |
|
144 |
// Destructor |
|
145 |
// --------------------------------------------------------------------------- |
|
146 |
// |
|
147 |
EXPORT_C CGlxCommandHandlerSlideshow::~CGlxCommandHandlerSlideshow() |
|
148 |
{ |
|
149 |
TRACER( "CGlxCommandHandlerSlideshow::~CGlxCommandHandlerSlideshow" ); |
|
150 |
if ( iResourceOffset ) |
|
151 |
{ |
|
152 |
CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); |
|
153 |
} |
|
154 |
||
155 |
if (iUiUtility) |
|
156 |
{ |
|
157 |
iUiUtility->Close(); |
|
158 |
} |
|
159 |
||
160 |
delete iBufFlat; |
|
161 |
delete iBuffer; |
|
162 |
} |
|
163 |
||
164 |
// --------------------------------------------------------------------------- |
|
165 |
// DoActivateL |
|
166 |
// --------------------------------------------------------------------------- |
|
167 |
// |
|
168 |
void CGlxCommandHandlerSlideshow::DoActivateL(TInt aViewId) |
|
169 |
{ |
|
170 |
TRACER( "CGlxCommandHandlerSlideshow::DoActivateL" ); |
|
171 |
iViewId = aViewId; |
|
172 |
||
173 |
// for media list item "focus changed" notification |
|
174 |
MGlxMediaList& mediaList( MediaList() ); |
|
175 |
mediaList.AddMediaListObserverL( this ); |
|
176 |
} |
|
177 |
||
178 |
||
179 |
// ---------------------------------------------------------------------------- |
|
180 |
// Deactivate |
|
181 |
// ---------------------------------------------------------------------------- |
|
182 |
void CGlxCommandHandlerSlideshow::Deactivate() |
|
183 |
{ |
|
184 |
TRACER( "CGlxCommandHandlerSlideshow::Deactivate" ); |
|
185 |
||
186 |
MGlxMediaList& mediaList( MediaList() ); |
|
187 |
mediaList.RemoveMediaListObserver( this ); |
|
188 |
} |
|
189 |
||
190 |
// ---------------------------------------------------------------------------- |
|
191 |
// IsSlideshowPlayableOnFocusedContainer |
|
192 |
// ---------------------------------------------------------------------------- |
|
193 |
// |
|
194 |
TBool CGlxCommandHandlerSlideshow::IsSlideshowNotPlayableOnFocusedContainer |
|
195 |
(TInt aCommandId, MGlxMediaList& aList) |
|
196 |
{ |
|
197 |
TRACER("CGlxCommandHandlerSlideshow::IsSlideshowNotPlayableOnFocusedContainer"); |
|
198 |
TBool slideshowDisabled = EFalse; |
|
199 |
||
200 |
// get the media item |
|
201 |
const TGlxMedia& item = aList.Item( aList.FocusIndex() ); |
|
202 |
const TCommandInfo& info = CommandInfo(aCommandId); |
|
203 |
||
204 |
// Check minimum item count if not yet disabled by previous rules |
|
205 |
TInt count(0); |
|
206 |
||
207 |
if( (info.iMinSlideshowPlayableContainedItemCount )&& |
|
208 |
( item.GetSlideshowPlayableContainedItemCount(count) ) ) |
|
209 |
{ |
|
210 |
// disable if less than required amount of items in container |
|
211 |
// (ignore non-containers, i.e. -1) |
|
212 |
if( count != -1 ) |
|
213 |
{ |
|
214 |
slideshowDisabled = ( count < info.iMinSlideshowPlayableContainedItemCount ); |
|
215 |
} |
|
216 |
} |
|
217 |
return slideshowDisabled; |
|
218 |
} |
|
219 |
||
220 |
// ----------------------------------------------------------------------------- |
|
221 |
// DoExecute - the relevant action for the command id |
|
222 |
// ----------------------------------------------------------------------------- |
|
223 |
// |
|
224 |
TBool CGlxCommandHandlerSlideshow::DoExecuteL(TInt aCommandId, |
|
225 |
MGlxMediaList& aList ) |
|
226 |
{ |
|
227 |
TRACER( "CGlxCommandHandlerSlideshow::DoExecuteL" ); |
|
228 |
TBool handledCommand = ETrue; |
|
229 |
||
230 |
switch (aCommandId) |
|
231 |
{ |
|
232 |
case EGlxCmdSlideshowPlay: |
|
233 |
{ |
|
234 |
// This check has to be done again here since Slideshow can be |
|
235 |
// activated from toolbar even when there are non-slideshow playable |
|
236 |
// items in a container and when that container is focused. |
|
237 |
if( aList.Count() <= 0 || IsSlideshowNotPlayableOnFocusedContainer( aCommandId, aList ) ) |
|
238 |
{ |
|
239 |
HBufC* popupText = NULL; |
|
240 |
||
241 |
//Load the "No Images to Play Slideshow" string from the resource file |
|
242 |
popupText = StringLoader::LoadLC( R_GLX_NO_IMAGES_TO_PLAY_SLIDESHOW ); |
|
243 |
||
244 |
// Show the Info Note. |
|
245 |
GlxGeneralUiUtilities::ShowInfoNoteL( popupText->Des(), EFalse ); |
|
246 |
||
247 |
// LoadLC will push text on to cleanupstack, |
|
248 |
// hence it should be poped and destroyed |
|
249 |
CleanupStack::PopAndDestroy( popupText ); |
|
250 |
} |
|
251 |
else |
|
252 |
{ |
|
253 |
// Activate the slideshow view to play forwards |
|
254 |
ActivateViewL( NShwSlideshow::EPlayForwards ); |
|
255 |
||
256 |
// set PCFW app state |
|
257 |
GlxSetAppState::SetState(EGlxInSlideshowView); |
|
258 |
} |
|
259 |
break; |
|
260 |
} |
|
261 |
/* case EGlxCmdSlideshowPlayBackwards: |
|
262 |
{ |
|
263 |
// Activate the slideshow view to play backwards |
|
264 |
ActivateViewL( NShwSlideshow::EPlayBackwards ); |
|
265 |
||
266 |
// set PCFW app state |
|
267 |
GlxSetAppState::SetState(EGlxInSlideshowView); |
|
268 |
||
269 |
break; |
|
270 |
} */ |
|
271 |
case EGlxCmdSlideshowSettings: |
|
272 |
{ |
|
273 |
// In order for the Settings Dialogs Akn StatusPane to become |
|
274 |
// visible the the Hui display should be deactivated & activated |
|
275 |
// before & after the Settings Dialog (which is uses the Akn |
|
276 |
// framework) is activated & deactivated respectively. |
|
277 |
// Activating and deactivating the HUI within the Settings |
|
278 |
// Dialog class will cause a Cone 8 panic. |
|
279 |
||
280 |
iAvkonAppUi->ProcessCommandL(EGlxCmdDialogLaunched); |
|
281 |
||
282 |
// hide HUI display |
|
283 |
CGlxUiUtility::HideAlfDisplayL(); |
|
284 |
{ |
|
285 |
MMPXViewUtility* viewUtility = MMPXViewUtility::UtilityL(); |
|
286 |
CleanupClosePushL(*viewUtility); |
|
287 |
||
288 |
// Activate the slideshow settings dialog |
|
289 |
viewUtility->ActivateViewL( |
|
290 |
TUid::Uid(KShwSettingsDlgImplementationUid)); |
|
291 |
||
292 |
CleanupStack::PopAndDestroy(viewUtility); |
|
293 |
} |
|
294 |
// show HUI display |
|
295 |
CGlxUiUtility::ShowAlfDisplayL(); |
|
296 |
iAvkonAppUi->ProcessCommandL(EGlxCmdResetView); |
|
297 |
break; |
|
298 |
} |
|
299 |
case EGlxCmdShowViaUpnpStateChanged: |
|
300 |
{ |
|
301 |
handledCommand = EFalse; |
|
302 |
break; |
|
303 |
} |
|
304 |
default: |
|
305 |
{ |
|
306 |
handledCommand = EFalse; |
|
307 |
break; |
|
308 |
} |
|
309 |
} |
|
310 |
||
311 |
return handledCommand; |
|
312 |
} |
|
313 |
||
314 |
// ----------------------------------------------------------------------------- |
|
315 |
// DoIsDisabled |
|
316 |
// ----------------------------------------------------------------------------- |
|
317 |
// |
|
318 |
TBool CGlxCommandHandlerSlideshow::DoIsDisabled( |
|
319 |
TInt /*aCommandId*/, MGlxMediaList& /*aList*/) const |
|
320 |
{ |
|
321 |
TRACER("CGlxCommandHandlerSlideshow::DoIsDisabled"); |
|
322 |
// Disable if UPnP is active |
|
323 |
return ( GlxUpnpRenderer::Status() == NGlxUpnpRenderer::EActive ); |
|
324 |
} |
|
325 |
||
326 |
// ----------------------------------------------------------------------------- |
|
327 |
// BypassFiltersForExecute |
|
328 |
// ----------------------------------------------------------------------------- |
|
329 |
// |
|
330 |
TBool CGlxCommandHandlerSlideshow::BypassFiltersForExecute() const |
|
331 |
{ |
|
332 |
TRACER("CGlxCommandHandlerSlideshow::BypassFiltersForExecute"); |
|
333 |
// Always bypass filters to minimise the time spent by the base class |
|
334 |
// when it initialises the slideshow menu item. |
|
335 |
return ETrue; |
|
336 |
} |
|
337 |
||
338 |
// ---------------------------------------------------------------------------- |
|
339 |
// HandleFocusChangedL |
|
340 |
// ---------------------------------------------------------------------------- |
|
341 |
void CGlxCommandHandlerSlideshow::HandleFocusChangedL( |
|
342 |
NGlxListDefs::TFocusChangeType /*aType*/, |
|
343 |
TInt /*aNewIndex*/, TInt /*aOldIndex*/, MGlxMediaList* aList) |
|
344 |
{ |
|
345 |
TRACER("CGlxCommandHandlerSlideshow::HandleFocusChangedL"); |
|
346 |
// Check if toolbar is available. |
|
347 |
CAknToolbar* toolbar = iUiUtility->GetGridToolBar(); |
|
348 |
if (aList->Count() <= 0 && toolbar) |
|
349 |
{ |
|
350 |
toolbar->SetItemDimmed(EGlxCmdSlideshowPlay, ETrue, ETrue); |
|
351 |
} |
|
352 |
} |
|
353 |
||
354 |
// --------------------------------------------------------------------------- |
|
355 |
// HandleItemAddedL |
|
356 |
// --------------------------------------------------------------------------- |
|
357 |
// |
|
358 |
void CGlxCommandHandlerSlideshow::HandleItemAddedL(TInt /*aStartIndex*/, |
|
359 |
TInt /*aEndIndex*/, MGlxMediaList* aList) |
|
360 |
{ |
|
361 |
TRACER("CGlxCommandHandlerSlideshow::HandleItemAddedL"); |
|
362 |
// Check if toolbar is available. |
|
363 |
CAknToolbar* toolbar = iUiUtility->GetGridToolBar(); |
|
364 |
if (aList->Count() > 0 && toolbar) |
|
365 |
{ |
|
366 |
toolbar->SetItemDimmed(EGlxCmdSlideshowPlay, EFalse, ETrue); |
|
367 |
} |
|
368 |
} |
|
369 |
||
370 |
// --------------------------------------------------------------------------- |
|
371 |
// HandleMediaL |
|
372 |
// --------------------------------------------------------------------------- |
|
373 |
// |
|
374 |
void CGlxCommandHandlerSlideshow::HandleMediaL(TInt /*aListIndex*/, |
|
375 |
MGlxMediaList* /*aList*/) |
|
376 |
{ |
|
377 |
} |
|
378 |
||
379 |
// --------------------------------------------------------------------------- |
|
380 |
// HandleItemRemovedL |
|
381 |
// --------------------------------------------------------------------------- |
|
382 |
// |
|
383 |
void CGlxCommandHandlerSlideshow::HandleItemRemovedL(TInt /*aStartIndex*/, |
|
384 |
TInt /*aEndIndex*/, MGlxMediaList* aList) |
|
385 |
{ |
|
386 |
TRACER("CGlxCommandHandlerSlideshow::HandleItemRemovedL"); |
|
387 |
// Check if toolbar is available. |
|
388 |
CAknToolbar* toolbar = iUiUtility->GetGridToolBar(); |
|
389 |
if (aList->Count() <= 0 && toolbar) |
|
390 |
{ |
|
391 |
toolbar->SetItemDimmed(EGlxCmdSlideshowPlay, ETrue, ETrue); |
|
392 |
} |
|
393 |
} |
|
394 |
||
395 |
// --------------------------------------------------------------------------- |
|
396 |
// HandleItemModifiedL |
|
397 |
// --------------------------------------------------------------------------- |
|
398 |
// |
|
399 |
void CGlxCommandHandlerSlideshow::HandleItemModifiedL( |
|
400 |
const RArray<TInt>& /*aItemIndexes*/, MGlxMediaList* /*aList*/) |
|
401 |
{ |
|
402 |
} |
|
403 |
||
404 |
// --------------------------------------------------------------------------- |
|
405 |
// HandleAttributesAvailableL |
|
406 |
// --------------------------------------------------------------------------- |
|
407 |
// |
|
408 |
void CGlxCommandHandlerSlideshow::HandleAttributesAvailableL( |
|
409 |
TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes, |
|
410 |
MGlxMediaList* /*aList*/ ) |
|
411 |
{ |
|
412 |
TRACER("CGlxCommandHandlerSlideshow::HandleAttributesAvailableL"); |
|
413 |
if ( iShowInToolbar && MediaList().FocusIndex() == aItemIndex ) |
|
414 |
{ |
|
415 |
TIdentityRelation<TMPXAttribute> match( TMPXAttribute::MatchContentId ); |
|
416 |
||
417 |
if ( aAttributes.Find( KMPXMediaGeneralCategory, match ) >= 0 |
|
418 |
|| aAttributes.Find( KMPXMediaDrmProtected, match ) >= 0 |
|
419 |
|| aAttributes.Find( KGlxMediaGeneralFramecount, match ) >= 0 ) |
|
420 |
{ |
|
421 |
UpdateToolbar(); |
|
422 |
} |
|
423 |
} |
|
424 |
} |
|
425 |
||
426 |
// --------------------------------------------------------------------------- |
|
427 |
// HandleItemSelectedL |
|
428 |
// --------------------------------------------------------------------------- |
|
429 |
// |
|
430 |
void CGlxCommandHandlerSlideshow::HandleItemSelectedL(TInt /*aIndex*/, |
|
431 |
TBool /*aSelected*/, MGlxMediaList* /*aList*/) |
|
432 |
{ |
|
433 |
} |
|
434 |
||
435 |
// --------------------------------------------------------------------------- |
|
436 |
// HandleMessageL |
|
437 |
// --------------------------------------------------------------------------- |
|
438 |
// |
|
439 |
void CGlxCommandHandlerSlideshow::HandleMessageL( |
|
440 |
const CMPXMessage& /*aMessage*/, MGlxMediaList* /*aList*/) |
|
441 |
{ |
|
442 |
} |
|
443 |
||
444 |
// ----------------------------------------------------------------------------- |
|
445 |
// ActivateViewL - launch the view |
|
446 |
// ----------------------------------------------------------------------------- |
|
447 |
// |
|
448 |
void CGlxCommandHandlerSlideshow::ActivateViewL( NShwSlideshow::TPlayDirection |
|
449 |
aPlaybackDirection ) |
|
450 |
{ |
|
451 |
TRACER( "CGlxCommandHandlerSlideshow::ActivateViewL" ); |
|
452 |
||
453 |
// Determine the path from the media list |
|
454 |
CMPXCollectionPath* path = MediaList().PathLC(); |
|
455 |
// Ensure the path's at the correct level for the view |
|
456 |
if ( iStepBack && path->Levels() > 0 ) |
|
457 |
{ |
|
458 |
path->Back(); |
|
459 |
} |
|
460 |
// Stream the data buffer |
|
461 |
RBufWriteStream stream; |
|
462 |
stream.Open( *iBufFlat ); |
|
463 |
CleanupClosePushL( stream ); |
|
464 |
// Write out the playback direction |
|
465 |
stream.WriteInt32L( aPlaybackDirection ); |
|
466 |
stream.CommitL(); |
|
467 |
// Externalize the path to the stream |
|
468 |
path->ExternalizeL( stream ); |
|
469 |
||
470 |
// ActivateViewL takes a TDesC*, rather than a TDesC8 |
|
471 |
// so copy the data accordingly |
|
472 |
if ( iBuffer ) |
|
473 |
{ |
|
474 |
delete iBuffer; |
|
475 |
iBuffer = NULL; |
|
476 |
} |
|
477 |
||
478 |
TInt length = iBufFlat->Size(); |
|
479 |
iBuffer = HBufC::NewL( length ); |
|
480 |
TPtr bufferPtr = iBuffer->Des(); |
|
481 |
TPtr8 ptr = iBufFlat->Ptr( 0 ); |
|
482 |
bufferPtr.Copy( ptr ); |
|
483 |
||
484 |
// Get the view utility |
|
485 |
MMPXViewUtility* viewUtility = MMPXViewUtility::UtilityL(); |
|
486 |
CleanupClosePushL( *viewUtility ); |
|
487 |
||
488 |
viewUtility->ActivateViewL( TUid::Uid(KShwSlideshowViewImplementationId), |
|
489 |
iBuffer ); |
|
490 |
||
491 |
// set the view navigation direction so that previous view keeps its |
|
492 |
// media list and focus |
|
493 |
iUiUtility->SetViewNavigationDirection( EGlxNavigationForwards ); |
|
494 |
||
495 |
CleanupStack::PopAndDestroy( 3, path ); // viewUtility, stream and path |
|
496 |
} |
|
497 |
||
498 |
// --------------------------------------------------------------------------- |
|
499 |
// UpdateToolbarL |
|
500 |
// --------------------------------------------------------------------------- |
|
501 |
// |
|
502 |
void CGlxCommandHandlerSlideshow::UpdateToolbar() |
|
503 |
{ |
|
504 |
TRACER("CGlxCommandHandlerSlideshow::UpdateToolbar"); |
|
505 |
TBool visible = EFalse; |
|
506 |
||
507 |
if ( GlxUpnpRenderer::Status() != NGlxUpnpRenderer::EActive ) |
|
508 |
{ |
|
509 |
TInt focus = MediaList().FocusIndex(); |
|
510 |
||
511 |
if ( focus >= 0 ) |
|
512 |
{ |
|
513 |
const TGlxMedia& media = MediaList().Item( focus ); |
|
514 |
||
515 |
TInt frameCount = 0; |
|
516 |
// get count, ignore return value |
|
517 |
(void)media.GetFrameCount( frameCount ); |
|
518 |
||
519 |
// medialistcommandhandler has added these attributes to a low |
|
520 |
// priority fetch context when command was loaded so the values |
|
521 |
// should be loaded |
|
522 |
visible = ( EMPXImage == media.Category() |
|
523 |
&& !media.IsDrmProtected() |
|
524 |
&& 1 == frameCount ); |
|
525 |
} |
|
526 |
} |
|
527 |
||
528 |
iUiUtility->ScreenFurniture()->SetToolbarItemVisibility( |
|
529 |
EGlxCmdSlideshowPlay, visible ); |
|
530 |
} |
|
531 |
||
532 |
// ---------------------------------------------------------------------------- |
|
533 |
// HandlePopulatedL |
|
534 |
// ---------------------------------------------------------------------------- |
|
535 |
// |
|
536 |
void CGlxCommandHandlerSlideshow::HandlePopulatedL( MGlxMediaList* aList ) |
|
537 |
{ |
|
538 |
TRACER("CGlxCommandHandlerSlideshow::HandlePopulatedL()"); |
|
539 |
// Check if toolbar is available. |
|
540 |
CAknToolbar* toolbar = iUiUtility->GetGridToolBar(); |
|
541 |
if (aList->Count() == 0 && toolbar) |
|
542 |
{ |
|
543 |
toolbar->SetItemDimmed(EGlxCmdSlideshowPlay, ETrue, ETrue); |
|
544 |
} |
|
545 |
} |
|
546 |
||
547 |
// --------------------------------------------------------------------------- |
|
548 |
// PopulateToolbar |
|
549 |
// --------------------------------------------------------------------------- |
|
550 |
// |
|
551 |
void CGlxCommandHandlerSlideshow::PopulateToolbarL() |
|
552 |
{ |
|
553 |
TRACER("CGlxCommandHandlerSlideshow::PopulateToolbarL"); |
|
554 |
iUiUtility->ScreenFurniture()->SetTooltipL(EGlxCmdSlideshowPlay, |
|
555 |
CAknButton::EPositionLeft); |
|
556 |
} |
|
557 |
||
64
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
558 |
// ----------------------------------------------------------------------------- |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
559 |
// DynInitMenuPaneL |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
560 |
// ----------------------------------------------------------------------------- |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
561 |
// |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
562 |
void CGlxCommandHandlerSlideshow::DynInitMenuPaneL(TInt /*aResourceId*/, |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
563 |
CEikMenuPane* aMenuPane, TBool aIsBrowseMode) |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
564 |
{ |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
565 |
TRACER("CGlxCommandHandlerSlideshow::DynInitMenuPaneL"); |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
566 |
MGlxMediaList& mediaList = MediaList(); |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
567 |
if (aMenuPane) |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
568 |
{ |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
569 |
TInt pos = 0; |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
570 |
if (mediaList.Count()) |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
571 |
{ |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
572 |
TInt focusIndex = mediaList.FocusIndex(); |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
573 |
if (!aIsBrowseMode && focusIndex > KErrNotFound && focusIndex |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
574 |
< mediaList.Count()) |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
575 |
{ |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
576 |
if (aMenuPane->MenuItemExists(EGlxCmdSlideshowPlay, pos)) |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
577 |
{ |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
578 |
const TGlxMedia& media = mediaList.Item(focusIndex); |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
579 |
if (EMPXVideo == media.Category()) |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
580 |
{ |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
581 |
aMenuPane->SetItemDimmed(EGlxCmdSlideshowPlay, ETrue); |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
582 |
} |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
583 |
else |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
584 |
{ |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
585 |
CEikMenuPaneItem::SData& item = |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
586 |
aMenuPane->ItemDataByIndexL(pos); |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
587 |
if (item.iFlags & EEikMenuItemSpecific) |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
588 |
{ |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
589 |
TSize tnSize = iUiUtility->GetGridIconSize(); |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
590 |
TMPXAttribute thumbnailAttribute( |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
591 |
KGlxMediaIdThumbnail, |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
592 |
GlxFullThumbnailAttributeId(ETrue, |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
593 |
tnSize.iWidth, tnSize.iHeight)); |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
594 |
|
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
595 |
const CGlxThumbnailAttribute* value = |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
596 |
media.ThumbnailAttribute( |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
597 |
thumbnailAttribute); |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
598 |
|
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
599 |
// No thumbnail available, hence there might be |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
600 |
// no vaild items to play slideshow |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
601 |
if (!value) |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
602 |
{ |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
603 |
aMenuPane->SetItemDimmed( |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
604 |
EGlxCmdSlideshowPlay, ETrue); |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
605 |
} |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
606 |
} |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
607 |
} |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
608 |
} |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
609 |
} |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
610 |
|
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
611 |
if (aIsBrowseMode) |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
612 |
{ |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
613 |
if (aMenuPane->MenuItemExists(EGlxCmdSlideshow, pos) |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
614 |
&& mediaList.SelectionCount()) |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
615 |
{ |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
616 |
aMenuPane->SetItemDimmed(EGlxCmdSlideshow, ETrue); |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
617 |
} |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
618 |
|
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
619 |
if (aMenuPane->MenuItemExists(EGlxCmdSlideshowPlay, pos) |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
620 |
&& mediaList.SelectionCount() == 0) |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
621 |
{ |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
622 |
CEikMenuPaneItem::SData& item = |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
623 |
aMenuPane->ItemDataByIndexL(pos); |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
624 |
if (item.iFlags & EEikMenuItemSpecific |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
625 |
&& EMPXVideo == mediaList.Item( |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
626 |
mediaList.FocusIndex()).Category()) |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
627 |
{ |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
628 |
aMenuPane->SetItemDimmed(EGlxCmdSlideshowPlay, ETrue); |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
629 |
} |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
630 |
} |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
631 |
} |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
632 |
} |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
633 |
else |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
634 |
{ |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
635 |
if (aMenuPane->MenuItemExists(EGlxCmdSlideshowPlay, pos)) |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
636 |
{ |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
637 |
aMenuPane->SetItemDimmed(EGlxCmdSlideshowPlay, ETrue); |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
638 |
} |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
639 |
|
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
640 |
if (aMenuPane->MenuItemExists(EGlxCmdSlideshow, pos)) |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
641 |
{ |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
642 |
aMenuPane->SetItemDimmed(EGlxCmdSlideshow, ETrue); |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
643 |
} |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
644 |
} |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
645 |
} |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
646 |
} |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
647 |
|
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
648 |
|
60 | 649 |
// End of File |