1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-14 13:01:53 +02:00

Made the toggle menubar key shortcut work when the menubar is hidden.

This commit is contained in:
Teo Mrnjavac 2012-08-04 18:58:45 +02:00
parent c1408213df
commit 4c136fc4fc
2 changed files with 8 additions and 0 deletions

View File

@ -276,6 +276,11 @@ TomahawkWindow::setupToolBar()
compactMenuButton->setMenu( m_compactMainMenu );
compactMenuButton->setToolButtonStyle( Qt::ToolButtonIconOnly );
m_compactMenuAction = toolbar->addWidget( compactMenuButton );
//HACK: adding the toggle action to the window, otherwise the shortcut keys
// won't be picked up when the menu is hidden.
// This must be done for all menu bar actions that have shortcut keys :(
// Does not apply to Mac which always shows the menu bar.
addAction( ActionCollection::instance()->getAction( "toggleMenuBar" ) );
#endif
}

View File

@ -75,11 +75,13 @@ ActionCollection::initActions()
m_actionCollection[ "copyPlaylist" ] = new QAction( tr( "&Copy Playlist Link" ), this );
m_actionCollection[ "playPause" ] = new QAction( tr( "&Play" ), this );
m_actionCollection[ "playPause" ]->setShortcut( Qt::Key_Space );
m_actionCollection[ "playPause" ]->setShortcutContext( Qt::ApplicationShortcut );
m_actionCollection[ "stop" ] = new QAction( tr( "&Stop" ), this );
m_actionCollection[ "previousTrack" ] = new QAction( tr( "&Previous Track" ), this );
m_actionCollection[ "nextTrack" ] = new QAction( tr( "&Next Track" ), this );
m_actionCollection[ "quit" ] = new QAction( tr( "&Quit" ), this );
m_actionCollection[ "quit" ]->setShortcut( QKeySequence::Quit );
m_actionCollection[ "quit" ]->setShortcutContext( Qt::ApplicationShortcut );
m_actionCollection[ "quit" ]->setMenuRole( QAction::QuitRole );
// connect actions to AudioEngine
@ -105,6 +107,7 @@ ActionCollection::initActions()
#else
m_actionCollection[ "toggleMenuBar" ] = new QAction( tr( "Hide Menu Bar" ), this );
m_actionCollection[ "toggleMenuBar" ]->setShortcut( QKeySequence( "Ctrl+M" ) );
m_actionCollection[ "toggleMenuBar" ]->setShortcutContext( Qt::ApplicationShortcut );
#endif
m_actionCollection[ "diagnostics" ] = new QAction( tr( "Diagnostics..." ), this );
m_actionCollection[ "diagnostics" ]->setMenuRole( QAction::ApplicationSpecificRole );