mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-25 02:09:48 +01:00
* Support tomahawk://view/track in GlobalActionManager.
This commit is contained in:
parent
4fdacf80a5
commit
4ca4439255
@ -808,19 +808,21 @@ bool
|
||||
GlobalActionManager::handleViewCommand( const QUrl& url )
|
||||
{
|
||||
QStringList parts = url.path().split( "/" ).mid( 1 ); // get the rest of the command
|
||||
if ( parts.isEmpty() ) {
|
||||
if ( parts.isEmpty() )
|
||||
{
|
||||
tLog() << "No specific view command:" << url.toString();
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( parts[ 0 ] == "artist" )
|
||||
{
|
||||
const QString artist = url.queryItemValue( "name" );
|
||||
const QString artist = QUrl::fromPercentEncoding( url.encodedQueryItemValue( "name" ) ).replace( "+", " " );
|
||||
if ( artist.isEmpty() )
|
||||
{
|
||||
tLog() << "Not artist supplied for view/artist command.";
|
||||
tLog() << "No artist supplied for view/artist command.";
|
||||
return false;
|
||||
}
|
||||
|
||||
artist_ptr artistPtr = Artist::get( artist );
|
||||
if ( !artistPtr.isNull() )
|
||||
ViewManager::instance()->show( artistPtr );
|
||||
@ -829,19 +831,37 @@ GlobalActionManager::handleViewCommand( const QUrl& url )
|
||||
}
|
||||
else if ( parts[ 0 ] == "album" )
|
||||
{
|
||||
const QString artist = url.queryItemValue( "artist" );
|
||||
const QString album = url.queryItemValue( "name" );
|
||||
const QString artist = QUrl::fromPercentEncoding( url.encodedQueryItemValue( "artist" ) ).replace( "+", " " );
|
||||
const QString album = QUrl::fromPercentEncoding( url.encodedQueryItemValue( "name" ) ).replace( "+", " " );
|
||||
if ( artist.isEmpty() || album.isEmpty() )
|
||||
{
|
||||
tLog() << "Not artist or album supplied for view/artist command:" << url;
|
||||
tLog() << "No artist or album supplied for view/album command:" << url;
|
||||
return false;
|
||||
}
|
||||
|
||||
album_ptr albumPtr = Album::get( Artist::get( artist, false ), album, false );
|
||||
if ( !albumPtr.isNull() )
|
||||
ViewManager::instance()->show( albumPtr );
|
||||
|
||||
return true;
|
||||
}
|
||||
else if ( parts[ 0 ] == "track" )
|
||||
{
|
||||
const QString artist = QUrl::fromPercentEncoding( url.encodedQueryItemValue( "artist" ) ).replace( "+", " " );
|
||||
const QString album = QUrl::fromPercentEncoding( url.encodedQueryItemValue( "album" ) ).replace( "+", " " );
|
||||
const QString track = QUrl::fromPercentEncoding( url.encodedQueryItemValue( "name" ) ).replace( "+", " " );
|
||||
if ( artist.isEmpty() || track.isEmpty() )
|
||||
{
|
||||
tLog() << "No artist or track supplied for view/track command:" << url;
|
||||
return false;
|
||||
}
|
||||
|
||||
query_ptr queryPtr = Query::get( artist, track, album );
|
||||
if ( !queryPtr.isNull() )
|
||||
ViewManager::instance()->show( queryPtr );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user