1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-12 00:54:20 +02:00

* Fixed systray menu not working.

This commit is contained in:
Christian Muehlhaeuser
2012-05-22 08:01:14 +02:00
parent d44028a2af
commit 530d9d7e5f
6 changed files with 19 additions and 19 deletions

View File

@@ -49,7 +49,8 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
m_contextMenu = new QMenu(); m_contextMenu = new QMenu();
setContextMenu( m_contextMenu ); setContextMenu( m_contextMenu );
m_stopContinueAfterTrackAction = new QAction( tr( "&Stop Playback after current Track" ), this ); m_stopContinueAfterTrackAction = new QAction( this );
onStopContinueAfterTrackChanged();
ActionCollection *ac = ActionCollection::instance(); ActionCollection *ac = ActionCollection::instance();
m_contextMenu->addAction( ac->getAction( "playPause" ) ); m_contextMenu->addAction( ac->getAction( "playPause" ) );
@@ -61,7 +62,7 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
m_contextMenu->addSeparator(); m_contextMenu->addSeparator();
m_contextMenu->addAction( ActionCollection::instance()->getAction( "togglePrivacy" ) ); m_contextMenu->addAction( ActionCollection::instance()->getAction( "togglePrivacy" ) );
connect( m_stopContinueAfterTrackAction, SIGNAL( triggered(bool) ), this, SLOT( stopContinueAfterTrackActionTriggered() ) ); connect( m_stopContinueAfterTrackAction, SIGNAL( triggered() ), SLOT( stopContinueAfterTrackActionTriggered() ) );
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
// On mac you can close the windows while leaving the app open. We then need a way to show the main window again // On mac you can close the windows while leaving the app open. We then need a way to show the main window again
@@ -78,10 +79,10 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
connect( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ), SLOT( setResult( Tomahawk::result_ptr ) ) ); connect( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ), SLOT( setResult( Tomahawk::result_ptr ) ) );
connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( onPlay() ) ); connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( onPlay() ) );
connect( AudioEngine::instance(), SIGNAL( resumed() ), this, SLOT( onResume() ) ); connect( AudioEngine::instance(), SIGNAL( resumed() ), SLOT( onResume() ) );
connect( AudioEngine::instance(), SIGNAL( stopped() ), this, SLOT( onStop() ) ); connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onStop() ) );
connect( AudioEngine::instance(), SIGNAL( paused() ), this, SLOT( onPause() ) ); connect( AudioEngine::instance(), SIGNAL( paused() ), SLOT( onPause() ) );
connect( AudioEngine::instance(), SIGNAL( stopAfterTrack_changed() ) , this, SLOT( stopContinueAfterTrack_StatusChanged() ) ); connect( AudioEngine::instance(), SIGNAL( stopAfterTrackChanged() ), SLOT( onStopContinueAfterTrackChanged() ) );
connect( &m_animationTimer, SIGNAL( timeout() ), SLOT( onAnimationTimer() ) ); connect( &m_animationTimer, SIGNAL( timeout() ), SLOT( onAnimationTimer() ) );
connect( this, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), SLOT( onActivated( QSystemTrayIcon::ActivationReason ) ) ); connect( this, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), SLOT( onActivated( QSystemTrayIcon::ActivationReason ) ) );
@@ -236,7 +237,7 @@ TomahawkTrayIcon::onPlay()
{ {
m_stopContinueAfterTrackAction->setEnabled( true ); m_stopContinueAfterTrackAction->setEnabled( true );
onResume(); onResume();
stopContinueAfterTrack_StatusChanged(); onStopContinueAfterTrackChanged();
} }
@@ -256,7 +257,7 @@ TomahawkTrayIcon::onResume()
void void
TomahawkTrayIcon::stopContinueAfterTrack_StatusChanged() TomahawkTrayIcon::onStopContinueAfterTrackChanged()
{ {
if ( !AudioEngine::instance()->currentTrack().isNull() ) if ( !AudioEngine::instance()->currentTrack().isNull() )
{ {

View File

@@ -49,8 +49,7 @@ private slots:
void onStop(); void onStop();
void onResume(); void onResume();
void stopContinueAfterTrack_StatusChanged(); void onStopContinueAfterTrackChanged();
void stopContinueAfterTrackActionTriggered(); void stopContinueAfterTrackActionTriggered();
void menuAboutToShow(); void menuAboutToShow();

View File

@@ -32,7 +32,7 @@ ActionCollection* ActionCollection::instance()
} }
ActionCollection::ActionCollection( QObject *parent ) ActionCollection::ActionCollection( QObject* parent )
: QObject( parent ) : QObject( parent )
{ {
s_instance = this; s_instance = this;
@@ -79,11 +79,11 @@ ActionCollection::initActions()
m_actionCollection[ "quit" ] = new QAction( tr( "&Quit" ), this ); m_actionCollection[ "quit" ] = new QAction( tr( "&Quit" ), this );
// connect actions to AudioEngine // connect actions to AudioEngine
// AudioEngine *ae = AudioEngine::instance(); AudioEngine *ae = AudioEngine::instance();
// connect( m_actionCollection[ "playPause" ], SIGNAL( triggered() ), ae, SLOT( playPause() ), Qt::UniqueConnection ); 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[ "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 );
} }

View File

@@ -38,7 +38,7 @@ public:
static ActionCollection* instance(); static ActionCollection* instance();
ActionCollection( QObject *parent); ActionCollection( QObject *parent );
~ActionCollection(); ~ActionCollection();
void initActions(); void initActions();

View File

@@ -783,7 +783,7 @@ AudioEngine::setStopAfterTrack( const query_ptr& query )
if ( m_stopAfterTrack != query ) if ( m_stopAfterTrack != query )
{ {
m_stopAfterTrack = query; m_stopAfterTrack = query;
emit stopAfterTrack_changed(); emit stopAfterTrackChanged();
} }
} }

View File

@@ -109,7 +109,7 @@ signals:
void paused(); void paused();
void resumed(); void resumed();
void stopAfterTrack_changed(); void stopAfterTrackChanged();
void seeked( qint64 ms ); void seeked( qint64 ms );