mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 07:49:42 +01:00
Handle tomahawk://import/playlist as well as playlist/import as it's more consistent
This commit is contained in:
parent
a53ef7370c
commit
b1b9ee46db
@ -354,6 +354,10 @@ GlobalActionManager::parseTomahawkLink( const QString& urlIn )
|
||||
{
|
||||
return handleViewCommand( u );
|
||||
}
|
||||
else if ( cmdType == "import" )
|
||||
{
|
||||
return handleImportCommand( u );
|
||||
}
|
||||
else
|
||||
{
|
||||
tLog() << "Tomahawk link not supported, command not known!" << cmdType << u.path();
|
||||
@ -429,6 +433,43 @@ GlobalActionManager::handlePlaylistCommand( const QUrl& url )
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
GlobalActionManager::handleImportCommand( const QUrl& url )
|
||||
{
|
||||
QStringList parts = url.path().split( "/" ).mid( 1 ); // get the rest of the command
|
||||
if ( parts.size() < 1 )
|
||||
return false;
|
||||
|
||||
if ( parts[ 0 ] == "playlist" )
|
||||
{
|
||||
if ( url.hasQueryItem( "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 ) ), this, SLOT( playlistCreatedToShow( Tomahawk::playlist_ptr) ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
else if ( url.hasQueryItem( "jspf" ) )
|
||||
{
|
||||
QUrl jspf = QUrl::fromUserInput( url.queryItemValue( "jspf" ) );
|
||||
QString title = url.hasQueryItem( "title" ) ? url.queryItemValue( "title" ) : QString();
|
||||
JSPFLoader* l= new JSPFLoader( true, this );
|
||||
l->setOverrideTitle( title );
|
||||
l->load( jspf );
|
||||
connect( l, SIGNAL( ok( Tomahawk::playlist_ptr ) ), this, SLOT( playlistCreatedToShow( Tomahawk::playlist_ptr) ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GlobalActionManager::playlistCreatedToShow( const playlist_ptr& pl )
|
||||
{
|
||||
|
@ -106,6 +106,7 @@ private:
|
||||
bool handleSearchCommand( const QUrl& url );
|
||||
bool handleQueueCommand( const QUrl& url );
|
||||
bool handleAutoPlaylistCommand( const QUrl& url );
|
||||
bool handleImportCommand( const QUrl& url );
|
||||
bool doQueueAdd( const QStringList& parts, const QList< QPair< QString, QString > >& queryItems );
|
||||
|
||||
bool playSpotify( const QUrl& url );
|
||||
|
Loading…
x
Reference in New Issue
Block a user