[vlc-devel] commit: Qt: make sure the random buttons states are consistent ( Jean-Baptiste Kempf )

git version control git at videolan.org
Fri Dec 4 07:21:46 CET 2009


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun Nov 29 18:20:24 2009 +0100| [c5f0506c9eb9b0f899379112158c129cee29b4bf] | committer: Jean-Baptiste Kempf 

Qt: make sure the random buttons states are consistent

with the core and between themselves

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c5f0506c9eb9b0f899379112158c129cee29b4bf
---

 modules/gui/qt4/components/controller.cpp |    2 ++
 modules/gui/qt4/input_manager.cpp         |   18 ++++++++++++++++++
 modules/gui/qt4/input_manager.hpp         |    2 ++
 3 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/modules/gui/qt4/components/controller.cpp b/modules/gui/qt4/components/controller.cpp
index aa73f05..0a2071e 100644
--- a/modules/gui/qt4/components/controller.cpp
+++ b/modules/gui/qt4/components/controller.cpp
@@ -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:
diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index 77d09fc..7f65ff0 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -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;
+}
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index 5fc39a5..98f5c1d 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -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




More information about the vlc-devel mailing list