1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-12 09:04:33 +02:00

* Removed obsolete code.

This commit is contained in:
Christian Muehlhaeuser
2012-06-29 03:35:46 +02:00
parent 295f059e19
commit 5ed6bb52b5

View File

@@ -278,44 +278,32 @@ CategoryAddItem::playlistToRenameLoaded()
void void
CategoryAddItem::parsedDroppedTracks( const QList< query_ptr >& tracks ) CategoryAddItem::parsedDroppedTracks( const QList< query_ptr >& tracks )
{ {
if( m_categoryType == SourcesModel::PlaylistsCategory ) { if ( m_categoryType == SourcesModel::PlaylistsCategory )
{
playlist_ptr newpl = Playlist::create( SourceList::instance()->getLocal(), uuid(), "New Playlist", "", SourceList::instance()->getLocal()->friendlyName(), false, tracks ); playlist_ptr newpl = Playlist::create( SourceList::instance()->getLocal(), uuid(), "New Playlist", "", SourceList::instance()->getLocal()->friendlyName(), false, tracks );
ViewManager::instance()->show( newpl ); ViewManager::instance()->show( newpl );
connect( newpl.data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), this, SLOT( playlistToRenameLoaded() ) ); connect( newpl.data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), this, SLOT( playlistToRenameLoaded() ) );
} else if( m_categoryType == SourcesModel::StationsCategory ) { }
else if ( m_categoryType == SourcesModel::StationsCategory )
{
// seed the playlist with these song or artist filters // seed the playlist with these song or artist filters
QString name; QString name;
if ( sender() && sender()->property( "dragsource" ).toString() == "artist" )
name = tracks.isEmpty() ? tr( "New Station" ) : tr( "%1 Station" ).arg( ( tracks.first()->artist() ) );
else
name = tracks.isEmpty() ? tr( "New Station" ) : tr( "%1 Station" ).arg( tracks.first()->track() ); name = tracks.isEmpty() ? tr( "New Station" ) : tr( "%1 Station" ).arg( tracks.first()->track() );
dynplaylist_ptr newpl = DynamicPlaylist::create( SourceList::instance()->getLocal(), uuid(), name, "", SourceList::instance()->getLocal()->friendlyName(), OnDemand, false ); dynplaylist_ptr newpl = DynamicPlaylist::create( SourceList::instance()->getLocal(), uuid(), name, "", SourceList::instance()->getLocal()->friendlyName(), OnDemand, false );
newpl->setMode( OnDemand ); newpl->setMode( OnDemand );
// now we want to add each query as a song or similar artist filter... // now we want to add each query as a song or similar artist filter...
QList< dyncontrol_ptr > contrls; QList< dyncontrol_ptr > controls;
if ( sender() && sender()->property( "dragsource" ).toString() == "artist" ) foreach ( const Tomahawk::query_ptr& q, tracks )
{ {
foreach( const Tomahawk::query_ptr& q, tracks ) {
dyncontrol_ptr c = newpl->generator()->createControl( "Artist" );
c->setMatch( QString::number( (int)Echonest::DynamicPlaylist::ArtistRadioType ) );
c->setInput( QString( "%1" ).arg( q->artist() ) );
contrls << c;
}
}
else
{
foreach( const Tomahawk::query_ptr& q, tracks ) {
dyncontrol_ptr c = newpl->generator()->createControl( "Song" ); dyncontrol_ptr c = newpl->generator()->createControl( "Song" );
c->setInput( QString( "%1 %2" ).arg( q->track() ).arg( q->artist() ) ); c->setInput( QString( "%1 %2" ).arg( q->track() ).arg( q->artist() ) );
contrls << c; controls << c;
}
} }
newpl->createNewRevision( uuid(), newpl->currentrevision(), newpl->type(), contrls ); newpl->createNewRevision( uuid(), newpl->currentrevision(), newpl->type(), controls );
ViewManager::instance()->show( newpl ); ViewManager::instance()->show( newpl );
connect( newpl.data(), SIGNAL( dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision ) ), this, SLOT( playlistToRenameLoaded() ) ); connect( newpl.data(), SIGNAL( dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision ) ), this, SLOT( playlistToRenameLoaded() ) );
@@ -340,7 +328,8 @@ CategoryItem::CategoryItem( SourcesModel* model, SourceTreeItem* parent, Sources
{ {
// in the constructor we're still being added to the parent, so we don't exist to have rows addded yet. so this is safe. // in the constructor we're still being added to the parent, so we don't exist to have rows addded yet. so this is safe.
// beginRowsAdded( 0, 0 ); // beginRowsAdded( 0, 0 );
if( m_showAdd ) { if ( m_showAdd )
{
m_addItem = new CategoryAddItem( model, this, m_category ); m_addItem = new CategoryAddItem( model, this, m_category );
} }
// endRowsAdded(); // endRowsAdded();
@@ -361,8 +350,10 @@ CategoryItem::insertItems( QList< SourceTreeItem* > items )
int curCount = children().size(); int curCount = children().size();
if ( m_showAdd ) // if there's an add item, add it before that if ( m_showAdd ) // if there's an add item, add it before that
curCount--; curCount--;
beginRowsAdded( curCount, curCount + items.size() - 1 ); beginRowsAdded( curCount, curCount + items.size() - 1 );
foreach( SourceTreeItem* item, items ) { foreach( SourceTreeItem* item, items )
{
insertChild( children().count() - 1, item ); insertChild( children().count() - 1, item );
} }
endRowsAdded(); endRowsAdded();