/*****************************************************************************
* open.cpp : Panels for the open dialogs
****************************************************************************
- * Copyright (C) 2006-2007 the VideoLAN team
+ * Copyright (C) 2006-2008 the VideoLAN team
* Copyright (C) 2007 Société des arts technologiques
* Copyright (C) 2007 Savoir-faire Linux
*
#include <QScrollArea>
#include <QUrl>
+#define I_DEVICE_TOOLTIP "Select the device or the VIDEO_TS directory"
+
/**************************************************************************
* Open Files and subtitles *
**************************************************************************/
dialogBox->setFileMode( QFileDialog::ExistingFiles );
dialogBox->setAcceptMode( QFileDialog::AcceptOpen );
- dialogBox->setViewMode( config_GetInt( p_intf, "qt-open-detail" ) ?
- QFileDialog::Detail : QFileDialog::List );
+#if HAS_QT43
+ dialogBox->restoreState(
+ getSettings()->value( "file-dialog-state" ).toByteArray() );
+#endif
/* We don't want to see a grip in the middle of the window, do we? */
dialogBox->setSizeGripEnabled( false );
/* Add a tooltip */
- dialogBox->setToolTip( qtr( "Select one or multiple files, or a folder" ) );
+ dialogBox->setToolTip( qtr( "Select one or multiple files" ) );
// But hide the two OK/Cancel buttons. Enable them for debug.
QDialogButtonBox *fileDialogAcceptBox =
FileOpenPanel::~FileOpenPanel()
{
+#if HAS_QT43
+ getSettings()->setValue( "file-dialog-state", dialogBox->saveState() );
+#endif
}
/* Show a fileBrowser to select a subtitle */
void FileOpenBox::accept()
{
- OpenDialog::getInstance( NULL, NULL )->play();
+ OpenDialog::getInstance( NULL, NULL, true )->selectSlots();
}
/* Function called by Open Dialog when clicked on cancel */
b_firstvcd = true;
b_firstcdda = true;
+ ui.browseDiscButton->setToolTip( I_DEVICE_TOOLTIP );
+ ui.deviceCombo->setToolTip( I_DEVICE_TOOLTIP );
+
#if WIN32 /* Disc drives probing for Windows */
char szDrives[512];
szDrives[0] = '\0';
BUTTONACT( ui.audioCDRadioButton, updateButtons() );
BUTTONACT( ui.dvdsimple, updateButtons() );
BUTTONACT( ui.browseDiscButton, browseDevice() );
- BUTTONACT( ui.ejectButton, eject() );
+ BUTTON_SET_ACT_I( ui.ejectButton, "", eject, qtr( "Eject the disc" ),
+ eject() );
CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
CONNECT( ui.titleSpin, valueChanged( int ), this, updateMRL());
DiscOpenPanel::~DiscOpenPanel()
{
- delete psz_dvddiscpath;
- delete psz_vcddiscpath;
- delete psz_cddadiscpath;
+ free( psz_dvddiscpath );
+ free( psz_vcddiscpath );
+ free( psz_cddadiscpath );
}
void DiscOpenPanel::clear()
ui.chapterLabel->show();
ui.chapterSpin->show();
ui.diskOptionBox_2->show();
+ ui.dvdsimple->setEnabled( true );
}
else if ( ui.vcdRadioButton->isChecked() )
{
ui.chapterLabel->hide();
ui.chapterSpin->hide();
ui.diskOptionBox_2->show();
+ ui.dvdsimple->setEnabled( false );
}
else /* CDDA */
{
ui.chapterLabel->hide();
ui.chapterSpin->hide();
ui.diskOptionBox_2->hide();
+ ui.dvdsimple->setEnabled( false );
}
updateMRL();
void DiscOpenPanel::browseDevice()
{
QString dir = QFileDialog::getExistingDirectory( 0,
- qtr("Open a device or a VIDEO_TS directory") );
+ qtr( I_DEVICE_TOOLTIP ) );
if (!dir.isEmpty()) {
ui.deviceCombo->setEditText( dir );
}
ui.setupUi( this );
/* CONNECTs */
- CONNECT( ui.protocolCombo, currentIndexChanged( int ),
+ CONNECT( ui.protocolCombo, activated( int ),
this, updateProtocol( int ) );
CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() );
CONNECT( ui.addressText, textChanged( QString ), this, updateMRL());
CONNECT( ui.timeShift, clicked(), this, updateMRL());
- CONNECT( ui.ipv6, clicked(), this, updateMRL());
+ ui.protocolCombo->addItem( "" );
ui.protocolCombo->addItem("HTTP", QVariant("http"));
ui.protocolCombo->addItem("HTTPS", QVariant("https"));
- ui.protocolCombo->addItem("FTP", QVariant("ftp"));
ui.protocolCombo->addItem("MMS", QVariant("mms"));
+ ui.protocolCombo->addItem("FTP", QVariant("ftp"));
ui.protocolCombo->addItem("RTSP", QVariant("rtsp"));
- ui.protocolCombo->addItem("UDP/RTP (unicast)", QVariant("udp"));
- ui.protocolCombo->addItem("UDP/RTP (multicast)", QVariant("udp"));
+ ui.protocolCombo->addItem("RTP", QVariant("rtp"));
+ ui.protocolCombo->addItem("UDP", QVariant("udp"));
+ ui.protocolCombo->addItem("RTMP", QVariant("rtmp"));
+
+ updateProtocol( ui.protocolCombo->currentIndex() );
}
NetOpenPanel::~NetOpenPanel()
{}
/* update the widgets according the type of protocol */
-void NetOpenPanel::updateProtocol( int idx ) {
+void NetOpenPanel::updateProtocol( int idx_proto ) {
QString addr = ui.addressText->text();
- QString proto = ui.protocolCombo->itemData( idx ).toString();
+ QString proto = ui.protocolCombo->itemData( idx_proto ).toString();
- ui.timeShift->setEnabled( idx >= 5 );
- ui.ipv6->setEnabled( idx == 5 );
- ui.addressText->setEnabled( idx != 5 );
- ui.portSpin->setEnabled( idx >= 5 );
+ ui.timeShift->setEnabled( idx_proto == UDP_PROTO );
+ ui.portSpin->setEnabled( idx_proto == UDP_PROTO ||
+ idx_proto == RTP_PROTO );
+
+ if( idx_proto == NO_PROTO ) return;
/* If we already have a protocol in the address, replace it */
- if( addr.contains( "://")) {
- msg_Err( p_intf, "replace");
- addr.replace( QRegExp("^.*://"), proto + "://");
+ if( addr.contains( "://"))
+ {
+ if( idx_proto != UDP_PROTO && idx_proto != RTP_PROTO )
+ addr.replace( QRegExp("^.*://@*"), proto + "://");
+ else
+ addr.replace( QRegExp("^.*://"), proto + "://@");
ui.addressText->setText( addr );
}
updateMRL();
QString mrl = "";
QString addr = ui.addressText->text();
addr = QUrl::toPercentEncoding( addr, ":/?#@!$&'()*+,;=" );
- int proto = ui.protocolCombo->currentIndex();
+ int idx_proto = ui.protocolCombo->currentIndex();
- if( addr.contains( "://") && ( proto != 5 || proto != 6 ) )
+ if( addr.contains( "://"))
{
- mrl = addr;
+ /* Match the correct item in the comboBox */
+ ui.protocolCombo->setCurrentIndex(
+ ui.protocolCombo->findData( addr.section( ':', 0, 0 ) ) );
+
+ if( idx_proto != UDP_PROTO || idx_proto != RTP_PROTO )
+ mrl = addr;
}
else
{
- switch( proto ) {
- case 0:
+ switch( idx_proto ) {
+ case HTTP_PROTO:
mrl = "http://" + addr;
emit methodChanged("http-caching");
break;
- case 1:
+ case HTTPS_PROTO:
mrl = "https://" + addr;
emit methodChanged("http-caching");
break;
- case 3:
+ case MMS_PROTO:
mrl = "mms://" + addr;
emit methodChanged("mms-caching");
break;
- case 2:
+ case FTP_PROTO:
mrl = "ftp://" + addr;
emit methodChanged("ftp-caching");
break;
- case 4: /* RTSP */
+ case RTSP_PROTO:
mrl = "rtsp://" + addr;
emit methodChanged("rtsp-caching");
break;
- case 5:
- mrl = "udp://@";
- if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() )
- {
- mrl += "[::]";
- }
- mrl += QString(":%1").arg( ui.portSpin->value() );
- emit methodChanged("udp-caching");
- break;
- case 6: /* UDP multicast */
+ case UDP_PROTO:
mrl = "udp://@";
/* Add [] to IPv6 */
if ( addr.contains(':') && !addr.contains('[') )
else mrl += addr;
mrl += QString(":%1").arg( ui.portSpin->value() );
emit methodChanged("udp-caching");
+ break;
+ case RTP_PROTO:
+ mrl = "rtp://@";
+ if ( addr.contains(':') && !addr.contains('[') )
+ mrl += "[" + addr + "]"; /* Add [] to IPv6 */
+ else
+ mrl += addr;
+ mrl += QString(":%1").arg( ui.portSpin->value() );
+ emit methodChanged("rtp-caching");
+ break;
+ case RTMP_PROTO:
+ mrl = "rtmp://" + addr;
+ emit methodChanged("rtmp-caching");
+ break;
}
}
/* Jack Main panel */
/* Channels */
- QLabel *jackChannelsLabel = new QLabel( qtr( "Channels :" ) );
+ QLabel *jackChannelsLabel = new QLabel( qtr( "Channels:" ) );
jackDevLayout->addWidget( jackChannelsLabel, 1, 0 );
jackChannels = new QSpinBox;
/* Jack Props panel */
/* Selected ports */
- QLabel *jackPortsLabel = new QLabel( qtr( "Selected ports :" ) );
+ QLabel *jackPortsLabel = new QLabel( qtr( "Selected ports:" ) );
jackPropLayout->addWidget( jackPortsLabel, 0 , 0 );
jackPortsSelected = new QLineEdit( qtr( ".*") );
jackPropLayout->addWidget( jackPortsSelected, 0, 1 );
/* Caching */
- QLabel *jackCachingLabel = new QLabel( qtr( "Input caching :" ) );
+ QLabel *jackCachingLabel = new QLabel( qtr( "Input caching:" ) );
jackPropLayout->addWidget( jackCachingLabel, 1 , 0 );
jackCaching = new QSpinBox;
setSpinBoxFreq( jackCaching );
screenDevLayout->addWidget( screenLabel, 0, 0 );
/* General connects */
- connect( ui.deviceCombo, SIGNAL( activated( int ) ),
- stackedDevLayout, SLOT( setCurrentIndex( int ) ) );
- connect( ui.deviceCombo, SIGNAL( activated( int ) ),
- stackedPropLayout, SLOT( setCurrentIndex( int ) ) );
+ CONNECT( ui.deviceCombo, activated( int ) ,
+ stackedDevLayout, setCurrentIndex( int ) );
+ CONNECT( ui.deviceCombo, activated( int ),
+ stackedPropLayout, setCurrentIndex( int ) );
CONNECT( ui.deviceCombo, activated( int ), this, updateMRL() );
CONNECT( ui.deviceCombo, activated( int ), this, updateButtons() );
/* New Adv Prop dialog */
adv = new QDialog( this );
- adv->setWindowTitle( qtr( "Advanced options..." ) );
+ adv->setWindowTitle( qtr( "Advanced Options" ) );
/* A main Layout with a Frame */
QVBoxLayout *mainLayout = new QVBoxLayout( adv );
/* Button stuffs */
QDialogButtonBox *advButtonBox = new QDialogButtonBox( adv );
- QPushButton *closeButton = new QPushButton( qtr( "Ok" ) );
+ QPushButton *closeButton = new QPushButton( qtr( "OK" ) );
QPushButton *cancelButton = new QPushButton( qtr( "Cancel" ) );
CONNECT( closeButton, clicked(), adv, accept() );
advButtonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
advButtonBox->addButton( cancelButton, QDialogButtonBox::RejectRole );
- gLayout->addWidget( advButtonBox, i_confsize + 1, 0, 1, -1 );
+ mainLayout->addWidget( advButtonBox );
/* Creation of the MRL */
if( adv->exec() )