[vlc-commits] commit: URL box is now focussed when "Open Network Stream" dialog box opens . (Daniel Marth )

git at videolan.org git at videolan.org
Thu Dec 16 01:56:53 CET 2010


vlc | branch: master | Daniel Marth <danielmarth at gmx.at> | Wed Dec 15 19:19:49 2010 +0100| [df805945d60896b8b6e5a27f801948d6b4db8478] | committer: Jean-Baptiste Kempf 

URL box is now focussed when "Open Network Stream" dialog box opens.

The URL box in the "Open Network Stream" dialog has now always focus
when opened 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).

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/gui/qt4/components/open_panels.cpp |    6 ++++++
 modules/gui/qt4/components/open_panels.hpp |    2 ++
 modules/gui/qt4/dialogs/open.cpp           |   14 ++++++++++++--
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt4/components/open_panels.cpp b/modules/gui/qt4/components/open_panels.cpp
index ce95924..0ce49dd 100644
--- a/modules/gui/qt4/components/open_panels.cpp
+++ b/modules/gui/qt4/components/open_panels.cpp
@@ -594,6 +594,12 @@ NetOpenPanel::~NetOpenPanel()
 void NetOpenPanel::clear()
 {}
 
+void NetOpenPanel::onFocus()
+{
+    ui.urlComboBox->setFocus();
+    ui.urlComboBox->lineEdit()->selectAll();
+}
+
 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..8d6f00c 100644
--- a/modules/gui/qt4/components/open_panels.hpp
+++ b/modules/gui/qt4/components/open_panels.hpp
@@ -74,6 +74,7 @@ public:
     }
     virtual ~OpenPanel() {};
     virtual void clear() = 0;
+    virtual void onFocus() {}
 protected:
     intf_thread_t *p_intf;
 public slots:
@@ -140,6 +141,7 @@ public:
     NetOpenPanel( QWidget *, intf_thread_t * );
     virtual ~NetOpenPanel();
     virtual void clear() ;
+    void onFocus();
 private:
     Ui::OpenNetwork ui;
     QStringListModel *mrlList;
diff --git a/modules/gui/qt4/dialogs/open.cpp b/modules/gui/qt4/dialogs/open.cpp
index 6cd52e3..24d0653 100644
--- a/modules/gui/qt4/dialogs/open.cpp
+++ b/modules/gui/qt4/dialogs/open.cpp
@@ -240,15 +240,25 @@ void OpenDialog::showTab( int i_tab )
     if( i_tab == OPEN_CAPTURE_TAB ) captureOpenPanel->initialize();
     ui.Tab->setCurrentIndex( i_tab );
     show();
+    if( ui.Tab->currentWidget() != NULL )
+    {
+        OpenPanel *panel = dynamic_cast<OpenPanel *>( ui.Tab->currentWidget() );
+        assert( panel );
+        panel->onFocus();
+    }
 }
 
 /* Function called on signal currentChanged triggered */
 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();
+    {
+        OpenPanel *panel = dynamic_cast<OpenPanel *>( ui.Tab->currentWidget() );
+        assert( panel );
+        panel->onFocus();
+        panel->updateMRL();
+    }
 }
 
 void OpenDialog::toggleAdvancedPanel()



More information about the vlc-commits mailing list