Commit 47c72a9a authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf Committed by 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 354abbea)
Signed-off-by: default avatarChristophe Mutricy <xtophe@videolan.org>
parent 58b3ac35
...@@ -557,6 +557,16 @@ void NetOpenPanel::updateMRL() { ...@@ -557,6 +557,16 @@ void NetOpenPanel::updateMRL() {
CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
OpenPanel( _parent, _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 ); ui.setupUi( this );
BUTTONACT( ui.advancedButton, advancedDialog() ); BUTTONACT( ui.advancedButton, advancedDialog() );
......
...@@ -179,6 +179,8 @@ public: ...@@ -179,6 +179,8 @@ public:
virtual void clear() ; virtual void clear() ;
private: private:
Ui::OpenCapture ui; Ui::OpenCapture ui;
bool isInitialized;
QString advMRL; QString advMRL;
QDialog *adv; QDialog *adv;
#ifdef WIN32 #ifdef WIN32
...@@ -203,6 +205,7 @@ private: ...@@ -203,6 +205,7 @@ private:
public slots: public slots:
virtual void updateMRL(); virtual void updateMRL();
void initialize();
private slots: private slots:
void updateButtons(); void updateButtons();
void advancedDialog(); void advancedDialog();
......
...@@ -128,7 +128,7 @@ OpenDialog::OpenDialog( QWidget *parent, ...@@ -128,7 +128,7 @@ OpenDialog::OpenDialog( QWidget *parent,
setMenuAction(); setMenuAction();
/* Force MRL update on tab change */ /* 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( fileOpenPanel, mrlUpdated( QString ), this, updateMRL( QString ) );
CONNECT( netOpenPanel, mrlUpdated( QString ), this, updateMRL( QString ) ); CONNECT( netOpenPanel, mrlUpdated( QString ), this, updateMRL( QString ) );
...@@ -208,13 +208,16 @@ void OpenDialog::setMenuAction() ...@@ -208,13 +208,16 @@ void OpenDialog::setMenuAction()
void OpenDialog::showTab( int i_tab ) void OpenDialog::showTab( int i_tab )
{ {
if( i_tab == OPEN_CAPTURE_TAB ) captureOpenPanel->initialize();
ui.Tab->setCurrentIndex( i_tab ); ui.Tab->setCurrentIndex( i_tab );
show(); show();
} }
/* Function called on signal currentChanged triggered */ /* 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 ) if( ui.Tab->currentWidget() != NULL )
( dynamic_cast<OpenPanel *>( ui.Tab->currentWidget() ) )->updateMRL(); ( dynamic_cast<OpenPanel *>( ui.Tab->currentWidget() ) )->updateMRL();
} }
......
...@@ -114,7 +114,7 @@ private slots: ...@@ -114,7 +114,7 @@ private slots:
void updateMRL( QString ); void updateMRL( QString );
void updateMRL(); void updateMRL();
void newCachingMethod( QString ); void newCachingMethod( QString );
void signalCurrent(); void signalCurrent( int );
void browseInputSlave(); void browseInputSlave();
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment