Commit c5f0506c authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: make sure the random buttons states are consistent

with the core and between themselves
parent faa1a71b
......@@ -363,6 +363,8 @@ QWidget *AbstractController::createWidget( buttonType_e button, int options )
case RANDOM_BUTTON: {
NORMAL_BUTTON( RANDOM );
RANDOMButton->setCheckable( true );
CONNECT( THEMIM, randomChanged( bool ),
RANDOMButton, setChecked( bool ) );
}
break;
default:
......
......@@ -46,6 +46,10 @@ static int PLItemRemoved( vlc_object_t *, const char *,
static int VolumeChanged( vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void * );
static int RandomChanged( 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 * );
static int VbiEvent( vlc_object_t *, const char *,
......@@ -888,6 +892,7 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf )
var_AddCallback( THEPL, "activity", PLItemChanged, this );
var_AddCallback( THEPL, "playlist-item-append", PLItemAppended, this );
var_AddCallback( THEPL, "playlist-item-deleted", PLItemRemoved, this );
var_AddCallback( THEPL, "random", RandomChanged, this );
var_AddCallback( p_intf->p_libvlc, "volume-change", VolumeChanged, this );
......@@ -959,6 +964,9 @@ void MainInputManager::customEvent( QEvent *event )
plEv = static_cast<PLEvent*>( event );
emit playlistItemRemoved( plEv->i_item );
return;
case RandomChanged_Type:
emit randomChanged( var_GetBool( THEPL, "random" ) );
return;
default:
if( type != ItemChanged_Type ) return;
}
......@@ -1079,3 +1087,13 @@ static int PLItemRemoved
QApplication::postEvent( mim, event );
return VLC_SUCCESS;
}
static int RandomChanged
( vlc_object_t * obj, const char *var, vlc_value_t old, vlc_value_t cur, void *data )
{
MainInputManager *mim = static_cast<MainInputManager*>(data);
IMEvent *event = new IMEvent( RandomChanged_Type );
QApplication::postEvent( mim, event );
return VLC_SUCCESS;
}
......@@ -57,6 +57,7 @@ enum {
BookmarksChanged_Type,
RecordingEvent_Type,
ProgramChanged_Type,
RandomChanged_Type,
/* SignalChanged_Type, */
FullscreenControlToggle_Type = QEvent::User + IMEventType + 20,
......@@ -269,6 +270,7 @@ signals:
void volumeChanged();
void playlistItemAppended( int itemId, int parentId );
void playlistItemRemoved( int itemId );
void randomChanged( bool );
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment