diff options
Diffstat (limited to 'amarok/src/mediadevice/generic/genericmediadevice.cpp')
-rw-r--r-- | amarok/src/mediadevice/generic/genericmediadevice.cpp | 162 |
1 files changed, 81 insertions, 81 deletions
diff --git a/amarok/src/mediadevice/generic/genericmediadevice.cpp b/amarok/src/mediadevice/generic/genericmediadevice.cpp index 79056bde..33256369 100644 --- a/amarok/src/mediadevice/generic/genericmediadevice.cpp +++ b/amarok/src/mediadevice/generic/genericmediadevice.cpp @@ -72,12 +72,12 @@ typedef TQPtrListIterator<GenericMediaFile> MediaFileListIterator; class GenericMediaItem : public MediaItem { public: - GenericMediaItem( TQListView *parent, TQListViewItem *after = 0 ) - : MediaItem( parent, after ) + GenericMediaItem( TQListView *tqparent, TQListViewItem *after = 0 ) + : MediaItem( tqparent, after ) { } - GenericMediaItem( TQListViewItem *parent, TQListViewItem *after = 0 ) - : MediaItem( parent, after ) + GenericMediaItem( TQListViewItem *tqparent, TQListViewItem *after = 0 ) + : MediaItem( tqparent, after ) { } // List directories first, always @@ -108,22 +108,22 @@ class GenericMediaItem : public MediaItem class GenericMediaFile { public: - GenericMediaFile( GenericMediaFile *parent, TQString basename, GenericMediaDevice *device ) - : m_parent( parent ) + GenericMediaFile( GenericMediaFile *tqparent, TQString basename, GenericMediaDevice *device ) + : m_tqparent( tqparent ) , m_device( device ) { m_listed = false; - m_children = new MediaFileList(); + m_tqchildren = new MediaFileList(); - if( m_parent ) + if( m_tqparent ) { - if( m_parent == m_device->getInitialFile() ) + if( m_tqparent == m_device->getInitialFile() ) m_viewItem = new GenericMediaItem( m_device->view() ); else - m_viewItem = new GenericMediaItem( m_parent->getViewItem() ); + m_viewItem = new GenericMediaItem( m_tqparent->getViewItem() ); setNamesFromBase( basename ); m_viewItem->setText( 0, m_baseName ); - m_parent->getChildren()->append( this ); + m_tqparent->getChildren()->append( this ); } else { @@ -148,33 +148,33 @@ class GenericMediaFile ~GenericMediaFile() { - if( m_parent ) - m_parent->removeChild( this ); + if( m_tqparent ) + m_tqparent->removeChild( this ); m_device->getItemMap().erase( m_viewItem ); m_device->getFileMap().erase( m_fullName ); - if ( m_children ) - delete m_children; + if ( m_tqchildren ) + delete m_tqchildren; if ( m_viewItem ) delete m_viewItem; } GenericMediaFile* - getParent() { return m_parent; } + getParent() { return m_tqparent; } void - setParent( GenericMediaFile* parent ) + setParent( GenericMediaFile* tqparent ) { m_device->getFileMap().erase( m_fullName ); - m_parent->getChildren()->remove( this ); - m_parent = parent; - if( m_parent ) - m_parent->getChildren()->append( this ); + m_tqparent->getChildren()->remove( this ); + m_tqparent = tqparent; + if( m_tqparent ) + m_tqparent->getChildren()->append( this ); setNamesFromBase( m_baseName ); m_device->getFileMap()[m_fullName] = this; } void - removeChild( GenericMediaFile* childToDelete ) { m_children->remove( childToDelete ); } + removeChild( GenericMediaFile* childToDelete ) { m_tqchildren->remove( childToDelete ); } GenericMediaItem* getViewItem() { return m_viewItem; } @@ -185,10 +185,10 @@ class GenericMediaFile void setListed( bool listed ) { m_listed = listed; } - QString + TQString getFullName() { return m_fullName; } - QString + TQString getBaseName() { return m_baseName; } //always follow this function with setNamesFromBase() @@ -196,12 +196,12 @@ class GenericMediaFile setBaseName( TQString &name ) { m_baseName = name; } void - setNamesFromBase( const TQString &name = TQString::null ) + setNamesFromBase( const TQString &name = TQString() ) { - if( name != TQString::null ) + if( name != TQString() ) m_baseName = name; - if( m_parent ) - m_fullName = m_parent->getFullName() + '/' + m_baseName; + if( m_tqparent ) + m_fullName = m_tqparent->getFullName() + '/' + m_baseName; else m_fullName = m_baseName; if( m_viewItem ) @@ -209,15 +209,15 @@ class GenericMediaFile } MediaFileList* - getChildren() { return m_children; } + getChildren() { return m_tqchildren; } void deleteAll( bool onlyChildren ) { GenericMediaFile *vmf; - if( m_children && !m_children->isEmpty() ) + if( m_tqchildren && !m_tqchildren->isEmpty() ) { - MediaFileListIterator it( *m_children ); + MediaFileListIterator it( *m_tqchildren ); while( ( vmf = it.current() ) != 0 ) { ++it; @@ -232,9 +232,9 @@ class GenericMediaFile renameAllChildren() { GenericMediaFile *vmf; - if( m_children && !m_children->isEmpty() ) + if( m_tqchildren && !m_tqchildren->isEmpty() ) { - for( vmf = m_children->first(); vmf; vmf = m_children->next() ) + for( vmf = m_tqchildren->first(); vmf; vmf = m_tqchildren->next() ) vmf->renameAllChildren(); } setNamesFromBase(); @@ -243,14 +243,14 @@ class GenericMediaFile private: TQString m_fullName; TQString m_baseName; - GenericMediaFile *m_parent; - MediaFileList *m_children; + GenericMediaFile *m_tqparent; + MediaFileList *m_tqchildren; GenericMediaItem *m_viewItem; GenericMediaDevice* m_device; bool m_listed; }; -QString +TQString GenericMediaDevice::fileName( const MetaBundle &bundle ) { TQString result = cleanPath( bundle.artist() ); @@ -299,8 +299,8 @@ GenericMediaDevice::GenericMediaDevice() m_ignoreThePrefix = false; m_asciiTextOnly = false; - m_songLocation = TQString::null; - m_podcastLocation = TQString::null; + m_songLocation = TQString(); + m_podcastLocation = TQString(); m_supportedFileTypes.clear(); @@ -314,9 +314,9 @@ GenericMediaDevice::GenericMediaDevice() } void -GenericMediaDevice::init( MediaBrowser* parent ) +GenericMediaDevice::init( MediaBrowser* tqparent ) { - MediaDevice::init( parent ); + MediaDevice::init( tqparent ); } GenericMediaDevice::~GenericMediaDevice() @@ -476,7 +476,7 @@ GenericMediaDevice::newDirectory( const TQString &name, MediaItem *parent ) debug() << "Creating directory: " << fullPath << endl; const KURL url( fullPath ); - if( !KIO::NetAccess::mkdir( url, m_parent ) ) //failed + if( !KIO::NetAccess::mkdir( url, m_tqparent ) ) //failed { debug() << "Failed to create directory " << fullPath << endl; return 0; @@ -516,7 +516,7 @@ GenericMediaDevice::addToDirectory( MediaItem *directory, TQPtrList<MediaItem> i const KURL srcurl(src); const KURL dsturl(dst); - if ( !KIO::NetAccess::file_move( srcurl, dsturl, -1, false, false, m_parent ) ) + if ( !KIO::NetAccess::file_move( srcurl, dsturl, -1, false, false, m_tqparent ) ) debug() << "Failed moving " << src << " to " << dst << endl; else { @@ -530,7 +530,7 @@ GenericMediaDevice::addToDirectory( MediaItem *directory, TQPtrList<MediaItem> i /// Uploading -QString +TQString GenericMediaDevice::buildDestination( const TQString &format, const MetaBundle &mb ) { bool isCompilation = mb.compilation() == MetaBundle::CompilationYes; @@ -557,18 +557,18 @@ GenericMediaDevice::buildDestination( const TQString &format, const MetaBundle & args["artist"] = artist; args["albumartist"] = albumartist; args["initial"] = albumartist.mid( 0, 1 ).upper(); - args["filetype"] = mb.url().pathOrURL().section( ".", -1 ).lower(); + args["filetype"] = TQString(mb.url().pathOrURL().section( ".", -1 )).lower(); TQString track; if ( mb.track() ) track.sprintf( "%02d", mb.track() ); args["track"] = track; - Amarok::QStringx formatx( format ); + Amarok::TQStringx formatx( format ); TQString result = formatx.namedOptArgs( args ); if( !result.startsWith( "/" ) ) result.prepend( "/" ); - return result.replace( TQRegExp( "/\\.*" ), "/" ); + return result.tqreplace( TQRegExp( "/\\.*" ), "/" ); } void @@ -576,8 +576,8 @@ GenericMediaDevice::checkAndBuildLocation( const TQString& location ) { // check for every directory from the mount point to the location // whether they exist or not. - int mountPointDepth = m_medium.mountPoint().contains( '/', false ); - int locationDepth = location.contains( '/', false ); + int mountPointDepth = m_medium.mountPoint().tqcontains( '/', false ); + int locationDepth = location.tqcontains( '/', false ); if( m_medium.mountPoint().endsWith( "/" ) ) mountPointDepth--; @@ -597,7 +597,7 @@ GenericMediaDevice::checkAndBuildLocation( const TQString& location ) TQString secondpart = cleanPath( location.section( '/', i, i ) ); KURL url = KURL::fromPathOrURL( firstpart + '/' + secondpart ); - if( !KIO::NetAccess::exists( url, false, m_parent ) ) + if( !KIO::NetAccess::exists( url, false, m_tqparent ) ) { debug() << "directory does not exist, creating..." << url << endl; if( !KIO::NetAccess::mkdir(url, m_view ) ) //failed @@ -609,26 +609,26 @@ GenericMediaDevice::checkAndBuildLocation( const TQString& location ) } } -QString +TQString GenericMediaDevice::buildPodcastDestination( const PodcastEpisodeBundle *bundle ) { TQString location = m_podcastLocation.endsWith("/") ? m_podcastLocation : m_podcastLocation + '/'; // get info about the PodcastChannel - TQString parentUrl = bundle->parent().url(); - TQString sql = "SELECT title,parent FROM podcastchannels WHERE url='" + CollectionDB::instance()->escapeString( parentUrl ) + "';"; + TQString tqparentUrl = bundle->tqparent().url(); + TQString sql = "SELECT title,tqparent FROM podcastchannels WHERE url='" + CollectionDB::instance()->escapeString( tqparentUrl ) + "';"; TQStringList values = CollectionDB::instance()->query( sql ); TQString channelTitle; - int parent = 0; + int tqparent = 0; channelTitle = values.first(); - parent = values.last().toInt(); + tqparent = values.last().toInt(); // Put the file in a directory tree like in the playlistbrowser - sql = "SELECT name,parent FROM podcastfolders WHERE id=%1;"; + sql = "SELECT name,tqparent FROM podcastfolders WHERE id=%1;"; TQString name; - while ( parent > 0 ) + while ( tqparent > 0 ) { - values = CollectionDB::instance()->query( sql.arg( parent ) ); + values = CollectionDB::instance()->query( sql.tqarg( tqparent ) ); name = values.first(); - parent = values.last().toInt(); + tqparent = values.last().toInt(); location += cleanPath( name ) + '/'; } location += cleanPath( channelTitle ) + '/' + cleanPath( bundle->localUrl().filename() ); @@ -653,7 +653,7 @@ GenericMediaDevice::copyTrackToDevice( const MetaBundle& bundle ) const KURL desturl = KURL::fromPathOrURL( path ); - //kapp->processEvents( 100 ); + //kapp->tqprocessEvents( 100 ); if( !kioCopyTrack( bundle.url(), desturl ) ) { @@ -667,7 +667,7 @@ GenericMediaDevice::copyTrackToDevice( const MetaBundle& bundle ) //other than to see if it is NULL or not //if we're here the transfer shouldn't have failed, so we shouldn't get into a loop by waiting... while( !m_view->firstChild() ) - kapp->processEvents( 100 ); + kapp->tqprocessEvents( 100 ); return static_cast<MediaItem*>(m_view->firstChild()); } @@ -774,7 +774,7 @@ GenericMediaDevice::expandItem( TQListViewItem *item ) // SLOT while( !m_dirListerComplete ) { - kapp->processEvents( 100 ); + kapp->tqprocessEvents( 100 ); usleep(10000); } } @@ -852,12 +852,12 @@ int GenericMediaDevice::addTrackToList( int type, KURL url, int /*size*/ ) { TQString path = url.isLocalFile() ? url.path( -1 ) : url.prettyURL( -1 ); //no trailing slash - int index = path.findRev( '/', -1 ); + int index = path.tqfindRev( '/', -1 ); TQString baseName = path.right( path.length() - index - 1 ); - TQString parentName = path.left( index ); + TQString tqparentName = path.left( index ); - GenericMediaFile* parent = m_mfm[parentName]; - GenericMediaFile* newItem = new GenericMediaFile( parent, baseName, this ); + GenericMediaFile* tqparent = m_mfm[tqparentName]; + GenericMediaFile* newItem = new GenericMediaFile( tqparent, baseName, this ); if( type == MediaItem::DIRECTORY ) //directory newItem->getViewItem()->setType( MediaItem::DIRECTORY ); @@ -866,10 +866,10 @@ GenericMediaDevice::addTrackToList( int type, KURL url, int /*size*/ ) //or just update the list in the plugin as appropriate else if( type == MediaItem::TRACK ) //file { - if( baseName.endsWith( "mp3", false ) || baseName.endsWith( "wma", false ) || - baseName.endsWith( "wav", false ) || baseName.endsWith( "ogg", false ) || - baseName.endsWith( "asf", false ) || baseName.endsWith( "flac", false ) || - baseName.endsWith( "aac", false ) || baseName.endsWith( "m4a", false ) ) + if( baseName.tqendsWith( "mp3", false ) || baseName.tqendsWith( "wma", false ) || + baseName.tqendsWith( "wav", false ) || baseName.tqendsWith( "ogg", false ) || + baseName.tqendsWith( "asf", false ) || baseName.tqendsWith( "flac", false ) || + baseName.tqendsWith( "aac", false ) || baseName.tqendsWith( "m4a", false ) ) newItem->getViewItem()->setType( MediaItem::TRACK ); @@ -877,7 +877,7 @@ GenericMediaDevice::addTrackToList( int type, KURL url, int /*size*/ ) newItem->getViewItem()->setType( MediaItem::UNKNOWN ); } - refreshDir( parent->getFullName() ); + refreshDir( tqparent->getFullName() ); return 0; } @@ -889,7 +889,7 @@ GenericMediaDevice::getCapacity( KIO::filesize_t *total, KIO::filesize_t *availa { if( !m_connected || !KURL::fromPathOrURL( m_medium.mountPoint() ).isLocalFile() ) return false; - KDiskFreeSp* kdf = new KDiskFreeSp( m_parent, "generic_kdf" ); + KDiskFreeSp* kdf = new KDiskFreeSp( TQT_TQOBJECT(m_tqparent), "generic_kdf" ); kdf->readDF( m_medium.mountPoint() ); connect(kdf, TQT_SIGNAL(foundMountPoint( const TQString &, unsigned long, unsigned long, unsigned long )), TQT_SLOT(foundMountPoint( const TQString &, unsigned long, unsigned long, unsigned long ))); @@ -898,7 +898,7 @@ GenericMediaDevice::getCapacity( KIO::filesize_t *total, KIO::filesize_t *availa while( m_kBSize == 0 && m_kBAvail == 0){ usleep( 10000 ); - kapp->processEvents( 100 ); + kapp->tqprocessEvents( 100 ); count++; if (count > 120){ debug() << "KDiskFreeSp taking too long. Returning false from getCapacity()" << endl; @@ -929,7 +929,7 @@ GenericMediaDevice::foundMountPoint( const TQString & mountPoint, unsigned long void GenericMediaDevice::rmbPressed( TQListViewItem* qitem, const TQPoint& point, int ) { - enum Actions { APPEND, LOAD, QUEUE, + enum Actions { APPEND, LOAD, TQUEUE, DOWNLOAD, BURN_DATACD, BURN_AUDIOCD, DIRECTORY, RENAME, @@ -941,7 +941,7 @@ GenericMediaDevice::rmbPressed( TQListViewItem* qitem, const TQPoint& point, int KPopupMenu menu( m_view ); menu.insertItem( SmallIconSet( Amarok::icon( "playlist" ) ), i18n( "&Load" ), LOAD ); menu.insertItem( SmallIconSet( Amarok::icon( "1downarrow" ) ), i18n( "&Append to Playlist" ), APPEND ); - menu.insertItem( SmallIconSet( Amarok::icon( "fastforward" ) ), i18n( "&Queue Tracks" ), QUEUE ); + menu.insertItem( SmallIconSet( Amarok::icon( "fastforward" ) ), i18n( "&Queue Tracks" ), TQUEUE ); menu.insertSeparator(); menu.insertItem( SmallIconSet( Amarok::icon( "collection" ) ), i18n( "&Copy Files to Collection..." ), DOWNLOAD ); menu.insertItem( SmallIconSet( Amarok::icon( "cdrom_unmount" ) ), i18n( "Burn to CD as Data" ), BURN_DATACD ); @@ -966,7 +966,7 @@ GenericMediaDevice::rmbPressed( TQListViewItem* qitem, const TQPoint& point, int case APPEND: Playlist::instance()->insertMedia( getSelectedItems(), Playlist::Append ); break; - case QUEUE: + case TQUEUE: Playlist::instance()->insertMedia( getSelectedItems(), Playlist::Queue ); break; case DOWNLOAD: @@ -983,7 +983,7 @@ GenericMediaDevice::rmbPressed( TQListViewItem* qitem, const TQPoint& point, int if( item->type() == MediaItem::DIRECTORY ) m_view->newDirectory( static_cast<MediaItem*>(item) ); else - m_view->newDirectory( static_cast<MediaItem*>(item->parent()) ); + m_view->newDirectory( static_cast<MediaItem*>(item->tqparent()) ); break; case RENAME: @@ -1042,11 +1042,11 @@ TQString GenericMediaDevice::cleanPath( const TQString &component ) result.simplifyWhiteSpace(); if( m_spacesToUnderscores ) - result.replace( TQRegExp( "\\s" ), "_" ); + result.tqreplace( TQRegExp( "\\s" ), "_" ); if( m_actuallyVfat || m_vfatTextOnly ) result = Amarok::vfatPath( result ); - result.replace( "/", "-" ); + result.tqreplace( "/", "-" ); return result; } @@ -1072,15 +1072,15 @@ bool GenericMediaDevice::isPreferredFormat( const MetaBundle &bundle ) /// Configuration Dialog Extension -void GenericMediaDevice::addConfigElements( TQWidget * parent ) +void GenericMediaDevice::addConfigElements( TQWidget * tqparent ) { - m_configDialog = new GenericMediaDeviceConfigDialog( parent ); + m_configDialog = new GenericMediaDeviceConfigDialog( tqparent ); m_configDialog->setDevice( this ); } -void GenericMediaDevice::removeConfigElements( TQWidget * /* parent */ ) +void GenericMediaDevice::removeConfigElements( TQWidget * /* tqparent */ ) { if( m_configDialog != 0 ) delete m_configDialog; |