mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 20:00:13 +02:00
Be a bit more resilient in setting the playlist to rename after creating
This commit is contained in:
@@ -201,8 +201,9 @@ CategoryAddItem::dropMimeData( const QMimeData* data, Qt::DropAction )
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString name = firstArtist.isEmpty() ? tr( "New Station" ) : tr( "%1 Station" ).arg( firstArtist );
|
QString name = firstArtist.isEmpty() ? tr( "New Station" ) : tr( "%1 Station" ).arg( firstArtist );
|
||||||
newpl->rename( name );
|
|
||||||
newpl->createNewRevision( uuid(), newpl->currentrevision(), newpl->type(), contrls );
|
newpl->createNewRevision( uuid(), newpl->currentrevision(), newpl->type(), contrls );
|
||||||
|
newpl->setProperty( "newname", name );
|
||||||
|
connect( newpl.data(), SIGNAL( dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision ) ), this, SLOT( playlistToRenameLoaded() ) );
|
||||||
|
|
||||||
ViewManager::instance()->show( newpl );
|
ViewManager::instance()->show( newpl );
|
||||||
return true;
|
return true;
|
||||||
@@ -278,6 +279,22 @@ CategoryAddItem::dropMimeData( const QMimeData* data, Qt::DropAction )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CategoryAddItem::playlistToRenameLoaded()
|
||||||
|
{
|
||||||
|
Playlist* pl = qobject_cast< Playlist* >( sender() );
|
||||||
|
Q_ASSERT( pl );
|
||||||
|
|
||||||
|
QString name = sender()->property( "newname" ).toString();
|
||||||
|
if ( !name.isEmpty() )
|
||||||
|
pl->rename( name );
|
||||||
|
else
|
||||||
|
QTimer::singleShot( 400, APP->mainWindow()->sourceTreeView(), SLOT( renamePlaylist() ) );
|
||||||
|
|
||||||
|
disconnect( pl, SIGNAL( dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision ) ), this, SLOT( playlistToRenameLoaded() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CategoryAddItem::parsedDroppedTracks( const QList< query_ptr >& tracks )
|
CategoryAddItem::parsedDroppedTracks( const QList< query_ptr >& tracks )
|
||||||
{
|
{
|
||||||
@@ -322,8 +339,7 @@ CategoryAddItem::parsedDroppedTracks( const QList< query_ptr >& tracks )
|
|||||||
newpl->createNewRevision( uuid(), newpl->currentrevision(), newpl->type(), contrls );
|
newpl->createNewRevision( uuid(), newpl->currentrevision(), newpl->type(), contrls );
|
||||||
|
|
||||||
ViewManager::instance()->show( newpl );
|
ViewManager::instance()->show( newpl );
|
||||||
// Give a shot to try to rename it. The playlist has to be created first. ugly.
|
connect( newpl.data(), SIGNAL( dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision ) ), this, SLOT( playlistToRenameLoaded() ) );
|
||||||
QTimer::singleShot( 300, APP->mainWindow()->sourceTreeView(), SLOT( renamePlaylist() ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -40,9 +40,13 @@ private slots:
|
|||||||
void parsedDroppedTracks( const QList< Tomahawk::query_ptr >& tracks );
|
void parsedDroppedTracks( const QList< Tomahawk::query_ptr >& tracks );
|
||||||
void dialogClosed( int ret );
|
void dialogClosed( int ret );
|
||||||
|
|
||||||
|
//
|
||||||
|
void playlistToRenameLoaded();
|
||||||
private:
|
private:
|
||||||
SourcesModel::CategoryType m_categoryType;
|
SourcesModel::CategoryType m_categoryType;
|
||||||
QIcon m_icon;
|
QIcon m_icon;
|
||||||
|
public slots:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CategoryItem : public SourceTreeItem
|
class CategoryItem : public SourceTreeItem
|
||||||
|
Reference in New Issue
Block a user