summaryrefslogtreecommitdiffstats
path: root/libk3b
diff options
context:
space:
mode:
Diffstat (limited to 'libk3b')
-rw-r--r--libk3b/core/k3bdefaultexternalprograms.cpp75
-rw-r--r--libk3b/core/k3bdefaultexternalprograms.h16
-rw-r--r--libk3b/plugin/k3bpluginconfigwidget.cpp2
-rw-r--r--libk3b/plugin/k3bpluginfactory.h2
-rw-r--r--libk3b/plugin/k3bpluginmanager.cpp4
-rw-r--r--libk3b/projects/audiocd/k3baudionormalizejob.cpp30
6 files changed, 83 insertions, 46 deletions
diff --git a/libk3b/core/k3bdefaultexternalprograms.cpp b/libk3b/core/k3bdefaultexternalprograms.cpp
index 4b86055..7fbace6 100644
--- a/libk3b/core/k3bdefaultexternalprograms.cpp
+++ b/libk3b/core/k3bdefaultexternalprograms.cpp
@@ -49,13 +49,13 @@ void K3b::addDefaultPrograms( K3bExternalBinManager* m )
void K3b::addTranscodePrograms( K3bExternalBinManager* m )
{
static const char* transcodeTools[] = { "transcode",
- 0, // K3b 1.0 only uses the transcode binary
- "tcprobe",
- "tccat",
- "tcscan",
- "tcextract",
- "tcdecode",
- 0 };
+ 0, // K3b 1.0 only uses the transcode binary
+ "tcprobe",
+ "tccat",
+ "tcscan",
+ "tcextract",
+ "tcdecode",
+ 0 };
for( int i = 0; transcodeTools[i]; ++i )
m->addProgram( new K3bTranscodeProgram( transcodeTools[i] ) );
@@ -102,16 +102,16 @@ static TQString& debianWeirdnessHack( TQString& path )
f.open( IO_ReadOnly );
TQString s = TQTextStream( &f ).read();
if( s.contains( "cdrecord.mmap" ) && s.contains( "cdrecord.shm" ) ) {
- kdDebug() << "(K3bCdrecordProgram) Found Debian Wrapper script." << endl;
- TQString ext;
- if( K3b::kernelVersion().versionString().left(3) > "2.2" )
- ext = ".mmap";
- else
- ext = ".shm";
+ kdDebug() << "(K3bCdrecordProgram) Found Debian Wrapper script." << endl;
+ TQString ext;
+ if( K3b::kernelVersion().versionString().left(3) > "2.2" )
+ ext = ".mmap";
+ else
+ ext = ".shm";
- kdDebug() << "(K3bCdrecordProgram) Using cdrecord" << ext << endl;
+ kdDebug() << "(K3bCdrecordProgram) Using cdrecord" << ext << endl;
- path += ext;
+ path += ext;
}
}
}
@@ -214,7 +214,7 @@ bool K3bCdrecordProgram::scan( const TQString& p )
if( out.output().contains( "-tao" ) )
bin->addFeature( "tao" );
if( out.output().contains( "cuefile=" ) &&
- ( wodim || bin->version > K3bVersion( 2, 1, -1, "a14") ) ) // cuefile handling was still buggy in a14
+ ( wodim || bin->version > K3bVersion( 2, 1, -1, "a14") ) ) // cuefile handling was still buggy in a14
bin->addFeature( "cuefile" );
// new mode 2 options since cdrecord 2.01a12
@@ -223,15 +223,15 @@ bool K3bCdrecordProgram::scan( const TQString& p )
// two checks)
// and the version check does not handle versions like 2.01-dvd properly
if( out.output().contains( "-xamix" ) ||
- bin->version >= K3bVersion( 2, 1, -1, "a12" ) ||
- wodim )
+ bin->version >= K3bVersion( 2, 1, -1, "a12" ) ||
+ wodim )
bin->addFeature( "xamix" );
// check if we run cdrecord as root
struct stat s;
if( !::stat( TQFile::encodeName(path), &s ) ) {
if( (s.st_mode & S_ISUID) && s.st_uid == 0 )
- bin->addFeature( "suidroot" );
+ bin->addFeature( "suidroot" );
}
}
else {
@@ -352,7 +352,7 @@ bool K3bMkisofsProgram::scan( const TQString& p )
struct stat s;
if( !::stat( TQFile::encodeName(path), &s ) ) {
if( (s.st_mode & S_ISUID) && s.st_uid == 0 )
- bin->addFeature( "suidroot" );
+ bin->addFeature( "suidroot" );
}
}
else {
@@ -458,7 +458,7 @@ bool K3bReadcdProgram::scan( const TQString& p )
struct stat s;
if( !::stat( TQFile::encodeName(path), &s ) ) {
if( (s.st_mode & S_ISUID) && s.st_uid == 0 )
- bin->addFeature( "suidroot" );
+ bin->addFeature( "suidroot" );
}
}
else {
@@ -551,7 +551,7 @@ bool K3bCdrdaoProgram::scan( const TQString& p )
struct stat s;
if( !::stat( TQFile::encodeName(path), &s ) ) {
if( (s.st_mode & S_ISUID) && s.st_uid == 0 )
- bin->addFeature( "suidroot" );
+ bin->addFeature( "suidroot" );
}
}
else {
@@ -712,20 +712,41 @@ K3bNormalizeProgram::K3bNormalizeProgram()
{
}
+TQStringList K3bNormalizeProgram::binNames() const {
+ TQStringList rv;
+ rv << "normalize-audio" << "normalize";
+ return rv;
+}
bool K3bNormalizeProgram::scan( const TQString& p )
{
if( p.isEmpty() )
return false;
- TQString path = p;
- TQFileInfo fi( path );
+ bool found = false;
+
+ TQFileInfo fi( p );
if( fi.isDir() ) {
- if( path[path.length()-1] != '/' )
- path.append("/");
- path.append("normalize-audio");
+
+ for(const auto & name: binNames()) {
+ TQString path = p;
+ if( path[path.length()-1] != '/' )
+ path.append("/");
+ path.append(name);
+
+ if( verifyAddBin(path) )
+ found = true;
+ }
+ } else {
+ if( verifyAddBin(p) )
+ found = true;
}
+ return found;
+}
+
+
+bool K3bNormalizeProgram::verifyAddBin( const TQString& path ) {
if( !TQFile::exists( path ) )
return false;
diff --git a/libk3b/core/k3bdefaultexternalprograms.h b/libk3b/core/k3bdefaultexternalprograms.h
index bc4d41c..daca769 100644
--- a/libk3b/core/k3bdefaultexternalprograms.h
+++ b/libk3b/core/k3bdefaultexternalprograms.h
@@ -102,6 +102,22 @@ class LIBK3B_EXPORT K3bNormalizeProgram : public K3bExternalProgram
K3bNormalizeProgram();
bool scan( const TQString& );
+ protected:
+ /**
+ * Returns list of names the executable of this program could be called
+ */
+ TQStringList binNames() const;
+
+ /**
+ * Verifies if binary on the given path suitable to be used by k3b and
+ * addBin()s it if so
+ */
+ bool verifyAddBin( const TQString& path );
+
+ /**
+ * @note: it would make sense to make binNames() and verifyBin() virtuals in
+ * K3bExternalProgram and reimplement scan() in a more generic way.
+ */
};
diff --git a/libk3b/plugin/k3bpluginconfigwidget.cpp b/libk3b/plugin/k3bpluginconfigwidget.cpp
index 21876d5..5b847fb 100644
--- a/libk3b/plugin/k3bpluginconfigwidget.cpp
+++ b/libk3b/plugin/k3bpluginconfigwidget.cpp
@@ -18,7 +18,7 @@
#include <k3bcore.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
#include <kdebug.h>
diff --git a/libk3b/plugin/k3bpluginfactory.h b/libk3b/plugin/k3bpluginfactory.h
index dde5e9f..e812fef 100644
--- a/libk3b/plugin/k3bpluginfactory.h
+++ b/libk3b/plugin/k3bpluginfactory.h
@@ -18,7 +18,7 @@
#define _K3B_PLUGIN_FACTORY_H_
#include <klibloader.h>
-#include <kinstance.h>
+#include <tdeinstance.h>
#include <tdeglobal.h>
#include <tdelocale.h>
diff --git a/libk3b/plugin/k3bpluginmanager.cpp b/libk3b/plugin/k3bpluginmanager.cpp
index 9981070..364e76b 100644
--- a/libk3b/plugin/k3bpluginmanager.cpp
+++ b/libk3b/plugin/k3bpluginmanager.cpp
@@ -19,7 +19,7 @@
#include <k3bversion.h>
#include <kdebug.h>
-#include <ksimpleconfig.h>
+#include <tdesimpleconfig.h>
#include <tdelocale.h>
#include <tdeglobal.h>
#include <tdestandarddirs.h>
@@ -85,7 +85,7 @@ TQPtrList<K3bPlugin> K3bPluginManager::plugins( const TQString& group ) const
void K3bPluginManager::loadPlugin( const TQString& fileName )
{
- KSimpleConfig c( fileName, true );
+ TDESimpleConfig c( fileName, true );
c.setGroup( "K3b Plugin" );
TQString libName = c.readEntry( "Lib" );
diff --git a/libk3b/projects/audiocd/k3baudionormalizejob.cpp b/libk3b/projects/audiocd/k3baudionormalizejob.cpp
index 85fd698..beb05fb 100644
--- a/libk3b/projects/audiocd/k3baudionormalizejob.cpp
+++ b/libk3b/projects/audiocd/k3baudionormalizejob.cpp
@@ -131,18 +131,18 @@ void K3bAudioNormalizeJob::slotStdLine( const TQString& line )
if( m_currentAction == ADJUSTING_LEVELS ) {
emit newTask( i18n("Adjusting volume level for track %1 of %2").arg(m_currentTrack).arg(m_files.count()) );
kdDebug() << "(K3bAudioNormalizeJob) adjusting level for track "
- << m_currentTrack
- << " "
- << m_files.at(m_currentTrack-1)
- << endl;
+ << m_currentTrack
+ << " "
+ << m_files.at(m_currentTrack-1)
+ << endl;
}
else {
emit newTask( i18n("Computing level for track %1 of %2").arg(m_currentTrack).arg(m_files.count()) );
kdDebug() << "(K3bAudioNormalizeJob) computing level for track "
- << m_currentTrack
- << " "
- << m_files.at(m_currentTrack-1)
- << endl;
+ << m_currentTrack
+ << " "
+ << m_files.at(m_currentTrack-1)
+ << endl;
}
m_currentTrack++;
@@ -159,7 +159,7 @@ void K3bAudioNormalizeJob::slotStdLine( const TQString& line )
emit subPercent( p );
else
kdDebug() << "(K3bAudioNormalizeJob) subPercent parsing error at pos "
- << 19 << " in line '" << line.mid( 19, 3 ) << "'" << endl;
+ << 19 << " in line '" << line.mid( 19, 3 ) << "'" << endl;
// batch progress starts at position 50 in version 0.7.6
p = line.mid( 50, 3 ).toInt(&ok);
@@ -169,7 +169,7 @@ void K3bAudioNormalizeJob::slotStdLine( const TQString& line )
emit percent( 50 + (int)((double)p/2.0) );
else
kdDebug() << "(K3bAudioNormalizeJob) percent parsing error at pos "
- << 50 << " in line '" << line.mid( 50, 3 ) << "'" << endl;
+ << 50 << " in line '" << line.mid( 50, 3 ) << "'" << endl;
}
}
@@ -185,13 +185,13 @@ void K3bAudioNormalizeJob::slotProcessExited( TDEProcess* p )
break;
default:
if( !m_canceled ) {
- emit infoMessage( i18n("%1 returned an unknown error (code %2).").arg("normalize-audio").arg(p->exitStatus()),
- K3bJob::ERROR );
- emit infoMessage( i18n("Please send me an email with the last output."), K3bJob::ERROR );
- emit infoMessage( i18n("Error while normalizing tracks."), ERROR );
+ emit infoMessage( i18n("%1 returned an unknown error (code %2).").arg("normalize-audio").arg(p->exitStatus()),
+ K3bJob::ERROR );
+ emit infoMessage( i18n("Please send me an email with the last output."), K3bJob::ERROR );
+ emit infoMessage( i18n("Error while normalizing tracks."), ERROR );
}
else
- emit canceled();
+ emit canceled();
jobFinished(false);
break;
}