mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-02 04:10:20 +02:00
Removed old account toolbuttons and fixed toolbar balancing.
This commit is contained in:
@@ -288,7 +288,8 @@ TomahawkWindow::setupToolBar()
|
|||||||
|
|
||||||
m_accountsButton = new AccountsToolButton( m_toolbar );
|
m_accountsButton = new AccountsToolButton( m_toolbar );
|
||||||
m_toolbar->addWidget( m_accountsButton );
|
m_toolbar->addWidget( m_accountsButton );
|
||||||
//TODO: hook up signals for the new accounts widget
|
connect( m_accountsButton, SIGNAL( widthChanged() ),
|
||||||
|
this, SLOT( balanceToolbar() ) );
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
ContainedMenuButton* compactMenuButton = new ContainedMenuButton( m_toolbar );
|
ContainedMenuButton* compactMenuButton = new ContainedMenuButton( m_toolbar );
|
||||||
@@ -541,18 +542,6 @@ TomahawkWindow::setupSignals()
|
|||||||
connect( AccountManager::instance(), SIGNAL( disconnected( Tomahawk::Accounts::Account* ) ), SLOT( onAccountDisconnected() ) );
|
connect( AccountManager::instance(), SIGNAL( disconnected( Tomahawk::Accounts::Account* ) ), SLOT( onAccountDisconnected() ) );
|
||||||
connect( AccountManager::instance(), SIGNAL( authError( Tomahawk::Accounts::Account* ) ), SLOT( onAccountError() ) );
|
connect( AccountManager::instance(), SIGNAL( authError( Tomahawk::Accounts::Account* ) ), SLOT( onAccountError() ) );
|
||||||
|
|
||||||
// Menus for accounts that support them
|
|
||||||
connect( AccountManager::instance(), SIGNAL( added( Tomahawk::Accounts::Account* ) ), this, SLOT( onAccountAdded( Tomahawk::Accounts::Account* ) ) );
|
|
||||||
|
|
||||||
foreach ( Account* account, AccountManager::instance()->accounts( Tomahawk::Accounts::SipType ) )
|
|
||||||
{
|
|
||||||
if ( !account || !account->sipPlugin() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
connect( account->sipPlugin(), SIGNAL( addMenu( QMenu* ) ), this, SLOT( pluginMenuAdded( QMenu* ) ) );
|
|
||||||
connect( account->sipPlugin(), SIGNAL( removeMenu( QMenu* ) ), this, SLOT( pluginMenuRemoved( QMenu* ) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
connect( ViewManager::instance(), SIGNAL( historyBackAvailable( bool ) ), SLOT( onHistoryBackAvailable( bool ) ) );
|
connect( ViewManager::instance(), SIGNAL( historyBackAvailable( bool ) ), SLOT( onHistoryBackAvailable( bool ) ) );
|
||||||
connect( ViewManager::instance(), SIGNAL( historyForwardAvailable( bool ) ), SLOT( onHistoryForwardAvailable( bool ) ) );
|
connect( ViewManager::instance(), SIGNAL( historyForwardAvailable( bool ) ), SLOT( onHistoryForwardAvailable( bool ) ) );
|
||||||
}
|
}
|
||||||
@@ -881,48 +870,6 @@ TomahawkWindow::addPeerManually()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
TomahawkWindow::pluginMenuAdded( QMenu* menu )
|
|
||||||
{
|
|
||||||
SipPlugin* plugin = qobject_cast< SipPlugin* >( sender() );
|
|
||||||
if ( plugin )
|
|
||||||
{
|
|
||||||
ContainedMenuButton *button = new ContainedMenuButton( m_toolbar );
|
|
||||||
button->setIcon( plugin->account()->icon() );
|
|
||||||
button->setText( menu->title() );
|
|
||||||
button->setMenu( menu );
|
|
||||||
button->setToolButtonStyle( Qt::ToolButtonIconOnly );
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
QAction *action = m_toolbar->addWidget( button );
|
|
||||||
#else
|
|
||||||
QAction *action = m_toolbar->insertWidget( m_compactMenuAction, button );
|
|
||||||
#endif
|
|
||||||
action->setProperty( "id", plugin->account()->accountId() );
|
|
||||||
balanceToolbar();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
TomahawkWindow::pluginMenuRemoved( QMenu* menu )
|
|
||||||
{
|
|
||||||
Q_UNUSED( menu )
|
|
||||||
SipPlugin* plugin = qobject_cast< SipPlugin* >( sender() );
|
|
||||||
if ( plugin )
|
|
||||||
{
|
|
||||||
foreach ( QAction* action, m_toolbar->actions() )
|
|
||||||
{
|
|
||||||
if ( action->property( "id" ) == plugin->account()->accountId() )
|
|
||||||
{
|
|
||||||
m_toolbar->removeAction( action );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
balanceToolbar();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TomahawkWindow::showOfflineSources()
|
TomahawkWindow::showOfflineSources()
|
||||||
{
|
{
|
||||||
@@ -1221,17 +1168,6 @@ TomahawkWindow::onAccountDisconnected()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
TomahawkWindow::onAccountAdded( Account* acc )
|
|
||||||
{
|
|
||||||
if ( !acc->types() & SipType || !acc->sipPlugin() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
connect( acc->sipPlugin(), SIGNAL( addMenu( QMenu* ) ), this, SLOT( pluginMenuAdded( QMenu* ) ) );
|
|
||||||
connect( acc->sipPlugin(), SIGNAL( removeMenu( QMenu* ) ), this, SLOT( pluginMenuRemoved( QMenu* ) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TomahawkWindow::onAccountError()
|
TomahawkWindow::onAccountError()
|
||||||
{
|
{
|
||||||
|
@@ -100,15 +100,12 @@ public slots:
|
|||||||
void legalInfo();
|
void legalInfo();
|
||||||
void updateCollectionManually();
|
void updateCollectionManually();
|
||||||
void rescanCollectionManually();
|
void rescanCollectionManually();
|
||||||
void pluginMenuAdded( QMenu* );
|
|
||||||
void pluginMenuRemoved( QMenu* );
|
|
||||||
void showOfflineSources();
|
void showOfflineSources();
|
||||||
|
|
||||||
void fullScreenEntered();
|
void fullScreenEntered();
|
||||||
void fullScreenExited();
|
void fullScreenExited();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onAccountAdded( Tomahawk::Accounts::Account* account );
|
|
||||||
void onAccountConnected();
|
void onAccountConnected();
|
||||||
void onAccountDisconnected();
|
void onAccountDisconnected();
|
||||||
void onAccountError();
|
void onAccountError();
|
||||||
@@ -149,6 +146,7 @@ private slots:
|
|||||||
void crashNow();
|
void crashNow();
|
||||||
|
|
||||||
void toggleMenuBar();
|
void toggleMenuBar();
|
||||||
|
void balanceToolbar();
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
void audioStateChanged( AudioState newState, AudioState oldState );
|
void audioStateChanged( AudioState newState, AudioState oldState );
|
||||||
@@ -165,7 +163,6 @@ private:
|
|||||||
void setupToolBar();
|
void setupToolBar();
|
||||||
void setupSideBar();
|
void setupSideBar();
|
||||||
void setupUpdateCheck();
|
void setupUpdateCheck();
|
||||||
void balanceToolbar();
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
bool setupWindowsButtons();
|
bool setupWindowsButtons();
|
||||||
|
@@ -159,6 +159,7 @@ void
|
|||||||
AccountsToolButton::updateIcons()
|
AccountsToolButton::updateIcons()
|
||||||
{
|
{
|
||||||
m_factoryPixmaps.clear();
|
m_factoryPixmaps.clear();
|
||||||
|
int oldWidth = sizeHint().width();
|
||||||
|
|
||||||
for ( int i = 0; i < m_proxy->rowCount(); ++i )
|
for ( int i = 0; i < m_proxy->rowCount(); ++i )
|
||||||
{
|
{
|
||||||
@@ -208,6 +209,8 @@ AccountsToolButton::updateIcons()
|
|||||||
}
|
}
|
||||||
|
|
||||||
resize( sizeHint() );
|
resize( sizeHint() );
|
||||||
|
if ( oldWidth != sizeHint().width() )
|
||||||
|
emit widthChanged();
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -36,6 +36,9 @@ public:
|
|||||||
|
|
||||||
QSize sizeHint() const;
|
QSize sizeHint() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void widthChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent( QMouseEvent* event );
|
void mousePressEvent( QMouseEvent* event );
|
||||||
void paintEvent( QPaintEvent* event );
|
void paintEvent( QPaintEvent* event );
|
||||||
|
Reference in New Issue
Block a user