mpdata/src/mpsongdata.cpp
changeset 29 8192e5b5c935
child 32 c163ef0b758d
equal deleted inserted replaced
25:3ec52facab4d 29:8192e5b5c935
       
     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 #include <QPainter>
       
    22 #include <QBuffer>
       
    23 #include <QPixmap>
       
    24 #include <hbicon.h>
       
    25 #include <QIcon>
       
    26 #include <QFile>
       
    27 
       
    28 #include <thumbnailmanager_qt.h>
       
    29 #include <thumbnaildata.h>
       
    30 #include <thumbnailobjectsource.h>
       
    31 
       
    32 #include "mpsongdata.h"
       
    33 #include "mptrace.h"
       
    34 
       
    35 const int KUndefined = -1;
       
    36 
       
    37 /*!
       
    38     \class MpSongData
       
    39     \brief Music Player song metadata.
       
    40 
       
    41     Song data provide acces to current playing song metadata
       
    42 */
       
    43     
       
    44 /*!
       
    45     \fn void albumArtReady()
       
    46 
       
    47     This signal is albuma alrt is ready.
       
    48  */
       
    49 
       
    50 /*!
       
    51     \fn void playbackInfoChanged()
       
    52 
       
    53     This signal is emitted when basic information is available
       
    54  */
       
    55     
       
    56 /*!
       
    57     \fn void songDetailInfoChanged()
       
    58 
       
    59     This signal is emitted when detail information is available
       
    60  */
       
    61     
       
    62        
       
    63 
       
    64 /*!
       
    65     Constructs a new MpSongData.
       
    66  */
       
    67 MpSongData::MpSongData( QObject *parent )
       
    68     : QObject( parent ),
       
    69       mAlbumArt(),
       
    70       mReqId( KUndefined )
       
    71 {
       
    72     TX_ENTRY
       
    73     mThumbnailManager = new ThumbnailManager( this );
       
    74     mThumbnailManager->setQualityPreference( ThumbnailManager::OptimizeForQuality );
       
    75     mThumbnailManager->setThumbnailSize( ThumbnailManager::ThumbnailMedium );
       
    76     QObject::connect( mThumbnailManager, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ),
       
    77             this, SLOT( thumbnailReady( QPixmap , void * , int , int  ) ) );
       
    78 
       
    79     mDefaultAlbumArt = new HbIcon( "qtg_large_music_album" );
       
    80     TX_EXIT
       
    81 }
       
    82 
       
    83 /*!
       
    84  Constructs a new MpSongData.
       
    85  */
       
    86 MpSongData::~MpSongData()
       
    87 {
       
    88     TX_ENTRY
       
    89     if( mThumbnailManager ) {
       
    90         delete mThumbnailManager;
       
    91     }
       
    92     TX_EXIT
       
    93 }
       
    94 
       
    95 /*!
       
    96  Returns the song album art on \a pixmap.
       
    97 */
       
    98 void MpSongData::albumArt( HbIcon& icon ) const
       
    99 {
       
   100     TX_ENTRY
       
   101      if (  !mAlbumArt || mAlbumArt->isNull() ) {
       
   102          TX_LOG_ARGS( "Album art is NULL." );
       
   103          icon = HbIcon();
       
   104      } else {
       
   105          TX_LOG_ARGS( "Album art is not NULL." );
       
   106          icon = *mAlbumArt ;
       
   107      }
       
   108     TX_EXIT
       
   109 }
       
   110 
       
   111 
       
   112 /*!
       
   113  Returns the song title.
       
   114 */
       
   115 QString MpSongData::title() const
       
   116 {
       
   117     TX_LOG
       
   118     return mTitle;
       
   119 }
       
   120 
       
   121 /*!
       
   122  Returns the song album.
       
   123 */
       
   124 QString MpSongData::album() const
       
   125 {
       
   126     TX_LOG
       
   127     return mAlbum;
       
   128 }
       
   129 
       
   130 /*!
       
   131  Returns the song artist.
       
   132 */
       
   133 QString MpSongData::artist() const
       
   134 {
       
   135     TX_LOG
       
   136     return mArtist;
       
   137 }
       
   138 
       
   139 /*!
       
   140  Returns comment
       
   141 */
       
   142 QString MpSongData::comment() const
       
   143 {
       
   144     TX_LOG
       
   145     return mComment;
       
   146 }
       
   147 
       
   148 /*!
       
   149  Returns the song composer.
       
   150 */
       
   151 QString MpSongData::composer() const
       
   152 {
       
   153     TX_LOG
       
   154     return mComposer;
       
   155 }
       
   156 
       
   157 
       
   158 /*!
       
   159  Returns the song genre.
       
   160 */
       
   161 QString MpSongData::genre() const
       
   162 {
       
   163     TX_LOG
       
   164     return mGenre;
       
   165 }
       
   166 
       
   167 
       
   168 /*!
       
   169  Returns the album track.
       
   170 */
       
   171 QString MpSongData::albumTrack() const
       
   172 {
       
   173     TX_LOG
       
   174     return mAlbumTrack;
       
   175 }
       
   176 
       
   177 /*!
       
   178  Returns link
       
   179 */
       
   180 QString MpSongData::link() const
       
   181 {
       
   182     TX_LOG
       
   183     return mLink;
       
   184 }
       
   185 
       
   186 /*!
       
   187  Returns the release date.
       
   188 */
       
   189 QString MpSongData::year() const
       
   190 {
       
   191     TX_LOG    
       
   192     return mYear;
       
   193 }
       
   194 
       
   195 /*!
       
   196  Returns the file name
       
   197 */
       
   198 QString MpSongData::fileName() const
       
   199 {
       
   200     TX_LOG    
       
   201     return mFileName;
       
   202 }
       
   203 
       
   204 /*!
       
   205  Returns the MIME type
       
   206 */
       
   207 QString MpSongData::mimeType() const
       
   208 {
       
   209     TX_LOG    
       
   210     return mMimeType;   
       
   211 }
       
   212 
       
   213 /*!
       
   214  Returns the duration
       
   215 */
       
   216 QString MpSongData::duration() const
       
   217 {
       
   218     TX_LOG    
       
   219     return mDuration;  
       
   220 }
       
   221 
       
   222 /*!
       
   223  Returns the bit rate
       
   224 */
       
   225 QString MpSongData::bitRate() const
       
   226 {
       
   227     TX_LOG    
       
   228     return mBitRate;  
       
   229 }
       
   230 
       
   231 /*!
       
   232  Returns the sampling rate
       
   233 */
       
   234 QString MpSongData::sampleRate() const
       
   235 {
       
   236     TX_LOG    
       
   237     return mSampleRate;  
       
   238 }
       
   239 
       
   240 /*!
       
   241  Returns the size
       
   242 */
       
   243 QString MpSongData::size() const
       
   244 {
       
   245     TX_LOG    
       
   246     return mSize;  
       
   247 }
       
   248 
       
   249 /*!
       
   250  Returns the size
       
   251 */
       
   252 QString MpSongData::modified() const
       
   253 {
       
   254     TX_LOG    
       
   255     return mModified;  
       
   256 }
       
   257 
       
   258 /*!
       
   259  Returns the copy right
       
   260 */
       
   261 QString MpSongData::copyright() const
       
   262 {
       
   263     TX_LOG    
       
   264     return mCopyright;  
       
   265 }
       
   266 
       
   267 /*!
       
   268  Returns the music URL
       
   269 */
       
   270 QString MpSongData::musicURL() const
       
   271 {
       
   272     TX_LOG    
       
   273     return mMusicURL;  
       
   274 }
       
   275 
       
   276 /*!
       
   277  Returns whether the song is protected
       
   278 */
       
   279 bool MpSongData::isDrmProtected() const
       
   280 {
       
   281     TX_LOG    
       
   282     return mDrmProtected;
       
   283 }
       
   284 
       
   285 /*!
       
   286  Sets the song \a title, returns true if the value is new.
       
   287 */
       
   288 bool MpSongData::setTitle( const QString &title )
       
   289 {
       
   290     TX_ENTRY_ARGS( "title =" << title )
       
   291     bool change = false;
       
   292     if ( title != mTitle ) {
       
   293         change = true;
       
   294         mTitle = title;
       
   295     }
       
   296     TX_EXIT
       
   297     return change;
       
   298 }
       
   299 
       
   300 /*!
       
   301  Sets the song \a album, returns true if the value is new.
       
   302 */
       
   303 bool MpSongData::setAlbum( const QString &album )
       
   304 {
       
   305     TX_ENTRY_ARGS( "album =" << album )
       
   306     bool change = false;
       
   307     if ( album != mAlbum ) {
       
   308         change = true;
       
   309         mAlbum = album;
       
   310     }
       
   311     TX_EXIT
       
   312     return change;
       
   313 }
       
   314 
       
   315 /*!
       
   316  Sets the song \a artist, returns true if the value is new.
       
   317 */
       
   318 bool MpSongData::setArtist( const QString &artist )
       
   319 {
       
   320     TX_ENTRY_ARGS( "artist =" << artist )
       
   321     bool change = false;
       
   322     if ( artist != mArtist ) {
       
   323         change = true;
       
   324         mArtist = artist;
       
   325     }
       
   326     TX_EXIT
       
   327     return change;
       
   328 }
       
   329 
       
   330 /*!
       
   331  Sets the song \a comment, returns true if the value is new.
       
   332 */
       
   333 bool MpSongData::setComment( const QString &comment)
       
   334 {
       
   335     TX_ENTRY_ARGS( "comment =" << comment )
       
   336     bool change = false;
       
   337     if ( comment != mComment ) {
       
   338         change = true;
       
   339         mComment = comment;
       
   340     }
       
   341     TX_EXIT
       
   342     return change;
       
   343 }
       
   344 
       
   345 
       
   346 /*!
       
   347  Sets the song \a composer, returns true if the value is new.
       
   348 */
       
   349 bool MpSongData::setComposer( const QString &composer )
       
   350 {
       
   351     TX_ENTRY_ARGS( "composer =" << composer )
       
   352     bool change = false;
       
   353     if ( composer != mComposer ) {
       
   354         change = true;
       
   355         mComposer = composer;
       
   356     }
       
   357     TX_EXIT
       
   358     return change;
       
   359 }
       
   360 
       
   361 /*!
       
   362  Sets the song \a genre, returns true if the value is new.
       
   363 */
       
   364 bool MpSongData::setGenre( const QString &genre )
       
   365 {
       
   366     TX_ENTRY_ARGS( "genre =" << genre )
       
   367     bool change = false;
       
   368     if ( genre != mGenre ) {
       
   369         change = true;
       
   370         mGenre = genre;
       
   371     }
       
   372     TX_EXIT
       
   373     return change;
       
   374 }
       
   375 
       
   376 
       
   377 /*!
       
   378  Sets the song \a date, returns true if the value is new.
       
   379 */
       
   380 bool MpSongData::setYear( int year )
       
   381 {
       
   382     TX_ENTRY_ARGS( "year =" << year )
       
   383     bool change = false;
       
   384     if ( QString::number(year) != mYear ) {
       
   385         change = true;
       
   386         if ( year >= 0 && year < 9999 ) {
       
   387             mYear = QString::number(year);
       
   388         } else {
       
   389             mYear = QString();
       
   390         }
       
   391     }
       
   392     TX_EXIT
       
   393     return change;
       
   394 }
       
   395 
       
   396 /*!
       
   397  Sets the \a album track, returns true if the value is new.
       
   398 */
       
   399 bool MpSongData::setAlbumTrack( const QString &track )
       
   400 {
       
   401     TX_ENTRY_ARGS( "track =" << track )
       
   402     bool change = false;
       
   403     if ( track != mAlbumTrack ) {
       
   404         change = true;
       
   405         mAlbumTrack = track;
       
   406     }
       
   407     TX_EXIT
       
   408     return change;
       
   409 }
       
   410 
       
   411 /*!
       
   412  Sets the \a link
       
   413 */
       
   414 void MpSongData::setLink( const QString &link )
       
   415 {
       
   416     TX_ENTRY_ARGS( "Link =" << link )
       
   417     mLink = link;
       
   418     TX_EXIT
       
   419 }
       
   420 
       
   421 /*!
       
   422  Sets the song \a albumArtUri.
       
   423 */
       
   424 void MpSongData::setAlbumArtUri( const QString &albumArtUri)
       
   425 {
       
   426     TX_ENTRY_ARGS( "albumArtUri = " << albumArtUri )
       
   427     if ( !albumArtUri.isEmpty() ) {
       
   428         TX_LOG_ARGS( "There is album art" );
       
   429         bool ok = true;
       
   430         if ( mReqId != KUndefined ) {
       
   431             // There is already an outstanding request. Cancel it first.
       
   432             bool ok = mThumbnailManager->cancelRequest( mReqId );
       
   433         }
       
   434         if ( ok ) {
       
   435             mReqId = mThumbnailManager->getThumbnail( albumArtUri );
       
   436             if ( mReqId == KUndefined ) {
       
   437                 // Request failed. Set default album art.
       
   438                 mAlbumArt = mDefaultAlbumArt;
       
   439                 emit albumArtReady();
       
   440             }
       
   441         }
       
   442     }
       
   443     else {
       
   444         // No album art uri. Set default album art.
       
   445         TX_LOG_ARGS( "There is No album art" );
       
   446         mAlbumArt = mDefaultAlbumArt;
       
   447         emit albumArtReady();
       
   448     }
       
   449     TX_EXIT
       
   450 }
       
   451 
       
   452 /*!
       
   453  Sets the \a file name
       
   454 */
       
   455 bool MpSongData::setFileName( const QString &fileName )
       
   456 {
       
   457     TX_ENTRY_ARGS( "File name =" << fileName )
       
   458     bool change = false;
       
   459     if ( fileName != mFileName ) {
       
   460         change = true;
       
   461         mFileName = fileName;
       
   462     }
       
   463     TX_EXIT
       
   464     return change;
       
   465 }
       
   466 
       
   467 /*!
       
   468  Sets the \a MIME type
       
   469 */
       
   470 bool MpSongData::setMimeType( const QString &mimeType )
       
   471 {    
       
   472     TX_ENTRY_ARGS( "Mime =" << mimeType )
       
   473     bool change = false;
       
   474     if ( mimeType != mMimeType ) {
       
   475         change = true;
       
   476         mMimeType = mimeType;
       
   477     }
       
   478     TX_EXIT
       
   479     return change;    
       
   480 }
       
   481 
       
   482 /*!
       
   483  Sets the \a duration
       
   484 */
       
   485 bool MpSongData::setDuration( int duration )
       
   486 {   
       
   487     TX_ENTRY_ARGS( "Duration =" << duration )
       
   488     bool change = false;
       
   489     QString timeFormatOne("%1:%2:%3");
       
   490     QString timeFormatTwo("%1:%2");
       
   491     if ( QString::number( duration ) != mDuration ) {
       
   492         change = true;
       
   493         if ( duration >= 3600 ) {
       
   494             // more than one hours
       
   495             QString hourStr, minStr, secStr;
       
   496             int hour = duration / 3600;
       
   497             int min = duration % 3600 / 60;
       
   498             int sec = duration % 3600 % 60;
       
   499             
       
   500             hourStr = hour >= 10 ? QString::number( hour ) : QString::number( hour ).prepend( "0" );
       
   501             minStr = min >= 10 ? QString::number( min ) : QString::number( min ).prepend( "0" );
       
   502             secStr = sec >= 10 ? QString::number( sec ) : QString::number( sec ).prepend( "0" );            
       
   503             mDuration = timeFormatOne.arg( hourStr ).arg( minStr ).arg( secStr );
       
   504         } else if ( duration >= 60 && duration < 3600 ) {
       
   505             // more than one min && less than one hour
       
   506             QString minStr, secStr;
       
   507             int min = duration / 60;
       
   508             int sec = duration % 60;
       
   509             
       
   510             minStr = min >= 10 ? QString::number( min ) : QString::number( min ).prepend( "0" );
       
   511             secStr = sec >= 10 ? QString::number( sec ) : QString::number( sec ).prepend( "0" );     
       
   512             mDuration = timeFormatTwo.arg( minStr ).arg( secStr );
       
   513         } else if ( duration > 0 && duration < 60 ) {
       
   514             QString secStr;
       
   515             secStr = duration >= 10 ? QString::number( duration ) : QString::number( duration ).prepend( "0" ); 
       
   516             mDuration = secStr;
       
   517         } else {
       
   518             mDuration = QString();
       
   519         }
       
   520     }
       
   521     TX_EXIT
       
   522     return change;
       
   523 }
       
   524 
       
   525 /*!
       
   526  Sets bit rate
       
   527 */
       
   528 bool MpSongData::setBitRate( int bitRate)
       
   529 {
       
   530     TX_ENTRY_ARGS( "Bit rate =" << bitRate )
       
   531     bool change = false;
       
   532     if ( QString::number( bitRate ) != mBitRate ) {
       
   533         change = true;
       
   534         if ( bitRate > 0 ) {
       
   535             mBitRate = QString::number( bitRate / 1000 );
       
   536         } else {
       
   537             mBitRate = QString();
       
   538         }
       
   539     }
       
   540     TX_EXIT
       
   541     return change;
       
   542 }
       
   543 
       
   544 /*!
       
   545  Sets sample rate
       
   546 */
       
   547 bool MpSongData::setSampleRate( int sampleRate )
       
   548 {
       
   549     TX_ENTRY_ARGS( "Sample rate =" << sampleRate )
       
   550     bool change = false;
       
   551     if ( QString::number( sampleRate ) != mSampleRate ) {
       
   552         change = true;
       
   553         if ( sampleRate > 0 ) {
       
   554             mSampleRate = QString::number( sampleRate );
       
   555         } else {
       
   556             mSampleRate = QString();
       
   557         }
       
   558     }
       
   559     TX_EXIT
       
   560     return change;
       
   561 }
       
   562 
       
   563 /*!
       
   564  Sets the \a size
       
   565 */
       
   566 bool MpSongData::setSize( int size )
       
   567 {   
       
   568     TX_ENTRY_ARGS( "Size =" << size )
       
   569     bool change = false;
       
   570     if ( QString::number( size ) != mSize ) {
       
   571         change = true;
       
   572         mSize = QString::number( size / 1000 );
       
   573     }
       
   574     TX_EXIT
       
   575     return change;
       
   576 }
       
   577 
       
   578 /*!
       
   579  Sets the \a modification information
       
   580 */
       
   581 bool MpSongData::setModified( const QString &modified )
       
   582 {
       
   583     TX_ENTRY_ARGS( "Modified =" << modified )
       
   584     bool change = false;
       
   585     if ( modified != mModified ) {
       
   586         change = true;
       
   587         mModified = modified;
       
   588     }
       
   589     TX_EXIT
       
   590     return change;
       
   591 }
       
   592 
       
   593 /*!
       
   594  Sets the \a copyright information
       
   595 */
       
   596 bool MpSongData::setCopyright( const QString &copyright )
       
   597 {
       
   598     TX_ENTRY_ARGS( "Copyright =" << copyright )
       
   599     bool change = false;
       
   600     if ( copyright != mCopyright ) {
       
   601         change = true;
       
   602         mCopyright = copyright;
       
   603     }
       
   604     TX_EXIT
       
   605     return change;
       
   606 }
       
   607 
       
   608 /*!
       
   609  Sets the \a music URL
       
   610 */
       
   611 bool MpSongData::setMusicURL( const QString &musicURL )
       
   612 {
       
   613     TX_ENTRY_ARGS( "Music URL =" << musicURL )
       
   614     bool change = false;
       
   615     if ( musicURL != mMusicURL ) {
       
   616         change = true;
       
   617         mMusicURL = musicURL;
       
   618     }
       
   619     TX_EXIT
       
   620     return change;
       
   621 }
       
   622 
       
   623 /*!
       
   624  Set whether the song is DRM protected
       
   625 */
       
   626 bool MpSongData::setDrmProtected( bool drmProtected )
       
   627 {
       
   628     TX_ENTRY_ARGS( "DRM protected =" << drmProtected )
       
   629     bool change = false;
       
   630     if ( drmProtected != mDrmProtected ) {
       
   631         change = true;
       
   632         mDrmProtected = drmProtected;
       
   633     }
       
   634     TX_EXIT
       
   635     return change;
       
   636 }
       
   637 
       
   638 /*!
       
   639  Slot to handle the album art thumb.
       
   640 */
       
   641 void MpSongData::thumbnailReady(
       
   642         const QPixmap& pixmap,
       
   643         void *data,
       
   644         int id,
       
   645         int error  )
       
   646 {
       
   647     TX_ENTRY
       
   648     Q_UNUSED( data );
       
   649     if ( error == 0 && mReqId == id ) {
       
   650         QIcon qicon;
       
   651         QPixmap mCompositePixmap;
       
   652         mReqId = KUndefined;
       
   653         
       
   654         mCompositePixmap = QPixmap( 360, 360 );
       
   655         mCompositePixmap.fill( Qt::transparent );
       
   656         QPainter painter(&mCompositePixmap);
       
   657         painter.setCompositionMode(QPainter::CompositionMode_Clear);
       
   658         painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
       
   659         painter.fillRect(mCompositePixmap.rect(), Qt::transparent);
       
   660         painter.drawPixmap(QRect(0, 0,360,360), pixmap);
       
   661         
       
   662         if ( !mCompositePixmap.isNull() ) {
       
   663             qicon = QIcon( mCompositePixmap );
       
   664         }
       
   665         else {
       
   666             qicon = QIcon( pixmap );
       
   667         }
       
   668         
       
   669         if ( mAlbumArt == mDefaultAlbumArt ) {        
       
   670             TX_LOG_ARGS( "Album art is default album art." )
       
   671             delete mAlbumArt; 
       
   672             mAlbumArt = new HbIcon(qicon);
       
   673             mDefaultAlbumArt = new HbIcon( "qtg_large_music_album" );
       
   674         } else {
       
   675             TX_LOG_ARGS( "Album art is NOT default album art." )
       
   676             delete mAlbumArt;
       
   677             mAlbumArt = new HbIcon(qicon);
       
   678         }       
       
   679                 
       
   680         emit albumArtReady();
       
   681     }
       
   682     else {
       
   683         mReqId = KUndefined;
       
   684         mAlbumArt = mDefaultAlbumArt;
       
   685         emit albumArtReady();
       
   686     }
       
   687 
       
   688     TX_EXIT
       
   689 }
       
   690 
       
   691 /*!
       
   692  Emit signal when playback information changed, such as artist, track name
       
   693 */
       
   694 void MpSongData::commitPlaybackInfo()
       
   695 {
       
   696     TX_ENTRY
       
   697     emit playbackInfoChanged();
       
   698     TX_EXIT
       
   699 }
       
   700 
       
   701 /*!
       
   702  Emit signal when song detail information changed
       
   703 */
       
   704 void MpSongData::commitSongDetailInfo()
       
   705 {
       
   706     TX_ENTRY
       
   707     emit songDetailInfoChanged();
       
   708     TX_EXIT
       
   709 }
       
   710 
       
   711 /*!
       
   712  Retrieve the album art in base64 encoding suitable for inline HTML display for sharing player.
       
   713  */
       
   714 QString MpSongData::albumArtBase64() const
       
   715 {
       
   716     /*
       
   717     // Converts the current album art icon to a base64 string, and return the string.
       
   718     TX_LOG
       
   719     if ( mAlbumArt->isNull() ) {
       
   720         TX_ENTRY_ARGS( "MpSongData: album art isNull" )
       
   721         return "nullimgcraptoberemoved";
       
   722     }
       
   723     TX_ENTRY_ARGS("MpSongData: album art exists");
       
   724     QByteArray array;
       
   725     QBuffer buffer( &array );
       
   726     buffer.open( QIODevice::WriteOnly );
       
   727     mAlbumArt->pixmap().save( &buffer, "PNG" ); // writes pixmap into bytes in PNG format
       
   728     buffer.close();
       
   729     QString result = array.toBase64().constData();
       
   730     TX_ENTRY_ARGS("MpSongData: album art base64 length: " << result.length());
       
   731     return result;
       
   732     */
       
   733     // TODO: this is temporary solution until base64 defect in QT is fixed.
       
   734     TX_LOG
       
   735     QByteArray array;
       
   736     QFile file( "e:\\album_art.png" );
       
   737     file.open( QIODevice::WriteOnly );
       
   738     if ( mAlbumArt && !mAlbumArt->isNull() && !mAlbumArt->qicon().isNull() )
       
   739     {
       
   740         QPixmap p = mAlbumArt->qicon().pixmap( QSize( 74, 74 ), QIcon::Normal, QIcon::Off );
       
   741         p.save( &file, "PNG" );
       
   742         //mAlbumArt->pixmap().save( &file, "PNG" ); // writes pixmap into bytes in PNG format
       
   743     }
       
   744     file.close();
       
   745     return "e:\\album_art.png";
       
   746 }
       
   747