diff options
Diffstat (limited to 'krec/krecfile.cpp')
-rw-r--r-- | krec/krecfile.cpp | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/krec/krecfile.cpp b/krec/krecfile.cpp index 6e4b2b8f..a588d126 100644 --- a/krec/krecfile.cpp +++ b/krec/krecfile.cpp @@ -26,25 +26,25 @@ #include <kio/job.h> #include <klocale.h> #include <ksimpleconfig.h> -#include <qdir.h> -#include <qfileinfo.h> +#include <tqdir.h> +#include <tqfileinfo.h> #include <kmessagebox.h> -#include <qtimer.h> +#include <tqtimer.h> -#include <qdatastream.h> +#include <tqdatastream.h> #include <math.h> void KRecFile::init() { _pos = 0; _size = 0; - _filename = QString::null; + _filename = TQString::null; _currentBuffer = 0; _dir = new KTempDir(); _config = new KSimpleConfig( _dir->name()+"project.rc", false ); } -KRecFile::KRecFile( QObject* p, const char* n ) - : QObject( p,n ) +KRecFile::KRecFile( TQObject* p, const char* n ) + : TQObject( p,n ) , _saved( false ) { init(); @@ -65,8 +65,8 @@ KRecFile::KRecFile( QObject* p, const char* n ) delete dialog; } -KRecFile::KRecFile( const QString &filename, QObject* p, const char* n ) - : QObject( p,n ) +KRecFile::KRecFile( const TQString &filename, TQObject* p, const char* n ) + : TQObject( p,n ) , _saved( true ) { init(); @@ -77,7 +77,7 @@ KRecFile::KRecFile( const QString &filename, QObject* p, const char* n ) KTar *tar = new KTar( _filename, "application/x-gzip" ); tar->open( IO_ReadOnly ); int i=0; while ( _filename.find( '/', i ) != -1 ) i++; // Find last '/' - QString basename = _filename.right( _filename.length()-i ); + TQString basename = _filename.right( _filename.length()-i ); basename = basename.left( basename.length()-5 ); const KArchiveDirectory *dir = dynamic_cast<const KArchiveDirectory*>( tar->directory()->entry( basename ) ); @@ -91,7 +91,7 @@ KRecFile::KRecFile( const QString &filename, QObject* p, const char* n ) //kdDebug( 60005 ) << c << " Files to load" << endl; for ( int i=0; i<c; i++ ) { //kdDebug( 60005 ) << "Loading file " << i << endl; - _config->setGroup( "File-" + QString::number( i ) ); + _config->setGroup( "File-" + TQString::number( i ) ); newBuffer( KRecBuffer::fromConfig( _config, _dir->qDir(), this ) ); } KRecGlobal::the()->message( i18n( "\'%1\' loaded." ).arg( filename ) ); @@ -103,7 +103,7 @@ KRecFile::KRecFile( const QString &filename, QObject* p, const char* n ) } KRecFile::~KRecFile() { kdDebug( 60005 ) << k_funcinfo << endl; - QValueList<KRecBuffer*>::iterator it; + TQValueList<KRecBuffer*>::iterator it; for ( it = _buffers.begin(); it != _buffers.end(); ++it ) delete ( *it ); _buffers.clear(); @@ -112,8 +112,8 @@ KRecFile::~KRecFile() { //kdDebug( 60005 ) << k_funcinfo << "done." << endl; } -QString KRecFile::filename() { return _filename; } -void KRecFile::filename( const QString &n ) { +TQString KRecFile::filename() { return _filename; } +void KRecFile::filename( const TQString &n ) { if ( _filename!=n ) { _filename = n; emit filenameChanged( _filename ); @@ -123,18 +123,18 @@ void KRecFile::filename( const QString &n ) { void KRecFile::writeData( Arts::mcopbyte* /*data*/, uint /*length*/ ) { kdDebug( 60005 ) << k_funcinfo << endl; } -void KRecFile::writeData( QByteArray* data ) { +void KRecFile::writeData( TQByteArray* data ) { kdDebug( 60005 ) << k_funcinfo << endl; if ( _currentBuffer!=-1 ) _buffers[ _currentBuffer ]->writeData( data ); _saved = false; } -void KRecFile::writeData( QByteArray& data ) { +void KRecFile::writeData( TQByteArray& data ) { if ( _currentBuffer!=-1 ) _buffers[ _currentBuffer ]->writeData( data ); _saved = false; } -void KRecFile::save( const QString &fname ) { - QString filetosave = fname; +void KRecFile::save( const TQString &fname ) { + TQString filetosave = fname; //kdDebug( 60005 ) << k_funcinfo << filename << endl; if ( saved() ) { @@ -144,7 +144,7 @@ void KRecFile::save( const QString &fname ) { KRecGlobal::the()->message( i18n( "Saving in progress..." ) ); filename( fname ); - QString tmpname; + TQString tmpname; { KTempFile *tmp = new KTempFile(); tmp->setAutoDelete( true ); @@ -156,7 +156,7 @@ void KRecFile::save( const QString &fname ) { KTar *tar = new KTar( tmpname, "application/x-gzip" ); tar->open( IO_WriteOnly ); int i=0; while ( fname.find( '/', i ) != -1 ) i++; // Find last '/' - QString basename = fname.right( fname.length()-i ); + TQString basename = fname.right( fname.length()-i ); if ( basename.endsWith( ".krec" ) ) basename = basename.left( basename.length()-5 ); else { @@ -172,16 +172,16 @@ void KRecFile::save( const QString &fname ) { _saved = true; } -void KRecFile::exportwave( const QString &filename ) { +void KRecFile::exportwave( const TQString &filename ) { kdDebug( 60005 ) << k_funcinfo << filename << endl; } -QByteArray* KRecFile::getData( int ) { +TQByteArray* KRecFile::getData( int ) { kdDebug( 60005 ) << k_funcinfo << endl; return 0; } -void KRecFile::getData( QByteArray& data ) { +void KRecFile::getData( TQByteArray& data ) { KRecBuffer* current = getTopBuffer_buffer( _pos ); if ( current ) { //kdDebug( 60005 ) << "_pos=" << _pos << "(" << samplesToOffset( _pos ) << ") current->startpos()=" << current->startpos() << "(" << samplesToOffset( current->startpos() ) << ") that is " << samplesToOffset( _pos - current->startpos() ) << endl; @@ -203,10 +203,10 @@ void KRecFile::newPos( int p ) { emit posChanged( _pos ); } } -void KRecFile::newPos( KRecBuffer* buffer, QIODevice::Offset p ) { +void KRecFile::newPos( KRecBuffer* buffer, TQIODevice::Offset p ) { newPos( buffer->startpos() + offsetToSamples( p ) ); } -void KRecFile::newSize( KRecBuffer* buffer, QIODevice::Offset p ) { +void KRecFile::newSize( KRecBuffer* buffer, TQIODevice::Offset p ) { if ( buffer->startpos() + offsetToSamples( p ) > _size ) { _size = buffer->startpos() + offsetToSamples( p ); } @@ -215,13 +215,13 @@ void KRecFile::newSize( KRecBuffer* buffer, QIODevice::Offset p ) { /// * * * Frames <-> Offset and more * * * -int KRecFile::offsetToSamples( QIODevice::Offset n ) const { +int KRecFile::offsetToSamples( TQIODevice::Offset n ) const { int out = n / channels(); if ( bits() == 16 ) out /= 2; return out; } -QIODevice::Offset KRecFile::samplesToOffset( int n ) const { - QIODevice::Offset out = n * channels(); +TQIODevice::Offset KRecFile::samplesToOffset( int n ) const { + TQIODevice::Offset out = n * channels(); if ( bits() == 16 ) out *= 2; return out; } @@ -237,7 +237,7 @@ void KRecFile::saveProps() { _config->writeEntry( "Files", _buffers.count() ); for ( uint i=0; i<_buffers.count(); i++ ) { //kdDebug( 60005 ) << "Writing config " << i << endl; - _config->setGroup( "File-" + QString::number( i ) ); + _config->setGroup( "File-" + TQString::number( i ) ); _buffers[ i ]->writeConfig( _config ); } _config->sync(); @@ -252,15 +252,15 @@ void KRecFile::loadProps() { /// * * * NewBuffer * * * -void KRecFile::newBuffer( const QString &filename ) { +void KRecFile::newBuffer( const TQString &filename ) { kdDebug( 60005 ) << k_funcinfo << filename << endl; newBuffer( new KRecBuffer( filename, _pos, true, this ) ); } void KRecFile::newBuffer( KRecBuffer* buffer ) { kdDebug( 60005 ) << k_funcinfo << endl; - connect( buffer, SIGNAL( posChanged( KRecBuffer*, QIODevice::Offset ) ), this, SLOT( newPos( KRecBuffer*, QIODevice::Offset ) ) ); - connect( buffer, SIGNAL( sizeChanged( KRecBuffer*, QIODevice::Offset ) ), this, SLOT( newSize( KRecBuffer*, QIODevice::Offset ) ) ); - connect( buffer, SIGNAL( deleteSelf( KRecBuffer* ) ), this, SLOT( deleteBuffer( KRecBuffer* ) ) ); + connect( buffer, TQT_SIGNAL( posChanged( KRecBuffer*, TQIODevice::Offset ) ), this, TQT_SLOT( newPos( KRecBuffer*, TQIODevice::Offset ) ) ); + connect( buffer, TQT_SIGNAL( sizeChanged( KRecBuffer*, TQIODevice::Offset ) ), this, TQT_SLOT( newSize( KRecBuffer*, TQIODevice::Offset ) ) ); + connect( buffer, TQT_SIGNAL( deleteSelf( KRecBuffer* ) ), this, TQT_SLOT( deleteBuffer( KRecBuffer* ) ) ); _buffers.append( buffer ); newSize( buffer, buffer->size() ); _currentBuffer = _buffers.findIndex( buffer ); @@ -269,7 +269,7 @@ void KRecFile::newBuffer( KRecBuffer* buffer ) { } void KRecFile::newBuffer() { kdDebug( 60005 ) << k_funcinfo << endl; - newBuffer( _dir->name() + "file" + QString::number( _buffers.count() ) + ".raw" ); + newBuffer( _dir->name() + "file" + TQString::number( _buffers.count() ) + ".raw" ); } void KRecFile::deleteBuffer( KRecBuffer* b ) { @@ -285,7 +285,7 @@ void KRecFile::deleteBuffer( KRecBuffer* b ) { /// * * * helper * * * KRecBuffer* KRecFile::getTopBuffer_buffer( int pos ) { //kdDebug( 60005 ) << k_funcinfo << pos << endl; - QValueList<KRecBuffer*>::iterator it = _buffers.begin(); + TQValueList<KRecBuffer*>::iterator it = _buffers.begin(); KRecBuffer* out = 0; while ( it != _buffers.end() ) { if ( ( *it )->startpos() <= pos && offsetToSamples( ( *it )->size() ) + ( *it )->startpos() > pos && ( *it )->active() ) @@ -300,16 +300,16 @@ int KRecFile::getTopBuffer_int( int pos ) { /// * * * KRecBuffer * * * -KRecBuffer::KRecBuffer( const QString &filename, int startpos, bool a, KRecFile* p, const char* n ) - : QObject( p,n ) +KRecBuffer::KRecBuffer( const TQString &filename, int startpos, bool a, KRecFile* p, const char* n ) + : TQObject( p,n ) , _krecfile( p ) - , _file( new QFile( filename ) ) - , _stream( new QDataStream( _file ) ) - , _fileinfo( new QFileInfo( filename ) ) + , _file( new TQFile( filename ) ) + , _stream( new TQDataStream( _file ) ) + , _fileinfo( new TQFileInfo( filename ) ) , _active( a ) , _pos( 0 ), _start( startpos ) , _title( _fileinfo->fileName() ) - , _comment( QString::null ) + , _comment( TQString::null ) { kdDebug( 60005 ) << k_funcinfo << filename << " " << startpos << endl; _open = _file->open( IO_Raw | IO_ReadWrite ); @@ -336,21 +336,21 @@ void KRecBuffer::writeConfig( KConfig* config ) { config->writeEntry( "Comment", _comment ); } -KRecBuffer* KRecBuffer::fromConfig( KConfig* config, QDir* dir, KRecFile* p, const char* n ) { +KRecBuffer* KRecBuffer::fromConfig( KConfig* config, TQDir* dir, KRecFile* p, const char* n ) { kdDebug( 60005 ) << k_funcinfo << config << endl; KRecBuffer* tmp = new KRecBuffer( dir->path() + "/" + config->readEntry( "Filename" ), config->readNumEntry( "StartPos" ), config->readBoolEntry( "Activated", true ), p, n ); tmp->setTitle( config->readEntry( "Title", tmp->filename() ) ); - tmp->setComment( config->readEntry( "Comment", QString::null ) ); + tmp->setComment( config->readEntry( "Comment", TQString::null ) ); return tmp; } void KRecBuffer::writeData( Arts::mcopbyte* /*data*/, uint /*length*/ ) { kdDebug( 60005 ) << k_funcinfo << endl; } -void KRecBuffer::writeData( QByteArray* data ) { +void KRecBuffer::writeData( TQByteArray* data ) { kdDebug( 60005 ) << k_funcinfo << endl; writeData( *data ); /* if ( _open ) { @@ -360,7 +360,7 @@ kdDebug( 60005 ) << k_funcinfo << endl; emit sizeChanged( this, size() ); }*/ } -void KRecBuffer::writeData( QByteArray& data ) { +void KRecBuffer::writeData( TQByteArray& data ) { //kdDebug( 60005 ) << k_funcinfo << endl; if ( _open ) { _file->at( _pos ); @@ -370,7 +370,7 @@ void KRecBuffer::writeData( QByteArray& data ) { } } -void KRecBuffer::getData( QByteArray& data ) { +void KRecBuffer::getData( TQByteArray& data ) { //kdDebug( 60005 ) << k_funcinfo << "data.size()" << data.size() << " _pos" << _pos << endl; if ( _pos > _file->size() ) kdWarning() << "Trying to access behind file!" << endl; @@ -390,7 +390,7 @@ void KRecBuffer::getData( QByteArray& data ) { } } -void KRecBuffer::setPos( QIODevice::Offset p ) { +void KRecBuffer::setPos( TQIODevice::Offset p ) { if ( p!=_pos ) { _pos = p; emit posChanged( this, _pos ); @@ -399,20 +399,20 @@ void KRecBuffer::setPos( QIODevice::Offset p ) { } int KRecBuffer::startpos() const { return _start; } -QIODevice::Offset KRecBuffer::size() const { return _file->size(); } +TQIODevice::Offset KRecBuffer::size() const { return _file->size(); } -QString KRecBuffer::filename() const { return _fileinfo->fileName(); } -QString KRecBuffer::title() const { return _title; } -QString KRecBuffer::comment() const { return _comment; } +TQString KRecBuffer::filename() const { return _fileinfo->fileName(); } +TQString KRecBuffer::title() const { return _title; } +TQString KRecBuffer::comment() const { return _comment; } -void KRecBuffer::setTitle( const QString &n ) { +void KRecBuffer::setTitle( const TQString &n ) { if ( _title != n ) { _title = n; emit somethingChanged(); } } -void KRecBuffer::setComment( const QString &n ) { +void KRecBuffer::setComment( const TQString &n ) { if ( _comment != n ) { _comment = n; emit somethingChanged(); |