[vlc-devel] commit: Don't allocate and create the Capture Open Panel in open. ( Jean-Baptiste Kempf )

git version control git at videolan.org
Mon Aug 25 16:02:10 CEST 2008


vlc | branch: 0.9-bugfix | Jean-Baptiste Kempf <jb at videolan.org> | Mon Aug 25 01:06:48 2008 -0700| [47c72a9ad24127b5989312172ba36a678a79f387] | committer: Christophe Mutricy 

Don't allocate and create the Capture Open Panel in open.

The Capture panel is sensibly slower than all the other ones and way less used by most people. Therefore, don't build it (especially for windows) unless you need it. Better for speed and memory.
(cherry picked from commit 354abbea2151c4718f1ad2a645afff4799252588)

Signed-off-by: Christophe Mutricy <xtophe at videolan.org>

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

 modules/gui/qt4/components/open_panels.cpp |   10 ++++++++++
 modules/gui/qt4/components/open_panels.hpp |    3 +++
 modules/gui/qt4/dialogs/open.cpp           |    7 +++++--
 modules/gui/qt4/dialogs/open.hpp           |    2 +-
 4 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/modules/gui/qt4/components/open_panels.cpp b/modules/gui/qt4/components/open_panels.cpp
index 5f4dcab..ee1edca 100644
--- a/modules/gui/qt4/components/open_panels.cpp
+++ b/modules/gui/qt4/components/open_panels.cpp
@@ -557,6 +557,16 @@ void NetOpenPanel::updateMRL() {
 CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
                                 OpenPanel( _parent, _p_intf )
 {
+    isInitialized = false;
+}
+
+void CaptureOpenPanel::initialize()
+{
+    if( isInitialized ) return;
+
+    msg_Dbg( p_intf, "Initialization of Capture device panel" );
+    isInitialized = true;
+
     ui.setupUi( this );
 
     BUTTONACT( ui.advancedButton, advancedDialog() );
diff --git a/modules/gui/qt4/components/open_panels.hpp b/modules/gui/qt4/components/open_panels.hpp
index ee97347..d05998a 100644
--- a/modules/gui/qt4/components/open_panels.hpp
+++ b/modules/gui/qt4/components/open_panels.hpp
@@ -179,6 +179,8 @@ public:
     virtual void clear() ;
 private:
     Ui::OpenCapture ui;
+    bool isInitialized;
+
     QString advMRL;
     QDialog *adv;
 #ifdef WIN32
@@ -203,6 +205,7 @@ private:
 
 public slots:
     virtual void updateMRL();
+    void initialize();
 private slots:
     void updateButtons();
     void advancedDialog();
diff --git a/modules/gui/qt4/dialogs/open.cpp b/modules/gui/qt4/dialogs/open.cpp
index 8390108..df2b56a 100644
--- a/modules/gui/qt4/dialogs/open.cpp
+++ b/modules/gui/qt4/dialogs/open.cpp
@@ -128,7 +128,7 @@ OpenDialog::OpenDialog( QWidget *parent,
     setMenuAction();
 
     /* Force MRL update on tab change */
-    CONNECT( ui.Tab, currentChanged( int ), this, signalCurrent() );
+    CONNECT( ui.Tab, currentChanged( int ), this, signalCurrent( int ) );
 
     CONNECT( fileOpenPanel, mrlUpdated( QString ), this, updateMRL( QString ) );
     CONNECT( netOpenPanel, mrlUpdated( QString ), this, updateMRL( QString ) );
@@ -208,13 +208,16 @@ void OpenDialog::setMenuAction()
 
 void OpenDialog::showTab( int i_tab )
 {
+    if( i_tab == OPEN_CAPTURE_TAB ) captureOpenPanel->initialize();
     ui.Tab->setCurrentIndex( i_tab );
     show();
 }
 
 /* Function called on signal currentChanged triggered */
-void OpenDialog::signalCurrent()
+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 92a546d..291207e 100644
--- a/modules/gui/qt4/dialogs/open.hpp
+++ b/modules/gui/qt4/dialogs/open.hpp
@@ -114,7 +114,7 @@ private slots:
     void updateMRL( QString );
     void updateMRL();
     void newCachingMethod( QString );
-    void signalCurrent();
+    void signalCurrent( int );
     void browseInputSlave();
 };
 




More information about the vlc-devel mailing list