changeset 48 | af3740e3753f |
parent 42 | 79c49924ae23 |
child 54 | c5b304f4d89b |
42:79c49924ae23 | 48:af3740e3753f |
---|---|
20 |
20 |
21 #include "mpengine.h" |
21 #include "mpengine.h" |
22 #include "mpmpxharvesterframeworkwrapper.h" |
22 #include "mpmpxharvesterframeworkwrapper.h" |
23 #include "mpmpxcollectionframeworkwrapper.h" |
23 #include "mpmpxcollectionframeworkwrapper.h" |
24 #include "mpmpxplaybackframeworkwrapper.h" |
24 #include "mpmpxplaybackframeworkwrapper.h" |
25 #include "mpmpxdetailsframeworkwrapper.h" |
|
26 #include "mpaudioeffectsframeworkwrapper.h" |
25 #include "mpaudioeffectsframeworkwrapper.h" |
27 #include "mpequalizerframeworkwrapper.h" |
26 #include "mpequalizerframeworkwrapper.h" |
28 #include "mpmediakeyhandler.h" |
|
29 #include "mptrace.h" |
27 #include "mptrace.h" |
30 #include "mpsettingsmanager.h" |
28 #include "mpsettingsmanager.h" |
31 #include "mpsongscanner.h" |
29 #include "mpsongscanner.h" |
30 #include "mpsongdata.h" |
|
32 |
31 |
33 /*! |
32 /*! |
34 \class MpEngine |
33 \class MpEngine |
35 \brief Engine for musicplayer - mpx framework utilities. |
34 \brief Engine for musicplayer - mpx framework utilities. |
36 |
35 |
94 |
93 |
95 This signal is emitted when usb in synchronizing state is disconnected. |
94 This signal is emitted when usb in synchronizing state is disconnected. |
96 |
95 |
97 */ |
96 */ |
98 |
97 |
99 /*! |
|
100 \fn void libraryRefreshNeeded() |
|
101 |
|
102 This signal is emitted when usb in MassStorage mode is disconnected. |
|
103 |
|
104 */ |
|
105 |
|
106 |
98 |
107 /*! |
99 /*! |
108 ------------------------------------------------------------------------------- |
100 ------------------------------------------------------------------------------- |
109 Collection related signals |
101 Collection related signals |
110 ------------------------------------------------------------------------------- |
102 ------------------------------------------------------------------------------- |
182 container. |
174 container. |
183 |
175 |
184 */ |
176 */ |
185 |
177 |
186 /*! |
178 /*! |
179 ------------------------------------------------------------------------------- |
|
180 Playback related signals |
|
181 ------------------------------------------------------------------------------- |
|
182 */ |
|
183 |
|
184 /*! |
|
185 \fn void volumePropertyChanged( MpCommon::MpVolumeProperty, int value ); |
|
186 |
|
187 This signal is emitted when framework receives a volume related property notification, |
|
188 such as EPbPropertyVolume, EPbPropertyMaxVolume, EPbPropertyMute. |
|
189 */ |
|
190 |
|
191 |
|
192 /*! |
|
187 Constructs music player engine. |
193 Constructs music player engine. |
188 */ |
194 */ |
189 MpEngine::MpEngine() |
195 MpEngine::MpEngine() |
190 : mMpxHarvesterWrapper(0), |
196 : mMpxHarvesterWrapper(0), |
191 mSongScanner(0), |
197 mSongScanner(0), |
192 mMediaKeyHandler(0), |
|
193 mMpxCollectionWrapper(0), |
198 mMpxCollectionWrapper(0), |
194 mMpxPlaybackWrapper(0), |
199 mMpxPlaybackWrapper(0), |
195 mMpxDetailsWrapper(0), |
|
196 mAudioEffectsWrapper(0), |
200 mAudioEffectsWrapper(0), |
197 mEqualizerWrapper(0), |
201 mEqualizerWrapper(0), |
198 mCurrentPresetIndex(KEqualizerPresetNone), |
202 mCurrentPresetIndex(KEqualizerPresetNone), |
203 mSongData(0), |
|
199 mUsbBlockingState(USB_NotConnected), |
204 mUsbBlockingState(USB_NotConnected), |
200 mPreviousUsbState(USB_NotConnected) |
205 mPreviousUsbState(USB_NotConnected), |
206 mHandleMediaCommands(true) |
|
201 { |
207 { |
202 TX_LOG |
208 TX_LOG |
203 } |
209 } |
204 |
210 |
205 /*! |
211 /*! |
206 Destructs music player engine. |
212 Destructs music player engine. |
207 */ |
213 */ |
208 MpEngine::~MpEngine() |
214 MpEngine::~MpEngine() |
209 { |
215 { |
210 TX_ENTRY |
216 TX_ENTRY |
211 delete mMediaKeyHandler; |
|
212 delete mMpxPlaybackWrapper; |
217 delete mMpxPlaybackWrapper; |
213 delete mMpxDetailsWrapper; |
|
214 delete mMpxHarvesterWrapper; |
218 delete mMpxHarvesterWrapper; |
215 delete mMpxCollectionWrapper; |
219 delete mMpxCollectionWrapper; |
216 delete mAudioEffectsWrapper; |
220 delete mAudioEffectsWrapper; |
217 delete mEqualizerWrapper; |
221 delete mEqualizerWrapper; |
218 delete mSongScanner; |
222 delete mSongScanner; |
223 delete mSongData; |
|
219 TX_EXIT |
224 TX_EXIT |
220 } |
225 } |
221 |
226 |
222 /*! |
227 /*! |
223 Initialize engine |
228 Initialize engine |
224 */ |
229 */ |
225 void MpEngine::initialize( TUid hostUid, EngineMode mode ) |
230 void MpEngine::initialize( TUid hostUid, EngineMode mode ) |
226 { |
231 { |
227 TX_ENTRY |
232 TX_ENTRY_ARGS("hostUid=" << hostUid.iUid << ", mode=" << mode); |
228 mHostUid = hostUid; |
233 mHostUid = hostUid; |
229 |
234 |
230 if( mode == StandAlone || mode == Fetch ){ |
235 if ( StandAlone == mode ) { |
236 mSongData = new MpSongData(); |
|
237 |
|
231 // Harvesting Wrapper |
238 // Harvesting Wrapper |
232 mMpxHarvesterWrapper = new MpMpxHarvesterFrameworkWrapper( mHostUid ); |
239 mMpxHarvesterWrapper = new MpMpxHarvesterFrameworkWrapper( mHostUid ); |
233 connect( mMpxHarvesterWrapper, SIGNAL( scanStarted() ), |
240 connect( mMpxHarvesterWrapper, SIGNAL( scanStarted() ), |
234 this, SLOT( handleScanStarted() ), Qt::QueuedConnection ); |
241 this, SLOT( handleScanStarted() ), |
235 connect( mMpxHarvesterWrapper, SIGNAL( scanEnded(int, int) ), |
242 Qt::QueuedConnection ); |
236 this, SLOT( handleScanEnded(int, int) ), Qt::QueuedConnection ); |
243 connect( mMpxHarvesterWrapper, SIGNAL( scanEnded(int, int) ), |
244 this, SLOT( handleScanEnded(int, int) ), |
|
245 Qt::QueuedConnection ); |
|
237 qRegisterMetaType<MpxDiskEvents>("MpxDiskEvents"); |
246 qRegisterMetaType<MpxDiskEvents>("MpxDiskEvents"); |
238 connect( mMpxHarvesterWrapper, SIGNAL( diskEvent(MpxDiskEvents) ), |
247 connect( mMpxHarvesterWrapper, SIGNAL( diskEvent(MpxDiskEvents) ), |
239 this, SLOT( handleDiskEvent(MpxDiskEvents) ), Qt::QueuedConnection ); |
248 this, SLOT( handleDiskEvent(MpxDiskEvents) ), |
249 Qt::QueuedConnection ); |
|
240 qRegisterMetaType<MpxUsbEvents>("MpxUsbEvents"); |
250 qRegisterMetaType<MpxUsbEvents>("MpxUsbEvents"); |
241 connect( mMpxHarvesterWrapper, SIGNAL( usbEvent(MpxUsbEvents) ), |
251 connect( mMpxHarvesterWrapper, SIGNAL( usbEvent(MpxUsbEvents) ), |
242 this, SLOT( handleUsbEvent(MpxUsbEvents) ), Qt::QueuedConnection ); |
252 this, SLOT( handleUsbEvent(MpxUsbEvents) ), |
243 mMediaKeyHandler = new MpMediaKeyHandler(); |
253 Qt::QueuedConnection ); |
244 } |
254 |
245 |
|
246 if ( mode == StandAlone || mode == Fetch || mode == MediaBrowsing) { |
|
247 |
|
248 // Collection Wrapper |
255 // Collection Wrapper |
249 mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( mHostUid ); |
256 mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( mHostUid, mSongData ); |
250 |
|
251 //disabling these since fetch mode plays only one song at a time. |
|
252 mMpxCollectionWrapper->setRepeatFeatureEnabled( mode != Fetch ); |
|
253 mMpxCollectionWrapper->setShuffleFeatureEnabled( mode != Fetch ); |
|
254 |
|
255 connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ), |
257 connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ), |
256 this, SIGNAL( collectionPlaylistOpened() ), |
258 this, SIGNAL( collectionPlaylistOpened() ), |
257 Qt::QueuedConnection ); |
259 Qt::QueuedConnection ); |
258 connect( mMpxCollectionWrapper, SIGNAL( aboutToAddSongs( int ) ), |
260 connect( mMpxCollectionWrapper, SIGNAL( aboutToAddSongs(int) ), |
259 this, SIGNAL( aboutToAddSongs( int ) ) ); |
261 this, SIGNAL( aboutToAddSongs(int) ) ); |
260 connect( mMpxCollectionWrapper, SIGNAL( playlistSaved( bool ) ), |
262 connect( mMpxCollectionWrapper, SIGNAL( playlistSaved(bool) ), |
261 this, SIGNAL( playlistSaved( bool ) ), |
263 this, SIGNAL( playlistSaved(bool) ), |
262 Qt::QueuedConnection ); |
264 Qt::QueuedConnection ); |
263 connect( mMpxCollectionWrapper, SIGNAL( playlistsRenamed( bool ) ), |
265 connect( mMpxCollectionWrapper, SIGNAL( playlistsRenamed(bool) ), |
264 this, SIGNAL( playlistsRenamed( bool ) ), |
266 this, SIGNAL( playlistsRenamed(bool) ), |
265 Qt::QueuedConnection ); |
267 Qt::QueuedConnection ); |
266 connect( mMpxCollectionWrapper, SIGNAL( isolatedCollectionOpened( MpMpxCollectionData* ) ), |
268 connect( mMpxCollectionWrapper, SIGNAL( isolatedCollectionOpened(MpMpxCollectionData*) ), |
267 this, SIGNAL( isolatedCollectionOpened( MpMpxCollectionData* ) ), |
269 this, SIGNAL( isolatedCollectionOpened(MpMpxCollectionData*) ), |
268 Qt::QueuedConnection ); |
270 Qt::QueuedConnection ); |
269 connect( mMpxCollectionWrapper, SIGNAL( containerContentsChanged() ), |
271 connect( mMpxCollectionWrapper, SIGNAL( containerContentsChanged() ), |
270 this, SIGNAL( containerContentsChanged() ), |
272 this, SIGNAL( containerContentsChanged() ), |
271 Qt::QueuedConnection ); |
273 Qt::QueuedConnection ); |
272 connect( mMpxCollectionWrapper, SIGNAL( deleteStarted( TCollectionContext, int ) ), |
274 connect( mMpxCollectionWrapper, SIGNAL( deleteStarted(TCollectionContext, int) ), |
273 this, SLOT( handleDeleteStarted( TCollectionContext, int ) ) ); |
275 this, SLOT( handleDeleteStarted(TCollectionContext, int) ) ); |
274 connect( mMpxCollectionWrapper, SIGNAL( songsDeleted( bool ) ), |
276 connect( mMpxCollectionWrapper, SIGNAL( songsDeleted(bool) ), |
275 this, SLOT( handleDeleteEnded( bool ) ), |
277 this, SLOT( handleDeleteEnded(bool) ), |
276 Qt::QueuedConnection ); |
278 Qt::QueuedConnection ); |
277 connect( mMpxCollectionWrapper, SIGNAL( restorePathFailed() ), |
279 connect( mMpxCollectionWrapper, SIGNAL( restorePathFailed() ), |
278 this, SIGNAL( restorePathFailed() ), |
280 this, SIGNAL( restorePathFailed() ), |
279 Qt::QueuedConnection ); |
281 Qt::QueuedConnection ); |
280 } |
282 // Equalizer wrapper; this needs to be created before playback wrapper. |
281 |
|
282 if( mode == StandAlone ){ |
|
283 // Equalizer wrapper , this needs to be created before playback wrapper. |
|
284 mEqualizerWrapper = new MpEqualizerFrameworkWrapper(); |
283 mEqualizerWrapper = new MpEqualizerFrameworkWrapper(); |
285 connect( mEqualizerWrapper, SIGNAL( equalizerReady() ), |
284 connect( mEqualizerWrapper, SIGNAL( equalizerReady() ), |
286 this, SLOT( handleEqualizerReady() ), Qt::QueuedConnection ); |
285 this, SLOT( handleEqualizerReady() ), |
287 } |
286 Qt::QueuedConnection ); |
288 |
287 |
289 if ( mode == StandAlone || mode == Fetch || mode == Embedded ) { |
288 // Playback Wrapper |
290 // Playback Wrapper |
289 mMpxPlaybackWrapper = new MpMpxPlaybackFrameworkWrapper( mHostUid, mSongData ); |
291 mMpxPlaybackWrapper = new MpMpxPlaybackFrameworkWrapper( mHostUid ); |
290 connect( this, SIGNAL( libraryUpdated() ), |
292 |
291 mMpxPlaybackWrapper, SLOT( closeCurrentPlayback() ) ); |
293 // Details Wrapper |
292 connect( mMpxPlaybackWrapper, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ), |
294 mMpxDetailsWrapper = new MpMpxDetailsFrameworkWrapper( mHostUid ); |
293 this, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ) ); |
295 } |
294 |
296 |
|
297 if( mode == StandAlone ){ |
|
298 // AudioEffects wrapper |
295 // AudioEffects wrapper |
299 mAudioEffectsWrapper = new MpAudioEffectsFrameworkWrapper(); |
296 mAudioEffectsWrapper = new MpAudioEffectsFrameworkWrapper(); |
297 } |
|
298 else if ( Fetch == mode ) { |
|
299 // Harvesting Wrapper |
|
300 mMpxHarvesterWrapper = new MpMpxHarvesterFrameworkWrapper( mHostUid ); |
|
301 connect( mMpxHarvesterWrapper, SIGNAL( scanStarted() ), |
|
302 this, SLOT( handleScanStarted() ), |
|
303 Qt::QueuedConnection ); |
|
304 connect( mMpxHarvesterWrapper, SIGNAL( scanEnded(int, int) ), |
|
305 this, SLOT( handleScanEnded(int, int) ), |
|
306 Qt::QueuedConnection ); |
|
307 qRegisterMetaType<MpxDiskEvents>("MpxDiskEvents"); |
|
308 connect( mMpxHarvesterWrapper, SIGNAL( diskEvent(MpxDiskEvents) ), |
|
309 this, SLOT( handleDiskEvent(MpxDiskEvents) ), |
|
310 Qt::QueuedConnection ); |
|
311 qRegisterMetaType<MpxUsbEvents>("MpxUsbEvents"); |
|
312 connect( mMpxHarvesterWrapper, SIGNAL( usbEvent(MpxUsbEvents) ), |
|
313 this, SLOT( handleUsbEvent(MpxUsbEvents) ), |
|
314 Qt::QueuedConnection ); |
|
315 |
|
316 // Collection Wrapper |
|
317 mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( mHostUid, 0 ); |
|
318 connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ), |
|
319 this, SIGNAL( collectionPlaylistOpened() ), |
|
320 Qt::QueuedConnection ); |
|
321 // Disabling these since fetch mode plays only one song at a time. |
|
322 mMpxCollectionWrapper->setRepeatFeatureEnabled( false ); |
|
323 mMpxCollectionWrapper->setShuffleFeatureEnabled( false ); |
|
324 |
|
325 // Playback Wrapper |
|
326 mMpxPlaybackWrapper = new MpMpxPlaybackFrameworkWrapper( mHostUid, 0 ); |
|
327 connect( this, SIGNAL( libraryUpdated() ), |
|
328 mMpxPlaybackWrapper, SLOT( closeCurrentPlayback() ) ); |
|
329 connect( mMpxPlaybackWrapper, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ), |
|
330 this, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ) ); |
|
331 |
|
332 } |
|
333 else if ( MediaBrowsing == mode ) { |
|
334 // Collection Wrapper |
|
335 mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( mHostUid, 0 ); |
|
336 connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ), |
|
337 this, SIGNAL( collectionPlaylistOpened() ), |
|
338 Qt::QueuedConnection ); |
|
339 connect( mMpxCollectionWrapper, SIGNAL( containerContentsChanged() ), |
|
340 this, SIGNAL( containerContentsChanged() ), |
|
341 Qt::QueuedConnection ); |
|
342 } |
|
343 else if ( Embedded == mode ) { |
|
344 mSongData = new MpSongData(); |
|
345 // Playback Wrapper |
|
346 mMpxPlaybackWrapper = new MpMpxPlaybackFrameworkWrapper( mHostUid, mSongData ); |
|
347 connect( mMpxPlaybackWrapper, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ), |
|
348 this, SIGNAL( volumePropertyChanged( MpCommon::MpVolumeProperty, int ) ) ); |
|
349 |
|
300 } |
350 } |
301 TX_EXIT |
351 TX_EXIT |
302 } |
352 } |
303 |
353 |
304 /*! |
354 /*! |
365 /*! |
415 /*! |
366 Slot to be called when song scanning starts. |
416 Slot to be called when song scanning starts. |
367 */ |
417 */ |
368 void MpEngine::handleScanStarted() { |
418 void MpEngine::handleScanStarted() { |
369 TX_ENTRY |
419 TX_ENTRY |
370 mMediaKeyHandler->setEnabled(false); |
420 mHandleMediaCommands = false; |
371 TX_EXIT |
421 TX_EXIT |
372 } |
422 } |
373 |
423 |
374 /*! |
424 /*! |
375 Slot to be called when song scanning ends. |
425 Slot to be called when song scanning ends. |
376 */ |
426 */ |
377 void MpEngine::handleScanEnded( int count, int error ) { |
427 void MpEngine::handleScanEnded( int count, int error ) { |
378 TX_ENTRY |
428 TX_ENTRY |
379 Q_UNUSED( count ); |
429 Q_UNUSED( count ); |
380 Q_UNUSED( error ); |
430 Q_UNUSED( error ); |
381 mMediaKeyHandler->setEnabled(true); |
431 mHandleMediaCommands = true; |
382 emit libraryUpdated(); |
432 emit libraryUpdated(); |
383 TX_EXIT |
433 TX_EXIT |
384 } |
434 } |
385 |
435 |
386 /*! |
436 /*! |
389 void MpEngine::handleDiskEvent( MpxDiskEvents event ) |
439 void MpEngine::handleDiskEvent( MpxDiskEvents event ) |
390 { |
440 { |
391 TX_ENTRY_ARGS("event=" << event); |
441 TX_ENTRY_ARGS("event=" << event); |
392 switch ( event ) { |
442 switch ( event ) { |
393 case DiskFormatStarted: |
443 case DiskFormatStarted: |
394 mMediaKeyHandler->setEnabled(false); |
444 mHandleMediaCommands = false; |
395 break; |
445 break; |
396 case DiskFormatEnded: |
446 case DiskFormatEnded: |
397 mMediaKeyHandler->setEnabled(true); |
447 mHandleMediaCommands = true; |
398 break; |
448 break; |
399 case DiskRemoved: |
449 case DiskRemoved: |
400 if ( mUsbBlockingState != USB_Synchronizing ) { |
450 if ( mUsbBlockingState != USB_Synchronizing ) { |
401 emit libraryUpdated(); |
451 emit libraryUpdated(); |
402 } |
452 } |
446 To be called when EMcMsgUSBMassStorageStart event is received. |
496 To be called when EMcMsgUSBMassStorageStart event is received. |
447 */ |
497 */ |
448 void MpEngine::handleUsbMassStorageStartEvent() |
498 void MpEngine::handleUsbMassStorageStartEvent() |
449 { |
499 { |
450 TX_ENTRY |
500 TX_ENTRY |
451 mMediaKeyHandler->setEnabled(false); |
501 mHandleMediaCommands = false; |
452 |
502 |
453 changeUsbBlockingState( USB_Synchronizing ); |
503 changeUsbBlockingState( USB_Synchronizing ); |
454 emit usbBlocked(true); |
504 emit usbBlocked(true); |
455 emit usbSynchronizationStarted(); |
505 emit usbSynchronizationStarted(); |
456 |
506 |
461 To be called when EMcMsgUSBMassStorageEnd event is received. |
511 To be called when EMcMsgUSBMassStorageEnd event is received. |
462 */ |
512 */ |
463 void MpEngine::handleUsbMassStorageEndEvent() |
513 void MpEngine::handleUsbMassStorageEndEvent() |
464 { |
514 { |
465 TX_ENTRY |
515 TX_ENTRY |
466 mMediaKeyHandler->setEnabled(true); |
516 mHandleMediaCommands = true; |
467 |
517 |
468 changeUsbBlockingState( USB_NotConnected ); |
518 changeUsbBlockingState( USB_NotConnected ); |
469 emit usbBlocked(false); |
519 emit usbBlocked(false); |
470 emit usbSynchronizationFinished(); |
520 emit usbSynchronizationFinished(); |
471 emit libraryRefreshNeeded(); |
521 refreshLibrary(); |
472 |
522 |
473 TX_EXIT |
523 TX_EXIT |
474 } |
524 } |
475 |
525 |
476 /*! |
526 /*! |
477 To be called when EMcMsgUSBMTPStart event is received. |
527 To be called when EMcMsgUSBMTPStart event is received. |
478 */ |
528 */ |
479 void MpEngine::handleUsbMtpStartEvent() |
529 void MpEngine::handleUsbMtpStartEvent() |
480 { |
530 { |
481 TX_ENTRY |
531 TX_ENTRY |
482 mMediaKeyHandler->setEnabled(false); |
532 mHandleMediaCommands = false; |
483 |
533 |
484 changeUsbBlockingState( USB_Synchronizing ); |
534 changeUsbBlockingState( USB_Synchronizing ); |
485 emit usbBlocked(true); |
535 emit usbBlocked(true); |
486 |
536 |
487 //Cancel any ongoing operation. |
537 //Cancel any ongoing operation. |
496 To be called when EMcMsgUSBMTPEnd event is received. |
546 To be called when EMcMsgUSBMTPEnd event is received. |
497 */ |
547 */ |
498 void MpEngine::handleUsbMtpEndEvent() |
548 void MpEngine::handleUsbMtpEndEvent() |
499 { |
549 { |
500 TX_ENTRY |
550 TX_ENTRY |
501 mMediaKeyHandler->setEnabled(true); |
551 mHandleMediaCommands = true; |
502 |
552 |
503 changeUsbBlockingState( USB_NotConnected ); |
553 changeUsbBlockingState( USB_NotConnected ); |
504 emit usbBlocked(false); |
554 emit usbBlocked(false); |
505 |
555 |
506 if ( mPreviousUsbState == USB_Synchronizing ) { |
556 if ( mPreviousUsbState == USB_Synchronizing ) { |
716 Slot to be called when song deleting starts. |
766 Slot to be called when song deleting starts. |
717 */ |
767 */ |
718 void MpEngine::handleDeleteStarted( TCollectionContext context, int count ) |
768 void MpEngine::handleDeleteStarted( TCollectionContext context, int count ) |
719 { |
769 { |
720 TX_ENTRY |
770 TX_ENTRY |
721 mMediaKeyHandler->setEnabled( false ); |
771 mHandleMediaCommands = false; |
722 emit deleteStarted( context, count ); |
772 emit deleteStarted( context, count ); |
723 TX_EXIT |
773 TX_EXIT |
724 } |
774 } |
725 |
775 |
726 /*! |
776 /*! |
727 Slot to be called when song deleting ends. |
777 Slot to be called when song deleting ends. |
728 */ |
778 */ |
729 void MpEngine::handleDeleteEnded( bool success ) |
779 void MpEngine::handleDeleteEnded( bool success ) |
730 { |
780 { |
731 TX_ENTRY |
781 TX_ENTRY |
732 mMediaKeyHandler->setEnabled(true); |
782 mHandleMediaCommands = true; |
733 emit songsDeleted( success ); |
783 emit songsDeleted( success ); |
734 TX_EXIT |
784 TX_EXIT |
735 } |
785 } |
736 |
786 |
737 /*! |
787 /*! |
775 |
825 |
776 void MpEngine::playEmbedded(const XQSharableFile& file ) |
826 void MpEngine::playEmbedded(const XQSharableFile& file ) |
777 { |
827 { |
778 mMpxPlaybackWrapper->play( file ); |
828 mMpxPlaybackWrapper->play( file ); |
779 } |
829 } |
830 |
|
831 /*! |
|
832 Slot to handle a play command |
|
833 */ |
|
834 |
|
835 void MpEngine::play() |
|
836 { |
|
837 if ( mHandleMediaCommands ) { |
|
838 mMpxPlaybackWrapper->play(); |
|
839 } |
|
840 } |
|
841 |
|
842 /*! |
|
843 Slot to handle a pause command. |
|
844 */ |
|
845 void MpEngine::pause() |
|
846 { |
|
847 if ( mHandleMediaCommands ) { |
|
848 mMpxPlaybackWrapper->pause(); |
|
849 } |
|
850 } |
|
851 |
|
780 /*! |
852 /*! |
781 Slot to handle a play pause. |
853 Slot to handle a play pause. |
782 */ |
854 */ |
783 void MpEngine::playPause() |
855 void MpEngine::playPause() |
784 { |
856 { |
785 mMpxPlaybackWrapper->playPause(); |
857 if ( mHandleMediaCommands ) { |
858 mMpxPlaybackWrapper->playPause(); |
|
859 } |
|
786 } |
860 } |
787 |
861 |
788 /*! |
862 /*! |
789 Slot to handle a stop. |
863 Slot to handle a stop. |
790 */ |
864 */ |
791 void MpEngine::stop() |
865 void MpEngine::stop() |
792 { |
866 { |
793 mMpxPlaybackWrapper->stop(); |
867 if ( mHandleMediaCommands ) { |
868 mMpxPlaybackWrapper->stop(); |
|
869 } |
|
794 } |
870 } |
795 |
871 |
796 /*! |
872 /*! |
797 Slot to handle a skip forward. |
873 Slot to handle a skip forward. |
798 */ |
874 */ |
799 void MpEngine::skipForward() |
875 void MpEngine::skipForward() |
800 { |
876 { |
801 mMpxPlaybackWrapper->skipForward(); |
877 if ( mHandleMediaCommands ) { |
878 mMpxPlaybackWrapper->skipForward(); |
|
879 } |
|
802 } |
880 } |
803 |
881 |
804 /*! |
882 /*! |
805 Slot to handle seek forward. |
883 Slot to handle seek forward. |
806 */ |
884 */ |
807 void MpEngine::startSeekForward() |
885 void MpEngine::startSeekForward() |
808 { |
886 { |
809 mMpxPlaybackWrapper->startSeekForward(); |
887 if ( mHandleMediaCommands ) { |
888 mMpxPlaybackWrapper->startSeekForward(); |
|
889 } |
|
810 } |
890 } |
811 |
891 |
812 /*! |
892 /*! |
813 Slot to handle stop seeking. |
893 Slot to handle stop seeking. |
814 */ |
894 */ |
815 void MpEngine::stopSeeking() |
895 void MpEngine::stopSeeking() |
816 { |
896 { |
817 mMpxPlaybackWrapper->stopSeeking(); |
897 if ( mHandleMediaCommands ) { |
898 mMpxPlaybackWrapper->stopSeeking(); |
|
899 } |
|
818 } |
900 } |
819 |
901 |
820 /*! |
902 /*! |
821 Slot to handle a skip backwards. |
903 Slot to handle a skip backwards. |
822 */ |
904 */ |
823 void MpEngine::skipBackward() |
905 void MpEngine::skipBackward() |
824 { |
906 { |
825 mMpxPlaybackWrapper->skipBackward(); |
907 if ( mHandleMediaCommands ) { |
908 mMpxPlaybackWrapper->skipBackward(); |
|
909 } |
|
826 } |
910 } |
827 |
911 |
828 /*! |
912 /*! |
829 Slot to handle seek backwards. |
913 Slot to handle seek backwards. |
830 */ |
914 */ |
831 void MpEngine::startSeekBackward() |
915 void MpEngine::startSeekBackward() |
832 { |
916 { |
833 mMpxPlaybackWrapper->startSeekBackward(); |
917 if ( mHandleMediaCommands ) { |
918 mMpxPlaybackWrapper->startSeekBackward(); |
|
919 } |
|
834 } |
920 } |
835 /*! |
921 /*! |
836 Slot to handle a request to change \a position. |
922 Slot to handle a request to change \a position. |
837 */ |
923 */ |
838 void MpEngine::setPosition( int position ) |
924 void MpEngine::setPosition( int position ) |
855 { |
941 { |
856 mMpxPlaybackWrapper->setRepeat( mode ); |
942 mMpxPlaybackWrapper->setRepeat( mode ); |
857 } |
943 } |
858 |
944 |
859 /*! |
945 /*! |
860 Returns pointer to MpSongData, which is the song data for detail's view. |
946 Slot to handle a request to get the volume level Max. |
947 Response will be asynchronously sent through volumePropertyChanged() signal. |
|
948 */ |
|
949 void MpEngine::getMaxVolume( ) |
|
950 { |
|
951 mMpxPlaybackWrapper->getMaxVolume(); |
|
952 } |
|
953 |
|
954 /*! |
|
955 Slot to handle a request to get the current volume level. |
|
956 Response will be asynchronously sent through volumePropertyChanged() signal. |
|
957 */ |
|
958 void MpEngine::getVolume( ) |
|
959 { |
|
960 mMpxPlaybackWrapper->getVolume(); |
|
961 } |
|
962 |
|
963 /*! |
|
964 Slot to handle a request to increase volume. |
|
965 */ |
|
966 void MpEngine::increaseVolume() |
|
967 { |
|
968 if ( mHandleMediaCommands ) { |
|
969 mMpxPlaybackWrapper->increaseVolume(); |
|
970 } |
|
971 } |
|
972 |
|
973 /*! |
|
974 Slot to handle a request to decrease volume. |
|
975 */ |
|
976 void MpEngine::decreaseVolume() |
|
977 { |
|
978 if ( mHandleMediaCommands ) { |
|
979 mMpxPlaybackWrapper->decreaseVolume(); |
|
980 } |
|
981 } |
|
982 |
|
983 /*! |
|
984 Slot to handle a request to set the volume level. |
|
985 */ |
|
986 void MpEngine::setVolume( int value ) |
|
987 { |
|
988 if ( mHandleMediaCommands ) { |
|
989 mMpxPlaybackWrapper->setVolume( value ); |
|
990 } |
|
991 } |
|
992 |
|
993 /*! |
|
994 Slot to handle a request to get the current mute state. |
|
995 Response will be asynchronously sent through volumePropertyChanged() signal. |
|
996 */ |
|
997 void MpEngine::getMuteState( ) |
|
998 { |
|
999 mMpxPlaybackWrapper->getMuteState(); |
|
1000 } |
|
1001 |
|
1002 /*! |
|
1003 Slot to handle a request to mute. |
|
1004 */ |
|
1005 void MpEngine::mute() |
|
1006 { |
|
1007 if ( mHandleMediaCommands ) { |
|
1008 mMpxPlaybackWrapper->mute(); |
|
1009 } |
|
1010 } |
|
1011 |
|
1012 /*! |
|
1013 Slot to handle a request to unmute. |
|
1014 */ |
|
1015 void MpEngine::unmute() |
|
1016 { |
|
1017 if ( mHandleMediaCommands ) { |
|
1018 mMpxPlaybackWrapper->unmute(); |
|
1019 } |
|
1020 } |
|
1021 |
|
1022 /*! |
|
1023 Returns pointer to MpSongData, which is the song data for Details View. |
|
861 */ |
1024 */ |
862 MpSongData *MpEngine::songData() |
1025 MpSongData *MpEngine::songData() |
863 { |
1026 { |
864 return mMpxDetailsWrapper->songData(); |
1027 return mSongData; |
865 } |
1028 } |
866 |
1029 |
867 /*! |
1030 /*! |
868 Retrieve song informatioin |
1031 Retrieves song details for the specified \a index. |
869 */ |
1032 */ |
870 void MpEngine::retrieveSong() |
1033 void MpEngine::retrieveSongDetails( int index ) |
871 { |
1034 { |
872 TX_ENTRY |
1035 TX_ENTRY |
873 mMpxDetailsWrapper->retrieveSong(); |
1036 if ( index == -1 ) { |
1037 // Retrieve song details of currently playing song |
|
1038 mMpxPlaybackWrapper->retrieveSongDetails(); |
|
1039 } |
|
1040 else { |
|
1041 mMpxCollectionWrapper->retrieveSongDetails(index); |
|
1042 } |
|
874 TX_EXIT |
1043 TX_EXIT |
875 } |
1044 } |
876 |
1045 |
877 /*! |
1046 /*! |
878 Retrieve balance informatioin from audio effects |
1047 Retrieve balance informatioin from audio effects |