mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 07:49:42 +01:00
Make surer to show playlist once loaded
This commit is contained in:
parent
6dd12f1940
commit
589202bde7
@ -304,12 +304,12 @@ GlobalActionManager::handlePlaylistCommand( const QUrl& url )
|
||||
tDebug() << "No xspf to load...";
|
||||
return false;
|
||||
}
|
||||
QUrl xspf = QUrl( url.queryItemValue( "xspf" ) );
|
||||
QUrl xspf = QUrl::fromUserInput( url.queryItemValue( "xspf" ) );
|
||||
QString title = url.hasQueryItem( "title" ) ? url.queryItemValue( "title" ) : QString();
|
||||
XSPFLoader* l= new XSPFLoader( true, this );
|
||||
l->setOverrideTitle( title );
|
||||
l->load( xspf );
|
||||
connect( l, SIGNAL( ok( Tomahawk::playlist_ptr ) ), ViewManager::instance(), SLOT( show( Tomahawk::playlist_ptr ) ) );
|
||||
connect( l, SIGNAL( ok( Tomahawk::playlist_ptr ) ), this, SLOT( playlistCreatedToShow( Tomahawk::playlist_ptr) ) );
|
||||
|
||||
} else if( parts [ 0 ] == "new" ) {
|
||||
if( !url.hasQueryItem( "title" ) ) {
|
||||
@ -330,6 +330,22 @@ GlobalActionManager::handlePlaylistCommand( const QUrl& url )
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
GlobalActionManager::playlistCreatedToShow( const playlist_ptr& pl )
|
||||
{
|
||||
connect( pl.data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), this, SLOT( playlistReadyToShow() ) );
|
||||
pl->setProperty( "sharedptr", QVariant::fromValue<Tomahawk::playlist_ptr>( pl ) );
|
||||
}
|
||||
|
||||
void GlobalActionManager::playlistReadyToShow()
|
||||
{
|
||||
playlist_ptr pl = sender()->property( "sharedptr" ).value<Tomahawk::playlist_ptr>();
|
||||
if ( !pl.isNull() )
|
||||
ViewManager::instance()->show( pl );
|
||||
|
||||
disconnect( sender(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), this, SLOT( playlistReadyToShow() ) );
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
GlobalActionManager::handleCollectionCommand( const QUrl& url )
|
||||
@ -438,7 +454,7 @@ GlobalActionManager::doQueueAdd( const QStringList& parts, const QList< QPair< Q
|
||||
foreach( pair, queryItems ) {
|
||||
if( pair.first != "url" )
|
||||
continue;
|
||||
QUrl track = QUrl::fromUserInput( pair.second );
|
||||
QUrl track = QUrl::fromUserInput( pair.second );
|
||||
//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
|
||||
|
@ -81,6 +81,8 @@ private slots:
|
||||
void playOrQueueNow( const Tomahawk::query_ptr& );
|
||||
void playNow( const Tomahawk::query_ptr& );
|
||||
|
||||
void playlistCreatedToShow( const Tomahawk::playlist_ptr& pl );
|
||||
void playlistReadyToShow();
|
||||
private:
|
||||
explicit GlobalActionManager( QObject* parent = 0 );
|
||||
void doBookmark( const Tomahawk::playlist_ptr& pl, const Tomahawk::query_ptr& q );
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "sourcelist.h"
|
||||
#include "playlist.h"
|
||||
#include <XspfUpdater.h>
|
||||
#include <pipeline.h>
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
@ -201,7 +202,7 @@ XSPFLoader::gotBody()
|
||||
continue;
|
||||
}
|
||||
|
||||
query_ptr q = Tomahawk::Query::get( artist, track, album, uuid(), m_autoResolve );
|
||||
query_ptr q = Tomahawk::Query::get( artist, track, album, uuid(), false );
|
||||
q->setDuration( duration.toInt() / 1000 );
|
||||
if ( !url.isEmpty() )
|
||||
q->setResultHint( url );
|
||||
@ -209,6 +210,12 @@ XSPFLoader::gotBody()
|
||||
m_entries << q;
|
||||
}
|
||||
|
||||
if ( m_autoResolve )
|
||||
{
|
||||
for ( int i = m_entries.size() - 1; i >= 0; i-- )
|
||||
Pipeline::instance()->resolve( m_entries[ i ] );
|
||||
}
|
||||
|
||||
if ( origTitle.isEmpty() && m_entries.isEmpty() )
|
||||
{
|
||||
emit error( ParseError );
|
||||
|
Loading…
x
Reference in New Issue
Block a user