mpdata/src/mpplaybackdata.cpp
changeset 29 8192e5b5c935
parent 22 ecf06a08d4d9
child 32 c163ef0b758d
--- a/mpdata/src/mpplaybackdata.cpp	Fri May 14 15:49:53 2010 +0300
+++ b/mpdata/src/mpplaybackdata.cpp	Thu May 27 12:49:57 2010 +0300
@@ -15,10 +15,10 @@
 *
 */
 
-#include <qicon>
-#include <qstring>
-#include <qpixmap>
-#include <qpainter>
+#include <QIcon>
+#include <QString>
+#include <QPixmap>
+#include <QPainter>
 #include <hbicon.h>
 #include <thumbnailmanager_qt.h>
 
@@ -74,23 +74,25 @@
     Constructs a new MpPlaybackData.
  */
 MpPlaybackData::MpPlaybackData( QObject *parent )
-    : QObject(parent),
-      mThumbnailManager(0),
-      mReqId(KUndefined),
+    : QObject( parent ),
+      mThumbnailManager( new ThumbnailManager( this ) ),
+      mReqId( KUndefined ),
       mDuration(0),
       mPosition(0),
-      mAlbumArt(),
-      mPlaybackState(Stopped)
+      mAlbum( hbTrId ( "txt_mus_other_unknown4" ) ),
+      mArtist( hbTrId ( "txt_mus_other_unknown3") ),
+      mAlbumId(0),
+      mId(0),
+      mAlbumArt( "qtg_large_music_album" ),
+      mDefaultAlbumArt( "qtg_large_music_album" ),
+      mPlaybackState( NotPlaying ),
+      mRealAudio( false )
 {
     TX_ENTRY
-    mThumbnailManager = new ThumbnailManager(this);
-    mThumbnailManager->setQualityPreference(ThumbnailManager::OptimizeForQuality);
-    mThumbnailManager->setThumbnailSize(ThumbnailManager::ThumbnailLarge);
-    connect( mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, void *, int, int)),
-             this, SLOT(thumbnailReady(QPixmap, void *, int, int)) );
-
-    //TODO: Change to final resource when available
-    mDefaultAlbumArt =  new HbIcon("qtg_large_music");
+    mThumbnailManager->setQualityPreference( ThumbnailManager::OptimizeForQuality );
+    mThumbnailManager->setThumbnailSize( ThumbnailManager::ThumbnailLarge );
+    connect( mThumbnailManager, SIGNAL( thumbnailReady(QPixmap, void *, int, int ) ),
+             this, SLOT(thumbnailReady( QPixmap, void *, int, int ) ) );
     TX_EXIT
 }
 
@@ -177,7 +179,12 @@
     bool change = false;
     if ( artist != mArtist ) {
         change = true;
-        mArtist = artist;
+        if ( artist.isEmpty() ){
+            mArtist = hbTrId( "txt_mus_other_unknown3" );      
+        }
+        else {
+            mArtist = artist;
+        }
     }
     TX_EXIT
     return change;
@@ -201,7 +208,12 @@
     bool change = false;
     if ( album != mAlbum ) {
         change = true;
-        mAlbum = album;
+        if ( album.isEmpty() ){
+            mAlbum = hbTrId( "txt_mus_other_unknown4" );
+        }
+        else{
+            mAlbum = album;            
+        }
     }
     TX_EXIT
     return change;
@@ -275,16 +287,75 @@
 void MpPlaybackData::albumArt( HbIcon& icon ) const
 {
     TX_ENTRY
-    if ( mAlbumArt->isNull() ) {
-        icon = HbIcon();
-     }
-     else {
-        icon = *mAlbumArt ;
-     }
+    icon = mAlbumArt ;
     TX_EXIT
 }
 
 /*!
+ Sets the song's album \a id, returns true if the value is new.
+*/
+bool MpPlaybackData::setAlbumId( int id )
+{
+    bool change = false;
+    if (mAlbumId != id) {
+        mAlbumId = id;
+        change = true;
+    }
+    return change;
+}
+
+/*!
+ Returns the id of the album to which the song belongs.
+*/
+int MpPlaybackData::albumId()
+{
+    return mAlbumId;
+}
+
+/*!
+ Sets the song's \a id, returns true if the value is new.
+*/
+bool MpPlaybackData::setId( int id )
+{
+    bool change = false;
+    if (mId != id) {
+        mId = id;
+        change = true;
+    }
+    return change;
+}
+
+/*!
+ Returns the id the song.
+*/
+int MpPlaybackData::id()
+{
+    return mId;
+}
+/*!
+Set Real Audio \a mode.
+*/
+bool MpPlaybackData::setRealAudio( bool mode )
+{
+    TX_ENTRY
+    bool change = false;
+    if (mRealAudio != mode) {
+        mRealAudio = mode;
+        change = true;
+    }
+    TX_EXIT
+    return change;
+}
+
+/*!
+ Returns the mode of Real Audio.
+*/
+bool MpPlaybackData::realAudio()
+{
+    return mRealAudio;
+}
+
+/*!
  Sets the playback \a state.
 */
 void MpPlaybackData::setPlaybackState( const SimplifiedState state )
@@ -316,6 +387,7 @@
     TX_EXIT
 }
 
+
 /*!
  Slot to handle the album art thumb.
 */
@@ -345,7 +417,7 @@
         }
         
         
-        mAlbumArt = new HbIcon(qicon);
+        mAlbumArt = HbIcon(qicon);
         
         emit albumArtReady();
     }