[vlc-commits] commit: Playlist: Allow pausing the playback using space. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Sat Jun 5 15:55:26 CEST 2010


vlc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Sat Jun  5 15:35:14 2010 +0200| [c60dc271901f061dda5fd98bde516fa7b8c705d2] | committer: Rémi Denis-Courmont 

Playlist: Allow pausing the playback using space.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 modules/gui/qt4/components/playlist/icon_view.cpp |   22 +++++++++++++++++++++
 modules/gui/qt4/components/playlist/icon_view.hpp |    2 +
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/icon_view.cpp b/modules/gui/qt4/components/playlist/icon_view.cpp
index cc5ee73..60e1ca5 100644
--- a/modules/gui/qt4/components/playlist/icon_view.cpp
+++ b/modules/gui/qt4/components/playlist/icon_view.cpp
@@ -385,6 +385,17 @@ void PlListView::dragMoveEvent ( QDragMoveEvent * event )
     QAbstractItemView::dragMoveEvent( event );
 }
 
+void PlListView::keyPressEvent( QKeyEvent *event )
+{
+    //If the space key is pressed, override the standard list behaviour to allow pausing
+    //to proceed.
+    if ( event->modifiers() == Qt::NoModifier && event->key() == Qt::Key_Space )
+        QWidget::keyPressEvent( event );
+    //Otherwise, just do as usual.
+    else
+        QListView::keyPressEvent( event );
+}
+
 void PlTreeView::startDrag ( Qt::DropActions supportedActions )
 {
     plViewStartDrag( this, supportedActions );
@@ -395,3 +406,14 @@ void PlTreeView::dragMoveEvent ( QDragMoveEvent * event )
     plViewDragMoveEvent( this, event );
     QAbstractItemView::dragMoveEvent( event );
 }
+
+void PlTreeView::keyPressEvent( QKeyEvent *event )
+{
+    //If the space key is pressed, override the standard list behaviour to allow pausing
+    //to proceed.
+    if ( event->modifiers() == Qt::NoModifier && event->key() == Qt::Key_Space )
+        QWidget::keyPressEvent( event );
+    //Otherwise, just do as usual.
+    else
+        QTreeView::keyPressEvent( event );
+}
diff --git a/modules/gui/qt4/components/playlist/icon_view.hpp b/modules/gui/qt4/components/playlist/icon_view.hpp
index 9f53999..64996d8 100644
--- a/modules/gui/qt4/components/playlist/icon_view.hpp
+++ b/modules/gui/qt4/components/playlist/icon_view.hpp
@@ -82,6 +82,7 @@ public:
 private:
     void startDrag ( Qt::DropActions supportedActions );
     void dragMoveEvent ( QDragMoveEvent * event );
+    void keyPressEvent( QKeyEvent *event );
 };
 
 class PlTreeView : public QTreeView
@@ -91,6 +92,7 @@ class PlTreeView : public QTreeView
 private:
     void startDrag ( Qt::DropActions supportedActions );
     void dragMoveEvent ( QDragMoveEvent * event );
+    void keyPressEvent( QKeyEvent *event );
 };
 
 #endif



More information about the vlc-commits mailing list