[vlc-devel] [PATCH] URL box is now focussed when "Open Network Stream" dialog box opens.

Daniel Marth danielmarth at gmx.at
Wed Dec 15 15:50:18 CET 2010


The URL box in the "Open Network Stream" dialog has now always focus and its 
content is automatically selected.
The patch is for ticket #4361 and was created as a part of a GCI-task 
(http://www.google-
melange.com/gci/task/show/google/gci2010/videolan/t129200306101).
---
 modules/gui/qt4/components/open_panels.cpp |    6 ++++++
 modules/gui/qt4/components/open_panels.hpp |    1 +
 modules/gui/qt4/dialogs/open.cpp           |   15 ++++++++++++++-
 modules/gui/qt4/dialogs/open.hpp           |    3 ++-
 4 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt4/components/open_panels.cpp 
b/modules/gui/qt4/components/open_panels.cpp
index ce95924..8257a8e 100644
--- a/modules/gui/qt4/components/open_panels.cpp
+++ b/modules/gui/qt4/components/open_panels.cpp
@@ -577,6 +577,7 @@ NetOpenPanel::NetOpenPanel( QWidget *_parent, 
intf_thread_t *_p_intf ) :
 
     ui.urlComboBox->setValidator( new UrlValidator( this ) );
     ui.urlComboBox->setFocus();
+    ui.urlComboBox->grabKeyboard();
 }
 
 NetOpenPanel::~NetOpenPanel()
@@ -594,6 +595,11 @@ NetOpenPanel::~NetOpenPanel()
 void NetOpenPanel::clear()
 {}
 
+QComboBox *NetOpenPanel::comboBox()
+{
+    return ui.urlComboBox;
+}
+
 static int strcmp_void( const void *k, const void *e )
 {
     return strcmp( (const char *)k, (const char *)e );
diff --git a/modules/gui/qt4/components/open_panels.hpp 
b/modules/gui/qt4/components/open_panels.hpp
index 0160972..409699f 100644
--- a/modules/gui/qt4/components/open_panels.hpp
+++ b/modules/gui/qt4/components/open_panels.hpp
@@ -140,6 +140,7 @@ public:
     NetOpenPanel( QWidget *, intf_thread_t * );
     virtual ~NetOpenPanel();
     virtual void clear() ;
+    QComboBox *comboBox();
 private:
     Ui::OpenNetwork ui;
     QStringListModel *mrlList;
diff --git a/modules/gui/qt4/dialogs/open.cpp 
b/modules/gui/qt4/dialogs/open.cpp
index 6cd52e3..bc5153e 100644
--- a/modules/gui/qt4/dialogs/open.cpp
+++ b/modules/gui/qt4/dialogs/open.cpp
@@ -165,6 +165,8 @@ OpenDialog::OpenDialog( QWidget *parent,
     BUTTONACT( playButton, selectSlots() );
     BUTTONACT( selectButton, close() );
     BUTTONACT( cancelButton, cancel() );
+    
+    CONNECT( ui.Tab, currentChanged( int ), netOpenPanel->comboBox()-
>lineEdit(), selectAll());
 
     /* Hide the advancedPanel */
     if( !var_InheritBool( p_intf, "qt-adv-options" ) )
@@ -204,6 +206,17 @@ QString OpenDialog::getOptions()
     return ui.advancedLineInput->text();
 }
 
+/* Show dialog and select text in the network panel, if this is the current 
tab */
+void OpenDialog::show()
+{
+    QVLCDialog::show();
+    if( ui.Tab->currentIndex() == OPEN_NETWORK_TAB )
+    {
+        netOpenPanel->comboBox()->lineEdit()->selectAll();
+        netOpenPanel->comboBox()->lineEdit()->setFocus();
+    }
+}
+
 /* Finish the dialog and decide if you open another one after */
 void OpenDialog::setMenuAction()
 {
@@ -246,7 +259,7 @@ void OpenDialog::showTab( int i_tab )
 void OpenDialog::signalCurrent( int i_tab )
 {
     if( i_tab == OPEN_CAPTURE_TAB ) captureOpenPanel->initialize();
-
+    
     if( ui.Tab->currentWidget() != NULL )
         ( dynamic_cast<OpenPanel *>( ui.Tab->currentWidget() ) )-
>updateMRL();
 }
diff --git a/modules/gui/qt4/dialogs/open.hpp 
b/modules/gui/qt4/dialogs/open.hpp
index 47deea6..eceeecf 100644
--- a/modules/gui/qt4/dialogs/open.hpp
+++ b/modules/gui/qt4/dialogs/open.hpp
@@ -74,12 +74,13 @@ public:
     QString getOptions();
 
 public slots:
+    void show();
     void selectSlots();
     void play();
     void stream( bool b_transode_only = false );
     void enqueue();
     void transcode();
-
+    
 private:
     OpenDialog( QWidget *parent, intf_thread_t *, bool b_selectMode,
                 int _action_flag = 0, bool b_pl = true );
-- 
1.7.1




More information about the vlc-devel mailing list