mpdata/inc/mpmpxcollectiondata_p.h
branchRCL_3
changeset 25 14979e23cb5e
equal deleted inserted replaced
24:26a1709b9fec 25:14979e23cb5e
       
     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 - private implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef MPMPXCOLLECTIONDATA_P_H
       
    19 #define MPMPXCOLLECTIONDATA_P_H
       
    20 
       
    21 #include <e32base.h>
       
    22 
       
    23 #include <QHash>
       
    24 #include <QPair>
       
    25 #include <QAbstractListModel>
       
    26 
       
    27 #include "mpmpxcollectiondata.h"
       
    28 #include "mpmpxcollectionviewdefs.h"
       
    29 
       
    30 class CMPXMedia;
       
    31 class CMPXMediaArray;
       
    32 
       
    33 
       
    34 class MpMpxCollectionDataPrivate
       
    35 {
       
    36 public:
       
    37 
       
    38     explicit MpMpxCollectionDataPrivate( MpMpxCollectionData *wrapper );
       
    39     virtual ~MpMpxCollectionDataPrivate();
       
    40 
       
    41     TCollectionContext context() const;
       
    42 
       
    43     int count() const;
       
    44     QString collectionTitle() const;
       
    45     QString itemData( int index, MpMpxCollectionData::DataType type );
       
    46 
       
    47     bool isAutoPlaylist();
       
    48     bool isAutoPlaylist( int index );
       
    49     int itemCount( int index );
       
    50     int containerId();
       
    51     int itemId( int index);
       
    52     int albumSongId( int index);
       
    53     void removeItem( int index);
       
    54     bool testCachedItem( int itemId );
       
    55     void insertCachedItem( int index);
       
    56 
       
    57     bool setCurrentAlbum( int index );
       
    58     int currentAlbumIndex() const;
       
    59     int albumSongsCount() const;
       
    60     QString albumSongData( int index, MpMpxCollectionData::DataType type ) const;
       
    61     bool hasItemProperty( int index, MpMpxCollectionData:: DataProperty type ) const;
       
    62     bool hasAlbumSongProperty( int index, MpMpxCollectionData:: DataProperty type ) const;
       
    63 
       
    64     void setMpxMedia( const CMPXMedia& entries, bool reopen );
       
    65     void incrementalOpenUpdate();
       
    66     const CMPXMedia& containerMedia();
       
    67     void setContext( TCollectionContext context );
       
    68     void setAlbumContent( const CMPXMedia& albumContent );
       
    69     int itemIndex( int itemUniqueId );
       
    70     int albumSongIndex( int songUniqueId );
       
    71     QList<int> songIndex( int songUniqueId );
       
    72     void setCorruptValue( QModelIndex index, bool tBone );
       
    73     void setReloadAlbumContent( bool reloadAlbum );
       
    74 
       
    75 private:
       
    76 
       
    77     void loadAlbumsLookup();
       
    78     void loadAlbumSongsLookup();
       
    79     void setReloadRange( int index );
       
    80     int itemId2( int index);
       
    81     void DoGetDataL( int index, MpMpxCollectionData::DataType type, QString& data );
       
    82     bool DoIsAutoPlaylistL();
       
    83     bool DoIsAutoPlaylistL( int index );
       
    84     int DoGetItemCountL( int index );
       
    85     int DoGetContainerIdL();
       
    86     int DoGetItemIdL( int index );
       
    87     int DoGetItemId2L( int index );
       
    88     int DoGetAlbumSongIdL( int index );
       
    89     void DoRemoveItemL( int index );
       
    90     bool DoTestCachedItemL( int itemId );
       
    91 
       
    92     bool DoSetCurrentAlbumL( int index );
       
    93     void DoGetAlbumSongDataL( int index, MpMpxCollectionData::DataType type, QString& data ) const;
       
    94     bool DoHasItemPropertyL( int index, MpMpxCollectionData:: DataProperty type ) const;
       
    95     bool DoHasAlbumSongPropertyL( int index, MpMpxCollectionData:: DataProperty type ) const;
       
    96 
       
    97     void SetCollectionContextL();
       
    98     void DoSetMpxMediaL( const CMPXMedia& entries );
       
    99     void DoSetAlbumContentL( const CMPXMedia& albumContent );
       
   100     void DoSetCorruptValueL( QModelIndex index, bool tBone );
       
   101 
       
   102 private:
       
   103 
       
   104     MpMpxCollectionData     *q_ptr;
       
   105 
       
   106     TCollectionContext      iContext;
       
   107 
       
   108     CMPXMedia               *iContainerMedia;       // Owned
       
   109     CMPXMediaArray          *iMediaArray;           // Not owned
       
   110     CMPXMedia               *iCachedRemovedItem;    // Owned
       
   111 
       
   112     int                     iCurrentAlbumIndex;
       
   113     int                     iAlbumSongCount;
       
   114     QHash<int, int>         iAlbumIdIndexMapping;
       
   115     QHash<int, int>         iAlbumSongIdIndexMapping;
       
   116     QHash<int, int>         iSongIdIndexMapping;
       
   117     bool                    iReloadAlbumContent;
       
   118 
       
   119     bool                    iNeedReload;
       
   120     QPair<int, int>         iReloadRange;
       
   121 	
       
   122 };
       
   123 
       
   124 #endif // MPMPXCOLLECTIONDATA_P_H
       
   125