mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-02 12:20:45 +02:00
Merge pull request #111 from teo/master
Make menubar hideable and other stuff.
This commit is contained in:
@@ -73,6 +73,7 @@ SET( tomahawkSourcesGui ${tomahawkSourcesGui}
|
|||||||
TomahawkWindow.cpp
|
TomahawkWindow.cpp
|
||||||
LoadXSPFDialog.cpp
|
LoadXSPFDialog.cpp
|
||||||
SocialWidget.cpp
|
SocialWidget.cpp
|
||||||
|
ContainedMenuButton.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
IF( WITH_BREAKPAD )
|
IF( WITH_BREAKPAD )
|
||||||
|
52
src/ContainedMenuButton.cpp
Normal file
52
src/ContainedMenuButton.cpp
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2012, Teo Mrnjavac <teo@kde.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ContainedMenuButton.h"
|
||||||
|
|
||||||
|
#include <QtGui/QMouseEvent>
|
||||||
|
|
||||||
|
ContainedMenuButton::ContainedMenuButton( QWidget *parent )
|
||||||
|
: QToolButton( parent )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ContainedMenuButton::setMenu( QMenu *menu )
|
||||||
|
{
|
||||||
|
m_menu = menu;
|
||||||
|
connect( m_menu, SIGNAL( aboutToHide() ), SLOT( menuHidden() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ContainedMenuButton::mousePressEvent( QMouseEvent *event )
|
||||||
|
{
|
||||||
|
if( m_menu )
|
||||||
|
{
|
||||||
|
QPoint myPos = mapToGlobal( rect().bottomRight() );
|
||||||
|
myPos.rx() -= m_menu->sizeHint().width();
|
||||||
|
m_menu->popup( myPos );
|
||||||
|
event->accept();
|
||||||
|
}
|
||||||
|
QToolButton::mousePressEvent( event );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ContainedMenuButton::menuHidden()
|
||||||
|
{
|
||||||
|
setDown( false );
|
||||||
|
}
|
47
src/ContainedMenuButton.h
Normal file
47
src/ContainedMenuButton.h
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2012, Teo Mrnjavac <teo@kde.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONTAINEDMENUBUTTON_H
|
||||||
|
#define CONTAINEDMENUBUTTON_H
|
||||||
|
|
||||||
|
#include <QtGui/QMenu>
|
||||||
|
#include <QtGui/QToolButton>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The ContainedMenuButton class defines a modified QToolButton that pops
|
||||||
|
* up a QMenu under itself, stretching left instead of right and witout
|
||||||
|
* drawing an arrow primitive.
|
||||||
|
*/
|
||||||
|
class ContainedMenuButton : public QToolButton
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit ContainedMenuButton( QWidget *parent = 0 );
|
||||||
|
|
||||||
|
void setMenu( QMenu *menu );
|
||||||
|
QMenu *menu() const { return m_menu; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void mousePressEvent( QMouseEvent *event );
|
||||||
|
private slots:
|
||||||
|
void menuHidden();
|
||||||
|
private:
|
||||||
|
QMenu *m_menu;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CONTAINEDMENUBUTTON_H
|
@@ -73,6 +73,7 @@ SettingsDialog::SettingsDialog( QWidget *parent )
|
|||||||
TomahawkSettings* s = TomahawkSettings::instance();
|
TomahawkSettings* s = TomahawkSettings::instance();
|
||||||
|
|
||||||
TomahawkUtils::unmarginLayout( layout() );
|
TomahawkUtils::unmarginLayout( layout() );
|
||||||
|
TomahawkUtils::unmarginLayout( ui->horizontalLayout );
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
ui->stackedWidget->setContentsMargins( 4, 4, 4, 4 );
|
ui->stackedWidget->setContentsMargins( 4, 4, 4, 4 );
|
||||||
@@ -116,6 +117,8 @@ SettingsDialog::SettingsDialog( QWidget *parent )
|
|||||||
createIcons();
|
createIcons();
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
setContentsMargins( 4, 4, 4, 4 );
|
setContentsMargins( 4, 4, 4, 4 );
|
||||||
|
#elif defined( Q_OS_MAC )
|
||||||
|
setContentsMargins( 0, 0, 0, 4 );
|
||||||
#else
|
#else
|
||||||
setContentsMargins( 0, 4, 4, 4 );
|
setContentsMargins( 0, 4, 4, 4 );
|
||||||
#endif
|
#endif
|
||||||
|
@@ -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, Leo Franchi <lfranchi@kde.org>
|
* Copyright 2010-2012, Leo Franchi <lfranchi@kde.org>
|
||||||
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.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
|
||||||
@@ -35,6 +36,7 @@
|
|||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
|
#include <QToolButton>
|
||||||
|
|
||||||
#include "accounts/AccountManager.h"
|
#include "accounts/AccountManager.h"
|
||||||
#include "sourcetree/SourceTreeView.h"
|
#include "sourcetree/SourceTreeView.h"
|
||||||
@@ -70,6 +72,7 @@
|
|||||||
#include "libtomahawk/filemetadata/ScanManager.h"
|
#include "libtomahawk/filemetadata/ScanManager.h"
|
||||||
#include "TomahawkApp.h"
|
#include "TomahawkApp.h"
|
||||||
#include "LoadXSPFDialog.h"
|
#include "LoadXSPFDialog.h"
|
||||||
|
#include "ContainedMenuButton.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#include <qtsparkle/Updater>
|
#include <qtsparkle/Updater>
|
||||||
@@ -108,14 +111,13 @@ 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() );
|
||||||
|
|
||||||
|
setupMenuBar();
|
||||||
|
setupAccountsMenu();
|
||||||
setupToolBar();
|
setupToolBar();
|
||||||
setupSideBar();
|
setupSideBar();
|
||||||
statusBar()->addPermanentWidget( m_audioControls, 1 );
|
statusBar()->addPermanentWidget( m_audioControls, 1 );
|
||||||
@@ -126,8 +128,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
|
||||||
@@ -186,6 +188,14 @@ TomahawkWindow::loadSettings()
|
|||||||
setWindowOpacity( 1 );
|
setWindowOpacity( 1 );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
bool mbVisible = s->menuBarVisible();
|
||||||
|
menuBar()->setVisible( mbVisible );
|
||||||
|
m_compactMenuAction->setVisible( !mbVisible );
|
||||||
|
ActionCollection::instance()->getAction( "toggleMenuBar" )
|
||||||
|
->setText( mbVisible ? tr( "Hide Menu Bar" ) : tr( "Show Menu Bar" ) );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -196,6 +206,7 @@ TomahawkWindow::saveSettings()
|
|||||||
s->setMainWindowGeometry( saveGeometry() );
|
s->setMainWindowGeometry( saveGeometry() );
|
||||||
s->setMainWindowState( saveState() );
|
s->setMainWindowState( saveState() );
|
||||||
s->setMainWindowSplitterState( ui->splitter->saveState() );
|
s->setMainWindowSplitterState( ui->splitter->saveState() );
|
||||||
|
s->setMenuBarVisible( menuBar()->isVisible() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -218,7 +229,7 @@ TomahawkWindow::applyPlatformTweaks()
|
|||||||
void
|
void
|
||||||
TomahawkWindow::setupToolBar()
|
TomahawkWindow::setupToolBar()
|
||||||
{
|
{
|
||||||
QToolBar* toolbar = addToolBar( "TomahawkToolbar" );
|
QToolBar *toolbar = addToolBar( "TomahawkToolbar" );
|
||||||
toolbar->setObjectName( "TomahawkToolbar" );
|
toolbar->setObjectName( "TomahawkToolbar" );
|
||||||
toolbar->setMovable( false );
|
toolbar->setMovable( false );
|
||||||
toolbar->setFloatable( false );
|
toolbar->setFloatable( false );
|
||||||
@@ -235,9 +246,9 @@ TomahawkWindow::setupToolBar()
|
|||||||
m_forwardAction = toolbar->addAction( QIcon( RESPATH "images/forward.png" ), tr( "Forward" ), ViewManager::instance(), SLOT( historyForward() ) );
|
m_forwardAction = toolbar->addAction( QIcon( RESPATH "images/forward.png" ), tr( "Forward" ), ViewManager::instance(), SLOT( historyForward() ) );
|
||||||
m_forwardAction->setToolTip( tr( "Go forward one page" ) );
|
m_forwardAction->setToolTip( tr( "Go forward one page" ) );
|
||||||
|
|
||||||
QWidget* spacer = new QWidget( this );
|
QWidget* leftSpacer = new QWidget( this );
|
||||||
spacer->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
leftSpacer->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
||||||
toolbar->addWidget( spacer );
|
toolbar->addWidget( leftSpacer );
|
||||||
|
|
||||||
m_searchWidget = new QSearchField( this );
|
m_searchWidget = new QSearchField( this );
|
||||||
m_searchWidget->setPlaceholderText( tr( "Global Search..." ) );
|
m_searchWidget->setPlaceholderText( tr( "Global Search..." ) );
|
||||||
@@ -246,6 +257,31 @@ TomahawkWindow::setupToolBar()
|
|||||||
connect( m_searchWidget, SIGNAL( returnPressed() ), this, SLOT( onFilterEdited() ) );
|
connect( m_searchWidget, SIGNAL( returnPressed() ), this, SLOT( onFilterEdited() ) );
|
||||||
|
|
||||||
toolbar->addWidget( m_searchWidget );
|
toolbar->addWidget( m_searchWidget );
|
||||||
|
|
||||||
|
QWidget* rightSpacer = new QWidget( this );
|
||||||
|
rightSpacer->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
||||||
|
toolbar->addWidget( rightSpacer );
|
||||||
|
|
||||||
|
ContainedMenuButton *accountsMenuButton = new ContainedMenuButton( toolbar );
|
||||||
|
accountsMenuButton->setIcon( QIcon( RESPATH "images/account-settings.png" ) );
|
||||||
|
accountsMenuButton->setText( tr( "&Network" ) );
|
||||||
|
accountsMenuButton->setMenu( m_menuAccounts );
|
||||||
|
accountsMenuButton->setToolButtonStyle( Qt::ToolButtonIconOnly );
|
||||||
|
toolbar->addWidget( accountsMenuButton );
|
||||||
|
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
ContainedMenuButton *compactMenuButton = new ContainedMenuButton( toolbar );
|
||||||
|
compactMenuButton->setIcon( QIcon( RESPATH "images/configure.png" ) );
|
||||||
|
compactMenuButton->setText( tr( "&Main Menu" ) );
|
||||||
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -295,21 +331,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;
|
||||||
|
|
||||||
@@ -323,9 +355,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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -414,30 +445,24 @@ 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( ui->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
|
#else
|
||||||
ui->menuWindow->clear();
|
connect( ac->getAction( "toggleMenuBar" ), SIGNAL( triggered() ), SLOT( toggleMenuBar() ) );
|
||||||
ui->menuWindow->menuAction()->setVisible( false );
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// <AccountHandler>
|
// <AccountHandler>
|
||||||
@@ -460,6 +485,26 @@ TomahawkWindow::setupSignals()
|
|||||||
connect( ViewManager::instance(), SIGNAL( historyForwardAvailable( bool ) ), SLOT( onHistoryForwardAvailable( bool ) ) );
|
connect( ViewManager::instance(), SIGNAL( historyForwardAvailable( bool ) ), SLOT( onHistoryForwardAvailable( bool ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TomahawkWindow::setupAccountsMenu()
|
||||||
|
{
|
||||||
|
m_menuAccounts = new QMenu( this );
|
||||||
|
m_actionToggleConnect = new QAction( tr( "Go &Online" ),
|
||||||
|
m_menuAccounts );
|
||||||
|
m_menuAccounts->addAction( m_actionToggleConnect );
|
||||||
|
m_menuAccounts->addSeparator();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TomahawkWindow::setupMenuBar()
|
||||||
|
{
|
||||||
|
// Always create a menubar, but only create a compactMenu on Windows and X11
|
||||||
|
m_menuBar = ActionCollection::instance()->createMenuBar( this );
|
||||||
|
setMenuBar( m_menuBar );
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
m_compactMainMenu = ActionCollection::instance()->createCompactMenu( this );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TomahawkWindow::changeEvent( QEvent* e )
|
TomahawkWindow::changeEvent( QEvent* e )
|
||||||
@@ -502,8 +547,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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -514,8 +559,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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -771,18 +816,18 @@ TomahawkWindow::addPeerManually()
|
|||||||
void
|
void
|
||||||
TomahawkWindow::pluginMenuAdded( QMenu* menu )
|
TomahawkWindow::pluginMenuAdded( QMenu* menu )
|
||||||
{
|
{
|
||||||
ui->menuNetwork->addMenu( menu );
|
m_menuAccounts->addMenu( menu );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TomahawkWindow::pluginMenuRemoved( QMenu* menu )
|
TomahawkWindow::pluginMenuRemoved( QMenu* menu )
|
||||||
{
|
{
|
||||||
foreach ( QAction* action, ui->menuNetwork->actions() )
|
foreach ( QAction* action, m_menuAccounts->actions() )
|
||||||
{
|
{
|
||||||
if ( action->menu() == menu )
|
if ( action->menu() == menu )
|
||||||
{
|
{
|
||||||
ui->menuNetwork->removeAction( action );
|
m_menuAccounts->removeAction( action );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -792,8 +837,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() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1028,7 +1075,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
|
||||||
@@ -1048,7 +1095,7 @@ TomahawkWindow::audioFinished()
|
|||||||
void
|
void
|
||||||
TomahawkWindow::audioPaused()
|
TomahawkWindow::audioPaused()
|
||||||
{
|
{
|
||||||
ui->actionPlay->setText( tr( "Play" ) );
|
ActionCollection::instance()->getAction( "playPause" )->setText( tr( "&Play" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1074,14 +1121,14 @@ TomahawkWindow::onPlaybackLoading( const Tomahawk::result_ptr& result )
|
|||||||
void
|
void
|
||||||
TomahawkWindow::onAccountConnected()
|
TomahawkWindow::onAccountConnected()
|
||||||
{
|
{
|
||||||
ui->actionToggleConnect->setText( tr( "Go &offline" ) );
|
m_actionToggleConnect->setText( tr( "Go &offline" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TomahawkWindow::onAccountDisconnected()
|
TomahawkWindow::onAccountDisconnected()
|
||||||
{
|
{
|
||||||
ui->actionToggleConnect->setText( tr( "Go &online" ) );
|
m_actionToggleConnect->setText( tr( "Go &online" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1237,3 +1284,23 @@ TomahawkWindow::crashNow()
|
|||||||
{
|
{
|
||||||
TomahawkUtils::crash();
|
TomahawkUtils::crash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TomahawkWindow::toggleMenuBar() //SLOT
|
||||||
|
{
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
if( menuBar()->isVisible() )
|
||||||
|
{
|
||||||
|
menuBar()->setVisible( false );
|
||||||
|
ActionCollection::instance()->getAction( "toggleMenuBar" )->setText( tr( "Show Menu Bar" ) );
|
||||||
|
m_compactMenuAction->setVisible( true );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_compactMenuAction->setVisible( false );
|
||||||
|
ActionCollection::instance()->getAction( "toggleMenuBar" )->setText( tr( "Hide Menu Bar" ) );
|
||||||
|
menuBar()->setVisible( true );
|
||||||
|
}
|
||||||
|
saveSettings();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@@ -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, Leo Franchi <lfranchi@kde.org>
|
* Copyright 2010-2012, Leo Franchi <lfranchi@kde.org>
|
||||||
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.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
|
||||||
@@ -26,6 +27,7 @@
|
|||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
|
#include <QToolButton>
|
||||||
|
|
||||||
#include "Result.h"
|
#include "Result.h"
|
||||||
#include "audio/AudioEngine.h"
|
#include "audio/AudioEngine.h"
|
||||||
@@ -143,6 +145,8 @@ private slots:
|
|||||||
|
|
||||||
void crashNow();
|
void crashNow();
|
||||||
|
|
||||||
|
void toggleMenuBar();
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
void audioStateChanged( AudioState newState, AudioState oldState );
|
void audioStateChanged( AudioState newState, AudioState oldState );
|
||||||
void updateWindowsLoveButton();
|
void updateWindowsLoveButton();
|
||||||
@@ -154,6 +158,8 @@ private:
|
|||||||
|
|
||||||
void applyPlatformTweaks();
|
void applyPlatformTweaks();
|
||||||
void setupSignals();
|
void setupSignals();
|
||||||
|
void setupAccountsMenu(); //must be called before setupToolBar
|
||||||
|
void setupMenuBar();
|
||||||
void setupToolBar();
|
void setupToolBar();
|
||||||
void setupSideBar();
|
void setupSideBar();
|
||||||
void setupUpdateCheck();
|
void setupUpdateCheck();
|
||||||
@@ -177,6 +183,15 @@ private:
|
|||||||
AnimatedSplitter* m_sidebar;
|
AnimatedSplitter* m_sidebar;
|
||||||
JobStatusSortModel* m_jobsModel;
|
JobStatusSortModel* m_jobsModel;
|
||||||
|
|
||||||
|
// Menus and menu actions: Accounts menu
|
||||||
|
QMenu *m_menuAccounts;
|
||||||
|
QAction *m_actionToggleConnect;
|
||||||
|
QMenuBar *m_menuBar;
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
QAction *m_compactMenuAction;
|
||||||
|
QMenu *m_compactMainMenu;
|
||||||
|
#endif
|
||||||
|
|
||||||
QAction* m_backAction;
|
QAction* m_backAction;
|
||||||
QAction* m_forwardAction;
|
QAction* m_forwardAction;
|
||||||
|
|
||||||
|
@@ -61,68 +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="menuNetwork">
|
|
||||||
<property name="title">
|
|
||||||
<string>&Network</string>
|
|
||||||
</property>
|
|
||||||
<addaction name="actionToggleConnect"/>
|
|
||||||
<addaction name="separator"/>
|
|
||||||
</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="menuNetwork"/>
|
|
||||||
<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,19 @@ 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[ "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[ "playPause" ]->setShortcut( Qt::Key_Space );
|
||||||
m_actionCollection[ "previousTrack" ] = new QAction( tr( "&Previous Track" ), this );
|
m_actionCollection[ "playPause" ]->setShortcutContext( Qt::ApplicationShortcut );
|
||||||
m_actionCollection[ "nextTrack" ] = new QAction( tr( "&Next Track" ), this );
|
m_actionCollection[ "stop" ] = new QAction( tr( "&Stop" ), this );
|
||||||
m_actionCollection[ "quit" ] = new QAction( tr( "&Quit" ), 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
|
// connect actions to AudioEngine
|
||||||
AudioEngine *ae = AudioEngine::instance();
|
AudioEngine *ae = AudioEngine::instance();
|
||||||
@@ -84,6 +90,148 @@ 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 );
|
||||||
|
#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" ) );
|
||||||
|
#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" ]->setMenuRole( QAction::AboutRole );
|
||||||
|
m_actionCollection[ "legalInfo" ] = new QAction( tr( "&Legal Information..." ), this );
|
||||||
|
m_actionCollection[ "legalInfo" ]->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 );
|
||||||
|
}
|
||||||
|
|
||||||
|
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 );
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
settingsMenu->addAction( m_actionCollection[ "toggleMenuBar" ] );
|
||||||
|
#endif
|
||||||
|
settingsMenu->addAction( m_actionCollection[ "preferences" ] );
|
||||||
|
|
||||||
|
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 )
|
||||||
|
QMenu *windowMenu = new QMenu( tr( "&Window" ), menuBar );
|
||||||
|
windowMenu->addAction( m_actionCollection[ "minimize" ] );
|
||||||
|
windowMenu->addAction( m_actionCollection[ "zoom" ] );
|
||||||
|
|
||||||
|
menuBar->addMenu( windowMenu );
|
||||||
|
#endif
|
||||||
|
menuBar->addMenu( helpMenu );
|
||||||
|
return menuBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu *
|
||||||
|
ActionCollection::createCompactMenu( QWidget *parent )
|
||||||
|
{
|
||||||
|
QMenu *compactMenu = new QMenu( tr( "Main Menu" ), parent );
|
||||||
|
|
||||||
|
compactMenu->addAction( m_actionCollection[ "playPause" ] );
|
||||||
|
compactMenu->addAction( m_actionCollection[ "previousTrack" ] );
|
||||||
|
compactMenu->addAction( m_actionCollection[ "nextTrack" ] );
|
||||||
|
compactMenu->addSeparator();
|
||||||
|
compactMenu->addAction( m_actionCollection[ "togglePrivacy" ] );
|
||||||
|
compactMenu->addAction( m_actionCollection[ "showOfflineSources" ] );
|
||||||
|
compactMenu->addSeparator();
|
||||||
|
compactMenu->addAction( m_actionCollection[ "loadXSPF" ] );
|
||||||
|
compactMenu->addAction( m_actionCollection[ "updateCollection" ] );
|
||||||
|
compactMenu->addAction( m_actionCollection[ "rescanCollection" ] );
|
||||||
|
compactMenu->addSeparator();
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC // This should never happen anyway
|
||||||
|
compactMenu->addAction( m_actionCollection[ "minimize" ] );
|
||||||
|
compactMenu->addAction( m_actionCollection[ "zoom" ] );
|
||||||
|
#else
|
||||||
|
compactMenu->addAction( m_actionCollection[ "toggleMenuBar" ] );
|
||||||
|
#endif
|
||||||
|
compactMenu->addAction( m_actionCollection[ "preferences" ] );
|
||||||
|
compactMenu->addSeparator();
|
||||||
|
|
||||||
|
compactMenu->addAction( m_actionCollection[ "diagnostics" ] );
|
||||||
|
compactMenu->addAction( m_actionCollection[ "aboutTomahawk" ] );
|
||||||
|
compactMenu->addAction( m_actionCollection[ "legalInfo" ] );
|
||||||
|
|
||||||
|
// Setup update check
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
compactMenu->insertSeparator( m_actionCollection[ "aboutTomahawk" ] );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined( Q_OS_MAC ) && defined( HAVE_SPARKLE )
|
||||||
|
compactMenu->addAction( m_actionCollection[ "checkForUpdates" ] );
|
||||||
|
#elif defined( Q_WS_WIN )
|
||||||
|
compactMenu->addSeparator();
|
||||||
|
compactMenu->addAction( m_actionCollection[ "checkForUpdates" ] );
|
||||||
|
#endif
|
||||||
|
if ( qApp->arguments().contains( "--debug" ) )
|
||||||
|
{
|
||||||
|
compactMenu->addSeparator();
|
||||||
|
compactMenu->addAction( m_actionCollection[ "crashNow" ] );
|
||||||
|
}
|
||||||
|
compactMenu->addSeparator();
|
||||||
|
compactMenu->addAction( m_actionCollection[ "quit" ] );
|
||||||
|
|
||||||
|
return compactMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -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,19 @@ public:
|
|||||||
|
|
||||||
void initActions();
|
void initActions();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method returns a main menu bar, suitable for Windows, Mac and X11.
|
||||||
|
*/
|
||||||
|
QMenuBar *createMenuBar( QWidget *parent );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a QMenu with all the entries that would normally be in the main menu,
|
||||||
|
* arranged in a sensible way. The compressed menu makes absolutely no sense on Mac,
|
||||||
|
* and fairly little sense on Unity and other X11 desktop configurations which pull
|
||||||
|
* out the menu bar from the window.
|
||||||
|
*/
|
||||||
|
QMenu *createCompactMenu( 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* );
|
||||||
|
@@ -901,6 +901,24 @@ TomahawkSettings::setVerboseNotifications( bool notifications )
|
|||||||
setValue( "ui/notifications/verbose", notifications );
|
setValue( "ui/notifications/verbose", notifications );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
TomahawkSettings::menuBarVisible() const
|
||||||
|
{
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
return value( "ui/mainwindow/menuBarVisible", true ).toBool();
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TomahawkSettings::setMenuBarVisible( bool visible )
|
||||||
|
{
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
setValue( "ui/mainwindow/menuBarVisible", visible );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TomahawkSettings::showOfflineSources() const
|
TomahawkSettings::showOfflineSources() const
|
||||||
|
@@ -76,6 +76,9 @@ public:
|
|||||||
bool verboseNotifications() const;
|
bool verboseNotifications() const;
|
||||||
void setVerboseNotifications( bool notifications );
|
void setVerboseNotifications( bool notifications );
|
||||||
|
|
||||||
|
bool menuBarVisible() const;
|
||||||
|
void setMenuBarVisible( bool visible );
|
||||||
|
|
||||||
// Collection Stuff
|
// Collection Stuff
|
||||||
bool showOfflineSources() const;
|
bool showOfflineSources() const;
|
||||||
void setShowOfflineSources( bool show );
|
void setShowOfflineSources( bool show );
|
||||||
|
Reference in New Issue
Block a user