|
|
@ -139,7 +139,7 @@ MtpMediaDevice::progressCallback( uint64_t const sent, uint64_t const total, voi
|
|
|
|
Q_UNUSED( sent );
|
|
|
|
Q_UNUSED( sent );
|
|
|
|
Q_UNUSED( total );
|
|
|
|
Q_UNUSED( total );
|
|
|
|
|
|
|
|
|
|
|
|
kapp->processEvents( 100 );
|
|
|
|
kapp->tqprocessEvents( 100 );
|
|
|
|
|
|
|
|
|
|
|
|
MtpMediaDevice *dev = (MtpMediaDevice*)(data);
|
|
|
|
MtpMediaDevice *dev = (MtpMediaDevice*)(data);
|
|
|
|
|
|
|
|
|
|
|
@ -188,12 +188,12 @@ MediaItem
|
|
|
|
// fallback to checking the extension (e.g. .wma, .ogg, etc)
|
|
|
|
// fallback to checking the extension (e.g. .wma, .ogg, etc)
|
|
|
|
debug() << "No filetype found by Amarok filetype" << endl;
|
|
|
|
debug() << "No filetype found by Amarok filetype" << endl;
|
|
|
|
|
|
|
|
|
|
|
|
const TQString extension = bundle.url().path().section( ".", -1 ).lower();
|
|
|
|
const TQString extension = TQString(bundle.url().path().section( ".", -1 )).lower();
|
|
|
|
|
|
|
|
|
|
|
|
int libmtp_type = m_supportedFiles.findIndex( extension );
|
|
|
|
int libmtp_type = m_supportedFiles.tqfindIndex( extension );
|
|
|
|
if( libmtp_type >= 0 )
|
|
|
|
if( libmtp_type >= 0 )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int keyIndex = mtpFileTypes.values().findIndex( extension );
|
|
|
|
int keyIndex = mtpFileTypes.values().tqfindIndex( extension );
|
|
|
|
libmtp_type = mtpFileTypes.keys()[keyIndex];
|
|
|
|
libmtp_type = mtpFileTypes.keys()[keyIndex];
|
|
|
|
trackmeta->filetype = (LIBMTP_filetype_t) libmtp_type;
|
|
|
|
trackmeta->filetype = (LIBMTP_filetype_t) libmtp_type;
|
|
|
|
debug() << "set filetype to " << libmtp_type << " based on extension of ." << extension << endl;
|
|
|
|
debug() << "set filetype to " << libmtp_type << " based on extension of ." << extension << endl;
|
|
|
@ -321,7 +321,7 @@ MediaItem
|
|
|
|
|
|
|
|
|
|
|
|
LIBMTP_destroy_track_t( trackmeta );
|
|
|
|
LIBMTP_destroy_track_t( trackmeta );
|
|
|
|
|
|
|
|
|
|
|
|
kapp->processEvents( 100 );
|
|
|
|
kapp->tqprocessEvents( 100 );
|
|
|
|
|
|
|
|
|
|
|
|
// add track to view and to new tracks list
|
|
|
|
// add track to view and to new tracks list
|
|
|
|
MediaItem *newItem = addTrackToView( taggedTrack );
|
|
|
|
MediaItem *newItem = addTrackToView( taggedTrack );
|
|
|
@ -436,7 +436,7 @@ MtpMediaDevice::updateAlbumArt( TQPtrList<MediaItem> *items )
|
|
|
|
|
|
|
|
|
|
|
|
setCanceled( false );
|
|
|
|
setCanceled( false );
|
|
|
|
|
|
|
|
|
|
|
|
kapp->processEvents( 100 );
|
|
|
|
kapp->tqprocessEvents( 100 );
|
|
|
|
TQMap< TQString, TQPtrList<MediaItem> > albumList;
|
|
|
|
TQMap< TQString, TQPtrList<MediaItem> > albumList;
|
|
|
|
|
|
|
|
|
|
|
|
for( MtpMediaItem *it = dynamic_cast<MtpMediaItem*>(items->first()); it && !(m_canceled); it = dynamic_cast<MtpMediaItem*>(items->next()) )
|
|
|
|
for( MtpMediaItem *it = dynamic_cast<MtpMediaItem*>(items->first()); it && !(m_canceled); it = dynamic_cast<MtpMediaItem*>(items->next()) )
|
|
|
@ -453,14 +453,14 @@ MtpMediaDevice::updateAlbumArt( TQPtrList<MediaItem> *items )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int i = 0;
|
|
|
|
int i = 0;
|
|
|
|
setProgress( i, albumList.count() );
|
|
|
|
setProgress( i, albumList.count() );
|
|
|
|
kapp->processEvents( 100 );
|
|
|
|
kapp->tqprocessEvents( 100 );
|
|
|
|
TQMap< TQString, TQPtrList<MediaItem> >::Iterator it;
|
|
|
|
TQMap< TQString, TQPtrList<MediaItem> >::Iterator it;
|
|
|
|
for( it = albumList.begin(); it != albumList.end(); ++it )
|
|
|
|
for( it = albumList.begin(); it != albumList.end(); ++it )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
sendAlbumArt( &it.data() );
|
|
|
|
sendAlbumArt( &it.data() );
|
|
|
|
setProgress( ++i );
|
|
|
|
setProgress( ++i );
|
|
|
|
if( i % 20 == 0 )
|
|
|
|
if( i % 20 == 0 )
|
|
|
|
kapp->processEvents( 100 );
|
|
|
|
kapp->tqprocessEvents( 100 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
hideProgress();
|
|
|
|
hideProgress();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -744,7 +744,7 @@ MtpMediaDevice::synchronizeDevice()
|
|
|
|
MediaItem
|
|
|
|
MediaItem
|
|
|
|
*MtpMediaDevice::trackExists( const MetaBundle &bundle )
|
|
|
|
*MtpMediaDevice::trackExists( const MetaBundle &bundle )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MediaItem *artist = dynamic_cast<MediaItem *>( m_view->findItem( bundle.artist(), 0 ) );
|
|
|
|
MediaItem *artist = dynamic_cast<MediaItem *>( m_view->tqfindItem( bundle.artist(), 0 ) );
|
|
|
|
if( artist )
|
|
|
|
if( artist )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MediaItem *album = dynamic_cast<MediaItem *>( artist->findItem( bundle.album() ) );
|
|
|
|
MediaItem *album = dynamic_cast<MediaItem *>( artist->findItem( bundle.album() ) );
|
|
|
@ -1053,7 +1053,7 @@ MtpMediaDevice::deleteObject( MtpMediaItem *deleteItem )
|
|
|
|
m_fileNameToItem.remove( TQString( "%1/%2" ).tqarg( deleteItem->track()->folderId() ).tqarg( deleteItem->bundle()->filename() ) );
|
|
|
|
m_fileNameToItem.remove( TQString( "%1/%2" ).tqarg( deleteItem->track()->folderId() ).tqarg( deleteItem->bundle()->filename() ) );
|
|
|
|
// remove from the media view
|
|
|
|
// remove from the media view
|
|
|
|
delete deleteItem;
|
|
|
|
delete deleteItem;
|
|
|
|
kapp->processEvents( 100 );
|
|
|
|
kapp->tqprocessEvents( 100 );
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1137,11 +1137,11 @@ MtpMediaDevice::openDevice( bool silent )
|
|
|
|
m_supportedFiles << mtpFileTypes[ filetypes[ i ] ];
|
|
|
|
m_supportedFiles << mtpFileTypes[ filetypes[ i ] ];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// find supported image types (for album art).
|
|
|
|
// find supported image types (for album art).
|
|
|
|
if( m_supportedFiles.findIndex( "jpg" ) )
|
|
|
|
if( m_supportedFiles.tqfindIndex( "jpg" ) )
|
|
|
|
m_format = "JPEG";
|
|
|
|
m_format = "JPEG";
|
|
|
|
else if( m_supportedFiles.findIndex( "png" ) )
|
|
|
|
else if( m_supportedFiles.tqfindIndex( "png" ) )
|
|
|
|
m_format = "PNG";
|
|
|
|
m_format = "PNG";
|
|
|
|
else if( m_supportedFiles.findIndex( "gif" ) )
|
|
|
|
else if( m_supportedFiles.tqfindIndex( "gif" ) )
|
|
|
|
m_format = "GIF";
|
|
|
|
m_format = "GIF";
|
|
|
|
free( filetypes );
|
|
|
|
free( filetypes );
|
|
|
|
m_critical_mutex.unlock();
|
|
|
|
m_critical_mutex.unlock();
|
|
|
@ -1422,7 +1422,7 @@ MtpMediaItem
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQString artistName = track->bundle()->artist();
|
|
|
|
TQString artistName = track->bundle()->artist();
|
|
|
|
|
|
|
|
|
|
|
|
MtpMediaItem *artist = dynamic_cast<MtpMediaItem *>( m_view->findItem( artistName, 0 ) );
|
|
|
|
MtpMediaItem *artist = dynamic_cast<MtpMediaItem *>( m_view->tqfindItem( artistName, 0 ) );
|
|
|
|
if( !artist )
|
|
|
|
if( !artist )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
artist = new MtpMediaItem(m_view);
|
|
|
|
artist = new MtpMediaItem(m_view);
|
|
|
@ -1478,7 +1478,7 @@ MtpMediaDevice::readMtpMusic()
|
|
|
|
int progress = 0;
|
|
|
|
int progress = 0;
|
|
|
|
setProgress( progress, total ); // we don't know how many tracks. fake progress bar.
|
|
|
|
setProgress( progress, total ); // we don't know how many tracks. fake progress bar.
|
|
|
|
|
|
|
|
|
|
|
|
kapp->processEvents( 100 );
|
|
|
|
kapp->tqprocessEvents( 100 );
|
|
|
|
|
|
|
|
|
|
|
|
LIBMTP_track_t *tracks = LIBMTP_Get_Tracklisting_With_Callback( m_device, progressCallback, this );
|
|
|
|
LIBMTP_track_t *tracks = LIBMTP_Get_Tracklisting_With_Callback( m_device, progressCallback, this );
|
|
|
|
|
|
|
|
|
|
|
@ -1512,7 +1512,7 @@ MtpMediaDevice::readMtpMusic()
|
|
|
|
progress++;
|
|
|
|
progress++;
|
|
|
|
setProgress( progress );
|
|
|
|
setProgress( progress );
|
|
|
|
if( progress % 50 == 0 )
|
|
|
|
if( progress % 50 == 0 )
|
|
|
|
kapp->processEvents( 100 );
|
|
|
|
kapp->tqprocessEvents( 100 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1562,7 +1562,7 @@ MtpMediaDevice::readPlaylists()
|
|
|
|
tmp = playlists;
|
|
|
|
tmp = playlists;
|
|
|
|
playlists = playlists->next;
|
|
|
|
playlists = playlists->next;
|
|
|
|
LIBMTP_destroy_playlist_t( tmp );
|
|
|
|
LIBMTP_destroy_playlist_t( tmp );
|
|
|
|
kapp->processEvents( 50 );
|
|
|
|
kapp->tqprocessEvents( 50 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1585,7 +1585,7 @@ MtpMediaDevice::readAlbums()
|
|
|
|
tmp = albums;
|
|
|
|
tmp = albums;
|
|
|
|
albums = albums->next;
|
|
|
|
albums = albums->next;
|
|
|
|
LIBMTP_destroy_album_t( tmp );
|
|
|
|
LIBMTP_destroy_album_t( tmp );
|
|
|
|
kapp->processEvents( 50 );
|
|
|
|
kapp->tqprocessEvents( 50 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|