mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-23 01:09:42 +01:00
* Added 'Open Page' item to Artist/Album/Track context menus.
This commit is contained in:
parent
23757b2819
commit
285b254f76
@ -38,7 +38,7 @@ ContextMenu::ContextMenu( QWidget* parent )
|
||||
m_sigmap = new QSignalMapper( this );
|
||||
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 )
|
||||
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();
|
||||
|
||||
if ( m_supportedActions & ActionDelete )
|
||||
@ -135,12 +138,15 @@ 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 & 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 );
|
||||
|
||||
if ( m_supportedActions & ActionPage && itemCount() == 1 )
|
||||
m_sigmap->setMapping( addAction( tr( "&Show Album Page" ) ), ActionPage );
|
||||
|
||||
//m_sigmap->setMapping( addAction( tr( "&Add to Playlist" ) ), ActionAddToPlaylist );
|
||||
|
||||
addSeparator();
|
||||
@ -174,12 +180,15 @@ ContextMenu::setArtists( const QList<Tomahawk::artist_ptr>& artists )
|
||||
m_artists.clear();
|
||||
m_artists << artists;
|
||||
|
||||
if ( m_supportedActions & ActionPlay && itemCount() == 1 )
|
||||
m_sigmap->setMapping( addAction( tr( "Show &Artist page" ) ), ActionPlay );
|
||||
/* if ( m_supportedActions & ActionPlay && itemCount() == 1 )
|
||||
m_sigmap->setMapping( addAction( tr( "Show &Artist Page" ) ), ActionPlay );*/
|
||||
|
||||
if ( m_supportedActions & 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 );
|
||||
|
||||
addSeparator();
|
||||
@ -215,6 +224,10 @@ ContextMenu::onTriggered( int action )
|
||||
case ActionCopyLink:
|
||||
copyLink();
|
||||
break;
|
||||
|
||||
case ActionPage:
|
||||
openPage();
|
||||
break;
|
||||
|
||||
case ActionLove:
|
||||
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
|
||||
ContextMenu::onSocialActionsLoaded()
|
||||
{
|
||||
|
@ -41,7 +41,8 @@ public:
|
||||
ActionDelete = 4,
|
||||
ActionCopyLink = 8,
|
||||
ActionLove = 16,
|
||||
ActionStopAfter = 32
|
||||
ActionStopAfter = 32,
|
||||
ActionPage = 64
|
||||
};
|
||||
|
||||
explicit ContextMenu( QWidget* parent = 0 );
|
||||
@ -69,6 +70,7 @@ signals:
|
||||
private slots:
|
||||
void onTriggered( int action );
|
||||
void copyLink();
|
||||
void openPage();
|
||||
void addToQueue();
|
||||
|
||||
void onSocialActionsLoaded();
|
||||
|
Loading…
x
Reference in New Issue
Block a user