void ActionCollection::initActions() { QAction *latchOn = new QAction( tr( "&Listen Along" ), this ); latchOn->setIcon( QIcon( RESPATH "images/headphones-sidebar.png" ) ); m_actionCollection[ "latchOn" ] = latchOn; QAction *latchOff = new QAction( tr( "&Stop Listening Along" ), this ); latchOff->setIcon( QIcon( RESPATH "images/headphones-off.png" ) ); m_actionCollection[ "latchOff" ] = latchOff; bool isPublic = TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening; QAction *privacyToggle = new QAction( ( isPublic ? tr( "&Listen Privately" ) : tr( "&Listen Publicly" ) ), this ); privacyToggle->setIcon( QIcon( RESPATH "images/private-listening.png" ) ); privacyToggle->setIconVisibleInMenu( isPublic ); m_actionCollection[ "togglePrivacy" ] = privacyToggle; connect( m_actionCollection[ "togglePrivacy" ], SIGNAL( triggered() ), SLOT( togglePrivateListeningMode() ), Qt::UniqueConnection ); m_actionCollection[ "loadPlaylist"] = new QAction( tr( "&Load Playlist" ), this ); m_actionCollection[ "renamePlaylist"] = new QAction( tr( "&Rename Playlist" ), this ); m_actionCollection[ "copyPlaylist"] = new QAction( tr( "&Copy Playlist Link" ), this ); m_actionCollection[ "playPause"] = new QAction( tr( "&Play" ), this ); 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 ); // connect actions to AudioEngine AudioEngine *ae = AudioEngine::instance(); connect( m_actionCollection[ "playPause" ], SIGNAL( triggered() ), ae, SLOT( playPause() ), Qt::UniqueConnection ); connect( m_actionCollection[ "stop" ], SIGNAL( triggered() ), ae, SLOT( stop() ), Qt::UniqueConnection ); connect( m_actionCollection[ "previousTrack" ], SIGNAL( triggered() ), ae, SLOT( previous() ), Qt::UniqueConnection ); connect( m_actionCollection[ "nextTrack" ], SIGNAL( triggered() ), ae, SLOT( next() ), Qt::UniqueConnection ); }
void ActionCollection::initActions() { QAction *latchOn = new QAction( tr( "&Listen Along" ), this ); latchOn->setIcon( ImageRegistry::instance()->icon( RESPATH "images/headphones.svg" ) ); m_actionCollection[ "latchOn" ] = latchOn; QAction *latchOff = new QAction( tr( "Stop &Listening Along" ), this ); latchOff->setIcon( ImageRegistry::instance()->icon( RESPATH "images/headphones-off.svg" ) ); m_actionCollection[ "latchOff" ] = latchOff; QAction *realtimeFollowingAlong = new QAction( tr( "&Follow in real-time" ), this ); realtimeFollowingAlong->setCheckable( true ); m_actionCollection[ "realtimeFollowingAlong" ] = realtimeFollowingAlong; bool isPublic = TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening; QAction *privacyToggle = new QAction( ( isPublic ? tr( "&Listen Privately" ) : tr( "&Listen Publicly" ) ), this ); privacyToggle->setIcon( ImageRegistry::instance()->icon( RESPATH "images/private-listening.svg" ) ); privacyToggle->setIconVisibleInMenu( isPublic ); m_actionCollection[ "togglePrivacy" ] = privacyToggle; connect( m_actionCollection[ "togglePrivacy" ], SIGNAL( triggered() ), SLOT( togglePrivateListeningMode() ), Qt::UniqueConnection ); m_actionCollection[ "loadPlaylist" ] = new QAction( tr( "&Load Playlist" ), this ); m_actionCollection[ "loadStation" ] = new QAction( tr( "&Load Station" ), this ); m_actionCollection[ "renamePlaylist" ] = new QAction( tr( "&Rename Playlist" ), this ); m_actionCollection[ "renameStation" ] = new QAction( tr( "&Rename Station" ), this ); m_actionCollection[ "copyPlaylist" ] = new QAction( tr( "&Copy Playlist Link" ), this ); m_actionCollection[ "playPause" ] = new QAction( tr( "&Play" ), this ); m_actionCollection[ "playPause" ]->setIcon( ImageRegistry::instance()->icon( RESPATH "images/play-rest.svg" ) ); 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[ "previousTrack" ]->setIcon( ImageRegistry::instance()->icon( RESPATH "images/back-rest.svg" ) ); m_actionCollection[ "nextTrack" ] = new QAction( tr( "&Next Track" ), this ); m_actionCollection[ "nextTrack" ]->setIcon( ImageRegistry::instance()->icon( RESPATH "images/skip-rest.svg" ) ); 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 AudioEngine *ae = AudioEngine::instance(); connect( m_actionCollection[ "playPause" ], SIGNAL( triggered() ), ae, SLOT( playPause() ), Qt::UniqueConnection ); connect( m_actionCollection[ "stop" ], SIGNAL( triggered() ), ae, SLOT( stop() ), Qt::UniqueConnection ); connect( m_actionCollection[ "previousTrack" ], SIGNAL( triggered() ), ae, SLOT( previous() ), Qt::UniqueConnection ); connect( m_actionCollection[ "nextTrack" ], SIGNAL( triggered() ), ae, SLOT( next() ), Qt::UniqueConnection ); // main menu actions m_actionCollection[ "loadXSPF" ] = new QAction( tr( "Load &XSPF..." ), this ); m_actionCollection[ "updateCollection" ] = new QAction( tr( "U&pdate Collection" ), this ); m_actionCollection[ "rescanCollection" ] = new QAction( tr( "Fully &Rescan Collection" ), this ); m_actionCollection[ "showOfflineSources" ] = new QAction( tr( "Show Offline Sources" ), this ); m_actionCollection[ "showOfflineSources" ]->setCheckable( true ); m_actionCollection[ "preferences" ] = new QAction( tr( "&Configure Tomahawk..." ), this ); m_actionCollection[ "preferences" ]->setIcon( ImageRegistry::instance()->icon( RESPATH "images/configure.svg" ) ); m_actionCollection[ "preferences" ]->setMenuRole( QAction::PreferencesRole ); #ifdef Q_OS_MAC m_actionCollection[ "minimize" ] = new QAction( tr( "Minimize" ), this ); m_actionCollection[ "minimize" ]->setShortcut( QKeySequence( "Ctrl+M" ) ); m_actionCollection[ "zoom" ] = new QAction( tr( "Zoom" ), this ); m_actionCollection[ "zoom" ]->setShortcut( QKeySequence( "Meta+Ctrl+Z" ) ); m_actionCollection[ "fullscreen" ] = new QAction( tr( "Enter Full Screen" ), this ); m_actionCollection[ "fullscreen" ]->setShortcut( QKeySequence( "Meta+Ctrl+F" ) ); #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 ); m_actionCollection[ "aboutTomahawk" ] = new QAction( tr( "About &Tomahawk..." ), this ); m_actionCollection[ "aboutTomahawk" ]->setIcon( ImageRegistry::instance()->icon( RESPATH "images/info.svg" ) ); m_actionCollection[ "aboutTomahawk" ]->setMenuRole( QAction::AboutRole ); m_actionCollection[ "legalInfo" ] = new QAction( tr( "&Legal Information..." ), this ); m_actionCollection[ "legalInfo" ]->setMenuRole( QAction::ApplicationSpecificRole ); m_actionCollection[ "openLogfile" ] = new QAction( tr( "&View Logfile" ), this ); m_actionCollection[ "openLogfile" ]->setMenuRole( QAction::ApplicationSpecificRole ); #if defined( Q_OS_MAC ) && defined( HAVE_SPARKLE ) || defined( Q_WS_WIN ) m_actionCollection[ "checkForUpdates" ] = new QAction( tr( "Check For Updates..." ), this ); m_actionCollection[ "checkForUpdates" ]->setMenuRole( QAction::ApplicationSpecificRole ); #endif m_actionCollection[ "crashNow" ] = new QAction( "Crash now...", this ); }