mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-13 09:34:53 +02:00
* Cleaned up ContextMenu a bit and added album & artist page-links for queries.
This commit is contained in:
@@ -104,14 +104,20 @@ ContextMenu::setQueries( const QList<Tomahawk::query_ptr>& queries )
|
||||
onSocialActionsLoaded();
|
||||
}
|
||||
|
||||
if ( m_supportedActions & ActionCopyLink && itemCount() == 1 )
|
||||
m_sigmap->setMapping( addAction( tr( "&Copy Track Link" ) ), ActionCopyLink );
|
||||
addSeparator();
|
||||
|
||||
if ( m_supportedActions & ActionPage && itemCount() == 1 )
|
||||
m_sigmap->setMapping( addAction( tr( "&Show Track Page" ) ), ActionPage );
|
||||
{
|
||||
m_sigmap->setMapping( addAction( tr( "&Go to \"%1\"" ).arg( m_queries.first()->track() ) ), ActionTrackPage );
|
||||
m_sigmap->setMapping( addAction( tr( "&Go to \"%1\"" ).arg( m_queries.first()->album() ) ), ActionAlbumPage );
|
||||
m_sigmap->setMapping( addAction( tr( "&Go to \"%1\"" ).arg( m_queries.first()->artist() ) ), ActionArtistPage );
|
||||
}
|
||||
|
||||
addSeparator();
|
||||
|
||||
if ( m_supportedActions & ActionCopyLink && itemCount() == 1 )
|
||||
m_sigmap->setMapping( addAction( tr( "&Copy Track Link" ) ), ActionCopyLink );
|
||||
|
||||
if ( m_supportedActions & ActionEditMetadata && itemCount() == 1 )
|
||||
m_sigmap->setMapping( addAction( tr( "Properties..." ) ), ActionEditMetadata );
|
||||
|
||||
@@ -149,14 +155,16 @@ ContextMenu::setAlbums( const QList<Tomahawk::album_ptr>& albums )
|
||||
m_albums.clear();
|
||||
m_albums << albums;
|
||||
|
||||
/* if ( m_supportedActions & ActionPlay && itemCount() == 1 )
|
||||
m_sigmap->setMapping( addAction( tr( "Show &Album Page" ) ), ActionPlay );*/
|
||||
|
||||
if ( m_supportedActions & ActionQueue )
|
||||
m_sigmap->setMapping( addAction( tr( "Add to &Queue" ) ), ActionQueue );
|
||||
|
||||
addSeparator();
|
||||
|
||||
if ( m_supportedActions & ActionPage && itemCount() == 1 )
|
||||
m_sigmap->setMapping( addAction( tr( "&Show Album Page" ) ), ActionPage );
|
||||
{
|
||||
m_sigmap->setMapping( addAction( tr( "&Go to \"%1\"" ).arg( m_albums.first()->name() ) ), ActionAlbumPage );
|
||||
m_sigmap->setMapping( addAction( tr( "&Go to \"%1\"" ).arg( m_albums.first()->artist()->name() ) ), ActionArtistPage );
|
||||
}
|
||||
|
||||
//m_sigmap->setMapping( addAction( tr( "&Add to Playlist" ) ), ActionAddToPlaylist );
|
||||
|
||||
@@ -197,8 +205,10 @@ ContextMenu::setArtists( const QList<Tomahawk::artist_ptr>& artists )
|
||||
if ( m_supportedActions & ActionQueue )
|
||||
m_sigmap->setMapping( addAction( tr( "Add to &Queue" ) ), ActionQueue );
|
||||
|
||||
addSeparator();
|
||||
|
||||
if ( m_supportedActions & ActionPage && itemCount() == 1 )
|
||||
m_sigmap->setMapping( addAction( tr( "&Show Artist Page" ) ), ActionPage );
|
||||
m_sigmap->setMapping( addAction( tr( "&Go to \"%1\"" ).arg( m_artists.first()->name() ) ), ActionArtistPage );
|
||||
|
||||
//m_sigmap->setMapping( addAction( tr( "&Add to Playlist" ) ), ActionAddToPlaylist );
|
||||
|
||||
@@ -236,8 +246,10 @@ ContextMenu::onTriggered( int action )
|
||||
copyLink();
|
||||
break;
|
||||
|
||||
case ActionPage:
|
||||
openPage();
|
||||
case ActionTrackPage:
|
||||
case ActionArtistPage:
|
||||
case ActionAlbumPage:
|
||||
openPage( (MenuActions)action );
|
||||
break;
|
||||
|
||||
case ActionLove:
|
||||
@@ -304,20 +316,42 @@ ContextMenu::copyLink()
|
||||
|
||||
|
||||
void
|
||||
ContextMenu::openPage()
|
||||
ContextMenu::openPage( MenuActions action )
|
||||
{
|
||||
if ( m_queries.count() )
|
||||
{
|
||||
ViewManager::instance()->show( m_queries.first() );
|
||||
if ( action == ActionTrackPage )
|
||||
{
|
||||
ViewManager::instance()->show( m_queries.first() );
|
||||
}
|
||||
else
|
||||
{
|
||||
const Tomahawk::artist_ptr artist = Artist::get( m_queries.first()->artist(), false );
|
||||
if ( action == ActionArtistPage )
|
||||
{
|
||||
ViewManager::instance()->show( artist );
|
||||
}
|
||||
else if ( action == ActionAlbumPage )
|
||||
{
|
||||
ViewManager::instance()->show( Album::get( artist, m_queries.first()->album(), false ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( m_albums.count() )
|
||||
{
|
||||
if ( action == ActionArtistPage )
|
||||
{
|
||||
ViewManager::instance()->show( m_albums.first()->artist() );
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewManager::instance()->show( m_albums.first() );
|
||||
}
|
||||
}
|
||||
else if ( m_artists.count() )
|
||||
{
|
||||
ViewManager::instance()->show( m_artists.first() );
|
||||
}
|
||||
else if ( m_albums.count() )
|
||||
{
|
||||
ViewManager::instance()->show( m_albums.first() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -43,6 +43,9 @@ public:
|
||||
ActionLove = 16,
|
||||
ActionStopAfter = 32,
|
||||
ActionPage = 64,
|
||||
ActionTrackPage = 65,
|
||||
ActionArtistPage = 66,
|
||||
ActionAlbumPage = 67,
|
||||
ActionEditMetadata = 128
|
||||
};
|
||||
|
||||
@@ -73,7 +76,7 @@ signals:
|
||||
private slots:
|
||||
void onTriggered( int action );
|
||||
void copyLink();
|
||||
void openPage();
|
||||
void openPage( MenuActions action );
|
||||
void addToQueue();
|
||||
|
||||
void onSocialActionsLoaded();
|
||||
|
Reference in New Issue
Block a user