mpviewplugins/mpcollectionviewplugin/src/mpmpxcollectiondata.cpp
changeset 19 4e84c994a771
child 20 82baf59ce8dd
equal deleted inserted replaced
5:2a40e88564c8 19:4e84c994a771
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Music Player collection data.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "mpmpxcollectiondata.h"
       
    19 #include "mpmpxcollectiondata_p.h"
       
    20 
       
    21 /*!
       
    22     \class MpMpxCollectionData
       
    23     \brief Music Player collection data.
       
    24 
       
    25     Collection data provides access to collection data needed by the view.
       
    26     Every item of data can be accessed via an index and its details by specifying
       
    27     the data type of the selected data item.
       
    28 */
       
    29 
       
    30 /*!
       
    31     \enum MpMpxCollectionData::DataType
       
    32 
       
    33     This enum defines available data types.
       
    34  */
       
    35 
       
    36 /*!
       
    37     \fn void contextChanged( TCollectionContext context )
       
    38 
       
    39     This signal is emitted when a new data set is available and the
       
    40     collection context is changed.
       
    41 
       
    42     \sa setMpxMedia()
       
    43  */
       
    44 
       
    45 /*!
       
    46  Constructs the collection data.
       
    47  */
       
    48 MpMpxCollectionData::MpMpxCollectionData( QObject *parent )
       
    49     : QObject(parent)
       
    50 {
       
    51     d_ptr = new MpMpxCollectionDataPrivate(this);
       
    52 }
       
    53 
       
    54 /*!
       
    55  Destructs the collection data.
       
    56  */
       
    57 MpMpxCollectionData::~MpMpxCollectionData()
       
    58 {
       
    59     delete d_ptr;
       
    60 }
       
    61 
       
    62 /*!
       
    63  Returns the current collection context.
       
    64  */
       
    65 TCollectionContext MpMpxCollectionData::context() const
       
    66 {
       
    67     return d_ptr->context();
       
    68 }
       
    69 
       
    70 /*!
       
    71  Returns the number of data entries.
       
    72  */
       
    73 int MpMpxCollectionData::count() const
       
    74 {
       
    75     return d_ptr->count();
       
    76 }
       
    77 
       
    78 /*!
       
    79  Returns the \a title of the collection data based on the current context.
       
    80  */
       
    81 QString MpMpxCollectionData::collectionTitle() const
       
    82 {
       
    83     return d_ptr->collectionTitle();
       
    84 }
       
    85 
       
    86 /*!
       
    87  Returns the data for the specified \a index and \a type.
       
    88  */
       
    89 QString MpMpxCollectionData::itemData( int index, MpMpxCollectionData::DataType type ) const
       
    90 {
       
    91     return d_ptr->itemData(index, type);
       
    92 }
       
    93 
       
    94 /*!
       
    95  Returns if the current container is of type 'Auto playlist'.
       
    96  */
       
    97 bool MpMpxCollectionData::isAutoPlaylist()
       
    98 {
       
    99     return d_ptr->isAutoPlaylist();
       
   100 }
       
   101 
       
   102 /*!
       
   103  Returns if the item specified by \a index is of type 'Auto playlist'.
       
   104  */
       
   105 bool MpMpxCollectionData::isAutoPlaylist( int index )
       
   106 {
       
   107     return d_ptr->isAutoPlaylist(index);
       
   108 }
       
   109 
       
   110 /*!
       
   111  Returns the count of the items contained within item specified by \a index.
       
   112  */
       
   113 int MpMpxCollectionData::itemCount( int index )
       
   114 {
       
   115     return d_ptr->itemCount(index);
       
   116 }
       
   117   
       
   118 /*!
       
   119  Sets the media \a entries from the MPX framework.
       
   120  Internal usage only from MpMpxFrameworkWrapper.
       
   121  */
       
   122 void MpMpxCollectionData::setMpxMedia( const CMPXMedia& entries )
       
   123 {
       
   124     d_ptr->setMpxMedia(entries);
       
   125 }
       
   126 
       
   127 /*!
       
   128  Returns the container media from the MPX framework.
       
   129  Internal usage only from MpMpxFrameworkWrapper.
       
   130 
       
   131 
       
   132  \sa setMpxMedia()
       
   133  */
       
   134 const CMPXMedia& MpMpxCollectionData::containerMedia()
       
   135 {
       
   136     return d_ptr->containerMedia();
       
   137 }
       
   138