26
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-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: Implementation of Slideshow view
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
// INCLUDE FILES
|
|
23 |
#include <aknnotewrappers.h>
|
|
24 |
#include "shwslideshowview.h"
|
|
25 |
|
|
26 |
#include <aknViewAppUi.h>
|
|
27 |
#include <eikmenub.h> // for access to CEikButtonGroupContainer (from Cba())
|
|
28 |
#include <AknUtils.h> // for CompleteWithAppPath
|
|
29 |
#include <AknWaitDialog.h>
|
|
30 |
#include <StringLoader.h>
|
|
31 |
|
|
32 |
#include <alf/alfcontrolgroup.h>
|
|
33 |
#include <alf/alfenv.h>
|
|
34 |
#include <alf/alfdisplay.h>
|
|
35 |
#include <alf/alfutil.h>
|
|
36 |
#include <alf/alfroster.h>
|
|
37 |
|
|
38 |
#include <glxhdmicontroller.h>
|
|
39 |
#include <glxresourceutilities.h> // for CGlxResourceUtilities
|
|
40 |
#include <glxresolutionutility.h> // for CGlxResolutionUtility
|
|
41 |
#include <shwslideshowview.rsg> // view's resource
|
|
42 |
#include <data_caging_path_literals.hrh> // for resource directory path
|
|
43 |
#include <glxcommandhandlers.hrh> // for EGlxCmdResetView
|
|
44 |
#include <glxlog.h>
|
|
45 |
#include <glxtracer.h>
|
|
46 |
#include <aknsoundsystem.h> // for CAknKeySoundSystem
|
|
47 |
#include <avkon.rsg> // for R_AVKON_SILENT_SKEY_LIST
|
|
48 |
#include <mpxcollectionpath.h>
|
|
49 |
#include <coeutils.h>
|
|
50 |
#include <eiksoftkeypostingtransparency.h>
|
|
51 |
#include "mpxcollectionutility.h"
|
|
52 |
#include "glxfilterfactory.h" // for TGlxFilterFactory
|
|
53 |
#include "mglxmedialist.h"
|
|
54 |
#include "glxuiutility.h"
|
|
55 |
#include "shwslideshowengine.h"
|
|
56 |
#include "shweffectinfo.h"
|
|
57 |
#include "shwslideshowvolumecontrol.h"
|
|
58 |
#include "shwslideshowbacklighttimer.h"
|
|
59 |
#include "shwslideshowview.hrh" // for EShwSlideshowCmdContinue
|
|
60 |
#include "shwslideshowkeyhandler.h"
|
|
61 |
#include "shwslideshowpausehandler.h"
|
|
62 |
#include "shwslideshowtelephonehandler.h"
|
|
63 |
#include "shwcallback.h"
|
|
64 |
#include "shwsettingsmodel.h"
|
|
65 |
#include "shwgesturecontrol.h"
|
|
66 |
#include "shwviewtimer.h"
|
|
67 |
#include "shwmediakeyshandler.h"
|
|
68 |
#include <glxtexturemanager.h>
|
|
69 |
#include <glxerrormanager.h>
|
|
70 |
#include <glxthumbnailattributeinfo.h>
|
|
71 |
#include <glxicons.mbg>
|
|
72 |
#include <AknIconUtils.h>
|
|
73 |
#include <glxuistd.h>
|
|
74 |
|
|
75 |
namespace
|
|
76 |
{
|
|
77 |
_LIT(KShwSlideshowViewResource,"shwslideshowview.rsc");
|
|
78 |
const TInt KShwDefaultDelayMicroSeconds = 5000000; // 5s
|
|
79 |
const TInt KVolumeControlGroupId = 1;
|
|
80 |
// Reuse the plug-in's uid
|
|
81 |
const TInt KViewId = 0x20007199;
|
|
82 |
//gontrol goup id has to be locally unique
|
|
83 |
const TInt KShwGestureControlGroupId = 2;
|
|
84 |
const TInt KGestureControlGroupId = 44;
|
|
85 |
//This constant is used to calculate the index of the item for which texture has to removed.
|
|
86 |
//6 = 5(iterator value in forward or backward direction for fullscreen) + 1(focus index)
|
|
87 |
const TInt KSlideShowIterator = 2;
|
|
88 |
//Constant which says maximum number of fullscreen textures that we have have at a time.
|
|
89 |
//11 = (5(5 fullscreen texture backwards)+1(fucus index texture)+5(5 fullscreen texture forwards))
|
|
90 |
const TInt KSlideShowTextureOffset = 3;
|
|
91 |
}
|
|
92 |
//display screen furniture for KShowForSeconds
|
|
93 |
const TInt KShowForSeconds = 5;
|
|
94 |
|
|
95 |
// ======== MEMBER FUNCTIONS ========
|
|
96 |
|
|
97 |
// ---------------------------------------------------------------------------
|
|
98 |
// Default constructor. Inlined to save a few bits of ROM
|
|
99 |
// ---------------------------------------------------------------------------
|
|
100 |
//
|
|
101 |
inline CShwSlideshowView::CShwSlideshowView() :
|
|
102 |
CGlxViewBase(ETrue) // workaround - force synchronous view activation
|
|
103 |
{
|
|
104 |
TRACER("CShwSlideshowView::CShwSlideshowView");
|
|
105 |
GLX_LOG_INFO( "CShwSlideshowView::CShwSlideshowView" );
|
|
106 |
}
|
|
107 |
|
|
108 |
// ---------------------------------------------------------------------------
|
|
109 |
// Two-phased constructor.
|
|
110 |
// ---------------------------------------------------------------------------
|
|
111 |
//
|
|
112 |
CShwSlideshowView* CShwSlideshowView::NewLC()
|
|
113 |
{
|
|
114 |
TRACER("CShwSlideshowView::NewLC");
|
|
115 |
GLX_LOG_INFO( "CShwSlideshowView::NewLC" );
|
|
116 |
CShwSlideshowView* self = new ( ELeave ) CShwSlideshowView;
|
|
117 |
CleanupStack::PushL( self );
|
|
118 |
self->ConstructL();
|
|
119 |
return self;
|
|
120 |
}
|
|
121 |
|
|
122 |
// ---------------------------------------------------------------------------
|
|
123 |
// Destructor
|
|
124 |
// ---------------------------------------------------------------------------
|
|
125 |
//
|
|
126 |
CShwSlideshowView::~CShwSlideshowView()
|
|
127 |
{
|
|
128 |
TRACER("CShwSlideshowView::~CShwSlideshowView");
|
|
129 |
GLX_LOG_INFO( "CShwSlideshowView::~CShwSlideshowView()" );
|
|
130 |
|
|
131 |
delete iMMCNotifier;
|
|
132 |
iMMCNotifier = NULL;
|
|
133 |
|
|
134 |
// delete media list population call back
|
|
135 |
delete iPopulateListCallBack;
|
|
136 |
|
|
137 |
// delete engine async starter
|
|
138 |
delete iAsyncCallBack;
|
|
139 |
|
|
140 |
// Cleanup both the lists in case view was not deactivated
|
|
141 |
if ( iMediaList )
|
|
142 |
{
|
|
143 |
iMediaList->Close();
|
|
144 |
}
|
|
145 |
|
|
146 |
if ( iFilteredList )
|
|
147 |
{
|
|
148 |
iFilteredList->Close();
|
|
149 |
}
|
|
150 |
|
|
151 |
// Remove the back light timer
|
|
152 |
delete iBackLightTimer;
|
|
153 |
|
|
154 |
// Delete the control groups
|
|
155 |
if ( iEnv )
|
|
156 |
{
|
|
157 |
iEnv->DeleteControlGroup( KVolumeControlGroupId );
|
|
158 |
iVolumeControlGroup = NULL;
|
|
159 |
if(iGestureControlGroup)
|
|
160 |
{
|
|
161 |
CAlfControl* gesture = (&(iGestureControlGroup->Control(1))); // CGestureControl is 1
|
|
162 |
iGestureControlGroup->Remove(gesture);
|
|
163 |
}
|
|
164 |
iEnv->DeleteControlGroup( KShwGestureControlGroupId );
|
|
165 |
iGestureControlGroup = NULL;
|
|
166 |
delete iGestureControl;
|
|
167 |
}
|
|
168 |
|
|
169 |
// Turn back on the keypad tones
|
|
170 |
AppUi()->KeySounds()->PopContext();
|
|
171 |
|
|
172 |
// Delete resource file
|
|
173 |
if ( iResourceOffset )
|
|
174 |
{
|
|
175 |
CCoeEnv::Static()->DeleteResourceFile( iResourceOffset );
|
|
176 |
iResourceOffset = NULL;
|
|
177 |
}
|
|
178 |
}
|
|
179 |
|
|
180 |
// -----------------------------------------------------------------------------
|
|
181 |
// ShowProgressDialogL.
|
|
182 |
// -----------------------------------------------------------------------------
|
|
183 |
TInt CShwSlideshowView::ShowProgressDialogL()
|
|
184 |
{
|
|
185 |
TRACER("CShwSlideshowView::ShowProgressDialogL");
|
|
186 |
GLX_LOG_INFO( "CShwSlideshowView::ShowProgressDialogL" );
|
|
187 |
|
|
188 |
// Set to landscape orientation
|
|
189 |
// Note that the orientation switch is performed here rather than in the
|
|
190 |
// view activation to ensure the correct use of the screen furniture layout
|
|
191 |
iUiUtility->SetAppOrientationL( EGlxOrientationLandscape );
|
|
192 |
// Set display background as a solid black colour
|
|
193 |
iDisplay->SetClearBackgroundL( CAlfDisplay::EClearWithColor );
|
|
194 |
|
|
195 |
// Setup the progress dialog
|
|
196 |
iWaitDialog = new ( ELeave ) CAknWaitDialog(
|
|
197 |
reinterpret_cast< CEikDialog** >( &iWaitDialog ), ETrue );
|
|
198 |
iWaitDialog->PrepareLC( R_SHW_WAIT_NOTE );
|
|
199 |
// Dialog is non-modal so request dismissal callbacks
|
|
200 |
iWaitDialog->SetCallback( this );
|
|
201 |
// Load string for dialog
|
|
202 |
HBufC* title = StringLoader::LoadLC( R_SHW_WAIT_DLG_OPENING );
|
|
203 |
iWaitDialog->SetTextL( *title );
|
|
204 |
CleanupStack::PopAndDestroy( title );
|
|
205 |
|
|
206 |
// Show the dialog, we show it non blocking so no use for the return value
|
|
207 |
iWaitDialog->RunLD();
|
|
208 |
// set the callback to be engine start
|
|
209 |
iAsyncCallBack->Set(TShwCallBack<CShwSlideshowView,
|
|
210 |
&CShwSlideshowView::StartEngineL> (this));
|
|
211 |
// if both lists are ready
|
|
212 |
if( iInputListReady && iPlayListReady )
|
|
213 |
{
|
|
214 |
// make the async callback, this will end up calling StartEngineL()
|
|
215 |
// in CAsyncCallback::RunL once the scheduler next time runs.
|
|
216 |
iAsyncCallBack->CallBack();
|
|
217 |
}
|
|
218 |
|
|
219 |
// return value needed as this is a TCallBack
|
|
220 |
return KErrNone;
|
|
221 |
}
|
|
222 |
|
|
223 |
// -----------------------------------------------------------------------------
|
|
224 |
// StartEngineL
|
|
225 |
// -----------------------------------------------------------------------------
|
|
226 |
TInt CShwSlideshowView::StartEngineL()
|
|
227 |
{
|
|
228 |
TRACER("CShwSlideshowView::StartEngineL");
|
|
229 |
GLX_LOG_INFO( "CShwSlideshowView::StartEngineL" );
|
|
230 |
// Check that the list has some items
|
|
231 |
if (iFilteredList)
|
|
232 |
{
|
|
233 |
TInt filteredCount = iFilteredList->Count();
|
|
234 |
TInt inputlistCount = iMediaList->Count();
|
|
235 |
if ((inputlistCount < 1) || (filteredCount < 1))
|
|
236 |
{
|
|
237 |
GLX_LOG_INFO2(
|
|
238 |
"CShwSlideshowView::PopulateListL error, counts: %d, %d",
|
|
239 |
inputlistCount, filteredCount );
|
|
240 |
iEngineStartFailed = ETrue;
|
|
241 |
// need to dismiss the dialog if it's still there
|
|
242 |
if (iWaitDialog)
|
|
243 |
{
|
|
244 |
iWaitDialog->ProcessFinishedL();
|
|
245 |
}
|
|
246 |
}
|
|
247 |
else
|
|
248 |
{
|
|
249 |
// The list should now be populated, so set the focus
|
|
250 |
SetListFocusL();
|
|
251 |
|
|
252 |
// Initialize control textures
|
|
253 |
iVolumeControl->InitControlTextureL();
|
|
254 |
|
|
255 |
// Need to take latest screen size as layout has changed
|
|
256 |
TRect currentScreen;
|
|
257 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen,
|
|
258 |
currentScreen);
|
|
259 |
iScrnSize = currentScreen.Size();
|
|
260 |
|
|
261 |
iHdmiWidth
|
|
262 |
= (iScrnSize.iWidth > iScrnSize.iHeight ? iScrnSize.iWidth
|
|
263 |
: iScrnSize.iHeight);
|
|
264 |
iHdmiHeight
|
|
265 |
= (iScrnSize.iWidth < iScrnSize.iHeight ? iScrnSize.iWidth
|
|
266 |
: iScrnSize.iHeight);
|
|
267 |
iEngine->StartL(*iEnv, *iDisplay, *iFilteredList, *this, iScrnSize);
|
|
268 |
if (iHdmiController == NULL || (iHdmiController
|
|
269 |
&& !iHdmiController->IsHDMIConnected()))
|
|
270 |
{
|
|
271 |
iEngine->HandleHDMIDecodingEventL(EHdmiDisconnected);
|
|
272 |
}
|
|
273 |
SetItemToHDMIL();
|
|
274 |
iHdmiActive = ETrue;
|
|
275 |
}
|
|
276 |
}
|
|
277 |
// return value needed as this is a TCallBack
|
|
278 |
return KErrNone;
|
|
279 |
}
|
|
280 |
|
|
281 |
// -----------------------------------------------------------------------------
|
|
282 |
// PopulateListL
|
|
283 |
// -----------------------------------------------------------------------------
|
|
284 |
TInt CShwSlideshowView::PopulateListL()
|
|
285 |
{
|
|
286 |
TRACER("CShwSlideshowView::PopulateListL");
|
|
287 |
GLX_LOG_INFO( "CShwSlideshowView::PopulateListL" );
|
|
288 |
// Setup a filter given the play direction and the path
|
|
289 |
CMPXFilter* filter = NULL;
|
|
290 |
|
|
291 |
// take current filter and add the slideshow parameters in it
|
|
292 |
// If we play forwards, we dont revert the original order and if we
|
|
293 |
// play backwards we need to just revert the original order
|
|
294 |
// Note we dont know the original order and cant ask for it as its set by the
|
|
295 |
// plug-in and never returned to the client side.
|
|
296 |
|
|
297 |
// we need the full path for the filter creation so that the selection can be
|
|
298 |
// extracted from there
|
|
299 |
CMPXCollectionPath* fullpath = iMediaList->PathLC();
|
|
300 |
// CreateSlideShowFilterFromExistingFilterL() takes ownership of the fullpath so no need to destroy it.
|
|
301 |
CleanupStack::Pop( fullpath );
|
|
302 |
// create the filter
|
|
303 |
filter = TGlxFilterFactory::CreateSlideShowFilterFromExistingFilterL(
|
|
304 |
iMediaList->Filter(), fullpath,
|
|
305 |
iPlayDirection);
|
|
306 |
CleanupStack::PushL( filter );
|
|
307 |
|
|
308 |
// Use this DLL's uid as the hierarchy id
|
|
309 |
TGlxHierarchyId hierarchyId = TUid( NShwSlideshow::KEngineDllUid ).iUid;
|
|
310 |
iFilteredList = MGlxMediaList::InstanceL( *iCollectionPath, hierarchyId, filter );
|
|
311 |
iFilteredList->AddMediaListObserverL( this );
|
|
312 |
|
|
313 |
CleanupStack::PopAndDestroy( filter );
|
|
314 |
|
|
315 |
// return value needed as this is a TCallBack
|
|
316 |
return KErrNone;
|
|
317 |
}
|
|
318 |
|
|
319 |
// ---------------------------------------------------------------------------
|
|
320 |
// Symbian 2nd phase constructor can leave.
|
|
321 |
// ---------------------------------------------------------------------------
|
|
322 |
//
|
|
323 |
void CShwSlideshowView::ConstructL()
|
|
324 |
{
|
|
325 |
TRACER("CShwSlideshowView::ConstructL");
|
|
326 |
GLX_LOG_INFO( "CShwSlideshowView::ConstructL()" );
|
|
327 |
|
|
328 |
// Load the view's resources
|
|
329 |
TFileName resourceFile( KDC_APP_RESOURCE_DIR );
|
|
330 |
resourceFile.Append( KShwSlideshowViewResource );
|
|
331 |
CGlxResourceUtilities::GetResourceFilenameL( resourceFile );
|
|
332 |
iResourceOffset = iCoeEnv->AddResourceFileL( resourceFile );
|
|
333 |
|
|
334 |
// AknView base construction
|
|
335 |
BaseConstructL( R_SHW_SLIDESHOW_PLAY_VIEW );
|
|
336 |
|
|
337 |
// Glx view base construction
|
|
338 |
ViewBaseConstructL();
|
|
339 |
|
|
340 |
iMMCNotifier = CGlxMMCNotifier::NewL(*this);
|
|
341 |
|
|
342 |
// Create async engine starter with standard priority
|
|
343 |
iAsyncCallBack = new( ELeave ) CAsyncCallBack( CActive::EPriorityStandard );
|
|
344 |
|
|
345 |
// Create the back light timer
|
|
346 |
iBackLightTimer = CShwSlideshowBackLightTimer::NewL();
|
|
347 |
|
|
348 |
iEnv = iUiUtility->Env();
|
|
349 |
iDisplay = iUiUtility->Display();
|
|
350 |
iGridIconSize = iUiUtility->GetGridIconSize();
|
|
351 |
|
|
352 |
// Construct the volume control
|
|
353 |
iVolumeControl = CShwSlideshowVolumeControl::
|
|
354 |
NewL( *iEnv,
|
|
355 |
*iUiUtility,
|
|
356 |
KShwDefaultDelayMicroSeconds );
|
|
357 |
// Create a control group for the volume control
|
|
358 |
iVolumeControlGroup = &iEnv->NewControlGroupL( KVolumeControlGroupId );
|
|
359 |
// doc says the following takes ownership, but reality is different
|
|
360 |
iVolumeControlGroup->AppendL( iVolumeControl );
|
|
361 |
|
|
362 |
iGestureControlGroup = &iEnv->NewControlGroupL( KShwGestureControlGroupId );
|
|
363 |
|
|
364 |
// construct the gesture control group
|
|
365 |
iShwGestureControl = CShwGestureControl::NewL(*iEnv,*iDisplay);
|
|
366 |
iGestureControlGroup->AppendL( iShwGestureControl );
|
|
367 |
|
|
368 |
GestureHelper::CGestureControl* gestureControl = GestureHelper::CGestureControl::NewLC(
|
|
369 |
*iShwGestureControl, *iEnv, *iDisplay, KGestureControlGroupId );
|
|
370 |
iGestureControl = gestureControl;
|
|
371 |
CleanupStack::Pop( gestureControl ); // doc says the following takes ownership, but reality is different
|
|
372 |
iGestureControlGroup->AppendL( iGestureControl );
|
|
373 |
|
|
374 |
// Need a mechanism to distinguish when we receive the MusicVolume
|
|
375 |
// callback for the first time
|
|
376 |
iCurrentVolume = -1;
|
|
377 |
iPopulateListCallBack = new( ELeave )
|
|
378 |
CAsyncCallBack( CActive::EPriorityStandard );
|
|
379 |
// set the callback for the media list population
|
|
380 |
iPopulateListCallBack->Set(TShwCallBack<CShwSlideshowView,
|
|
381 |
&CShwSlideshowView::PopulateListL> (this));
|
|
382 |
iMSKPressed = EFalse;
|
|
383 |
iLSKPressed = EFalse;
|
|
384 |
iAknEventMonitor
|
|
385 |
= static_cast<CAknAppUiBase*> (CCoeEnv::Static()->AppUi())->EventMonitor();
|
|
386 |
}
|
|
387 |
|
|
388 |
// ---------------------------------------------------------------------------
|
|
389 |
// From CAknView
|
|
390 |
// Returns views id.
|
|
391 |
// ---------------------------------------------------------------------------
|
|
392 |
//
|
|
393 |
TUid CShwSlideshowView::Id() const
|
|
394 |
{
|
|
395 |
TRACER("CShwSlideshowView::Id()");
|
|
396 |
GLX_LOG_INFO( "CShwSlideshowView::Id()" );
|
|
397 |
return TUid::Uid( KViewId );
|
|
398 |
}
|
|
399 |
|
|
400 |
// ---------------------------------------------------------------------------
|
|
401 |
// From CAknView
|
|
402 |
// Background event handling in HandleWsEventL.
|
|
403 |
// Foreground event handling this function.
|
|
404 |
// ---------------------------------------------------------------------------
|
|
405 |
//
|
|
406 |
void CShwSlideshowView::HandleForegroundEventL(TBool aForeground)
|
|
407 |
{
|
|
408 |
TRACER("CShwSlideshowView::HandleForegroundEventL");
|
|
409 |
GLX_LOG_INFO1("CShwSlideshowView::HandleForegroundEventL(%d)", aForeground);
|
|
410 |
iIsForegrnd = aForeground;
|
|
411 |
if (aForeground)
|
|
412 |
{
|
|
413 |
if (iHdmiController && iHdmiActive)
|
|
414 |
{
|
|
415 |
iHdmiController->ShiftToPostingMode();
|
|
416 |
}
|
|
417 |
// we gained the foreground
|
|
418 |
if(iMMCState && iPrevNotInBackground)
|
|
419 |
{
|
|
420 |
ProcessCommandL(EAknSoftkeyClose);
|
|
421 |
}
|
|
422 |
else
|
|
423 |
{
|
|
424 |
iPauseHandler->SwitchToForegroundL();
|
|
425 |
iEngine->GetMusicVolumeL();
|
|
426 |
}
|
|
427 |
}
|
|
428 |
CAknView::HandleForegroundEventL(aForeground);
|
|
429 |
}
|
|
430 |
|
|
431 |
// -----------------------------------------------------------------------------
|
|
432 |
// From CGlxViewBase
|
|
433 |
// DoViewActivateL.
|
|
434 |
// -----------------------------------------------------------------------------
|
|
435 |
void CShwSlideshowView::DoViewActivateL(const TVwsViewId& /*aPrevViewId*/,
|
|
436 |
TUid /*aCustomMessageId*/,
|
|
437 |
const TDesC8& aCustomMessage)
|
|
438 |
{
|
|
439 |
TRACER("CShwSlideshowView::DoViewActivateL");
|
|
440 |
GLX_LOG_INFO( "CShwSlideshowView::DoViewActivateL()" );
|
|
441 |
|
|
442 |
// remove the status pane
|
|
443 |
AppUi()->StatusPane()->MakeVisible(EFalse);
|
|
444 |
|
|
445 |
//make the softkeys invisible
|
|
446 |
AppUi()->Cba()->MakeVisible(EFalse);
|
|
447 |
|
|
448 |
// Hide the application toolbar when slide show is started
|
|
449 |
if ( AppUi()->PopupToolbar() )
|
|
450 |
{
|
|
451 |
AppUi()->PopupToolbar()->SetToolbarVisibility( EFalse );
|
|
452 |
AppUi()->PopupToolbar()->MakeVisible(EFalse);
|
|
453 |
}
|
|
454 |
iHdmiActive = EFalse;
|
|
455 |
// reset failure flag
|
|
456 |
iEngineStartFailed = EFalse;
|
|
457 |
|
|
458 |
if(!iHdmiController)
|
|
459 |
{
|
|
460 |
iHdmiController = CGlxHdmiController::NewL(*this);
|
|
461 |
}
|
|
462 |
if(!iTvConnection)
|
|
463 |
{
|
|
464 |
iTvConnection = CGlxTv::NewL( *this );
|
|
465 |
}
|
|
466 |
// Engine related construction
|
|
467 |
// Instantiate the slideshow engine, with this class as its observer
|
|
468 |
__ASSERT_DEBUG( !iEngine, Panic( EGlxPanicAlreadyInitialised ) );
|
|
469 |
iEngine = CShwSlideshowEngine::NewL( *this );
|
|
470 |
|
|
471 |
// Instantiate the pause handler, it encapsulates the pause rules
|
|
472 |
__ASSERT_DEBUG( !iPauseHandler, Panic( EGlxPanicAlreadyInitialised ) );
|
|
473 |
iPauseHandler = CShwSlideShowPauseHandler::NewL( *iEngine );
|
|
474 |
|
|
475 |
// Instantiate the key handler, encapsulates all key handling logic
|
|
476 |
__ASSERT_DEBUG( !iKeyHandler, Panic( EGlxPanicAlreadyInitialised ) );
|
|
477 |
iKeyHandler = CShwSlideShowKeyHandler::NewL( *iEngine, *iPauseHandler,
|
|
478 |
reinterpret_cast<TInt&>(iShwState ));
|
|
479 |
AppUi()->AddToStackL( iKeyHandler, ECoeStackPriorityDefault,
|
|
480 |
ECoeStackFlagRefusesFocus );
|
|
481 |
|
|
482 |
// Create the telephone call handler
|
|
483 |
__ASSERT_DEBUG( !iTelephoneHandler, Panic( EGlxPanicAlreadyInitialised ) );
|
|
484 |
iTelephoneHandler = CShwTelephoneHandler::NewL( *iEngine, *iPauseHandler );
|
|
485 |
iTelephoneHandler->StartL();
|
|
486 |
|
|
487 |
// Extract the media list's path and the playback direction from
|
|
488 |
// the custom message data
|
|
489 |
GetPathAndPlaybackDirectionL( aCustomMessage );
|
|
490 |
|
|
491 |
// Ensure the back light stays on
|
|
492 |
iBackLightTimer->StartL();
|
|
493 |
|
|
494 |
// Request asynch callback that will end up in ShowProgressDialogL
|
|
495 |
// once the active scheduler runs
|
|
496 |
iAsyncCallBack->Set(TShwCallBack<CShwSlideshowView,
|
|
497 |
&CShwSlideshowView::ShowProgressDialogL> (this));
|
|
498 |
iAsyncCallBack->CallBack();
|
|
499 |
|
|
500 |
iDisplay->Roster().ShowL( *iGestureControlGroup,KAlfRosterShowAtTop );
|
|
501 |
|
|
502 |
iTicker = CShwTicker::NewL(*this);
|
|
503 |
|
|
504 |
InitializeShwFurnitureL();
|
|
505 |
iUiUtility->Display()->SetVisibleArea(TRect(TPoint(0,0),AlfUtil::ScreenSize()));
|
|
506 |
// We will require to act on events ONLY when the view is active.
|
|
507 |
// So listen to them only when the view is active.
|
|
508 |
iShwGestureControl->AddObserverL(this);
|
|
509 |
iAknEventMonitor->Enable(ETrue);
|
|
510 |
iAknEventMonitor->AddObserverL(this);
|
|
511 |
}
|
|
512 |
|
|
513 |
// -----------------------------------------------------------------------------
|
|
514 |
// From CGlxViewBase
|
|
515 |
// DoViewDeactivate.
|
|
516 |
// -----------------------------------------------------------------------------
|
|
517 |
void CShwSlideshowView::DoViewDeactivate()
|
|
518 |
{
|
|
519 |
TRACER("CShwSlideshowView::DoViewDeactivate");
|
|
520 |
GLX_LOG_INFO( "CShwSlideshowView::DoViewDeactivate()" );
|
|
521 |
if (iHdmiController)
|
|
522 |
{
|
|
523 |
GLX_LOG_INFO( "CShwSlideshowView::DoViewDeactivate() - delete hdmicontroller" );
|
|
524 |
delete iHdmiController;
|
|
525 |
iHdmiController = NULL;
|
|
526 |
}
|
|
527 |
if(iTvConnection)
|
|
528 |
{
|
|
529 |
delete iTvConnection;
|
|
530 |
iTvConnection = NULL;
|
|
531 |
}
|
|
532 |
|
|
533 |
//check if we have engine active object starting
|
|
534 |
if( iPopulateListCallBack->IsActive() )
|
|
535 |
{
|
|
536 |
//cancel the engine start
|
|
537 |
iPopulateListCallBack->Cancel();
|
|
538 |
}
|
|
539 |
|
|
540 |
//check if we have engine active object starting
|
|
541 |
if( iAsyncCallBack->IsActive() )
|
|
542 |
{
|
|
543 |
//cancel the engine start
|
|
544 |
iAsyncCallBack->Cancel();
|
|
545 |
}
|
|
546 |
|
|
547 |
//Hide the volume control group, iDisplay and iVolumeControlGroup
|
|
548 |
//are always valid so no need to test for != NULL
|
|
549 |
iDisplay->Roster().Hide( *iVolumeControlGroup );
|
|
550 |
|
|
551 |
iAknEventMonitor->Enable(EFalse);
|
|
552 |
iAknEventMonitor->RemoveObserver(this);
|
|
553 |
|
|
554 |
//Ensure we revert to a proper background
|
|
555 |
TRAP_IGNORE(
|
|
556 |
{
|
|
557 |
iDisplay->SetClearBackgroundL( CAlfDisplay::EClearWithSkinBackground );
|
|
558 |
} );
|
|
559 |
|
|
560 |
|
|
561 |
//Ensure we don't get any more key events
|
|
562 |
AppUi()->RemoveFromStack( iKeyHandler );
|
|
563 |
delete iKeyHandler;
|
|
564 |
iKeyHandler = NULL;
|
|
565 |
|
|
566 |
//Stop handling telephone calls
|
|
567 |
delete iTelephoneHandler;
|
|
568 |
iTelephoneHandler = NULL;
|
|
569 |
|
|
570 |
//delete the pause handler
|
|
571 |
//it is used by key and telephone handlers so do this last
|
|
572 |
delete iPauseHandler;
|
|
573 |
iPauseHandler = NULL;
|
|
574 |
|
|
575 |
//Cancel the back light timer
|
|
576 |
iBackLightTimer->Cancel();
|
|
577 |
|
|
578 |
|
|
579 |
//Stop the slideshow
|
|
580 |
//NOTE: this needs to be done before the list is closed as the
|
|
581 |
//destructor removes the engine as medialist observer and also
|
|
582 |
//removes the contexts from the list
|
|
583 |
delete iEngine;
|
|
584 |
iEngine = NULL;
|
|
585 |
|
|
586 |
delete iCollectionPath;
|
|
587 |
iCollectionPath = NULL;
|
|
588 |
|
|
589 |
//Ensure we don't get any more list callbacks
|
|
590 |
if( iMediaList )
|
|
591 |
{
|
|
592 |
iMediaList->RemoveMediaListObserver( this );
|
|
593 |
//need to close the list
|
|
594 |
iMediaList->Close();
|
|
595 |
//set to NULL to prevent double delete
|
|
596 |
iMediaList = NULL;
|
|
597 |
}
|
|
598 |
//Ensure we don't get any more list callbacks
|
|
599 |
if ( iFilteredList )
|
|
600 |
{
|
|
601 |
iFilteredList->RemoveMediaListObserver( this );
|
|
602 |
//need to also close the list
|
|
603 |
iFilteredList->Close();
|
|
604 |
//set to NULL to prevent double delete
|
|
605 |
iFilteredList = NULL;
|
|
606 |
}
|
|
607 |
iShwGestureControl->RemoveObserver(this);
|
|
608 |
iDisplay->Roster().Hide( *iGestureControlGroup );
|
|
609 |
|
|
610 |
if(iTicker)
|
|
611 |
{
|
|
612 |
delete iTicker;
|
|
613 |
iTicker =NULL;
|
|
614 |
}
|
|
615 |
AppUi()->RemoveFromStack( iShwCba );
|
|
616 |
delete iShwCba;
|
|
617 |
iShwCba =NULL;
|
|
618 |
if(iMediaKeyHandler)
|
|
619 |
{
|
|
620 |
delete iMediaKeyHandler;
|
|
621 |
iMediaKeyHandler = NULL;
|
|
622 |
}
|
|
623 |
}
|
|
624 |
|
|
625 |
// ---------------------------------------------------------------------------
|
|
626 |
// From MGlxMediaListObserver
|
|
627 |
// HandleItemAddedL
|
|
628 |
// ---------------------------------------------------------------------------
|
|
629 |
//
|
|
630 |
void CShwSlideshowView::HandleItemAddedL( TInt /*aStartIndex*/,
|
|
631 |
TInt /*aEndIndex*/,
|
|
632 |
MGlxMediaList* /*aList*/ )
|
|
633 |
{
|
|
634 |
}
|
|
635 |
|
|
636 |
// ---------------------------------------------------------------------------
|
|
637 |
// From MGlxMediaListObserver
|
|
638 |
// HandleMediaL
|
|
639 |
// ---------------------------------------------------------------------------
|
|
640 |
//
|
|
641 |
void CShwSlideshowView::HandleMediaL( TInt /*aListIndex*/,
|
|
642 |
MGlxMediaList* /*aList*/)
|
|
643 |
{
|
|
644 |
}
|
|
645 |
|
|
646 |
// ---------------------------------------------------------------------------
|
|
647 |
// From MGlxMediaListObserver
|
|
648 |
// HandleItemRemoved
|
|
649 |
// ---------------------------------------------------------------------------
|
|
650 |
//
|
|
651 |
void CShwSlideshowView::HandleItemRemovedL( TInt /*aStartIndex*/,
|
|
652 |
TInt /*aEndIndex*/,
|
|
653 |
MGlxMediaList* /*aList*/ )
|
|
654 |
{
|
|
655 |
}
|
|
656 |
|
|
657 |
// ---------------------------------------------------------------------------
|
|
658 |
// From MGlxMediaListObserver
|
|
659 |
// HandleItemModifiedL.
|
|
660 |
// ---------------------------------------------------------------------------
|
|
661 |
//
|
|
662 |
void CShwSlideshowView::HandleItemModifiedL(
|
|
663 |
const RArray<TInt>& /*aItemIndexes*/, MGlxMediaList* /*aList*/ )
|
|
664 |
{
|
|
665 |
}
|
|
666 |
|
|
667 |
// ---------------------------------------------------------------------------
|
|
668 |
// From MGlxMediaListObserver
|
|
669 |
// HandleAttributesAvailableL.
|
|
670 |
// ---------------------------------------------------------------------------
|
|
671 |
//
|
|
672 |
void CShwSlideshowView::HandleAttributesAvailableL(
|
|
673 |
TInt /*aItemIndex*/,
|
|
674 |
const RArray<TMPXAttribute>& /*aAttributes*/,
|
|
675 |
MGlxMediaList*/* aList*/ )
|
|
676 |
{
|
|
677 |
}
|
|
678 |
|
|
679 |
// ---------------------------------------------------------------------------
|
|
680 |
// From MGlxMediaListObserver
|
|
681 |
// HandleFocusChangedL.
|
|
682 |
// ---------------------------------------------------------------------------
|
|
683 |
//
|
|
684 |
void CShwSlideshowView::HandleFocusChangedL( NGlxListDefs::TFocusChangeType /*aType*/,
|
|
685 |
TInt /*aNewIndex*/,
|
|
686 |
TInt /*aOldIndex*/,
|
|
687 |
MGlxMediaList* /*aList*/)
|
|
688 |
{
|
|
689 |
TRACER("CShwSlideshowView::HandleFocusChangedL()");
|
|
690 |
if(iFilteredList)
|
|
691 |
{
|
|
692 |
if (iFilteredList->Count() && iHdmiActive)
|
|
693 |
{
|
|
694 |
if(iFilteredList->Count() > KSlideShowTextureOffset)
|
|
695 |
{
|
|
696 |
RemoveTexture();
|
|
697 |
}
|
|
698 |
SetItemToHDMIL();
|
|
699 |
}
|
|
700 |
}
|
|
701 |
}
|
|
702 |
|
|
703 |
// ---------------------------------------------------------------------------
|
|
704 |
// From MGlxMediaListObserver
|
|
705 |
// HandleItemSelected.
|
|
706 |
// ---------------------------------------------------------------------------
|
|
707 |
//
|
|
708 |
void CShwSlideshowView::HandleItemSelectedL( TInt /*aIndex*/,
|
|
709 |
TBool /*aSelected*/,
|
|
710 |
MGlxMediaList* /*aList*/)
|
|
711 |
{
|
|
712 |
}
|
|
713 |
|
|
714 |
// ---------------------------------------------------------------------------
|
|
715 |
// From MGlxMediaListObserver
|
|
716 |
// HandleMessageL.
|
|
717 |
// ---------------------------------------------------------------------------
|
|
718 |
//
|
|
719 |
void CShwSlideshowView::HandleMessageL( const CMPXMessage& /*aMessage*/,
|
|
720 |
MGlxMediaList* /*aList*/)
|
|
721 |
{
|
|
722 |
}
|
|
723 |
|
|
724 |
// ---------------------------------------------------------------------------
|
|
725 |
// From MGlxMediaListObserver
|
|
726 |
// HandlePopulated.
|
|
727 |
// ---------------------------------------------------------------------------
|
|
728 |
//
|
|
729 |
void CShwSlideshowView::HandlePopulatedL( MGlxMediaList* aList )
|
|
730 |
{
|
|
731 |
TRACER("CShwSlideshowView::HandlePopulatedL");
|
|
732 |
GLX_LOG_INFO( "CShwSlideshowView::HandlePopulatedL" );
|
|
733 |
|
|
734 |
if( iMediaList == aList )
|
|
735 |
{
|
|
736 |
// input list is ready
|
|
737 |
iInputListReady = ETrue;
|
|
738 |
// read the selection and filter
|
|
739 |
// note that these cannot be read until the list has been populated
|
|
740 |
// make the async callback, this will end up calling PopulateListL()
|
|
741 |
// in CAsyncCallback::RunL once the scheduler next time runs.
|
|
742 |
iPopulateListCallBack->CallBack();
|
|
743 |
}
|
|
744 |
else if( iFilteredList == aList )
|
|
745 |
{
|
|
746 |
// playable list is ready
|
|
747 |
iPlayListReady = ETrue;
|
|
748 |
}
|
|
749 |
|
|
750 |
// the filtered list has been populated so start the engine
|
|
751 |
if( iInputListReady && iPlayListReady )
|
|
752 |
{
|
|
753 |
// make the async callback, this will end up calling StartEngineL()
|
|
754 |
// in CAsyncCallback::RunL once the scheduler next time runs.
|
|
755 |
// this is a no-op if the callback is already active
|
|
756 |
iAsyncCallBack->CallBack();
|
|
757 |
}
|
|
758 |
}
|
|
759 |
|
|
760 |
// ---------------------------------------------------------------------------
|
|
761 |
// From MShwEngineObserver
|
|
762 |
// Engine started callback.
|
|
763 |
// ---------------------------------------------------------------------------
|
|
764 |
//
|
|
765 |
void CShwSlideshowView::EngineStartedL()
|
|
766 |
{
|
|
767 |
TRACER("CShwSlideshowView::EngineStartedL");
|
|
768 |
GLX_LOG_INFO( "CShwSlideshowView::EngineStartedL()" );
|
|
769 |
if (iWaitDialog)
|
|
770 |
{
|
|
771 |
// cancel the progress bar
|
|
772 |
iWaitDialog->ProcessFinishedL();
|
|
773 |
}
|
|
774 |
if (iHdmiController)
|
|
775 |
{
|
|
776 |
iHdmiController->ShiftToPostingMode();
|
|
777 |
}
|
|
778 |
// Here, iShwState value is either 0(first instance)
|
|
779 |
// or EShwExiting(remembered from previous instance)
|
|
780 |
iShwState = EShwPlay;
|
|
781 |
ShowShwFurnitureL();
|
|
782 |
}
|
|
783 |
|
|
784 |
// ---------------------------------------------------------------------------
|
|
785 |
// From MShwEngineObserver
|
|
786 |
// Engine paused callback.
|
|
787 |
// ---------------------------------------------------------------------------
|
|
788 |
//
|
|
789 |
void CShwSlideshowView::EnginePausedL()
|
|
790 |
{
|
|
791 |
TRACER("CShwSlideshowView::EnginePausedL");
|
|
792 |
GLX_LOG_INFO( "CShwSlideshowView::EnginePausedL()" );
|
|
793 |
// Cancel the backlight if it's on
|
|
794 |
if (iBackLightTimer->IsRunning())
|
|
795 |
{
|
|
796 |
iBackLightTimer->Cancel();
|
|
797 |
}
|
|
798 |
if (!iUiUtility->IsExitingState() && (iShwState != EShwExiting))
|
|
799 |
{
|
|
800 |
iShwState = EShwPause;
|
|
801 |
ReplaceCommandSetL(R_SHW_SOFTKEYS_END_CONTINUE,
|
|
802 |
R_SHW_SOFTKEYS_END_PAUSE);
|
|
803 |
ShowShwFurnitureL();
|
|
804 |
}
|
|
805 |
}
|
|
806 |
|
|
807 |
// ---------------------------------------------------------------------------
|
|
808 |
// From MShwEngineObserver
|
|
809 |
// Engine resumed callback.
|
|
810 |
// ---------------------------------------------------------------------------
|
|
811 |
//
|
|
812 |
void CShwSlideshowView::EngineResumedL()
|
|
813 |
{
|
|
814 |
TRACER("CShwSlideshowView::EngineResumedL");
|
|
815 |
GLX_LOG_INFO( "CShwSlideshowView::EngineResumedL" );
|
|
816 |
iEngine->GetMusicVolumeL();
|
|
817 |
// Re-enable the backlight if it's off
|
|
818 |
if (!iBackLightTimer->IsRunning())
|
|
819 |
{
|
|
820 |
iBackLightTimer->StartL();
|
|
821 |
}
|
|
822 |
if (iShwState != EShwExiting)
|
|
823 |
{
|
|
824 |
iShwState = EShwPlay;
|
|
825 |
ReplaceCommandSetL(R_SHW_SOFTKEYS_END_PAUSE,
|
|
826 |
R_SHW_SOFTKEYS_END_CONTINUE);
|
|
827 |
ShowShwFurnitureL();
|
|
828 |
}
|
|
829 |
}
|
|
830 |
// ---------------------------------------------------------------------------
|
|
831 |
// From MShwEngineObserver
|
|
832 |
// Engine LSK Pressed
|
|
833 |
// ---------------------------------------------------------------------------
|
|
834 |
//
|
|
835 |
void CShwSlideshowView::EngineLSKPressedL()
|
|
836 |
{
|
|
837 |
TRACER("CShwSlideshowView::EngineLSKPressedL");
|
|
838 |
GLX_LOG_INFO( "CShwSlideshowView::EngineLSKPressedL" );
|
|
839 |
iLSKPressed = ETrue;
|
|
840 |
iPauseHandler->UserToggledPauseL();
|
|
841 |
}
|
|
842 |
// ---------------------------------------------------------------------------
|
|
843 |
// From MShwEngineObserver
|
|
844 |
// Engine Toggle Ui callback.EngineLSKPressedL
|
|
845 |
// ---------------------------------------------------------------------------
|
|
846 |
//
|
|
847 |
void CShwSlideshowView::EngineToggleUiStateL()
|
|
848 |
{
|
|
849 |
TRACER("CShwSlideshowView::EngineToggleUiStateL");
|
|
850 |
GLX_LOG_INFO( "CShwSlideshowView::EngineToggleUiStateL" );
|
|
851 |
iMSKPressed = ETrue;
|
|
852 |
if(iShwFurniture == EFurnitureVisible)
|
|
853 |
{
|
|
854 |
HideShwFurniture();
|
|
855 |
}
|
|
856 |
else
|
|
857 |
{
|
|
858 |
ShowShwFurnitureL();
|
|
859 |
}
|
|
860 |
}
|
|
861 |
|
|
862 |
// ---------------------------------------------------------------------------
|
|
863 |
// From MShwEngineObserver
|
|
864 |
// Engine encountered an error and we need to exit.
|
|
865 |
// ---------------------------------------------------------------------------
|
|
866 |
void CShwSlideshowView::ErrorDuringSlideshowL()
|
|
867 |
{
|
|
868 |
TRACER("CShwSlideshowView::ErrorDuringSlideshowL");
|
|
869 |
GLX_LOG_INFO( "CShwSlideshowView::ErrorDuringSlideshowL" );
|
|
870 |
iEngineStartFailed = ETrue;
|
|
871 |
// need to dismiss the dialog if it's still there
|
|
872 |
if( iWaitDialog )
|
|
873 |
{
|
|
874 |
iWaitDialog->ProcessFinishedL();
|
|
875 |
}
|
|
876 |
else
|
|
877 |
{
|
|
878 |
ProcessCommandL( EAknSoftkeyBack );
|
|
879 |
}
|
|
880 |
}
|
|
881 |
|
|
882 |
// -----------------------------------------------------------------------------
|
|
883 |
// From MShwMusicObserver
|
|
884 |
// MusicOn.
|
|
885 |
// -----------------------------------------------------------------------------
|
|
886 |
void CShwSlideshowView::MusicOnL()
|
|
887 |
{
|
|
888 |
TRACER("CShwSlideshowView::MusicOnL");
|
|
889 |
GLX_LOG_INFO( "CShwSlideshowView::MusicOnL" );
|
|
890 |
// Turn on the keypad tones
|
|
891 |
AppUi()->KeySounds()->PushContextL( R_AVKON_SILENT_SKEY_LIST );
|
|
892 |
// if MusicOn leaves, MusicOff will get called
|
|
893 |
// initialize the medikey control only if music is on.
|
|
894 |
// delayed initialization intended
|
|
895 |
// since there is a conflict if slideshow is launched from full screen
|
|
896 |
iMediaKeyHandler = CShwMediaKeyUtility::NewL();
|
|
897 |
}
|
|
898 |
|
|
899 |
// -----------------------------------------------------------------------------
|
|
900 |
// From MShwMusicObserver
|
|
901 |
// MusicOff.
|
|
902 |
// -----------------------------------------------------------------------------
|
|
903 |
void CShwSlideshowView::MusicOff()
|
|
904 |
{
|
|
905 |
TRACER("CShwSlideshowView::MusicOff");
|
|
906 |
GLX_LOG_INFO( "CShwSlideshowView::MusicOff" );
|
|
907 |
//
|
|
908 |
TInt resource_id = AppUi()->KeySounds()->TopContext();
|
|
909 |
if( R_AVKON_SILENT_SKEY_LIST == resource_id )
|
|
910 |
{
|
|
911 |
// Turn off the keypad tones
|
|
912 |
AppUi()->KeySounds()->PopContext();
|
|
913 |
}
|
|
914 |
|
|
915 |
// If it's visible, hide the volume control
|
|
916 |
iDisplay->Roster().Hide( *iVolumeControlGroup );
|
|
917 |
//delete the media key handler
|
|
918 |
if(iMediaKeyHandler)
|
|
919 |
{
|
|
920 |
delete iMediaKeyHandler;
|
|
921 |
iMediaKeyHandler = NULL;
|
|
922 |
}
|
|
923 |
}
|
|
924 |
|
|
925 |
// -----------------------------------------------------------------------------
|
|
926 |
// From MShwMusicObserver
|
|
927 |
// MusicVolume.
|
|
928 |
// -----------------------------------------------------------------------------
|
|
929 |
void CShwSlideshowView::MusicVolumeL(TInt aCurrentVolume, TInt aMaxVolume)
|
|
930 |
{
|
|
931 |
TRACER("CShwSlideshowView::MusicVolume");
|
|
932 |
GLX_LOG_INFO( "CShwSlideshowView::MusicVolume" );
|
|
933 |
if (aCurrentVolume != iCurrentVolume)
|
|
934 |
{
|
|
935 |
// Store the changed value
|
|
936 |
iCurrentVolume = aCurrentVolume;
|
|
937 |
iVolumeControl->SetVolume(aCurrentVolume, aMaxVolume);
|
|
938 |
}
|
|
939 |
// Always show the control even if the volume hasn't changed, e.g. @ 100%
|
|
940 |
iVolumeControl->RefreshL();
|
|
941 |
}
|
|
942 |
|
|
943 |
// -----------------------------------------------------------------------------
|
|
944 |
// From MShwMusicObserver
|
|
945 |
// ErrorWithTrackL.
|
|
946 |
// -----------------------------------------------------------------------------
|
|
947 |
void CShwSlideshowView::ErrorWithTrackL( TInt /*aErrorCode*/ )
|
|
948 |
{
|
|
949 |
TRACER("CShwSlideshowView::ErrorWithTrackL");
|
|
950 |
// we dont use the error code as any kind of error with track file
|
|
951 |
// means we cannot play it.
|
|
952 |
// set the music to off if there was an error in track (file missing etc)
|
|
953 |
// this way the user gets notification only once
|
|
954 |
// ER: EMSR-77PCSJ
|
|
955 |
CShwSettingsModel* shwSettingsMdl = CShwSettingsModel::NewL();
|
|
956 |
CleanupStack::PushL( shwSettingsMdl );
|
|
957 |
shwSettingsMdl->SaveMusicStateL( EFalse );
|
|
958 |
CleanupStack::PopAndDestroy( shwSettingsMdl );
|
|
959 |
|
|
960 |
// Display the error note
|
|
961 |
HBufC* noteBuf = StringLoader::LoadLC(
|
|
962 |
R_SHW_QTN_LGAL_NOTE_SLIDESHOW_DEFINE );
|
|
963 |
CAknInformationNote* note = new (ELeave) CAknInformationNote;
|
|
964 |
CleanupStack::Pop( noteBuf );
|
|
965 |
note->ExecuteLD( *noteBuf );
|
|
966 |
}
|
|
967 |
|
|
968 |
// -----------------------------------------------------------------------------
|
|
969 |
// From MProgressDialogCallback
|
|
970 |
// Gets called when a dialog is dismissed.
|
|
971 |
// -----------------------------------------------------------------------------
|
|
972 |
void CShwSlideshowView::DialogDismissedL( TInt aButtonId )
|
|
973 |
{
|
|
974 |
TRACER("CShwSlideshowView::DialogDismissedL");
|
|
975 |
GLX_LOG_INFO( "CShwSlideshowView::DialogDismissedL" );
|
|
976 |
if ( iEngineStartFailed || aButtonId == EEikBidCancel )
|
|
977 |
{
|
|
978 |
// Cancel the callback
|
|
979 |
iAsyncCallBack->Cancel();
|
|
980 |
// Send the back command to return to the previous view
|
|
981 |
ProcessCommandL( EAknSoftkeyBack );
|
|
982 |
}
|
|
983 |
}
|
|
984 |
|
|
985 |
// -----------------------------------------------------------------------------
|
|
986 |
// SetupScreenFurnitureL.
|
|
987 |
// -----------------------------------------------------------------------------
|
|
988 |
void CShwSlideshowView::SetupScreenFurnitureL()
|
|
989 |
{
|
|
990 |
TRACER("CShwSlideshowView::SetupScreenFurnitureL");
|
|
991 |
GLX_LOG_INFO( "CShwSlideshowView::SetupScreenFurnitureL" );
|
|
992 |
// Create the soft keys
|
|
993 |
// Left (bottom in landscape orientation)
|
|
994 |
HBufC* softKeyTextLeft = StringLoader::LoadLC( R_SHW_SOFTKEY_LEFT );
|
|
995 |
CleanupStack::Pop( softKeyTextLeft );
|
|
996 |
// Right (top in landscape orientation)
|
|
997 |
HBufC* softKeyTextRight = StringLoader::LoadLC( R_SHW_SOFTKEY_RIGHT );
|
|
998 |
CleanupStack::Pop( softKeyTextRight );
|
|
999 |
|
|
1000 |
}
|
|
1001 |
|
|
1002 |
// -----------------------------------------------------------------------------
|
|
1003 |
// GetPathAndPlaybackDirectionL
|
|
1004 |
// -----------------------------------------------------------------------------
|
|
1005 |
void CShwSlideshowView::GetPathAndPlaybackDirectionL( const TDesC8& aData )
|
|
1006 |
{
|
|
1007 |
TRACER("CShwSlideshowView::GetPathAndPlaybackDirectionL");
|
|
1008 |
GLX_LOG_INFO( "CShwSlideshowView::GetPathAndPlaybackDirectionL" );
|
|
1009 |
// reset state flags for list population
|
|
1010 |
iInputListReady = iPlayListReady = EFalse;
|
|
1011 |
|
|
1012 |
// Create a copy of the media list using the path and the play direction
|
|
1013 |
RDesReadStream stream( aData );
|
|
1014 |
CleanupClosePushL( stream );
|
|
1015 |
stream.ReadInt32L();
|
|
1016 |
|
|
1017 |
//Get the play direction.
|
|
1018 |
CShwSettingsModel* shwSettingsMdl = CShwSettingsModel::NewL();
|
|
1019 |
CleanupStack::PushL(shwSettingsMdl);
|
|
1020 |
iPlayDirection
|
|
1021 |
= static_cast<NShwSlideshow::TPlayDirection> (shwSettingsMdl->PlayOrderL());
|
|
1022 |
CleanupStack::PopAndDestroy( shwSettingsMdl );
|
|
1023 |
|
|
1024 |
// Retrieve the path
|
|
1025 |
iCollectionPath = CMPXCollectionPath::NewL();
|
|
1026 |
iCollectionPath->InternalizeL( stream );
|
|
1027 |
// Create the media list from the path
|
|
1028 |
iMediaList = MGlxMediaList::InstanceL( *iCollectionPath );
|
|
1029 |
// the list might be already populated
|
|
1030 |
if( iMediaList->IsPopulated() )
|
|
1031 |
{
|
|
1032 |
iInputListReady = ETrue;
|
|
1033 |
// list is ready so read the selection and filter already now
|
|
1034 |
// need to do this while on DoViewActivateL as the previous view
|
|
1035 |
// may loose the selection while it is closing
|
|
1036 |
PopulateListL();
|
|
1037 |
}
|
|
1038 |
else
|
|
1039 |
{
|
|
1040 |
// add us as an observer for the input list as well
|
|
1041 |
// we cannot read the path and filter before the list is populated
|
|
1042 |
iMediaList->AddMediaListObserverL( this );
|
|
1043 |
}
|
|
1044 |
|
|
1045 |
CleanupStack::PopAndDestroy( &stream );
|
|
1046 |
}
|
|
1047 |
|
|
1048 |
// -----------------------------------------------------------------------------
|
|
1049 |
// SetListFocusL.
|
|
1050 |
// -----------------------------------------------------------------------------
|
|
1051 |
void CShwSlideshowView::SetListFocusL()
|
|
1052 |
{
|
|
1053 |
TRACER("CShwSlideshowView::SetListFocusL");
|
|
1054 |
GLX_LOG_INFO("CShwSlideshowView::SetListFocusL");
|
|
1055 |
// Ensure that we start the slideshow from the correct image index:
|
|
1056 |
// if there are any selected images we always start from the first one,
|
|
1057 |
// otherwise we try to use the item with focus from the unfiltered list
|
|
1058 |
// so long as it hasn't been filtered out, in which case we use the first image.
|
|
1059 |
TInt selectionCount = iCollectionPath->Selection().Count();
|
|
1060 |
TInt focusIndex = 0;
|
|
1061 |
if (selectionCount == 0)
|
|
1062 |
{
|
|
1063 |
|
|
1064 |
// nothing selected, so determine which item has focus in the original list
|
|
1065 |
focusIndex = iMediaList->FocusIndex();
|
|
1066 |
GLX_LOG_INFO1("SlideshowView::SetListFocusL focusIndex(%d)", focusIndex);
|
|
1067 |
|
|
1068 |
const TGlxMedia& mediaItem = iMediaList->Item(focusIndex);
|
|
1069 |
// Check if this item is in the filtered list
|
|
1070 |
TGlxIdSpaceId spaceId = iMediaList->IdSpaceId(focusIndex);
|
|
1071 |
focusIndex = iFilteredList->Index(spaceId, mediaItem.Id());
|
|
1072 |
if (focusIndex == KErrNotFound)
|
|
1073 |
{
|
|
1074 |
focusIndex = ((iPlayDirection == NShwSlideshow::EPlayBackwards)
|
|
1075 |
? 0 : iFilteredList->Count() - 1);
|
|
1076 |
}
|
|
1077 |
}
|
|
1078 |
iFilteredList->SetFocusL(NGlxListDefs::EAbsolute, focusIndex);
|
|
1079 |
}
|
|
1080 |
|
|
1081 |
|
|
1082 |
// -----------------------------------------------------------------------------
|
|
1083 |
// HandleTickL.
|
|
1084 |
// act on timer expiry
|
|
1085 |
// -----------------------------------------------------------------------------
|
|
1086 |
//
|
|
1087 |
void CShwSlideshowView::HandleTickL()
|
|
1088 |
{
|
|
1089 |
TRACER("CShwSlideshowView::HandleTickL");
|
|
1090 |
GLX_LOG_INFO( "CShwSlideshowView::HandleTickL" );
|
|
1091 |
if(iShwFurniture != EFurnitureVisible)
|
|
1092 |
{
|
|
1093 |
ShowShwFurnitureL();
|
|
1094 |
}
|
|
1095 |
else
|
|
1096 |
{
|
|
1097 |
HideShwFurniture();
|
|
1098 |
}
|
|
1099 |
}
|
|
1100 |
|
|
1101 |
// -----------------------------------------------------------------------------
|
|
1102 |
// HandleTickCancelled.
|
|
1103 |
// act on timer cancelled
|
|
1104 |
// -----------------------------------------------------------------------------
|
|
1105 |
//
|
|
1106 |
void CShwSlideshowView::HandleTickCancelled()
|
|
1107 |
{
|
|
1108 |
TRACER("CShwSlideshowView::HandleTickCancelled()");
|
|
1109 |
}
|
|
1110 |
|
|
1111 |
// -----------------------------------------------------------------------------
|
|
1112 |
// HandleShwGestureEventL.
|
|
1113 |
// act on gestures
|
|
1114 |
// -----------------------------------------------------------------------------
|
|
1115 |
//
|
|
1116 |
void CShwSlideshowView::HandleShwGestureEventL(MShwGestureObserver::TShwGestureEventType aType)
|
|
1117 |
{
|
|
1118 |
TRACER("CShwSlideshowView::HandleShwGestureEventL");
|
|
1119 |
GLX_LOG_INFO( "CShwSlideshowView::HandleShwGestureEventL" );
|
|
1120 |
|
|
1121 |
// If there is no Engine, the vehicle is handicapped and there is no way to know
|
|
1122 |
// whether it is possible for it to PROPERLY respond to events.
|
|
1123 |
// So it is safer to not do so.
|
|
1124 |
if (NULL == iEngine)
|
|
1125 |
{
|
|
1126 |
return ;
|
|
1127 |
}
|
|
1128 |
|
|
1129 |
iTicker->CancelTicking();
|
|
1130 |
switch(aType)
|
|
1131 |
{
|
|
1132 |
case ETapEvent:
|
|
1133 |
{
|
|
1134 |
if(iShwFurniture == EFurnitureVisible)
|
|
1135 |
{
|
|
1136 |
HideShwFurniture();
|
|
1137 |
}
|
|
1138 |
else
|
|
1139 |
{
|
|
1140 |
ShowShwFurnitureL();
|
|
1141 |
}
|
|
1142 |
break;
|
|
1143 |
}
|
|
1144 |
case ESwipeLeft:
|
|
1145 |
{
|
|
1146 |
iEngine->NextItemL();
|
|
1147 |
break;
|
|
1148 |
}
|
|
1149 |
case ESwipeRight:
|
|
1150 |
{
|
|
1151 |
iEngine->PreviousItemL();
|
|
1152 |
break;
|
|
1153 |
}
|
|
1154 |
default:
|
|
1155 |
{
|
|
1156 |
break;
|
|
1157 |
}
|
|
1158 |
}
|
|
1159 |
}
|
|
1160 |
// -----------------------------------------------------------------------------
|
|
1161 |
// InitializeShwFurnitureL.
|
|
1162 |
// set sof keys and the volume slider
|
|
1163 |
// -----------------------------------------------------------------------------
|
|
1164 |
//
|
|
1165 |
void CShwSlideshowView::InitializeShwFurnitureL()
|
|
1166 |
{
|
|
1167 |
TRACER("CShwSlideshowView::InitializeShwFurnitureL");
|
|
1168 |
GLX_LOG_INFO( "CShwSlideshowView::InitializeShwFurnitureL" );
|
|
1169 |
// initialize softkeys
|
|
1170 |
InitializeCbaL();
|
|
1171 |
}
|
|
1172 |
|
|
1173 |
// -----------------------------------------------------------------------------
|
|
1174 |
// InitializeCbaL.
|
|
1175 |
// set sof keys
|
|
1176 |
// -----------------------------------------------------------------------------
|
|
1177 |
//
|
|
1178 |
void CShwSlideshowView::InitializeCbaL()
|
|
1179 |
{
|
|
1180 |
TRACER("CShwSlideshowView::InitializeCbaL");
|
|
1181 |
GLX_LOG_INFO( "CShwSlideshowView::InitializeCbaL" );
|
|
1182 |
// initialize with the end-pause command set as that is the one
|
|
1183 |
// we are supposed to show immediately on slideshow play
|
|
1184 |
// orientation: set to Vertical as slide show is always intended to
|
|
1185 |
// run in landscape mode
|
|
1186 |
iShwCba = CEikButtonGroupContainer::NewL(
|
|
1187 |
CEikButtonGroupContainer::ECba,
|
|
1188 |
CEikButtonGroupContainer::EVertical,
|
|
1189 |
this, R_SHW_SOFTKEYS_END_PAUSE );
|
|
1190 |
iShwCba->MakeVisible(EFalse);
|
|
1191 |
}
|
|
1192 |
|
|
1193 |
// -----------------------------------------------------------------------------
|
|
1194 |
// ReplaceCommandSetL.
|
|
1195 |
// replaces a commandset with a new one
|
|
1196 |
// -----------------------------------------------------------------------------
|
|
1197 |
//
|
|
1198 |
void CShwSlideshowView::ReplaceCommandSetL(TInt aNewComandId, TInt aOldCommandSet)
|
|
1199 |
{
|
|
1200 |
TRACER("CShwSlideshowView::ReplaceCommandSetL");
|
|
1201 |
GLX_LOG_INFO( "CShwSlideshowView::ReplaceCommandSetL" );
|
|
1202 |
//find and remove the command set
|
|
1203 |
TInt pos = iShwCba->PositionById( aOldCommandSet );
|
|
1204 |
if( pos != KErrNotFound )
|
|
1205 |
{
|
|
1206 |
iShwCba->RemoveCommandFromStack( pos, aOldCommandSet );
|
|
1207 |
}
|
|
1208 |
// set the new command set
|
|
1209 |
iShwCba->SetCommandSetL( aNewComandId );
|
|
1210 |
}
|
|
1211 |
|
|
1212 |
|
|
1213 |
// -----------------------------------------------------------------------------
|
|
1214 |
// HideShwFurnitureL.
|
|
1215 |
// hide softkeys and the volume slider
|
|
1216 |
// -----------------------------------------------------------------------------
|
|
1217 |
//
|
|
1218 |
void CShwSlideshowView::HideShwFurniture()
|
|
1219 |
{
|
|
1220 |
TRACER("CShwSlideshowView::HideShwFurnitureL");
|
|
1221 |
GLX_LOG_INFO( "CShwSlideshowView::HideShwFurnitureL" );
|
|
1222 |
iTicker->CancelTicking();
|
|
1223 |
iShwCba->MakeVisible(EFalse);
|
|
1224 |
iShwCba->DrawNow();
|
|
1225 |
if(iMediaKeyHandler)
|
|
1226 |
{
|
|
1227 |
iVolumeControl->Hide();
|
|
1228 |
}
|
|
1229 |
iShwFurniture = EFurnitureHidden;
|
|
1230 |
}
|
|
1231 |
|
|
1232 |
// -----------------------------------------------------------------------------
|
|
1233 |
// ShowShwFurnitureL.
|
|
1234 |
// show softkeys and the volume slider
|
|
1235 |
// -----------------------------------------------------------------------------
|
|
1236 |
//
|
|
1237 |
void CShwSlideshowView::ShowShwFurnitureL()
|
|
1238 |
{
|
|
1239 |
TRACER("CShwSlideshowView::ShowShwFurnitureL");
|
|
1240 |
GLX_LOG_INFO( "CShwSlideshowView::ShowShwFurnitureL" );
|
|
1241 |
iTicker->CancelTicking();
|
|
1242 |
iShwCba->MakeVisible(ETrue);
|
|
1243 |
iShwCba->DrawNow();
|
|
1244 |
if(iMediaKeyHandler)
|
|
1245 |
{
|
|
1246 |
iVolumeControl->ShowControlL();
|
|
1247 |
}
|
|
1248 |
iShwFurniture = EFurnitureVisible;
|
|
1249 |
//start the timer to keep the up the screen furniture for 5 seconds
|
|
1250 |
iTicker->StartTicking(KShowForSeconds);
|
|
1251 |
}
|
|
1252 |
|
|
1253 |
// -----------------------------------------------------------------------------
|
|
1254 |
// ProcessCommandL.
|
|
1255 |
// handle softkey events
|
|
1256 |
// -----------------------------------------------------------------------------
|
|
1257 |
//
|
|
1258 |
void CShwSlideshowView::ProcessCommandL(TInt aCommandId)
|
|
1259 |
{
|
|
1260 |
TRACER("CShwSlideshowView::ProcessCommandL");
|
|
1261 |
GLX_LOG_INFO( "CShwSlideshowView::ProcessCommandL" );
|
|
1262 |
switch (aCommandId)
|
|
1263 |
{
|
|
1264 |
case EShwSlideshowCmdEnd:
|
|
1265 |
case EAknSoftkeyBack:
|
|
1266 |
case EGlxCmdResetView:
|
|
1267 |
{
|
|
1268 |
iShwState = EShwExiting;
|
|
1269 |
iDisplay->Roster().Hide(*iGestureControlGroup);
|
|
1270 |
HideShwFurniture();
|
|
1271 |
if (aCommandId == EShwSlideshowCmdEnd)
|
|
1272 |
{
|
|
1273 |
aCommandId = EAknSoftkeyBack;
|
|
1274 |
}
|
|
1275 |
break;
|
|
1276 |
}
|
|
1277 |
//When user presses MSK or LSK this cmd will Generated
|
|
1278 |
case EShwSlideshowCmdPause:
|
|
1279 |
case EShwSlideshowCmdContinue:
|
|
1280 |
{
|
|
1281 |
// If MSK preesed to toggle visibility of softekey
|
|
1282 |
if (iMSKPressed)
|
|
1283 |
{
|
|
1284 |
iMSKPressed = EFalse;
|
|
1285 |
}
|
|
1286 |
else if (iLSKPressed)
|
|
1287 |
{
|
|
1288 |
iLSKPressed = EFalse;// Already Handlled
|
|
1289 |
}
|
|
1290 |
else
|
|
1291 |
{
|
|
1292 |
iPauseHandler->UserToggledPauseL();
|
|
1293 |
}
|
|
1294 |
break;
|
|
1295 |
}
|
|
1296 |
default:
|
|
1297 |
{
|
|
1298 |
break;
|
|
1299 |
}
|
|
1300 |
}
|
|
1301 |
CGlxViewBase::ProcessCommandL(aCommandId);
|
|
1302 |
}
|
|
1303 |
// -----------------------------------------------------------------------------
|
|
1304 |
// Set the image to external display - HDMI
|
|
1305 |
// -----------------------------------------------------------------------------
|
|
1306 |
//
|
|
1307 |
void CShwSlideshowView::SetItemToHDMIL()
|
|
1308 |
{
|
|
1309 |
TRACER("CShwSlideshowView::SetImageToHDMIL() ");
|
|
1310 |
|
|
1311 |
TInt focusIndex = iFilteredList->FocusIndex();
|
|
1312 |
TInt nextIndex = GetNextIndex();
|
|
1313 |
|
|
1314 |
// If we dont know what item we are focussing on
|
|
1315 |
// or if our filtered list is empty
|
|
1316 |
// or if HDMI is not connected
|
|
1317 |
// or if there is no HDMI Controller at all
|
|
1318 |
// then dont SetImageToHDMI :)
|
|
1319 |
if( ( KErrNotFound == focusIndex)
|
|
1320 |
|| (0 == iFilteredList->Count())
|
|
1321 |
|| (NULL == iHdmiController))
|
|
1322 |
{
|
|
1323 |
GLX_LOG_INFO("CShwSlideshowView::SetImageToHDMIL - Cant Set Image To HDMI");
|
|
1324 |
return;
|
|
1325 |
}
|
|
1326 |
|
|
1327 |
TGlxMedia item = iFilteredList->Item(focusIndex);
|
|
1328 |
TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties(),
|
|
1329 |
KGlxMediaIdThumbnail);
|
|
1330 |
TGlxMedia nextItem = iFilteredList->Item(nextIndex);
|
|
1331 |
TInt nexterror = GlxErrorManager::HasAttributeErrorL(nextItem.Properties(),
|
|
1332 |
KGlxMediaIdThumbnail);
|
|
1333 |
|
|
1334 |
// Item will be supported by HDMI ONLY if
|
|
1335 |
// it is not a video
|
|
1336 |
// and it has no attribute error
|
|
1337 |
if ( (item.Category() != EMPXVideo)
|
|
1338 |
&& (error == KErrNone) )
|
|
1339 |
{
|
|
1340 |
GLX_LOG_INFO("CShwSlideshowView::SetImageToHDMIL - CGlxHdmi - Fetch FS thumbnail");
|
|
1341 |
TMPXAttribute fsTnAttrib = TMPXAttribute(KGlxMediaIdThumbnail,
|
|
1342 |
GlxFullThumbnailAttributeId(ETrue, iScrnSize.iWidth,
|
|
1343 |
iScrnSize.iHeight));
|
|
1344 |
const CGlxThumbnailAttribute* fsValue = item.ThumbnailAttribute(
|
|
1345 |
fsTnAttrib);
|
|
1346 |
if (fsValue)
|
|
1347 |
{
|
|
1348 |
GLX_LOG_INFO("CShwSlideshowView::SetImageToHDMIL - CGlxHdmi - Setting FS Bitmap");
|
|
1349 |
CFbsBitmap* fsBitmap = new (ELeave) CFbsBitmap;
|
|
1350 |
CleanupStack::PushL(fsBitmap);
|
|
1351 |
fsBitmap->Duplicate( fsValue->iBitmap->Handle());
|
|
1352 |
|
|
1353 |
GLX_LOG_INFO2("CShwSlideshowView::SetImageToHDMIL - CGlxHdmi - FS Bitmap Size width=%d, height=%d",
|
|
1354 |
fsBitmap->SizeInPixels().iWidth, fsBitmap->SizeInPixels().iHeight);
|
|
1355 |
if(nexterror == KErrNone)
|
|
1356 |
{
|
|
1357 |
iHdmiController->SetImageL(item.Uri(), nextItem.Uri(), fsBitmap);
|
|
1358 |
}
|
|
1359 |
else
|
|
1360 |
{
|
|
1361 |
iHdmiController->SetImageL(item.Uri(), KNullDesC, fsBitmap);
|
|
1362 |
}
|
|
1363 |
CleanupStack::PopAndDestroy(fsBitmap);
|
|
1364 |
}
|
|
1365 |
else
|
|
1366 |
{
|
|
1367 |
GLX_LOG_INFO("CShwSlideshowView::SetImageToHDMIL - CGlxHdmi - Fetch Grid thumbnail");
|
|
1368 |
TMPXAttribute gridTnAttrib = TMPXAttribute(KGlxMediaIdThumbnail,
|
|
1369 |
GlxFullThumbnailAttributeId(ETrue, iGridIconSize.iWidth,
|
|
1370 |
iGridIconSize.iHeight));
|
|
1371 |
const CGlxThumbnailAttribute* gridvalue = item.ThumbnailAttribute(
|
|
1372 |
gridTnAttrib);
|
|
1373 |
|
|
1374 |
if (gridvalue)
|
|
1375 |
{
|
|
1376 |
GLX_LOG_INFO("CShwSlideshowView::SetImageToHDMIL - CGlxHdmi - Setting Grid Bitmap");
|
|
1377 |
CFbsBitmap* gridBitmap = new (ELeave) CFbsBitmap;
|
|
1378 |
CleanupStack::PushL(gridBitmap);
|
|
1379 |
gridBitmap->Duplicate( gridvalue->iBitmap->Handle());
|
|
1380 |
|
|
1381 |
GLX_LOG_INFO2("CShwSlideshowView::SetImageToHDMIL - CGlxHdmi - gridBitmap Size width=%d, height=%d",
|
|
1382 |
gridBitmap->SizeInPixels().iWidth, gridBitmap->SizeInPixels().iHeight);
|
|
1383 |
if(nexterror == KErrNone)
|
|
1384 |
{
|
|
1385 |
iHdmiController->SetImageL(item.Uri(), nextItem.Uri(), gridBitmap);
|
|
1386 |
}
|
|
1387 |
else
|
|
1388 |
{
|
|
1389 |
iHdmiController->SetImageL(item.Uri(), KNullDesC, gridBitmap);
|
|
1390 |
}
|
|
1391 |
CleanupStack::PopAndDestroy(gridBitmap);
|
|
1392 |
}
|
|
1393 |
else
|
|
1394 |
{
|
|
1395 |
GLX_LOG_INFO("CShwSlideshowView::SetImageToHDMIL - CGlxHdmi - Setting Null Bitmap");
|
|
1396 |
TFileName resFile(KDC_APP_BITMAP_DIR);
|
|
1397 |
resFile.Append(KGlxIconsFilename);
|
|
1398 |
CFbsBitmap* defaultBitmap = AknIconUtils::CreateIconL(resFile,
|
|
1399 |
EMbmGlxiconsQgn_prop_image_notcreated);
|
|
1400 |
CleanupStack::PushL(defaultBitmap);
|
|
1401 |
|
|
1402 |
// always need to setsize on the raw bitmap for it to be visible
|
|
1403 |
AknIconUtils::SetSize(defaultBitmap, TSize(iHdmiWidth,iHdmiHeight),EAspectRatioPreserved);
|
|
1404 |
|
|
1405 |
GLX_LOG_INFO2("CShwSlideshowView::SetImageToHDMIL - CGlxHdmi - Default Size width=%d, height=%d",
|
|
1406 |
defaultBitmap->SizeInPixels().iWidth, defaultBitmap->SizeInPixels().iHeight);
|
|
1407 |
if(nexterror == KErrNone)
|
|
1408 |
{
|
|
1409 |
iHdmiController->SetImageL(item.Uri(), nextItem.Uri(),
|
|
1410 |
defaultBitmap);
|
|
1411 |
}
|
|
1412 |
else
|
|
1413 |
{
|
|
1414 |
iHdmiController->SetImageL(item.Uri(), KNullDesC , defaultBitmap);
|
|
1415 |
}
|
|
1416 |
CleanupStack::PopAndDestroy(defaultBitmap);
|
|
1417 |
}
|
|
1418 |
}
|
|
1419 |
}
|
|
1420 |
else
|
|
1421 |
{
|
|
1422 |
GLX_LOG_INFO("CShwSlideshowView::SetImageToHDMIL - Unsupported Item");
|
|
1423 |
//Set the external display to cloning mode if
|
|
1424 |
//the current item is something we wont support (e.g. video, corrupted item)
|
|
1425 |
iHdmiController->ShiftToCloningMode();
|
|
1426 |
}
|
|
1427 |
}
|
|
1428 |
// ---------------------------------------------------------------------------
|
|
1429 |
//
|
|
1430 |
// Gets the index of the item for which the texture has to be removed
|
|
1431 |
// ---------------------------------------------------------------------------
|
|
1432 |
//
|
|
1433 |
TInt CShwSlideshowView::GetIndexToBeRemoved()
|
|
1434 |
{
|
|
1435 |
TRACER("CShwSlideshowView::GetIndexToBeRemoved");
|
|
1436 |
TInt indextoberemoved;
|
|
1437 |
TInt count = iFilteredList->Count();
|
|
1438 |
TInt focusIndex = iFilteredList->FocusIndex();
|
|
1439 |
if(iPlayDirection == NShwSlideshow::EPlayForwards)
|
|
1440 |
{
|
|
1441 |
indextoberemoved = focusIndex-KSlideShowIterator;
|
|
1442 |
if(indextoberemoved < 0)
|
|
1443 |
{
|
|
1444 |
indextoberemoved = count+indextoberemoved;
|
|
1445 |
}
|
|
1446 |
}
|
|
1447 |
else
|
|
1448 |
{
|
|
1449 |
indextoberemoved = focusIndex+KSlideShowIterator;
|
|
1450 |
if(indextoberemoved > count-1)
|
|
1451 |
{
|
|
1452 |
indextoberemoved = indextoberemoved-count;
|
|
1453 |
}
|
|
1454 |
}
|
|
1455 |
GLX_LOG_INFO1("CShwSlideshowView::GetIndexToBeRemoved Index to be removed is %d",indextoberemoved);
|
|
1456 |
return indextoberemoved;
|
|
1457 |
}
|
|
1458 |
// ---------------------------------------------------------------------------
|
|
1459 |
//
|
|
1460 |
// Remove the texture on every swipe while HDMI is connected.
|
|
1461 |
// ---------------------------------------------------------------------------
|
|
1462 |
//
|
|
1463 |
void CShwSlideshowView::RemoveTexture()
|
|
1464 |
{
|
|
1465 |
TRACER("CShwSlideshowView::RemoveTexture");
|
|
1466 |
const TGlxMedia& item = iFilteredList->Item(GetIndexToBeRemoved());
|
|
1467 |
iUiUtility->GlxTextureManager().RemoveTexture(item.Id(),EFalse);
|
|
1468 |
}
|
|
1469 |
|
|
1470 |
// ---------------------------------------------------------------------------
|
|
1471 |
//
|
|
1472 |
// HandleMMCInsertionL
|
|
1473 |
// ---------------------------------------------------------------------------
|
|
1474 |
//
|
|
1475 |
void CShwSlideshowView::HandleMMCInsertionL()
|
|
1476 |
{
|
|
1477 |
TRACER("CShwSlideshowView::HandleMMCInsertionL()");
|
|
1478 |
iMMCState = ETrue;
|
|
1479 |
iPrevNotInBackground = iIsForegrnd;
|
|
1480 |
if(iIsForegrnd)
|
|
1481 |
{
|
|
1482 |
ProcessCommandL(EAknSoftkeyClose);
|
|
1483 |
}
|
|
1484 |
}
|
|
1485 |
|
|
1486 |
// ---------------------------------------------------------------------------
|
|
1487 |
//
|
|
1488 |
// HandleMMCRemovalL
|
|
1489 |
// ---------------------------------------------------------------------------
|
|
1490 |
//
|
|
1491 |
void CShwSlideshowView::HandleMMCRemovalL()
|
|
1492 |
{
|
|
1493 |
TRACER("CShwSlideshowView::HandleMMCRemovalL()");
|
|
1494 |
ProcessCommandL(EAknSoftkeyExit);
|
|
1495 |
}
|
|
1496 |
|
|
1497 |
// ---------------------------------------------------------------------------
|
|
1498 |
//
|
|
1499 |
// HandleTvStatusChangedL
|
|
1500 |
// ---------------------------------------------------------------------------
|
|
1501 |
//
|
|
1502 |
void CShwSlideshowView::HandleTvStatusChangedL(TTvChangeType aChangeType )
|
|
1503 |
{
|
|
1504 |
TRACER("CShwSlideshowView::HandleTvStatusChangedL");
|
|
1505 |
// This is a common function for both HDMI ,TV-out and Headset disconnected.
|
|
1506 |
// (see CGlxTv::HandleTvConnectionStatusChangedL)
|
|
1507 |
if (aChangeType == EDisconnected)
|
|
1508 |
{
|
|
1509 |
GLX_LOG_INFO("CShwSlideshowView::HandleTvStatusChangedL- Acessory Not Connected");
|
|
1510 |
//Issue pause command if not already paused
|
|
1511 |
if (!iPauseHandler->IsSlideShowEngineStatePaused())
|
|
1512 |
{
|
|
1513 |
ProcessCommandL(EShwSlideshowCmdPause);
|
|
1514 |
}
|
|
1515 |
}
|
|
1516 |
|
|
1517 |
}
|
|
1518 |
|
|
1519 |
// ---------------------------------------------------------------------------
|
|
1520 |
// GetNextIndex
|
|
1521 |
// ---------------------------------------------------------------------------
|
|
1522 |
//
|
|
1523 |
TInt CShwSlideshowView::GetNextIndex()
|
|
1524 |
{
|
|
1525 |
TRACER("CShwSlideshowView::GetNextIndex");
|
|
1526 |
TInt count = iFilteredList->Count();
|
|
1527 |
TInt focusIndex = iFilteredList->FocusIndex();
|
|
1528 |
TInt nextIndex = focusIndex + 1;
|
|
1529 |
if (nextIndex > count - 1)
|
|
1530 |
{
|
|
1531 |
nextIndex = nextIndex - count;
|
|
1532 |
}
|
|
1533 |
GLX_LOG_INFO1("CShwSlideshowView::GetNextIndex-nextIndex:%d",nextIndex);
|
|
1534 |
return nextIndex;
|
|
1535 |
}
|
|
1536 |
|
|
1537 |
//---------------------------------------------------------------------------
|
|
1538 |
// From MGlxHDMIDecoderObserver
|
|
1539 |
// Handle notification of HDMI Image Decoder.
|
|
1540 |
//---------------------------------------------------------------------------
|
|
1541 |
void CShwSlideshowView::HandleHDMIDecodingEventL(THdmiDecodingStatus aStatus)
|
|
1542 |
{
|
|
1543 |
TRACER("CShwSlideshowView::HandleHDMIDecodingEventL()");
|
|
1544 |
iEngine->HandleHDMIDecodingEventL(aStatus);
|
|
1545 |
}
|
|
1546 |
// -------------------------------------------------------------------------------------------------
|
|
1547 |
// CShwSlideshowView::IsAppInForegroundL()
|
|
1548 |
// -------------------------------------------------------------------------------------------------
|
|
1549 |
//
|
|
1550 |
TBool CShwSlideshowView::IsAppInForegroundL()
|
|
1551 |
{
|
|
1552 |
TRACER("CShwSlideshowView::IsAppInForegroundL()");
|
|
1553 |
TBool ret = EFalse;
|
|
1554 |
CArrayFixFlat<TInt>* wgList = new (ELeave) CArrayFixFlat<TInt> (
|
|
1555 |
iEikonEnv->WsSession().NumWindowGroups());
|
|
1556 |
CleanupStack::PushL(wgList);
|
|
1557 |
if (iEikonEnv->WsSession().WindowGroupList(0, wgList) == KErrNone)
|
|
1558 |
{
|
|
1559 |
// Check if Photos App window group is in foreground
|
|
1560 |
ret = (iCoeEnv->RootWin().Identifier() == wgList->At(0));
|
|
1561 |
GLX_LOG_INFO2("SlideshowView::IsAppInForegroundL() ret=%d, wgId=%u",
|
|
1562 |
ret, wgList->At(0));
|
|
1563 |
}
|
|
1564 |
|
|
1565 |
CleanupStack::PopAndDestroy(wgList);
|
|
1566 |
return ret;
|
|
1567 |
}
|
|
1568 |
|
|
1569 |
// -------------------------------------------------------------------------------------------------
|
|
1570 |
// CShwSlideshowView::HandleWsEventL()
|
|
1571 |
// WS Events handling function
|
|
1572 |
// -------------------------------------------------------------------------------------------------
|
|
1573 |
//
|
|
1574 |
void CShwSlideshowView::HandleWsEventL(const TWsEvent& aEvent,
|
|
1575 |
CCoeControl* /*aDestination*/)
|
|
1576 |
{
|
|
1577 |
TRACER("CShwSlideshowView::HandleWsEventL()");
|
|
1578 |
TInt event = aEvent.Type();
|
|
1579 |
GLX_LOG_INFO1("CShwSlideshowView::HandleWsEventL() event=%d", event);
|
|
1580 |
|
|
1581 |
// If we are sent to full background, shift to cloning mode
|
|
1582 |
if ((event == KAknFullOrPartialForegroundLost) && !IsAppInForegroundL())
|
|
1583 |
{
|
|
1584 |
GLX_LOG_INFO("SlideshowView::HandleWsEventL() App is in background!");
|
|
1585 |
if (iHdmiController && iHdmiActive)
|
|
1586 |
{
|
|
1587 |
iHdmiController->ShiftToCloningMode();
|
|
1588 |
}
|
|
1589 |
// Something else has gained the foreground
|
|
1590 |
iPauseHandler->SwitchToBackgroundL();
|
|
1591 |
}
|
|
1592 |
}
|