369 |
372 |
370 ( ( MpSongDataPrivate* ) this )->mTempAlbumArt = sTempFileLocation; |
373 ( ( MpSongDataPrivate* ) this )->mTempAlbumArt = sTempFileLocation; |
371 TX_LOG_ARGS( "Create album art file " << mTempAlbumArt ); |
374 TX_LOG_ARGS( "Create album art file " << mTempAlbumArt ); |
372 |
375 |
373 QFile file( mTempAlbumArt ); |
376 QFile file( mTempAlbumArt ); |
374 file.open( QIODevice::WriteOnly ); |
377 if ( !file.open( QIODevice::WriteOnly ) ) { |
|
378 return QString(""); |
|
379 } |
375 if ( mAlbumArt && !mAlbumArt->isNull() && !mAlbumArt->qicon().isNull() ) |
380 if ( mAlbumArt && !mAlbumArt->isNull() && !mAlbumArt->qicon().isNull() ) |
376 { |
381 { |
377 QPixmap p = mAlbumArt->qicon().pixmap( QSize( 74, 74 ), QIcon::Normal, QIcon::Off ); |
382 QPixmap p = mAlbumArt->qicon().pixmap( QSize( 74, 74 ), QIcon::Normal, QIcon::Off ); |
378 p.save( &file, "PNG" ); |
383 p.save( &file, "PNG" ); |
379 //mAlbumArt->pixmap().save( &file, "PNG" ); // writes pixmap into bytes in PNG format |
384 //mAlbumArt->pixmap().save( &file, "PNG" ); // writes pixmap into bytes in PNG format |
539 TX_LOG_ARGS( "File name with path: " << fullName ); |
544 TX_LOG_ARGS( "File name with path: " << fullName ); |
540 // get size & last modifed information from file system |
545 // get size & last modifed information from file system |
541 QFileInfo info( fullName ); |
546 QFileInfo info( fullName ); |
542 changed |= setSize( info.size() ); |
547 changed |= setSize( info.size() ); |
543 |
548 |
|
549 // Localization of timestamp is somewhat complex operation: |
|
550 // 1. Localize the date and time parts separately |
|
551 // 2. Concatenate the resulting localized strings |
|
552 // 3. Finally, convert all of the digits in resulting single string |
|
553 // to their localized versions (not all scripts have same numerals |
|
554 // as latin/arabic) |
544 QDateTime lastModified = info.lastModified(); |
555 QDateTime lastModified = info.lastModified(); |
545 QDate date = lastModified.date(); |
556 QDate date( lastModified.date() ); |
546 int day = date.day(); |
557 QTime time( lastModified.time() ); |
547 int month = date.month(); |
558 |
548 int year = date.year(); |
559 HbExtendedLocale locale = HbExtendedLocale::system(); |
549 QTime time = lastModified.time(); |
560 |
550 int sec = time.second(); |
561 QString dateStr = locale.format( date, r_qtn_date_usual_with_zero ); |
551 int min = time.minute(); |
562 QString timeStr = locale.format( time, r_qtn_time_long_with_zero ); |
552 int hr = time.hour(); |
563 QString timestampStr( dateStr + " " + timeStr ); |
553 |
564 TX_LOG_ARGS( "Timestamp before corrections: " << timestampStr ); |
554 QString lastModifiedStr("%1.%2.%3 %4:%5:%6"); |
565 QString convertedTimestampStr( HbStringUtil::convertDigits(timestampStr) ); |
555 lastModifiedStr = lastModifiedStr.arg( day ).arg( month ).arg( year ).arg( hr ).arg( min ).arg( sec ); |
566 |
556 changed |= setModified( lastModifiedStr ); |
567 changed |= setModified( convertedTimestampStr ); |
557 |
568 |
558 |
569 |
559 // get file name without suffix |
570 // get file name without suffix |
560 QString file; |
571 QString file; |
561 QRegExp rx("(.+)\\..+"); |
572 QRegExp rx("(.+)\\..+"); |
1002 { |
1013 { |
1003 TX_ENTRY_ARGS( "Music URL =" << musicURL ) |
1014 TX_ENTRY_ARGS( "Music URL =" << musicURL ) |
1004 bool change = false; |
1015 bool change = false; |
1005 if ( musicURL != mMusicURL ) { |
1016 if ( musicURL != mMusicURL ) { |
1006 change = true; |
1017 change = true; |
1007 mMusicURL = musicURL; |
1018 |
|
1019 // Make sure URL contains the correct protocol definition (HTTP). |
|
1020 if ( (musicURL.length() > 0) && |
|
1021 (musicURL.indexOf( "://", 0, Qt::CaseInsensitive ) == -1) ) { |
|
1022 mMusicURL = "http://" + musicURL; |
|
1023 TX_LOG_ARGS("Changed music url to " << mMusicURL); |
|
1024 } |
|
1025 else { |
|
1026 mMusicURL = musicURL; |
|
1027 TX_LOG_ARGS("Music url unchanged: " << mMusicURL); |
|
1028 } |
1008 } |
1029 } |
1009 TX_EXIT |
1030 TX_EXIT |
1010 return change; |
1031 return change; |
1011 } |
1032 } |
1012 |
1033 |