summaryrefslogtreecommitdiffstats
path: root/src/convert.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2023-11-13 18:42:43 +0900
committerMichele Calgaro <[email protected]>2023-11-14 20:57:09 +0900
commit802b45c5566c3916e46250060ecef332f055fc26 (patch)
tree1bd49a5d76709e620040d6474dff725d1f8fbbc2 /src/convert.cpp
parent300613eef3cbb63f040fcbced2e03570791d16f3 (diff)
downloadsoundkonverter-802b45c5566c3916e46250060ecef332f055fc26.tar.gz
soundkonverter-802b45c5566c3916e46250060ecef332f055fc26.zip
cmake conversion
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'src/convert.cpp')
-rw-r--r--src/convert.cpp45
1 files changed, 24 insertions, 21 deletions
diff --git a/src/convert.cpp b/src/convert.cpp
index 204fb17..f86d31b 100644
--- a/src/convert.cpp
+++ b/src/convert.cpp
@@ -177,11 +177,13 @@ void Convert::rip( ConvertItem* item )
TQString src;
if( item->fileListItem->track != 0 ) {
// TODO does it work with cds with less than 10 tracks?
- src.sprintf( "audiocd:/Wav/Track %02i.wav?device=" + item->fileListItem->device + "&fileNameTemplate=Track %%{number}", item->fileListItem->track );
+ src = TQString("audiocd:/Wav/Track %1.wav?device=%2&fileNameTemplate=Track %%{number}").
+ arg(TQString::number(item->fileListItem->track).rightJustify(2, '0')).
+ arg(item->fileListItem->device);
}
else {
// FIXME implement ripping of full cds
- src = "audiocd:/Full CD/Full CD.wav?device=" + item->fileListItem->device + "&albumTemplate=Full CD";
+ src = TQString("audiocd:/Full CD/Full CD.wav?device=%1&albumTemplate=Full CD").arg(item->fileListItem->device);
item->tracks = 1;
}
KURL source( src );
@@ -206,15 +208,15 @@ void Convert::rip( ConvertItem* item )
item->convertProcess->clearArguments();
param = TQString();
- if( plugin->rip.param ) param.append( " " + plugin->rip.param );
- if( plugin->rip.device ) param.append( " " + plugin->rip.device );
- if( plugin->rip.overwrite ) param.append( " " + plugin->rip.overwrite );
+ if( !plugin->rip.param.isEmpty() ) param.append( " " + plugin->rip.param );
+ if( !plugin->rip.device.isEmpty() ) param.append( " " + plugin->rip.device );
+ if( !plugin->rip.overwrite.isEmpty() ) param.append( " " + plugin->rip.overwrite );
if( item->fileListItem->track != 0 ) {
- if( plugin->rip.track ) param.append( " " + plugin->rip.track );
+ if( !plugin->rip.track.isEmpty() ) param.append( " " + plugin->rip.track );
}
else {
- if( plugin->rip.full_disc.param ) param.append( " " + plugin->rip.full_disc.param );
+ if( !plugin->rip.full_disc.param.isEmpty() ) param.append( " " + plugin->rip.full_disc.param );
item->tracks = cdManager->getTrackCount( item->fileListItem->device );
item->track = 0;
}
@@ -464,10 +466,10 @@ void Convert::encode( ConvertItem* item )
}
}
- if( item->fileListItem->options.encodingOptions.replaygain.bEnabled && plugin->enc.replaygain.enabled && plugin->enc.replaygain.use && formatItem->internalReplayGain ) {
+ if( item->fileListItem->options.encodingOptions.replaygain.bEnabled && plugin->enc.replaygain.enabled && !plugin->enc.replaygain.use.isEmpty() && formatItem->internalReplayGain ) {
param.append( " " + plugin->enc.replaygain.use );
}
- else if( plugin->enc.replaygain.enabled && plugin->enc.replaygain.avoid ) {
+ else if( plugin->enc.replaygain.enabled && !plugin->enc.replaygain.avoid.isEmpty() ) {
param.append( " " + plugin->enc.replaygain.avoid );
}
@@ -955,23 +957,23 @@ void Convert::processOutput( TDEProcess* proc, char* data, int )
if( outputPattern.find("%p") != -1 ) {
outputPattern.replace( "%p", "%i" );
- sscanf( data, outputPattern, &iPercent );
+ sscanf( data, outputPattern.local8Bit().data(), &iPercent );
}
else if( outputPattern.find("%t") != -1 ) {
outputPattern.replace( "%t", "%i" );
- sscanf( data, outputPattern, &iTime );
+ sscanf( data, outputPattern.local8Bit().data(), &iTime );
iPercent = iTime * 100 / (*item)->fileListItem->time;
}
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 );
+ sscanf( data, outputPattern.local8Bit().data(), &iPos, &iNum );
}
else {
outputPattern.replace( "%0", "%i" );
outputPattern.replace( "%1", "%i" );
- sscanf( data, outputPattern, &iNum, &iPos );
+ sscanf( data, outputPattern.local8Bit().data(), &iNum, &iPos );
}
if( iPos != 0 && iNum != 0 ) iPercent = iPos * 100 / iNum;
}
@@ -1000,23 +1002,23 @@ void Convert::processOutput( TDEProcess* proc, char* data, int )
if( outputPattern.find("%p") != -1 ) {
outputPattern.replace( "%p", "%i" );
- sscanf( data, outputPattern, &iPercent );
+ sscanf( data, outputPattern.local8Bit().data(), &iPercent );
}
else if( outputPattern.find("%t") != -1 ) {
outputPattern.replace( "%t", "%i" );
- sscanf( data, outputPattern, &iTime );
+ sscanf( data, outputPattern.local8Bit().data(), &iTime );
iPercent = iTime * 100 / (*item)->fileListItem->time;
}
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 );
+ sscanf( data, outputPattern.local8Bit().data(), &iPos, &iNum );
}
else {
outputPattern.replace( "%0", "%i" );
outputPattern.replace( "%1", "%i" );
- sscanf( data, outputPattern, &iNum, &iPos );
+ sscanf( data, outputPattern.local8Bit().data(), &iNum, &iPos );
}
if( iPos != 0 && iNum != 0 ) iPercent = iPos * 100 / iNum;
}
@@ -1043,23 +1045,23 @@ void Convert::processOutput( TDEProcess* proc, char* data, int )
if( outputPattern.find("%p") != -1 || outputPattern.find("%a") != -1 ) {
outputPattern.replace( "%p", "%i" );
outputPattern.replace( "%a", "%i" );
- sscanf( data, outputPattern, &iPercent );
+ sscanf( data, outputPattern.local8Bit().data(), &iPercent );
}
else if( outputPattern.find("%t") != -1 ) {
outputPattern.replace( "%t", "%i" );
- sscanf( data, outputPattern, &iTime );
+ sscanf( data, outputPattern.local8Bit().data(), &iTime );
iPercent = iTime * 100 / (*item)->fileListItem->time;
}
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 );
+ sscanf( data, outputPattern.local8Bit().data(), &iPos, &iNum );
}
else {
outputPattern.replace( "%0", "%i" );
outputPattern.replace( "%1", "%i" );
- sscanf( data, outputPattern, &iNum, &iPos );
+ sscanf( data, outputPattern.local8Bit().data(), &iNum, &iPos );
}
if( iPos != 0 && iNum != 0 ) iPercent = iPos * 100 / iNum;
}
@@ -1613,3 +1615,4 @@ void Convert::updateProgressIndicator()
// }
+#include "convert.moc"