@ -22,8 +22,8 @@
//#include <kprocess.h>
# include <kstandarddirs.h>
# include < qfile.h>
# include < qtimer.h>
# include < t qfile.h>
# include < t qtimer.h>
ConvertItem : : ConvertItem ( )
{
@ -47,26 +47,26 @@ Convert::Convert( Config* _config, TagEngine* _tagEngine, CDManager* _cdManager,
tagEngine = _tagEngine ;
cdManager = _cdManager ;
fileList = _fileList ;
connect ( fileList , SIGNAL( convertItem ( FileListItem * ) ) ,
this , SLOT( add ( FileListItem * ) )
connect ( fileList , TQT_ SIGNAL( convertItem ( FileListItem * ) ) ,
this , TQT_ SLOT( add ( FileListItem * ) )
) ;
connect ( fileList , SIGNAL( stopItem ( FileListItem * ) ) ,
this , SLOT( stop ( FileListItem * ) )
connect ( fileList , TQT_ SIGNAL( stopItem ( FileListItem * ) ) ,
this , TQT_ SLOT( stop ( FileListItem * ) )
) ;
connect ( this , SIGNAL( finished ( FileListItem * , int ) ) ,
fileList , SLOT( itemFinished ( FileListItem * , int ) )
connect ( this , TQT_ SIGNAL( finished ( FileListItem * , int ) ) ,
fileList , TQT_ SLOT( itemFinished ( FileListItem * , int ) )
) ;
connect ( this , SIGNAL( rippingFinished ( const QString& ) ) ,
fileList , SLOT( rippingFinished ( const QString& ) )
connect ( this , TQT_ SIGNAL( rippingFinished ( const T QString& ) ) ,
fileList , TQT_ SLOT( rippingFinished ( const T QString& ) )
) ;
logger = _logger ;
connect ( this , SIGNAL( finishedProcess ( int , int ) ) ,
logger , SLOT( processCompleted ( int , int ) )
connect ( this , TQT_ SIGNAL( finishedProcess ( int , int ) ) ,
logger , TQT_ SLOT( processCompleted ( int , int ) )
) ;
tUpdateProgressIndicator = new QTimer( this , " tUpdateProgressIndicator " ) ;
connect ( tUpdateProgressIndicator , SIGNAL( timeout ( ) ) ,
this , SLOT( updateProgressIndicator ( ) )
tUpdateProgressIndicator = new T QTimer( this , " tUpdateProgressIndicator " ) ;
connect ( tUpdateProgressIndicator , TQT_ SIGNAL( timeout ( ) ) ,
this , TQT_ SLOT( updateProgressIndicator ( ) )
) ;
}
@ -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 . replace( " ? " , " %3f " ) ) ;
KURL source ( item - > fileListItem - > options . filePathName . tq replace( " ? " , " %3f " ) ) ;
KURL destination ( item - > tempInFile - > name ( ) ) ;
if ( source . isLocalFile ( ) & & destination . isLocalFile ( ) ) {
@ -102,11 +102,11 @@ void Convert::get( ConvertItem* item )
}
else {
item - > moveJob = new KIO : : FileCopyJob ( source , destination , - 1 , false , true , false , false ) ;
connect ( item - > moveJob , SIGNAL( percent ( KIO : : Job * , unsigned long ) ) ,
this , SLOT( moveProgress ( KIO : : Job * , unsigned long ) )
connect ( item - > moveJob , TQT_ SIGNAL( percent ( KIO : : Job * , unsigned long ) ) ,
this , TQT_ SLOT( moveProgress ( KIO : : Job * , unsigned long ) )
) ;
connect ( item - > moveJob , SIGNAL( result ( KIO : : Job * ) ) ,
this , SLOT( moveFinished ( KIO : : Job * ) )
connect ( item - > moveJob , TQT_ SIGNAL( result ( KIO : : Job * ) ) ,
this , TQT_ SLOT( moveFinished ( KIO : : Job * ) )
) ;
}
}
@ -117,7 +117,7 @@ void Convert::getCorrection( ConvertItem* item )
item - > state = ConvertItem : : get_correction ;
// calculate the name of the correction input file
QFile file ( OutputDirectory : : changeExtension ( item - > fileListItem - > options . filePathName , item - > correctionInputExtension ) ) ;
T QFile file ( OutputDirectory : : changeExtension ( item - > fileListItem - > options . filePathName , item - > correctionInputExtension ) ) ;
if ( ! file . exists ( ) ) {
logger - > log ( item - > logID , " " + i18n ( " Aborting, file does not exist " ) + " ( " + file . name ( ) + " ) " ) ;
executeNextStep ( item ) ;
@ -143,11 +143,11 @@ void Convert::getCorrection( ConvertItem* item )
}
else {
item - > moveJob = new KIO : : FileCopyJob ( source , destination , - 1 , false , true , false , false ) ;
connect ( item - > moveJob , SIGNAL( percent ( KIO : : Job * , unsigned long ) ) ,
this , SLOT( moveProgress ( KIO : : Job * , unsigned long ) )
connect ( item - > moveJob , TQT_ SIGNAL( percent ( KIO : : Job * , unsigned long ) ) ,
this , TQT_ SLOT( moveProgress ( KIO : : Job * , unsigned long ) )
) ;
connect ( item - > moveJob , SIGNAL( result ( KIO : : Job * ) ) ,
this , SLOT( moveFinished ( KIO : : Job * ) )
connect ( item - > moveJob , TQT_ SIGNAL( result ( KIO : : Job * ) ) ,
this , TQT_ SLOT( moveFinished ( KIO : : Job * ) )
) ;
}
}
@ -158,15 +158,15 @@ void Convert::rip( ConvertItem* item )
item - > state = ConvertItem : : rip ;
/** kaudiocreator
QString wavFile ;
QString args = job - > device ;
T QString wavFile ;
T QString args = job - > device ;
if ( ! args . isEmpty ( ) )
args = QString( " ?device=%1 " ) . arg( args ) ;
args = T QString( " ?device=%1 " ) . tq arg( args ) ;
args = args + " &fileNameTemplate=Track %{number} " ;
if ( job - > track < 10 )
wavFile = QString( " audiocd:/Wav/Track 0%1.wav%2 " ) . arg( job - > track ) . arg( args ) ;
wavFile = T QString( " audiocd:/Wav/Track 0%1.wav%2 " ) . tq arg( job - > track ) . tq arg( args ) ;
else
wavFile = QString( " audiocd:/Wav/Track %1.wav%2 " ) . arg( job - > track ) . arg( args ) ;
wavFile = T QString( " audiocd:/Wav/Track %1.wav%2 " ) . tq arg( job - > track ) . tq arg( args ) ;
*/
RipperPlugin * plugin = config - > getCurrentRipper ( ) ;
@ -174,7 +174,7 @@ void Convert::rip( ConvertItem* item )
if ( plugin = = 0 ) {
// NOTE process devices like '/dev/cdrom' - seems to be done
// TODO implement process priority (nice level)
QString src ;
T QString 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 ) ;
@ -191,21 +191,21 @@ void Convert::rip( ConvertItem* item )
item - > fileListItem - > ripping = true ;
item - > moveJob = new KIO : : FileCopyJob ( source , dest , - 1 , false , true , false , false ) ;
connect ( item - > moveJob , SIGNAL( percent ( KIO : : Job * , unsigned long ) ) ,
this , SLOT( moveProgress ( KIO : : Job * , unsigned long ) )
connect ( item - > moveJob , TQT_ SIGNAL( percent ( KIO : : Job * , unsigned long ) ) ,
this , TQT_ SLOT( moveProgress ( KIO : : Job * , unsigned long ) )
) ;
connect ( item - > moveJob , SIGNAL( result ( KIO : : Job * ) ) ,
this , SLOT( moveFinished ( KIO : : Job * ) )
connect ( item - > moveJob , TQT_ SIGNAL( result ( KIO : : Job * ) ) ,
this , TQT_ SLOT( moveFinished ( KIO : : Job * ) )
) ;
}
else {
QStringList params ;
QString param , paramSplinter ;
T QStringList params ;
T QString param , paramSplinter ;
item - > convertProcess - > clearArguments ( ) ;
param = QString: : null ;
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 ) ;
@ -219,37 +219,37 @@ void Convert::rip( ConvertItem* item )
item - > track = 0 ;
}
// if( plugin->rip.out_file. find("%p") != -1 ) {
// QString t_str = plugin->rip.out_file;
// t_str. replace( "%p", param );
// if( plugin->rip.out_file. tq find("%p") != -1 ) {
// T QString t_str = plugin->rip.out_file;
// t_str. tq replace( "%p", param );
// param = plugin->rip.bin + " " + t_str;
// }
// else {
// param = plugin->rip.bin + param + " " + plugin->rip.out_file;
// }
QString t_str = plugin - > rip . out_file ;
t_str . replace( " %p " , param ) ;
T QString t_str = plugin - > rip . out_file ;
t_str . tq replace( " %p " , param ) ;
param = config - > binaries [ plugin - > rip . bin ] + " " + t_str ;
param . simplifyWhiteSpace ( ) ;
params = QStringList: : split ( ' ' , param ) ;
params = T QStringList: : split ( ' ' , param ) ;
for ( QStringList: : Iterator it = params . begin ( ) ; it ! = params . end ( ) ; + + it )
for ( T QStringList: : Iterator it = params . begin ( ) ; it ! = params . end ( ) ; + + it )
{
paramSplinter = * it ;
paramSplinter . replace( " %d " , item - > fileListItem - > device ) ;
paramSplinter . replace( " %t " , QString( ) . sprintf ( " %i " , item - > fileListItem - > track ) ) ;
paramSplinter . replace( " %n " , QString( ) . sprintf ( " %i " , cdManager - > getTrackCount ( item - > fileListItem - > device ) ) ) ;
paramSplinter . replace( " %o " , item - > tempWavFile - > name ( ) ) ;
paramSplinter . tq replace( " %d " , item - > fileListItem - > device ) ;
paramSplinter . tq replace( " %t " , T QString( ) . sprintf ( " %i " , item - > fileListItem - > track ) ) ;
paramSplinter . tq replace( " %n " , T QString( ) . sprintf ( " %i " , cdManager - > getTrackCount ( item - > fileListItem - > device ) ) ) ;
paramSplinter . tq replace( " %o " , item - > tempWavFile - > name ( ) ) ;
* ( item - > convertProcess ) < < paramSplinter ;
}
param . replace( " %d " , item - > fileListItem - > device ) ;
param . replace( " %t " , QString( ) . sprintf ( " %i " , item - > fileListItem - > track ) ) ;
param . replace( " %n " , QString( ) . sprintf ( " %i " , cdManager - > getTrackCount ( item - > fileListItem - > device ) ) ) ;
param . replace( " %o " , " \" " + item - > tempWavFile - > name ( ) + " \" " ) ;
param . tq replace( " %d " , item - > fileListItem - > device ) ;
param . tq replace( " %t " , T QString( ) . sprintf ( " %i " , item - > fileListItem - > track ) ) ;
param . tq replace( " %n " , T QString( ) . sprintf ( " %i " , cdManager - > getTrackCount ( item - > fileListItem - > device ) ) ) ;
param . tq replace( " %o " , " \" " + item - > tempWavFile - > name ( ) + " \" " ) ;
logger - > log ( item - > logID , param ) ;
//kdDebug() << " Executing: `" << param << "'" << endl;
@ -270,8 +270,8 @@ void Convert::decode( ConvertItem* item )
logger - > log ( item - > logID , i18n ( " Decoding " ) ) ;
item - > state = ConvertItem : : decode ;
QStringList params ;
QString param , paramSplinter ;
T QStringList params ;
T QString param , paramSplinter ;
item - > convertProcess - > clearArguments ( ) ;
@ -285,24 +285,24 @@ void Convert::decode( ConvertItem* item )
if ( ! plugin - > dec . param . isEmpty ( ) ) param . append ( " " + plugin - > dec . param ) ;
if ( ! plugin - > dec . overwrite . isEmpty ( ) ) param . append ( " " + plugin - > dec . overwrite ) ;
QString t_str = plugin - > dec . in_out_files ;
t_str . replace( " %p " , param ) ;
T QString t_str = plugin - > dec . in_out_files ;
t_str . tq replace( " %p " , param ) ;
param = config - > binaries [ plugin - > dec . bin ] + " " + t_str ;
param = param . simplifyWhiteSpace ( ) ;
params = QStringList: : split ( ' ' , param ) ;
params = T QStringList: : split ( ' ' , param ) ;
for ( QStringList: : Iterator it = params . begin ( ) ; it ! = params . end ( ) ; + + it )
for ( T QStringList: : Iterator it = params . begin ( ) ; it ! = params . end ( ) ; + + it )
{
paramSplinter = * it ;
paramSplinter . replace( " %i " , item - > tempInFile - > name ( ) ) ;
paramSplinter . replace( " %o " , item - > tempWavFile - > name ( ) ) ;
paramSplinter . tq replace( " %i " , item - > tempInFile - > name ( ) ) ;
paramSplinter . tq replace( " %o " , item - > tempWavFile - > name ( ) ) ;
* ( item - > convertProcess ) < < paramSplinter ;
}
param . replace( " %i " , " \" " + item - > tempInFile - > name ( ) + " \" " ) ;
param . replace( " %o " , " \" " + item - > tempWavFile - > name ( ) + " \" " ) ;
param . tq replace( " %i " , " \" " + item - > tempInFile - > name ( ) + " \" " ) ;
param . tq replace( " %o " , " \" " + item - > tempWavFile - > name ( ) + " \" " ) ;
//item->log = param;
logger - > log ( item - > logID , param ) ;
@ -321,12 +321,12 @@ void Convert::encode( ConvertItem* item )
{
// TODO test quality profiles (never done)
QString sStrength ;
QString sBitrate ;
QString sQuality ;
QString sMinBitrate ;
QString sMaxBitrate ;
QString sSamplingRate ;
T QString sStrength ;
T QString sBitrate ;
T QString sQuality ;
T QString sMinBitrate ;
T QString sMaxBitrate ;
T QString sSamplingRate ;
int t_int ;
float t_float ;
@ -334,8 +334,8 @@ void Convert::encode( ConvertItem* item )
logger - > log ( item - > logID , i18n ( " Encoding " ) ) ;
item - > state = ConvertItem : : encode ;
QStringList params ;
QString param , paramSplinter ;
T QStringList params ;
T QString param , paramSplinter ;
item - > convertProcess - > clearArguments ( ) ;
@ -366,20 +366,20 @@ void Convert::encode( ConvertItem* item )
if ( plugin - > enc . strength . profiles . empty ( ) ) {
if ( plugin - > enc . strength . step < 1 ) {
if ( plugin - > enc . strength . range_max > = plugin - > enc . strength . range_min )
sStrength = QString: : number ( compressionLevel * plugin - > enc . strength . step ) ;
sStrength = T QString: : number ( compressionLevel * plugin - > enc . strength . step ) ;
else
sStrength = QString: : number ( plugin - > enc . strength . range_min - compressionLevel * plugin - > enc . strength . step ) ;
sStrength = T QString: : number ( plugin - > enc . strength . range_min - compressionLevel * plugin - > enc . strength . step ) ;
}
else {
if ( plugin - > enc . strength . range_max > = plugin - > enc . strength . range_min )
sStrength = QString: : number ( int ( compressionLevel * plugin - > enc . strength . step ) ) ;
sStrength = T QString: : number ( int ( compressionLevel * plugin - > enc . strength . step ) ) ;
else
sStrength = QString: : number ( int ( plugin - > enc . strength . range_min - compressionLevel * plugin - > enc . strength . step ) ) ;
sStrength = T QString: : number ( int ( plugin - > enc . strength . range_min - compressionLevel * plugin - > enc . strength . step ) ) ;
}
if ( plugin - > enc . strength . separator ! = ' . ' ) sStrength . replace( QChar( ' . ' ) , plugin - > enc . strength . separator ) ;
if ( plugin - > enc . strength . separator ! = ' . ' ) sStrength . tq replace( T QChar( ' . ' ) , plugin - > enc . strength . separator ) ;
}
else {
QStringList: : Iterator it = plugin - > enc . strength . profiles . at ( compressionLevel ) ;
T QStringList: : Iterator it = plugin - > enc . strength . profiles . at ( compressionLevel ) ;
sStrength = * it ;
}
}
@ -387,16 +387,16 @@ void Convert::encode( ConvertItem* item )
if ( item - > fileListItem - > options . encodingOptions . sQualityMode = = i18n ( " Bitrate " ) ) {
if ( item - > fileListItem - > options . encodingOptions . sBitrateMode = = " cbr " & & plugin - > enc . lossy . bitrate . cbr . enabled ) {
param . append ( " " + plugin - > enc . lossy . bitrate . cbr . param ) ;
sBitrate = QString: : number ( item - > fileListItem - > options . encodingOptions . iQuality ) ;
sBitrate = T QString: : number ( item - > fileListItem - > options . encodingOptions . iQuality ) ;
}
else if ( item - > fileListItem - > options . encodingOptions . sBitrateMode = = " abr " & & plugin - > enc . lossy . bitrate . abr . enabled ) {
param . append ( " " + plugin - > enc . lossy . bitrate . abr . param ) ;
sBitrate = QString: : number ( item - > fileListItem - > options . encodingOptions . iQuality ) ;
sBitrate = T QString: : number ( item - > fileListItem - > options . encodingOptions . iQuality ) ;
if ( item - > fileListItem - > options . encodingOptions . bBitrateRange & & plugin - > enc . lossy . bitrate . abr . bitrate_range . enabled ) {
param . append ( " " + plugin - > enc . lossy . bitrate . abr . bitrate_range . param_min ) ;
sMinBitrate = QString: : number ( item - > fileListItem - > options . encodingOptions . iMinBitrate ) ;
sMinBitrate = T QString: : number ( item - > fileListItem - > options . encodingOptions . iMinBitrate ) ;
param . append ( " " + plugin - > enc . lossy . bitrate . abr . bitrate_range . param_max ) ;
sMaxBitrate = QString: : number ( item - > fileListItem - > options . encodingOptions . iMaxBitrate ) ;
sMaxBitrate = T QString: : number ( item - > fileListItem - > options . encodingOptions . iMaxBitrate ) ;
}
}
}
@ -409,8 +409,8 @@ void Convert::encode( ConvertItem* item )
else
t_float = ( ( 100.0f - ( float ) item - > fileListItem - > options . encodingOptions . iQuality ) * ( plugin - > enc . lossy . quality . range_min - plugin - > enc . lossy . quality . range_max ) / 100 ) + plugin - > enc . lossy . quality . range_max ;
//t_float -= t_float%plugin->enc.quality.step;
//sQuality = QString().sprintf( "%.2f", t_float );
sQuality = QString: : number ( t_float ) ;
//sQuality = T QString().sprintf( "%.2f", t_float );
sQuality = T QString: : number ( t_float ) ;
}
else {
if ( plugin - > enc . lossy . quality . range_max > = plugin - > enc . lossy . quality . range_min )
@ -418,13 +418,13 @@ void Convert::encode( ConvertItem* item )
else
t_int = ( ( 100 - item - > fileListItem - > options . encodingOptions . iQuality ) * ( int ) ( plugin - > enc . lossy . quality . range_min - plugin - > enc . lossy . quality . range_max ) / 100 ) + ( int ) plugin - > enc . lossy . quality . range_max ;
//t_int -= t_int%plugin->enc.quality.step;
sQuality = QString: : number ( t_int ) ;
sQuality = T QString: : number ( t_int ) ;
}
if ( plugin - > enc . bin = = " oggenc " ) sQuality . replace( QChar( ' . ' ) , KGlobal : : locale ( ) - > decimalSymbol ( ) ) ; // HACK make oggenc usable with all langauges
else if ( plugin - > enc . lossy . quality . separator ! = ' . ' ) sQuality . replace( QChar( ' . ' ) , plugin - > enc . lossy . quality . separator ) ;
if ( plugin - > enc . bin = = " oggenc " ) sQuality . tq replace( T QChar( ' . ' ) , KGlobal : : locale ( ) - > decimalSymbol ( ) ) ; // HACK make oggenc usable with all langauges
else if ( plugin - > enc . lossy . quality . separator ! = ' . ' ) sQuality . tq replace( T QChar( ' . ' ) , plugin - > enc . lossy . quality . separator ) ;
}
else {
QStringList: : Iterator it = plugin - > enc . lossy . quality . profiles . at ( rint ( item - > fileListItem - > options . encodingOptions . iQuality * plugin - > enc . lossy . quality . range_max / 100 ) ) ;
T QStringList: : Iterator it = plugin - > enc . lossy . quality . profiles . at ( rint ( item - > fileListItem - > options . encodingOptions . iQuality * plugin - > enc . lossy . quality . range_max / 100 ) ) ;
sQuality = * it ;
}
}
@ -433,16 +433,16 @@ void Convert::encode( ConvertItem* item )
}
else if ( item - > fileListItem - > options . encodingOptions . sQualityMode = = i18n ( " Hybrid " ) & & plugin - > enc . hybrid . enabled ) {
param . append ( " " + plugin - > enc . hybrid . param ) ;
sBitrate = QString: : number ( item - > fileListItem - > options . encodingOptions . iQuality ) ;
sBitrate = T QString: : number ( item - > fileListItem - > options . encodingOptions . iQuality ) ;
}
if ( item - > fileListItem - > options . encodingOptions . samplingRate . bEnabled & & plugin - > enc . lossy . samplingrate . enabled ) {
param . append ( " " + plugin - > enc . lossy . samplingrate . param ) ;
if ( plugin - > enc . lossy . samplingrate . unit = = PluginLoaderBase : : Hz ) {
sSamplingRate = QString: : number ( item - > fileListItem - > options . encodingOptions . samplingRate . iSamplingRate ) ;
sSamplingRate = T QString: : number ( item - > fileListItem - > options . encodingOptions . samplingRate . iSamplingRate ) ;
}
else {
sSamplingRate = QString: : number ( ( float ) item - > fileListItem - > options . encodingOptions . samplingRate . iSamplingRate / 1000 ) ;
sSamplingRate = T QString: : number ( ( float ) item - > fileListItem - > options . encodingOptions . samplingRate . iSamplingRate / 1000 ) ;
}
}
@ -485,64 +485,64 @@ void Convert::encode( ConvertItem* item )
if ( ! plugin - > enc . tag . year . isEmpty ( ) & & item - > fileListItem - > tags - > year ! = 0 ) param . append ( " " + plugin - > enc . tag . year ) ;
}
QString sInOutFiles = item - > fileListItem - > options . encodingOptions . sInOutFiles ;
param = sInOutFiles . replace( " %p " , param ) ;
T QString sInOutFiles = item - > fileListItem - > options . encodingOptions . sInOutFiles ;
param = sInOutFiles . tq replace( " %p " , param ) ;
// cosmetic surgery
param = param . simplifyWhiteSpace ( ) ;
params = QStringList: : split ( ' ' , param ) ;
params = T QStringList: : split ( ' ' , param ) ;
QString inputFile ;
T QString inputFile ;
if ( item - > mode & ConvertItem : : decode | | item - > mode & ConvertItem : : rip ) inputFile = item - > tempWavFile - > name ( ) ;
else inputFile = item - > tempInFile - > name ( ) ;
for ( QStringList: : Iterator it = params . begin ( ) ; it ! = params . end ( ) ; + + it )
for ( T QStringList: : Iterator it = params . begin ( ) ; it ! = params . end ( ) ; + + it )
{
paramSplinter = * it ;
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 ) ;
paramSplinter . tq replace( " %i " , inputFile ) ;
paramSplinter . tq replace( " %o " , item - > tempOutFile - > name ( ) ) ;
paramSplinter . tq replace( " %c " , sStrength ) ;
paramSplinter . tq replace( " %b " , sBitrate ) ;
paramSplinter . tq replace( " %q " , sQuality ) ;
paramSplinter . tq replace( " %m " , sMinBitrate ) ;
paramSplinter . tq replace( " %M " , sMaxBitrate ) ;
paramSplinter . tq replace( " %s " , sSamplingRate ) ;
if ( item - > fileListItem - > tags ) {
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 " , ( QString: : number ( item - > fileListItem - > tags - > disc ) ! = " " ) ? QString: : number ( item - > fileListItem - > tags - > disc ) : " 0 " ) ;
paramSplinter . replace( " %tg " , ( item - > fileListItem - > tags - > genre ! = " " ) ? item - > fileListItem - > tags - > genre : i18n ( " Unknown " ) ) ;
paramSplinter . replace( " %tn " , ( QString: : number ( item - > fileListItem - > tags - > track ) ! = " " ) ? QString: : 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 " , ( QString: : number ( item - > fileListItem - > tags - > year ) ! = " " ) ? QString: : number ( item - > fileListItem - > tags - > year ) : " 0 " ) ;
paramSplinter . tq replace( " %ta " , ( item - > fileListItem - > tags - > artist ! = " " ) ? item - > fileListItem - > tags - > artist : i18n ( " Unknown " ) ) ;
paramSplinter . tq replace( " %tb " , ( item - > fileListItem - > tags - > album ! = " " ) ? item - > fileListItem - > tags - > album : i18n ( " Unknown " ) ) ;
paramSplinter . tq replace( " %tc " , ( item - > fileListItem - > tags - > comment ! = " " ) ? item - > fileListItem - > tags - > comment : i18n ( " Unknown " ) ) ;
paramSplinter . tq replace( " %td " , ( T QString: : number ( item - > fileListItem - > tags - > disc ) ! = " " ) ? T QString: : number ( item - > fileListItem - > tags - > disc ) : " 0 " ) ;
paramSplinter . tq replace( " %tg " , ( item - > fileListItem - > tags - > genre ! = " " ) ? item - > fileListItem - > tags - > genre : i18n ( " Unknown " ) ) ;
paramSplinter . tq replace( " %tn " , ( T QString: : number ( item - > fileListItem - > tags - > track ) ! = " " ) ? T QString: : number ( item - > fileListItem - > tags - > track ) : " 0 " ) ;
paramSplinter . tq replace( " %tp " , ( item - > fileListItem - > tags - > composer ! = " " ) ? item - > fileListItem - > tags - > composer : i18n ( " Unknown " ) ) ;
paramSplinter . tq replace( " %tt " , ( item - > fileListItem - > tags - > title ! = " " ) ? item - > fileListItem - > tags - > title : i18n ( " Unknown " ) ) ;
paramSplinter . tq replace( " %ty " , ( T QString: : number ( item - > fileListItem - > tags - > year ) ! = " " ) ? T QString: : number ( item - > fileListItem - > tags - > year ) : " 0 " ) ;
}
if ( paramSplinter ! = " " & & paramSplinter ! = " " ) * ( item - > convertProcess ) < < paramSplinter ; // NOTE fixes wavpack encoding
}
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 ) ;
param . tq replace( " %i " , " \" " + inputFile + " \" " ) ;
param . tq replace( " %o " , " \" " + item - > tempOutFile - > name ( ) + " \" " ) ;
param . tq replace( " %c " , sStrength ) ;
param . tq replace( " %b " , sBitrate ) ;
param . tq replace( " %q " , sQuality ) ;
param . tq replace( " %m " , sMinBitrate ) ;
param . tq replace( " %M " , sMaxBitrate ) ;
param . tq replace( " %s " , sSamplingRate ) ;
if ( item - > fileListItem - > tags ) {
param . replace( " %ta " , " \" " + item - > fileListItem - > tags - > artist + " \" " ) ;
param . replace( " %tb " , " \" " + item - > fileListItem - > tags - > album + " \" " ) ;
param . replace( " %tc " , " \" " + item - > fileListItem - > tags - > comment + " \" " ) ;
param . replace( " %td " , QString: : number ( item - > fileListItem - > tags - > disc ) ) ;
param . replace( " %tg " , " \" " + item - > fileListItem - > tags - > genre + " \" " ) ;
param . replace( " %tn " , QString: : number ( item - > fileListItem - > tags - > track ) ) ;
param . replace( " %tp " , " \" " + item - > fileListItem - > tags - > composer + " \" " ) ;
param . replace( " %tt " , " \" " + item - > fileListItem - > tags - > title + " \" " ) ;
param . replace( " %ty " , QString: : number ( item - > fileListItem - > tags - > year ) ) ;
param . tq replace( " %ta " , " \" " + item - > fileListItem - > tags - > artist + " \" " ) ;
param . tq replace( " %tb " , " \" " + item - > fileListItem - > tags - > album + " \" " ) ;
param . tq replace( " %tc " , " \" " + item - > fileListItem - > tags - > comment + " \" " ) ;
param . tq replace( " %td " , T QString: : number ( item - > fileListItem - > tags - > disc ) ) ;
param . tq replace( " %tg " , " \" " + item - > fileListItem - > tags - > genre + " \" " ) ;
param . tq replace( " %tn " , T QString: : number ( item - > fileListItem - > tags - > track ) ) ;
param . tq replace( " %tp " , " \" " + item - > fileListItem - > tags - > composer + " \" " ) ;
param . tq replace( " %tt " , " \" " + item - > fileListItem - > tags - > title + " \" " ) ;
param . tq replace( " %ty " , T QString: : number ( item - > fileListItem - > tags - > year ) ) ;
}
logger - > log ( item - > logID , param ) ;
@ -611,12 +611,12 @@ void Convert::put( ConvertItem* item )
logger - > log ( item - > logID , i18n ( " Moving file " ) ) ;
item - > state = ConvertItem : : put ;
QString src ;
T QString src ;
if ( item - > mode & ConvertItem : : encode ) src = item - > tempOutFile - > name ( ) ;
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 ) ) ) . replace( " %2f " , " %252f " ) ;
item - > outputFilePathName = OutputDirectory : : makePath ( OutputDirectory : : uniqueFileName ( OutputDirectory : : calcPath ( item - > fileListItem , config ) ) ) . tq replace( " %2f " , " %252f " ) ;
KURL source ( src ) ;
KURL destination ( item - > outputFilePathName ) ;
@ -635,11 +635,11 @@ void Convert::put( ConvertItem* item )
}
else {
item - > moveJob = new KIO : : FileCopyJob ( source , destination , - 1 , false , false , false , false ) ;
connect ( item - > moveJob , SIGNAL( percent ( KIO : : Job * , unsigned long ) ) ,
this , SLOT( moveProgress ( KIO : : Job * , unsigned long ) )
connect ( item - > moveJob , TQT_ SIGNAL( percent ( KIO : : Job * , unsigned long ) ) ,
this , TQT_ SLOT( moveProgress ( KIO : : Job * , unsigned long ) )
) ;
connect ( item - > moveJob , SIGNAL( result ( KIO : : Job * ) ) ,
this , SLOT( moveFinished ( KIO : : Job * ) )
connect ( item - > moveJob , TQT_ SIGNAL( result ( KIO : : Job * ) ) ,
this , TQT_ SLOT( moveFinished ( KIO : : Job * ) )
) ;
}
}
@ -649,9 +649,9 @@ void Convert::putCorrection( ConvertItem* item )
logger - > log ( item - > logID , i18n ( " Moving correction file " ) ) ;
item - > state = ConvertItem : : put_correction ;
QString src = item - > correctionOutFile ;
T QString src = item - > correctionOutFile ;
QString dest = OutputDirectory : : makePath ( OutputDirectory : : calcPath ( item - > fileListItem , config , item - > correctionOutputExtension ) ) . replace( " %2f " , " %252f " ) ;
T QString dest = OutputDirectory : : makePath ( OutputDirectory : : calcPath ( item - > fileListItem , config , item - > correctionOutputExtension ) ) . tq replace( " %2f " , " %252f " ) ;
KURL source ( src ) ;
// KURL destination( dest );
@ -674,11 +674,11 @@ void Convert::putCorrection( ConvertItem* item )
}
else {
item - > moveJob = new KIO : : FileCopyJob ( source , destination , - 1 , false , false , false , false ) ;
connect ( item - > moveJob , SIGNAL( percent ( KIO : : Job * , unsigned long ) ) ,
this , SLOT( moveProgress ( KIO : : Job * , unsigned long ) )
connect ( item - > moveJob , TQT_ SIGNAL( percent ( KIO : : Job * , unsigned long ) ) ,
this , TQT_ SLOT( moveProgress ( KIO : : Job * , unsigned long ) )
) ;
connect ( item - > moveJob , SIGNAL( result ( KIO : : Job * ) ) ,
this , SLOT( moveFinished ( KIO : : Job * ) )
connect ( item - > moveJob , TQT_ SIGNAL( result ( KIO : : Job * ) ) ,
this , TQT_ SLOT( moveFinished ( KIO : : Job * ) )
) ;
}
}
@ -695,7 +695,7 @@ void Convert::executeUserScript( ConvertItem* item )
item - > convertProcess - > clearArguments ( ) ;
QString userscript = locate ( " data " , " soundkonverter/userscript.sh " ) ;
T QString userscript = locate ( " data " , " soundkonverter/userscript.sh " ) ;
if ( userscript = = " " ) executeNextStep ( item ) ;
* ( item - > convertProcess ) < < userscript ;
@ -833,7 +833,7 @@ void Convert::executeNextStep( ConvertItem* item )
void Convert : : moveProgress ( KIO : : Job * job , unsigned long percent )
{
// search the item list for our item
for ( QValueList< ConvertItem * > : : Iterator item = items . begin ( ) ; item ! = items . end ( ) ; item + + ) {
for ( T QValueList< ConvertItem * > : : Iterator item = items . begin ( ) ; item ! = items . end ( ) ; item + + ) {
if ( ( * item ) - > moveJob = = job ) {
( * item ) - > percent = percent ;
}
@ -843,7 +843,7 @@ void Convert::moveProgress( KIO::Job* job, unsigned long percent )
void Convert : : moveFinished ( KIO : : Job * job )
{
// search the item list for our item
for ( QValueList< ConvertItem * > : : Iterator item = items . begin ( ) ; item ! = items . end ( ) ; item + + ) {
for ( T QValueList< ConvertItem * > : : Iterator item = items . begin ( ) ; item ! = items . end ( ) ; item + + ) {
if ( ( * item ) - > moveJob = = job ) {
( * item ) - > percent = 0 ;
@ -888,7 +888,7 @@ void Convert::moveFinished( KIO::Job* job )
}
else if ( ( * item ) - > state = = ConvertItem : : put ) {
if ( job - > error ( ) ! = 0 ) {
logger - > log ( ( * item ) - > logID , i18n ( " Could not write to file: `%1' " ) . arg( OutputDirectory : : calcPath ( ( * item ) - > fileListItem , config ) ) ) ;
logger - > log ( ( * item ) - > logID , i18n ( " Could not write to file: `%1' " ) . tq arg( OutputDirectory : : calcPath ( ( * item ) - > fileListItem , config ) ) ) ;
emit uncountTime ( ( * item ) - > getTime ) ;
emit uncountTime ( ( * item ) - > getCorrectionTime ) ;
emit uncountTime ( ( * item ) - > ripTime ) ;
@ -929,15 +929,15 @@ void Convert::processOutput( KProcess* proc, char* data, int )
int iPercent = 0 , iTime = 0 , iPos = 0 , iNum = 0 ;
// search the item list for our item
for ( QValueList< ConvertItem * > : : Iterator item = items . begin ( ) ; item ! = items . end ( ) ; item + + )
for ( T QValueList< ConvertItem * > : : Iterator item = items . begin ( ) ; item ! = items . end ( ) ; item + + )
{
if ( ( * item ) - > convertProcess = = proc )
{
QString log_data = data ;
/* log_data. replace("\n","\\n");
log_data . replace( " \t " , " \\ t " ) ;
log_data . replace( " \r " , " \\ r " ) ;
log_data . replace( " \b " , " \\ b " ) ; */
T QString log_data = data ;
/* log_data. tq replace("\n","\\n");
log_data . tq replace( " \t " , " \\ t " ) ;
log_data . tq replace( " \r " , " \\ r " ) ;
log_data . tq replace( " \b " , " \\ b " ) ; */
logger - > log ( ( * item ) - > logID , " " + i18n ( " Output " ) + " : " + log_data ) ;
//if( (*item)->readOutputTimer.elapsed() < /*config->pauseTime*/ 100 ) return; // TODO use config value
@ -950,27 +950,27 @@ void Convert::processOutput( KProcess* proc, char* data, int )
ConvertPlugin * plugin = config - > decoderForFormat ( ( * item ) - > fileListItem - > mimeType ) ;
// TODO null pointer check
QString outputPattern = plugin - > dec . output ;
//outputPattern. replace( "%i", "%p" ); // for compatibility with old plugins
T QString outputPattern = plugin - > dec . output ;
//outputPattern. tq replace( "%i", "%p" ); // for compatibility with old plugins
if ( outputPattern . find( " %p " ) ! = - 1 ) {
outputPattern . replace( " %p " , " %i " ) ;
if ( outputPattern . tq find( " %p " ) ! = - 1 ) {
outputPattern . tq replace( " %p " , " %i " ) ;
sscanf ( data , outputPattern , & iPercent ) ;
}
else if ( outputPattern . find( " %t " ) ! = - 1 ) {
outputPattern . replace( " %t " , " %i " ) ;
else if ( outputPattern . tq find( " %t " ) ! = - 1 ) {
outputPattern . tq replace( " %t " , " %i " ) ;
sscanf ( data , outputPattern , & 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 " ) ;
else if ( outputPattern . tq find( " %0 " ) ! = - 1 & & outputPattern . tq find( " %1 " ) ! = - 1 ) {
if ( outputPattern . tq find( " %0 " ) < outputPattern . tq find( " %1 " ) ) {
outputPattern . tq replace( " %0 " , " %i " ) ;
outputPattern . tq replace( " %1 " , " %i " ) ;
sscanf ( data , outputPattern , & iPos , & iNum ) ;
}
else {
outputPattern . replace( " %0 " , " %i " ) ;
outputPattern . replace( " %1 " , " %i " ) ;
outputPattern . tq replace( " %0 " , " %i " ) ;
outputPattern . tq replace( " %1 " , " %i " ) ;
sscanf ( data , outputPattern , & iNum , & iPos ) ;
}
if ( iPos ! = 0 & & iNum ! = 0 ) iPercent = iPos * 100 / iNum ;
@ -991,31 +991,31 @@ void Convert::processOutput( KProcess* proc, char* data, int )
ConvertPlugin * plugin = config - > encoderForFormat ( ( * item ) - > fileListItem - > options . encodingOptions . sFormat ) ;
// TODO null pointer check
QString outputPattern ;
T QString outputPattern ;
if ( ( * item ) - > fileListItem - > options . encodingOptions . sQualityMode = = i18n ( " Quality " ) ) outputPattern = plugin - > enc . lossy . quality . output ;
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. replace( "%i", "%p" ); // for compatibility with old plugins
//outputPattern. tq replace( "%i", "%p" ); // for compatibility with old plugins
if ( outputPattern . find( " %p " ) ! = - 1 ) {
outputPattern . replace( " %p " , " %i " ) ;
if ( outputPattern . tq find( " %p " ) ! = - 1 ) {
outputPattern . tq replace( " %p " , " %i " ) ;
sscanf ( data , outputPattern , & iPercent ) ;
}
else if ( outputPattern . find( " %t " ) ! = - 1 ) {
outputPattern . replace( " %t " , " %i " ) ;
else if ( outputPattern . tq find( " %t " ) ! = - 1 ) {
outputPattern . tq replace( " %t " , " %i " ) ;
sscanf ( data , outputPattern , & 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 " ) ;
else if ( outputPattern . tq find( " %0 " ) ! = - 1 & & outputPattern . tq find( " %1 " ) ! = - 1 ) {
if ( outputPattern . tq find( " %0 " ) < outputPattern . tq find( " %1 " ) ) {
outputPattern . tq replace( " %0 " , " %i " ) ;
outputPattern . tq replace( " %1 " , " %i " ) ;
sscanf ( data , outputPattern , & iPos , & iNum ) ;
}
else {
outputPattern . replace( " %0 " , " %i " ) ;
outputPattern . replace( " %1 " , " %i " ) ;
outputPattern . tq replace( " %0 " , " %i " ) ;
outputPattern . tq replace( " %1 " , " %i " ) ;
sscanf ( data , outputPattern , & iNum , & iPos ) ;
}
if ( iPos ! = 0 & & iNum ! = 0 ) iPercent = iPos * 100 / iNum ;
@ -1035,30 +1035,30 @@ void Convert::processOutput( KProcess* proc, char* data, int )
RipperPlugin * plugin = config - > getCurrentRipper ( ) ;
// TODO null pointer check
QString outputPattern ;
T QString outputPattern ;
if ( ( * item ) - > fileListItem - > track ! = 0 ) outputPattern = plugin - > rip . output ;
else outputPattern = plugin - > rip . full_disc . output ;
//outputPattern. replace( "%i", "%p" ); // for compatibility with old plugins
//outputPattern. tq replace( "%i", "%p" ); // for compatibility with old plugins
if ( outputPattern . find( " %p " ) ! = - 1 | | outputPattern . find( " %a " ) ! = - 1 ) {
outputPattern . replace( " %p " , " %i " ) ;
outputPattern . replace( " %a " , " %i " ) ;
if ( outputPattern . tq find( " %p " ) ! = - 1 | | outputPattern . tq find( " %a " ) ! = - 1 ) {
outputPattern . tq replace( " %p " , " %i " ) ;
outputPattern . tq replace( " %a " , " %i " ) ;
sscanf ( data , outputPattern , & iPercent ) ;
}
else if ( outputPattern . find( " %t " ) ! = - 1 ) {
outputPattern . replace( " %t " , " %i " ) ;
else if ( outputPattern . tq find( " %t " ) ! = - 1 ) {
outputPattern . tq replace( " %t " , " %i " ) ;
sscanf ( data , outputPattern , & 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 " ) ;
else if ( outputPattern . tq find( " %0 " ) ! = - 1 & & outputPattern . tq find( " %1 " ) ! = - 1 ) {
if ( outputPattern . tq find( " %0 " ) < outputPattern . tq find( " %1 " ) ) {
outputPattern . tq replace( " %0 " , " %i " ) ;
outputPattern . tq replace( " %1 " , " %i " ) ;
sscanf ( data , outputPattern , & iPos , & iNum ) ;
}
else {
outputPattern . replace( " %0 " , " %i " ) ;
outputPattern . replace( " %1 " , " %i " ) ;
outputPattern . tq replace( " %0 " , " %i " ) ;
outputPattern . tq 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 . find( " %a " ) ! = - 1 ) {
if ( ( * item ) - > fileListItem - > track = = 0 & & plugin - > rip . full_disc . output . tq find( " %a " ) ! = - 1 ) {
if ( iPercent < ( * item ) - > lastPercent ) ( * item ) - > track + + ;
( * item ) - > lastPercent = iPercent ;
( * item ) - > percent = ( * item ) - > track * 100 / ( * item ) - > tracks + iPercent / ( * item ) - > tracks ;
@ -1086,7 +1086,7 @@ void Convert::processOutput( KProcess* proc, char* data, int )
void Convert : : processExit ( KProcess * proc )
{
// search the item list for our item
for ( QValueList< ConvertItem * > : : Iterator item = items . begin ( ) ; item ! = items . end ( ) ; item + + ) {
for ( T QValueList< ConvertItem * > : : Iterator item = items . begin ( ) ; item ! = items . end ( ) ; item + + ) {
// if( (*item)->convertProcess == proc && (*item)->fileListItem != 0 ) {
if ( ( * item ) - > convertProcess = = proc ) {
@ -1201,7 +1201,7 @@ void Convert::processExit( KProcess* proc )
}
if ( ( * item ) - > state = = ConvertItem : : put ) {
if ( proc - > signalled ( ) ) {
logger - > log ( ( * item ) - > logID , i18n ( " Could not write to file: `%1' " ) . arg( OutputDirectory : : calcPath ( ( * item ) - > fileListItem , config ) ) ) ;
logger - > log ( ( * item ) - > logID , i18n ( " Could not write to file: `%1' " ) . tq arg( OutputDirectory : : calcPath ( ( * item ) - > fileListItem , config ) ) ) ;
emit uncountTime ( ( * item ) - > getTime ) ;
emit uncountTime ( ( * item ) - > getCorrectionTime ) ;
emit uncountTime ( ( * item ) - > ripTime ) ;
@ -1213,7 +1213,7 @@ void Convert::processExit( KProcess* proc )
return ;
}
if ( ! proc - > normalExit ( ) ) {
logger - > log ( ( * item ) - > logID , i18n ( " Could not write to file: `%1' " ) . arg( OutputDirectory : : calcPath ( ( * item ) - > fileListItem , config ) ) ) ;
logger - > log ( ( * item ) - > logID , i18n ( " Could not write to file: `%1' " ) . tq arg( OutputDirectory : : calcPath ( ( * item ) - > fileListItem , config ) ) ) ;
emit uncountTime ( ( * item ) - > getTime ) ;
emit uncountTime ( ( * item ) - > getCorrectionTime ) ;
emit uncountTime ( ( * item ) - > ripTime ) ;
@ -1289,14 +1289,14 @@ void Convert::processExit( KProcess* proc )
void Convert : : add ( FileListItem * item )
{
logger - > log ( 1000 , i18n ( " Adding new item to conversion list: `%1' " ) . arg( item - > options . filePathName ) ) ;
logger - > log ( 1000 , i18n ( " Adding new item to conversion list: `%1' " ) . tq arg( item - > options . filePathName ) ) ;
// append the item to the item list and store the iterator
QValueList< ConvertItem * > : : Iterator newItem = items . append ( new ConvertItem ( item ) ) ;
T QValueList< ConvertItem * > : : Iterator newItem = items . append ( new ConvertItem ( item ) ) ;
// register at the logger
( * newItem ) - > logID = logger - > registerProcess ( item - > options . filePathName ) ;
logger - > log ( 1000 , " " + i18n ( " Got log ID: %1 " ) . arg( ( * newItem ) - > logID ) ) ;
logger - > log ( 1000 , " " + i18n ( " Got log ID: %1 " ) . tq arg( ( * newItem ) - > logID ) ) ;
logger - > log ( ( * newItem ) - > logID , " Mime Type: " + ( * newItem ) - > fileListItem - > mimeType ) ;
if ( ( * newItem ) - > fileListItem - > tags ) logger - > log ( ( * newItem ) - > logID , i18n ( " Tags successfully read " ) ) ;
@ -1310,35 +1310,35 @@ void Convert::add( FileListItem* item )
( * newItem ) - > replayGain = 0 ;
/* seems to be unnecessary
( * newItem ) - > correctionInFile = QString: : null ( ) ;
( * newItem ) - > correctionOutFile = QString: : null ( ) ;
( * newItem ) - > correctionInputExtension = QString: : null ( ) ;
( * newItem ) - > correctionOutputExtension = QString: : null ( ) ; */
( * newItem ) - > correctionInFile = TQString( ) ( ) ;
( * newItem ) - > correctionOutFile = TQString( ) ( ) ;
( * newItem ) - > correctionInputExtension = TQString( ) ( ) ;
( * newItem ) - > correctionOutputExtension = TQString( ) ( ) ; */
// connect convertProcess of our new item with the slots of Convert
( * newItem ) - > convertProcess = new KProcess ( ) ;
connect ( ( * newItem ) - > convertProcess , SIGNAL( receivedStdout ( KProcess * , char * , int ) ) ,
this , SLOT( processOutput ( KProcess * , char * , int ) )
connect ( ( * newItem ) - > convertProcess , TQT_ SIGNAL( receivedStdout ( KProcess * , char * , int ) ) ,
this , TQT_ SLOT( processOutput ( KProcess * , char * , int ) )
) ;
connect ( ( * newItem ) - > convertProcess , SIGNAL( receivedStderr ( KProcess * , char * , int ) ) ,
this , SLOT( processOutput ( KProcess * , char * , int ) )
connect ( ( * newItem ) - > convertProcess , TQT_ SIGNAL( receivedStderr ( KProcess * , char * , int ) ) ,
this , TQT_ SLOT( processOutput ( KProcess * , char * , int ) )
) ;
connect ( ( * newItem ) - > convertProcess , SIGNAL( processExited ( KProcess * ) ) ,
this , SLOT( processExit ( KProcess * ) )
connect ( ( * newItem ) - > convertProcess , TQT_ SIGNAL( processExited ( KProcess * ) ) ,
this , TQT_ SLOT( processExit ( KProcess * ) )
) ;
// NOTE the tempInFile is also created if the file is a audio cd track
// set up the names of our temp files
( * newItem ) - > tempInFile = new KTempFile ( QString: : null , " . " + item - > fileFormat ) ;
( * newItem ) - > tempInFile = new KTempFile ( TQString( ) , " . " + item - > fileFormat ) ;
( * newItem ) - > tempInFile - > setAutoDelete ( true ) ;
( * newItem ) - > tempInFile - > close ( ) ;
( * newItem ) - > tempWavFile = new KTempFile ( QString: : null , " .wav " ) ;
( * newItem ) - > tempWavFile = new KTempFile ( TQString( ) , " .wav " ) ;
( * newItem ) - > tempWavFile - > setAutoDelete ( true ) ;
( * newItem ) - > tempWavFile - > close ( ) ;
( * newItem ) - > tempOutFile = new KTempFile ( QString: : null , " . " + item - > options . encodingOptions . sFormat ) ;
( * newItem ) - > tempOutFile = new KTempFile ( TQString( ) , " . " + item - > options . encodingOptions . sFormat ) ;
( * newItem ) - > tempOutFile - > setAutoDelete ( true ) ;
( * newItem ) - > tempOutFile - > close ( ) ;
@ -1364,7 +1364,7 @@ void Convert::add( FileListItem* item )
( * newItem ) - > mode = ConvertItem : : Mode ( ( * newItem ) - > mode | ConvertItem : : replaygain ) ;
}
QString extension ;
T QString extension ;
extension = config - > getCorrectionExtension ( item - > mimeType ) ;
if ( ! extension . isEmpty ( ) ) {
@ -1432,7 +1432,7 @@ void Convert::add( FileListItem* item )
void Convert : : stop ( FileListItem * item )
{
// search the item list for our item to stop
for ( QValueList< ConvertItem * > : : Iterator stopItem = items . begin ( ) ; stopItem ! = items . end ( ) ; stopItem + + ) {
for ( T QValueList< ConvertItem * > : : Iterator stopItem = items . begin ( ) ; stopItem ! = items . end ( ) ; stopItem + + ) {
// is fileListItem pointing at the same address, as item
if ( ( * stopItem ) - > fileListItem = = item ) {
@ -1465,25 +1465,25 @@ void Convert::remove( ConvertItem* item, int state )
//emit uncountTime( item->getTime + item->getCorrectionTime + item->ripTime +
// item->decodeTime + item->encodeTime + item->replaygainTime );
logger - > log ( item - > logID , i18n ( " Removing file from conversion list. Exit code %1 " ) . arg( state ) ) ;
logger - > log ( item - > logID , i18n ( " Removing file from conversion list. Exit code %1 " ) . tq arg( state ) ) ;
if ( item - > fileListItem - > notify ! = " " ) {
QString command = item - > fileListItem - > notify ;
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 \" " ) . arg( command ) ) ;
T QString command = item - > fileListItem - > notify ;
command . tq replace( " %u " , item - > fileListItem - > url ) ;
command . tq replace( " %i " , item - > fileListItem - > options . filePathName . tq replace( " " , " %20 " ) ) ;
command . tq replace( " %o " , item - > outputFilePathName . tq replace( " " , " %20 " ) ) ;
logger - > log ( item - > logID , " " + i18n ( " Executing command: \" %1 \" " ) . tq arg( command ) ) ;
notify . clearArguments ( ) ;
QString paramSplinter ;
T QString paramSplinter ;
// FIXME split correct (strings with spaces are splited by mistake)
// FIXME only one command can be executed at once!?
QStringList params = QStringList: : split ( ' ' , item - > fileListItem - > notify ) ;
for ( QStringList: : Iterator it = params . begin ( ) ; it ! = params . end ( ) ; + + it )
T QStringList params = T QStringList: : split ( ' ' , item - > fileListItem - > notify ) ;
for ( T QStringList: : Iterator it = params . begin ( ) ; it ! = params . end ( ) ; + + it )
{
paramSplinter = * it ;
paramSplinter . replace( " %u " , item - > fileListItem - > url ) ;
paramSplinter . replace( " %i " , item - > fileListItem - > options . filePathName ) ;
paramSplinter . replace( " %o " , item - > outputFilePathName ) ;
paramSplinter . tq replace( " %u " , item - > fileListItem - > url ) ;
paramSplinter . tq replace( " %i " , item - > fileListItem - > options . filePathName ) ;
paramSplinter . tq replace( " %o " , item - > outputFilePathName ) ;
notify < < paramSplinter ;
}
notify . start ( KProcess : : DontCare ) ;
@ -1507,13 +1507,13 @@ void Convert::remove( ConvertItem* item, int state )
item - > tempWavFile = 0 ;
if ( item - > tempOutFile ! = 0 ) delete item - > tempOutFile ;
item - > tempOutFile = 0 ;
QFile file ;
T QFile file ;
file . setName ( item - > correctionInFile ) ;
if ( file . exists ( ) ) file . remove ( ) ;
file . setName ( item - > correctionOutFile ) ;
if ( file . exists ( ) ) file . remove ( ) ;
for ( QValueList< ConvertItem * > : : Iterator it = items . begin ( ) ; it ! = items . end ( ) ; it + + ) {
for ( T QValueList< ConvertItem * > : : Iterator it = items . begin ( ) ; it ! = items . end ( ) ; it + + ) {
if ( ( * it ) = = item ) {
items . remove ( it ) ;
break ;
@ -1532,14 +1532,14 @@ void Convert::updateProgressIndicator()
{
float time = 0 ;
for ( QValueList< ConvertItem * > : : Iterator it = items . begin ( ) ; it ! = items . end ( ) ; it + + ) {
for ( T QValueList< ConvertItem * > : : Iterator it = items . begin ( ) ; it ! = items . end ( ) ; it + + ) {
if ( ( * it ) - > state = = ConvertItem : : get ) {
time + = ( * it ) - > getTime * ( * it ) - > percent / 100 ;
( * it ) - > fileListItem - > setText ( fileList - > columnByName ( i18n ( " State " ) ) , i18n ( " Getting file " ) + " ... " + QString( ) . sprintf ( " %02i %% " , ( * it ) - > percent ) ) ;
( * it ) - > fileListItem - > setText ( fileList - > columnByName ( i18n ( " State " ) ) , i18n ( " Getting file " ) + " ... " + T QString( ) . sprintf ( " %02i %% " , ( * it ) - > percent ) ) ;
}
else if ( ( * it ) - > state = = ConvertItem : : get_correction ) {
time + = ( * it ) - > getCorrectionTime * ( * it ) - > percent / 100 ;
( * it ) - > fileListItem - > setText ( fileList - > columnByName ( i18n ( " State " ) ) , i18n ( " Getting correction file " ) + " ... " + QString( ) . sprintf ( " %02i %% " , ( * it ) - > percent ) ) ;
( * it ) - > fileListItem - > setText ( fileList - > columnByName ( i18n ( " State " ) ) , i18n ( " Getting correction file " ) + " ... " + T QString( ) . sprintf ( " %02i %% " , ( * it ) - > percent ) ) ;
}
else if ( ( * it ) - > state = = ConvertItem : : rip ) {
RipperPlugin * plugin = config - > getCurrentRipper ( ) ;
@ -1548,7 +1548,7 @@ void Convert::updateProgressIndicator()
}
else {
time + = ( * it ) - > ripTime * ( * it ) - > percent / 100 ;
( * it ) - > fileListItem - > setText ( fileList - > columnByName ( i18n ( " State " ) ) , i18n ( " Ripping " ) + " ... " + QString( ) . sprintf ( " %02i %% " , ( * it ) - > percent ) ) ;
( * it ) - > fileListItem - > setText ( fileList - > columnByName ( i18n ( " State " ) ) , i18n ( " Ripping " ) + " ... " + T QString( ) . sprintf ( " %02i %% " , ( * it ) - > percent ) ) ;
}
}
else if ( ( * it ) - > state = = ConvertItem : : decode ) {
@ -1558,12 +1558,12 @@ void Convert::updateProgressIndicator()
}
else {
time + = ( * it ) - > decodeTime * ( * it ) - > percent / 100 ;
( * it ) - > fileListItem - > setText ( fileList - > columnByName ( i18n ( " State " ) ) , i18n ( " Decoding " ) + " ... " + QString( ) . sprintf ( " %02i %% " , ( * it ) - > percent ) ) ;
( * it ) - > fileListItem - > setText ( fileList - > columnByName ( i18n ( " State " ) ) , i18n ( " Decoding " ) + " ... " + T QString( ) . sprintf ( " %02i %% " , ( * it ) - > percent ) ) ;
}
}
else if ( ( * it ) - > state = = ConvertItem : : encode ) {
ConvertPlugin * plugin = config - > encoderForFormat ( ( * it ) - > fileListItem - > options . encodingOptions . sFormat ) ;
QString outputPattern ;
T QString outputPattern ;
if ( plugin ! = 0 & & ( * it ) - > fileListItem - > options . encodingOptions . sQualityMode = = i18n ( " Quality " ) ) outputPattern = plugin - > enc . lossy . quality . output ;
else if ( plugin ! = 0 & & ( * it ) - > fileListItem - > options . encodingOptions . sQualityMode = = i18n ( " Bitrate " ) & & ( * it ) - > fileListItem - > options . encodingOptions . sBitrateMode = = " cbr " ) outputPattern = plugin - > enc . lossy . bitrate . cbr . output ;
else if ( plugin ! = 0 & & ( * it ) - > fileListItem - > options . encodingOptions . sQualityMode = = i18n ( " Bitrate " ) & & ( * it ) - > fileListItem - > options . encodingOptions . sBitrateMode = = " abr " ) outputPattern = plugin - > enc . lossy . bitrate . abr . output ;
@ -1572,19 +1572,19 @@ void Convert::updateProgressIndicator()
}
else {
time + = ( * it ) - > encodeTime * ( * it ) - > percent / 100 ;
( * it ) - > fileListItem - > setText ( fileList - > columnByName ( i18n ( " State " ) ) , i18n ( " Encoding " ) + " ... " + QString( ) . sprintf ( " %02i %% " , ( * it ) - > percent ) ) ;
( * it ) - > fileListItem - > setText ( fileList - > columnByName ( i18n ( " State " ) ) , i18n ( " Encoding " ) + " ... " + T QString( ) . sprintf ( " %02i %% " , ( * it ) - > percent ) ) ;
}
}
else if ( ( * it ) - > state = = ConvertItem : : replaygain ) {
time + = ( * it ) - > replaygainTime * ( * it ) - > percent / 100 ;
( * it ) - > fileListItem - > setText ( fileList - > columnByName ( i18n ( " State " ) ) , i18n ( " Replay Gain " ) + " ... " + QString( ) . sprintf ( " %02i %% " , ( * it ) - > percent ) ) ;
( * it ) - > fileListItem - > setText ( fileList - > columnByName ( i18n ( " State " ) ) , i18n ( " Replay Gain " ) + " ... " + T QString( ) . sprintf ( " %02i %% " , ( * it ) - > percent ) ) ;
}
else if ( ( * it ) - > state = = ConvertItem : : put ) {
( * it ) - > fileListItem - > setText ( fileList - > columnByName ( i18n ( " State " ) ) , i18n ( " Moving file " ) + " ... " + QString( ) . sprintf ( " %02i %% " , ( * it ) - > percent ) ) ;
( * it ) - > fileListItem - > setText ( fileList - > columnByName ( i18n ( " State " ) ) , i18n ( " Moving file " ) + " ... " + T QString( ) . sprintf ( " %02i %% " , ( * it ) - > percent ) ) ;
}
else if ( ( * it ) - > state = = ConvertItem : : put_correction ) {
time + = ( * it ) - > getCorrectionTime * ( * it ) - > percent / 100 ;
( * it ) - > fileListItem - > setText ( fileList - > columnByName ( i18n ( " State " ) ) , i18n ( " Moving correction file " ) + " ... " + QString( ) . sprintf ( " %02i %% " , ( * it ) - > percent ) ) ;
( * it ) - > fileListItem - > setText ( fileList - > columnByName ( i18n ( " State " ) ) , i18n ( " Moving correction file " ) + " ... " + T QString( ) . sprintf ( " %02i %% " , ( * it ) - > percent ) ) ;
}
}
emit update ( time ) ;
@ -1594,18 +1594,18 @@ void Convert::updateProgressIndicator()
// { // FIXME setting a higher priority does not work
// KProcess pChangePriority;
//
// for( QValueList<ConvertItem*>::Iterator it = items.begin(); it != items.end(); it++ ) {
// for( T QValueList<ConvertItem*>::Iterator it = items.begin(); it != items.end(); it++ ) {
// if( (*it)->convertProcess->isRunning() ) {
// //(*it)->convertProcess->setPriority( priority );
// pChangePriority.clearArguments();
// pChangePriority << "renice";
// QString prio;
// T QString prio;
// prio.sprintf( "%i", priority );
// pChangePriority << prio;
// QString pid;
// T QString pid;
// pid.sprintf( "%i", (*it)->convertProcess->pid() );
// pChangePriority << pid;
// // QString cmd;
// // T QString cmd;
// //cmd.sprintf( "renice %i %i", );
// pChangePriority.start( KProcess::Block );
// }