mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 11:20:22 +02:00
* React to being muted from outside Tomahawk.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2012, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||||
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
|
||||||
*
|
*
|
||||||
@@ -234,9 +234,9 @@ AudioEngine::AudioEngine()
|
|||||||
connect( d->mediaObject, SIGNAL( tick( qint64 ) ), SLOT( timerTriggered( qint64 ) ) );
|
connect( d->mediaObject, SIGNAL( tick( qint64 ) ), SLOT( timerTriggered( qint64 ) ) );
|
||||||
connect( d->mediaObject, SIGNAL( aboutToFinish() ), SLOT( onAboutToFinish() ) );
|
connect( d->mediaObject, SIGNAL( aboutToFinish() ), SLOT( onAboutToFinish() ) );
|
||||||
connect( d->audioOutput, SIGNAL( volumeChanged( qreal ) ), SLOT( onVolumeChanged( qreal ) ) );
|
connect( d->audioOutput, SIGNAL( volumeChanged( qreal ) ), SLOT( onVolumeChanged( qreal ) ) );
|
||||||
|
connect( d->audioOutput, SIGNAL( mutedChanged( bool ) ), SIGNAL( mutedChanged( bool ) ) );
|
||||||
|
|
||||||
onVolumeChanged( d->audioOutput->volume() );
|
onVolumeChanged( d->audioOutput->volume() );
|
||||||
|
|
||||||
setVolume( TomahawkSettings::instance()->volume() );
|
setVolume( TomahawkSettings::instance()->volume() );
|
||||||
|
|
||||||
initEqualizer();
|
initEqualizer();
|
||||||
@@ -574,7 +574,6 @@ AudioEngine::mute()
|
|||||||
{
|
{
|
||||||
Q_D( AudioEngine );
|
Q_D( AudioEngine );
|
||||||
d->audioOutput->setMuted( true );
|
d->audioOutput->setMuted( true );
|
||||||
emit volumeChanged( 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -583,7 +582,6 @@ AudioEngine::toggleMute()
|
|||||||
{
|
{
|
||||||
Q_D( AudioEngine );
|
Q_D( AudioEngine );
|
||||||
d->audioOutput->setMuted( !d->audioOutput->isMuted() );
|
d->audioOutput->setMuted( !d->audioOutput->isMuted() );
|
||||||
emit volumeChanged( d->audioOutput->isMuted() ? 0 : volume() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2012, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||||
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
|
||||||
*
|
*
|
||||||
@@ -167,6 +167,7 @@ signals:
|
|||||||
void controlStateChanged();
|
void controlStateChanged();
|
||||||
void stateChanged( AudioState newState, AudioState oldState );
|
void stateChanged( AudioState newState, AudioState oldState );
|
||||||
void volumeChanged( int volume /* in percent */ );
|
void volumeChanged( int volume /* in percent */ );
|
||||||
|
void mutedChanged( bool muted );
|
||||||
|
|
||||||
void timerMilliSeconds( qint64 msElapsed );
|
void timerMilliSeconds( qint64 msElapsed );
|
||||||
void timerSeconds( unsigned int secondsElapsed );
|
void timerSeconds( unsigned int secondsElapsed );
|
||||||
|
@@ -160,6 +160,7 @@ AudioControls::AudioControls( QWidget* parent )
|
|||||||
connect( AudioEngine::instance(), SIGNAL( seeked( qint64 ) ), SLOT( onPlaybackSeeked( qint64 ) ) );
|
connect( AudioEngine::instance(), SIGNAL( seeked( qint64 ) ), SLOT( onPlaybackSeeked( qint64 ) ) );
|
||||||
connect( AudioEngine::instance(), SIGNAL( timerMilliSeconds( qint64 ) ), SLOT( onPlaybackTimer( qint64 ) ) );
|
connect( AudioEngine::instance(), SIGNAL( timerMilliSeconds( qint64 ) ), SLOT( onPlaybackTimer( qint64 ) ) );
|
||||||
connect( AudioEngine::instance(), SIGNAL( volumeChanged( int ) ), SLOT( onVolumeChanged( int ) ) );
|
connect( AudioEngine::instance(), SIGNAL( volumeChanged( int ) ), SLOT( onVolumeChanged( int ) ) );
|
||||||
|
connect( AudioEngine::instance(), SIGNAL( mutedChanged( bool ) ), SLOT( onMutedChanged( bool ) ) );
|
||||||
connect( AudioEngine::instance(), SIGNAL( controlStateChanged() ), SLOT( onControlStateChanged() ) );
|
connect( AudioEngine::instance(), SIGNAL( controlStateChanged() ), SLOT( onControlStateChanged() ) );
|
||||||
connect( AudioEngine::instance(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ), SLOT( onRepeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ) );
|
connect( AudioEngine::instance(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ), SLOT( onRepeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ) );
|
||||||
connect( AudioEngine::instance(), SIGNAL( shuffleModeChanged( bool ) ), SLOT( onShuffleModeChanged( bool ) ) );
|
connect( AudioEngine::instance(), SIGNAL( shuffleModeChanged( bool ) ), SLOT( onShuffleModeChanged( bool ) ) );
|
||||||
@@ -231,6 +232,24 @@ AudioControls::onVolumeChanged( int volume )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
AudioControls::onMutedChanged( bool muted )
|
||||||
|
{
|
||||||
|
ui->volumeSlider->blockSignals( true );
|
||||||
|
|
||||||
|
if ( muted )
|
||||||
|
{
|
||||||
|
ui->volumeSlider->setValue( 0 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->volumeSlider->setValue( AudioEngine::instance()->volume() );
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->volumeSlider->blockSignals( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AudioControls::onControlStateChanged()
|
AudioControls::onControlStateChanged()
|
||||||
{
|
{
|
||||||
|
@@ -74,6 +74,7 @@ private slots:
|
|||||||
|
|
||||||
void onPlaybackTimer( qint64 msElapsed );
|
void onPlaybackTimer( qint64 msElapsed );
|
||||||
void onVolumeChanged( int volume );
|
void onVolumeChanged( int volume );
|
||||||
|
void onMutedChanged( bool muted );
|
||||||
void onControlStateChanged();
|
void onControlStateChanged();
|
||||||
|
|
||||||
void onRepeatClicked();
|
void onRepeatClicked();
|
||||||
|
Reference in New Issue
Block a user