|
|
|
@ -34,6 +34,7 @@
|
|
|
|
|
#include <tqcombobox.h>
|
|
|
|
|
#include <tqcheckbox.h>
|
|
|
|
|
#include <tqlayout.h>
|
|
|
|
|
#include <tqregexp.h>
|
|
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <sys/wait.h>
|
|
|
|
@ -65,46 +66,32 @@ class K3bSoxProgram : public K3bExternalProgram
|
|
|
|
|
if( !TQFile::exists( path ) )
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
K3bExternalBin* bin = 0;
|
|
|
|
|
|
|
|
|
|
// probe version
|
|
|
|
|
TDEProcess vp;
|
|
|
|
|
K3bProcessOutputCollector out( &vp );
|
|
|
|
|
|
|
|
|
|
vp << path << "-h";
|
|
|
|
|
if( vp.start( TDEProcess::Block, TDEProcess::AllOutput ) ) {
|
|
|
|
|
int pos = out.output().find( "sox: SoX Version" );
|
|
|
|
|
if ( pos < 0 )
|
|
|
|
|
pos = out.output().find( "sox: SoX v" ); // newer sox versions
|
|
|
|
|
int endPos = out.output().find( "\n", pos );
|
|
|
|
|
if( pos > 0 && endPos > 0 ) {
|
|
|
|
|
pos += 17;
|
|
|
|
|
bin = new K3bExternalBin( this );
|
|
|
|
|
bin->path = path;
|
|
|
|
|
bin->version = out.output().mid( pos, endPos-pos );
|
|
|
|
|
|
|
|
|
|
addBin( bin );
|
|
|
|
|
TQRegExp versionRe ("sox: +(SoX )?(Version |v)([^\\n]+)");
|
|
|
|
|
// Should match:
|
|
|
|
|
// * sox: Version 12.2.3
|
|
|
|
|
// * sox: SoX Version 12.18.1
|
|
|
|
|
// * sox: SoX v14.0.0
|
|
|
|
|
// * sox: SoX v14.4.0
|
|
|
|
|
int pos = versionRe.search( out.output() );
|
|
|
|
|
if( pos > 0 ) {
|
|
|
|
|
TQString version = versionRe.cap(3);
|
|
|
|
|
|
|
|
|
|
K3bExternalBin* bin = new K3bExternalBin( this );
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
pos = out.output().find( "sox: Version" );
|
|
|
|
|
endPos = out.output().find( "\n", pos );
|
|
|
|
|
if( pos > 0 && endPos > 0 ) {
|
|
|
|
|
pos += 13;
|
|
|
|
|
bin = new K3bExternalBin( this );
|
|
|
|
|
bin->path = path;
|
|
|
|
|
bin->version = out.output().mid( pos, endPos-pos );
|
|
|
|
|
bin->version = version;
|
|
|
|
|
|
|
|
|
|
addBin( bin );
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|