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/convert.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/convert.cpp')
-rwxr-xr-x | src/convert.cpp | 204 |
1 files changed, 102 insertions, 102 deletions
diff --git a/src/convert.cpp b/src/convert.cpp index 6b274e3..9f5000a 100755 --- a/src/convert.cpp +++ b/src/convert.cpp @@ -85,7 +85,7 @@ void Convert::get( ConvertItem* item ) item->fileListItem->setText( fileList->columnByName(i18n("State")), i18n("Getting file")+"... 00 %" ); - KURL source( item->fileListItem->options.filePathName.tqreplace("?","%3f") ); + KURL source( item->fileListItem->options.filePathName.replace("?","%3f") ); KURL destination( item->tempInFile->name() ); if( source.isLocalFile() && destination.isLocalFile() ) { @@ -219,9 +219,9 @@ void Convert::rip( ConvertItem* item ) item->track = 0; } -// if( plugin->rip.out_file.tqfind("%p") != -1 ) { +// if( plugin->rip.out_file.find("%p") != -1 ) { // TQString t_str = plugin->rip.out_file; -// t_str.tqreplace( "%p", param ); +// t_str.replace( "%p", param ); // param = plugin->rip.bin + " " + t_str; // } // else { @@ -229,7 +229,7 @@ void Convert::rip( ConvertItem* item ) // } TQString t_str = plugin->rip.out_file; - t_str.tqreplace( "%p", param ); + t_str.replace( "%p", param ); param = config->binaries[plugin->rip.bin] + " " + t_str; param.simplifyWhiteSpace(); @@ -239,17 +239,17 @@ void Convert::rip( ConvertItem* item ) for( TQStringList::Iterator it = params.begin(); it != params.end(); ++it ) { paramSplinter = *it; - paramSplinter.tqreplace( "%d", item->fileListItem->device ); - paramSplinter.tqreplace( "%t", TQString().sprintf("%i",item->fileListItem->track) ); - paramSplinter.tqreplace( "%n", TQString().sprintf("%i",cdManager->getTrackCount(item->fileListItem->device)) ); - paramSplinter.tqreplace( "%o", item->tempWavFile->name() ); + paramSplinter.replace( "%d", item->fileListItem->device ); + paramSplinter.replace( "%t", TQString().sprintf("%i",item->fileListItem->track) ); + paramSplinter.replace( "%n", TQString().sprintf("%i",cdManager->getTrackCount(item->fileListItem->device)) ); + paramSplinter.replace( "%o", item->tempWavFile->name() ); *(item->convertProcess) << paramSplinter; } - param.tqreplace( "%d", item->fileListItem->device ); - param.tqreplace( "%t", TQString().sprintf("%i",item->fileListItem->track) ); - param.tqreplace( "%n", TQString().sprintf("%i",cdManager->getTrackCount(item->fileListItem->device)) ); - param.tqreplace( "%o", "\""+item->tempWavFile->name()+"\"" ); + param.replace( "%d", item->fileListItem->device ); + param.replace( "%t", TQString().sprintf("%i",item->fileListItem->track) ); + param.replace( "%n", TQString().sprintf("%i",cdManager->getTrackCount(item->fileListItem->device)) ); + param.replace( "%o", "\""+item->tempWavFile->name()+"\"" ); logger->log( item->logID, param ); //kdDebug() << " Executing: `" << param << "'" << endl; @@ -286,7 +286,7 @@ void Convert::decode( ConvertItem* item ) if( !plugin->dec.overwrite.isEmpty() ) param.append( " " + plugin->dec.overwrite ); TQString t_str = plugin->dec.in_out_files; - t_str.tqreplace( "%p", param ); + t_str.replace( "%p", param ); param = config->binaries[plugin->dec.bin] + " " + t_str; param = param.simplifyWhiteSpace(); @@ -296,13 +296,13 @@ void Convert::decode( ConvertItem* item ) for( TQStringList::Iterator it = params.begin(); it != params.end(); ++it ) { paramSplinter = *it; - paramSplinter.tqreplace( "%i", item->tempInFile->name() ); - paramSplinter.tqreplace( "%o", item->tempWavFile->name() ); + paramSplinter.replace( "%i", item->tempInFile->name() ); + paramSplinter.replace( "%o", item->tempWavFile->name() ); *(item->convertProcess) << paramSplinter; } - param.tqreplace( "%i", "\""+item->tempInFile->name()+"\"" ); - param.tqreplace( "%o", "\""+item->tempWavFile->name()+"\"" ); + param.replace( "%i", "\""+item->tempInFile->name()+"\"" ); + param.replace( "%o", "\""+item->tempWavFile->name()+"\"" ); //item->log = param; logger->log( item->logID, param ); @@ -376,7 +376,7 @@ void Convert::encode( ConvertItem* item ) else sStrength = TQString::number( int(plugin->enc.strength.range_min - compressionLevel * plugin->enc.strength.step) ); } - if( plugin->enc.strength.separator != '.' ) sStrength.tqreplace( TQChar('.'), plugin->enc.strength.separator ); + if( plugin->enc.strength.separator != '.' ) sStrength.replace( TQChar('.'), plugin->enc.strength.separator ); } else { TQStringList::Iterator it = plugin->enc.strength.profiles.at( compressionLevel ); @@ -420,8 +420,8 @@ void Convert::encode( ConvertItem* item ) //t_int -= t_int%plugin->enc.quality.step; sQuality = TQString::number( t_int ); } - if( plugin->enc.bin == "oggenc" ) sQuality.tqreplace(TQChar('.'),KGlobal::locale()->decimalSymbol()); // HACK make oggenc usable with all langauges - else if( plugin->enc.lossy.quality.separator != '.' ) sQuality.tqreplace(TQChar('.'),plugin->enc.lossy.quality.separator); + if( plugin->enc.bin == "oggenc" ) sQuality.replace(TQChar('.'),KGlobal::locale()->decimalSymbol()); // HACK make oggenc usable with all langauges + else if( plugin->enc.lossy.quality.separator != '.' ) sQuality.replace(TQChar('.'),plugin->enc.lossy.quality.separator); } else { TQStringList::Iterator it = plugin->enc.lossy.quality.profiles.at( rint(item->fileListItem->options.encodingOptions.iQuality*plugin->enc.lossy.quality.range_max/100) ); @@ -486,7 +486,7 @@ void Convert::encode( ConvertItem* item ) } TQString sInOutFiles = item->fileListItem->options.encodingOptions.sInOutFiles; - param = sInOutFiles.tqreplace( "%p", param ); + param = sInOutFiles.replace( "%p", param ); // cosmetic surgery param = param.simplifyWhiteSpace(); @@ -500,49 +500,49 @@ void Convert::encode( ConvertItem* item ) for( TQStringList::Iterator it = params.begin(); it != params.end(); ++it ) { paramSplinter = *it; - paramSplinter.tqreplace( "%i", inputFile ); - paramSplinter.tqreplace( "%o", item->tempOutFile->name() ); - paramSplinter.tqreplace( "%c", sStrength ); - paramSplinter.tqreplace( "%b", sBitrate ); - paramSplinter.tqreplace( "%q", sQuality ); - paramSplinter.tqreplace( "%m", sMinBitrate ); - paramSplinter.tqreplace( "%M", sMaxBitrate ); - paramSplinter.tqreplace( "%s", sSamplingRate ); + paramSplinter.replace( "%i", inputFile ); + paramSplinter.replace( "%o", item->tempOutFile->name() ); + paramSplinter.replace( "%c", sStrength ); + paramSplinter.replace( "%b", sBitrate ); + paramSplinter.replace( "%q", sQuality ); + paramSplinter.replace( "%m", sMinBitrate ); + paramSplinter.replace( "%M", sMaxBitrate ); + paramSplinter.replace( "%s", sSamplingRate ); if( item->fileListItem->tags ) { - paramSplinter.tqreplace( "%ta", ( item->fileListItem->tags->artist != "" ) ? item->fileListItem->tags->artist : i18n("Unknown") ); - paramSplinter.tqreplace( "%tb", ( item->fileListItem->tags->album != "" ) ? item->fileListItem->tags->album : i18n("Unknown") ); - paramSplinter.tqreplace( "%tc", ( item->fileListItem->tags->comment != "" ) ? item->fileListItem->tags->comment : i18n("Unknown") ); - paramSplinter.tqreplace( "%td", ( TQString::number(item->fileListItem->tags->disc) != "" ) ? TQString::number(item->fileListItem->tags->disc) : "0" ); - paramSplinter.tqreplace( "%tg", ( item->fileListItem->tags->genre != "" ) ? item->fileListItem->tags->genre : i18n("Unknown") ); - paramSplinter.tqreplace( "%tn", ( TQString::number(item->fileListItem->tags->track) != "" ) ? TQString::number(item->fileListItem->tags->track) : "0" ); - paramSplinter.tqreplace( "%tp", ( item->fileListItem->tags->composer != "" ) ? item->fileListItem->tags->composer : i18n("Unknown") ); - paramSplinter.tqreplace( "%tt", ( item->fileListItem->tags->title != "" ) ? item->fileListItem->tags->title : i18n("Unknown") ); - paramSplinter.tqreplace( "%ty", ( TQString::number(item->fileListItem->tags->year) != "" ) ? TQString::number(item->fileListItem->tags->year) : "0" ); + paramSplinter.replace( "%ta", ( item->fileListItem->tags->artist != "" ) ? item->fileListItem->tags->artist : i18n("Unknown") ); + paramSplinter.replace( "%tb", ( item->fileListItem->tags->album != "" ) ? item->fileListItem->tags->album : i18n("Unknown") ); + paramSplinter.replace( "%tc", ( item->fileListItem->tags->comment != "" ) ? item->fileListItem->tags->comment : i18n("Unknown") ); + paramSplinter.replace( "%td", ( TQString::number(item->fileListItem->tags->disc) != "" ) ? TQString::number(item->fileListItem->tags->disc) : "0" ); + paramSplinter.replace( "%tg", ( item->fileListItem->tags->genre != "" ) ? item->fileListItem->tags->genre : i18n("Unknown") ); + paramSplinter.replace( "%tn", ( TQString::number(item->fileListItem->tags->track) != "" ) ? TQString::number(item->fileListItem->tags->track) : "0" ); + paramSplinter.replace( "%tp", ( item->fileListItem->tags->composer != "" ) ? item->fileListItem->tags->composer : i18n("Unknown") ); + paramSplinter.replace( "%tt", ( item->fileListItem->tags->title != "" ) ? item->fileListItem->tags->title : i18n("Unknown") ); + paramSplinter.replace( "%ty", ( TQString::number(item->fileListItem->tags->year) != "" ) ? TQString::number(item->fileListItem->tags->year) : "0" ); } if( paramSplinter != "" && paramSplinter != " " ) *(item->convertProcess) << paramSplinter; // NOTE fixes wavpack encoding } - param.tqreplace( "%i", "\""+inputFile+"\"" ); - param.tqreplace( "%o", "\""+item->tempOutFile->name()+"\"" ); - param.tqreplace( "%c", sStrength ); - param.tqreplace( "%b", sBitrate ); - param.tqreplace( "%q", sQuality ); - param.tqreplace( "%m", sMinBitrate ); - param.tqreplace( "%M", sMaxBitrate ); - param.tqreplace( "%s", sSamplingRate ); + param.replace( "%i", "\""+inputFile+"\"" ); + param.replace( "%o", "\""+item->tempOutFile->name()+"\"" ); + param.replace( "%c", sStrength ); + param.replace( "%b", sBitrate ); + param.replace( "%q", sQuality ); + param.replace( "%m", sMinBitrate ); + param.replace( "%M", sMaxBitrate ); + param.replace( "%s", sSamplingRate ); if( item->fileListItem->tags ) { - param.tqreplace( "%ta", "\""+item->fileListItem->tags->artist+"\"" ); - param.tqreplace( "%tb", "\""+item->fileListItem->tags->album+"\"" ); - param.tqreplace( "%tc", "\""+item->fileListItem->tags->comment+"\"" ); - param.tqreplace( "%td", TQString::number(item->fileListItem->tags->disc) ); - param.tqreplace( "%tg", "\""+item->fileListItem->tags->genre+"\"" ); - param.tqreplace( "%tn", TQString::number(item->fileListItem->tags->track) ); - param.tqreplace( "%tp", "\""+item->fileListItem->tags->composer+"\"" ); - param.tqreplace( "%tt", "\""+item->fileListItem->tags->title+"\"" ); - param.tqreplace( "%ty", TQString::number(item->fileListItem->tags->year) ); + param.replace( "%ta", "\""+item->fileListItem->tags->artist+"\"" ); + param.replace( "%tb", "\""+item->fileListItem->tags->album+"\"" ); + param.replace( "%tc", "\""+item->fileListItem->tags->comment+"\"" ); + param.replace( "%td", TQString::number(item->fileListItem->tags->disc) ); + param.replace( "%tg", "\""+item->fileListItem->tags->genre+"\"" ); + param.replace( "%tn", TQString::number(item->fileListItem->tags->track) ); + param.replace( "%tp", "\""+item->fileListItem->tags->composer+"\"" ); + param.replace( "%tt", "\""+item->fileListItem->tags->title+"\"" ); + param.replace( "%ty", TQString::number(item->fileListItem->tags->year) ); } logger->log( item->logID, param ); @@ -616,7 +616,7 @@ void Convert::put( ConvertItem* item ) else src = item->tempWavFile->name(); item->fileListItem->setText( fileList->columnByName(i18n("State")), i18n("Moving file")+"... 00 %" ); - item->outputFilePathName = OutputDirectory::makePath( OutputDirectory::uniqueFileName(OutputDirectory::calcPath(item->fileListItem,config)) ).tqreplace("%2f","%252f"); + item->outputFilePathName = OutputDirectory::makePath( OutputDirectory::uniqueFileName(OutputDirectory::calcPath(item->fileListItem,config)) ).replace("%2f","%252f"); KURL source( src ); KURL destination( item->outputFilePathName ); @@ -651,7 +651,7 @@ void Convert::putCorrection( ConvertItem* item ) TQString src = item->correctionOutFile; - TQString dest = OutputDirectory::makePath( OutputDirectory::calcPath(item->fileListItem,config,item->correctionOutputExtension) ).tqreplace("%2f","%252f"); + TQString dest = OutputDirectory::makePath( OutputDirectory::calcPath(item->fileListItem,config,item->correctionOutputExtension) ).replace("%2f","%252f"); KURL source( src ); // KURL destination( dest ); @@ -934,10 +934,10 @@ void Convert::processOutput( KProcess* proc, char* data, int ) if( (*item)->convertProcess == proc ) { TQString log_data = data; -/* log_data.tqreplace("\n","\\n"); - log_data.tqreplace("\t","\\t"); - log_data.tqreplace("\r","\\r"); - log_data.tqreplace("\b","\\b");*/ +/* log_data.replace("\n","\\n"); + log_data.replace("\t","\\t"); + log_data.replace("\r","\\r"); + log_data.replace("\b","\\b");*/ logger->log( (*item)->logID, " " + i18n("Output") + ": " + log_data ); //if( (*item)->readOutputTimer.elapsed() < /*config->pauseTime*/ 100 ) return; // TODO use config value @@ -951,26 +951,26 @@ void Convert::processOutput( KProcess* proc, char* data, int ) // TODO null pointer check TQString outputPattern = plugin->dec.output; - //outputPattern.tqreplace( "%i", "%p" ); // for compatibility with old plugins + //outputPattern.replace( "%i", "%p" ); // for compatibility with old plugins - if( outputPattern.tqfind("%p") != -1 ) { - outputPattern.tqreplace( "%p", "%i" ); + if( outputPattern.find("%p") != -1 ) { + outputPattern.replace( "%p", "%i" ); sscanf( data, outputPattern, &iPercent ); } - else if( outputPattern.tqfind("%t") != -1 ) { - outputPattern.tqreplace( "%t", "%i" ); + else if( outputPattern.find("%t") != -1 ) { + outputPattern.replace( "%t", "%i" ); sscanf( data, outputPattern, &iTime ); iPercent = iTime * 100 / (*item)->fileListItem->time; } - else if( outputPattern.tqfind("%0") != -1 && outputPattern.tqfind("%1") != -1 ) { - if( outputPattern.tqfind("%0") < outputPattern.tqfind("%1") ) { - outputPattern.tqreplace( "%0", "%i" ); - outputPattern.tqreplace( "%1", "%i" ); + else if( outputPattern.find("%0") != -1 && outputPattern.find("%1") != -1 ) { + if( outputPattern.find("%0") < outputPattern.find("%1") ) { + outputPattern.replace( "%0", "%i" ); + outputPattern.replace( "%1", "%i" ); sscanf( data, outputPattern, &iPos, &iNum ); } else { - outputPattern.tqreplace( "%0", "%i" ); - outputPattern.tqreplace( "%1", "%i" ); + outputPattern.replace( "%0", "%i" ); + outputPattern.replace( "%1", "%i" ); sscanf( data, outputPattern, &iNum, &iPos ); } if( iPos != 0 && iNum != 0 ) iPercent = iPos * 100 / iNum; @@ -996,26 +996,26 @@ void Convert::processOutput( KProcess* proc, char* data, int ) else if( (*item)->fileListItem->options.encodingOptions.sQualityMode == i18n("Bitrate") && (*item)->fileListItem->options.encodingOptions.sBitrateMode == "cbr" ) outputPattern = plugin->enc.lossy.bitrate.cbr.output; else if( (*item)->fileListItem->options.encodingOptions.sQualityMode == i18n("Bitrate") && (*item)->fileListItem->options.encodingOptions.sBitrateMode == "abr" ) outputPattern = plugin->enc.lossy.bitrate.abr.output; - //outputPattern.tqreplace( "%i", "%p" ); // for compatibility with old plugins + //outputPattern.replace( "%i", "%p" ); // for compatibility with old plugins - if( outputPattern.tqfind("%p") != -1 ) { - outputPattern.tqreplace( "%p", "%i" ); + if( outputPattern.find("%p") != -1 ) { + outputPattern.replace( "%p", "%i" ); sscanf( data, outputPattern, &iPercent ); } - else if( outputPattern.tqfind("%t") != -1 ) { - outputPattern.tqreplace( "%t", "%i" ); + else if( outputPattern.find("%t") != -1 ) { + outputPattern.replace( "%t", "%i" ); sscanf( data, outputPattern, &iTime ); iPercent = iTime * 100 / (*item)->fileListItem->time; } - else if( outputPattern.tqfind("%0") != -1 && outputPattern.tqfind("%1") != -1 ) { - if( outputPattern.tqfind("%0") < outputPattern.tqfind("%1") ) { - outputPattern.tqreplace( "%0", "%i" ); - outputPattern.tqreplace( "%1", "%i" ); + else if( outputPattern.find("%0") != -1 && outputPattern.find("%1") != -1 ) { + if( outputPattern.find("%0") < outputPattern.find("%1") ) { + outputPattern.replace( "%0", "%i" ); + outputPattern.replace( "%1", "%i" ); sscanf( data, outputPattern, &iPos, &iNum ); } else { - outputPattern.tqreplace( "%0", "%i" ); - outputPattern.tqreplace( "%1", "%i" ); + outputPattern.replace( "%0", "%i" ); + outputPattern.replace( "%1", "%i" ); sscanf( data, outputPattern, &iNum, &iPos ); } if( iPos != 0 && iNum != 0 ) iPercent = iPos * 100 / iNum; @@ -1038,27 +1038,27 @@ void Convert::processOutput( KProcess* proc, char* data, int ) TQString outputPattern; if( (*item)->fileListItem->track != 0 ) outputPattern = plugin->rip.output; else outputPattern = plugin->rip.full_disc.output; - //outputPattern.tqreplace( "%i", "%p" ); // for compatibility with old plugins + //outputPattern.replace( "%i", "%p" ); // for compatibility with old plugins - if( outputPattern.tqfind("%p") != -1 || outputPattern.tqfind("%a") != -1 ) { - outputPattern.tqreplace( "%p", "%i" ); - outputPattern.tqreplace( "%a", "%i" ); + if( outputPattern.find("%p") != -1 || outputPattern.find("%a") != -1 ) { + outputPattern.replace( "%p", "%i" ); + outputPattern.replace( "%a", "%i" ); sscanf( data, outputPattern, &iPercent ); } - else if( outputPattern.tqfind("%t") != -1 ) { - outputPattern.tqreplace( "%t", "%i" ); + else if( outputPattern.find("%t") != -1 ) { + outputPattern.replace( "%t", "%i" ); sscanf( data, outputPattern, &iTime ); iPercent = iTime * 100 / (*item)->fileListItem->time; } - else if( outputPattern.tqfind("%0") != -1 && outputPattern.tqfind("%1") != -1 ) { - if( outputPattern.tqfind("%0") < outputPattern.tqfind("%1") ) { - outputPattern.tqreplace( "%0", "%i" ); - outputPattern.tqreplace( "%1", "%i" ); + else if( outputPattern.find("%0") != -1 && outputPattern.find("%1") != -1 ) { + if( outputPattern.find("%0") < outputPattern.find("%1") ) { + outputPattern.replace( "%0", "%i" ); + outputPattern.replace( "%1", "%i" ); sscanf( data, outputPattern, &iPos, &iNum ); } else { - outputPattern.tqreplace( "%0", "%i" ); - outputPattern.tqreplace( "%1", "%i" ); + outputPattern.replace( "%0", "%i" ); + outputPattern.replace( "%1", "%i" ); sscanf( data, outputPattern, &iNum, &iPos ); } if( iPos != 0 && iNum != 0 ) iPercent = iPos * 100 / iNum; @@ -1068,7 +1068,7 @@ void Convert::processOutput( KProcess* proc, char* data, int ) { // TODO guess progress, when no signal is received (*item)->lastOutputTimer.start(); - if( (*item)->fileListItem->track == 0 && plugin->rip.full_disc.output.tqfind("%a") != -1 ) { + if( (*item)->fileListItem->track == 0 && plugin->rip.full_disc.output.find("%a") != -1 ) { if( iPercent < (*item)->lastPercent ) (*item)->track++; (*item)->lastPercent = iPercent; (*item)->percent = (*item)->track * 100 / (*item)->tracks + iPercent / (*item)->tracks; @@ -1469,9 +1469,9 @@ void Convert::remove( ConvertItem* item, int state ) if( item->fileListItem->notify != "" ) { TQString command = item->fileListItem->notify; - command.tqreplace( "%u", item->fileListItem->url ); - command.tqreplace( "%i", item->fileListItem->options.filePathName.tqreplace(" ","%20") ); - command.tqreplace( "%o", item->outputFilePathName.tqreplace(" ","%20") ); + command.replace( "%u", item->fileListItem->url ); + command.replace( "%i", item->fileListItem->options.filePathName.replace(" ","%20") ); + command.replace( "%o", item->outputFilePathName.replace(" ","%20") ); logger->log( item->logID, " "+i18n("Executing command: \"%1\"").tqarg(command) ); notify.clearArguments(); TQString paramSplinter; @@ -1481,9 +1481,9 @@ void Convert::remove( ConvertItem* item, int state ) for( TQStringList::Iterator it = params.begin(); it != params.end(); ++it ) { paramSplinter = *it; - paramSplinter.tqreplace( "%u", item->fileListItem->url ); - paramSplinter.tqreplace( "%i", item->fileListItem->options.filePathName ); - paramSplinter.tqreplace( "%o", item->outputFilePathName ); + paramSplinter.replace( "%u", item->fileListItem->url ); + paramSplinter.replace( "%i", item->fileListItem->options.filePathName ); + paramSplinter.replace( "%o", item->outputFilePathName ); notify << paramSplinter; } notify.start( KProcess::DontCare ); |