CTC++ Coverage Report - Execution Profile    #16/17

Directory Summary | Files Summary | Functions Summary | Execution Profile
To files: First | Previous | Next | Last | Index | No Index


File: Z:\musicplayer\mpviewplugins\mpdetailsviewplugin\tsrc\unittest_mpdetailsview\stub\src\mpsongdata.cpp
Instrumentation mode: function-decision
TER: 0 % ( 0/146)

Start/ End/    
True False - Line Source

  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 <hbicon.h>
  24 
  25 #include "stub/inc/thumbnailmanager_qt.h"
  26 #include <thumbnaildata.h>
  27 #include <thumbnailobjectsource.h>
  28 
  29 #include "stub/inc/mpsongdata.h"
  30 #include "mptrace.h"
  31 
  32 const int KUndefined = -1;
  33 
  34 
Top
- 35 MpSongData::MpSongData( QObject *parent )
  36     : QObject( parent ),
  37       mTitle( NULL ),
  38       mAlbum( NULL ),
  39       mArtist( NULL ),
  40       mComposer( NULL),
  41       mGenre( NULL ),
  42       mYear( NULL ),
  43       mAlbumTrack( NULL ),
  44       mAlbumArt(),
  45       mReqId( KUndefined )
  46 {
  47     TX_ENTRY_ARGS("Stub")
  48     mThumbnailManager = new ThumbnailManager( this );
  49     mThumbnailManager->setQualityPreference( ThumbnailManager::OptimizeForQuality );
  50     mThumbnailManager->setThumbnailSize( ThumbnailManager::ThumbnailMedium );
  51     QObject::connect( mThumbnailManager, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ),
  52             this, SLOT( thumbnailReady( QPixmap , void * , int , int  ) ) );
  53     
  54     TX_EXIT_ARGS("Stub")
  55 }
  56 
Top
- 57 MpSongData::~MpSongData()
  58 {
  59     TX_ENTRY_ARGS("Stub")
- 60     if( mThumbnailManager ) {
  61         delete mThumbnailManager;
  62     }
  63     TX_EXIT_ARGS("Stub")
  64 }
  65 
Top
- 66 void MpSongData::albumArt( HbIcon& icon ) const
  67 {
  68     TX_ENTRY_ARGS("Stub")
  69     TX_EXIT_ARGS("Stub")
  70 }
  71 
  72 
Top
- 73 QString MpSongData::title() const
  74 {
  75     TX_ENTRY_ARGS("Stub")
 - 76     return mTitle;
  77 }
  78 
Top
- 79 QString MpSongData::album() const
  80 {
  81     TX_ENTRY_ARGS("Stub")
 - 82     return mAlbum;
  83 }
  84 
Top
- 85 QString MpSongData::artist() const
  86 {
  87     TX_ENTRY_ARGS("Stub")
 - 88     return mArtist;
  89 }
  90 
Top
- 91 QString MpSongData::comment() const
  92 {
  93     TX_ENTRY_ARGS("Stub")
 - 94     return mComment;
  95 }
  96 
Top
- 97 QString MpSongData::composer() const
  98 {
  99     TX_ENTRY_ARGS("Stub")
 - 100     return mComposer;
  101 }
  102 
  103 
Top
- 104 QString MpSongData::genre() const
  105 {
  106     TX_ENTRY_ARGS("Stub")
 - 107     return mGenre;
  108 }
  109 
  110 
Top
- 111 QString MpSongData::albumTrack() const
  112 {
  113     TX_ENTRY_ARGS("Stub")
 - 114     return mAlbumTrack;
  115 }
  116 
Top
- 117 QString MpSongData::link() const
  118 {
  119     TX_ENTRY_ARGS("Stub")
 - 120     return mLink;
  121 }
  122 
Top
- 123 QString MpSongData::year() const
  124 {
  125     TX_ENTRY_ARGS("Stub")    
 - 126     return mYear;
  127 }
  128 
Top
- 129 QString MpSongData::fileName() const
  130 {
  131     TX_LOG    
 - 132     return mFileName;
  133 }
  134 
Top
- 135 QString MpSongData::mimeType() const
  136 {
  137     TX_LOG    
 - 138     return mMimeType;   
  139 }
  140 
Top
- 141 QString MpSongData::duration() const
  142 {
  143     TX_LOG    
 - 144     return mDuration;  
  145 }
  146 
Top
- 147 QString MpSongData::bitRate() const
  148 {
  149     TX_LOG    
 - 150     return mBitRate;  
  151 }
  152 
Top
- 153 QString MpSongData::sampleRate() const
  154 {
  155     TX_LOG    
 - 156     return mSampleRate;  
  157 }
  158 
Top
- 159 QString MpSongData::size() const
  160 {
  161     TX_LOG    
 - 162     return mSize;  
  163 }
  164 
Top
- 165 QString MpSongData::modified() const
  166 {
  167     TX_LOG    
 - 168     return mModified;  
  169 }
  170 
Top
- 171 QString MpSongData::copyright() const
  172 {
  173     TX_LOG    
 - 174     return mCopyright;  
  175 }
  176 
Top
- 177 QString MpSongData::musicURL() const
  178 {
  179     TX_LOG    
 - 180     return mMusicURL;  
  181 }
  182 
Top
- 183 bool MpSongData::setTitle( const QString &title )
  184 {
  185     TX_ENTRY_ARGS("Stub title =" << title )
  186     bool change = false;
- 187     if ( title != mTitle ) {
  188         change = true;
  189         mTitle = title;
  190     }
  191     TX_EXIT_ARGS("Stub")
 - 192     return change;
  193 }
  194 
Top
- 195 bool MpSongData::setAlbum( const QString &album )
  196 {
  197     TX_ENTRY_ARGS("Stub album =" << album )
  198     TX_EXIT_ARGS("Stub")
 - 199     return false;
  200 }
  201 
Top
- 202 bool MpSongData::setArtist( const QString &artist )
  203 {
  204     TX_ENTRY_ARGS("Stub artist =" << artist )
  205     bool change = false;
- 206     if ( artist != mArtist ) {
  207         change = true;
  208         mArtist = artist;
  209     }
  210     TX_EXIT_ARGS("Stub")
 - 211     return change;
  212 }
  213 
Top
- 214 bool MpSongData::setComment( const QString &comment)
  215 {
  216     TX_ENTRY_ARGS("Stub comment =" << comment )
  217     bool change = false;
- 218     if ( comment != mComment ) {
  219         change = true;
  220         mComment = comment;
  221     }
  222     TX_EXIT_ARGS("Stub")
 - 223     return change;
  224 }
  225 
Top
- 226 bool MpSongData::setComposer( const QString &composer )
  227 {
  228     TX_ENTRY_ARGS("Stub composer =" << composer )
  229     bool change = false;
- 230     if ( composer != mComposer ) {
  231         change = true;
  232         mComposer = composer;
  233     }
  234     TX_EXIT_ARGS("Stub")
 - 235     return change;
  236 }
  237 
Top
- 238 bool MpSongData::setGenre( const QString &genre )
  239 {
  240     TX_ENTRY_ARGS("Stub genre =" << genre )
  241     bool change = false;
- 242     if ( genre != mGenre ) {
  243         change = true;
  244         mGenre = genre;
  245     }
  246     TX_EXIT_ARGS("Stub")
 - 247     return change;
  248 }
  249 
  250 
Top
- 251 bool MpSongData::setYear( int year )
  252 {
  253     TX_ENTRY_ARGS("Stub year =" << year )
  254     bool change = false;
- 255     if ( QString::number(year) != mYear ) {
  256         change = true;
- 257         if ( year >= 0 && year < 9999 ) {
  258             mYear = QString::number(year);
  259         }
  260     }
  261     TX_EXIT_ARGS("Stub")
 - 262     return change;
  263 }
  264 
Top
- 265 bool MpSongData::setAlbumTrack( const QString &track )
  266 {
  267     TX_ENTRY_ARGS("Stub track =" << track )
  268     bool change = false;
- 269     if ( track != mAlbumTrack ) {
  270         change = true;
  271         mAlbumTrack = track;
  272     }
  273     TX_EXIT_ARGS("Stub")
 - 274     return change;
  275 }
  276 
Top
- 277 void MpSongData::setLink( const QString &link )
  278 {
  279     TX_ENTRY_ARGS("Stub Link =" << link )
  280     mLink = link;
  281     TX_EXIT_ARGS("Stub")
  282 }
  283 
Top
- 284 void MpSongData::setAlbumArtUri( const QString &albumArtUri)
  285 {
  286     TX_ENTRY_ARGS("Stub albumArtUri = " << albumArtUri )
- 287     if ( !albumArtUri.isEmpty() ) {
  288         bool ok = true;
- 289         if ( mReqId != KUndefined ) {
  290             // There is already an outstanding request. Cancel it first.
  291             bool ok = mThumbnailManager->cancelRequest( mReqId );
  292         }
- 293         if ( ok ) {
  294             mReqId = mThumbnailManager->getThumbnail( albumArtUri );
- 295             if ( mReqId == KUndefined ) {
  296                 // Request failed. Set default album art.
  297                 mAlbumArt = mDefaultAlbumArt;
  298                 emit albumArtReady();
  299             }
  300         }
  301     }
    302     else {
  303         // No album art uri. Set default album art.
  304         mAlbumArt = mDefaultAlbumArt;
  305         emit albumArtReady();
  306     }
  307     TX_EXIT
  308 }
  309 
Top
- 310 bool MpSongData::setFileName( const QString &fileName )
  311 {
  312     TX_ENTRY_ARGS( "File name =" << fileName )
  313     bool change = false;
- 314     if ( fileName != mFileName ) {
  315         change = true;
  316         mFileName = fileName;
  317     }
  318     TX_EXIT
 - 319     return change;
  320 }
  321 
Top
- 322 bool MpSongData::setMimeType( const QString &mimeType )
  323 {    
  324     TX_ENTRY_ARGS( "Mime =" << mimeType )
  325     bool change = false;
- 326     if ( mimeType != mMimeType ) {
  327         change = true;
  328         mMimeType = mimeType;
  329     }
  330     TX_EXIT
 - 331     return change;    
  332 }
  333 
Top
- 334 bool MpSongData::setDuration( int duration )
  335 {   
  336     TX_ENTRY_ARGS( "Duration =" << duration )
  337     bool change = false;
  338     QString timeFormatOne("%1:%2:%3");
  339     QString timeFormatTwo("%1:%2");
- 340     if ( QString::number( duration ) != mDuration ) {
  341         change = true;
- 342         if ( duration >= 3600 ) {
  343             // more than one hours
  344             QString hourStr, minStr, secStr;
  345             int hour = duration / 3600;
  346             int min = duration % 3600 / 60;
  347             int sec = duration % 3600 % 60;
  348             
    349             hourStr = hour >= 10 ? QString::number( hour ) : QString::number( hour ).prepend( "0" );
- 349     ternary-?: hour >= 10
    350             minStr = min >= 10 ? QString::number( min ) : QString::number( min ).prepend( "0" );
- 350     ternary-?: min >= 10
    351             secStr = sec >= 10 ? QString::number( sec ) : QString::number( sec ).prepend( "0" );            
- 351     ternary-?: sec >= 10
  352             mDuration = timeFormatOne.arg( hourStr ).arg( minStr ).arg( secStr );
- 353         } else if ( duration >= 60 && duration < 3600 ) {
  354             // more than one min && less than one hour
  355             QString minStr, secStr;
  356             int min = duration / 60;
  357             int sec = duration % 60;
  358             
    359             minStr = min >= 10 ? QString::number( min ) : QString::number( min ).prepend( "0" );
- 359     ternary-?: min >= 10
    360             secStr = sec >= 10 ? QString::number( sec ) : QString::number( sec ).prepend( "0" );     
- 360     ternary-?: sec >= 10
  361             mDuration = timeFormatTwo.arg( minStr ).arg( secStr );
- 362         } else if ( duration > 0 && duration < 60 ) {
  363             QString secStr;
    364             secStr = duration >= 10 ? QString::number( duration ) : QString::number( duration ).prepend( "0" ); 
- 364     ternary-?: duration >= 10
  365             mDuration = secStr;
    366         } else {
  367             mDuration = QString();
  368         }
  369     }
  370     TX_EXIT
 - 371     return change;
  372 }
  373 
Top
- 374 bool MpSongData::setBitRate( int bitRate)
  375 {
  376     TX_ENTRY_ARGS( "Bit rate =" << bitRate )
  377     bool change = false;
- 378     if ( QString::number( bitRate ) != mBitRate ) {
  379         change = true;
- 380         if ( bitRate > 0 ) {
  381             mBitRate = QString::number( bitRate / 1000 );
    382         } else {
  383             mBitRate = QString();
  384         }
  385     }
  386     TX_EXIT
 - 387     return change;
  388 }
  389 
Top
- 390 bool MpSongData::setSampleRate( int sampleRate )
  391 {
  392     TX_ENTRY_ARGS( "Sample rate =" << sampleRate )
  393     bool change = false;
- 394     if ( QString::number( sampleRate ) != mSampleRate ) {
  395         change = true;
- 396         if ( sampleRate > 0 ) {
  397             mSampleRate = QString::number( sampleRate );
    398         } else {
  399             mSampleRate = QString();
  400         }
  401     }
  402     TX_EXIT
 - 403     return change;
  404 }
  405 
Top
- 406 bool MpSongData::setSize( int size )
  407 {   
  408     TX_ENTRY_ARGS( "Size =" << size )
  409     bool change = false;
- 410     if ( QString::number( size ) != mSize ) {
  411         change = true;
  412         mSize = QString::number( size / 1000 ).append( " MB" );
  413     }
  414     TX_EXIT
 - 415     return change;
  416 }
  417 
Top
- 418 bool MpSongData::setModified( const QString &modified )
  419 {
  420     TX_ENTRY_ARGS( "Modified =" << modified )
  421     bool change = false;
- 422     if ( modified != mModified ) {
  423         change = true;
  424         mModified = modified;
  425     }
  426     TX_EXIT
 - 427     return change;
  428 }
  429 
Top
- 430 bool MpSongData::setCopyright( const QString &copyright )
  431 {
  432     TX_ENTRY_ARGS( "Copyright =" << copyright )
  433     bool change = false;
- 434     if ( copyright != mCopyright ) {
  435         change = true;
  436         mCopyright = copyright;
  437     }
  438     TX_EXIT
 - 439     return change;
  440 }
  441 
Top
- 442 bool MpSongData::setMusicURL( const QString &musicURL )
  443 {
  444     TX_ENTRY_ARGS( "Music URL =" << musicURL )
  445     bool change = false;
- 446     if ( musicURL != mMusicURL ) {
  447         change = true;
  448         mMusicURL = musicURL;
  449     }
  450     TX_EXIT
 - 451     return change;
  452 }
  453 
  454 
Top
- 455 void MpSongData::thumbnailReady(
  456         const QPixmap& pixmap,
  457         void *data,
  458         int id,
  459         int error  )
  460 {
  461     TX_ENTRY_ARGS("Stub")
  462     Q_UNUSED( data );
  463     TX_EXIT_ARGS("Stub")
  464 }
  465 
Top
- 466 void MpSongData::commitPlaybackInfo()
  467 {
  468     TX_ENTRY_ARGS("Stub")
  469     emit playbackInfoChanged();
  470     TX_EXIT_ARGS("Stub")
  471 }
  472 
Top
- 473 void MpSongData::commitSongDetailInfo()
  474 {
  475     TX_ENTRY_ARGS("Stub")
  476     emit songDetailInfoChanged();
  477     TX_EXIT_ARGS("Stub")
  478 }
  479 
Top
- 480 QString MpSongData::albumArtBase64() const
  481 {
 - 482     return QString();
  483 }
***TER 0% (0/146) of SOURCE FILE mpsongdata.cpp

Directory Summary | Files Summary | Functions Summary | Execution Profile
To files: First | Previous | Next | Last | Top | Index | No Index