mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 03:10:12 +02:00
* Clicking the speaker icon toggles mute.
This commit is contained in:
@@ -541,6 +541,9 @@ AudioEngine::setVolume( int percentage )
|
||||
|
||||
percentage = qBound( 0, percentage, 100 );
|
||||
d->audioOutput->setVolume( (qreal)percentage / 100.0 );
|
||||
|
||||
if ( percentage > 0 )
|
||||
d->audioOutput->setMuted( false );
|
||||
emit volumeChanged( percentage );
|
||||
}
|
||||
|
||||
@@ -559,10 +562,28 @@ AudioEngine::raiseVolume()
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
AudioEngine::isMuted() const
|
||||
{
|
||||
return d_func()->audioOutput->isMuted();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::mute()
|
||||
{
|
||||
setVolume( 0 );
|
||||
Q_D( AudioEngine );
|
||||
d->audioOutput->setMuted( true );
|
||||
emit volumeChanged( 0 );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::toggleMute()
|
||||
{
|
||||
Q_D( AudioEngine );
|
||||
d->audioOutput->setMuted( !d->audioOutput->isMuted() );
|
||||
emit volumeChanged( d->audioOutput->isMuted() ? 0 : volume() );
|
||||
}
|
||||
|
||||
|
||||
|
@@ -67,6 +67,7 @@ public:
|
||||
bool isPlaying() const;
|
||||
bool isPaused() const;
|
||||
bool isStopped() const;
|
||||
bool isMuted() const;
|
||||
|
||||
/**
|
||||
* Returns the PlaylistInterface of the currently playing track.
|
||||
@@ -133,6 +134,7 @@ public slots:
|
||||
void lowerVolume();
|
||||
void raiseVolume();
|
||||
void mute();
|
||||
void toggleMute();
|
||||
|
||||
void playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::result_ptr& result, const Tomahawk::query_ptr& fromQuery = Tomahawk::query_ptr() );
|
||||
void playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::query_ptr& query );
|
||||
|
@@ -132,7 +132,7 @@ AudioControls::AudioControls( QWidget* parent )
|
||||
connect( ui->playPauseButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( play() ) );
|
||||
connect( ui->pauseButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( pause() ) );
|
||||
connect( ui->nextButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( next() ) );
|
||||
// connect( ui->volumeLowButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( lowerVolume() ) );
|
||||
connect( ui->volumeLowButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( toggleMute() ) );
|
||||
// connect( ui->volumeHighButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( raiseVolume() ) );
|
||||
|
||||
connect( ui->playPauseButton, SIGNAL( clicked() ), SIGNAL( playPressed() ) );
|
||||
|
Reference in New Issue
Block a user