author | Simon Howkins <simonh@symbian.org> |
Mon, 22 Nov 2010 16:50:40 +0000 | |
branch | RCL_3 |
changeset 44 | 87ee154df721 |
parent 41 | 755f0370535b |
permissions | -rw-r--r-- |
33 | 1 |
/* |
2 |
* Copyright (c) 2005 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: Application's UI class. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
#include "musuiclipsharingcontroller.h" |
|
21 |
#include "musuicallbackservice.h" |
|
22 |
#include "musuieventobserver.h" |
|
23 |
#include "musuisharingobserver.h" |
|
24 |
#include "musuisendobserver.h" |
|
25 |
#include "musuiclipsharingobserver.h" |
|
26 |
#include "musuidialogutil.h" |
|
27 |
#include "musengclipsession.h" |
|
28 |
#include "mussettings.h" |
|
29 |
#include "mussettingskeys.h" |
|
30 |
#include "musuiresourcehandler.h" |
|
31 |
#include "musui.hrh" |
|
32 |
#include "muslogger.h" // debug logging |
|
33 |
#include "musuiactivetimer.h" |
|
34 |
#include "musuigeneralview.h" |
|
35 |
||
36 |
#include <musui.rsg> |
|
37 |
#include <StringLoader.h> |
|
38 |
#include <AknUtils.h> |
|
39 |
||
40 |
#include <badesca.h> |
|
41 |
#include <avkon.hrh> |
|
42 |
||
43 |
// CONSTANTS |
|
44 |
const TInt KMusTimeToCloseAfterClipEndedStandard = 60 * 1000000; // 60 seconds |
|
45 |
const TInt KMusTimeToCloseAfterClipEndedOpVariant = 1 * 1000000; // 1 second |
|
46 |
||
47 |
// ----------------------------------------------------------------------------- |
|
48 |
// |
|
49 |
// ----------------------------------------------------------------------------- |
|
50 |
// |
|
51 |
CMusUiClipSharingController* CMusUiClipSharingController::NewL( |
|
52 |
MMusUiEventObserver& aEventObserver, |
|
53 |
MMusUiSharingObserver& aSharingObserver, |
|
54 |
MMusUiSendObserver& aSendObserver, |
|
55 |
MMusUiClipSharingObserver& aClipObserver, |
|
56 |
const TRect& aRect ) |
|
57 |
{ |
|
58 |
CMusUiClipSharingController* self = |
|
59 |
new( ELeave ) CMusUiClipSharingController( aEventObserver, |
|
60 |
aSharingObserver, |
|
61 |
aSendObserver, |
|
62 |
aClipObserver ); |
|
63 |
CleanupStack::PushL( self ); |
|
64 |
self->ConstructL( aRect ); |
|
65 |
CleanupStack::Pop( self ); |
|
66 |
return self; |
|
67 |
} |
|
68 |
||
69 |
||
70 |
// ----------------------------------------------------------------------------- |
|
71 |
// |
|
72 |
// ----------------------------------------------------------------------------- |
|
73 |
// |
|
74 |
CMusUiClipSharingController::~CMusUiClipSharingController() |
|
75 |
{ |
|
76 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::~CMusUiClipSharingController" ); |
|
77 |
delete iCloseTimer; |
|
78 |
DeleteEngineSession(); |
|
79 |
delete iFileName; |
|
80 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::~CMusUiClipSharingController" ); |
|
81 |
} |
|
82 |
||
83 |
||
84 |
// ----------------------------------------------------------------------------- |
|
85 |
// |
|
86 |
// ----------------------------------------------------------------------------- |
|
87 |
// |
|
88 |
CMusUiClipSharingController::CMusUiClipSharingController( |
|
89 |
MMusUiEventObserver& aEventObserver, |
|
90 |
MMusUiSharingObserver& aSharingObserver, |
|
91 |
MMusUiSendObserver& aSendObserver, |
|
92 |
MMusUiClipSharingObserver& aClipObserver ) |
|
93 |
:CMusUiSendController( aEventObserver, aSharingObserver, aSendObserver ), |
|
94 |
iClipObserver( aClipObserver ) |
|
95 |
{ |
|
96 |
} |
|
97 |
||
98 |
||
99 |
// ----------------------------------------------------------------------------- |
|
100 |
// |
|
101 |
// ----------------------------------------------------------------------------- |
|
102 |
// |
|
103 |
void CMusUiClipSharingController::ConstructL( const TRect& aRect ) |
|
104 |
{ |
|
105 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::ConstructL" ); |
|
106 |
||
107 |
CMusUiSendController::ConstructL(); // Base class construction |
|
108 |
||
109 |
iRect = aRect; |
|
110 |
iSession = CMusEngClipSession::NewL( iRect, |
|
111 |
*this, |
|
112 |
*this, |
|
113 |
*this, |
|
114 |
iSipProfileId ); |
|
115 |
iSession->SetAudioRoutingObserver( this ); |
|
116 |
iSession->SetVolumeChangeObserver( this ); |
|
117 |
||
118 |
if ( iSession->AudioRoutingCanBeChanged() && !iSession->IsAudioRoutingHeadset() ) |
|
119 |
{ |
|
120 |
iSession->EnableLoudspeakerL( ELoudspeakerEnabled, ETrue ); |
|
121 |
} |
|
122 |
||
123 |
if ( iVideoCodec && iVideoCodec->Length() > 0 ) |
|
124 |
{ |
|
125 |
iSession->SetSupportedVideoCodecListL( *iVideoCodec ); |
|
126 |
} |
|
127 |
||
128 |
iCallbackService->AsyncEventL( EMusUiAsyncStartMediaGallery ); |
|
129 |
||
130 |
iCloseTimer = CMusUiActiveTimer::NewL( this ); |
|
131 |
||
132 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::ConstructL" ); |
|
133 |
} |
|
134 |
||
135 |
||
136 |
// ----------------------------------------------------------------------------- |
|
137 |
// |
|
138 |
// ----------------------------------------------------------------------------- |
|
139 |
// |
|
140 |
void CMusUiClipSharingController::HandleAsyncEventL( TMusUiAsyncEvent aEventId ) |
|
141 |
{ |
|
142 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::HandleAsyncEventL" ); |
|
143 |
switch ( aEventId ) |
|
144 |
{ |
|
145 |
case EMusUiAsyncStartMediaGallery: |
|
146 |
{ |
|
147 |
iTranscode = EFalse; |
|
148 |
iTranscodingGoing = EFalse; |
|
149 |
||
150 |
if ( !iSession ) |
|
151 |
{ |
|
152 |
iSession = CMusEngClipSession::NewL( iRect, |
|
153 |
*this, |
|
154 |
*this, |
|
155 |
*this, |
|
156 |
iSipProfileId ); |
|
157 |
iSession->SetAudioRoutingObserver( this ); |
|
158 |
} |
|
159 |
||
160 |
// Do fetching guarded. If registration completes during fetching, |
|
161 |
// there is no need to do anything. |
|
162 |
iFileFetchingOngoing = ETrue; |
|
163 |
iClipObserver.RunFetchDialogL(); |
|
164 |
iFileFetchingOngoing = EFalse; |
|
165 |
||
166 |
TRAPD( error, |
|
167 |
iSession->SetClipL( *iFileName ) ) |
|
168 |
MUS_LOG_TDESC( "mus: [MUSUI ] File name: ", |
|
169 |
iFileName->Des() ) |
|
170 |
if ( error == KErrNone) |
|
171 |
{ |
|
172 |
if ( iSession->AudioRoutingCanBeChanged() ) |
|
173 |
{ |
|
174 |
iSession->EnableLoudspeakerL( ELoudspeakerEnabled, ETrue ); |
|
175 |
} |
|
176 |
iClipEnded = EFalse; |
|
177 |
StartInvitationL(); |
|
178 |
} |
|
179 |
else if ( error == KErrPermissionDenied ) |
|
180 |
{ |
|
181 |
MusUiDialogUtil::ShowInformationDialogL( |
|
182 |
R_MUS_VIEW_DRM_INFO_SEND_FORBID ); |
|
183 |
DeleteEngineSession(); |
|
184 |
delete iFileName; |
|
185 |
iFileName = NULL; |
|
186 |
iSession = CMusEngClipSession::NewL( iRect, |
|
187 |
*this, |
|
188 |
*this, |
|
189 |
*this, |
|
190 |
iSipProfileId ); |
|
191 |
iSession->SetAudioRoutingObserver( this ); |
|
192 |
if ( iSession->AudioRoutingCanBeChanged() ) |
|
193 |
{ |
|
194 |
iSession->EnableLoudspeakerL( ELoudspeakerEnabled, ETrue ); |
|
195 |
} |
|
196 |
iCallbackService->AsyncEventL( EMusUiAsyncStartMediaGallery ); |
|
197 |
} |
|
198 |
else |
|
199 |
{ |
|
200 |
HandleExitL(); |
|
201 |
} |
|
202 |
||
203 |
break; |
|
204 |
} |
|
205 |
case EMusUiAsyncStartTranscoding: |
|
206 |
{ |
|
207 |
// Parse Target Filename for the transcoding result |
|
208 |
// and start transcoding: |
|
209 |
//iSession->TranscodeL( VideoFileNameL() ); |
|
210 |
// Show progress dialog: |
|
211 |
//iObserver->ShowTranscodingProgressDialogL(); |
|
212 |
iTranscodingGoing = ETrue; |
|
213 |
break; |
|
214 |
} |
|
215 |
||
216 |
default: |
|
217 |
{ |
|
218 |
// Not clip specific, let the base class handle |
|
219 |
CMusUiSendController::HandleAsyncEventL( aEventId ); |
|
220 |
} |
|
221 |
} |
|
222 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::HandleAsyncEventL" ); |
|
223 |
} |
|
224 |
||
225 |
||
226 |
// ----------------------------------------------------------------------------- |
|
227 |
// |
|
228 |
// ----------------------------------------------------------------------------- |
|
229 |
// |
|
230 |
void CMusUiClipSharingController::DeleteEngineSession() |
|
231 |
{ |
|
232 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::DeleteEngineSession" ); |
|
233 |
||
234 |
CMusUiSendController::DeleteEngineSession(); |
|
235 |
// Cancel transcoding |
|
236 |
if ( iSession && iTranscodingGoing ) |
|
237 |
{ |
|
238 |
MUS_LOG( "mus: [MUSUI ] CMusUiClipSharingController::DeleteEngineSession:\ |
|
239 |
Canceling transcoding..." ); |
|
240 |
DismissWaitDialog(); |
|
241 |
TRAP_IGNORE( MusUiDialogUtil::ShowGlobalErrorDialogL( |
|
242 |
R_MUS_VIEW_NOTE_UNABLE_TO_CONVERT ); |
|
243 |
iSession->CancelTranscodeL() ); |
|
244 |
} |
|
245 |
if ( iSession && iSession->IsAudioRoutingLoudSpeaker() ) |
|
246 |
{ |
|
247 |
iShowDialog = ETrue; |
|
248 |
} |
|
249 |
delete iSession; |
|
250 |
iSession = NULL; |
|
251 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::DeleteEngineSession" ); |
|
252 |
} |
|
253 |
||
254 |
||
255 |
// ----------------------------------------------------------------------------- |
|
256 |
// |
|
257 |
// ----------------------------------------------------------------------------- |
|
258 |
// |
|
259 |
CMusEngMceOutSession* CMusUiClipSharingController::EngineOutSession() |
|
260 |
{ |
|
261 |
return iSession; // Clip session is CMusEngMceOutSession |
|
262 |
} |
|
263 |
||
264 |
||
265 |
// ----------------------------------------------------------------------------- |
|
266 |
// Handles status changes specific to sending sharing types. |
|
267 |
// Calls base class version for status changes that are not sending specific. |
|
268 |
// ----------------------------------------------------------------------------- |
|
269 |
// |
|
270 |
void CMusUiClipSharingController::HandleChangedStatusL( |
|
271 |
TMusAvailabilityStatus aStatus ) |
|
272 |
{ |
|
273 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::HandleChangedStatusL" ) |
|
274 |
||
275 |
switch( aStatus ) |
|
276 |
{ |
|
277 |
case EMultimediaSharingAvailable: |
|
278 |
{ |
|
279 |
MUS_LOG( "mus: [MUSUI ] EMultimediaSharingAvailable" ) |
|
280 |
||
281 |
if ( iSipRegistrationPending ) |
|
282 |
{ |
|
283 |
iSipRegistrationPending = EFalse; |
|
284 |
||
285 |
// If fecth dialog is still open, there is no need to do anything |
|
286 |
if ( !iFileFetchingOngoing ) |
|
287 |
{ |
|
288 |
iSipRegistrationPending = EFalse; |
|
289 |
// Set callback service, Call StartInvitationL when wait dialog dismissed |
|
290 |
TRAPD( err, iSharingObserver.SetWaitDialogCallbackL( |
|
291 |
&iWaitDialogCallback ) ); |
|
292 |
// Dismiss pending wait note |
|
293 |
iSharingObserver.DismissWaitDialogL(); |
|
294 |
if ( err == KErrNotReady ) |
|
295 |
{ |
|
296 |
StartInvitationL(); |
|
297 |
} |
|
298 |
} |
|
299 |
} |
|
300 |
break; |
|
301 |
} |
|
302 |
default: |
|
303 |
{ |
|
304 |
// Not clip specific, let the base class handle |
|
305 |
CMusUiSendController::HandleChangedStatusL( aStatus ); |
|
306 |
break; |
|
307 |
} |
|
308 |
} |
|
309 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::HandleChangedStatusL" ) |
|
310 |
} |
|
311 |
||
312 |
||
313 |
// ----------------------------------------------------------------------------- |
|
314 |
// |
|
315 |
// ----------------------------------------------------------------------------- |
|
316 |
// |
|
317 |
void CMusUiClipSharingController::InviteL( const TDesC& aRecipient ) |
|
318 |
{ |
|
319 |
MUS_LOG_TDESC( "mus: [MUSUI ] -> CMusUiClipSharingController::InviteL:", |
|
320 |
aRecipient ); |
|
321 |
||
322 |
// Registration must not be pending in this phase |
|
323 |
__ASSERT_ALWAYS( !iSipRegistrationPending, |
|
324 |
iEventObserver.HandleError( KErrNotReady ) ); |
|
325 |
||
326 |
delete iAddress; |
|
327 |
iAddress = NULL; |
|
328 |
iAddress = aRecipient.AllocL(); |
|
329 |
||
330 |
||
331 |
TBool inviteProceeding = DoInviteL(); |
|
332 |
if ( !inviteProceeding ) |
|
333 |
{ |
|
334 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::InviteL, invite failed" ); |
|
335 |
return; |
|
336 |
} |
|
337 |
if( iTranscode ) |
|
338 |
{ |
|
339 |
MUS_LOG( "mus: [MUSUI ] Starting transcode..." ); |
|
340 |
iTranscode = EFalse; |
|
341 |
||
342 |
// Start transcoding |
|
343 |
iTranscodingGoing = ETrue; |
|
344 |
||
345 |
SetFileNameL( VideoFileNameL() ); |
|
346 |
TRAPD( err, iSession->TranscodeL( *iFileName ) ); |
|
347 |
||
348 |
if ( err != KErrNone ) |
|
349 |
{ |
|
350 |
MUS_LOG1( "mus: [MUSUI ] Transcoding failed: %d", err ); |
|
351 |
iTranscodingGoing = EFalse; |
|
352 |
if ( iTranscodeDueUnknownRemoteCapas ) |
|
353 |
{ |
|
354 |
MUS_LOG( "mus: [MUSUI ] Retry invite without transcoding" ); |
|
355 |
// Still retry the clip without transcoding as other end might support current codec. |
|
356 |
iVideoToBeSaved = EFalse; |
|
357 |
inviteProceeding = DoInviteL(); |
|
358 |
} |
|
359 |
else if ( err == KErrNotFound ) // No Video Editor Engine |
|
360 |
{ |
|
361 |
MusUiDialogUtil::ShowGlobalErrorDialogL( |
|
362 |
R_MUS_LIVE_SHARING_VIEW_NOTE_TRANSCODING_NOT_SUPPORTED ); |
|
363 |
DeleteEngineSession(); |
|
364 |
iVideoToBeSaved = EFalse; |
|
365 |
HandleExitL(); |
|
366 |
inviteProceeding = EFalse; |
|
367 |
} |
|
368 |
else |
|
369 |
{ |
|
370 |
// Unable to convert clip, if transc. leaves. |
|
371 |
// After note return back to the media gallery. |
|
372 |
TranscodingFailed(); |
|
373 |
inviteProceeding = EFalse; |
|
374 |
} |
|
375 |
} |
|
376 |
else |
|
377 |
{ |
|
378 |
// Show progress dialog: |
|
379 |
iClipObserver.ShowTranscodingProgressDialogL(); |
|
380 |
inviteProceeding = EFalse; |
|
381 |
} |
|
382 |
} |
|
383 |
||
384 |
if ( inviteProceeding ) |
|
385 |
{ |
|
386 |
SetConnectionInitialized( ETrue ); |
|
387 |
ShowInvitingWaitDialogL(); |
|
388 |
} |
|
389 |
||
390 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::InviteL" ); |
|
391 |
} |
|
392 |
||
393 |
// ----------------------------------------------------------------------------- |
|
394 |
// |
|
395 |
// ----------------------------------------------------------------------------- |
|
396 |
// |
|
397 |
TBool CMusUiClipSharingController::DoInviteL() |
|
398 |
{ |
|
399 |
__ASSERT_ALWAYS( iAddress, User::Leave( KErrNotReady ) ); |
|
400 |
TRAPD( err, iSession->InviteL( *iAddress ) ); |
|
401 |
MUS_LOG( "mus: [MUSUI ] CMusUiClipSharingController::DoInviteL: After TRAPD" ); |
|
402 |
||
403 |
// If address is in wrong format, Manual Address Entry Dialog |
|
404 |
// is displayed |
|
405 |
if ( err != KErrNone ) |
|
406 |
{ |
|
407 |
DismissWaitDialog(); |
|
408 |
MusUiDialogUtil::ShowGlobalErrorDialogL( |
|
409 |
R_MUS_LIVE_SHARING_VIEW_NOTE_INVITE_ERROR ); |
|
410 |
if ( ( ++iTriedInvitations < 2 ) && ( err == KErrArgument ) ) |
|
411 |
{ |
|
412 |
MUS_LOG( "mus: [MUSUI ] CMusUiLiveSharingController::DoInviteL: iTriedInvitations < 2" ); |
|
413 |
iManualAddressTyped = ETrue; |
|
414 |
iResourceHandler->RequestKeypadL( ETrue ); |
|
415 |
||
416 |
// If the address has to be queried again...: |
|
417 |
iTranscode = EFalse; |
|
418 |
||
419 |
MUS_LOG_TDESC( "mus: [MUSUI ] CMusUiClipSharingController::DoInviteL: ", |
|
420 |
iFileName->Des() ) |
|
421 |
||
422 |
iSendObserver.ManualAddressEntryL( *iRemoteSipAddressProposal ); |
|
423 |
} |
|
424 |
else |
|
425 |
{ |
|
426 |
MUS_LOG( "mus: [MUSUI ] CMusUiLiveSharingController::DoInviteL: ++iTriedInvitations > 1" ); |
|
427 |
DeleteEngineSession(); |
|
428 |
HandleExitL(); |
|
429 |
} |
|
430 |
} |
|
431 |
return ( err == KErrNone ); |
|
432 |
} |
|
433 |
||
434 |
// ----------------------------------------------------------------------------- |
|
435 |
// |
|
436 |
// ----------------------------------------------------------------------------- |
|
437 |
// |
|
438 |
void CMusUiClipSharingController::HandleSliderValueChangeL( TInt aNewLevel ) |
|
439 |
{ |
|
440 |
MUS_LOG1( "mus: [MUSUI ] -> CMusUiClipSharingController::HandleSliderValueChangeL(%d)", |
|
441 |
aNewLevel ) |
|
442 |
||
443 |
__ASSERT_ALWAYS( !ExitOccured(), User::Leave( KErrDied ) ); |
|
444 |
__ASSERT_ALWAYS( iConnectionEstablished, User::Leave( KErrNotReady ) ); |
|
445 |
||
446 |
iSession->SetPositionL( TTimeIntervalSeconds( aNewLevel ) ); |
|
447 |
||
448 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::HandleSliderValueChangeL" ) |
|
449 |
} |
|
450 |
||
451 |
||
452 |
||
453 |
void CMusUiClipSharingController::OfferToolbarEventL( TInt aCommand ) |
|
454 |
{ |
|
455 |
MUS_LOG1( "mus: [MUSUI ] -> CMusUiClipSharingController::OfferToolbarEventL [%d]", |
|
456 |
aCommand ); |
|
457 |
||
458 |
switch ( aCommand ) |
|
459 |
{ |
|
460 |
case EMusuiCmdToolbarPause: |
|
461 |
{ |
|
462 |
HandleCommandL( EMusuiCmdViewPause ); |
|
463 |
iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarPause, |
|
464 |
EMusuiCmdToolbarUnPause, |
|
465 |
ETrue ); |
|
466 |
break; |
|
467 |
} |
|
468 |
case EMusuiCmdToolbarUnPause: |
|
469 |
{ |
|
470 |
HandleCommandL( EMusuiCmdViewContinue ); |
|
471 |
iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarUnPause, |
|
472 |
EMusuiCmdToolbarPause, |
|
473 |
ETrue ); |
|
474 |
break; |
|
475 |
} |
|
476 |
case EMusuiCmdToolbarFFRev: |
|
477 |
{ |
|
478 |
iToolbarFFRevSelected = !iToolbarFFRevSelected; |
|
479 |
iClipObserver.SetDurationValue( iSession->DurationL().Int() ); |
|
480 |
if ( iToolbarFFRevSelected ) |
|
481 |
{ |
|
482 |
iWasPlayingBeforeWinding = iSession->IsPlayingL(); |
|
483 |
PauseL(); |
|
484 |
} |
|
485 |
else |
|
486 |
{ |
|
487 |
StopWindingL(); |
|
488 |
if ( iWasPlayingBeforeWinding ) |
|
489 |
{ |
|
490 |
PlayL(); |
|
491 |
} |
|
492 |
} |
|
493 |
// iClipObserver.SetDurationVisible(); |
|
494 |
iSharingObserver.HighlightSelectedToolbarItem( EMusuiCmdToolbarFFRev ); |
|
495 |
break; |
|
496 |
} |
|
497 |
default: // Not clip specific, let the base class handle |
|
498 |
{ |
|
499 |
CMusUiEventController::OfferToolbarEventL( aCommand ); |
|
500 |
break; |
|
501 |
} |
|
502 |
} |
|
503 |
||
504 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::OfferToolbarEventL" ); |
|
505 |
} |
|
506 |
||
507 |
||
508 |
// ----------------------------------------------------------------------------- |
|
509 |
// |
|
510 |
// ----------------------------------------------------------------------------- |
|
511 |
// |
|
512 |
void CMusUiClipSharingController::HandleCommandL(TInt aCommand) |
|
513 |
{ |
|
514 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::HandleCommandL" ); |
|
515 |
||
516 |
__ASSERT_ALWAYS( !ExitOccured(), User::Leave( KErrDied ) ); |
|
517 |
||
518 |
switch ( aCommand ) |
|
519 |
{ |
|
520 |
case EMusuiCmdViewPause: |
|
521 |
{ |
|
522 |
PauseL(); |
|
523 |
iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconPause ); |
|
524 |
break; |
|
525 |
} |
|
526 |
case EMusuiCmdViewContinue: |
|
527 |
{ |
|
528 |
PlayL(); |
|
529 |
iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconPlay ); |
|
530 |
break; |
|
531 |
} |
|
532 |
||
533 |
case EMusuiCmdViewReplay: |
|
534 |
{ |
|
535 |
if( !MUS_NO_TOOLBAR ) |
|
536 |
{ |
|
537 |
if (!AknLayoutUtils::PenEnabled()) |
|
538 |
{ |
|
539 |
iEventObserver.SetToolbarVisibility( ETrue ); |
|
540 |
} |
|
541 |
||
542 |
if ( ClipEnded() ) |
|
543 |
{ |
|
544 |
iEventObserver.SetToolbarVisibility( ETrue ); |
|
545 |
// Simulate press of play in toolbar |
|
546 |
OfferToolbarEventL( EMusuiCmdToolbarUnPause ); |
|
547 |
} |
|
548 |
} |
|
549 |
break; |
|
550 |
} |
|
551 |
||
552 |
case EMusuiCmdViewShareVideo: |
|
553 |
{ |
|
554 |
PauseL(); |
|
555 |
// TODO: Change to video sharing |
|
556 |
break; |
|
557 |
} |
|
558 |
case EMusuiCmdViewShareImage: |
|
559 |
{ |
|
560 |
PauseL(); |
|
561 |
// TODO: Change to image sharing |
|
562 |
break; |
|
563 |
} |
|
564 |
case EMusuiCmdViewShareLive: |
|
565 |
{ |
|
566 |
// TODO: Change to live sharing |
|
567 |
break; |
|
568 |
} |
|
569 |
||
570 |
case EMusuiCmdViewAudioNormal: |
|
571 |
{ |
|
572 |
if( !MUS_NO_TOOLBAR ) |
|
573 |
{ |
|
574 |
if (!AknLayoutUtils::PenEnabled()) |
|
575 |
{ |
|
576 |
iEventObserver.SetToolbarVisibility( ETrue ); |
|
577 |
} |
|
578 |
} |
|
579 |
iSession->UnmuteL(); |
|
580 |
break; |
|
581 |
} |
|
582 |
case EMusuiCmdViewAudioMute: |
|
583 |
{ |
|
584 |
if (!AknLayoutUtils::PenEnabled()) |
|
585 |
{ |
|
586 |
iEventObserver.SetToolbarVisibility( ETrue ); |
|
587 |
} |
|
588 |
||
589 |
iSession->MuteL(); |
|
590 |
break; |
|
591 |
} |
|
592 |
case EMusuiCmdViewFastForward: |
|
593 |
{ |
|
594 |
MUS_LOG( "mus: [MUSUI ] CMusUiClipSharingController::HandleCommandL: EMusuiCmdViewFastForward" ); |
|
595 |
if ( DoFastForwardingL( ETrue ) ) |
|
596 |
{ |
|
597 |
iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconForward ); |
|
598 |
iClipObserver.SetPositionValueL( iSession->PositionL().Int() ); |
|
41
755f0370535b
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
599 |
iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarPause, |
755f0370535b
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
600 |
EMusuiCmdToolbarUnPause, |
755f0370535b
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
601 |
ETrue ); |
33 | 602 |
//iClipObserver.SetDurationVisible(); |
603 |
} |
|
604 |
MUS_LOG( "mus: [MUSUI ] CMusUiClipSharingController::HandleCommandL: EMusuiCmdViewFastForward END" ); |
|
605 |
break; |
|
606 |
} |
|
607 |
case EMusuiCmdViewFastReverse: |
|
608 |
{ |
|
609 |
MUS_LOG( "mus: [MUSUI ] CMusUiClipSharingController::HandleCommandL: EMusuiCmdViewFastReverse" ); |
|
610 |
if ( DoFastRewindingL( ETrue ) ) |
|
611 |
{ |
|
612 |
iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconRew ); |
|
613 |
iClipObserver.SetPositionValueL( iSession->PositionL().Int() ); |
|
41
755f0370535b
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
614 |
iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarPause, |
755f0370535b
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
615 |
EMusuiCmdToolbarUnPause, |
755f0370535b
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
616 |
ETrue ); |
33 | 617 |
//iClipObserver.SetDurationVisible(); |
618 |
} |
|
619 |
MUS_LOG( "mus: [MUSUI ] CMusUiClipSharingController::HandleCommandL: EMusuiCmdViewFastReverse END" ); |
|
620 |
break; |
|
621 |
} |
|
622 |
case EMusuiCmdViewFastForwardEnd: |
|
623 |
{ |
|
624 |
if ( DoFastForwardingL( EFalse ) ) |
|
625 |
{ |
|
626 |
iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconPause ); |
|
627 |
PauseL(); |
|
41
755f0370535b
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
628 |
iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarUnPause, |
755f0370535b
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
629 |
EMusuiCmdToolbarPause, |
755f0370535b
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
630 |
ETrue ); |
33 | 631 |
} |
632 |
break; |
|
633 |
} |
|
634 |
case EMusuiCmdViewFastReverseEnd: |
|
635 |
{ |
|
636 |
if ( DoFastRewindingL( EFalse ) ) |
|
637 |
{ |
|
638 |
iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconPause ); |
|
639 |
PauseL(); |
|
41
755f0370535b
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
640 |
iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarUnPause, |
755f0370535b
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
641 |
EMusuiCmdToolbarPause, |
755f0370535b
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
642 |
ETrue ); |
33 | 643 |
} |
644 |
break; |
|
645 |
} |
|
646 |
default: |
|
647 |
{ |
|
648 |
// Try more general handling |
|
649 |
CMusUiEventController::HandleCommandL( aCommand ); |
|
650 |
break; |
|
651 |
} |
|
652 |
} |
|
653 |
||
654 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::HandleCommandL" ); |
|
655 |
} |
|
656 |
||
657 |
||
658 |
// ----------------------------------------------------------------------------- |
|
659 |
// |
|
660 |
// ----------------------------------------------------------------------------- |
|
661 |
// |
|
662 |
void CMusUiClipSharingController::SetFileNameL( const TDesC& aFileName ) |
|
663 |
{ |
|
664 |
iFileName = aFileName.AllocL(); |
|
665 |
} |
|
666 |
||
667 |
||
668 |
// ----------------------------------------------------------------------------- |
|
669 |
// |
|
670 |
// ----------------------------------------------------------------------------- |
|
671 |
// |
|
672 |
TBool CMusUiClipSharingController::ClipEnded() |
|
673 |
{ |
|
674 |
return iClipEnded; |
|
675 |
} |
|
676 |
||
677 |
||
678 |
// ----------------------------------------------------------------------------- |
|
679 |
// |
|
680 |
// ----------------------------------------------------------------------------- |
|
681 |
// |
|
682 |
TBool CMusUiClipSharingController::ClipMutedL() |
|
683 |
{ |
|
684 |
return iSession->IsMutedL(); |
|
685 |
} |
|
686 |
||
687 |
||
688 |
// ----------------------------------------------------------------------------- |
|
689 |
// |
|
690 |
// ----------------------------------------------------------------------------- |
|
691 |
// |
|
692 |
TBool CMusUiClipSharingController::ClipContainsAudioL() |
|
693 |
{ |
|
694 |
if ( !iConnectionInitialized || !iSession ) |
|
695 |
{ |
|
696 |
return EFalse; // We cannot be sure yet |
|
697 |
} |
|
698 |
||
699 |
return iSession->ContainsAudioL(); |
|
700 |
} |
|
701 |
||
702 |
||
703 |
// ----------------------------------------------------------------------------- |
|
704 |
// |
|
705 |
// ----------------------------------------------------------------------------- |
|
706 |
// |
|
707 |
void CMusUiClipSharingController::CancelTranscodingL() |
|
708 |
{ |
|
709 |
if ( iSession && iTranscodingGoing ) |
|
710 |
{ |
|
711 |
iTranscodingGoing = EFalse; |
|
712 |
iSession->CancelTranscodeL(); |
|
713 |
} |
|
714 |
iVideoToBeSaved = EFalse; |
|
715 |
HandleExitL(); |
|
716 |
} |
|
717 |
||
718 |
||
719 |
// ----------------------------------------------------------------------------- |
|
720 |
// |
|
721 |
// ----------------------------------------------------------------------------- |
|
722 |
// |
|
723 |
void CMusUiClipSharingController::StopWindingL() |
|
724 |
{ |
|
725 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::StopWindingL" ); |
|
726 |
||
727 |
if ( DoFastForwardingL( EFalse ) || DoFastRewindingL( EFalse ) ) |
|
728 |
{ |
|
729 |
iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconPause ); |
|
730 |
} |
|
731 |
||
732 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::StopWindingL" ); |
|
733 |
} |
|
734 |
||
735 |
||
736 |
// ----------------------------------------------------------------------------- |
|
737 |
// |
|
738 |
// ----------------------------------------------------------------------------- |
|
739 |
// |
|
740 |
TBool CMusUiClipSharingController::ToolbarFFRevSelected() |
|
741 |
{ |
|
742 |
return iToolbarFFRevSelected; |
|
743 |
} |
|
744 |
||
745 |
||
746 |
// ----------------------------------------------------------------------------- |
|
747 |
// |
|
748 |
// ----------------------------------------------------------------------------- |
|
749 |
// |
|
750 |
void CMusUiClipSharingController::TranscodingProgressedL( TInt aPercentage ) |
|
751 |
{ |
|
752 |
MUS_LOG1( "mus: [MUSUI ] -> CMusUiClipSharingController::TranscodingProgressedL ( %d )", aPercentage ); |
|
753 |
if ( aPercentage < KMusOneHundredPercent ) |
|
754 |
{ |
|
755 |
iTranscodingGoing = ETrue; |
|
756 |
iClipObserver.UpdateClipTranscodingPercentageL( aPercentage ); |
|
757 |
} |
|
758 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::TranscodingProgressedL" ); |
|
759 |
} |
|
760 |
||
761 |
||
762 |
// ----------------------------------------------------------------------------- |
|
763 |
// |
|
764 |
// ----------------------------------------------------------------------------- |
|
765 |
// |
|
766 |
void CMusUiClipSharingController::TranscodingCompletedInitL() |
|
767 |
{ |
|
768 |
MUS_LOG( |
|
769 |
"mus: [MUSUI ] -> CMusUiClipSharingController::TranscodingCompletedInitL" ); |
|
770 |
if ( iTranscodingGoing ) |
|
771 |
{ |
|
772 |
iVideoToBeSaved = ETrue; |
|
773 |
iTranscodingGoing = EFalse; |
|
774 |
iClipObserver.CancelTranscodingDialogL(); |
|
775 |
MusUiDialogUtil::ShowInformationDialogL( R_MUS_VIEW_NOTE_TRANSCODING_COMPLETE ); |
|
776 |
} |
|
777 |
MUS_LOG( |
|
778 |
"mus: [MUSUI ] <- CMusUiClipSharingController::TranscodingCompletedInitL" ); |
|
779 |
} |
|
780 |
||
781 |
// ----------------------------------------------------------------------------- |
|
782 |
// |
|
783 |
// ----------------------------------------------------------------------------- |
|
784 |
// |
|
785 |
void CMusUiClipSharingController::TranscodingCompletedFinalizeL() |
|
786 |
{ |
|
787 |
MUS_LOG( |
|
788 |
"mus: [MUSUI ] -> CMusUiClipSharingController::TranscodingCompletedFinalizeL" ); |
|
789 |
SetConnectionInitialized( ETrue ); |
|
790 |
if ( !iTranscodingGoing ) |
|
791 |
{ |
|
792 |
ShowInvitingWaitDialogL(); |
|
793 |
} |
|
794 |
MUS_LOG( |
|
795 |
"mus: [MUSUI ] <- CMusUiClipSharingController::TranscodingCompletedFinalizeL" ); |
|
796 |
} |
|
797 |
||
798 |
// ----------------------------------------------------------------------------- |
|
799 |
// |
|
800 |
// ----------------------------------------------------------------------------- |
|
801 |
// |
|
802 |
const TDesC& CMusUiClipSharingController::FormattedDurationString( |
|
803 |
const TTimeIntervalSeconds& aDurationSeconds, |
|
804 |
const TTimeIntervalSeconds& aPositionSeconds ) |
|
805 |
{ |
|
806 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::FormattedDurationString" ); |
|
807 |
_LIT( KDurationAndPositionSeparator, "/" ); |
|
808 |
||
809 |
iDurationStringBuffer.SetLength( 0 ); |
|
810 |
TLocale locale; |
|
811 |
_LIT( KZeroSymbol, "0" ); |
|
812 |
||
813 |
TInt durationMinutes( 0 ); |
|
814 |
TInt durationSeconds( aDurationSeconds.Int() ); |
|
815 |
if ( aDurationSeconds.Int() > ( KMusOneMinuteInSeconds - 1 ) ) |
|
816 |
{ |
|
817 |
durationMinutes = (int)( aDurationSeconds.Int() / KMusOneMinuteInSeconds ); |
|
818 |
durationSeconds = durationSeconds - ( durationMinutes * KMusOneMinuteInSeconds ); |
|
819 |
} |
|
820 |
||
821 |
iDurationStringBuffer.AppendNum( durationMinutes ); |
|
822 |
iDurationStringBuffer.Append( locale.TimeSeparator( KMusLocaleMinutesAndSecondsSeparator ) ); |
|
823 |
if ( durationSeconds < KMusNumberValueTen ) |
|
824 |
{ |
|
825 |
iDurationStringBuffer.Append( KZeroSymbol ); |
|
826 |
} |
|
827 |
iDurationStringBuffer.AppendNum( durationSeconds ); |
|
828 |
iDurationStringBuffer.Append( KDurationAndPositionSeparator ); |
|
829 |
||
830 |
TInt positionMinutes( 0 ); |
|
831 |
TInt positionSeconds( aPositionSeconds.Int() ); |
|
832 |
if ( aPositionSeconds.Int() > ( KMusOneMinuteInSeconds - 1 ) ) |
|
833 |
{ |
|
834 |
positionMinutes = (int)( aPositionSeconds.Int() / KMusOneMinuteInSeconds ); |
|
835 |
positionSeconds = positionSeconds - ( positionMinutes * KMusOneMinuteInSeconds ); |
|
836 |
} |
|
837 |
||
838 |
iDurationStringBuffer.AppendNum( positionMinutes ); |
|
839 |
iDurationStringBuffer.Append( locale.TimeSeparator( KMusLocaleMinutesAndSecondsSeparator ) ); |
|
840 |
if ( positionSeconds < KMusNumberValueTen ) |
|
841 |
{ |
|
842 |
iDurationStringBuffer.Append( KZeroSymbol ); |
|
843 |
} |
|
844 |
iDurationStringBuffer.AppendNum( positionSeconds ); |
|
845 |
||
846 |
||
847 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::FormattedDurationString" ); |
|
848 |
return iDurationStringBuffer; |
|
849 |
} |
|
850 |
||
851 |
||
852 |
// ----------------------------------------------------------------------------- |
|
853 |
// |
|
854 |
// ----------------------------------------------------------------------------- |
|
855 |
// |
|
856 |
void CMusUiClipSharingController::EndOfClip() |
|
857 |
{ |
|
858 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::EndOfClip" ); |
|
859 |
iClipEnded = ETrue; |
|
860 |
||
861 |
TRAP_IGNORE( iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconStop ) ); |
|
862 |
if(!MUS_NO_TOOLBAR) |
|
863 |
{ |
|
864 |
iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarPause, |
|
865 |
EMusuiCmdToolbarUnPause, |
|
866 |
ETrue ); |
|
867 |
} |
|
868 |
iCloseTimer->Cancel(); |
|
869 |
iCloseTimer->After( iOperatorSpecificFunctionality ? |
|
870 |
KMusTimeToCloseAfterClipEndedOpVariant : |
|
871 |
KMusTimeToCloseAfterClipEndedStandard ); |
|
872 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::EndOfClip" ); |
|
873 |
} |
|
874 |
||
875 |
||
876 |
// ----------------------------------------------------------------------------- |
|
877 |
// |
|
878 |
// ----------------------------------------------------------------------------- |
|
879 |
// |
|
880 |
void CMusUiClipSharingController::TranscodingNeeded(TBool aDueUnknownRemoteCapabilities) |
|
881 |
{ |
|
882 |
MUS_LOG1( "mus: [MUSUI ] -> CMusUiClipSharingController::TranscodingNeeded, %d", |
|
883 |
aDueUnknownRemoteCapabilities); |
|
884 |
iTranscode = ETrue; |
|
885 |
iTranscodeDueUnknownRemoteCapas = aDueUnknownRemoteCapabilities; |
|
886 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::TranscodingNeeded" ); |
|
887 |
} |
|
888 |
||
889 |
||
890 |
// ----------------------------------------------------------------------------- |
|
891 |
// |
|
892 |
// ----------------------------------------------------------------------------- |
|
893 |
// |
|
894 |
void CMusUiClipSharingController::TranscodingProgressed( TInt aPercentage ) |
|
895 |
{ |
|
896 |
MUS_LOG1( "mus: [MUSUI ] -> CMusUiClipSharingController::TranscodingProgressed %d", |
|
897 |
aPercentage ); |
|
898 |
TRAP_IGNORE( TranscodingProgressedL( aPercentage ) ) |
|
899 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::TranscodingProgressed" ); |
|
900 |
} |
|
901 |
||
902 |
||
903 |
// ----------------------------------------------------------------------------- |
|
904 |
// |
|
905 |
// ----------------------------------------------------------------------------- |
|
906 |
// |
|
907 |
void CMusUiClipSharingController::TranscodingCompletedInit() |
|
908 |
{ |
|
909 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::TranscodingCompleted" ); |
|
910 |
TRAPD( error, TranscodingCompletedInitL() ); |
|
911 |
if ( error != KErrNone ) |
|
912 |
{ |
|
913 |
HandleError( error ); |
|
914 |
} |
|
915 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::TranscodingCompleted" ); |
|
916 |
} |
|
917 |
||
918 |
||
919 |
// ----------------------------------------------------------------------------- |
|
920 |
// |
|
921 |
// ----------------------------------------------------------------------------- |
|
922 |
// |
|
923 |
void CMusUiClipSharingController::TranscodingCompletedFinalize() |
|
924 |
{ |
|
925 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::TranscodingCompleted" ); |
|
926 |
TRAPD( error, TranscodingCompletedFinalizeL() ); |
|
927 |
if ( error != KErrNone ) |
|
928 |
{ |
|
929 |
HandleError( error ); |
|
930 |
} |
|
931 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::TranscodingCompleted" ); |
|
932 |
} |
|
933 |
||
934 |
// ----------------------------------------------------------------------------- |
|
935 |
// |
|
936 |
// ----------------------------------------------------------------------------- |
|
937 |
// |
|
938 |
void CMusUiClipSharingController::TranscodingFailed() |
|
939 |
{ |
|
940 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::TranscodingFailed" ); |
|
941 |
iTranscodingGoing = EFalse; |
|
942 |
DismissWaitDialog(); |
|
943 |
TRAP_IGNORE( iClipObserver.CancelTranscodingDialogL(); |
|
944 |
MusUiDialogUtil::ShowGlobalErrorModalDialogL( |
|
945 |
R_MUS_VIEW_NOTE_UNABLE_TO_CONVERT ) ); |
|
946 |
DeleteEngineSession(); |
|
947 |
delete iFileName; |
|
948 |
iFileName = NULL; |
|
949 |
TRAPD( error, |
|
950 |
iCallbackService->AsyncEventL( EMusUiAsyncStartMediaGallery ) ); |
|
951 |
if ( error != KErrNone ) |
|
952 |
{ |
|
953 |
HandleError( error ); |
|
954 |
} |
|
955 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::TranscodingFailed" ); |
|
956 |
} |
|
957 |
||
958 |
||
959 |
// ----------------------------------------------------------------------------- |
|
960 |
// |
|
961 |
// ----------------------------------------------------------------------------- |
|
962 |
// |
|
963 |
void CMusUiClipSharingController::SessionRecipientNotFound() |
|
964 |
{ |
|
965 |
MUS_LOG1( "mus: [MUSUI ] -> CMusUiClipSharingController::SessionRecipientNotFound [%d]", iTriedInvitations ); |
|
966 |
||
967 |
// If the address has to be queried again...: |
|
968 |
iTranscode = EFalse; |
|
969 |
||
970 |
CMusUiSendController::SessionRecipientNotFound(); |
|
971 |
||
972 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::SessionRecipientNotFound" ); |
|
973 |
} |
|
974 |
||
975 |
||
976 |
// ----------------------------------------------------------------------------- |
|
977 |
// |
|
978 |
// ----------------------------------------------------------------------------- |
|
979 |
// |
|
980 |
void CMusUiClipSharingController::SessionTerminated() |
|
981 |
{ |
|
982 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::SessionTerminated" ); |
|
983 |
DismissWaitDialog(); |
|
984 |
if ( iTranscodingGoing ) |
|
985 |
{ |
|
986 |
TRAP_IGNORE( MusUiDialogUtil::ShowGlobalErrorDialogL( |
|
987 |
R_MUS_VIEW_NOTE_UNABLE_TO_CONVERT ) ); |
|
988 |
} |
|
989 |
||
990 |
TRAP_IGNORE( iCallbackService->AsyncEventL( EMusUiAsyncHandleExit ) ); |
|
991 |
||
992 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::SessionTerminated" ); |
|
993 |
} |
|
994 |
||
995 |
||
996 |
// ----------------------------------------------------------------------------- |
|
997 |
// |
|
998 |
// ----------------------------------------------------------------------------- |
|
999 |
// |
|
1000 |
void CMusUiClipSharingController::SessionConnectionLost() |
|
1001 |
{ |
|
1002 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::SessionConnectionLost" ); |
|
1003 |
DismissWaitDialog(); |
|
1004 |
TRAP_IGNORE( MusUiDialogUtil::ShowGlobalErrorDialogL( |
|
1005 |
R_MUS_LIVE_SHARING_VIEW_NOTE_CONNECTION_LOST ) ); |
|
1006 |
||
1007 |
TRAP_IGNORE( iCallbackService->AsyncEventL( EMusUiAsyncHandleExit ) ); |
|
1008 |
||
1009 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::SessionConnectionLost" ); |
|
1010 |
} |
|
1011 |
||
1012 |
||
1013 |
// ----------------------------------------------------------------------------- |
|
1014 |
// |
|
1015 |
// ----------------------------------------------------------------------------- |
|
1016 |
// |
|
1017 |
void CMusUiClipSharingController::SessionFailed() |
|
1018 |
{ |
|
1019 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::SessionFailed" ); |
|
1020 |
DismissWaitDialog(); |
|
1021 |
if ( iTranscodingGoing ) |
|
1022 |
{ |
|
1023 |
TRAP_IGNORE( MusUiDialogUtil::ShowGlobalErrorDialogL( |
|
1024 |
R_MUS_VIEW_NOTE_UNABLE_TO_CONVERT ) ); |
|
1025 |
} |
|
1026 |
||
1027 |
TRAP_IGNORE( iCallbackService->AsyncEventL( EMusUiAsyncHandleExit ) ); |
|
1028 |
||
1029 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::SessionFailed" ); |
|
1030 |
} |
|
1031 |
||
1032 |
||
1033 |
// ----------------------------------------------------------------------------- |
|
1034 |
// |
|
1035 |
// ----------------------------------------------------------------------------- |
|
1036 |
// |
|
1037 |
void CMusUiClipSharingController::StreamIdle() |
|
1038 |
{ |
|
1039 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::StreamIdle" ); |
|
1040 |
iClipObserver.InvalidVideoFrame( ETrue ); |
|
1041 |
TRAPD( error, StreamIdleL() ); |
|
1042 |
if ( error != KErrNone ) |
|
1043 |
{ |
|
1044 |
iEventObserver.HandleError( error ); |
|
1045 |
} |
|
1046 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::StreamIdle" ); |
|
1047 |
} |
|
1048 |
||
1049 |
||
1050 |
// ----------------------------------------------------------------------------- |
|
1051 |
// |
|
1052 |
// ----------------------------------------------------------------------------- |
|
1053 |
// |
|
1054 |
void CMusUiClipSharingController::StreamStreaming() |
|
1055 |
{ |
|
1056 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::StreamStreaming" ); |
|
1057 |
iClipObserver.InvalidVideoFrame( EFalse ); |
|
1058 |
TRAPD( error, StreamStreamingL() ); |
|
1059 |
if ( error != KErrNone ) |
|
1060 |
{ |
|
1061 |
iEventObserver.HandleError( error ); |
|
1062 |
} |
|
1063 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::StreamStreaming" ); |
|
1064 |
} |
|
1065 |
||
1066 |
||
1067 |
// ----------------------------------------------------------------------------- |
|
1068 |
// |
|
1069 |
// ----------------------------------------------------------------------------- |
|
1070 |
// |
|
1071 |
void CMusUiClipSharingController::SessionTimeChanged( |
|
1072 |
const TTimeIntervalSeconds& aSeconds ) |
|
1073 |
{ |
|
1074 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::SessionTimeChanged" ); |
|
1075 |
TRAP_IGNORE( SessionTimeChangedL( aSeconds ) ); |
|
1076 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::SessionTimeChanged" ); |
|
1077 |
} |
|
1078 |
||
1079 |
||
1080 |
// ----------------------------------------------------------------------------- |
|
1081 |
// |
|
1082 |
// ----------------------------------------------------------------------------- |
|
1083 |
// |
|
1084 |
void CMusUiClipSharingController::InactivityTimeout() |
|
1085 |
{ |
|
1086 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::InactivityTimeout" ); |
|
1087 |
DismissWaitDialog(); |
|
1088 |
TRAP_IGNORE( MusUiDialogUtil::ShowGlobalErrorDialogL( |
|
1089 |
R_MUS_LIVE_SHARING_VIEW_NOTE_SERVICE_N_A ) ); |
|
1090 |
||
1091 |
TRAP_IGNORE( iCallbackService->AsyncEventL( EMusUiAsyncHandleExit ) ); |
|
1092 |
||
1093 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::InactivityTimeout" ); |
|
1094 |
} |
|
1095 |
||
1096 |
||
1097 |
// ----------------------------------------------------------------------------- |
|
1098 |
// Called when predefined time elapsed |
|
1099 |
// after the clip had reached the end |
|
1100 |
// ----------------------------------------------------------------------------- |
|
1101 |
// |
|
1102 |
void CMusUiClipSharingController::TimerComplete( CMusUiActiveTimer* /*aTimer*/ ) |
|
1103 |
{ |
|
1104 |
MUS_LOG( "mus: [MUSUI ] Close time elapsed from clip ending => \ |
|
1105 |
closing session" ); |
|
1106 |
TRAP_IGNORE( HandleExitL() ) |
|
1107 |
} |
|
1108 |
||
1109 |
||
1110 |
// ----------------------------------------------------------------------------- |
|
1111 |
// |
|
1112 |
// ----------------------------------------------------------------------------- |
|
1113 |
// |
|
1114 |
void CMusUiClipSharingController::StreamStreamingL() |
|
1115 |
{ |
|
1116 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::StreamStreamingL" ); |
|
1117 |
||
1118 |
if ( ConnectionEstablished() ) |
|
1119 |
{ |
|
1120 |
iClipEnded = EFalse; |
|
1121 |
iCloseTimer->Cancel(); |
|
1122 |
iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconPlay ); |
|
1123 |
} |
|
1124 |
||
1125 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::StreamStreamingL" ); |
|
1126 |
} |
|
1127 |
||
1128 |
// ----------------------------------------------------------------------------- |
|
1129 |
// |
|
1130 |
// ----------------------------------------------------------------------------- |
|
1131 |
// |
|
1132 |
void CMusUiClipSharingController::StreamIdleL() |
|
1133 |
{ |
|
1134 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::StreamIdleL" ); |
|
1135 |
||
1136 |
if ( ConnectionEstablished() ) |
|
1137 |
{ |
|
1138 |
iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconPause ); |
|
1139 |
} |
|
1140 |
||
1141 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::StreamIdleL" ); |
|
1142 |
} |
|
1143 |
||
1144 |
// ----------------------------------------------------------------------------- |
|
1145 |
// |
|
1146 |
// ----------------------------------------------------------------------------- |
|
1147 |
// |
|
1148 |
void CMusUiClipSharingController::SessionTimeChangedL( const TTimeIntervalSeconds& aSeconds ) |
|
1149 |
{ |
|
1150 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::SessionTimeChangedL" ); |
|
1151 |
if ( aSeconds.Int() > -1 ) |
|
1152 |
{ |
|
1153 |
TTimeIntervalSeconds clipDuration = iSession->DurationL(); |
|
1154 |
TTimeIntervalSeconds clipPosition = iSession->PositionL(); |
|
1155 |
||
1156 |
iSharingObserver.UpdateSessionTime( SessionTimeFormatted( aSeconds ) ); |
|
1157 |
iClipObserver.UpdateClipPositionL( clipPosition.Int(), |
|
1158 |
FormattedDurationString( |
|
1159 |
clipPosition, |
|
1160 |
clipDuration ) ); |
|
1161 |
} |
|
1162 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::SessionTimeChangedL" ); |
|
1163 |
} |
|
1164 |
||
1165 |
||
1166 |
// ----------------------------------------------------------------------------- |
|
1167 |
// CMusUiClipSharingController::SessionEstablished() |
|
1168 |
// ----------------------------------------------------------------------------- |
|
1169 |
// |
|
1170 |
void CMusUiClipSharingController::SessionEstablished() |
|
1171 |
{ |
|
1172 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::SessionEstablished" ); |
|
1173 |
||
1174 |
TRAPD( error, iResourceHandler->RequestVideoPlayerL( ETrue ) ); |
|
1175 |
if ( error != KErrNone ) |
|
1176 |
{ |
|
1177 |
MUS_LOG1( "mus: [MUSUI ] RequestVideoPlayerL leave code: %d", error ) |
|
1178 |
} |
|
1179 |
||
1180 |
// Duration setting visible |
|
1181 |
TRAP( error, iClipObserver.SetDurationValue( iSession->DurationL().Int() ) ) |
|
1182 |
if ( error != KErrNone ) |
|
1183 |
{ |
|
1184 |
HandleError( error ); |
|
1185 |
} |
|
1186 |
iClipObserver.SetDurationVisible(); |
|
1187 |
||
1188 |
// General handling |
|
1189 |
CMusUiSendController::SessionEstablished(); // Base class handling |
|
1190 |
||
1191 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::SessionEstablished" ); |
|
1192 |
} |
|
1193 |
||
1194 |
||
1195 |
// ----------------------------------------------------------------------------- |
|
1196 |
// CMusUiClipSharingController::DoFastForwardingL() |
|
1197 |
// ----------------------------------------------------------------------------- |
|
1198 |
// |
|
1199 |
TBool CMusUiClipSharingController::DoFastForwardingL( TBool aUseWinding ) |
|
1200 |
{ |
|
1201 |
if( iFastForward ^ aUseWinding ) |
|
1202 |
{ |
|
1203 |
iSession->FastForwardL( aUseWinding ); |
|
1204 |
iFastForward = aUseWinding; |
|
1205 |
return ETrue; |
|
1206 |
} |
|
1207 |
return EFalse; |
|
1208 |
} |
|
1209 |
||
1210 |
||
1211 |
// ----------------------------------------------------------------------------- |
|
1212 |
// CMusUiClipSharingController::DoFastRewindingL() |
|
1213 |
// ----------------------------------------------------------------------------- |
|
1214 |
// |
|
1215 |
TBool CMusUiClipSharingController::DoFastRewindingL( TBool aUseWinding ) |
|
1216 |
{ |
|
1217 |
if( iFastRewind ^ aUseWinding ) |
|
1218 |
{ |
|
1219 |
iSession->FastRewindL( aUseWinding ); |
|
1220 |
iFastRewind = aUseWinding; |
|
1221 |
return ETrue; |
|
1222 |
} |
|
1223 |
return EFalse; |
|
1224 |
} |
|
1225 |
||
1226 |
||
1227 |
// ----------------------------------------------------------------------------- |
|
1228 |
// CMusUiClipSharingController::RewindFromEndL() |
|
1229 |
// ----------------------------------------------------------------------------- |
|
1230 |
// |
|
1231 |
void CMusUiClipSharingController::RewindFromEndL() |
|
1232 |
{ |
|
1233 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::RewindFromEndL" ); |
|
1234 |
PauseL(); |
|
1235 |
iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconPause ); |
|
1236 |
iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarPause, |
|
1237 |
EMusuiCmdToolbarUnPause, |
|
1238 |
ETrue ); |
|
1239 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::RewindFromEndL" ); |
|
1240 |
} |
|
1241 |
// End of file |
|
1242 |