mpengine/src/mpmpxcollectionframeworkwrapper.cpp
changeset 22 ecf06a08d4d9
child 29 8192e5b5c935
equal deleted inserted replaced
20:82baf59ce8dd 22:ecf06a08d4d9
       
     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: Wrapper for mpx collection framework utilities.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "mpmpxcollectionframeworkwrapper.h"
       
    19 #include "mpmpxcollectionframeworkwrapper_p.h"
       
    20 
       
    21 /*!
       
    22     \class MpMpxCollectionFrameworkWrapper
       
    23     \brief Wrapper for mpx framework utilities.
       
    24 
       
    25     MPX framework wrapper provides Qt style interface to the MPX framework
       
    26     utilities. Its implementation is hidden using private class data pattern.
       
    27 */
       
    28 
       
    29 /*!
       
    30     \fn void collectionPlaylistOpened()
       
    31 
       
    32     This signal is emitted when A new collection playlist is opened and 
       
    33     playback is initialized.
       
    34 
       
    35  */
       
    36 
       
    37 /*!
       
    38     \fn void playlistSaved( bool success )
       
    39 
       
    40     This signal is emitted when playlist save operation is completed, it 
       
    41     indicates the operation \a success .
       
    42 
       
    43  */
       
    44 
       
    45 /*!
       
    46     \fn void songsDeleted( bool success )
       
    47 
       
    48     This signal is emitted when song delete operation is completed, it 
       
    49     indicates the operation \a success .
       
    50 
       
    51  */
       
    52 
       
    53 /*!
       
    54     \fn void playlistsRenamed( bool success )
       
    55 
       
    56     This signal is emitted when playlist rename operation is completed, it
       
    57     indicates the operation  \a success .
       
    58 
       
    59  */
       
    60 
       
    61 /*!
       
    62     \fn void isolatedCollectionOpened( MpMpxCollectionData* collectionData )
       
    63 
       
    64     This signal is emitted when an isolated collection is opened on \a context
       
    65 
       
    66  */
       
    67  
       
    68  
       
    69  
       
    70 /*!
       
    71  Constructs the utility wrapper.
       
    72  */
       
    73 MpMpxCollectionFrameworkWrapper::MpMpxCollectionFrameworkWrapper( MpCommon::MpViewMode viewMode, TUid hostUid, QObject *parent )
       
    74     : QObject( parent )
       
    75 {
       
    76     d_ptr = new MpMpxCollectionFrameworkWrapperPrivate( this );
       
    77     d_ptr->init( viewMode, hostUid );
       
    78 }
       
    79 
       
    80 /*!
       
    81  Destructs the utility wrapper.
       
    82  */
       
    83 MpMpxCollectionFrameworkWrapper::~MpMpxCollectionFrameworkWrapper()
       
    84 {
       
    85     delete d_ptr;
       
    86 }
       
    87 
       
    88 /*!
       
    89  Opens the collection for the given \a context.
       
    90 
       
    91  \sa collectionOpened()
       
    92  */
       
    93 void MpMpxCollectionFrameworkWrapper::openCollection( TCollectionContext context )
       
    94 {
       
    95     d_ptr->openCollection( context );
       
    96 }
       
    97 
       
    98 /*!
       
    99  Opens the collection at a specific \a index.
       
   100 
       
   101  \sa collectionOpened(), playlistOpened()
       
   102  */
       
   103 void MpMpxCollectionFrameworkWrapper::openCollectionItem( int index )
       
   104 {
       
   105     d_ptr->openCollectionItem( index );
       
   106 }
       
   107 
       
   108 /*!
       
   109  Navigates back to the container of the current items.
       
   110 
       
   111  \sa collectionOpened()
       
   112  */
       
   113 void MpMpxCollectionFrameworkWrapper::back()
       
   114 {
       
   115     d_ptr->back();
       
   116 }
       
   117 
       
   118 /*!
       
   119  Loads the user created \a playLists.
       
   120 
       
   121  */
       
   122 void MpMpxCollectionFrameworkWrapper::findPlaylists( QStringList &playlists )
       
   123 {
       
   124     d_ptr->findPlaylists( playlists );
       
   125 }
       
   126 
       
   127 /*!
       
   128  Creates a new playlist with name \a playlistName and adds \a selection and optionally uses \a collectionData.
       
   129  */
       
   130 void MpMpxCollectionFrameworkWrapper::createPlaylist( QString &playlistName, QList<int> &selection, MpMpxCollectionData* collectionData )
       
   131 {
       
   132     d_ptr->createPlaylist( playlistName, selection, collectionData );
       
   133 }
       
   134 
       
   135 /*!
       
   136  Adds \a selection to the playlist specified in \a playlistIndex.
       
   137  */
       
   138 void MpMpxCollectionFrameworkWrapper::saveToPlaylist( int playlistIndex, QList<int> &selection )
       
   139 {
       
   140     d_ptr->saveToPlaylist( playlistIndex, selection );
       
   141 }
       
   142 
       
   143 /*!
       
   144  Rename a playlist by \a index with \a name.
       
   145  */
       
   146 void MpMpxCollectionFrameworkWrapper::renamePlaylist( QString &newName, int index )
       
   147 {
       
   148     d_ptr->renamePlaylist( newName, index );
       
   149 }
       
   150 
       
   151 /*!
       
   152  Adds \a selection to the current playlist from the specified \a collectionData.
       
   153  */
       
   154 void MpMpxCollectionFrameworkWrapper::saveToCurrentPlaylist( QList<int> &selection, MpMpxCollectionData *collectionData )
       
   155 {
       
   156     d_ptr->saveToCurrentPlaylist( selection, collectionData );
       
   157 }
       
   158 
       
   159 /*!
       
   160  Rename a playlist with \a name.
       
   161  */
       
   162 void MpMpxCollectionFrameworkWrapper::renamePlaylist( QString &newName )
       
   163 {
       
   164     d_ptr->renamePlaylist( newName );
       
   165 }
       
   166 
       
   167 /*!
       
   168  Deletes \a selection from the collection.
       
   169  */
       
   170 void MpMpxCollectionFrameworkWrapper::deleteSongs( QList<int> &selection )
       
   171 {
       
   172     d_ptr->deleteSongs( selection );
       
   173 }
       
   174 
       
   175 /*!
       
   176  Sets the suffle according to \a active.
       
   177  */
       
   178 void MpMpxCollectionFrameworkWrapper::setShuffle( bool active )
       
   179 {
       
   180     d_ptr->setShuffle( active );
       
   181 }
       
   182 
       
   183 /*!
       
   184  Initiate a playback preview for the selected item.
       
   185  */
       
   186 void MpMpxCollectionFrameworkWrapper::previewItem( int index )
       
   187 {
       
   188     d_ptr->previewItem( index );
       
   189 }
       
   190 
       
   191 
       
   192 /*!
       
   193  Opens the an isolated collection with \a context.
       
   194  \sa isolatedCollectionOpened()
       
   195  */
       
   196 void MpMpxCollectionFrameworkWrapper::openIsolatedCollection( TCollectionContext context )
       
   197 {
       
   198        d_ptr->openIsolatedCollection( context );     
       
   199 }
       
   200 
       
   201 /*!
       
   202  Releases the resources used for the isolated collection.
       
   203  */
       
   204 void MpMpxCollectionFrameworkWrapper::releaseIsolatedCollection()
       
   205 {
       
   206     d_ptr->releaseIsolatedCollection();
       
   207 }
       
   208 
       
   209 /*!
       
   210  Returns pointer to MpMpxCollectionData, which is the collection data.
       
   211  */
       
   212 MpMpxCollectionData *MpMpxCollectionFrameworkWrapper::collectionData()
       
   213 {
       
   214     return d_ptr->collectionData();
       
   215 }
       
   216 
       
   217 /*!
       
   218  Called from an engine slot to reopen the collection in its current state.
       
   219 
       
   220  \sa collectionOpened()
       
   221  */
       
   222 void MpMpxCollectionFrameworkWrapper::reopenCollection()
       
   223 {
       
   224     d_ptr->reopenCollection();
       
   225 }
       
   226 
       
   227 /*!
       
   228  Called from an engine slot to request a reorder operation , indicates that 
       
   229  the item with \a playlistId , \a songId is to be moved from 
       
   230  \a originalOrdinal to \a newOrdinal.
       
   231  */
       
   232 void MpMpxCollectionFrameworkWrapper::reorderPlaylist( int playlistId, int songId, int originalOrdinal, int newOrdinal )
       
   233 {
       
   234     d_ptr->reorderPlaylist( playlistId, songId, originalOrdinal, newOrdinal );
       
   235 }
       
   236 
       
   237