diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-10 06:08:18 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-10 06:08:18 +0000 |
commit | 3a2300ed7cee06b5b49c4bc71f38d5cee72171b5 (patch) | |
tree | ebc2fc901d7584145d9c40de18d9e4931283360a /src/outputdirectory.cpp | |
parent | 633d093981e9e04c06921459694cd095cdf85c23 (diff) | |
download | soundkonverter-3a2300ed7cee06b5b49c4bc71f38d5cee72171b5.tar.gz soundkonverter-3a2300ed7cee06b5b49c4bc71f38d5cee72171b5.zip |
rename the following methods:
tqfind find
tqreplace replace
tqcontains contains
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/soundkonverter@1246075 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/outputdirectory.cpp')
-rwxr-xr-x | src/outputdirectory.cpp | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/src/outputdirectory.cpp b/src/outputdirectory.cpp index 161c1a5..df92c36 100755 --- a/src/outputdirectory.cpp +++ b/src/outputdirectory.cpp @@ -140,7 +140,7 @@ void OutputDirectory::setDirectory( const TQString& directory ) TQString OutputDirectory::calcPath( FileListItem* fileListItem, Config* config, TQString extension ) { - // TODO tqreplace '//' by '/' ??? + // TODO replace '//' by '/' ??? // FIXME test fvat names TQString path; if( extension.isEmpty() ) extension = fileListItem->options.encodingOptions.sFormat; @@ -170,55 +170,55 @@ TQString OutputDirectory::calcPath( FileListItem* fileListItem, Config* config, else */path = fileListItem->options.outputOptions.directory; if( path.right(1) == "/" ) path += "%f"; - else if( path.tqfindRev(TQRegExp("%[aAbBcCdDfFgGnNpPtTyY]{1,1}")) < path.tqfindRev("/") ) path += "/%f"; - - path.tqreplace( "%a", "$replace_by_artist$" ); - path.tqreplace( "%b", "$replace_by_album$" ); - path.tqreplace( "%c", "$replace_by_comment$" ); - path.tqreplace( "%d", "$replace_by_disc$" ); - path.tqreplace( "%g", "$replace_by_genre$" ); - path.tqreplace( "%n", "$replace_by_track$" ); - path.tqreplace( "%p", "$replace_by_composer$" ); - path.tqreplace( "%t", "$replace_by_title$" ); - path.tqreplace( "%y", "$replace_by_year$" ); - path.tqreplace( "%f", "$replace_by_filename$" ); + else if( path.findRev(TQRegExp("%[aAbBcCdDfFgGnNpPtTyY]{1,1}")) < path.findRev("/") ) path += "/%f"; + + path.replace( "%a", "$replace_by_artist$" ); + path.replace( "%b", "$replace_by_album$" ); + path.replace( "%c", "$replace_by_comment$" ); + path.replace( "%d", "$replace_by_disc$" ); + path.replace( "%g", "$replace_by_genre$" ); + path.replace( "%n", "$replace_by_track$" ); + path.replace( "%p", "$replace_by_composer$" ); + path.replace( "%t", "$replace_by_title$" ); + path.replace( "%y", "$replace_by_year$" ); + path.replace( "%f", "$replace_by_filename$" ); TQString artist = ( fileListItem->tags == 0 || fileListItem->tags->artist.isEmpty() ) ? i18n("Unknown Artist") : fileListItem->tags->artist; -/// artist.tqreplace("/","\\"); - path.tqreplace( "$replace_by_artist$", KURL::encode_string(artist).tqreplace("/","%2f") ); +/// artist.replace("/","\\"); + path.replace( "$replace_by_artist$", KURL::encode_string(artist).replace("/","%2f") ); TQString album = ( fileListItem->tags == 0 || fileListItem->tags->album.isEmpty() ) ? i18n("Unknown Album") : fileListItem->tags->album; -/// album.tqreplace("/","\\"); - path.tqreplace( "$replace_by_album$", KURL::encode_string(album).tqreplace("/","%2f") ); +/// album.replace("/","\\"); + path.replace( "$replace_by_album$", KURL::encode_string(album).replace("/","%2f") ); TQString comment = ( fileListItem->tags == 0 || fileListItem->tags->comment.isEmpty() ) ? i18n("No Comment") : fileListItem->tags->comment; -/// comment.tqreplace("/","\\"); - path.tqreplace( "$replace_by_comment$", KURL::encode_string(comment).tqreplace("/","%2f") ); +/// comment.replace("/","\\"); + path.replace( "$replace_by_comment$", KURL::encode_string(comment).replace("/","%2f") ); TQString disc = ( fileListItem->tags == 0 ) ? "0" : TQString().sprintf("%i",fileListItem->tags->disc); - path.tqreplace( "$replace_by_disc$", disc ); + path.replace( "$replace_by_disc$", disc ); TQString genre = ( fileListItem->tags == 0 || fileListItem->tags->genre.isEmpty() ) ? i18n("Unknown Genre") : fileListItem->tags->genre; -/// genre.tqreplace("/","\\"); - path.tqreplace( "$replace_by_genre$", KURL::encode_string(genre).tqreplace("/","%2f") ); +/// genre.replace("/","\\"); + path.replace( "$replace_by_genre$", KURL::encode_string(genre).replace("/","%2f") ); TQString track = ( fileListItem->tags == 0 ) ? "00" : TQString().sprintf("%02i",fileListItem->tags->track); - path.tqreplace( "$replace_by_track$", track ); + path.replace( "$replace_by_track$", track ); TQString composer = ( fileListItem->tags == 0 || fileListItem->tags->composer.isEmpty() ) ? i18n("Unknown Composer") : fileListItem->tags->composer; -/// composer.tqreplace("/","\\"); - path.tqreplace( "$replace_by_composer$", KURL::encode_string(composer).tqreplace("/","%2f") ); +/// composer.replace("/","\\"); + path.replace( "$replace_by_composer$", KURL::encode_string(composer).replace("/","%2f") ); TQString title = ( fileListItem->tags == 0 || fileListItem->tags->title.isEmpty() ) ? i18n("Unknown Title") : fileListItem->tags->title; -/// title.tqreplace("/","\\"); - path.tqreplace( "$replace_by_title$", KURL::encode_string(title).tqreplace("/","%2f") ); +/// title.replace("/","\\"); + path.replace( "$replace_by_title$", KURL::encode_string(title).replace("/","%2f") ); TQString year = ( fileListItem->tags == 0 ) ? "0000" : TQString().sprintf("%04i",fileListItem->tags->year); - path.tqreplace( "$replace_by_year$", year ); + path.replace( "$replace_by_year$", year ); - TQString filename = fileName.left( fileName.tqfindRev(".") ); -/// filename.tqreplace("/","\\"); - path.tqreplace( "$replace_by_filename$", filename ); + TQString filename = fileName.left( fileName.findRev(".") ); +/// filename.replace("/","\\"); + path.replace( "$replace_by_filename$", filename ); // path = uniqueFileName( path + "." + extension ); path = path + "." + extension; @@ -230,13 +230,13 @@ TQString OutputDirectory::calcPath( FileListItem* fileListItem, Config* config, TQString originalPath = fileListItem->options.filePathName; TQString cutted; while( basePath.length() > 0 ) { - if( fileListItem->options.filePathName.tqfind(basePath) == 0 ) { - originalPath.tqreplace( basePath, "" ); + if( fileListItem->options.filePathName.find(basePath) == 0 ) { + originalPath.replace( basePath, "" ); return uniqueFileName( changeExtension(basePath+cutted+originalPath,extension) ); } else { - cutted = basePath.right( basePath.length() - basePath.tqfindRev("/") ) + cutted; - basePath = basePath.left( basePath.tqfindRev("/") ); + cutted = basePath.right( basePath.length() - basePath.findRev("/") ) + cutted; + basePath = basePath.left( basePath.findRev("/") ); } } // path = uniqueFileName( changeExtension(fileListItem->options.outputOptions.directory+"/"+fileListItem->options.filePathName,extension) ); @@ -254,7 +254,7 @@ TQString OutputDirectory::calcPath( FileListItem* fileListItem, Config* config, TQString OutputDirectory::changeExtension( const TQString& filename, const TQString& extension ) { - return filename.left( filename.tqfindRev(".") + 1 ) + extension; + return filename.left( filename.findRev(".") + 1 ) + extension; } TQString OutputDirectory::uniqueFileName( const TQString& filename ) @@ -277,7 +277,7 @@ TQString OutputDirectory::uniqueFileName( const TQString& filename ) int length = ( filename.left(6) == "home:/" ) ? 6 : 14; TQString username = filename; username.remove( 0, length ); - username = username.left( username.tqfind("/") ); + username = username.left( username.find("/") ); filePathName = filename; filePathName.remove( 0, length + username.length() ); KUser user( username ); @@ -287,7 +287,7 @@ TQString OutputDirectory::uniqueFileName( const TQString& filename ) int length = ( filename.left(7) == "media:/" ) ? 7 : 14; TQString device = filename; device.remove( 0, length ); - device = "/dev/" + device.left( device.tqfind( "/" ) ); + device = "/dev/" + device.left( device.find( "/" ) ); KMountPoint::List mountPoints = KMountPoint::possibleMountPoints(); @@ -309,10 +309,10 @@ TQString OutputDirectory::uniqueFileName( const TQString& filename ) // generate a unique file name while( fileInfo.exists() ) { - fileInfo.setFile( fileInfo.filePath().left( fileInfo.filePath().tqfindRev(".")+1 ) + i18n("new") + fileInfo.filePath().right( fileInfo.filePath().length() - fileInfo.filePath().tqfindRev(".") ) ); + fileInfo.setFile( fileInfo.filePath().left( fileInfo.filePath().findRev(".")+1 ) + i18n("new") + fileInfo.filePath().right( fileInfo.filePath().length() - fileInfo.filePath().findRev(".") ) ); } - return KURL::encode_string( fileInfo.filePath() ); // was: .tqreplace( "//", "/" ) + return KURL::encode_string( fileInfo.filePath() ); // was: .replace( "//", "/" ) } TQString OutputDirectory::makePath( const TQString& path ) @@ -323,7 +323,7 @@ TQString OutputDirectory::makePath( const TQString& path ) TQString mkDir; TQDir dir; for( TQStringList::Iterator it = dirs.begin(); it != dirs.end(); ++it ) { - mkDir += "/" + KURL::decode_string(*it).tqreplace("/","%2f"); + mkDir += "/" + KURL::decode_string(*it).replace("/","%2f"); dir.setPath( mkDir ); if( !dir.exists() ) dir.mkdir( mkDir ); } @@ -336,8 +336,8 @@ TQString OutputDirectory::makePath( const TQString& path ) // modified : 2008 Daniel Faust <[email protected]> TQString OutputDirectory::vfatPath( const TQString& path ) { - TQString s = KURL::decode_string(path.right( path.length() - path.tqfindRev("/") - 1 )); - TQString p = KURL::decode_string(path.left( path.tqfindRev("/") + 1 )); + TQString s = KURL::decode_string(path.right( path.length() - path.findRev("/") - 1 )); + TQString p = KURL::decode_string(path.left( path.findRev("/") + 1 )); for( uint i = 0; i < s.length(); i++ ) { @@ -378,25 +378,25 @@ TQString OutputDirectory::vfatPath( const TQString& path ) if( s[len-1] == ' ' ) s[len-1] = '_'; - return TQString( p + s ).tqreplace("%2f","_"); + return TQString( p + s ).replace("%2f","_"); // return p + s; } void OutputDirectory::selectDir() { TQString startDir = lDir->text(); - int i = startDir.tqfind( TQRegExp("%[aAbBcCdDfFgGnNpPtTyY]{1,1}") ); + int i = startDir.find( TQRegExp("%[aAbBcCdDfFgGnNpPtTyY]{1,1}") ); if( i != -1 ) { - i = startDir.tqfindRev( "/", i ); + i = startDir.findRev( "/", i ); startDir = startDir.left( i ); } TQString directory = KFileDialog::getExistingDirectory( startDir, this, i18n("Choose an output directory") ); if( !directory.isEmpty() ) { TQString dir = lDir->text(); - i = dir.tqfind( TQRegExp("%[aAbBcCdDfFgGnNpPtTyY]{1,1}") ); + i = dir.find( TQRegExp("%[aAbBcCdDfFgGnNpPtTyY]{1,1}") ); if( i != -1 && (Mode)cMode->currentItem() == MetaData ) { - i = dir.tqfindRev( "/", i ); + i = dir.findRev( "/", i ); lDir->setText( directory + dir.mid(i) ); } else { @@ -409,9 +409,9 @@ void OutputDirectory::selectDir() void OutputDirectory::gotoDir() { TQString startDir = lDir->originalText(); - int i = startDir.tqfind( TQRegExp("%[aAbBcCdDfFgGnNpPtTyY]{1,1}") ); + int i = startDir.find( TQRegExp("%[aAbBcCdDfFgGnNpPtTyY]{1,1}") ); if( i != -1 ) { - i = startDir.tqfindRev( "/", i ); + i = startDir.findRev( "/", i ); startDir = startDir.left( i ); } |