/* Set the volume from the config */
libUpdateVolume();
- /* Force the update at build time in order to have a muted icon if needed */
- updateMuteStatus();
+ /* Sync mute status */
+ if( aout_MuteGet( THEPL ) > 0 )
+ updateMuteStatus( true );
/* Volume control connection */
volumeSlider->setTracking( true );
CONNECT( volumeSlider, valueChanged( int ), this, valueChangedFilter( int ) );
CONNECT( this, valueReallyChanged( int ), this, userUpdateVolume( int ) );
CONNECT( THEMIM, volumeChanged( void ), this, libUpdateVolume( void ) );
- CONNECT( THEMIM, soundMuteChanged( void ), this, updateMuteStatus( void ) );
+ CONNECT( THEMIM, soundMuteChanged( bool ), this, updateMuteStatus( bool ) );
}
SoundWidget::~SoundWidget()
}
/* libvlc mute/unmute event slot */
-void SoundWidget::updateMuteStatus()
+void SoundWidget::updateMuteStatus( bool mute )
{
- playlist_t *p_playlist = pl_Get( p_intf );
- b_is_muted = aout_MuteGet( p_playlist ) > 0;
+ b_is_muted = mute;
SoundSlider *soundSlider = qobject_cast<SoundSlider *>(volumeSlider);
if( soundSlider )
- soundSlider->setMuted( b_is_muted );
+ soundSlider->setMuted( mute );
refreshLabels();
}
vlc_value_t, vlc_value_t, void * );
static int VolumeChanged( vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void * );
-static int SoundMuteChanged( vlc_object_t *, const char *,
- vlc_value_t, vlc_value_t, void * );
static int InputEvent( vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void * );
MainInputManager::MainInputManager( intf_thread_t *_p_intf )
: QObject(NULL), p_intf( _p_intf ),
random( VLC_OBJECT(THEPL), "random" ),
- repeat( VLC_OBJECT(THEPL), "repeat" ), loop( VLC_OBJECT(THEPL), "loop" )
+ repeat( VLC_OBJECT(THEPL), "repeat" ), loop( VLC_OBJECT(THEPL), "loop" ),
+ mute( VLC_OBJECT(THEPL), "mute" )
{
p_input = NULL;
im = new InputManager( this, p_intf );
loop.addCallback( this, SLOT(notifyRepeatLoop(bool)) );
var_AddCallback( THEPL, "volume", VolumeChanged, this );
- var_AddCallback( THEPL, "mute", SoundMuteChanged, this );
+ mute.addCallback( this, SLOT(notifyMute(bool)) );
/* Warn our embedded IM about input changes */
DCONNECT( this, inputChanged( input_thread_t * ),
}
var_DelCallback( THEPL, "volume", VolumeChanged, this );
- var_DelCallback( THEPL, "mute", SoundMuteChanged, this );
var_DelCallback( THEPL, "activity", PLItemChanged, this );
var_DelCallback( THEPL, "item-change", ItemChanged, im );
case VolumeChanged_Type:
emit volumeChanged();
return;
- case SoundMuteChanged_Type:
- emit soundMuteChanged();
- return;
case PLItemAppended_Type:
plEv = static_cast<PLEvent*>( event );
emit playlistItemAppended( plEv->i_item, plEv->i_parent );
return VLC_SUCCESS;
}
-static int SoundMuteChanged( vlc_object_t *p_this, const char *psz_var,
- vlc_value_t oldval, vlc_value_t newval, void *param )
+void MainInputManager::notifyMute( bool mute )
{
- VLC_UNUSED( p_this ); VLC_UNUSED( psz_var ); VLC_UNUSED( oldval ); VLC_UNUSED( newval );
-
- MainInputManager *mim = (MainInputManager*)param;
-
- IMEvent *event = new IMEvent( SoundMuteChanged_Type );
- QApplication::postEvent( mim, event );
- return VLC_SUCCESS;
+ emit soundMuteChanged(mute);
}
static int PLItemAppended
ItemTitleChanged_Type,
ItemRateChanged_Type,
VolumeChanged_Type,
- SoundMuteChanged_Type,
ItemEsChanged_Type,
ItemTeletextChanged_Type,
InterfaceVoutUpdate_Type,
input_thread_t *p_input;
intf_thread_t *p_intf;
QVLCBool random, repeat, loop;
+ QVLCBool mute;
public slots:
void togglePlayPause();
private slots:
void notifyRandom( bool );
void notifyRepeatLoop( bool );
+ void notifyMute( bool );
signals:
void inputChanged( input_thread_t * );
void volumeChanged();
- void soundMuteChanged();
+ void soundMuteChanged(bool);
void playlistItemAppended( int itemId, int parentId );
void playlistItemRemoved( int itemId );
void playlistNotEmpty( bool );