mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
Pulled the Network menu outside the main menu bar.
This prepares the way for the compressed menu feature.
This commit is contained in:
@@ -35,6 +35,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"
|
||||||
@@ -116,6 +117,7 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
|
|||||||
ui->centralWidget->setContentsMargins( 0, 0, 0, 0 );
|
ui->centralWidget->setContentsMargins( 0, 0, 0, 0 );
|
||||||
TomahawkUtils::unmarginLayout( ui->centralWidget->layout() );
|
TomahawkUtils::unmarginLayout( ui->centralWidget->layout() );
|
||||||
|
|
||||||
|
setupAccountsMenu();
|
||||||
setupToolBar();
|
setupToolBar();
|
||||||
setupSideBar();
|
setupSideBar();
|
||||||
statusBar()->addPermanentWidget( m_audioControls, 1 );
|
statusBar()->addPermanentWidget( m_audioControls, 1 );
|
||||||
@@ -235,9 +237,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 +248,20 @@ 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 );
|
||||||
|
|
||||||
|
QToolButton *accountsMenuButton = new QToolButton( toolbar );
|
||||||
|
accountsMenuButton->setIcon( QIcon( RESPATH "images/account-settings.png" ) );
|
||||||
|
accountsMenuButton->setText( tr( "&Network" ) );
|
||||||
|
accountsMenuButton->setMenu( m_menuAccounts );
|
||||||
|
//TODO: when we decide if compressed menus go left or right, if they go right, make
|
||||||
|
// them pop up *inside* the main window.
|
||||||
|
accountsMenuButton->setToolButtonStyle( Qt::ToolButtonIconOnly );
|
||||||
|
accountsMenuButton->setPopupMode( QToolButton::InstantPopup );
|
||||||
|
toolbar->addWidget( accountsMenuButton );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -418,7 +434,7 @@ TomahawkWindow::setupSignals()
|
|||||||
connect( ui->actionPreferences, SIGNAL( triggered() ), SLOT( showSettingsDialog() ) );
|
connect( ui->actionPreferences, SIGNAL( triggered() ), SLOT( showSettingsDialog() ) );
|
||||||
connect( ui->actionDiagnostics, SIGNAL( triggered() ), SLOT( showDiagnosticsDialog() ) );
|
connect( ui->actionDiagnostics, SIGNAL( triggered() ), SLOT( showDiagnosticsDialog() ) );
|
||||||
connect( ui->actionLegalInfo, SIGNAL( triggered() ), SLOT( legalInfo() ) );
|
connect( ui->actionLegalInfo, 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( ui->actionUpdateCollection, SIGNAL( triggered() ), SLOT( updateCollectionManually() ) );
|
||||||
connect( ui->actionRescanCollection, SIGNAL( triggered() ), SLOT( rescanCollectionManually() ) );
|
connect( ui->actionRescanCollection, SIGNAL( triggered() ), SLOT( rescanCollectionManually() ) );
|
||||||
connect( ui->actionLoadXSPF, SIGNAL( triggered() ), SLOT( loadSpiff() ));
|
connect( ui->actionLoadXSPF, SIGNAL( triggered() ), SLOT( loadSpiff() ));
|
||||||
@@ -460,6 +476,16 @@ 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
|
void
|
||||||
TomahawkWindow::changeEvent( QEvent* e )
|
TomahawkWindow::changeEvent( QEvent* e )
|
||||||
@@ -771,18 +797,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1074,14 +1100,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" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -154,6 +154,7 @@ private:
|
|||||||
|
|
||||||
void applyPlatformTweaks();
|
void applyPlatformTweaks();
|
||||||
void setupSignals();
|
void setupSignals();
|
||||||
|
void setupAccountsMenu(); //must be called before setupToolBar
|
||||||
void setupToolBar();
|
void setupToolBar();
|
||||||
void setupSideBar();
|
void setupSideBar();
|
||||||
void setupUpdateCheck();
|
void setupUpdateCheck();
|
||||||
@@ -177,6 +178,10 @@ 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;
|
||||||
|
|
||||||
QAction* m_backAction;
|
QAction* m_backAction;
|
||||||
QAction* m_forwardAction;
|
QAction* m_forwardAction;
|
||||||
|
|
||||||
|
@@ -95,13 +95,6 @@
|
|||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionExit"/>
|
<addaction name="actionExit"/>
|
||||||
</widget>
|
</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">
|
<widget class="QMenu" name="menuWindow">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>&Window</string>
|
<string>&Window</string>
|
||||||
@@ -118,7 +111,6 @@
|
|||||||
<addaction name="actionLegalInfo"/>
|
<addaction name="actionLegalInfo"/>
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menuApp"/>
|
<addaction name="menuApp"/>
|
||||||
<addaction name="menuNetwork"/>
|
|
||||||
<addaction name="menuSettings"/>
|
<addaction name="menuSettings"/>
|
||||||
<addaction name="menuWindow"/>
|
<addaction name="menuWindow"/>
|
||||||
<addaction name="menu_Help"/>
|
<addaction name="menu_Help"/>
|
||||||
|
Reference in New Issue
Block a user