mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-03 04:37:36 +02:00
Select playlist in sidebar when creating bookmark playlist
This commit is contained in:
@@ -170,8 +170,8 @@ GlobalActionManager::handleQueueCommand( const QUrl& url )
|
|||||||
if( pair.first != "url" )
|
if( pair.first != "url" )
|
||||||
continue;
|
continue;
|
||||||
QUrl track = QUrl::fromUserInput( pair.second );
|
QUrl track = QUrl::fromUserInput( pair.second );
|
||||||
//FIXME: isLocalFile is part of KUrl, not QUrl
|
//FIXME: isLocalFile is Qt 4.8
|
||||||
if( false /*track.isLocalFile()*/ ) { // it's local, so we see if it's in the DB and load it if so
|
if( track.toString().startsWith( "file://" ) ) { // it's local, so we see if it's in the DB and load it if so
|
||||||
// TODO
|
// TODO
|
||||||
} else { // give it a web result hint
|
} else { // give it a web result hint
|
||||||
// TODO actually read the tags
|
// TODO actually read the tags
|
||||||
@@ -287,7 +287,7 @@ GlobalActionManager::handlePlayCommand( const QUrl& url )
|
|||||||
if( bookmarkpl.isNull() ) { // create it and do the deed then
|
if( bookmarkpl.isNull() ) { // create it and do the deed then
|
||||||
m_waitingToBookmark = q;
|
m_waitingToBookmark = q;
|
||||||
col->createBookmarksPlaylist();
|
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 {
|
} else {
|
||||||
doBookmark( bookmarkpl, q );
|
doBookmark( bookmarkpl, q );
|
||||||
}
|
}
|
||||||
@@ -301,6 +301,7 @@ GlobalActionManager::handlePlayCommand( const QUrl& url )
|
|||||||
void
|
void
|
||||||
GlobalActionManager::bookmarkPlaylistCreated( const Tomahawk::playlist_ptr& pl )
|
GlobalActionManager::bookmarkPlaylistCreated( const Tomahawk::playlist_ptr& pl )
|
||||||
{
|
{
|
||||||
|
Q_ASSERT( !m_waitingToBookmark.isNull() );
|
||||||
doBookmark( pl, m_waitingToBookmark );
|
doBookmark( pl, m_waitingToBookmark );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,7 +19,9 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "localcollection.h"
|
#include "localcollection.h"
|
||||||
#include <sourcelist.h>
|
|
||||||
|
#include "sourcelist.h"
|
||||||
|
#include "viewmanager.h"
|
||||||
|
|
||||||
#define MAGIC_BOOKMARK_GUID "_bookmarkplaylist"
|
#define MAGIC_BOOKMARK_GUID "_bookmarkplaylist"
|
||||||
|
|
||||||
@@ -40,8 +42,9 @@ LocalCollection::createBookmarksPlaylist()
|
|||||||
{
|
{
|
||||||
if( bookmarksPlaylist().isNull() ) {
|
if( bookmarksPlaylist().isNull() ) {
|
||||||
Tomahawk::playlist_ptr p = Tomahawk::Playlist::create( SourceList::instance()->getLocal(), MAGIC_BOOKMARK_GUID, tr( "Bookmarks" ), tr( "Saved tracks" ), QString(), false );
|
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( 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 >() );
|
// p->createNewRevision( uuid(), p->currentrevision(), QList< Tomahawk::plentry_ptr >() );
|
||||||
}
|
}
|
||||||
|
@@ -149,6 +149,22 @@ ViewManager::queue() const
|
|||||||
return m_queueView->queue();
|
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*
|
Tomahawk::ViewPage*
|
||||||
ViewManager::show( const Tomahawk::playlist_ptr& playlist )
|
ViewManager::show( const Tomahawk::playlist_ptr& playlist )
|
||||||
@@ -156,15 +172,7 @@ ViewManager::show( const Tomahawk::playlist_ptr& playlist )
|
|||||||
PlaylistView* view;
|
PlaylistView* view;
|
||||||
if ( !m_playlistViews.contains( playlist ) )
|
if ( !m_playlistViews.contains( playlist ) )
|
||||||
{
|
{
|
||||||
view = new PlaylistView();
|
view = createPageForPlaylist( playlist );
|
||||||
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 );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -87,6 +87,9 @@ public:
|
|||||||
Tomahawk::ViewPage* pageForDynPlaylist( const Tomahawk::dynplaylist_ptr& pl ) const;
|
Tomahawk::ViewPage* pageForDynPlaylist( const Tomahawk::dynplaylist_ptr& pl ) const;
|
||||||
Tomahawk::ViewPage* pageForCollection( const Tomahawk::collection_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:
|
signals:
|
||||||
void numSourcesChanged( unsigned int sources );
|
void numSourcesChanged( unsigned int sources );
|
||||||
void numTracksChanged( unsigned int tracks );
|
void numTracksChanged( unsigned int tracks );
|
||||||
|
Reference in New Issue
Block a user