mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpdetailssharedialog/stub/src/mpsongdata.cpp
changeset 45 612c4815aebe
parent 36 a0afa279b8fe
equal deleted inserted replaced
43:0f32e550d9d8 45:612c4815aebe
    65       mYear( NULL ),
    65       mYear( NULL ),
    66       mAlbumTrack( NULL ),
    66       mAlbumTrack( NULL ),
    67       mAlbumArt(),
    67       mAlbumArt(),
    68       mReqId( KUndefined )
    68       mReqId( KUndefined )
    69 {
    69 {
    70     //TX_ENTRY
    70     TX_ENTRY_ARGS("Stub")
    71     //TX_EXIT
       
    72 }
    71 }
    73 
    72 
    74 /*!
    73 /*!
    75  Constructs a new MpSongData.
    74  Constructs a new MpSongData.
    76  */
    75  */
    77 MpSongData::~MpSongData()
    76 MpSongData::~MpSongData()
    78 {
    77 {
    79     //TX_ENTRY
    78     TX_ENTRY_ARGS("Stub")
    80     //TX_EXIT
       
    81 }
    79 }
    82 
    80 
    83 /*!
    81 /*!
    84  Returns the song album art on \a pixmap.
    82  Returns the song album art on \a pixmap.
    85 */
    83 */
    86 void MpSongData::albumArt( QPixmap& pixmap )
    84 void MpSongData::albumArt( QPixmap& pixmap )
    87 {
    85 {
    88     //TX_ENTRY
       
    89      if ( !mAlbumArt.isNull() ) {
    86      if ( !mAlbumArt.isNull() ) {
    90         pixmap = mAlbumArt;
    87         pixmap = mAlbumArt;
    91      }
    88      }
    92      else {
    89      else {
    93          pixmap = QPixmap();
    90          pixmap = QPixmap();
    94      }
    91      }
    95     //TX_EXIT
       
    96 }
    92 }
    97 
    93 
    98 
    94 
    99 /*!
    95 /*!
   100  Returns the song title.
    96  Returns the song title.
   101 */
    97 */
   102 QString MpSongData::title() const
    98 QString MpSongData::title() const
   103 {
    99 {
   104     //TX_LOG
       
   105     return mTitle;
   100     return mTitle;
   106 }
   101 }
   107 
   102 
   108 /*!
   103 /*!
   109  Returns the song album.
   104  Returns the song album.
   110 */
   105 */
   111 QString MpSongData::album() const
   106 QString MpSongData::album() const
   112 {
   107 {
   113     //TX_LOG
       
   114     return mAlbum;
   108     return mAlbum;
   115 }
   109 }
   116 
   110 
   117 /*!
   111 /*!
   118  Returns the song artist.
   112  Returns the song artist.
   119 */
   113 */
   120 QString MpSongData::artist() const
   114 QString MpSongData::artist() const
   121 {
   115 {
   122     //TX_LOG
       
   123     return mArtist;
   116     return mArtist;
   124 }
   117 }
   125 
   118 
   126 /*!
   119 /*!
   127  Returns comment
   120  Returns comment
   128 */
   121 */
   129 QString MpSongData::comment() const
   122 QString MpSongData::comment() const
   130 {
   123 {
   131     //TX_LOG
       
   132     return mComment;
   124     return mComment;
   133 }
   125 }
   134 
   126 
   135 /*!
   127 /*!
   136  Returns the song composer.
   128  Returns the song composer.
   137 */
   129 */
   138 QString MpSongData::composer() const
   130 QString MpSongData::composer() const
   139 {
   131 {
   140     //TX_LOG
       
   141     return mComposer;
   132     return mComposer;
   142 }
   133 }
   143 
   134 
   144 
   135 
   145 /*!
   136 /*!
   146  Returns the song genre.
   137  Returns the song genre.
   147 */
   138 */
   148 QString MpSongData::genre() const
   139 QString MpSongData::genre() const
   149 {
   140 {
   150     //TX_LOG
       
   151     return mGenre;
   141     return mGenre;
   152 }
   142 }
   153 
   143 
   154 
   144 
   155 /*!
   145 /*!
   156  Returns the album track.
   146  Returns the album track.
   157 */
   147 */
   158 QString MpSongData::albumTrack() const
   148 QString MpSongData::albumTrack() const
   159 {
   149 {
   160     //TX_LOG
       
   161     return mAlbumTrack;
   150     return mAlbumTrack;
   162 }
   151 }
   163 
   152 
   164 /*!
   153 /*!
   165  Returns link
   154  Returns link
   166 */
   155 */
   167 QString MpSongData::link() const
   156 QString MpSongData::link() const
   168 {
   157 {
   169     //TX_LOG
       
   170     return mLink;
   158     return mLink;
   171 }
   159 }
   172 
   160 
   173 /*!
   161 /*!
   174  Returns the release date.
   162  Returns the release date.
   175 */
   163 */
   176 QString MpSongData::year() const
   164 QString MpSongData::year() const
   177 {
   165 {
   178     //TX_LOG    
       
   179     return mYear;
   166     return mYear;
   180 }
   167 }
   181 
   168 
   182 
   169 
   183 /*!
   170 /*!
   184  Sets the song \a title, returns true if the value is new.
   171  Sets the song \a title, returns true if the value is new.
   185 */
   172 */
   186 bool MpSongData::setTitle( const QString &title )
   173 bool MpSongData::setTitle( const QString &title )
   187 {
   174 {
   188     //TX_ENTRY_ARGS( "title =" << title )
       
   189     bool change = false;
   175     bool change = false;
   190     if ( title != mTitle ) {
   176     if ( title != mTitle ) {
   191         change = true;
   177         change = true;
   192         mTitle = title;
   178         mTitle = title;
   193     }
   179     }
   194     //TX_EXIT
       
   195     return change;
   180     return change;
   196 }
   181 }
   197 
   182 
   198 /*!
   183 /*!
   199  Sets the song \a album, returns true if the value is new.
   184  Sets the song \a album, returns true if the value is new.
   200 */
   185 */
   201 bool MpSongData::setAlbum( const QString &album )
   186 bool MpSongData::setAlbum( const QString &album )
   202 {
   187 {
   203     //TX_ENTRY_ARGS( "album =" << album )
       
   204     bool change = false;
   188     bool change = false;
   205     if ( album != mAlbum ) {
   189     if ( album != mAlbum ) {
   206         change = true;
   190         change = true;
   207         mAlbum = album;
   191         mAlbum = album;
   208     }
   192     }
   209     //TX_EXIT
       
   210     return change;
   193     return change;
   211 }
   194 }
   212 
   195 
   213 /*!
   196 /*!
   214  Sets the song \a artist, returns true if the value is new.
   197  Sets the song \a artist, returns true if the value is new.
   215 */
   198 */
   216 bool MpSongData::setArtist( const QString &artist )
   199 bool MpSongData::setArtist( const QString &artist )
   217 {
   200 {
   218     //TX_ENTRY_ARGS( "artist =" << artist )
       
   219     bool change = false;
   201     bool change = false;
   220     if ( artist != mArtist ) {
   202     if ( artist != mArtist ) {
   221         change = true;
   203         change = true;
   222         mArtist = artist;
   204         mArtist = artist;
   223     }
   205     }
   224     //TX_EXIT
       
   225     return change;
   206     return change;
   226 }
   207 }
   227 
   208 
   228 /*!
   209 /*!
   229  Sets the song \a comment, returns true if the value is new.
   210  Sets the song \a comment, returns true if the value is new.
   230 */
   211 */
   231 bool MpSongData::setComment( const QString &comment)
   212 bool MpSongData::setComment( const QString &comment)
   232 {
   213 {
   233     //TX_ENTRY_ARGS( "comment =" << comment )
       
   234     bool change = false;
   214     bool change = false;
   235     if ( comment != mComment ) {
   215     if ( comment != mComment ) {
   236         change = true;
   216         change = true;
   237         mComment = comment;
   217         mComment = comment;
   238     }
   218     }
   239     //TX_EXIT
       
   240     return change;
   219     return change;
   241 }
   220 }
   242 
   221 
   243 
   222 
   244 /*!
   223 /*!
   245  Sets the song \a composer, returns true if the value is new.
   224  Sets the song \a composer, returns true if the value is new.
   246 */
   225 */
   247 bool MpSongData::setComposer( const QString &composer )
   226 bool MpSongData::setComposer( const QString &composer )
   248 {
   227 {
   249     //TX_ENTRY_ARGS( "composer =" << composer )
       
   250     bool change = false;
   228     bool change = false;
   251     if ( composer != mComposer ) {
   229     if ( composer != mComposer ) {
   252         change = true;
   230         change = true;
   253         mComposer = composer;
   231         mComposer = composer;
   254     }
   232     }
   255     //TX_EXIT
       
   256     return change;
   233     return change;
   257 }
   234 }
   258 
   235 
   259 /*!
   236 /*!
   260  Sets the song \a genre, returns true if the value is new.
   237  Sets the song \a genre, returns true if the value is new.
   261 */
   238 */
   262 bool MpSongData::setGenre( const QString &genre )
   239 bool MpSongData::setGenre( const QString &genre )
   263 {
   240 {
   264     //TX_ENTRY_ARGS( "genre =" << genre )
       
   265     bool change = false;
   241     bool change = false;
   266     if ( genre != mGenre ) {
   242     if ( genre != mGenre ) {
   267         change = true;
   243         change = true;
   268         mGenre = genre;
   244         mGenre = genre;
   269     }
   245     }
   270     //TX_EXIT
       
   271     return change;
   246     return change;
   272 }
   247 }
   273 
   248 
   274 
   249 
   275 /*!
   250 /*!
   276  Sets the song \a date, returns true if the value is new.
   251  Sets the song \a date, returns true if the value is new.
   277 */
   252 */
   278 bool MpSongData::setYear( int year )
   253 bool MpSongData::setYear( int year )
   279 {
   254 {
   280     //TX_ENTRY_ARGS( "year =" << year )
       
   281     bool change = false;
   255     bool change = false;
   282     if ( QString::number(year) != mYear ) {
   256     if ( QString::number(year) != mYear ) {
   283         change = true;
   257         change = true;
   284         if ( year >= 0 && year < 9999 ) {
   258         if ( year >= 0 && year < 9999 ) {
   285             mYear = QString::number(year);
   259             mYear = QString::number(year);
   286         }
   260         }
   287     }
   261     }
   288     //TX_EXIT
       
   289     return change;
   262     return change;
   290 }
   263 }
   291 
   264 
   292 /*!
   265 /*!
   293  Sets the \a album track, returns true if the value is new.
   266  Sets the \a album track, returns true if the value is new.
   294 */
   267 */
   295 bool MpSongData::setAlbumTrack( const QString &track )
   268 bool MpSongData::setAlbumTrack( const QString &track )
   296 {
   269 {
   297     //TX_ENTRY_ARGS( "track =" << track )
       
   298     bool change = false;
   270     bool change = false;
   299     if ( track != mAlbumTrack ) {
   271     if ( track != mAlbumTrack ) {
   300         change = true;
   272         change = true;
   301         mAlbumTrack = track;
   273         mAlbumTrack = track;
   302     }
   274     }
   303     //TX_EXIT
       
   304     return change;
   275     return change;
   305 }
   276 }
   306 
   277 
   307 /*!
   278 /*!
   308  Sets the \a link
   279  Sets the \a link
   309 */
   280 */
   310 void MpSongData::setLink( const QString &link )
   281 void MpSongData::setLink( const QString &link )
   311 {
   282 {
   312     //TX_ENTRY_ARGS( "Link =" << link )
       
   313     mLink = link;
   283     mLink = link;
   314     //TX_EXIT
       
   315 }
   284 }
   316 
   285 
   317 /*!
   286 /*!
   318  Sets the song \a albumArtUri.
   287  Sets the song \a albumArtUri.
   319 */
   288 */
   320 void MpSongData::setAlbumArtUri( const QString &albumArtUri)
   289 void MpSongData::setAlbumArtUri( const QString &albumArtUri)
   321 {
   290 {
   322     //TX_ENTRY
   291     Q_UNUSED(albumArtUri);
   323     mAlbumArt = mDefaultAlbumArt;
   292     mAlbumArt = mDefaultAlbumArt;
   324     emit albumArtReady();
   293     emit albumArtReady();
   325     //TX_EXIT
       
   326 }
   294 }
   327 
   295 
   328 
   296 
   329 /*!
   297 /*!
   330  Slot to handle the album art thumb.
   298  Slot to handle the album art thumb.
   333         const QPixmap& pixmap,
   301         const QPixmap& pixmap,
   334         void *data,
   302         void *data,
   335         int id,
   303         int id,
   336         int error  )
   304         int error  )
   337 {
   305 {
   338     //TX_ENTRY
   306     Q_UNUSED( pixmap );
   339     Q_UNUSED( data );
   307     Q_UNUSED( data );
   340 
   308     Q_UNUSED( id );
   341     //TX_EXIT
   309     Q_UNUSED( error );
   342 }
   310 }
   343 
   311 
   344 /*!
   312 /*!
   345  Emit signal when playback information changed, such as artist, track name
   313  Emit signal when playback information changed, such as artist, track name
   346 */
   314 */
   347 void MpSongData::commitPlaybackInfo()
   315 void MpSongData::commitPlaybackInfo()
   348 {
   316 {
   349     //TX_ENTRY
       
   350     emit playbackInfoChanged();
   317     emit playbackInfoChanged();
   351     //TX_EXIT
       
   352 }
   318 }
   353 
   319 
   354 /*!
   320 /*!
   355  Emit signal when song detail information changed
   321  Emit signal when song detail information changed
   356 */
   322 */
   357 void MpSongData::commitSongDetailInfo()
   323 void MpSongData::commitSongDetailInfo()
   358 {
   324 {
   359     //TX_ENTRY
       
   360     emit songDetailInfoChanged();
   325     emit songDetailInfoChanged();
   361     //TX_EXIT
       
   362 }
   326 }
   363 
   327 
   364 QString MpSongData::albumArtBase64() const
   328 QString MpSongData::albumArtBase64() const
   365 {
   329 {
   366     // Converts the current album art pixmap to a base64 string, and return the string.
   330 
   367 //    TX_ENTRY
       
   368 //    QByteArray array;
       
   369 //    QBuffer buffer(&array);
       
   370 //    buffer.open(QIODevice::WriteOnly);
       
   371 //    mAlbumArt.save(&buffer, "PNG"); // writes pixmap into bytes in PNG format
       
   372 //    buffer.close();
       
   373 //    QByteArray base64 = array.toBase64();
       
   374 //    TX_EXIT
       
   375 //    return base64.constData();
       
   376     return QString("");
   331     return QString("");
   377 }
   332 }
   378 
   333 
   379 void MpSongData::removeAlbumArtFile() const
   334 void MpSongData::removeAlbumArtFile() const
   380 {
   335 {