1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-04 21:27:58 +02:00

* Added 'Open Page' item to Artist/Album/Track context menus.

This commit is contained in:
Christian Muehlhaeuser
2012-05-19 03:08:50 +02:00
parent 23757b2819
commit 285b254f76
2 changed files with 39 additions and 6 deletions

View File

@@ -38,7 +38,7 @@ ContextMenu::ContextMenu( QWidget* parent )
m_sigmap = new QSignalMapper( this ); m_sigmap = new QSignalMapper( this );
connect( m_sigmap, SIGNAL( mapped( int ) ), SLOT( onTriggered( int ) ) ); connect( m_sigmap, SIGNAL( mapped( int ) ), SLOT( onTriggered( int ) ) );
m_supportedActions = ActionPlay | ActionQueue | ActionCopyLink | ActionLove | ActionStopAfter; m_supportedActions = ActionPlay | ActionQueue | ActionCopyLink | ActionLove | ActionStopAfter | ActionPage;
} }
@@ -104,6 +104,9 @@ ContextMenu::setQueries( const QList<Tomahawk::query_ptr>& queries )
if ( m_supportedActions & ActionCopyLink && itemCount() == 1 ) if ( m_supportedActions & ActionCopyLink && itemCount() == 1 )
m_sigmap->setMapping( addAction( tr( "&Copy Track Link" ) ), ActionCopyLink ); m_sigmap->setMapping( addAction( tr( "&Copy Track Link" ) ), ActionCopyLink );
if ( m_supportedActions & ActionPage && itemCount() == 1 )
m_sigmap->setMapping( addAction( tr( "&Show Track Page" ) ), ActionPage );
addSeparator(); addSeparator();
if ( m_supportedActions & ActionDelete ) if ( m_supportedActions & ActionDelete )
@@ -135,12 +138,15 @@ ContextMenu::setAlbums( const QList<Tomahawk::album_ptr>& albums )
m_albums.clear(); m_albums.clear();
m_albums << albums; m_albums << albums;
if ( m_supportedActions & ActionPlay && itemCount() == 1 ) /* if ( m_supportedActions & ActionPlay && itemCount() == 1 )
m_sigmap->setMapping( addAction( tr( "Show &Album page" ) ), ActionPlay ); m_sigmap->setMapping( addAction( tr( "Show &Album Page" ) ), ActionPlay );*/
if ( m_supportedActions & ActionQueue ) if ( m_supportedActions & ActionQueue )
m_sigmap->setMapping( addAction( tr( "Add to &Queue" ) ), ActionQueue ); m_sigmap->setMapping( addAction( tr( "Add to &Queue" ) ), ActionQueue );
if ( m_supportedActions & ActionPage && itemCount() == 1 )
m_sigmap->setMapping( addAction( tr( "&Show Album Page" ) ), ActionPage );
//m_sigmap->setMapping( addAction( tr( "&Add to Playlist" ) ), ActionAddToPlaylist ); //m_sigmap->setMapping( addAction( tr( "&Add to Playlist" ) ), ActionAddToPlaylist );
addSeparator(); addSeparator();
@@ -174,12 +180,15 @@ ContextMenu::setArtists( const QList<Tomahawk::artist_ptr>& artists )
m_artists.clear(); m_artists.clear();
m_artists << artists; m_artists << artists;
if ( m_supportedActions & ActionPlay && itemCount() == 1 ) /* if ( m_supportedActions & ActionPlay && itemCount() == 1 )
m_sigmap->setMapping( addAction( tr( "Show &Artist page" ) ), ActionPlay ); m_sigmap->setMapping( addAction( tr( "Show &Artist Page" ) ), ActionPlay );*/
if ( m_supportedActions & ActionQueue ) if ( m_supportedActions & ActionQueue )
m_sigmap->setMapping( addAction( tr( "Add to &Queue" ) ), ActionQueue ); m_sigmap->setMapping( addAction( tr( "Add to &Queue" ) ), ActionQueue );
if ( m_supportedActions & ActionPage && itemCount() == 1 )
m_sigmap->setMapping( addAction( tr( "&Show Artist Page" ) ), ActionPage );
//m_sigmap->setMapping( addAction( tr( "&Add to Playlist" ) ), ActionAddToPlaylist ); //m_sigmap->setMapping( addAction( tr( "&Add to Playlist" ) ), ActionAddToPlaylist );
addSeparator(); addSeparator();
@@ -215,6 +224,10 @@ ContextMenu::onTriggered( int action )
case ActionCopyLink: case ActionCopyLink:
copyLink(); copyLink();
break; break;
case ActionPage:
openPage();
break;
case ActionLove: case ActionLove:
m_queries.first()->setLoved( !m_queries.first()->loved() ); m_queries.first()->setLoved( !m_queries.first()->loved() );
@@ -264,6 +277,24 @@ ContextMenu::copyLink()
} }
void
ContextMenu::openPage()
{
if ( m_queries.count() )
{
ViewManager::instance()->show( m_queries.first() );
}
else if ( m_artists.count() )
{
ViewManager::instance()->show( m_artists.first() );
}
else if ( m_albums.count() )
{
ViewManager::instance()->show( m_albums.first() );
}
}
void void
ContextMenu::onSocialActionsLoaded() ContextMenu::onSocialActionsLoaded()
{ {

View File

@@ -41,7 +41,8 @@ public:
ActionDelete = 4, ActionDelete = 4,
ActionCopyLink = 8, ActionCopyLink = 8,
ActionLove = 16, ActionLove = 16,
ActionStopAfter = 32 ActionStopAfter = 32,
ActionPage = 64
}; };
explicit ContextMenu( QWidget* parent = 0 ); explicit ContextMenu( QWidget* parent = 0 );
@@ -69,6 +70,7 @@ signals:
private slots: private slots:
void onTriggered( int action ); void onTriggered( int action );
void copyLink(); void copyLink();
void openPage();
void addToQueue(); void addToQueue();
void onSocialActionsLoaded(); void onSocialActionsLoaded();