Commit 02044642 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - Open: clean again, and fix the clear() bug.

parent fe986989
...@@ -112,13 +112,13 @@ OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal, ...@@ -112,13 +112,13 @@ OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal,
CONNECT( captureOpenPanel, mrlUpdated( QString ), this, updateMRL(QString) ); CONNECT( captureOpenPanel, mrlUpdated( QString ), this, updateMRL(QString) );
CONNECT( fileOpenPanel, methodChanged( QString ), CONNECT( fileOpenPanel, methodChanged( QString ),
this, newMethod(QString) ); this, newCachingMethod(QString) );
CONNECT( netOpenPanel, methodChanged( QString ), CONNECT( netOpenPanel, methodChanged( QString ),
this, newMethod(QString) ); this, newCachingMethod(QString) );
CONNECT( discOpenPanel, methodChanged( QString ), CONNECT( discOpenPanel, methodChanged( QString ),
this, newMethod(QString) ); this, newCachingMethod(QString) );
CONNECT( captureOpenPanel, methodChanged( QString ), CONNECT( captureOpenPanel, methodChanged( QString ),
this, newMethod(QString) ); this, newCachingMethod(QString) );
/* Advanced frame Connects */ /* Advanced frame Connects */
CONNECT( ui.slaveText, textChanged(QString), this, updateMRL()); CONNECT( ui.slaveText, textChanged(QString), this, updateMRL());
...@@ -135,7 +135,7 @@ OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal, ...@@ -135,7 +135,7 @@ OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal,
/* Initialize caching */ /* Initialize caching */
storedMethod = ""; storedMethod = "";
newMethod("file-caching"); newCachingMethod("file-caching");
mainHeight = advHeight = 0; mainHeight = advHeight = 0;
} }
...@@ -179,6 +179,31 @@ void OpenDialog::signalCurrent() { ...@@ -179,6 +179,31 @@ void OpenDialog::signalCurrent() {
(dynamic_cast<OpenPanel *>( ui.Tab->currentWidget() ))->updateMRL(); (dynamic_cast<OpenPanel *>( ui.Tab->currentWidget() ))->updateMRL();
} }
void OpenDialog::toggleAdvancedPanel()
{
//FIXME does not work under Windows
if( ui.advancedFrame->isVisible() ) {
ui.advancedFrame->hide();
#ifndef WIN32
setMinimumHeight(1);
resize( width(), mainHeight );
#endif
} else {
#ifndef WIN32
if( mainHeight == 0 )
mainHeight = height();
#endif
ui.advancedFrame->show();
#ifndef WIN32
if( advHeight == 0 ) {
advHeight = height() - mainHeight;
}
resize( width(), mainHeight + advHeight );
#endif
}
}
/*********** /***********
* Actions * * Actions *
***********/ ***********/
...@@ -186,8 +211,9 @@ void OpenDialog::signalCurrent() { ...@@ -186,8 +211,9 @@ void OpenDialog::signalCurrent() {
/* If Cancel is pressed or escaped */ /* If Cancel is pressed or escaped */
void OpenDialog::cancel() void OpenDialog::cancel()
{ {
fileOpenPanel->clear(); for( int i = 0; i <= OPEN_TAB_MAX; i++ )
this->toggleVisible(); dynamic_cast<OpenPanel*>(ui.Tab->widget( i ))->clear();
toggleVisible();
if( isModal() ) reject(); if( isModal() ) reject();
} }
...@@ -230,7 +256,7 @@ void OpenDialog::stream( bool b_transcode_only ) ...@@ -230,7 +256,7 @@ void OpenDialog::stream( bool b_transcode_only )
void OpenDialog::finish( bool b_enqueue = false ) void OpenDialog::finish( bool b_enqueue = false )
{ {
this->toggleVisible(); toggleVisible();
mrl = ui.advancedLineInput->text(); mrl = ui.advancedLineInput->text();
if( !isModal() ) if( !isModal() )
...@@ -240,18 +266,17 @@ void OpenDialog::finish( bool b_enqueue = false ) ...@@ -240,18 +266,17 @@ void OpenDialog::finish( bool b_enqueue = false )
{ {
bool b_start = !i && !b_enqueue; bool b_start = !i && !b_enqueue;
input_item_t *p_input; input_item_t *p_input;
const char *psz_utf8 = qtu( tempMRL[i] );
p_input = input_ItemNew( p_intf, psz_utf8, NULL ); p_input = input_ItemNew( p_intf, qtu( tempMRL[i] ), NULL );
/* Insert options */ /* Insert options */
while( i + 1 < tempMRL.size() && tempMRL[i + 1].startsWith( ":" ) ) while( i + 1 < tempMRL.size() && tempMRL[i + 1].startsWith( ":" ) )
{ {
i++; i++;
psz_utf8 = qtu( tempMRL[i] ); input_ItemAddOption( p_input, qtu( tempMRL[i] ) );
input_ItemAddOption( p_input, psz_utf8 );
} }
/* Switch between enqueuing and starting the item */
if( b_start ) if( b_start )
{ {
playlist_AddInput( THEPL, p_input, playlist_AddInput( THEPL, p_input,
...@@ -261,7 +286,7 @@ void OpenDialog::finish( bool b_enqueue = false ) ...@@ -261,7 +286,7 @@ void OpenDialog::finish( bool b_enqueue = false )
else else
{ {
playlist_AddInput( THEPL, p_input, playlist_AddInput( THEPL, p_input,
PLAYLIST_APPEND|PLAYLIST_PREPARSE, PLAYLIST_APPEND | PLAYLIST_PREPARSE,
PLAYLIST_END, VLC_TRUE, VLC_FALSE ); PLAYLIST_END, VLC_TRUE, VLC_FALSE );
} }
} }
...@@ -270,29 +295,12 @@ void OpenDialog::finish( bool b_enqueue = false ) ...@@ -270,29 +295,12 @@ void OpenDialog::finish( bool b_enqueue = false )
accept(); accept();
} }
void OpenDialog::toggleAdvancedPanel()
{
//FIXME does not work under Windows
if( ui.advancedFrame->isVisible() ) {
ui.advancedFrame->hide();
#ifndef WIN32
setMinimumHeight(1);
resize( width(), mainHeight );
#endif
} else {
#ifndef WIN32
if( mainHeight == 0 )
mainHeight = height();
#endif
ui.advancedFrame->show(); /* Update the MRL */
#ifndef WIN32 void OpenDialog::updateMRL( QString tempMRL )
if( advHeight == 0 ) { {
advHeight = height() - mainHeight; mainMRL = tempMRL;
} updateMRL();
resize( width(), mainHeight + advHeight );
#endif
}
} }
void OpenDialog::updateMRL() { void OpenDialog::updateMRL() {
...@@ -312,18 +320,12 @@ void OpenDialog::updateMRL() { ...@@ -312,18 +320,12 @@ void OpenDialog::updateMRL() {
ui.advancedLineInput->setText(mrl); ui.advancedLineInput->setText(mrl);
} }
void OpenDialog::updateMRL(QString tempMRL) void OpenDialog::newCachingMethod( QString method )
{
mainMRL = tempMRL;
updateMRL();
}
void OpenDialog::newMethod(QString method)
{ {
if( method != storedMethod ) { if( method != storedMethod ) {
storedMethod = method; storedMethod = method;
int i_value = config_GetInt( p_intf, qta(storedMethod) ); int i_value = config_GetInt( p_intf, qta( storedMethod ) );
ui.cacheSpinBox->setValue(i_value); ui.cacheSpinBox->setValue( i_value );
} }
} }
......
...@@ -92,7 +92,7 @@ private slots: ...@@ -92,7 +92,7 @@ private slots:
void toggleAdvancedPanel(); void toggleAdvancedPanel();
void updateMRL( QString ); void updateMRL( QString );
void updateMRL(); void updateMRL();
void newMethod(QString); void newCachingMethod( QString );
void signalCurrent(); void signalCurrent();
}; };
......
...@@ -74,7 +74,8 @@ enum { ...@@ -74,7 +74,8 @@ enum {
OPEN_FILE_TAB, OPEN_FILE_TAB,
OPEN_DISC_TAB, OPEN_DISC_TAB,
OPEN_NETWORK_TAB, OPEN_NETWORK_TAB,
OPEN_CAPTURE_TAB OPEN_CAPTURE_TAB,
OPEN_TAB_MAX
}; };
enum { enum {
......
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