diff options
Diffstat (limited to 'src/metadata/tagengine.cpp')
-rw-r--r-- | src/metadata/tagengine.cpp | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/src/metadata/tagengine.cpp b/src/metadata/tagengine.cpp index 9f9626c..f8064d2 100644 --- a/src/metadata/tagengine.cpp +++ b/src/metadata/tagengine.cpp @@ -34,6 +34,8 @@ #include "m4a/mp4itunestag.h" #endif +#define TStringToTQString(s) TQString::fromUtf8((s).toCString(true)) + // TODO COMPILATION tag // FIXME BPM tag @@ -67,7 +69,7 @@ TagEngine::TagEngine() { TagLib::StringList genres = TagLib::ID3v1::genreList(); for( TagLib::StringList::ConstIterator it = genres.begin(), end = genres.end(); it != end; ++it ) - genreList += TStringToQString( (*it) ); + genreList += TStringToTQString( (*it) ); genreList.sort(); } @@ -92,11 +94,11 @@ TagData* TagEngine::readTags( const TQString& file ) if( tag ) { - tagData->title = TQString(TStringToQString( tag->title() )).stripWhiteSpace(); - tagData->artist = TQString(TStringToQString( tag->artist() )).stripWhiteSpace(); - tagData->album = TQString(TStringToQString( tag->album() )).stripWhiteSpace(); - tagData->genre = TQString(TStringToQString( tag->genre() )).stripWhiteSpace(); - tagData->comment = TQString(TStringToQString( tag->comment() )).stripWhiteSpace(); + tagData->title = TStringToTQString( tag->title() ).stripWhiteSpace(); + tagData->artist = TStringToTQString( tag->artist() ).stripWhiteSpace(); + tagData->album = TStringToTQString( tag->album() ).stripWhiteSpace(); + tagData->genre = TStringToTQString( tag->genre() ).stripWhiteSpace(); + tagData->comment = TStringToTQString( tag->comment() ).stripWhiteSpace(); tagData->track = tag->track(); tagData->year = tag->year(); } @@ -121,18 +123,18 @@ TagData* TagEngine::readTags( const TQString& file ) if ( file->ID3v2Tag() ) { if ( !file->ID3v2Tag()->frameListMap()[ "TPOS" ].isEmpty() ) - disc = TQString(TStringToQString( file->ID3v2Tag()->frameListMap()["TPOS"].front()->toString() )).stripWhiteSpace(); + disc = TStringToTQString( file->ID3v2Tag()->frameListMap()["TPOS"].front()->toString() ).stripWhiteSpace(); if ( !file->ID3v2Tag()->frameListMap()[ "TCOM" ].isEmpty() ) - tagData->composer = TQString(TStringToQString( file->ID3v2Tag()->frameListMap()["TCOM"].front()->toString() )).stripWhiteSpace(); + tagData->composer = TStringToTQString( file->ID3v2Tag()->frameListMap()["TCOM"].front()->toString() ).stripWhiteSpace(); } if ( file->APETag() ) { if ( !file->APETag()->itemListMap()[ "REPLAYGAIN_TRACK_GAIN" ].isEmpty() ) - track_gain = TQString(TStringToQString( file->APETag()->itemListMap()["REPLAYGAIN_TRACK_GAIN"].toString() )).stripWhiteSpace(); + track_gain = TStringToTQString( file->APETag()->itemListMap()["REPLAYGAIN_TRACK_GAIN"].toString() ).stripWhiteSpace(); if ( !file->APETag()->itemListMap()[ "REPLAYGAIN_ALBUM_GAIN" ].isEmpty() ) - album_gain = TQString(TStringToQString( file->APETag()->itemListMap()["REPLAYGAIN_ALBUM_GAIN"].toString() )).stripWhiteSpace(); + album_gain = TStringToTQString( file->APETag()->itemListMap()["REPLAYGAIN_ALBUM_GAIN"].toString() ).stripWhiteSpace(); } } else if ( TagLib::Ogg::Vorbis::File *file = dynamic_cast<TagLib::Ogg::Vorbis::File *>( fileref.file() ) ) @@ -140,16 +142,16 @@ TagData* TagEngine::readTags( const TQString& file ) if ( file->tag() ) { if ( !file->tag()->fieldListMap()[ "COMPOSER" ].isEmpty() ) - tagData->composer = TQString(TStringToQString( file->tag()->fieldListMap()["COMPOSER"].front() )).stripWhiteSpace(); + tagData->composer = TStringToTQString( file->tag()->fieldListMap()["COMPOSER"].front() ).stripWhiteSpace(); if ( !file->tag()->fieldListMap()[ "DISCNUMBER" ].isEmpty() ) - disc = TQString(TStringToQString( file->tag()->fieldListMap()["DISCNUMBER"].front() )).stripWhiteSpace(); + disc = TStringToTQString( file->tag()->fieldListMap()["DISCNUMBER"].front() ).stripWhiteSpace(); if ( !file->tag()->fieldListMap()[ "REPLAYGAIN_TRACK_GAIN" ].isEmpty() ) - track_gain = TQString(TStringToQString( file->tag()->fieldListMap()["REPLAYGAIN_TRACK_GAIN"].front() )).stripWhiteSpace(); + track_gain = TStringToTQString( file->tag()->fieldListMap()["REPLAYGAIN_TRACK_GAIN"].front() ).stripWhiteSpace(); if ( !file->tag()->fieldListMap()[ "REPLAYGAIN_ALBUM_GAIN" ].isEmpty() ) - album_gain = TQString(TStringToQString( file->tag()->fieldListMap()["REPLAYGAIN_ALBUM_GAIN"].front() )).stripWhiteSpace(); + album_gain = TStringToTQString( file->tag()->fieldListMap()["REPLAYGAIN_ALBUM_GAIN"].front() ).stripWhiteSpace(); } } else if ( TagLib::FLAC::File *file = dynamic_cast<TagLib::FLAC::File *>( fileref.file() ) ) @@ -157,25 +159,25 @@ TagData* TagEngine::readTags( const TQString& file ) if ( file->xiphComment() ) { if ( !file->xiphComment()->fieldListMap()[ "COMPOSER" ].isEmpty() ) - tagData->composer = TQString(TStringToQString( file->xiphComment()->fieldListMap()["COMPOSER"].front() )).stripWhiteSpace(); + tagData->composer = TStringToTQString( file->xiphComment()->fieldListMap()["COMPOSER"].front() ).stripWhiteSpace(); if ( !file->xiphComment()->fieldListMap()[ "DISCNUMBER" ].isEmpty() ) - disc = TQString(TStringToQString( file->xiphComment()->fieldListMap()["DISCNUMBER"].front() )).stripWhiteSpace(); + disc = TStringToTQString( file->xiphComment()->fieldListMap()["DISCNUMBER"].front() ).stripWhiteSpace(); if ( !file->xiphComment()->fieldListMap()[ "REPLAYGAIN_TRACK_GAIN" ].isEmpty() ) - track_gain = TQString(TStringToQString( file->xiphComment()->fieldListMap()["REPLAYGAIN_TRACK_GAIN"].front() )).stripWhiteSpace(); + track_gain = TStringToTQString( file->xiphComment()->fieldListMap()["REPLAYGAIN_TRACK_GAIN"].front() ).stripWhiteSpace(); if ( !file->xiphComment()->fieldListMap()[ "REPLAYGAIN_ALBUM_GAIN" ].isEmpty() ) - album_gain = TQString(TStringToQString( file->xiphComment()->fieldListMap()["REPLAYGAIN_ALBUM_GAIN"].front() )).stripWhiteSpace(); + album_gain = TStringToTQString( file->xiphComment()->fieldListMap()["REPLAYGAIN_ALBUM_GAIN"].front() ).stripWhiteSpace(); } /*if ( file->tag() ) { if ( !file->tag()->fieldListMap()[ "REPLAYGAIN_TRACK_GAIN" ].isEmpty() ) - track_gain = TQString(TStringToQString( file->tag()->fieldListMap()["REPLAYGAIN_TRACK_GAIN"].front() )).stripWhiteSpace(); + track_gain = TStringToTQString( file->tag()->fieldListMap()["REPLAYGAIN_TRACK_GAIN"].front() ).stripWhiteSpace(); if ( !file->tag()->fieldListMap()[ "REPLAYGAIN_ALBUM_GAIN" ].isEmpty() ) - album_gain = TQString(TStringToQString( file->tag()->fieldListMap()["REPLAYGAIN_ALBUM_GAIN"].front() )).stripWhiteSpace(); + album_gain = TStringToTQString( file->tag()->fieldListMap()["REPLAYGAIN_ALBUM_GAIN"].front() ).stripWhiteSpace(); }*/ } else if ( TagLib::MP4::File *file = dynamic_cast<TagLib::MP4::File *>( fileref.file() ) ) @@ -183,7 +185,7 @@ TagData* TagEngine::readTags( const TQString& file ) TagLib::MP4::Tag *mp4tag = dynamic_cast<TagLib::MP4::Tag *>( file->tag() ); if( mp4tag ) { - tagData->composer = TStringToQString( mp4tag->composer() ); + tagData->composer = TStringToTQString( mp4tag->composer() ); disc = TQString::number( mp4tag->disk() ); } @@ -193,10 +195,10 @@ TagData* TagEngine::readTags( const TQString& file ) if ( file->APETag() ) { if ( !file->APETag()->itemListMap()[ "REPLAYGAIN_TRACK_GAIN" ].isEmpty() ) - track_gain = TQString(TStringToQString( file->APETag()->itemListMap()["REPLAYGAIN_TRACK_GAIN"].toString() )).stripWhiteSpace(); + track_gain = TStringToTQString( file->APETag()->itemListMap()["REPLAYGAIN_TRACK_GAIN"].toString() ).stripWhiteSpace(); if ( !file->APETag()->itemListMap()[ "REPLAYGAIN_ALBUM_GAIN" ].isEmpty() ) - album_gain = TQString(TStringToQString( file->APETag()->itemListMap()["REPLAYGAIN_ALBUM_GAIN"].toString() )).stripWhiteSpace(); + album_gain = TStringToTQString( file->APETag()->itemListMap()["REPLAYGAIN_ALBUM_GAIN"].toString() ).stripWhiteSpace(); } }*/ else if ( TagLib::WavPack::File *file = dynamic_cast<TagLib::WavPack::File *>( fileref.file() ) ) @@ -204,10 +206,10 @@ TagData* TagEngine::readTags( const TQString& file ) if ( file->APETag() ) { if ( !file->APETag()->itemListMap()[ "REPLAYGAIN_TRACK_GAIN" ].isEmpty() ) - track_gain = TQString(TStringToQString( file->APETag()->itemListMap()["REPLAYGAIN_TRACK_GAIN"].toString() )).stripWhiteSpace(); + track_gain = TStringToTQString( file->APETag()->itemListMap()["REPLAYGAIN_TRACK_GAIN"].toString() ).stripWhiteSpace(); if ( !file->APETag()->itemListMap()[ "REPLAYGAIN_ALBUM_GAIN" ].isEmpty() ) - album_gain = TQString(TStringToQString( file->APETag()->itemListMap()["REPLAYGAIN_ALBUM_GAIN"].toString() )).stripWhiteSpace(); + album_gain = TStringToTQString( file->APETag()->itemListMap()["REPLAYGAIN_ALBUM_GAIN"].toString() ).stripWhiteSpace(); } } else if ( TagLib::TTA::File *file = dynamic_cast<TagLib::TTA::File *>( fileref.file() ) ) @@ -215,10 +217,10 @@ TagData* TagEngine::readTags( const TQString& file ) if ( file->ID3v2Tag() ) { if ( !file->ID3v2Tag()->frameListMap()[ "TPOS" ].isEmpty() ) - disc = TQString(TStringToQString( file->ID3v2Tag()->frameListMap()["TPOS"].front()->toString() )).stripWhiteSpace(); + disc = TStringToTQString( file->ID3v2Tag()->frameListMap()["TPOS"].front()->toString() ).stripWhiteSpace(); if ( !file->ID3v2Tag()->frameListMap()[ "TCOM" ].isEmpty() ) - tagData->composer = TQString(TStringToQString( file->ID3v2Tag()->frameListMap()["TCOM"].front()->toString() )).stripWhiteSpace(); + tagData->composer = TStringToTQString( file->ID3v2Tag()->frameListMap()["TCOM"].front()->toString() ).stripWhiteSpace(); } } |