[vlc-commits] Add shortcut to set focus on playlist search field

Guillaume Gomez git at videolan.org
Mon Mar 7 14:13:59 CET 2016


vlc | branch: master | Guillaume Gomez <guillaume1.gomez at gmail.com> | Fri Mar  4 02:36:13 2016 +0100| [106a3256810c7f56da704fef6d59ccedf3794954] | committer: Jean-Baptiste Kempf

Add shortcut to set focus on playlist search field

Signed-off-by: Guillaume Gomez <guillaume1.gomez at gmail.com>
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/gui/qt/components/playlist/playlist.cpp |    5 +++++
 modules/gui/qt/components/playlist/playlist.hpp |    1 +
 modules/gui/qt/main_interface.cpp               |    6 ++++++
 3 files changed, 12 insertions(+)

diff --git a/modules/gui/qt/components/playlist/playlist.cpp b/modules/gui/qt/components/playlist/playlist.cpp
index 7091805..cc89300 100644
--- a/modules/gui/qt/components/playlist/playlist.cpp
+++ b/modules/gui/qt/components/playlist/playlist.cpp
@@ -226,6 +226,11 @@ void PlaylistWidget::changeView( const QModelIndex& index )
     locationBar->setIndex( index );
 }
 
+void PlaylistWidget::setSearchFieldFocus()
+{
+    searchEdit->setFocus();
+}
+
 #include <QSignalMapper>
 #include <QMenu>
 #include <QPainter>
diff --git a/modules/gui/qt/components/playlist/playlist.hpp b/modules/gui/qt/components/playlist/playlist.hpp
index 35d745b..1955370 100644
--- a/modules/gui/qt/components/playlist/playlist.hpp
+++ b/modules/gui/qt/components/playlist/playlist.hpp
@@ -56,6 +56,7 @@ public:
 
     void forceHide();
     void forceShow();
+    void setSearchFieldFocus();
     QStackedWidget *artContainer;
     StandardPLPanel      *mainView;
 
diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp
index 5fc777d..04acfdd 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -1489,6 +1489,12 @@ void MainInterface::handleKeyPress( QKeyEvent *e )
         toggleMinimalView( !b_minimalView );
         e->accept();
     }
+    else if( ( e->modifiers() & Qt::ControlModifier ) && ( e->key() == Qt::Key_K ) &&
+        playlistWidget )
+    {
+        playlistWidget->setSearchFieldFocus();
+        e->accept();
+    }
 
     int i_vlck = qtEventToVLCKey( e );
     if( i_vlck > 0 )



More information about the vlc-commits mailing list