X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fqt4%2Fcomponents%2Fopen_panels.cpp;h=488d3f34275d68436fde9e773f2cad7c75037cea;hb=552b5247eea6d1c0c93407c49ce64a39af751e43;hp=3c6d8c32ea3dcee34779e34c02a6d89eb51c125b;hpb=03eee1cbefa9073fecec66102f27bacf6c632cf0;p=vlc diff --git a/modules/gui/qt4/components/open_panels.cpp b/modules/gui/qt4/components/open_panels.cpp index 3c6d8c32ea..488d3f3427 100644 --- a/modules/gui/qt4/components/open_panels.cpp +++ b/modules/gui/qt4/components/open_panels.cpp @@ -1,7 +1,7 @@ /***************************************************************************** * 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 * @@ -45,6 +45,8 @@ #include #include +#define I_DEVICE_TOOLTIP N_("Select the device or the VIDEO_TS directory") + /************************************************************************** * Open Files and subtitles * **************************************************************************/ @@ -74,8 +76,10 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : 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 ); @@ -138,6 +142,9 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : FileOpenPanel::~FileOpenPanel() { +#if HAS_QT43 + getSettings()->setValue( "file-dialog-state", dialogBox->saveState() ); +#endif } /* Show a fileBrowser to select a subtitle */ @@ -183,7 +190,7 @@ void FileOpenPanel::accept() void FileOpenBox::accept() { - OpenDialog::getInstance( NULL, NULL )->play(); + OpenDialog::getInstance( NULL, NULL, true )->selectSlots(); } /* Function called by Open Dialog when clicked on cancel */ @@ -219,6 +226,9 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : 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'; @@ -248,7 +258,8 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : 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()); @@ -262,9 +273,9 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : DiscOpenPanel::~DiscOpenPanel() { - delete psz_dvddiscpath; - delete psz_vcddiscpath; - delete psz_cddadiscpath; + free( psz_dvddiscpath ); + free( psz_vcddiscpath ); + free( psz_cddadiscpath ); } void DiscOpenPanel::clear() @@ -389,7 +400,7 @@ void DiscOpenPanel::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 ); } @@ -418,7 +429,6 @@ NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : 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")); @@ -426,9 +436,11 @@ NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : 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() @@ -442,19 +454,16 @@ void NetOpenPanel::updateProtocol( int idx_proto ) { QString addr = ui.addressText->text(); QString proto = ui.protocolCombo->itemData( idx_proto ).toString(); - ui.timeShift->setEnabled( idx_proto == UDP_PROTO || - idx_proto == UDPM_PROTO ); - ui.ipv6->setEnabled( idx_proto == UDP_PROTO ); - ui.addressText->setEnabled( idx_proto != UDP_PROTO ); + ui.timeShift->setEnabled( idx_proto == UDP_PROTO ); ui.portSpin->setEnabled( idx_proto == UDP_PROTO || - idx_proto == UDPM_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( "://")) { - if( idx_proto != UDPM_PROTO ) + if( idx_proto != UDP_PROTO && idx_proto != RTP_PROTO ) addr.replace( QRegExp("^.*://@*"), proto + "://"); else addr.replace( QRegExp("^.*://"), proto + "://@"); @@ -475,7 +484,7 @@ void NetOpenPanel::updateMRL() { ui.protocolCombo->setCurrentIndex( ui.protocolCombo->findData( addr.section( ':', 0, 0 ) ) ); - if( idx_proto != UDP_PROTO || idx_proto != UDPM_PROTO ) + if( idx_proto != UDP_PROTO || idx_proto != RTP_PROTO ) mrl = addr; } else @@ -502,15 +511,6 @@ void NetOpenPanel::updateMRL() { emit methodChanged("rtsp-caching"); break; case UDP_PROTO: - mrl = "udp://@"; - if( ui.ipv6->isEnabled() && ui.ipv6->isChecked() ) - { - mrl += "[::]"; - } - mrl += QString(":%1").arg( ui.portSpin->value() ); - emit methodChanged("udp-caching"); - break; - case UDPM_PROTO: /* UDP multicast */ mrl = "udp://@"; /* Add [] to IPv6 */ if ( addr.contains(':') && !addr.contains('[') ) @@ -521,6 +521,15 @@ void NetOpenPanel::updateMRL() { 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"); @@ -1100,7 +1109,7 @@ void CaptureOpenPanel::advancedDialog() /* 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 ); @@ -1127,7 +1136,7 @@ void CaptureOpenPanel::advancedDialog() /* 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() );