mpviewplugins/mpcollectionviewplugin/src/mpcollectioncontainerfactory.cpp
changeset 25 3ec52facab4d
parent 20 82baf59ce8dd
child 29 8192e5b5c935
equal deleted inserted replaced
22:ecf06a08d4d9 25:3ec52facab4d
    19 
    19 
    20 #include "mpcollectioncontainerfactory.h"
    20 #include "mpcollectioncontainerfactory.h"
    21 #include "mpcollectionview.h"
    21 #include "mpcollectionview.h"
    22 #include "mpcollectioncontainer.h"
    22 #include "mpcollectioncontainer.h"
    23 #include "mpcollectioncontainerallsongs.h"
    23 #include "mpcollectioncontainerallsongs.h"
       
    24 #include "mpcollectioncontainerartists.h"
    24 #include "mpcollectioncontaineralbums.h"
    25 #include "mpcollectioncontaineralbums.h"
    25 #include "mpcollectioncontainerplaylists.h"
    26 #include "mpcollectioncontainerplaylists.h"
    26 #include "mpcollectioncontainergenres.h"
    27 #include "mpcollectioncontainergenres.h"
    27 #include "mptrace.h"
    28 #include "mptrace.h"
    28 
    29 
    73         mCurrentContainer = new MpCollectionContainerAllSongs(mDocumentLoader);
    74         mCurrentContainer = new MpCollectionContainerAllSongs(mDocumentLoader);
    74         mCurrentContainer->initialize();
    75         mCurrentContainer->initialize();
    75         connect( mCurrentContainer, SIGNAL(itemActivated(int)), mView, SLOT(openIndex(int)) );
    76         connect( mCurrentContainer, SIGNAL(itemActivated(int)), mView, SLOT(openIndex(int)) );
    76         connect( mCurrentContainer, SIGNAL(itemLongPressed(int, QPointF)), mView, SLOT(openContextMenu(int, QPointF)) );
    77         connect( mCurrentContainer, SIGNAL(itemLongPressed(int, QPointF)), mView, SLOT(openContextMenu(int, QPointF)) );
    77         break;
    78         break;
       
    79     case ECollectionContextArtists:
       
    80             if ( ( mCurrentContext != ECollectionContextArtistAlbums ) && ( mCurrentContext != ECollectionContextAlbumSongs) )
       
    81                 {
       
    82                 deleteCurrentContainer();
       
    83                 mCurrentContainer = new MpCollectionContainerArtists(mDocumentLoader);
       
    84                 mCurrentContainer->initialize();
       
    85                 connect( mCurrentContainer, SIGNAL(itemActivated(int)), mView, SLOT(openIndex(int)) );
       
    86                 connect( mCurrentContainer, SIGNAL(itemLongPressed(int, QPointF)), mView, SLOT(openContextMenu(int, QPointF)) );
       
    87             }
       
    88             break;
    78     case ECollectionContextAlbums:
    89     case ECollectionContextAlbums:
    79         if ( mCurrentContext != ECollectionContextAlbumSongs ) {
    90         if ( mCurrentContext != ECollectionContextAlbumSongs ) {
    80             deleteCurrentContainer();
    91             deleteCurrentContainer();
    81             mCurrentContainer = new MpCollectionContainerAlbums(mDocumentLoader);
    92             mCurrentContainer = new MpCollectionContainerAlbums(mDocumentLoader);
    82             mCurrentContainer->initialize();
    93             mCurrentContainer->initialize();
   101             connect( mCurrentContainer, SIGNAL(itemActivated(int)), mView, SLOT(openIndex(int)) );
   112             connect( mCurrentContainer, SIGNAL(itemActivated(int)), mView, SLOT(openIndex(int)) );
   102             //connect( mCurrentContainer, SIGNAL(itemLongPressed(int, QPointF)), mView, SLOT(openContextMenu(int, QPointF)) );
   113             //connect( mCurrentContainer, SIGNAL(itemLongPressed(int, QPointF)), mView, SLOT(openContextMenu(int, QPointF)) );
   103         }
   114         }
   104         break;
   115         break;
   105     case ECollectionContextAlbumSongs:
   116     case ECollectionContextAlbumSongs:
       
   117     case ECollectionContextArtistAlbums:
       
   118     case ECollectionContextArtistSongs:
   106     case ECollectionContextPlaylistSongs:
   119     case ECollectionContextPlaylistSongs:
   107     case ECollectionContextGenreSongs:
   120     case ECollectionContextGenreSongs:
   108         // For this contexts, reuse the same container.
   121         // For this contexts, reuse the same container.
   109         break;
   122         break;
   110     }
   123     }
   121     TX_ENTRY_ARGS("mCurrentContext=" << mCurrentContext);
   134     TX_ENTRY_ARGS("mCurrentContext=" << mCurrentContext);
   122     switch ( mCurrentContext ) {
   135     switch ( mCurrentContext ) {
   123     case ECollectionContextAllSongs:
   136     case ECollectionContextAllSongs:
   124         delete static_cast<MpCollectionContainerAllSongs *>(mCurrentContainer);
   137         delete static_cast<MpCollectionContainerAllSongs *>(mCurrentContainer);
   125         break;
   138         break;
       
   139     case ECollectionContextArtists:
       
   140     case ECollectionContextArtistAlbums:
       
   141     case ECollectionContextArtistSongs:
       
   142         delete static_cast<MpCollectionContainerArtists *>(mCurrentContainer);
       
   143         break;
   126     case ECollectionContextAlbums:
   144     case ECollectionContextAlbums:
   127     case ECollectionContextAlbumSongs:
   145     case ECollectionContextAlbumSongs:
   128         delete static_cast<MpCollectionContainerAlbums *>(mCurrentContainer);
   146         delete static_cast<MpCollectionContainerAlbums *>(mCurrentContainer);
   129         break;
   147         break;
   130     case ECollectionContextPlaylists:
   148     case ECollectionContextPlaylists: