]> git.sesse.net Git - vlc/commitdiff
Don't allocate and create the Capture Open Panel in open.
authorJean-Baptiste Kempf <jb@videolan.org>
Mon, 25 Aug 2008 08:06:48 +0000 (01:06 -0700)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 25 Aug 2008 08:06:48 +0000 (01:06 -0700)
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.

modules/gui/qt4/components/open_panels.cpp
modules/gui/qt4/components/open_panels.hpp
modules/gui/qt4/dialogs/open.cpp
modules/gui/qt4/dialogs/open.hpp

index 5f4dcaba62909be495e25917ad4b7c96d33ff216..ee1edca934a247b6bcc62f85b834c2dea7c220d6 100644 (file)
@@ -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() );
index ee973472bc13b5eba315af4f8c6a59775f102180..d05998a856a18f67c9d462bda03e048f8cb0027f 100644 (file)
@@ -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();
index 83901083bf6d15c378539d62bd4f91e0cdc869ed..df2b56ac32ee2822ac8ae6e805e985425b94bfd4 100644 (file)
@@ -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();
 }
index 92a546dd6a65dda91239a6c8111d28b5c95a3e80..291207e3d4a65641d62c9ee0446df0c4126426c4 100644 (file)
@@ -114,7 +114,7 @@ private slots:
     void updateMRL( QString );
     void updateMRL();
     void newCachingMethod( QString );
-    void signalCurrent();
+    void signalCurrent( int );
     void browseInputSlave();
 };