diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-27 19:21:21 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-27 19:21:21 +0000 |
commit | d8cc8bdfa7fa624a526d5aa1626974e1444cb799 (patch) | |
tree | f295f1c545b319963d5357af79fe08991d8141d9 /plugins/decoder/flac | |
parent | 2a39a080579fb52a2599c02b2939795385b89093 (diff) | |
download | k3b-d8cc8bdfa7fa624a526d5aa1626974e1444cb799.tar.gz k3b-d8cc8bdfa7fa624a526d5aa1626974e1444cb799.zip |
TQt4 port k3b
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/k3b@1233803 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'plugins/decoder/flac')
-rw-r--r-- | plugins/decoder/flac/k3bflacdecoder.cpp | 68 | ||||
-rw-r--r-- | plugins/decoder/flac/k3bflacdecoder.h | 14 |
2 files changed, 42 insertions, 40 deletions
diff --git a/plugins/decoder/flac/k3bflacdecoder.cpp b/plugins/decoder/flac/k3bflacdecoder.cpp index 762403f..4e537b0 100644 --- a/plugins/decoder/flac/k3bflacdecoder.cpp +++ b/plugins/decoder/flac/k3bflacdecoder.cpp @@ -17,9 +17,9 @@ #include <k3bpluginfactory.h> -#include <qbuffer.h> -#include <qfile.h> -#include <qstringlist.h> +#include <tqbuffer.h> +#include <tqfile.h> +#include <tqstringlist.h> #include <kurl.h> #include <kdebug.h> @@ -52,7 +52,7 @@ class K3bFLACDecoder::Private #endif { public: - void open(QFile* f) { + void open(TQFile* f) { file = f; file->open(IO_ReadOnly); @@ -72,14 +72,14 @@ public: comments = 0; } - Private(QFile* f) + Private(TQFile* f) #ifdef LEGACY_FLAC : FLAC::Decoder::SeekableStream(), #else : FLAC::Decoder::Stream(), #endif comments(0) { - internalBuffer = new QBuffer(); + internalBuffer = new TQBuffer(); internalBuffer->open(IO_ReadWrite); open(f); @@ -93,8 +93,8 @@ public: bool seekToFrame(int frame); - QFile* file; - QBuffer* internalBuffer; + TQFile* file; + TQBuffer* internalBuffer; FLAC::Metadata::VorbisComment* comments; unsigned rate; unsigned channels; @@ -240,8 +240,8 @@ FLAC__StreamDecoderWriteStatus K3bFLACDecoder::Private::write_callback(const FLA return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; } -K3bFLACDecoder::K3bFLACDecoder( QObject* parent, const char* name ) - : K3bAudioDecoder( parent, name ) +K3bFLACDecoder::K3bFLACDecoder( TQObject* tqparent, const char* name ) + : K3bAudioDecoder( tqparent, name ) { d = 0; } @@ -256,10 +256,10 @@ void K3bFLACDecoder::cleanup() { if (d) { d->cleanup(); - d->open(new QFile(filename())); + d->open(new TQFile(filename())); } else - d = new Private(new QFile(filename())); + d = new Private(new TQFile(filename())); } bool K3bFLACDecoder::analyseFileInternal( K3b::Msf& frames, int& samplerate, int& ch ) @@ -274,9 +274,9 @@ bool K3bFLACDecoder::analyseFileInternal( K3b::Msf& frames, int& samplerate, int if( d->comments != 0 ) { kdDebug() << "(K3bFLACDecoder) unpacking Vorbis tags" << endl; for( unsigned int i = 0; i < d->comments->get_num_comments(); ++i ) { - QString key = QString::fromUtf8( d->comments->get_comment(i).get_field_name(), + TQString key = TQString::fromUtf8( d->comments->get_comment(i).get_field_name(), d->comments->get_comment(i).get_field_name_length() ); - QString value = QString::fromUtf8( d->comments->get_comment(i).get_field_value(), + TQString value = TQString::fromUtf8( d->comments->get_comment(i).get_field_value(), d->comments->get_comment(i).get_field_value_length() ); if( key.upper() == "TITLE" ) @@ -291,7 +291,7 @@ bool K3bFLACDecoder::analyseFileInternal( K3b::Msf& frames, int& samplerate, int if ((d->comments == 0) || (d->comments->get_num_comments() == 0)) { // no Vorbis comments, check for ID3 tags kdDebug() << "(K3bFLACDecoder) using taglib to read tag" << endl; - TagLib::FLAC::File f( QFile::encodeName(filename()) ); + TagLib::FLAC::File f( TQFile::encodeName(filename()) ); if( f.isOpen() ) { addMetaInfo( META_TITLE, TStringToQString( f.tag()->title() ) ); addMetaInfo( META_ARTIST, TStringToQString( f.tag()->artist() ) ); @@ -348,7 +348,7 @@ int K3bFLACDecoder::decodeInternal( char* _data, int maxLen ) #endif bytesAvailable = d->internalBuffer->size() - d->internalBuffer->at(); - bytesToCopy = QMIN(maxLen, bytesAvailable); + bytesToCopy = TQMIN(maxLen, bytesAvailable); bytesCopied = (int)d->internalBuffer->readBlock(_data, bytesToCopy); if(bytesCopied == bytesAvailable) { @@ -367,45 +367,45 @@ bool K3bFLACDecoder::seekInternal( const K3b::Msf& pos ) } -QString K3bFLACDecoder::fileType() const +TQString K3bFLACDecoder::fileType() const { return i18n("FLAC"); } -QStringList K3bFLACDecoder::supportedTechnicalInfos() const +TQStringList K3bFLACDecoder::supportedTechnicalInfos() const { - return QStringList::split( ";", + return TQStringList::split( ";", i18n("Channels") + ";" + i18n("Sampling Rate") + ";" + i18n("Sample Size") ); } -QString K3bFLACDecoder::technicalInfo( const QString& info ) const +TQString K3bFLACDecoder::technicalInfo( const TQString& info ) const { if( d->comments != 0 ) { if( info == i18n("Vendor") ) #ifdef FLAC_NEWER_THAN_1_1_1 - return QString::fromUtf8((char*)d->comments->get_vendor_string()); + return TQString::fromUtf8((char*)d->comments->get_vendor_string()); #else - return QString::fromUtf8(d->comments->get_vendor_string().get_field()); + return TQString::fromUtf8(d->comments->get_vendor_string().get_field()); #endif else if( info == i18n("Channels") ) - return QString::number(d->channels); + return TQString::number(d->channels); else if( info == i18n("Sampling Rate") ) - return i18n("%1 Hz").arg(d->rate); + return i18n("%1 Hz").tqarg(d->rate); else if( info == i18n("Sample Size") ) - return i18n("%1 bits").arg(d->bitsPerSample); + return i18n("%1 bits").tqarg(d->bitsPerSample); } - return QString::null; + return TQString(); } -K3bFLACDecoderFactory::K3bFLACDecoderFactory( QObject* parent, const char* name ) - : K3bAudioDecoderFactory( parent, name ) +K3bFLACDecoderFactory::K3bFLACDecoderFactory( TQObject* tqparent, const char* name ) + : K3bAudioDecoderFactory( tqparent, name ) { } @@ -415,10 +415,10 @@ K3bFLACDecoderFactory::~K3bFLACDecoderFactory() } -K3bAudioDecoder* K3bFLACDecoderFactory::createDecoder( QObject* parent, +K3bAudioDecoder* K3bFLACDecoderFactory::createDecoder( TQObject* tqparent, const char* name ) const { - return new K3bFLACDecoder( parent, name ); + return new K3bFLACDecoder( tqparent, name ); } @@ -429,7 +429,7 @@ bool K3bFLACDecoderFactory::canDecode( const KURL& url ) // Note: since file is created on the stack it will be closed automatically // by its destructor when this method (i.e. canDecode) returns. - QFile file(url.path()); + TQFile file(url.path()); if(!file.open(IO_ReadOnly)) { kdDebug() << "(K3bFLACDecoder) Could not open file " << url.path() << endl; @@ -482,11 +482,11 @@ bool K3bFLACDecoderFactory::canDecode( const KURL& url ) } else { kdDebug() << "(K3bFLACDecoder) " << url.path() << ": wrong format:" << endl << " channels: " - << QString::number(info.get_channels()) << endl + << TQString::number(info.get_channels()) << endl << " samplerate: " - << QString::number(info.get_sample_rate()) << endl + << TQString::number(info.get_sample_rate()) << endl << " bits/sample: " - << QString::number(info.get_bits_per_sample()) << endl; + << TQString::number(info.get_bits_per_sample()) << endl; return false; } } diff --git a/plugins/decoder/flac/k3bflacdecoder.h b/plugins/decoder/flac/k3bflacdecoder.h index aace651..2e3bccf 100644 --- a/plugins/decoder/flac/k3bflacdecoder.h +++ b/plugins/decoder/flac/k3bflacdecoder.h @@ -24,16 +24,17 @@ class KURL; class K3bFLACDecoderFactory : public K3bAudioDecoderFactory { Q_OBJECT + TQ_OBJECT public: - K3bFLACDecoderFactory( QObject* parent = 0, const char* name = 0 ); + K3bFLACDecoderFactory( TQObject* tqparent = 0, const char* name = 0 ); ~K3bFLACDecoderFactory(); bool canDecode( const KURL& filename ); int pluginSystemVersion() const { return 3; } - K3bAudioDecoder* createDecoder( QObject* parent = 0, + K3bAudioDecoder* createDecoder( TQObject* tqparent = 0, const char* name = 0 ) const; }; @@ -41,18 +42,19 @@ class K3bFLACDecoderFactory : public K3bAudioDecoderFactory class K3bFLACDecoder : public K3bAudioDecoder { Q_OBJECT + TQ_OBJECT public: - K3bFLACDecoder( QObject* parent = 0, const char* name = 0 ); + K3bFLACDecoder( TQObject* tqparent = 0, const char* name = 0 ); ~K3bFLACDecoder(); void cleanup(); bool seekInternal( const K3b::Msf& ); - QString fileType() const; - QStringList supportedTechnicalInfos() const; - QString technicalInfo( const QString& ) const; + TQString fileType() const; + TQStringList supportedTechnicalInfos() const; + TQString technicalInfo( const TQString& ) const; protected: bool analyseFileInternal( K3b::Msf& frames, int& samplerate, int& ch ); |