mpengine/src/mpengine.cpp
changeset 61 3cd404d31176
parent 58 ed94e1e8390e
equal deleted inserted replaced
58:ed94e1e8390e 61:3cd404d31176
    27 #include "mptrace.h"
    27 #include "mptrace.h"
    28 #include "mpsettingsmanager.h"
    28 #include "mpsettingsmanager.h"
    29 #include "mpsongscanner.h"
    29 #include "mpsongscanner.h"
    30 #include "mpsongdata.h"
    30 #include "mpsongdata.h"
    31 #include "mpapplicationmonitor.h"
    31 #include "mpapplicationmonitor.h"
       
    32 #include "mpplaybackdata.h"
    32 
    33 
    33 /*!
    34 /*!
    34     \class MpEngine
    35     \class MpEngine
    35     \brief Engine for musicplayer - mpx framework utilities.
    36     \brief Engine for musicplayer - mpx framework utilities.
    36 
    37 
   220  Destructs music player engine.
   221  Destructs music player engine.
   221  */
   222  */
   222 MpEngine::~MpEngine()
   223 MpEngine::~MpEngine()
   223 {
   224 {
   224     TX_ENTRY
   225     TX_ENTRY
   225     delete mMpxPlaybackWrapper;
   226     if ( mMpxPlaybackWrapper ) {
       
   227         // Don't send stop cmd if mode=HomeScreen, because we don't want to stop playback when the music widget is deleted.
       
   228         if ( mEngineMode != HomeScreen ) {
       
   229             mMpxPlaybackWrapper->forceStop();
       
   230         }
       
   231         delete mMpxPlaybackWrapper;
       
   232     }
       
   233     
   226     delete mMpxHarvesterWrapper;
   234     delete mMpxHarvesterWrapper;
   227     delete mMpxCollectionWrapper;
   235     delete mMpxCollectionWrapper;
   228     delete mAudioEffectsWrapper;
   236     delete mAudioEffectsWrapper;
   229     delete mEqualizerWrapper;
   237     delete mEqualizerWrapper;
   230     delete mSongScanner;
   238     delete mSongScanner;
   262 				 Qt::QueuedConnection );
   270 				 Qt::QueuedConnection );
   263 
   271 
   264         // Collection Wrapper
   272         // Collection Wrapper
   265         mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( clientSecureId, mSongData );
   273         mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( clientSecureId, mSongData );
   266         connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ),
   274         connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ),
   267                  this, SIGNAL( collectionPlaylistOpened() ), 
   275                  this, SLOT( handleCollectionPlaylistOpened() ), 
   268 				 Qt::QueuedConnection );
   276 				 Qt::QueuedConnection );
   269         connect( mMpxCollectionWrapper, SIGNAL( aboutToAddSongs(int) ),
   277         connect( mMpxCollectionWrapper, SIGNAL( aboutToAddSongs(int) ),
   270                  this, SIGNAL( aboutToAddSongs(int) ) );
   278                  this, SIGNAL( aboutToAddSongs(int) ) );
   271         connect( mMpxCollectionWrapper, SIGNAL( playlistSaved(bool) ),
   279         connect( mMpxCollectionWrapper, SIGNAL( playlistSaved(bool) ),
   272                  this, SIGNAL( playlistSaved(bool) ), 
   280                  this, SIGNAL( playlistSaved(bool) ), 
   325 				 Qt::QueuedConnection );
   333 				 Qt::QueuedConnection );
   326 
   334 
   327         // Collection Wrapper
   335         // Collection Wrapper
   328         mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( clientSecureId, 0 );
   336         mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( clientSecureId, 0 );
   329         connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ),
   337         connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ),
   330                  this, SIGNAL( collectionPlaylistOpened() ), 
   338                  this, SLOT( handleCollectionPlaylistOpened() ), 
   331 				 Qt::QueuedConnection );
   339 				 Qt::QueuedConnection );
   332         // Disabling these since fetch mode plays only one song at a time.
   340         // Disabling these since fetch mode plays only one song at a time.
   333         mMpxCollectionWrapper->setRepeatFeatureEnabled( false );
   341         mMpxCollectionWrapper->setRepeatFeatureEnabled( false );
   334         mMpxCollectionWrapper->setShuffleFeatureEnabled( false );
   342         mMpxCollectionWrapper->setShuffleFeatureEnabled( false );
   335 
   343 
   345     }
   353     }
   346     else if ( MediaBrowsing == mode ) {
   354     else if ( MediaBrowsing == mode ) {
   347         // Collection Wrapper
   355         // Collection Wrapper
   348         mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( clientSecureId, 0 );
   356         mMpxCollectionWrapper = new MpMpxCollectionFrameworkWrapper( clientSecureId, 0 );
   349         connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ),
   357         connect( mMpxCollectionWrapper, SIGNAL( collectionPlaylistOpened() ),
   350                  this, SIGNAL( collectionPlaylistOpened() ), 
   358                  this, SLOT( handleCollectionPlaylistOpened() ), 
   351 				 Qt::QueuedConnection );
   359 				 Qt::QueuedConnection );
   352         connect( mMpxCollectionWrapper, SIGNAL( containerContentsChanged() ),
   360         connect( mMpxCollectionWrapper, SIGNAL( containerContentsChanged() ),
   353                  this, SIGNAL( containerContentsChanged() ), 
   361                  this, SIGNAL( containerContentsChanged() ), 
   354 				 Qt::QueuedConnection );
   362 				 Qt::QueuedConnection );
   355     }
   363     }
  1254     emit equalizerReady();
  1262     emit equalizerReady();
  1255     
  1263     
  1256     TX_EXIT
  1264     TX_EXIT
  1257 }
  1265 }
  1258 
  1266 
       
  1267 /*!
       
  1268  Slot to handle the open of a collecion playlist.
       
  1269  */
       
  1270 void MpEngine::handleCollectionPlaylistOpened()
       
  1271 {
       
  1272     TX_ENTRY
       
  1273     
       
  1274     playbackData()->handleCollectionPlaylistOpened();
       
  1275     emit collectionPlaylistOpened();
       
  1276     
       
  1277     TX_EXIT
       
  1278 }