mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/stub/src/mpsongdata.cpp
changeset 47 4cc1412daed0
parent 45 612c4815aebe
child 51 560ce2306a17
equal deleted inserted replaced
45:612c4815aebe 47:4cc1412daed0
     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: Playback Data provider for playback view.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <QString>
       
    20 #include <QPixmap>
       
    21 
       
    22 #include "mpsongdata.h"
       
    23 #include "mptrace.h"
       
    24 
       
    25 
       
    26 const int KUndefined = -1;
       
    27 
       
    28 /*!
       
    29     \class MpSongData
       
    30     \brief Music Player song metadata.
       
    31 
       
    32     Song data provide acces to current playing song metadata
       
    33 */
       
    34     
       
    35 /*!
       
    36     \fn void albumArtReady()
       
    37 
       
    38     This signal is albuma alrt is ready.
       
    39  */
       
    40 
       
    41 /*!
       
    42     \fn void playbackInfoChanged()
       
    43 
       
    44     This signal is emitted when basic information is available
       
    45  */
       
    46     
       
    47 /*!
       
    48     \fn void songDetailInfoChanged()
       
    49 
       
    50     This signal is emitted when detail information is available
       
    51  */
       
    52     
       
    53        
       
    54 
       
    55 /*!
       
    56     Constructs a new MpSongData.
       
    57  */
       
    58 MpSongData::MpSongData( QObject *parent )
       
    59     : QObject( parent ),
       
    60       mTitle( NULL ),
       
    61       mAlbum( NULL ),
       
    62       mArtist( NULL ),
       
    63       mComposer( NULL),
       
    64       mGenre( NULL ),
       
    65       mYear( NULL ),
       
    66       mAlbumTrack( NULL ),
       
    67       mAlbumArt(),
       
    68       mReqId( KUndefined )
       
    69 {
       
    70     TX_ENTRY_ARGS("Stub")
       
    71 }
       
    72 
       
    73 /*!
       
    74  Constructs a new MpSongData.
       
    75  */
       
    76 MpSongData::~MpSongData()
       
    77 {
       
    78     TX_ENTRY_ARGS("Stub")
       
    79 }
       
    80 
       
    81 /*!
       
    82  Returns the song album art on \a pixmap.
       
    83 */
       
    84 void MpSongData::albumArt( QPixmap& pixmap )
       
    85 {
       
    86      if ( !mAlbumArt.isNull() ) {
       
    87         pixmap = mAlbumArt;
       
    88      }
       
    89      else {
       
    90          pixmap = QPixmap();
       
    91      }
       
    92 }
       
    93 
       
    94 
       
    95 /*!
       
    96  Returns the song title.
       
    97 */
       
    98 QString MpSongData::title() const
       
    99 {
       
   100     return mTitle;
       
   101 }
       
   102 
       
   103 /*!
       
   104  Returns the song album.
       
   105 */
       
   106 QString MpSongData::album() const
       
   107 {
       
   108     return mAlbum;
       
   109 }
       
   110 
       
   111 /*!
       
   112  Returns the song artist.
       
   113 */
       
   114 QString MpSongData::artist() const
       
   115 {
       
   116     return mArtist;
       
   117 }
       
   118 
       
   119 /*!
       
   120  Returns comment
       
   121 */
       
   122 QString MpSongData::comment() const
       
   123 {
       
   124     return mComment;
       
   125 }
       
   126 
       
   127 /*!
       
   128  Returns the song composer.
       
   129 */
       
   130 QString MpSongData::composer() const
       
   131 {
       
   132     return mComposer;
       
   133 }
       
   134 
       
   135 
       
   136 /*!
       
   137  Returns the song genre.
       
   138 */
       
   139 QString MpSongData::genre() const
       
   140 {
       
   141     return mGenre;
       
   142 }
       
   143 
       
   144 
       
   145 /*!
       
   146  Returns the album track.
       
   147 */
       
   148 QString MpSongData::albumTrack() const
       
   149 {
       
   150     return mAlbumTrack;
       
   151 }
       
   152 
       
   153 /*!
       
   154  Returns link
       
   155 */
       
   156 QString MpSongData::link() const
       
   157 {
       
   158     return mLink;
       
   159 }
       
   160 
       
   161 /*!
       
   162  Returns the release date.
       
   163 */
       
   164 QString MpSongData::year() const
       
   165 {
       
   166     return mYear;
       
   167 }
       
   168 
       
   169 
       
   170 /*!
       
   171  Sets the song \a title, returns true if the value is new.
       
   172 */
       
   173 bool MpSongData::setTitle( const QString &title )
       
   174 {
       
   175     bool change = false;
       
   176     if ( title != mTitle ) {
       
   177         change = true;
       
   178         mTitle = title;
       
   179     }
       
   180     return change;
       
   181 }
       
   182 
       
   183 /*!
       
   184  Sets the song \a album, returns true if the value is new.
       
   185 */
       
   186 bool MpSongData::setAlbum( const QString &album )
       
   187 {
       
   188     bool change = false;
       
   189     if ( album != mAlbum ) {
       
   190         change = true;
       
   191         mAlbum = album;
       
   192     }
       
   193     return change;
       
   194 }
       
   195 
       
   196 /*!
       
   197  Sets the song \a artist, returns true if the value is new.
       
   198 */
       
   199 bool MpSongData::setArtist( const QString &artist )
       
   200 {
       
   201     bool change = false;
       
   202     if ( artist != mArtist ) {
       
   203         change = true;
       
   204         mArtist = artist;
       
   205     }
       
   206     return change;
       
   207 }
       
   208 
       
   209 /*!
       
   210  Sets the song \a comment, returns true if the value is new.
       
   211 */
       
   212 bool MpSongData::setComment( const QString &comment)
       
   213 {
       
   214     bool change = false;
       
   215     if ( comment != mComment ) {
       
   216         change = true;
       
   217         mComment = comment;
       
   218     }
       
   219     return change;
       
   220 }
       
   221 
       
   222 
       
   223 /*!
       
   224  Sets the song \a composer, returns true if the value is new.
       
   225 */
       
   226 bool MpSongData::setComposer( const QString &composer )
       
   227 {
       
   228     bool change = false;
       
   229     if ( composer != mComposer ) {
       
   230         change = true;
       
   231         mComposer = composer;
       
   232     }
       
   233     return change;
       
   234 }
       
   235 
       
   236 /*!
       
   237  Sets the song \a genre, returns true if the value is new.
       
   238 */
       
   239 bool MpSongData::setGenre( const QString &genre )
       
   240 {
       
   241     bool change = false;
       
   242     if ( genre != mGenre ) {
       
   243         change = true;
       
   244         mGenre = genre;
       
   245     }
       
   246     return change;
       
   247 }
       
   248 
       
   249 
       
   250 /*!
       
   251  Sets the song \a date, returns true if the value is new.
       
   252 */
       
   253 bool MpSongData::setYear( int year )
       
   254 {
       
   255     bool change = false;
       
   256     if ( QString::number(year) != mYear ) {
       
   257         change = true;
       
   258         if ( year >= 0 && year < 9999 ) {
       
   259             mYear = QString::number(year);
       
   260         }
       
   261     }
       
   262     return change;
       
   263 }
       
   264 
       
   265 /*!
       
   266  Sets the \a album track, returns true if the value is new.
       
   267 */
       
   268 bool MpSongData::setAlbumTrack( const QString &track )
       
   269 {
       
   270     bool change = false;
       
   271     if ( track != mAlbumTrack ) {
       
   272         change = true;
       
   273         mAlbumTrack = track;
       
   274     }
       
   275     return change;
       
   276 }
       
   277 
       
   278 /*!
       
   279  Sets the \a link
       
   280 */
       
   281 void MpSongData::setLink( const QString &link )
       
   282 {
       
   283     mLink = link;
       
   284 }
       
   285 
       
   286 /*!
       
   287  Sets the song \a albumArtUri.
       
   288 */
       
   289 void MpSongData::setAlbumArtUri( const QString &albumArtUri)
       
   290 {
       
   291     Q_UNUSED(albumArtUri);
       
   292     mAlbumArt = mDefaultAlbumArt;
       
   293     emit albumArtReady();
       
   294 }
       
   295 
       
   296 
       
   297 /*!
       
   298  Slot to handle the album art thumb.
       
   299 */
       
   300 void MpSongData::thumbnailReady(
       
   301         const QPixmap& pixmap,
       
   302         void *data,
       
   303         int id,
       
   304         int error  )
       
   305 {
       
   306     Q_UNUSED( pixmap );
       
   307     Q_UNUSED( data );
       
   308     Q_UNUSED( id );
       
   309     Q_UNUSED( error );
       
   310 }
       
   311 
       
   312 /*!
       
   313  Emit signal when playback information changed, such as artist, track name
       
   314 */
       
   315 void MpSongData::commitPlaybackInfo()
       
   316 {
       
   317     emit playbackInfoChanged();
       
   318 }
       
   319 
       
   320 /*!
       
   321  Emit signal when song detail information changed
       
   322 */
       
   323 void MpSongData::commitSongDetailInfo()
       
   324 {
       
   325     emit songDetailInfoChanged();
       
   326 }
       
   327 
       
   328 QString MpSongData::albumArtBase64() const
       
   329 {
       
   330 
       
   331     return QString("");
       
   332 }
       
   333 
       
   334 void MpSongData::removeAlbumArtFile() const
       
   335 {
       
   336 
       
   337 }