225 delete mMpxCollectionWrapper; |
227 delete mMpxCollectionWrapper; |
226 delete mAudioEffectsWrapper; |
228 delete mAudioEffectsWrapper; |
227 delete mEqualizerWrapper; |
229 delete mEqualizerWrapper; |
228 delete mSongScanner; |
230 delete mSongScanner; |
229 delete mSongData; |
231 delete mSongData; |
|
232 delete mApplicationMonitor; |
230 TX_EXIT |
233 TX_EXIT |
231 } |
234 } |
232 |
235 |
233 /*! |
236 /*! |
234 Initialize engine |
237 Initialize engine |
235 */ |
238 */ |
236 void MpEngine::initialize( TUid hostUid, EngineMode mode ) |
239 void MpEngine::initialize( quint32 clientSecureId, EngineMode mode ) |
237 { |
240 { |
238 TX_ENTRY_ARGS("hostUid=" << hostUid.iUid << ", mode=" << mode); |
241 TX_ENTRY_ARGS("clientSecureId=" << clientSecureId << ", mode=" << mode); |
239 mHostUid = hostUid; |
242 |
240 |
243 mEngineMode = mode; |
241 if ( StandAlone == mode ) { |
244 if ( StandAlone == mode ) { |
242 mSongData = new MpSongData(); |
245 mSongData = new MpSongData(); |
243 |
246 |
244 // Harvesting Wrapper |
247 // Harvesting Wrapper |
245 mMpxHarvesterWrapper = new MpMpxHarvesterFrameworkWrapper( mHostUid ); |
248 mMpxHarvesterWrapper = new MpMpxHarvesterFrameworkWrapper( clientSecureId ); |
246 connect( mMpxHarvesterWrapper, SIGNAL( scanStarted() ), |
249 connect( mMpxHarvesterWrapper, SIGNAL( scanStarted() ), |
247 this, SLOT( handleScanStarted() ), |
250 this, SLOT( handleScanStarted() ), |
248 Qt::QueuedConnection ); |
251 Qt::QueuedConnection ); |
249 connect( mMpxHarvesterWrapper, SIGNAL( scanEnded(int, int) ), |
252 connect( mMpxHarvesterWrapper, SIGNAL( scanEnded(int, int) ), |
250 this, SLOT( handleScanEnded(int, int) ), |
253 this, SLOT( handleScanEnded(int, int) ), |
257 connect( mMpxHarvesterWrapper, SIGNAL( usbEvent(MpxUsbEvents) ), |
260 connect( mMpxHarvesterWrapper, SIGNAL( usbEvent(MpxUsbEvents) ), |
258 this, SLOT( handleUsbEvent(MpxUsbEvents) ), |
261 this, SLOT( handleUsbEvent(MpxUsbEvents) ), |
259 Qt::QueuedConnection ); |
262 Qt::QueuedConnection ); |
260 |
263 |
261 // Collection Wrapper |
264 // Collection Wrapper |
262 mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( mHostUid, mSongData ); |
265 mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( clientSecureId, mSongData ); |
263 connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ), |
266 connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ), |
264 this, SIGNAL( collectionPlaylistOpened() ), |
267 this, SIGNAL( collectionPlaylistOpened() ), |
265 Qt::QueuedConnection ); |
268 Qt::QueuedConnection ); |
266 connect( mMpxCollectionWrapper, SIGNAL( aboutToAddSongs(int) ), |
269 connect( mMpxCollectionWrapper, SIGNAL( aboutToAddSongs(int) ), |
267 this, SIGNAL( aboutToAddSongs(int) ) ); |
270 this, SIGNAL( aboutToAddSongs(int) ) ); |
290 connect( mEqualizerWrapper, SIGNAL( equalizerReady() ), |
293 connect( mEqualizerWrapper, SIGNAL( equalizerReady() ), |
291 this, SLOT( handleEqualizerReady() ), |
294 this, SLOT( handleEqualizerReady() ), |
292 Qt::QueuedConnection ); |
295 Qt::QueuedConnection ); |
293 |
296 |
294 // Playback Wrapper |
297 // Playback Wrapper |
295 mMpxPlaybackWrapper = new MpMpxPlaybackFrameworkWrapper( mHostUid, mSongData ); |
298 mMpxPlaybackWrapper = new MpMpxPlaybackFrameworkWrapper( clientSecureId, mSongData ); |
296 connect( this, SIGNAL( libraryUpdated() ), |
299 connect( this, SIGNAL( libraryUpdated() ), |
297 mMpxPlaybackWrapper, SLOT( closeCurrentPlayback() ) ); |
300 mMpxPlaybackWrapper, SLOT( closeCurrentPlayback() ) ); |
298 connect( mMpxPlaybackWrapper, SIGNAL ( corruptedStop() ), |
301 connect( mMpxPlaybackWrapper, SIGNAL ( corruptedStop(bool) ), |
299 this, SIGNAL( corruptedStop() )); |
302 this, SLOT( handleCorruptedStop(bool) )); |
300 connect( mMpxPlaybackWrapper, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ), |
303 connect( mMpxPlaybackWrapper, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ), |
301 this, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ) ); |
304 this, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ) ); |
302 |
305 |
303 // AudioEffects wrapper |
306 // AudioEffects wrapper |
304 mAudioEffectsWrapper = new MpAudioEffectsFrameworkWrapper(); |
307 mAudioEffectsWrapper = new MpAudioEffectsFrameworkWrapper(); |
305 } |
308 } |
306 else if ( Fetch == mode ) { |
309 else if ( Fetch == mode ) { |
307 // Harvesting Wrapper |
310 // Harvesting Wrapper |
308 mMpxHarvesterWrapper = new MpMpxHarvesterFrameworkWrapper( mHostUid ); |
311 mMpxHarvesterWrapper = new MpMpxHarvesterFrameworkWrapper( clientSecureId ); |
309 connect( mMpxHarvesterWrapper, SIGNAL( scanStarted() ), |
312 connect( mMpxHarvesterWrapper, SIGNAL( scanStarted() ), |
310 this, SLOT( handleScanStarted() ), |
313 this, SLOT( handleScanStarted() ), |
311 Qt::QueuedConnection ); |
314 Qt::QueuedConnection ); |
312 connect( mMpxHarvesterWrapper, SIGNAL( scanEnded(int, int) ), |
315 connect( mMpxHarvesterWrapper, SIGNAL( scanEnded(int, int) ), |
313 this, SLOT( handleScanEnded(int, int) ), |
316 this, SLOT( handleScanEnded(int, int) ), |
320 connect( mMpxHarvesterWrapper, SIGNAL( usbEvent(MpxUsbEvents) ), |
323 connect( mMpxHarvesterWrapper, SIGNAL( usbEvent(MpxUsbEvents) ), |
321 this, SLOT( handleUsbEvent(MpxUsbEvents) ), |
324 this, SLOT( handleUsbEvent(MpxUsbEvents) ), |
322 Qt::QueuedConnection ); |
325 Qt::QueuedConnection ); |
323 |
326 |
324 // Collection Wrapper |
327 // Collection Wrapper |
325 mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( mHostUid, 0 ); |
328 mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( clientSecureId, 0 ); |
326 connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ), |
329 connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ), |
327 this, SIGNAL( collectionPlaylistOpened() ), |
330 this, SIGNAL( collectionPlaylistOpened() ), |
328 Qt::QueuedConnection ); |
331 Qt::QueuedConnection ); |
329 // Disabling these since fetch mode plays only one song at a time. |
332 // Disabling these since fetch mode plays only one song at a time. |
330 mMpxCollectionWrapper->setRepeatFeatureEnabled( false ); |
333 mMpxCollectionWrapper->setRepeatFeatureEnabled( false ); |
331 mMpxCollectionWrapper->setShuffleFeatureEnabled( false ); |
334 mMpxCollectionWrapper->setShuffleFeatureEnabled( false ); |
332 |
335 |
333 // Playback Wrapper |
336 // Playback Wrapper |
334 mMpxPlaybackWrapper = new MpMpxPlaybackFrameworkWrapper( mHostUid, 0 ); |
337 mMpxPlaybackWrapper = new MpMpxPlaybackFrameworkWrapper( clientSecureId, 0 ); |
335 connect( this, SIGNAL( libraryUpdated() ), |
338 connect( this, SIGNAL( libraryUpdated() ), |
336 mMpxPlaybackWrapper, SLOT( closeCurrentPlayback() ) ); |
339 mMpxPlaybackWrapper, SLOT( closeCurrentPlayback() ) ); |
337 connect( mMpxPlaybackWrapper, SIGNAL ( corruptedStop() ), |
340 connect( mMpxPlaybackWrapper, SIGNAL ( corruptedStop(bool) ), |
338 this, SIGNAL( corruptedStop() )); |
341 this, SLOT( handleCorruptedStop(bool) )); |
339 connect( mMpxPlaybackWrapper, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ), |
342 connect( mMpxPlaybackWrapper, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ), |
340 this, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ) ); |
343 this, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ) ); |
341 |
344 |
342 } |
345 } |
343 else if ( MediaBrowsing == mode ) { |
346 else if ( MediaBrowsing == mode ) { |
344 // Collection Wrapper |
347 // Collection Wrapper |
345 mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( mHostUid, 0 ); |
348 mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( clientSecureId, 0 ); |
346 connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ), |
349 connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ), |
347 this, SIGNAL( collectionPlaylistOpened() ), |
350 this, SIGNAL( collectionPlaylistOpened() ), |
348 Qt::QueuedConnection ); |
351 Qt::QueuedConnection ); |
349 connect( mMpxCollectionWrapper, SIGNAL( containerContentsChanged() ), |
352 connect( mMpxCollectionWrapper, SIGNAL( containerContentsChanged() ), |
350 this, SIGNAL( containerContentsChanged() ), |
353 this, SIGNAL( containerContentsChanged() ), |
351 Qt::QueuedConnection ); |
354 Qt::QueuedConnection ); |
352 } |
355 } |
353 else if ( Embedded == mode ) { |
356 else if ( Embedded == mode ) { |
354 mSongData = new MpSongData(); |
357 mSongData = new MpSongData(); |
355 // Playback Wrapper |
358 // Playback Wrapper |
356 mMpxPlaybackWrapper = new MpMpxPlaybackFrameworkWrapper( mHostUid, mSongData ); |
359 mMpxPlaybackWrapper = new MpMpxPlaybackFrameworkWrapper( clientSecureId, mSongData ); |
357 connect( mMpxPlaybackWrapper, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ), |
360 connect( mMpxPlaybackWrapper, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ), |
358 this, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ) ); |
361 this, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ) ); |
359 |
362 connect( mMpxPlaybackWrapper, SIGNAL ( corruptedStop(bool) ), |
|
363 this, SLOT( handleCorruptedStop(bool) )); |
|
364 } |
|
365 else if ( HomeScreen == mode ) { |
|
366 // Harvesting Wrapper |
|
367 mMpxHarvesterWrapper = new MpMpxHarvesterFrameworkWrapper( clientSecureId ); |
|
368 connect( mMpxHarvesterWrapper, SIGNAL( scanStarted() ), |
|
369 this, SLOT( handleScanStarted() ), |
|
370 Qt::QueuedConnection ); |
|
371 connect( mMpxHarvesterWrapper, SIGNAL( scanEnded(int, int) ), |
|
372 this, SLOT( handleScanEnded(int, int) ), |
|
373 Qt::QueuedConnection ); |
|
374 qRegisterMetaType<MpxDiskEvents>("MpxDiskEvents"); |
|
375 connect( mMpxHarvesterWrapper, SIGNAL( diskEvent(MpxDiskEvents) ), |
|
376 this, SLOT( handleDiskEvent(MpxDiskEvents) ), |
|
377 Qt::QueuedConnection ); |
|
378 qRegisterMetaType<MpxUsbEvents>("MpxUsbEvents"); |
|
379 connect( mMpxHarvesterWrapper, SIGNAL( usbEvent(MpxUsbEvents) ), |
|
380 this, SLOT( handleUsbEvent(MpxUsbEvents) ), |
|
381 Qt::QueuedConnection ); |
|
382 |
|
383 // Playback Wrapper |
|
384 mMpxPlaybackWrapper = new MpMpxPlaybackFrameworkWrapper( clientSecureId, mSongData ); |
360 } |
385 } |
361 TX_EXIT |
386 TX_EXIT |
362 } |
387 } |
363 |
388 |
364 /*! |
389 /*! |