mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 05:37:29 +02:00
Moved all menu actions to ActionCollection and removed menubar from .ui.
This commit does several things: * remove the main menu from TomahawkWindow.ui * all menu actions are created in ActionCollection.cpp, and some are merged from the old menubar where they were duplicated * some menu actions are removed entirely * the menubar is generated and returned to TomahawkWindow from ActionCollection::createMenuBar, to minimize the risk of having unused actions in the future * "Legal Info..." becomes "Legal Information..." Please note that while I did my best to #ifdef relevant Windows and Mac chunks of code, and update and split existing #ifdefs where necessary, I have not been able to test those code paths.
This commit is contained in:
@@ -109,14 +109,12 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
|
|||||||
#endif
|
#endif
|
||||||
ui->setupUi( this );
|
ui->setupUi( this );
|
||||||
|
|
||||||
ui->menuApp->insertAction( ui->actionCreatePlaylist, ActionCollection::instance()->getAction( "togglePrivacy" ) );
|
|
||||||
ui->menuApp->insertSeparator( ui->actionCreatePlaylist );
|
|
||||||
|
|
||||||
applyPlatformTweaks();
|
applyPlatformTweaks();
|
||||||
|
|
||||||
ui->centralWidget->setContentsMargins( 0, 0, 0, 0 );
|
ui->centralWidget->setContentsMargins( 0, 0, 0, 0 );
|
||||||
TomahawkUtils::unmarginLayout( ui->centralWidget->layout() );
|
TomahawkUtils::unmarginLayout( ui->centralWidget->layout() );
|
||||||
|
|
||||||
|
setMenuBar( ActionCollection::instance()->createMenuBar( this ) );
|
||||||
setupAccountsMenu();
|
setupAccountsMenu();
|
||||||
setupToolBar();
|
setupToolBar();
|
||||||
setupSideBar();
|
setupSideBar();
|
||||||
@@ -128,8 +126,8 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
|
|||||||
|
|
||||||
if ( qApp->arguments().contains( "--debug" ) )
|
if ( qApp->arguments().contains( "--debug" ) )
|
||||||
{
|
{
|
||||||
ui->menu_Help->addSeparator();
|
connect( ActionCollection::instance()->getAction( "crashNow" ), SIGNAL( triggered() ),
|
||||||
ui->menu_Help->addAction( "Crash now...", this, SLOT( crashNow() ) );
|
this, SLOT( crashNow() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// set initial state
|
// set initial state
|
||||||
@@ -311,21 +309,17 @@ TomahawkWindow::setupSideBar()
|
|||||||
ui->splitter->addWidget( ViewManager::instance()->widget() );
|
ui->splitter->addWidget( ViewManager::instance()->widget() );
|
||||||
ui->splitter->setCollapsible( 1, false );
|
ui->splitter->setCollapsible( 1, false );
|
||||||
|
|
||||||
ui->actionShowOfflineSources->setChecked( TomahawkSettings::instance()->showOfflineSources() );
|
ActionCollection::instance()->getAction( "showOfflineSources" )
|
||||||
|
->setChecked( TomahawkSettings::instance()->showOfflineSources() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TomahawkWindow::setupUpdateCheck()
|
TomahawkWindow::setupUpdateCheck()
|
||||||
{
|
{
|
||||||
#ifndef Q_OS_MAC
|
|
||||||
ui->menu_Help->insertSeparator( ui->actionAboutTomahawk );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined( Q_OS_MAC ) && defined( HAVE_SPARKLE )
|
#if defined( Q_OS_MAC ) && defined( HAVE_SPARKLE )
|
||||||
QAction* checkForUpdates = ui->menu_Help->addAction( tr( "Check For Updates..." ) );
|
connect( ActionCollection::instance()->getAction( "checkForUpdates" ), SIGNAL( triggered( bool ) ),
|
||||||
checkForUpdates->setMenuRole( QAction::ApplicationSpecificRole );
|
SLOT( checkForUpdates() ) );
|
||||||
connect( checkForUpdates, SIGNAL( triggered( bool ) ), SLOT( checkForUpdates() ) );
|
|
||||||
#elif defined( Q_WS_WIN )
|
#elif defined( Q_WS_WIN )
|
||||||
QUrl updaterUrl;
|
QUrl updaterUrl;
|
||||||
|
|
||||||
@@ -339,9 +333,8 @@ TomahawkWindow::setupUpdateCheck()
|
|||||||
updater->SetNetworkAccessManager( TomahawkUtils::nam() );
|
updater->SetNetworkAccessManager( TomahawkUtils::nam() );
|
||||||
updater->SetVersion( TomahawkUtils::appFriendlyVersion() );
|
updater->SetVersion( TomahawkUtils::appFriendlyVersion() );
|
||||||
|
|
||||||
ui->menu_Help->addSeparator();
|
connect( ActionCollection::instance()->getAction( "checkForUpdates" ), SIGNAL( triggered() ),
|
||||||
QAction* checkForUpdates = ui->menu_Help->addAction( tr( "Check For Updates..." ) );
|
updater, SLOT( CheckNow() ) );
|
||||||
connect( checkForUpdates, SIGNAL( triggered() ), updater, SLOT( CheckNow() ) );
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,30 +423,22 @@ TomahawkWindow::setupSignals()
|
|||||||
connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( audioStopped() ) );
|
connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( audioStopped() ) );
|
||||||
|
|
||||||
// <Menu Items>
|
// <Menu Items>
|
||||||
|
ActionCollection *ac = ActionCollection::instance();
|
||||||
// connect( ui->actionAddPeerManually, SIGNAL( triggered() ), SLOT( addPeerManually() ) );
|
// connect( ui->actionAddPeerManually, SIGNAL( triggered() ), SLOT( addPeerManually() ) );
|
||||||
connect( ui->actionPreferences, SIGNAL( triggered() ), SLOT( showSettingsDialog() ) );
|
connect( ac->getAction( "preferences" ), SIGNAL( triggered() ), SLOT( showSettingsDialog() ) );
|
||||||
connect( ui->actionDiagnostics, SIGNAL( triggered() ), SLOT( showDiagnosticsDialog() ) );
|
connect( ac->getAction( "diagnostics" ), SIGNAL( triggered() ), SLOT( showDiagnosticsDialog() ) );
|
||||||
connect( ui->actionLegalInfo, SIGNAL( triggered() ), SLOT( legalInfo() ) );
|
connect( ac->getAction( "legalInfo" ), SIGNAL( triggered() ), SLOT( legalInfo() ) );
|
||||||
connect( m_actionToggleConnect, SIGNAL( triggered() ), AccountManager::instance(), SLOT( toggleAccountsConnected() ) );
|
connect( m_actionToggleConnect, SIGNAL( triggered() ), AccountManager::instance(), SLOT( toggleAccountsConnected() ) );
|
||||||
connect( ui->actionUpdateCollection, SIGNAL( triggered() ), SLOT( updateCollectionManually() ) );
|
connect( ac->getAction( "updateCollection" ), SIGNAL( triggered() ), SLOT( updateCollectionManually() ) );
|
||||||
connect( ui->actionRescanCollection, SIGNAL( triggered() ), SLOT( rescanCollectionManually() ) );
|
connect( ac->getAction( "rescanCollection" ), SIGNAL( triggered() ), SLOT( rescanCollectionManually() ) );
|
||||||
connect( ui->actionLoadXSPF, SIGNAL( triggered() ), SLOT( loadSpiff() ));
|
connect( ac->getAction( "loadXSPF" ), SIGNAL( triggered() ), SLOT( loadSpiff() ));
|
||||||
connect( ui->actionCreatePlaylist, SIGNAL( triggered() ), SLOT( createPlaylist() ));
|
connect( ac->getAction( "aboutTomahawk" ), SIGNAL( triggered() ), SLOT( showAboutTomahawk() ) );
|
||||||
connect( ui->actionCreate_New_Station, SIGNAL( triggered() ), SLOT( createStation() ));
|
connect( ac->getAction( "quit" ), SIGNAL( triggered() ), qApp, SLOT( quit() ) );
|
||||||
connect( ui->actionAboutTomahawk, SIGNAL( triggered() ), SLOT( showAboutTomahawk() ) );
|
connect( ac->getAction( "showOfflineSources" ), SIGNAL( triggered() ), SLOT( showOfflineSources() ) );
|
||||||
connect( ui->actionExit, SIGNAL( triggered() ), qApp, SLOT( quit() ) );
|
|
||||||
connect( ui->actionShowOfflineSources, SIGNAL( triggered() ), SLOT( showOfflineSources() ) );
|
|
||||||
|
|
||||||
connect( ui->actionPlay, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( playPause() ) );
|
|
||||||
connect( ui->actionNext, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( next() ) );
|
|
||||||
connect( ui->actionPrevious, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( previous() ) );
|
|
||||||
|
|
||||||
#if defined( Q_OS_MAC )
|
#if defined( Q_OS_MAC )
|
||||||
connect( ui->actionMinimize, SIGNAL( triggered() ), SLOT( minimize() ) );
|
connect( ac->getAction( "minimize" ), SIGNAL( triggered() ), SLOT( minimize() ) );
|
||||||
connect( ui->actionZoom, SIGNAL( triggered() ), SLOT( maximize() ) );
|
connect( ac->getAction( "zoom" ), SIGNAL( triggered() ), SLOT( maximize() ) );
|
||||||
#else
|
|
||||||
ui->menuWindow->clear();
|
|
||||||
ui->menuWindow->menuAction()->setVisible( false );
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// <AccountHandler>
|
// <AccountHandler>
|
||||||
@@ -528,8 +513,8 @@ TomahawkWindow::showEvent( QShowEvent* e )
|
|||||||
QMainWindow::showEvent( e );
|
QMainWindow::showEvent( e );
|
||||||
|
|
||||||
#if defined( Q_OS_MAC )
|
#if defined( Q_OS_MAC )
|
||||||
ui->actionMinimize->setDisabled( false );
|
ActionCollection::instance()->getAction( "minimize" )->setDisabled( false );
|
||||||
ui->actionZoom->setDisabled( false );
|
ActionCollection::instance()->getAction( "zoom" )->setDisabled( false );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -540,8 +525,8 @@ TomahawkWindow::hideEvent( QHideEvent* e )
|
|||||||
QMainWindow::hideEvent( e );
|
QMainWindow::hideEvent( e );
|
||||||
|
|
||||||
#if defined( Q_OS_MAC )
|
#if defined( Q_OS_MAC )
|
||||||
ui->actionMinimize->setDisabled( true );
|
ActionCollection::instance()->getAction( "minimize" )->setDisabled( true );
|
||||||
ui->actionZoom->setDisabled( true );
|
ActionCollection::instance()->getAction( "zoom" )->setDisabled( true );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -818,8 +803,10 @@ TomahawkWindow::pluginMenuRemoved( QMenu* menu )
|
|||||||
void
|
void
|
||||||
TomahawkWindow::showOfflineSources()
|
TomahawkWindow::showOfflineSources()
|
||||||
{
|
{
|
||||||
m_sourcetree->showOfflineSources( ui->actionShowOfflineSources->isChecked() );
|
m_sourcetree->showOfflineSources( ActionCollection::instance()
|
||||||
TomahawkSettings::instance()->setShowOfflineSources( ui->actionShowOfflineSources->isChecked() );
|
->getAction( "showOfflineSources" )->isChecked() );
|
||||||
|
TomahawkSettings::instance()->setShowOfflineSources( ActionCollection::instance()
|
||||||
|
->getAction( "showOfflineSources" )->isChecked() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1054,7 +1041,7 @@ TomahawkWindow::audioStarted()
|
|||||||
{
|
{
|
||||||
m_audioRetryCounter = 0;
|
m_audioRetryCounter = 0;
|
||||||
|
|
||||||
ui->actionPlay->setText( tr( "Pause" ) );
|
ActionCollection::instance()->getAction( "playPause" )->setText( tr( "Pause" ) );
|
||||||
ActionCollection::instance()->getAction( "stop" )->setEnabled( true );
|
ActionCollection::instance()->getAction( "stop" )->setEnabled( true );
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
@@ -1074,7 +1061,7 @@ TomahawkWindow::audioFinished()
|
|||||||
void
|
void
|
||||||
TomahawkWindow::audioPaused()
|
TomahawkWindow::audioPaused()
|
||||||
{
|
{
|
||||||
ui->actionPlay->setText( tr( "Play" ) );
|
ActionCollection::instance()->getAction( "playPause" )->setText( tr( "&Play" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -61,60 +61,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenuBar" name="menuBar">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>1000</width>
|
|
||||||
<height>20</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<widget class="QMenu" name="menuSettings">
|
|
||||||
<property name="title">
|
|
||||||
<string>&Settings</string>
|
|
||||||
</property>
|
|
||||||
<addaction name="actionPreferences"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="QMenu" name="menuApp">
|
|
||||||
<property name="title">
|
|
||||||
<string>&Controls</string>
|
|
||||||
</property>
|
|
||||||
<addaction name="actionPlay"/>
|
|
||||||
<addaction name="actionPrevious"/>
|
|
||||||
<addaction name="actionNext"/>
|
|
||||||
<addaction name="separator"/>
|
|
||||||
<addaction name="actionCreatePlaylist"/>
|
|
||||||
<addaction name="actionCreate_New_Station"/>
|
|
||||||
<addaction name="actionLoadXSPF"/>
|
|
||||||
<addaction name="separator"/>
|
|
||||||
<addaction name="actionUpdateCollection"/>
|
|
||||||
<addaction name="actionRescanCollection"/>
|
|
||||||
<addaction name="separator"/>
|
|
||||||
<addaction name="actionShowOfflineSources"/>
|
|
||||||
<addaction name="separator"/>
|
|
||||||
<addaction name="actionExit"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="QMenu" name="menuWindow">
|
|
||||||
<property name="title">
|
|
||||||
<string>&Window</string>
|
|
||||||
</property>
|
|
||||||
<addaction name="actionMinimize"/>
|
|
||||||
<addaction name="actionZoom"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="QMenu" name="menu_Help">
|
|
||||||
<property name="title">
|
|
||||||
<string>&Help</string>
|
|
||||||
</property>
|
|
||||||
<addaction name="actionDiagnostics"/>
|
|
||||||
<addaction name="actionAboutTomahawk"/>
|
|
||||||
<addaction name="actionLegalInfo"/>
|
|
||||||
</widget>
|
|
||||||
<addaction name="menuApp"/>
|
|
||||||
<addaction name="menuSettings"/>
|
|
||||||
<addaction name="menuWindow"/>
|
|
||||||
<addaction name="menu_Help"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="QStatusBar" name="statusBar"/>
|
<widget class="QStatusBar" name="statusBar"/>
|
||||||
<action name="actionExit">
|
<action name="actionExit">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||||
* Copyright 2012, Leo Franchi <lfranchi@kde.org>
|
* Copyright 2012, Leo Franchi <lfranchi@kde.org>
|
||||||
|
* Copyright 2012, Teo Mrnjavac <teo@kde.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -69,14 +70,17 @@ ActionCollection::initActions()
|
|||||||
m_actionCollection[ "togglePrivacy" ] = privacyToggle;
|
m_actionCollection[ "togglePrivacy" ] = privacyToggle;
|
||||||
connect( m_actionCollection[ "togglePrivacy" ], SIGNAL( triggered() ), SLOT( togglePrivateListeningMode() ), Qt::UniqueConnection );
|
connect( m_actionCollection[ "togglePrivacy" ], SIGNAL( triggered() ), SLOT( togglePrivateListeningMode() ), Qt::UniqueConnection );
|
||||||
|
|
||||||
m_actionCollection[ "loadPlaylist" ] = new QAction( tr( "&Load Playlist" ), this );
|
m_actionCollection[ "loadPlaylist" ] = new QAction( tr( "&Load Playlist" ), this );
|
||||||
|
m_actionCollection[ "loadPlaylist" ]->setShortcut( Qt::Key_Space );
|
||||||
m_actionCollection[ "renamePlaylist" ] = new QAction( tr( "&Rename Playlist" ), this );
|
m_actionCollection[ "renamePlaylist" ] = new QAction( tr( "&Rename Playlist" ), this );
|
||||||
m_actionCollection[ "copyPlaylist" ] = new QAction( tr( "&Copy Playlist Link" ), this );
|
m_actionCollection[ "copyPlaylist" ] = new QAction( tr( "&Copy Playlist Link" ), this );
|
||||||
m_actionCollection[ "playPause" ] = new QAction( tr( "&Play" ), this );
|
m_actionCollection[ "playPause" ] = new QAction( tr( "&Play" ), this );
|
||||||
m_actionCollection[ "stop" ] = new QAction( tr( "&Stop" ), this );
|
m_actionCollection[ "stop" ] = new QAction( tr( "&Stop" ), this );
|
||||||
m_actionCollection[ "previousTrack" ] = new QAction( tr( "&Previous Track" ), this );
|
m_actionCollection[ "previousTrack" ] = new QAction( tr( "&Previous Track" ), this );
|
||||||
m_actionCollection[ "nextTrack" ] = new QAction( tr( "&Next Track" ), this );
|
m_actionCollection[ "nextTrack" ] = new QAction( tr( "&Next Track" ), this );
|
||||||
m_actionCollection[ "quit" ] = new QAction( tr( "&Quit" ), this );
|
m_actionCollection[ "quit" ] = new QAction( tr( "&Quit" ), this );
|
||||||
|
m_actionCollection[ "quit" ]->setShortcut( QKeySequence::Quit );
|
||||||
|
m_actionCollection[ "quit" ]->setMenuRole( QAction::QuitRole );
|
||||||
|
|
||||||
// connect actions to AudioEngine
|
// connect actions to AudioEngine
|
||||||
AudioEngine *ae = AudioEngine::instance();
|
AudioEngine *ae = AudioEngine::instance();
|
||||||
@@ -84,6 +88,91 @@ ActionCollection::initActions()
|
|||||||
connect( m_actionCollection[ "stop" ], SIGNAL( triggered() ), ae, SLOT( stop() ), 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[ "previousTrack" ], SIGNAL( triggered() ), ae, SLOT( previous() ), Qt::UniqueConnection );
|
||||||
connect( m_actionCollection[ "nextTrack" ], SIGNAL( triggered() ), ae, SLOT( next() ), 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" ]->setMenuRole( QAction::PreferencesRole );
|
||||||
|
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[ "diagnostics" ] = new QAction( tr( "Diagnostics..." ), this );
|
||||||
|
m_actionCollection[ "aboutTomahawk" ] = new QAction( tr( "About &Tomahawk..." ), this );
|
||||||
|
m_actionCollection[ "aboutTomahawk" ]->setMenuRole( QAction::AboutRole );
|
||||||
|
m_actionCollection[ "legalInfo" ] = new QAction( tr( "&Legal Information..." ), this );
|
||||||
|
#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 );
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenuBar *
|
||||||
|
ActionCollection::createMenuBar( QWidget *parent )
|
||||||
|
{
|
||||||
|
QMenuBar *menuBar = new QMenuBar( parent );
|
||||||
|
|
||||||
|
QMenu *controlsMenu = new QMenu( tr( "&Controls" ), menuBar );
|
||||||
|
controlsMenu->addAction( m_actionCollection[ "playPause" ] );
|
||||||
|
controlsMenu->addAction( m_actionCollection[ "previousTrack" ] );
|
||||||
|
controlsMenu->addAction( m_actionCollection[ "nextTrack" ] );
|
||||||
|
controlsMenu->addSeparator();
|
||||||
|
controlsMenu->addAction( m_actionCollection[ "togglePrivacy" ] );
|
||||||
|
controlsMenu->addAction( m_actionCollection[ "showOfflineSources" ] );
|
||||||
|
controlsMenu->addSeparator();
|
||||||
|
controlsMenu->addAction( m_actionCollection[ "loadXSPF" ] );
|
||||||
|
controlsMenu->addAction( m_actionCollection[ "updateCollection" ] );
|
||||||
|
controlsMenu->addAction( m_actionCollection[ "rescanCollection" ] );
|
||||||
|
controlsMenu->addSeparator();
|
||||||
|
controlsMenu->addAction( m_actionCollection[ "quit" ] );
|
||||||
|
|
||||||
|
QMenu *settingsMenu = new QMenu( tr( "&Settings" ), menuBar );
|
||||||
|
settingsMenu->addAction( m_actionCollection[ "preferences" ] );
|
||||||
|
|
||||||
|
QMenu *windowMenu = new QMenu( tr( "&Window" ), menuBar );
|
||||||
|
windowMenu->addAction( m_actionCollection[ "minimize" ] );
|
||||||
|
windowMenu->addAction( m_actionCollection[ "zoom" ] );
|
||||||
|
|
||||||
|
QMenu *helpMenu = new QMenu( tr( "&Help" ), menuBar );
|
||||||
|
helpMenu->addAction( m_actionCollection[ "diagnostics" ] );
|
||||||
|
helpMenu->addAction( m_actionCollection[ "aboutTomahawk" ] );
|
||||||
|
helpMenu->addAction( m_actionCollection[ "legalInfo" ] );
|
||||||
|
|
||||||
|
// Setup update check
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
helpMenu->insertSeparator( m_actionCollection[ "aboutTomahawk" ] );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined( Q_OS_MAC ) && defined( HAVE_SPARKLE )
|
||||||
|
helpMenu->addAction( m_actionCollection[ "checkForUpdates" ] );
|
||||||
|
#elif defined( Q_WS_WIN )
|
||||||
|
helpMenu->addSeparator();
|
||||||
|
helpMenu->addAction( m_actionCollection[ "checkForUpdates" ] );
|
||||||
|
#endif
|
||||||
|
if ( qApp->arguments().contains( "--debug" ) )
|
||||||
|
{
|
||||||
|
helpMenu->addSeparator();
|
||||||
|
helpMenu->addAction( m_actionCollection[ "crashNow" ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
menuBar->addMenu( controlsMenu );
|
||||||
|
menuBar->addMenu( settingsMenu );
|
||||||
|
#if defined( Q_OS_MAC )
|
||||||
|
menuBar->addMenu( windowMenu );
|
||||||
|
#endif
|
||||||
|
menuBar->addMenu( helpMenu );
|
||||||
|
return menuBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu *
|
||||||
|
ActionCollection::createCompressedMenu( QWidget *parent )
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
|
|
||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
|
#include <QtGui/QMenuBar>
|
||||||
|
|
||||||
class DLLEXPORT ActionCollection : public QObject
|
class DLLEXPORT ActionCollection : public QObject
|
||||||
{
|
{
|
||||||
@@ -43,6 +44,9 @@ public:
|
|||||||
|
|
||||||
void initActions();
|
void initActions();
|
||||||
|
|
||||||
|
QMenuBar *createMenuBar( QWidget *parent );
|
||||||
|
QMenu *createCompressedMenu( QWidget *parent );
|
||||||
|
|
||||||
QAction* getAction( const QString& name );
|
QAction* getAction( const QString& name );
|
||||||
QList< QAction* > getAction( ActionDestination category );
|
QList< QAction* > getAction( ActionDestination category );
|
||||||
QObject* actionNotifier( QAction* );
|
QObject* actionNotifier( QAction* );
|
||||||
|
Reference in New Issue
Block a user