* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
#include "input_manager.hpp"
OpenDialog *OpenDialog::instance = NULL;
OpenDialog* OpenDialog::getInstance( QWidget *parent, intf_thread_t *p_intf,
- int _action_flag, bool modal )
+ bool b_rawInstance, int _action_flag, bool b_selectMode )
{
/* Creation */
if( !instance )
- instance = new OpenDialog( parent, p_intf, modal, _action_flag );
- else
+ instance = new OpenDialog( parent, p_intf, b_selectMode, _action_flag );
+ else if( !b_rawInstance )
{
/* Request the instance but change small details:
- Button menu
- Modality on top of the parent dialog */
+ if( b_selectMode )
+ {
+ instance->setWindowModality( Qt::WindowModal );
+ _action_flag = SELECT; /* This should be useless, but we never know
+ if the call is correct */
+ }
instance->i_action_flag = _action_flag;
instance->setMenuAction();
- if( modal ) instance->setWindowModality( Qt::WindowModal );
}
return instance;
}
OpenDialog::OpenDialog( QWidget *parent,
intf_thread_t *_p_intf,
- bool modal,
+ bool b_selectMode,
int _action_flag ) : QVLCDialog( parent, _p_intf )
{
i_action_flag = _action_flag;
- if( modal ) /* Select mode */
+ if( b_selectMode ) /* Select mode */
{
setWindowModality( Qt::WindowModal );
i_action_flag = SELECT;
/* Basic Creation of the Window */
ui.setupUi( this );
setWindowTitle( qtr( "Open" ) );
- resize( 410, 300 );
+ /* resize( 410, 600 ); */
+ setMinimumSize( 520, 460 );
/* Tab definition and creation */
fileOpenPanel = new FileOpenPanel( ui.Tab, p_intf );
ui.slaveBrowseButton->hide();
/* Buttons Creation */
- QSizePolicy buttonSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum );
- buttonSizePolicy.setHorizontalStretch( 0 );
- buttonSizePolicy.setVerticalStretch( 0 );
-
/* Play Button */
- playButton = new QToolButton( this );
- playButton->setText( qtr( "&Play" ) );
- playButton->setSizePolicy( buttonSizePolicy );
- playButton->setMinimumSize( QSize( 90, 0 ) );
- playButton->setPopupMode( QToolButton::MenuButtonPopup );
- playButton->setToolButtonStyle( Qt::ToolButtonTextOnly );
+ playButton = ui.playButton;
/* Cancel Button */
- cancelButton = new QPushButton();
- cancelButton->setText( qtr( "&Cancel" ) );
- cancelButton->setSizePolicy( buttonSizePolicy );
+ cancelButton = new QPushButton( qtr( "&Cancel" ) );
/* Select Button */
- selectButton = new QPushButton;
- selectButton->setText( qtr( "Select" ) );
- selectButton->setSizePolicy( buttonSizePolicy );
+ selectButton = new QPushButton( qtr( "&Select" ) );
/* Menu for the Play button */
QMenu * openButtonMenu = new QMenu( "Open" );
openButtonMenu->addAction( qtr( "&Convert" ), this, SLOT( transcode() ) ,
QKeySequence( "Alt+C" ) );
- playButton->setMenu( openButtonMenu );
+ ui.menuButton->setMenu( openButtonMenu );
/* Add the three Buttons */
- ui.buttonsBox->addButton( playButton, QDialogButtonBox::ActionRole );
ui.buttonsBox->addButton( selectButton, QDialogButtonBox::AcceptRole );
ui.buttonsBox->addButton( cancelButton, QDialogButtonBox::RejectRole );
CONNECT( ui.slaveText, textChanged( QString ), this, updateMRL() );
CONNECT( ui.cacheSpinBox, valueChanged( int ), this, updateMRL() );
CONNECT( ui.startTimeSpinBox, valueChanged( int ), this, updateMRL() );
- BUTTONACT( ui.advancedCheckBox , toggleAdvancedPanel() );
+ BUTTONACT( ui.advancedCheckBox, toggleAdvancedPanel() );
/* Buttons action */
BUTTONACT( playButton, selectSlots() );
{
playButton->hide();
selectButton->show();
+ selectButton->setDefault( true );
}
else
{
}
playButton->show();
selectButton->hide();
+ playButton->setDefault( true );
}
}
-void OpenDialog::showTab( int i_tab=0 )
+void OpenDialog::showTab( int i_tab )
{
ui.Tab->setCurrentIndex( i_tab );
show();
if( ui.advancedFrame->isVisible() )
{
ui.advancedFrame->hide();
- //FIXME: Clear Bug here. Qt ?
- resize( size().width(), size().height() - ui.advancedFrame->height() );
+ //setMinimumSize( 520, 460 );
+ if( size().isValid() )
+ resize( size().width(), size().height()
+ - ui.advancedFrame->height() );
}
else
{
ui.advancedFrame->show();
+ //setMinimumSize( 520, 460 + ui.advancedFrame->height() );
+ if( size().isValid() )
+ resize( size().width(), size().height()
+ + ui.advancedFrame->height() );
}
}
mainMRL.clear();
/* If in Select Mode, reject instead of hiding */
- if( windowModality() != Qt::NonModal ) reject();
+ if( i_action_flag == SELECT ) reject();
else hide();
}
/* If EnterKey is pressed */
void OpenDialog::close()
{
- if( windowModality() != Qt::NonModal )
+ /* If in Select Mode, accept instead of selecting a Slot */
+ if( i_action_flag == SELECT )
accept();
else
selectSlots();
toggleVisible();
mrl = ui.advancedLineInput->text();
- if( windowModality() == Qt::NonModal )
+ if( i_action_flag != SELECT )
{
QStringList tempMRL = SeparateEntries( mrl );
for( size_t i = 0; i < tempMRL.size(); i++ )
}
/* Switch between enqueuing and starting the item */
- if( b_start )
- {
- playlist_AddInput( THEPL, p_input,
- PLAYLIST_APPEND | PLAYLIST_GO,
- PLAYLIST_END, VLC_TRUE, VLC_FALSE );
- }
- else
- {
- playlist_AddInput( THEPL, p_input,
- PLAYLIST_APPEND | PLAYLIST_PREPARSE,
- PLAYLIST_END, VLC_TRUE, VLC_FALSE );
- }
+ /* FIXME: playlist_AddInput() can fail */
+ playlist_AddInput( THEPL, p_input,
+ PLAYLIST_APPEND | ( b_start ? PLAYLIST_GO : PLAYLIST_PREPARSE ),
+ PLAYLIST_END, true, pl_Unlocked );
+ vlc_gc_decref( p_input );
}
}
else
{
mrl = ui.advancedLineInput->text();
toggleVisible();
- THEDP->streamingDialog( mrl, b_transcode_only );
+ THEDP->streamingDialog( this, mrl, b_transcode_only );
}
/* Update the MRL */