mpdata/src/mpmpxcollectiondata.cpp
changeset 29 8192e5b5c935
parent 22 ecf06a08d4d9
child 32 c163ef0b758d
--- a/mpdata/src/mpmpxcollectiondata.cpp	Fri May 14 15:49:53 2010 +0300
+++ b/mpdata/src/mpmpxcollectiondata.cpp	Thu May 27 12:49:57 2010 +0300
@@ -43,6 +43,37 @@
  */
 
 /*!
+    \fn void dataChanged()
+
+    This signal is emitted when a new data set is available within the
+    same context. This can happen after operations like delete and several
+    playlist related operations (save, rearrange, remove).
+
+    \sa setMpxMedia()
+ */
+
+
+/*!
+    \fn void albumDataChanged()
+
+    This signal is specific to views with TBone. This signal is emitted when
+    a new data set is available for the list section of the TBone. Currently,
+    the only operation that can trigger this is the delete operation.
+
+    \sa setMpxMedia()
+ */
+
+/*!
+    \fn void refreshAlbumSongs()
+
+    This signal is specific to views with TBone. This signal is emitted when
+    album song data is available (for the list section of the TBone), upon
+    completion of MpEngine's findAlbumSongs() operation.
+
+    \sa setAlbumContent()
+ */
+
+/*!
  Constructs the collection data.
  */
 MpMpxCollectionData::MpMpxCollectionData( QObject *parent )
@@ -61,6 +92,7 @@
 
 /*!
  Returns the current collection context.
+ /sa setContext()
  */
 TCollectionContext MpMpxCollectionData::context() const
 {
@@ -157,22 +189,62 @@
  */
 void MpMpxCollectionData::insertCachedItem(int index)
 {
-    return d_ptr->insertCachedItem( index );
+    d_ptr->insertCachedItem( index );
+}
+
+/*!
+ Sets the current album in focus. Also, triggers refreshAlbumSongs() signal
+ if data contains album songs already and returns true. Otherwise, function
+ returns false.
+ */
+bool MpMpxCollectionData::setCurrentAlbum( int index )
+{
+    return d_ptr->setCurrentAlbum( index );
+}
+
+/*!
+ Returns the current album index.
+ \sa setCurrentAlbum()
+ */
+int MpMpxCollectionData::currentAlbumIndex() const
+{
+    return d_ptr->currentAlbumIndex();
 }
 
 /*!
- Sets the media \a entries from the MPX framework.
- Internal usage only from MpMpxFrameworkWrapper.
+ Returns the number of songs in the current album.
  */
-void MpMpxCollectionData::setMpxMedia( const CMPXMedia& entries )
+int MpMpxCollectionData::albumSongsCount() const
 {
-    d_ptr->setMpxMedia(entries);
+    return d_ptr->albumSongsCount();
+}
+
+/*!
+ Returns the data for the specified \a index and \a type in the current album.
+ Currently supported data types are: Title and Uri. All others will return
+
+ empty string.
+
+ \sa setCurrentAlbum()
+ */
+QString MpMpxCollectionData::albumSongData( int index, MpMpxCollectionData::DataType type ) const
+{
+    return d_ptr->albumSongData( index, type );
+}
+
+/*!
+ Sets the media \a entries from the MPX framework. The \a reopen flag indicates
+ whether the new media is a result of reopenCollection() operation in the MpEngine.
+ Internal usage only from MpEngine.
+ */
+void MpMpxCollectionData::setMpxMedia( const CMPXMedia& entries, bool reopen )
+{
+    d_ptr->setMpxMedia(entries, reopen);
 }
 
 /*!
  Returns the container media from the MPX framework.
- Internal usage only from MpMpxFrameworkWrapper.
-
+ Internal usage only from MpEngine.
 
  \sa setMpxMedia()
  */
@@ -181,3 +253,37 @@
     return d_ptr->containerMedia();
 }
 
+/*!
+ Sets the context.
+ Used to fake open() and back() in T-Bone supporting views.
+ Used to force the context for Media Wall view.
+ */
+void MpMpxCollectionData::setContext( TCollectionContext context )
+{
+    d_ptr->setContext( context );
+}
+
+/*!
+ Sets the media \a albumContent from the MPX framework.
+ Internal usage only from MpEngine.
+ Album songs have been populated. Notify the change by emitting
+ refreshAlbumSongs() signal.
+
+ \sa setCurrentAlbum()
+ */
+void MpMpxCollectionData::setAlbumContent( const CMPXMedia& albumContent )
+{
+    d_ptr->setAlbumContent(albumContent);
+}
+
+/*!
+ Returns the index of the iten with \a ItemUniqueId.
+ Only supported for ECollectionContextAlbumsMediaWall.
+
+ \sa setContext()
+ */
+int MpMpxCollectionData::itemIndex( int itemUniqueId )
+{
+    return d_ptr->itemIndex( itemUniqueId );
+}
+