mpdata/src/mpmpxcollectiondata.cpp
changeset 29 8192e5b5c935
parent 22 ecf06a08d4d9
child 32 c163ef0b758d
equal deleted inserted replaced
25:3ec52facab4d 29:8192e5b5c935
    41 
    41 
    42     \sa setMpxMedia()
    42     \sa setMpxMedia()
    43  */
    43  */
    44 
    44 
    45 /*!
    45 /*!
       
    46     \fn void dataChanged()
       
    47 
       
    48     This signal is emitted when a new data set is available within the
       
    49     same context. This can happen after operations like delete and several
       
    50     playlist related operations (save, rearrange, remove).
       
    51 
       
    52     \sa setMpxMedia()
       
    53  */
       
    54 
       
    55 
       
    56 /*!
       
    57     \fn void albumDataChanged()
       
    58 
       
    59     This signal is specific to views with TBone. This signal is emitted when
       
    60     a new data set is available for the list section of the TBone. Currently,
       
    61     the only operation that can trigger this is the delete operation.
       
    62 
       
    63     \sa setMpxMedia()
       
    64  */
       
    65 
       
    66 /*!
       
    67     \fn void refreshAlbumSongs()
       
    68 
       
    69     This signal is specific to views with TBone. This signal is emitted when
       
    70     album song data is available (for the list section of the TBone), upon
       
    71     completion of MpEngine's findAlbumSongs() operation.
       
    72 
       
    73     \sa setAlbumContent()
       
    74  */
       
    75 
       
    76 /*!
    46  Constructs the collection data.
    77  Constructs the collection data.
    47  */
    78  */
    48 MpMpxCollectionData::MpMpxCollectionData( QObject *parent )
    79 MpMpxCollectionData::MpMpxCollectionData( QObject *parent )
    49     : QObject(parent)
    80     : QObject(parent)
    50 {
    81 {
    59     delete d_ptr;
    90     delete d_ptr;
    60 }
    91 }
    61 
    92 
    62 /*!
    93 /*!
    63  Returns the current collection context.
    94  Returns the current collection context.
       
    95  /sa setContext()
    64  */
    96  */
    65 TCollectionContext MpMpxCollectionData::context() const
    97 TCollectionContext MpMpxCollectionData::context() const
    66 {
    98 {
    67     return d_ptr->context();
    99     return d_ptr->context();
    68 }
   100 }
   155  Inserts the cached item in the location specified by \a index
   187  Inserts the cached item in the location specified by \a index
   156  \sa removeItem() testCachedItem()
   188  \sa removeItem() testCachedItem()
   157  */
   189  */
   158 void MpMpxCollectionData::insertCachedItem(int index)
   190 void MpMpxCollectionData::insertCachedItem(int index)
   159 {
   191 {
   160     return d_ptr->insertCachedItem( index );
   192     d_ptr->insertCachedItem( index );
   161 }
   193 }
   162 
   194 
   163 /*!
   195 /*!
   164  Sets the media \a entries from the MPX framework.
   196  Sets the current album in focus. Also, triggers refreshAlbumSongs() signal
   165  Internal usage only from MpMpxFrameworkWrapper.
   197  if data contains album songs already and returns true. Otherwise, function
   166  */
   198  returns false.
   167 void MpMpxCollectionData::setMpxMedia( const CMPXMedia& entries )
   199  */
   168 {
   200 bool MpMpxCollectionData::setCurrentAlbum( int index )
   169     d_ptr->setMpxMedia(entries);
   201 {
       
   202     return d_ptr->setCurrentAlbum( index );
       
   203 }
       
   204 
       
   205 /*!
       
   206  Returns the current album index.
       
   207  \sa setCurrentAlbum()
       
   208  */
       
   209 int MpMpxCollectionData::currentAlbumIndex() const
       
   210 {
       
   211     return d_ptr->currentAlbumIndex();
       
   212 }
       
   213 
       
   214 /*!
       
   215  Returns the number of songs in the current album.
       
   216  */
       
   217 int MpMpxCollectionData::albumSongsCount() const
       
   218 {
       
   219     return d_ptr->albumSongsCount();
       
   220 }
       
   221 
       
   222 /*!
       
   223  Returns the data for the specified \a index and \a type in the current album.
       
   224  Currently supported data types are: Title and Uri. All others will return
       
   225 
       
   226  empty string.
       
   227 
       
   228  \sa setCurrentAlbum()
       
   229  */
       
   230 QString MpMpxCollectionData::albumSongData( int index, MpMpxCollectionData::DataType type ) const
       
   231 {
       
   232     return d_ptr->albumSongData( index, type );
       
   233 }
       
   234 
       
   235 /*!
       
   236  Sets the media \a entries from the MPX framework. The \a reopen flag indicates
       
   237  whether the new media is a result of reopenCollection() operation in the MpEngine.
       
   238  Internal usage only from MpEngine.
       
   239  */
       
   240 void MpMpxCollectionData::setMpxMedia( const CMPXMedia& entries, bool reopen )
       
   241 {
       
   242     d_ptr->setMpxMedia(entries, reopen);
   170 }
   243 }
   171 
   244 
   172 /*!
   245 /*!
   173  Returns the container media from the MPX framework.
   246  Returns the container media from the MPX framework.
   174  Internal usage only from MpMpxFrameworkWrapper.
   247  Internal usage only from MpEngine.
   175 
       
   176 
   248 
   177  \sa setMpxMedia()
   249  \sa setMpxMedia()
   178  */
   250  */
   179 const CMPXMedia& MpMpxCollectionData::containerMedia()
   251 const CMPXMedia& MpMpxCollectionData::containerMedia()
   180 {
   252 {
   181     return d_ptr->containerMedia();
   253     return d_ptr->containerMedia();
   182 }
   254 }
   183 
   255 
       
   256 /*!
       
   257  Sets the context.
       
   258  Used to fake open() and back() in T-Bone supporting views.
       
   259  Used to force the context for Media Wall view.
       
   260  */
       
   261 void MpMpxCollectionData::setContext( TCollectionContext context )
       
   262 {
       
   263     d_ptr->setContext( context );
       
   264 }
       
   265 
       
   266 /*!
       
   267  Sets the media \a albumContent from the MPX framework.
       
   268  Internal usage only from MpEngine.
       
   269  Album songs have been populated. Notify the change by emitting
       
   270  refreshAlbumSongs() signal.
       
   271 
       
   272  \sa setCurrentAlbum()
       
   273  */
       
   274 void MpMpxCollectionData::setAlbumContent( const CMPXMedia& albumContent )
       
   275 {
       
   276     d_ptr->setAlbumContent(albumContent);
       
   277 }
       
   278 
       
   279 /*!
       
   280  Returns the index of the iten with \a ItemUniqueId.
       
   281  Only supported for ECollectionContextAlbumsMediaWall.
       
   282 
       
   283  \sa setContext()
       
   284  */
       
   285 int MpMpxCollectionData::itemIndex( int itemUniqueId )
       
   286 {
       
   287     return d_ptr->itemIndex( itemUniqueId );
       
   288 }
       
   289