1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 06:07:37 +02:00

rename slots & signals, disable Stop After Current Track in systray if track is stopped

This commit is contained in:
Stefan Derkits
2012-04-26 23:08:47 +02:00
parent ef8306394f
commit dab5d51952
3 changed files with 32 additions and 14 deletions

View File

@@ -74,12 +74,11 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
m_contextMenu->addAction( ac->getAction( "quit" ) ); m_contextMenu->addAction( ac->getAction( "quit" ) );
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( enablePause() ) ); connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( onPlay() ) );
connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( stopContinueAfterTrackStatusChanged()) ); connect( AudioEngine::instance(), SIGNAL( resumed() ), this, SLOT( onResume() ) );
connect( AudioEngine::instance(), SIGNAL( resumed() ), this, SLOT( enablePause() ) ); connect( AudioEngine::instance(), SIGNAL( stopped() ), this, SLOT( onStop() ) );
connect( AudioEngine::instance(), SIGNAL( stopped() ), this, SLOT( enablePlay() ) ); connect( AudioEngine::instance(), SIGNAL( paused() ), this, SLOT( onPause() ) );
connect( AudioEngine::instance(), SIGNAL( paused() ), this, SLOT( enablePlay() ) ); connect( AudioEngine::instance(), SIGNAL( stopAfterTrack_changed() ) , this, SLOT( stopContinueAfterTrack_StatusChanged() ) );
connect( AudioEngine::instance(), SIGNAL( stopContinueAfterTrack() ) , this, SLOT( stopContinueAfterTrackStatusChanged() ) );
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 ) ) );
@@ -223,21 +222,38 @@ TomahawkTrayIcon::onActivated( QSystemTrayIcon::ActivationReason reason )
void void
TomahawkTrayIcon::enablePlay() TomahawkTrayIcon::onPause()
{ {
ActionCollection::instance()->getAction( "playPause" )->setText( tr( "Play" ) ); ActionCollection::instance()->getAction( "playPause" )->setText( tr( "Play" ) );
} }
void void
TomahawkTrayIcon::enablePause() TomahawkTrayIcon::onPlay()
{
m_stopContinueAfterTrackAction->setEnabled( true );
onResume();
stopContinueAfterTrack_StatusChanged();
}
void
TomahawkTrayIcon::onStop()
{
m_stopContinueAfterTrackAction->setEnabled( false );
onPause();
}
void
TomahawkTrayIcon::onResume()
{ {
ActionCollection::instance()->getAction( "playPause" )->setText( tr( "Pause" ) ); ActionCollection::instance()->getAction( "playPause" )->setText( tr( "Pause" ) );
} }
void void
TomahawkTrayIcon::stopContinueAfterTrackStatusChanged() TomahawkTrayIcon::stopContinueAfterTrack_StatusChanged()
{ {
if ( !AudioEngine::instance()->currentTrack().isNull() ) if ( !AudioEngine::instance()->currentTrack().isNull() )
{ {

View File

@@ -44,10 +44,12 @@ private slots:
void onActivated( QSystemTrayIcon::ActivationReason reason ); void onActivated( QSystemTrayIcon::ActivationReason reason );
void showWindow(); void showWindow();
void enablePlay(); void onPause();
void enablePause(); void onPlay();
void onStop();
void onResume();
void stopContinueAfterTrackStatusChanged(); void stopContinueAfterTrack_StatusChanged();
void stopContinueAfterTrackActionTriggered(); void stopContinueAfterTrackActionTriggered();

View File

@@ -96,7 +96,7 @@ public slots:
void setPlaylist( Tomahawk::playlistinterface_ptr playlist ); void setPlaylist( Tomahawk::playlistinterface_ptr playlist );
void setQueue( Tomahawk::playlistinterface_ptr queue ) { m_queue = queue; } void setQueue( Tomahawk::playlistinterface_ptr queue ) { m_queue = queue; }
void setStopAfterTrack( const Tomahawk::query_ptr& query ) { m_stopAfterTrack = query; emit stopContinueAfterTrack(); } void setStopAfterTrack( const Tomahawk::query_ptr& query ) { if ( m_stopAfterTrack != query ) { m_stopAfterTrack = query; emit stopAfterTrack_changed(); } }
signals: signals:
void loading( const Tomahawk::result_ptr& track ); void loading( const Tomahawk::result_ptr& track );
@@ -106,7 +106,7 @@ signals:
void paused(); void paused();
void resumed(); void resumed();
void stopContinueAfterTrack(); void stopAfterTrack_changed();
void seeked( qint64 ms ); void seeked( qint64 ms );