mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-22 16:59:58 +01:00
Select playlist in sidebar when creating bookmark playlist
This commit is contained in:
parent
d5c182c151
commit
24f58b45d3
@ -170,8 +170,8 @@ GlobalActionManager::handleQueueCommand( const QUrl& url )
|
||||
if( pair.first != "url" )
|
||||
continue;
|
||||
QUrl track = QUrl::fromUserInput( pair.second );
|
||||
//FIXME: isLocalFile is part of KUrl, not QUrl
|
||||
if( false /*track.isLocalFile()*/ ) { // it's local, so we see if it's in the DB and load it if so
|
||||
//FIXME: isLocalFile is Qt 4.8
|
||||
if( track.toString().startsWith( "file://" ) ) { // it's local, so we see if it's in the DB and load it if so
|
||||
// TODO
|
||||
} else { // give it a web result hint
|
||||
// TODO actually read the tags
|
||||
@ -287,7 +287,7 @@ GlobalActionManager::handlePlayCommand( const QUrl& url )
|
||||
if( bookmarkpl.isNull() ) { // create it and do the deed then
|
||||
m_waitingToBookmark = q;
|
||||
col->createBookmarksPlaylist();
|
||||
connect( col.data(), SIGNAL( bookmarkPlaylistCreated( Tomahawk::playlist_ptr ) ), this, SLOT( bookmarkPlaylistCreated( Tomahawk::playlist_ptr ) ) );
|
||||
connect( col.data(), SIGNAL( bookmarkPlaylistCreated( Tomahawk::playlist_ptr ) ), this, SLOT( bookmarkPlaylistCreated( Tomahawk::playlist_ptr ) ), Qt::UniqueConnection );
|
||||
} else {
|
||||
doBookmark( bookmarkpl, q );
|
||||
}
|
||||
@ -301,6 +301,7 @@ GlobalActionManager::handlePlayCommand( const QUrl& url )
|
||||
void
|
||||
GlobalActionManager::bookmarkPlaylistCreated( const Tomahawk::playlist_ptr& pl )
|
||||
{
|
||||
Q_ASSERT( !m_waitingToBookmark.isNull() );
|
||||
doBookmark( pl, m_waitingToBookmark );
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,9 @@
|
||||
|
||||
|
||||
#include "localcollection.h"
|
||||
#include <sourcelist.h>
|
||||
|
||||
#include "sourcelist.h"
|
||||
#include "viewmanager.h"
|
||||
|
||||
#define MAGIC_BOOKMARK_GUID "_bookmarkplaylist"
|
||||
|
||||
@ -40,8 +42,9 @@ LocalCollection::createBookmarksPlaylist()
|
||||
{
|
||||
if( bookmarksPlaylist().isNull() ) {
|
||||
Tomahawk::playlist_ptr p = Tomahawk::Playlist::create( SourceList::instance()->getLocal(), MAGIC_BOOKMARK_GUID, tr( "Bookmarks" ), tr( "Saved tracks" ), QString(), false );
|
||||
ViewManager::instance()->createPageForPlaylist( p );
|
||||
// connect( p.data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), this, SLOT( loaded( Tomahawk::PlaylistRevision ) ), Qt::QueuedConnection );
|
||||
connect( p.data(), SIGNAL( created() ), this, SLOT( created() ), Qt::QueuedConnection );
|
||||
connect( p.data(), SIGNAL( created() ), this, SLOT( created() ) );
|
||||
|
||||
// p->createNewRevision( uuid(), p->currentrevision(), QList< Tomahawk::plentry_ptr >() );
|
||||
}
|
||||
|
@ -149,6 +149,22 @@ ViewManager::queue() const
|
||||
return m_queueView->queue();
|
||||
}
|
||||
|
||||
PlaylistView*
|
||||
ViewManager::createPageForPlaylist( const playlist_ptr& pl )
|
||||
{
|
||||
PlaylistView* view = new PlaylistView();
|
||||
|
||||
PlaylistModel* model = new PlaylistModel();
|
||||
view->setPlaylistModel( model );
|
||||
view->setFrameShape( QFrame::NoFrame );
|
||||
view->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||
model->loadPlaylist( pl );
|
||||
pl->resolve();
|
||||
|
||||
m_playlistViews.insert( pl, view );
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
Tomahawk::ViewPage*
|
||||
ViewManager::show( const Tomahawk::playlist_ptr& playlist )
|
||||
@ -156,15 +172,7 @@ ViewManager::show( const Tomahawk::playlist_ptr& playlist )
|
||||
PlaylistView* view;
|
||||
if ( !m_playlistViews.contains( playlist ) )
|
||||
{
|
||||
view = new PlaylistView();
|
||||
PlaylistModel* model = new PlaylistModel();
|
||||
view->setPlaylistModel( model );
|
||||
view->setFrameShape( QFrame::NoFrame );
|
||||
view->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||
model->loadPlaylist( playlist );
|
||||
playlist->resolve();
|
||||
|
||||
m_playlistViews.insert( playlist, view );
|
||||
view = createPageForPlaylist( playlist );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -87,6 +87,9 @@ public:
|
||||
Tomahawk::ViewPage* pageForDynPlaylist( const Tomahawk::dynplaylist_ptr& pl ) const;
|
||||
Tomahawk::ViewPage* pageForCollection( const Tomahawk::collection_ptr& pl ) const;
|
||||
|
||||
// only use this is you need to create a playlist and show it directly and want it to be
|
||||
// linked to the sidebar. call it right after creating the playlist
|
||||
PlaylistView* createPageForPlaylist( const Tomahawk::playlist_ptr& pl );
|
||||
signals:
|
||||
void numSourcesChanged( unsigned int sources );
|
||||
void numTracksChanged( unsigned int tracks );
|
||||
|
Loading…
x
Reference in New Issue
Block a user