1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-23 01:09:42 +01: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" ) );
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( stopContinueAfterTrackStatusChanged()) );
connect( AudioEngine::instance(), SIGNAL( resumed() ), this, SLOT( enablePause() ) );
connect( AudioEngine::instance(), SIGNAL( stopped() ), this, SLOT( enablePlay() ) );
connect( AudioEngine::instance(), SIGNAL( paused() ), this, SLOT( enablePlay() ) );
connect( AudioEngine::instance(), SIGNAL( stopContinueAfterTrack() ) , this, SLOT( stopContinueAfterTrackStatusChanged() ) );
connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( onPlay() ) );
connect( AudioEngine::instance(), SIGNAL( resumed() ), this, SLOT( onResume() ) );
connect( AudioEngine::instance(), SIGNAL( stopped() ), this, SLOT( onStop() ) );
connect( AudioEngine::instance(), SIGNAL( paused() ), this, SLOT( onPause() ) );
connect( AudioEngine::instance(), SIGNAL( stopAfterTrack_changed() ) , this, SLOT( stopContinueAfterTrack_StatusChanged() ) );
connect( &m_animationTimer, SIGNAL( timeout() ), SLOT( onAnimationTimer() ) );
connect( this, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), SLOT( onActivated( QSystemTrayIcon::ActivationReason ) ) );
@ -223,21 +222,38 @@ TomahawkTrayIcon::onActivated( QSystemTrayIcon::ActivationReason reason )
void
TomahawkTrayIcon::enablePlay()
TomahawkTrayIcon::onPause()
{
ActionCollection::instance()->getAction( "playPause" )->setText( tr( "Play" ) );
}
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" ) );
}
void
TomahawkTrayIcon::stopContinueAfterTrackStatusChanged()
TomahawkTrayIcon::stopContinueAfterTrack_StatusChanged()
{
if ( !AudioEngine::instance()->currentTrack().isNull() )
{

View File

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

View File

@ -96,7 +96,7 @@ public slots:
void setPlaylist( Tomahawk::playlistinterface_ptr playlist );
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:
void loading( const Tomahawk::result_ptr& track );
@ -106,7 +106,7 @@ signals:
void paused();
void resumed();
void stopContinueAfterTrack();
void stopAfterTrack_changed();
void seeked( qint64 ms );