diff options
Diffstat (limited to 'src/replaygainfilelist.cpp')
-rwxr-xr-x | src/replaygainfilelist.cpp | 380 |
1 files changed, 190 insertions, 190 deletions
diff --git a/src/replaygainfilelist.cpp b/src/replaygainfilelist.cpp index 2d71806..6f2eff2 100755 --- a/src/replaygainfilelist.cpp +++ b/src/replaygainfilelist.cpp @@ -6,13 +6,13 @@ #include "replaygain.h" #include "replaygainpluginloader.h" -#include <qdir.h> -#include <qpainter.h> -#include <qsimplerichtext.h> -#include <qapplication.h> -#include <qheader.h> -#include <qlayout.h> -#include <qtimer.h> +#include <tqdir.h> +#include <tqpainter.h> +#include <tqsimplerichtext.h> +#include <tqapplication.h> +#include <tqheader.h> +#include <tqlayout.h> +#include <tqtimer.h> #include <klocale.h> #include <kiconloader.h> @@ -33,8 +33,8 @@ // ### soundkonverter 0.4: give the 'track' and 'album' column a minimum width and fill the rest of the space with the 'file' column - make some margins, too -ReplayGainFileListItem::ReplayGainFileListItem( QListView* parent ) - : KListViewItem( parent ) +ReplayGainFileListItem::ReplayGainFileListItem( TQListView* tqparent ) + : KListViewItem( tqparent ) { m_type = File; mimeType = "application/octet-stream"; @@ -42,8 +42,8 @@ ReplayGainFileListItem::ReplayGainFileListItem( QListView* parent ) queued = false; } -// ReplayGainFileListItem::ReplayGainFileListItem( QListView* parent, QListViewItem* after ) -// : KListViewItem( parent, after ) +// ReplayGainFileListItem::ReplayGainFileListItem( TQListView* tqparent, TQListViewItem* after ) +// : KListViewItem( tqparent, after ) // { // m_type = File; // mimeType = "application/octet-stream"; @@ -51,8 +51,8 @@ ReplayGainFileListItem::ReplayGainFileListItem( QListView* parent ) // queued = false; // } -ReplayGainFileListItem::ReplayGainFileListItem( ReplayGainFileListItem* parent ) - : KListViewItem( parent ) +ReplayGainFileListItem::ReplayGainFileListItem( ReplayGainFileListItem* tqparent ) + : KListViewItem( tqparent ) { m_type = File; mimeType = "application/octet-stream"; @@ -63,59 +63,59 @@ ReplayGainFileListItem::ReplayGainFileListItem( ReplayGainFileListItem* parent ) ReplayGainFileListItem::~ReplayGainFileListItem() {} -void ReplayGainFileListItem::paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ) +void ReplayGainFileListItem::paintCell( TQPainter *p, const TQColorGroup &cg, int column, int width, int tqalignment ) { // NOTE speed up this function // NOTE calculate the red color - QColorGroup _cg( cg ); - QColor c; + TQColorGroup _cg( cg ); + TQColor c; if( column == ((ReplayGainFileList*)listView())->columnByName(i18n("File")) ) { int margin = listView()->itemMargin(); int w = width - 2*margin; int h = height(); - QRect textRect = p->boundingRect( margin, 0, w, h, alignment, text(column) ); + TQRect textRect = p->boundingRect( margin, 0, w, h, tqalignment, text(column) ); if( textRect.width() > w ) { - alignment = Qt::AlignRight | Qt::SingleLine; + tqalignment = TQt::AlignRight | TQt::SingleLine; } } if( isSelected() && addingReplayGain ) { - _cg.setColor( QColorGroup::Highlight, QColor( 215, 62, 62 ) ); - QListViewItem::paintCell( p, _cg, column, width, alignment ); + _cg.setColor( TQColorGroup::Highlight, TQColor( 215, 62, 62 ) ); + TQListViewItem::paintCell( p, _cg, column, width, tqalignment ); return; } else if( addingReplayGain && column != listView()->sortColumn() ) { - _cg.setColor( QColorGroup::Base, QColor( 255, 234, 234 ) ); - QListViewItem::paintCell( p, _cg, column, width, alignment ); + _cg.setColor( TQColorGroup::Base, TQColor( 255, 234, 234 ) ); + TQListViewItem::paintCell( p, _cg, column, width, tqalignment ); return; } else if( addingReplayGain && column == listView()->sortColumn() ) { - _cg.setColor( QColorGroup::Base, QColor( 247, 227, 227 ) ); - QListViewItem::paintCell( p, _cg, column, width, alignment ); + _cg.setColor( TQColorGroup::Base, TQColor( 247, 227, 227 ) ); + TQListViewItem::paintCell( p, _cg, column, width, tqalignment ); return; } if( isSelected() && queued ) { - _cg.setColor( QColorGroup::Highlight, QColor( 230, 232, 100 ) ); - QListViewItem::paintCell( p, _cg, column, width, alignment ); + _cg.setColor( TQColorGroup::Highlight, TQColor( 230, 232, 100 ) ); + TQListViewItem::paintCell( p, _cg, column, width, tqalignment ); return; } else if( queued && column != listView()->sortColumn() ) { - _cg.setColor( QColorGroup::Base, QColor( 255, 255, 190 ) ); - QListViewItem::paintCell( p, _cg, column, width, alignment ); + _cg.setColor( TQColorGroup::Base, TQColor( 255, 255, 190 ) ); + TQListViewItem::paintCell( p, _cg, column, width, tqalignment ); return; } else if( queued && column == listView()->sortColumn() ) { - _cg.setColor( QColorGroup::Base, QColor( 255, 243, 168 ) ); - QListViewItem::paintCell( p, _cg, column, width, alignment ); + _cg.setColor( TQColorGroup::Base, TQColor( 255, 243, 168 ) ); + TQListViewItem::paintCell( p, _cg, column, width, tqalignment ); return; } - KListViewItem::paintCell( p, _cg, column, width, alignment ); + KListViewItem::paintCell( p, _cg, column, width, tqalignment ); } void ReplayGainFileListItem::setType( Type type ) @@ -138,13 +138,13 @@ void ReplayGainFileListItem::updateReplayGainCells( TagData* tags ) } else { if( tags->track_gain != 210588 ) { - setText( ((ReplayGainFileList*)listView())->columnByName(i18n("Track")), QString().sprintf("%+.2f dB",tags->track_gain) ); + setText( ((ReplayGainFileList*)listView())->columnByName(i18n("Track")), TQString().sprintf("%+.2f dB",tags->track_gain) ); } else { setText( ((ReplayGainFileList*)listView())->columnByName(i18n("Track")), i18n("Unknown") ); } if( tags->album_gain != 210588 ) { - setText( ((ReplayGainFileList*)listView())->columnByName(i18n("Album")), QString().sprintf("%+.2f dB",tags->album_gain) ); + setText( ((ReplayGainFileList*)listView())->columnByName(i18n("Album")), TQString().sprintf("%+.2f dB",tags->album_gain) ); } else { setText( ((ReplayGainFileList*)listView())->columnByName(i18n("Album")), i18n("Unknown") ); @@ -152,7 +152,7 @@ void ReplayGainFileListItem::updateReplayGainCells( TagData* tags ) } } -int ReplayGainFileListItem::compare( QListViewItem* item, int column, bool ascending ) const +int ReplayGainFileListItem::compare( TQListViewItem* item, int column, bool ascending ) const { // NOTE looking at the types, not the strings would be better if( text(1) == "" && item->text(1) != "" ) return -1; @@ -160,8 +160,8 @@ int ReplayGainFileListItem::compare( QListViewItem* item, int column, bool ascen else return KListViewItem::compare( item, column, ascending ); } -ReplayGainFileList::ReplayGainFileList( TagEngine* _tagEngine, Config* _config, Logger* _logger, QWidget *parent, const char *name ) - : KListView( parent, name ) +ReplayGainFileList::ReplayGainFileList( TagEngine* _tagEngine, Config* _config, Logger* _logger, TQWidget *tqparent, const char *name ) + : KListView( tqparent, name ) { tagEngine = _tagEngine; config = _config; @@ -174,15 +174,15 @@ ReplayGainFileList::ReplayGainFileList( TagEngine* _tagEngine, Config* _config, processedTime = 0; addColumn( i18n("File"), 390 ); - setColumnWidthMode( 0, QListView::Manual ); + setColumnWidthMode( 0, TQListView::Manual ); addColumn( i18n("Track"), 90 ); - setColumnAlignment( 1, Qt::AlignRight ); + setColumnAlignment( 1, TQt::AlignRight ); addColumn( i18n("Album"), 90 ); - setColumnAlignment( 2, Qt::AlignRight ); + setColumnAlignment( 2, TQt::AlignRight ); - setSelectionMode( QListView::Extended ); + setSelectionMode( TQListView::Extended ); setAllColumnsShowFocus( true ); - setResizeMode( QListView::LastColumn ); + setResizeMode( TQListView::LastColumn ); setShowSortIndicator( true ); setSorting( 0 ); setRootIsDecorated( true ); @@ -190,66 +190,66 @@ ReplayGainFileList::ReplayGainFileList( TagEngine* _tagEngine, Config* _config, setDragEnabled( true ); setAcceptDrops( true ); - QGridLayout* grid = new QGridLayout( this, 2, 1, 11, 6 ); + TQGridLayout* grid = new TQGridLayout( this, 2, 1, 11, 6 ); grid->setRowStretch( 0, 1 ); grid->setRowStretch( 2, 1 ); grid->setColStretch( 0, 1 ); grid->setColStretch( 2, 1 ); - pScanStatus = new KProgress( this, "pScanStatus" ); - pScanStatus->setMinimumHeight( pScanStatus->height() ); - pScanStatus->setFormat( "%v / %m" ); - pScanStatus->hide(); - grid->addWidget( pScanStatus, 1, 1 ); + pScantqStatus = new KProgress( this, "pScantqStatus" ); + pScantqStatus->setMinimumHeight( pScantqStatus->height() ); + pScantqStatus->setFormat( "%v / %m" ); + pScantqStatus->hide(); + grid->addWidget( pScantqStatus, 1, 1 ); grid->setColStretch( 1, 2 ); contextMenu = new KPopupMenu( this ); - connect( this, SIGNAL(contextMenuRequested(QListViewItem*,const QPoint&,int)), - this, SLOT(showContextMenu(QListViewItem*,const QPoint&,int)) + connect( TQT_TQOBJECT(this), TQT_SIGNAL(contextMenuRequested(TQListViewItem*,const TQPoint&,int)), + TQT_TQOBJECT(this), TQT_SLOT(showContextMenu(TQListViewItem*,const TQPoint&,int)) ); // we haven't got access to the action collection of soundKonverter, so let's create a new one actionCollection = new KActionCollection( this ); - calc_gain = new KAction( i18n("Calculate Replay Gain tags"), "apply", 0, this, SLOT(calcSelectedItemsGain()), actionCollection, "calc_album" ); - remove_gain = new KAction( i18n("Remove Replay Gain tags"), "cancel", 0, this, SLOT(removeSelectedItemsGain()), actionCollection, "remove_gain" ); - remove = new KAction( i18n("Remove"), "edittrash", Key_Delete, this, SLOT(removeSelectedItems()), actionCollection, "remove" ); - paste = new KAction( i18n("Paste"), "editpaste", 0, this, 0, actionCollection, "paste" ); - newalbum = new KAction( i18n("New album"), "filenew", 0, this, SLOT(createNewAlbum()), actionCollection, "newalbum" ); - open_albums = new KAction( i18n("Open all albums"), "view_tree", 0, this, SLOT(openAlbums()), actionCollection, "open_albums" ); - close_albums = new KAction( i18n("Cloase all albums"), "view_text", 0, this, SLOT(closeAlbums()), actionCollection, "close_albums" ); + calc_gain = new KAction( i18n("Calculate Replay Gain tags"), "apply", 0, TQT_TQOBJECT(this), TQT_SLOT(calcSelectedItemsGain()), actionCollection, "calc_album" ); + remove_gain = new KAction( i18n("Remove Replay Gain tags"), "cancel", 0, TQT_TQOBJECT(this), TQT_SLOT(removeSelectedItemsGain()), actionCollection, "remove_gain" ); + remove = new KAction( i18n("Remove"), "edittrash", Key_Delete, TQT_TQOBJECT(this), TQT_SLOT(removeSelectedItems()), actionCollection, "remove" ); + paste = new KAction( i18n("Paste"), "editpaste", 0, TQT_TQOBJECT(this), 0, actionCollection, "paste" ); + newalbum = new KAction( i18n("New album"), "filenew", 0, TQT_TQOBJECT(this), TQT_SLOT(createNewAlbum()), actionCollection, "newalbum" ); + open_albums = new KAction( i18n("Open all albums"), "view_tree", 0, TQT_TQOBJECT(this), TQT_SLOT(openAlbums()), actionCollection, "open_albums" ); + close_albums = new KAction( i18n("Cloase all albums"), "view_text", 0, TQT_TQOBJECT(this), TQT_SLOT(closeAlbums()), actionCollection, "close_albums" ); replayGain = new ReplayGain( config, logger ); - bubble = new QSimpleRichText( i18n( "<div align=center>" + bubble = new TQSimpleRichText( i18n( "<div align=center>" "<h3>Replay Gain Tool</h3>" "With this tool you can add Replay Gain tags to your audio files and remove them." //"<br>Replay Gain adds a volume correction information to the files for playing them at the same volume." //"Replay Gain allows you to play all audio files at the same volume level without modifying the audio data." "<br>Replay Gain adds a volume correction information to the files so that they can be played at an equal volume level." // "<br><a href=\"documenation:replaygaintool\">Learn more about Replay Gain ...</a><br/>" - "</div>" ), QApplication::font() ); + "</div>" ), TQApplication::font() ); - connect( header(), SIGNAL(sizeChange( int, int, int )), - SLOT(columnResizeEvent( int, int, int )) + connect( header(), TQT_SIGNAL(sizeChange( int, int, int )), + TQT_SLOT(columnResizeEvent( int, int, int )) ); - connect( this, SIGNAL( dropped(QDropEvent*, QListViewItem*, QListViewItem*) ), - SLOT( slotDropped(QDropEvent*, QListViewItem*, QListViewItem*) ) + connect( TQT_TQOBJECT(this), TQT_SIGNAL( dropped(TQDropEvent*, TQListViewItem*, TQListViewItem*) ), + TQT_SLOT( slotDropped(TQDropEvent*, TQListViewItem*, TQListViewItem*) ) ); process = new KProcess(); - connect( process, SIGNAL(receivedStdout(KProcess*,char*,int)), - this, SLOT(processOutput(KProcess*,char*,int)) + connect( process, TQT_SIGNAL(receivedStdout(KProcess*,char*,int)), + TQT_TQOBJECT(this), TQT_SLOT(processOutput(KProcess*,char*,int)) ); - connect( process, SIGNAL(receivedStderr(KProcess*,char*,int)), - this, SLOT(processOutput(KProcess*,char*,int)) + connect( process, TQT_SIGNAL(receivedStderr(KProcess*,char*,int)), + TQT_TQOBJECT(this), TQT_SLOT(processOutput(KProcess*,char*,int)) ); - connect( process, SIGNAL(processExited(KProcess*)), - this, SLOT(processExit(KProcess*)) + connect( process, TQT_SIGNAL(processExited(KProcess*)), + TQT_TQOBJECT(this), TQT_SLOT(processExit(KProcess*)) ); - tUpdateProgress = new QTimer( this, "tUpdateProgress" ); - connect( tUpdateProgress, SIGNAL(timeout()), - this, SLOT(update()) + tUpdateProgress = new TQTimer( this, "tUpdateProgress" ); + connect( tUpdateProgress, TQT_SIGNAL(timeout()), + TQT_TQOBJECT(this), TQT_SLOT(update()) ); } @@ -258,7 +258,7 @@ ReplayGainFileList::~ReplayGainFileList() delete replayGain; } -int ReplayGainFileList::columnByName( const QString& name ) +int ReplayGainFileList::columnByName( const TQString& name ) { for( int i = 0; i < columns(); ++i ) { if( columnText( i ) == name ) return i; @@ -266,26 +266,26 @@ int ReplayGainFileList::columnByName( const QString& name ) return -1; } -void ReplayGainFileList::viewportPaintEvent( QPaintEvent* e ) +void ReplayGainFileList::viewportPaintEvent( TQPaintEvent* e ) { KListView::viewportPaintEvent( e ); // the bubble help if( childCount() == 0 ) { - QPainter p( viewport() ); + TQPainter p( viewport() ); bubble->setWidth( width() - 50 ); const uint w = bubble->width() + 20; const uint h = bubble->height() + 20; - p.setBrush( colorGroup().background() ); + p.setBrush( tqcolorGroup().background() ); p.drawRoundRect( 15, 15, w, h, (8*200)/w, (8*200)/h ); - bubble->draw( &p, 20, 20, QRect(), colorGroup() ); + bubble->draw( &p, 20, 20, TQRect(), tqcolorGroup() ); } } -void ReplayGainFileList::viewportResizeEvent( QResizeEvent* ) +void ReplayGainFileList::viewportResizeEvent( TQResizeEvent* ) { // needed for correct redraw of bubble help triggerUpdate(); @@ -297,22 +297,22 @@ void ReplayGainFileList::columnResizeEvent( int, int, int ) triggerUpdate(); } -bool ReplayGainFileList::acceptDrag( QDropEvent* e ) const +bool ReplayGainFileList::acceptDrag( TQDropEvent* e ) const { return ( e->source() == viewport() || KURLDrag::canDecode(e) ); // TODO verify the files } -void ReplayGainFileList::slotDropped( QDropEvent* e, QListViewItem*, QListViewItem* ) +void ReplayGainFileList::slotDropped( TQDropEvent* e, TQListViewItem*, TQListViewItem* ) { - QString file; + TQString file; KURL::List list; if( KURLDrag::decode( e, list ) ) { for( KURL::List::Iterator it = list.begin(); it != list.end(); ++it ) { // TODO verify the files (necessary when multiple files are being dropped) - file = QDir::convertSeparators( (*it).pathOrURL() ); - QFileInfo fileInfo( file ); + file = TQDir::convertSeparators( (*it).pathOrURL() ); + TQFileInfo fileInfo( file ); if( fileInfo.isDir() ) { addDir( file ); @@ -325,12 +325,12 @@ void ReplayGainFileList::slotDropped( QDropEvent* e, QListViewItem*, QListViewIt } } -void ReplayGainFileList::contentsDragEnterEvent( QDragEnterEvent *e ) +void ReplayGainFileList::contentsDragEnterEvent( TQDragEnterEvent *e ) { e->accept( e->source() == viewport() || KURLDrag::canDecode(e) ); } -void ReplayGainFileList::contentsDragMoveEvent( QDragMoveEvent *e ) +void ReplayGainFileList::contentsDragMoveEvent( TQDragMoveEvent *e ) { // the mouse has moved while dragging some stuff // if the file is added from an external app, don't let the user select the position to drop @@ -347,7 +347,7 @@ void ReplayGainFileList::contentsDragMoveEvent( QDragMoveEvent *e ) } // translate the coordinates of the mouse pointer - QPoint vp = contentsToViewport( e->pos() ); + TQPoint vp = contentsToViewport( e->pos() ); // and get the list view item below the pointer ReplayGainFileListItem* item = itemAt( vp ); @@ -368,7 +368,7 @@ void ReplayGainFileList::contentsDragMoveEvent( QDragMoveEvent *e ) KListView::contentsDragMoveEvent( e ); } -void ReplayGainFileList::contentsDropEvent( QDropEvent *e ) +void ReplayGainFileList::contentsDropEvent( TQDropEvent *e ) { // the stuff has been dropped emit dropped( e, 0, 0 ); // NOTE it works this way @@ -379,17 +379,17 @@ void ReplayGainFileList::contentsDropEvent( QDropEvent *e ) cleanItemHighlighter(); // get the item below the mouse pointer, where the stuff has been dropped - QPoint vp = contentsToViewport( e->pos() ); + TQPoint vp = contentsToViewport( e->pos() ); ReplayGainFileListItem* newParent = itemAt( vp ); - // if the item is a 'file', use the parent item + // if the item is a 'file', use the tqparent item if( newParent && newParent->type() != ReplayGainFileListItem::Album ) { - newParent = newParent->parent(); + newParent = newParent->tqparent(); } - // TODO if the mouse is on the left side under the parent but not under the sibling item, use the parent + // TODO if the mouse is on the left side under the tqparent but not under the sibling item, use the tqparent /* if( newParent == 0 && vp.x() >= 2*treeStepSize() ) { - QPoint p = vp; + TQPoint p = vp; int height = 0; if( firstChild() ) { height = firstChild()->height(); @@ -397,7 +397,7 @@ void ReplayGainFileList::contentsDropEvent( QDropEvent *e ) p.setY( p.y() - height ); ReplayGainFileListItem* it = itemAt( p ); if( it && it->type() != ReplayGainFileListItem::Album ) { - newParent = it->parent(); + newParent = it->tqparent(); } else if( it ) { newParent = it; @@ -495,32 +495,32 @@ void ReplayGainFileList::contentsDropEvent( QDropEvent *e ) } } -int ReplayGainFileList::listDir( const QString& directory, QStringList filter, bool recursive, bool fast, int count ) +int ReplayGainFileList::listDir( const TQString& directory, TQStringList filter, bool recursive, bool fast, int count ) { // NOTE speed up? - QDir dir( directory ); - dir.setFilter( QDir::Files | QDir::Dirs | QDir::NoSymLinks | QDir::Readable ); + TQDir dir( directory ); + dir.setFilter( TQDir::Files | TQDir::Dirs | TQDir::NoSymLinks | TQDir::Readable ); - QStringList list = dir.entryList(); + TQStringList list = dir.entryList(); - for( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { + for( TQStringList::Iterator it = list.begin(); it != list.end(); ++it ) { if( *it == "." || *it == ".." ) continue; - QFileInfo fileInfo( directory + "/" + *it ); + TQFileInfo fileInfo( directory + "/" + *it ); if( fast ) { if( fileInfo.isDir() && recursive ) { count = listDir( directory + "/" + *it, filter, recursive, fast, count ); } else if( !fileInfo.isDir() || !recursive ) { // NOTE checking for isFile may not work with all file names // NOTE filter feature - for( QStringList::Iterator jt = filter.begin(); jt != filter.end(); ++jt ) { - if( (*it).endsWith("."+(*jt),false) ) { + for( TQStringList::Iterator jt = filter.begin(); jt != filter.end(); ++jt ) { + if( (*it).tqendsWith("."+(*jt),false) ) { count++; - pScanStatus->setTotalSteps( count ); + pScantqStatus->setTotalSteps( count ); break; } } if( filter.first() == "" ) { count++; - pScanStatus->setTotalSteps( count ); + pScantqStatus->setTotalSteps( count ); } } } @@ -530,18 +530,18 @@ int ReplayGainFileList::listDir( const QString& directory, QStringList filter, b } else if( !fileInfo.isDir() || !recursive ) { // NOTE checking for isFile may not work with all file names // NOTE filter feature - for( QStringList::Iterator jt = filter.begin(); jt != filter.end(); ++jt ) { - if( (*it).endsWith("."+(*jt),false) ) { + for( TQStringList::Iterator jt = filter.begin(); jt != filter.end(); ++jt ) { + if( (*it).tqendsWith("."+(*jt),false) ) { addFile( KURL::encode_string(directory + "/" + *it) ); count++; - pScanStatus->setProgress( count ); + pScantqStatus->setProgress( count ); break; } } if( filter.first() == "" ) { addFile( KURL::encode_string(directory + "/" + *it) ); count++; - pScanStatus->setProgress( count ); + pScantqStatus->setProgress( count ); } } } @@ -550,7 +550,7 @@ int ReplayGainFileList::listDir( const QString& directory, QStringList filter, b return count; } -void ReplayGainFileList::showContextMenu( QListViewItem* item, const QPoint& point, int ) +void ReplayGainFileList::showContextMenu( TQListViewItem* item, const TQPoint& point, int ) { // remove all items from the context menu contextMenu->clear(); @@ -581,11 +581,11 @@ void ReplayGainFileList::showContextMenu( QListViewItem* item, const QPoint& poi contextMenu->popup( point ); } -void ReplayGainFileList::addFile( const QString& file ) +void ReplayGainFileList::addFile( const TQString& file ) { - QString filename = file; - QString filePathName; - QString device; + TQString filename = file; + TQString filePathName; + TQString device; if( filename.left( 1 ) == "/" ) { filePathName = filename; @@ -597,13 +597,13 @@ void ReplayGainFileList::addFile( const QString& file ) else if( filename.left( 13 ) == "system:/home/" ) { filePathName = filename; filePathName.remove( 0, 13 ); - filePathName = QDir::homeDirPath() + "/" + filePathName; + filePathName = TQDir::homeDirPath() + "/" + filePathName; } else if( filename.left( 14 ) == "system:/users/" || filename.left( 6 ) == "home:/" ) { int length = ( filename.left(6) == "home:/" ) ? 6 : 14; - QString username = filename; + TQString username = filename; username.remove( 0, length ); - username = username.left( username.find("/") ); + username = username.left( username.tqfind("/") ); filePathName = filename; filePathName.remove( 0, length + username.length() ); KUser user( username ); @@ -613,7 +613,7 @@ void ReplayGainFileList::addFile( const QString& file ) int length = ( filename.left(7) == "media:/" ) ? 7 : 14; device = filename; device.remove( 0, length ); - device = "/dev/" + device.left( device.find( "/" ) ); + device = "/dev/" + device.left( device.tqfind( "/" ) ); KMountPoint::List mountPoints = KMountPoint::possibleMountPoints(); @@ -634,7 +634,7 @@ void ReplayGainFileList::addFile( const QString& file ) TagData* tags = tagEngine->readTags( KURL::decode_string(filePathName) ); if( !tags || tags->album.isEmpty() ) { ReplayGainFileListItem* item = new ReplayGainFileListItem( this ); - item->originalFileFormat = filePathName.right( filePathName.length() - filePathName.findRev(".") - 1 ); + item->originalFileFormat = filePathName.right( filePathName.length() - filePathName.tqfindRev(".") - 1 ); item->mimeType = KMimeType::findByFileContent( filePathName )->name(); item->fileFormat = KMimeType::findByFileContent( filePathName )->patterns().first(); if( item->mimeType.isEmpty() || item->mimeType == "application/octet-stream" || item->mimeType == "text/plain" ) { @@ -651,30 +651,30 @@ void ReplayGainFileList::addFile( const QString& file ) else { FormatItem* formatItem = config->getFormatItem( item->mimeType ); if( formatItem && formatItem->size > 0 ) { - QFileInfo fileInfo( filePathName ); + TQFileInfo fileInfo( filePathName ); item->time = fileInfo.size() / formatItem->size; } else { item->time = 210; } } - item->setText( columnByName(i18n("File")), KURL::decode_string(filePathName).replace("%2f","/").replace("%%","%") ); + item->setText( columnByName(i18n("File")), KURL::decode_string(filePathName).tqreplace("%2f","/").tqreplace("%%","%") ); if( tags && tags->track_gain != 210588 ) { - item->setText( columnByName(i18n("Track")), QString().sprintf("%+.2f dB",tags->track_gain) ); + item->setText( columnByName(i18n("Track")), TQString().sprintf("%+.2f dB",tags->track_gain) ); } else { item->setText( columnByName(i18n("Track")), i18n("Unknown") ); } if( tags && tags->album_gain != 210588 ) { - item->setText( columnByName(i18n("Album")), QString().sprintf("%+.2f dB",tags->album_gain) ); + item->setText( columnByName(i18n("Album")), TQString().sprintf("%+.2f dB",tags->album_gain) ); } else { item->setText( columnByName(i18n("Album")), i18n("Unknown") ); } } else { - QString mimeType = KMimeType::findByFileContent( filePathName )->name(); - QString fileFormat = KMimeType::findByFileContent( filePathName )->patterns().first(); + TQString mimeType = KMimeType::findByFileContent( filePathName )->name(); + TQString fileFormat = KMimeType::findByFileContent( filePathName )->patterns().first(); if( mimeType.isEmpty() || mimeType == "application/octet-stream" || mimeType == "text/plain" ) { mimeType = KMimeType::findByURL( filePathName.lower() )->name(); fileFormat = KMimeType::findByURL( filePathName.lower() )->patterns().first(); @@ -685,23 +685,23 @@ void ReplayGainFileList::addFile( const QString& file ) } for( ReplayGainFileListItem* it = firstChild(); it != 0; it = it->nextSibling() ) { - //if( it->text(0) == QString(tags->artist+" - "+tags->album) ) { + //if( it->text(0) == TQString(tags->artist+" - "+tags->album) ) { if( it->text(columnByName(i18n("File"))) == tags->album && it->type() == ReplayGainFileListItem::Album && it->mimeType == mimeType ) { ReplayGainFileListItem* item = new ReplayGainFileListItem( it ); - item->originalFileFormat = filePathName.right( filePathName.length() - filePathName.findRev(".") - 1 ); + item->originalFileFormat = filePathName.right( filePathName.length() - filePathName.tqfindRev(".") - 1 ); item->filePathName = filePathName; item->mimeType = mimeType; item->fileFormat = fileFormat; item->time = tags->length; - item->setText( columnByName(i18n("File")), KURL::decode_string(filePathName).replace("%2f","/").replace("%%","%") ); + item->setText( columnByName(i18n("File")), KURL::decode_string(filePathName).tqreplace("%2f","/").tqreplace("%%","%") ); if( tags->track_gain != 210588 ) { - item->setText( columnByName(i18n("Track")), QString().sprintf("%+.2f dB",tags->track_gain) ); + item->setText( columnByName(i18n("Track")), TQString().sprintf("%+.2f dB",tags->track_gain) ); } else { item->setText( columnByName(i18n("Track")), i18n("Unknown") ); } if( tags->album_gain != 210588 ) { - item->setText( columnByName(i18n("Album")), QString().sprintf("%+.2f dB",tags->album_gain) ); + item->setText( columnByName(i18n("Album")), TQString().sprintf("%+.2f dB",tags->album_gain) ); } else { item->setText( columnByName(i18n("Album")), i18n("Unknown") ); @@ -711,27 +711,27 @@ void ReplayGainFileList::addFile( const QString& file ) } // | } // | if( tags ) { // <--' - ReplayGainFileListItem* parent = new ReplayGainFileListItem( this ); - //parent->setText( 0, tags->artist+" - "+tags->album ); - parent->setText( columnByName(i18n("File")), tags->album ); - parent->setType( ReplayGainFileListItem::Album ); - parent->mimeType = mimeType; - parent->fileFormat = fileFormat; - ReplayGainFileListItem* item = new ReplayGainFileListItem( parent ); - item->originalFileFormat = filePathName.right( filePathName.length() - filePathName.findRev(".") - 1 ); + ReplayGainFileListItem* tqparent = new ReplayGainFileListItem( this ); + //tqparent->setText( 0, tags->artist+" - "+tags->album ); + tqparent->setText( columnByName(i18n("File")), tags->album ); + tqparent->setType( ReplayGainFileListItem::Album ); + tqparent->mimeType = mimeType; + tqparent->fileFormat = fileFormat; + ReplayGainFileListItem* item = new ReplayGainFileListItem( tqparent ); + item->originalFileFormat = filePathName.right( filePathName.length() - filePathName.tqfindRev(".") - 1 ); item->filePathName = filePathName; item->mimeType = mimeType; item->fileFormat = fileFormat; item->time = tags->length; - item->setText( columnByName(i18n("File")), KURL::decode_string(filePathName).replace("%2f","/").replace("%%","%") ); + item->setText( columnByName(i18n("File")), KURL::decode_string(filePathName).tqreplace("%2f","/").tqreplace("%%","%") ); if( tags->track_gain != 210588 ) { - item->setText( columnByName(i18n("Track")), QString().sprintf("%+.2f dB",tags->track_gain) ); + item->setText( columnByName(i18n("Track")), TQString().sprintf("%+.2f dB",tags->track_gain) ); } else { item->setText( columnByName(i18n("Track")), i18n("Unknown") ); } if( tags->album_gain != 210588 ) { - item->setText( columnByName(i18n("Album")), QString().sprintf("%+.2f dB",tags->album_gain) ); + item->setText( columnByName(i18n("Album")), TQString().sprintf("%+.2f dB",tags->album_gain) ); } else { item->setText( columnByName(i18n("Album")), i18n("Unknown") ); @@ -740,17 +740,17 @@ void ReplayGainFileList::addFile( const QString& file ) } } -void ReplayGainFileList::addDir( const QString& directory, const QStringList& filter, bool recursive ) +void ReplayGainFileList::addDir( const TQString& directory, const TQStringList& filter, bool recursive ) { - pScanStatus->setProgress( 0 ); - pScanStatus->setTotalSteps( 0 ); - pScanStatus->show(); // show the status while scanning the directories + pScantqStatus->setProgress( 0 ); + pScantqStatus->setTotalSteps( 0 ); + pScantqStatus->show(); // show the status while scanning the directories kapp->processEvents(); int count = listDir( directory, filter, recursive, true ); listDir( directory, filter, recursive ); - pScanStatus->hide(); // hide the status bar, when the scan is done + pScantqStatus->hide(); // hide the status bar, when the scan is done } void ReplayGainFileList::openAlbums() @@ -836,18 +836,18 @@ void ReplayGainFileList::calcSelectedItemsGain() if( item->type() == ReplayGainFileListItem::File ) { if( item->isSelected() ) { item->queued = true; - item->repaint(); + item->tqrepaint(); item->mode = ReplayGainFileListItem::force; } } else { if( item->isSelected() ) { item->queued = true; - item->repaint(); + item->tqrepaint(); item->mode = ReplayGainFileListItem::force; for( ReplayGainFileListItem* sub_item = item->firstChild(); sub_item != 0; sub_item = sub_item->nextSibling() ) { sub_item->queued = true; - sub_item->repaint(); + sub_item->tqrepaint(); sub_item->mode = ReplayGainFileListItem::force; } } @@ -855,11 +855,11 @@ void ReplayGainFileList::calcSelectedItemsGain() for( ReplayGainFileListItem* sub_item = item->firstChild(); sub_item != 0; sub_item = sub_item->nextSibling() ) { if( sub_item->isSelected() ) { item->queued = true; - item->repaint(); + item->tqrepaint(); item->mode = ReplayGainFileListItem::force; for( ReplayGainFileListItem* sub_item2 = item->firstChild(); sub_item2 != 0; sub_item2 = sub_item2->nextSibling() ) { sub_item2->queued = true; - sub_item2->repaint(); + sub_item2->tqrepaint(); sub_item2->mode = ReplayGainFileListItem::force; } break; @@ -878,18 +878,18 @@ void ReplayGainFileList::removeSelectedItemsGain() if( item->type() == ReplayGainFileListItem::File ) { if( item->isSelected() && !item->addingReplayGain ) { item->queued = true; - item->repaint(); + item->tqrepaint(); item->mode = ReplayGainFileListItem::remove; } } else { if( item->isSelected() && !item->addingReplayGain ) { item->queued = true; - item->repaint(); + item->tqrepaint(); item->mode = ReplayGainFileListItem::remove; for( ReplayGainFileListItem* sub_item = item->firstChild(); sub_item != 0; sub_item = sub_item->nextSibling() ) { sub_item->queued = true; - sub_item->repaint(); + sub_item->tqrepaint(); sub_item->mode = ReplayGainFileListItem::remove; } } @@ -897,7 +897,7 @@ void ReplayGainFileList::removeSelectedItemsGain() for( ReplayGainFileListItem* sub_item = item->firstChild(); sub_item != 0; sub_item = sub_item->nextSibling() ) { if( sub_item->isSelected() && !sub_item->addingReplayGain ) { sub_item->queued = true; - sub_item->repaint(); + sub_item->tqrepaint(); sub_item->mode = ReplayGainFileListItem::remove; } } @@ -913,10 +913,10 @@ void ReplayGainFileList::calcReplayGain( ReplayGainFileListItem* item ) logger->log( logID, "Mime Type: " + item->mimeType ); logger->log( logID, i18n("Applying Replay Gain") ); - QStringList fileList; + TQStringList fileList; bool force = false; if( mode & ReplayGainFileListItem::force ) force = true; - QString album_gain = ""; + TQString album_gain = ""; bool skip = true; timeCount = 0; @@ -926,18 +926,18 @@ void ReplayGainFileList::calcReplayGain( ReplayGainFileListItem* item ) if( item->type() == ReplayGainFileListItem::Album ) { item->queued = false; item->addingReplayGain = true; - item->repaint(); + item->tqrepaint(); for( ReplayGainFileListItem* sub_item = item->firstChild(); sub_item != 0; sub_item = sub_item->nextSibling() ) { if( sub_item->queued && sub_item->mode & ReplayGainFileListItem::force ) force = true; // NOTE can this be replaced by checking item? sub_item->queued = false; sub_item->addingReplayGain = true; - sub_item->repaint(); + sub_item->tqrepaint(); fileList += sub_item->filePathName; files++; timeCount += sub_item->time; - QString current_gain = sub_item->text( columnByName(i18n("Album")) ); + TQString current_gain = sub_item->text( columnByName(i18n("Album")) ); if( album_gain == "" ) album_gain = current_gain; else if( album_gain != current_gain ) skip = false; } @@ -953,10 +953,10 @@ void ReplayGainFileList::calcReplayGain( ReplayGainFileListItem* item ) else { logger->processCompleted( logID, 0 ); item->addingReplayGain = false; - item->repaint(); + item->tqrepaint(); for( ReplayGainFileListItem* sub_item = item->firstChild(); sub_item != 0; sub_item = sub_item->nextSibling() ) { sub_item->addingReplayGain = false; - sub_item->repaint(); + sub_item->tqrepaint(); } processNextFile(); } @@ -966,7 +966,7 @@ void ReplayGainFileList::calcReplayGain( ReplayGainFileListItem* item ) item->queued = false; item->addingReplayGain = true; - item->repaint(); + item->tqrepaint(); files = 1; timeCount = item->time; @@ -989,13 +989,13 @@ void ReplayGainFileList::removeReplayGain( ReplayGainFileListItem* item ) if( item->type() == ReplayGainFileListItem::File ) { item->queued = false; item->addingReplayGain = true; - item->repaint(); + item->tqrepaint(); timeCount = item->time; replayGain->apply( item->filePathName, item->mimeType, process, logID, ReplayGain::remove ); } else { item->queued = false; - item->repaint(); + item->tqrepaint(); processNextFile(); } } @@ -1074,9 +1074,9 @@ void ReplayGainFileList::processNextFile() ReplayGainFileListItem* currentSubItem = 0; if( !currentItem ) { currentItem = firstChild(); } - else if( currentItem->type() == ReplayGainFileListItem::File && currentItem->parent() == 0 ) { currentItem = currentItem->nextSibling(); } + else if( currentItem->type() == ReplayGainFileListItem::File && currentItem->tqparent() == 0 ) { currentItem = currentItem->nextSibling(); } else if( currentItem->type() == ReplayGainFileListItem::Album ) { currentItem = currentItem->nextSibling(); } - else { currentSubItem = currentItem->nextSibling(); currentItem = currentItem->parent(); if( !currentSubItem ) { currentItem = currentItem->nextSibling(); } } + else { currentSubItem = currentItem->nextSibling(); currentItem = currentItem->tqparent(); if( !currentSubItem ) { currentItem = currentItem->nextSibling(); } } for( ReplayGainFileListItem* item = currentItem; item != 0; item = item->nextSibling() ) { if( item->type() == ReplayGainFileListItem::File ) { @@ -1133,11 +1133,11 @@ void ReplayGainFileList::processOutput( KProcess* proc, char* data, int ) { int iPercent = 0, iTime = 0, iPos = 0, iNum = 0; - QString log_data = data; - log_data.replace("\n","\\n"); - log_data.replace("\t","\\t"); - log_data.replace("\r","\\r"); - log_data.replace("\b","\\b"); + TQString log_data = data; + log_data.tqreplace("\n","\\n"); + log_data.tqreplace("\t","\\t"); + log_data.tqreplace("\r","\\r"); + log_data.tqreplace("\b","\\b"); logger->log( logID, " " + i18n("Output") + ": " + log_data ); ReplayGainPlugin* plugin = config->replaygainForFormat( currentItem->mimeType ); @@ -1150,28 +1150,28 @@ void ReplayGainFileList::processOutput( KProcess* proc, char* data, int ) return; } - QString outputPattern = ( files > 1 ) ? plugin->replaygain.output_multiple : plugin->replaygain.output_single; - //outputPattern.replace( "%i", "%p" ); // for compatibility with old plugins + TQString outputPattern = ( files > 1 ) ? plugin->replaygain.output_multiple : plugin->replaygain.output_single; + //outputPattern.tqreplace( "%i", "%p" ); // for compatibility with old plugins - if( outputPattern.find("%p") != -1 || outputPattern.find("%a") != -1 ) { - outputPattern.replace( "%p", "%i" ); - //outputPattern.replace( "%a", "%i" ); // for compatibility with old plugins + if( outputPattern.tqfind("%p") != -1 || outputPattern.tqfind("%a") != -1 ) { + outputPattern.tqreplace( "%p", "%i" ); + //outputPattern.tqreplace( "%a", "%i" ); // for compatibility with old plugins sscanf( data, outputPattern, &iPercent ); } - /*else if( outputPattern.find("%t") != -1 ) { // NOTE a little bit complicated and not necessary - outputPattern.replace( "%t", "%i" ); + /*else if( outputPattern.tqfind("%t") != -1 ) { // NOTE a little bit complicated and not necessary + outputPattern.tqreplace( "%t", "%i" ); sscanf( data, outputPattern, &iTime ); iPercent = iTime * 100 / currentItem->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.tqfind("%0") != -1 && outputPattern.tqfind("%1") != -1 ) { + if( outputPattern.tqfind("%0") < outputPattern.tqfind("%1") ) { + outputPattern.tqreplace( "%0", "%i" ); + outputPattern.tqreplace( "%1", "%i" ); sscanf( data, outputPattern, &iPos, &iNum ); } else { - outputPattern.replace( "%0", "%i" ); - outputPattern.replace( "%1", "%i" ); + outputPattern.tqreplace( "%0", "%i" ); + outputPattern.tqreplace( "%1", "%i" ); sscanf( data, outputPattern, &iNum, &iPos ); } if( iPos != 0 && iNum != 0 ) iPercent = iPos * 100 / iNum; @@ -1201,43 +1201,43 @@ void ReplayGainFileList::processExit( KProcess* proc ) if( item->addingReplayGain ) { processedTime += item->time; item->addingReplayGain = false; - item->repaint(); + item->tqrepaint(); item->updateReplayGainCells( tagEngine->readTags(KURL::decode_string(item->filePathName)) ); } if( item->queued && proc->signalled() ) { item->queued = false; - item->repaint(); + item->tqrepaint(); } } else { if( item->addingReplayGain ) { item->addingReplayGain = false; - item->repaint(); + item->tqrepaint(); for( ReplayGainFileListItem* sub_item = item->firstChild(); sub_item != 0; sub_item = sub_item->nextSibling() ) { processedTime += sub_item->time; sub_item->addingReplayGain = false; - sub_item->repaint(); + sub_item->tqrepaint(); sub_item->updateReplayGainCells( tagEngine->readTags(KURL::decode_string(sub_item->filePathName)) ); } } if( item->queued && proc->signalled() ) { item->queued = false; - item->repaint(); + item->tqrepaint(); for( ReplayGainFileListItem* sub_item = item->firstChild(); sub_item != 0; sub_item = sub_item->nextSibling() ) { sub_item->queued = false; - sub_item->repaint(); + sub_item->tqrepaint(); } } for( ReplayGainFileListItem* sub_item = item->firstChild(); sub_item != 0; sub_item = sub_item->nextSibling() ) { if( sub_item->addingReplayGain ) { processedTime += sub_item->time; sub_item->addingReplayGain = false; - sub_item->repaint(); + sub_item->tqrepaint(); sub_item->updateReplayGainCells( tagEngine->readTags(KURL::decode_string(sub_item->filePathName)) ); } if( sub_item->queued && proc->signalled() ) { sub_item->queued = false; - sub_item->repaint(); + sub_item->tqrepaint(); } } } |