mpdata/src/mpsongdata.cpp
branchRCL_3
changeset 52 14979e23cb5e
equal deleted inserted replaced
50:26a1709b9fec 52: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: Detailed song data provider for Details View.
       
    15 *
       
    16 */
       
    17 
       
    18 #include <thumbnailmanager_qt.h>
       
    19 
       
    20 #include "mpsongdata.h"
       
    21 #include "mpsongdata_p.h"
       
    22 
       
    23 /*!
       
    24     \class MpSongData
       
    25     \brief Music Player song metadata.
       
    26 
       
    27     Song data provide access to song metadata.
       
    28 */
       
    29 
       
    30 /*!
       
    31     \fn void albumArtReady()
       
    32 
       
    33     This signal is emitted album art is ready.
       
    34  */
       
    35 
       
    36 /*!
       
    37     \fn void playbackInfoChanged()
       
    38 
       
    39     This signal is emitted when basic information is available.
       
    40  */
       
    41 
       
    42 /*!
       
    43     \fn void songDetailInfoChanged()
       
    44 
       
    45     This signal is emitted when detail information is available.
       
    46  */
       
    47 
       
    48 
       
    49 /*!
       
    50     Constructs a new song data.
       
    51  */
       
    52 MpSongData::MpSongData( QObject *parent )
       
    53     : QObject( parent )
       
    54 {
       
    55     mThumbnailManager = new ThumbnailManager( this );
       
    56     mThumbnailManager->setQualityPreference( ThumbnailManager::OptimizeForQuality );
       
    57     mThumbnailManager->setThumbnailSize( ThumbnailManager::ThumbnailMedium );
       
    58     connect( mThumbnailManager, SIGNAL( thumbnailReady(QPixmap, void *, int, int) ),
       
    59              this, SLOT( thumbnailReady(QPixmap, void *, int, int) ) );
       
    60     d_ptr = new MpSongDataPrivate(this, mThumbnailManager);
       
    61 }
       
    62 
       
    63 /*!
       
    64  Destructs the song data.
       
    65  */
       
    66 MpSongData::~MpSongData()
       
    67 {
       
    68     delete mThumbnailManager;
       
    69     delete d_ptr;
       
    70 }
       
    71 
       
    72 /*!
       
    73  Returns the song title.
       
    74  */
       
    75 QString MpSongData::title() const
       
    76 {
       
    77     return d_ptr->title();
       
    78 }
       
    79 
       
    80 /*!
       
    81  Returns the song album.
       
    82  */
       
    83 QString MpSongData::album() const
       
    84 {
       
    85     return d_ptr->album();
       
    86 }
       
    87 
       
    88 /*!
       
    89  Returns the song artist.
       
    90  */
       
    91 QString MpSongData::artist() const
       
    92 {
       
    93     return d_ptr->artist();
       
    94 }
       
    95 
       
    96 /*!
       
    97  Returns comment
       
    98  */
       
    99 QString MpSongData::comment() const
       
   100 {
       
   101     return d_ptr->comment();
       
   102 }
       
   103 
       
   104 /*!
       
   105  Returns the song album art on \a icon.
       
   106  */
       
   107 void MpSongData::albumArt( HbIcon& icon ) const
       
   108 {
       
   109     d_ptr->albumArt(icon);
       
   110 }
       
   111 
       
   112 /*!
       
   113  Returns the release date.
       
   114  */
       
   115 QString MpSongData::year() const
       
   116 {
       
   117     return d_ptr->year();
       
   118 }
       
   119 
       
   120 /*!
       
   121  Returns the song genre.
       
   122  */
       
   123 QString MpSongData::genre() const
       
   124 {
       
   125     return d_ptr->genre();
       
   126 }
       
   127 
       
   128 /*!
       
   129  Returns the song composer.
       
   130  */
       
   131 QString MpSongData::composer() const
       
   132 {
       
   133     return d_ptr->composer();
       
   134 }
       
   135 
       
   136 /*!
       
   137  Returns the album track.
       
   138  */
       
   139 QString MpSongData::albumTrack() const
       
   140 {
       
   141     return d_ptr->albumTrack();
       
   142 }
       
   143 
       
   144 /*!
       
   145  Returns link
       
   146  */
       
   147 QString MpSongData::link() const
       
   148 {
       
   149     return d_ptr->link();
       
   150 }
       
   151 
       
   152 
       
   153 /*!
       
   154  Returns the file name
       
   155  */
       
   156 QString MpSongData::fileName() const
       
   157 {
       
   158     return d_ptr->fileName();
       
   159 }
       
   160 
       
   161 /*!
       
   162  Returns the MIME type
       
   163  */
       
   164 QString MpSongData::mimeType() const
       
   165 {
       
   166     return d_ptr->mimeType();
       
   167 }
       
   168 
       
   169 /*!
       
   170  Returns the duration
       
   171  */
       
   172 QString MpSongData::duration() const
       
   173 {
       
   174     return d_ptr->duration();
       
   175 }
       
   176 
       
   177 /*!
       
   178  Returns the bit rate
       
   179  */
       
   180 QString MpSongData::bitRate() const
       
   181 {
       
   182     return d_ptr->bitRate();
       
   183 }
       
   184 
       
   185 /*!
       
   186  Returns the sampling rate
       
   187  */
       
   188 QString MpSongData::sampleRate() const
       
   189 {
       
   190     return d_ptr->sampleRate();
       
   191 }
       
   192 
       
   193 /*!
       
   194  Returns the size
       
   195  */
       
   196 QString MpSongData::size() const
       
   197 {
       
   198     return d_ptr->size();
       
   199 }
       
   200 
       
   201 /*!
       
   202  Returns the modified time
       
   203  */
       
   204 QString MpSongData::modified() const
       
   205 {
       
   206     return d_ptr->modified();
       
   207 }
       
   208 
       
   209 /*!
       
   210  Returns the copyright
       
   211  */
       
   212 QString MpSongData::copyright() const
       
   213 {
       
   214     return d_ptr->copyright();
       
   215 }
       
   216 
       
   217 /*!
       
   218  Returns the music URL
       
   219  */
       
   220 QString MpSongData::musicURL() const
       
   221 {
       
   222     return d_ptr->musicURL();
       
   223 }
       
   224 
       
   225 /*!
       
   226  Returns whether the song is protected
       
   227  */
       
   228 bool MpSongData::isDrmProtected() const
       
   229 {
       
   230     return d_ptr->isDrmProtected();
       
   231 }
       
   232 
       
   233 
       
   234 /*!
       
   235  Retrieve the album art in base64 encoding suitable for inline HTML display for sharing player.
       
   236  */
       
   237 QString MpSongData::albumArtBase64() const
       
   238 {
       
   239     return d_ptr->albumArtBase64();
       
   240 }
       
   241 
       
   242 /*!
       
   243  Delete temporary album art file.
       
   244  */
       
   245 void MpSongData::removeAlbumArtFile() const
       
   246 {
       
   247     d_ptr->removeAlbumArtFile();
       
   248 }
       
   249 
       
   250 /*!
       
   251  Sets the \a link
       
   252 */
       
   253 void MpSongData::setLink( const QString &link )
       
   254 {
       
   255     d_ptr->setLink(link);
       
   256 }
       
   257 
       
   258 /*!
       
   259  Sets the media \a media from the MPX framework.
       
   260  Internal usage only from MpEngine.
       
   261  */
       
   262 void MpSongData::setMpxMedia( const CMPXMedia& media )
       
   263 {
       
   264     d_ptr->setMpxMedia(media);
       
   265 }
       
   266 
       
   267 /*!
       
   268  Returns the reserved length.
       
   269  */
       
   270 int MpSongData::reservedLength() const
       
   271 {
       
   272     return d_ptr->reservedLength();
       
   273 }
       
   274 
       
   275 /*!
       
   276  Slot to handle the album art thumb.
       
   277  */
       
   278 void MpSongData::thumbnailReady( QPixmap pixmap, void *data, int id, int error )
       
   279 {
       
   280     d_ptr->thumbnailReady(pixmap, data, id, error);
       
   281 }
       
   282