components/preferences_widgets.moc.cpp \
components/complete_preferences.moc.cpp \
components/simple_preferences.moc.cpp \
- components/open.moc.cpp \
+ components/open_panels.moc.cpp \
components/interface_widgets.moc.cpp \
components/playlist/panels.moc.cpp \
components/playlist/selector.moc.cpp \
components/preferences_widgets.cpp \
components/complete_preferences.cpp \
components/simple_preferences.cpp \
- components/open.cpp \
+ components/open_panels.cpp \
components/interface_widgets.cpp \
components/playlist/standardpanel.cpp \
components/playlist/selector.cpp \
components/preferences_widgets.hpp \
components/complete_preferences.hpp \
components/simple_preferences.hpp \
- components/open.hpp \
+ components/open_panels.hpp \
components/interface_widgets.hpp \
components/playlist/panels.hpp \
components/playlist/selector.hpp \
* DA Control Widget !
*****************************/
ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
+ MainInterface *_p_mi,
bool b_advControls,
bool b_shiny ) :
QFrame( NULL ), p_intf( _p_i )
setupSmallButton( playlistButton );
controlLayout->addWidget( playlistButton, 3, 11, Qt::AlignBottom );
BUTTON_SET_IMG( playlistButton, "" , playlist.png, qtr( "Show playlist" ) );
+ CONNECT( playlistButton, clicked(), _p_mi, togglePlaylist() );
/** extended Settings **/
QPushButton *extSettingsButton = new QPushButton( "F" );
Q_OBJECT
public:
/* p_intf, advanced control visible or not, blingbling or not */
- ControlsWidget( intf_thread_t *, bool, bool );
+ ControlsWidget( intf_thread_t *, MainInterface*, bool, bool );
// QSize sizeHint() const;
virtual ~ControlsWidget();
+++ /dev/null
-/*****************************************************************************
- * open.cpp : Panels for the open dialogs
- ****************************************************************************
- * Copyright (C) 2006-2007 the VideoLAN team
- * Copyright (C) 2007 Société des arts technologiques
- * Copyright (C) 2007 Savoir-faire Linux
- *
- * $Id$
- *
- * Authors: Clément Stenac <zorglub@videolan.org>
- * Jean-Baptiste Kempf <jb@videolan.org>
- * Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-
-#include "qt4.hpp"
-#include "components/open.hpp"
-#include "dialogs/open.hpp"
-#include "dialogs_provider.hpp"
-#include "components/preferences_widgets.hpp"
-
-#include <QFileDialog>
-#include <QDialogButtonBox>
-#include <QLineEdit>
-#include <QStackedLayout>
-#include <QListView>
-#include <QCompleter>
-#include <QDirModel>
-
-/**************************************************************************
- * Open Files and subtitles *
- **************************************************************************/
-FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
- OpenPanel( _parent, _p_intf )
-{
- /* Classic UI Setup */
- ui.setupUi( this );
-
- /** BEGIN QFileDialog tweaking **/
- /* Use a QFileDialog and customize it because we don't want to
- rewrite it all. Be careful to your eyes cause there are a few hacks.
- Be very careful and test correctly when you modify this. */
-
- /* Set Filters for file selection */
- QString fileTypes = "";
- ADD_FILTER_MEDIA( fileTypes );
- ADD_FILTER_VIDEO( fileTypes );
- ADD_FILTER_AUDIO( fileTypes );
- ADD_FILTER_PLAYLIST( fileTypes );
- ADD_FILTER_ALL( fileTypes );
- fileTypes.replace( QString(";*"), QString(" *"));
-
- /* retrieve last known path used in file browsing */
- char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
- if( EMPTY_STR( psz_filepath ) )
- {
- psz_filepath = p_intf->p_libvlc->psz_homedir;
- }
-
- // Make this QFileDialog a child of tempWidget from the ui.
- dialogBox = new FileOpenBox( ui.tempWidget, NULL,
- qfu( psz_filepath ), fileTypes );
- delete psz_filepath;
-
- dialogBox->setFileMode( QFileDialog::ExistingFiles );
- dialogBox->setAcceptMode( QFileDialog::AcceptOpen );
-
- /* 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" ) );
-
- // But hide the two OK/Cancel buttons. Enable them for debug.
- QDialogButtonBox *fileDialogAcceptBox =
- dialogBox->findChildren<QDialogButtonBox*>()[0];
- fileDialogAcceptBox->hide();
-
- /* Ugly hacks to get the good Widget */
- //This lineEdit is the normal line in the fileDialog.
-#if HAS_QT43
- lineFileEdit = dialogBox->findChildren<QLineEdit*>()[0];
-#else
- lineFileEdit = dialogBox->findChildren<QLineEdit*>()[1];
-#endif
- /* Make a list of QLabel inside the QFileDialog to access the good ones */
- QList<QLabel *> listLabel = dialogBox->findChildren<QLabel*>();
-
- /* Hide the FileNames one. Enable it for debug */
- listLabel[1]->setText( qtr( "File names:" ) );
- /* Change the text that was uncool in the usual box */
- listLabel[2]->setText( qtr( "Filter:" ) );
-
- dialogBox->layout()->setMargin( 0 );
- dialogBox->layout()->setSizeConstraint( QLayout::SetMinimumSize );
-
- /** END of QFileDialog tweaking **/
-
- // Add the DialogBox to the layout
- ui.gridLayout->addWidget( dialogBox, 0, 0, 1, 3 );
-
- //TODO later: fill the fileCompleteList with previous items played.
- QCompleter *fileCompleter = new QCompleter( fileCompleteList, this );
- fileCompleter->setModel( new QDirModel( fileCompleter ) );
- lineFileEdit->setCompleter( fileCompleter );
-
- // Hide the subtitles control by default.
- ui.subFrame->hide();
-
- /* Build the subs size combo box */
- setfillVLCConfigCombo( "freetype-rel-fontsize" , p_intf,
- ui.sizeSubComboBox );
-
- /* Build the subs align combo box */
- setfillVLCConfigCombo( "subsdec-align", p_intf, ui.alignSubComboBox );
-
- /* Connects */
- BUTTONACT( ui.subBrowseButton, browseFileSub() );
- BUTTONACT( ui.subCheckBox, toggleSubtitleFrame());
-
- CONNECT( lineFileEdit, textChanged( QString ), this, updateMRL() );
- CONNECT( ui.subInput, textChanged( QString ), this, updateMRL() );
- CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this, updateMRL() );
- CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this, updateMRL() );
-}
-
-FileOpenPanel::~FileOpenPanel(){}
-
-/* Show a fileBrowser to select a subtitle */
-void FileOpenPanel::browseFileSub()
-{
- // FIXME Handle selection of more than one subtitles file
- QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"),
- EXT_FILTER_SUBTITLE,
- dialogBox->directory().absolutePath() );
- if( files.isEmpty() ) return;
- ui.subInput->setText( files.join(" ") );
- updateMRL();
-}
-
-/* Update the current MRL */
-void FileOpenPanel::updateMRL()
-{
- QString mrl = "";
- foreach( QString file, dialogBox->selectedFiles() ) {
- mrl += "\"" + file + "\" ";
- }
-
- if( ui.subCheckBox->isChecked() ) {
- mrl.append( " :sub-file=" + ui.subInput->text() );
- int align = ui.alignSubComboBox->itemData(
- ui.alignSubComboBox->currentIndex() ).toInt();
- mrl.append( " :subsdec-align=" + QString().setNum( align ) );
- int size = ui.sizeSubComboBox->itemData(
- ui.sizeSubComboBox->currentIndex() ).toInt();
- mrl.append( " :freetype-rel-fontsize=" + QString().setNum( size ) );
- }
-
- emit mrlUpdated( mrl );
- emit methodChanged( "file-caching" );
-}
-
-/* Function called by Open Dialog when clicke on Play/Enqueue */
-void FileOpenPanel::accept()
-{
- //TODO set the completer
- const char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
- if( ( NULL == psz_filepath )
- || strcmp( psz_filepath, qtu( dialogBox->directory().absolutePath() )) )
- {
- /* set dialog box current directory as last known path */
- config_PutPsz( p_intf, "qt-filedialog-path",
- qtu( dialogBox->directory().absolutePath() ) );
- }
- delete psz_filepath;
-}
-
-void FileOpenBox::accept()
-{
- OpenDialog::getInstance( NULL, NULL )->play();
-}
-
-/* Function called by Open Dialog when clicked on cancel */
-void FileOpenPanel::clear()
-{
- lineFileEdit->clear();
- ui.subInput->clear();
-}
-
-void FileOpenPanel::toggleSubtitleFrame()
-{
- TOGGLEV( ui.subFrame );
-
- /* Update the MRL */
- updateMRL();
-}
-
-/**************************************************************************
- * Open Discs ( DVD, CD, VCD and similar devices ) *
- **************************************************************************/
-DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
- OpenPanel( _parent, _p_intf )
-{
- ui.setupUi( this );
-
- /* Get the default configuration path for the devices */
- psz_dvddiscpath = config_GetPsz( p_intf, "dvd" );
- psz_vcddiscpath = config_GetPsz( p_intf, "vcd" );
- psz_cddadiscpath = config_GetPsz( p_intf, "cd-audio" );
-
- /* State to avoid overwritting the users changes with the configuration */
- b_firstdvd = true;
- b_firstvcd = true;
- b_firstcdda = true;
-
-#if WIN32 /* Disc drives probing for Windows */
- char szDrives[512];
- szDrives[0] = '\0';
- if( GetLogicalDriveStringsA( sizeof( szDrives ) - 1, szDrives ) )
- {
- char *drive = szDrives;
- UINT oldMode = SetErrorMode( SEM_FAILCRITICALERRORS );
- while( *drive )
- {
- if( GetDriveTypeA(drive) == DRIVE_CDROM )
- ui.deviceCombo->addItem( drive );
-
- /* go to next drive */
- while( *(drive++) );
- }
- SetErrorMode(oldMode);
- }
-#else /* Use a Completer under Linux */
- QCompleter *discCompleter = new QCompleter( this );
- discCompleter->setModel( new QDirModel( discCompleter ) );
- ui.deviceCombo->setCompleter( discCompleter );
-#endif
-
- /* CONNECTs */
- BUTTONACT( ui.dvdRadioButton, updateButtons() );
- BUTTONACT( ui.vcdRadioButton, updateButtons() );
- BUTTONACT( ui.audioCDRadioButton, updateButtons() );
- BUTTONACT( ui.dvdsimple, updateButtons() );
- BUTTONACT( ui.browseDiscButton, browseDevice() );
-
- CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
- CONNECT( ui.titleSpin, valueChanged( int ), this, updateMRL());
- CONNECT( ui.chapterSpin, valueChanged( int ), this, updateMRL());
- CONNECT( ui.audioSpin, valueChanged( int ), this, updateMRL());
- CONNECT( ui.subtitlesSpin, valueChanged( int ), this, updateMRL());
-
- /* Run once the updateButtons function in order to fill correctly the comboBoxes */
- updateButtons();
-}
-
-DiscOpenPanel::~DiscOpenPanel()
-{
- delete psz_dvddiscpath;
- delete psz_vcddiscpath;
- delete psz_cddadiscpath;
-}
-
-void DiscOpenPanel::clear()
-{
- ui.titleSpin->setValue( 0 );
- ui.chapterSpin->setValue( 0 );
- b_firstcdda = true;
- b_firstdvd = true;
- b_firstvcd = true;
-}
-
-#ifdef WIN32
- #define setDrive( psz_name ) {\
- int index = ui.deviceCombo->findText( qfu( psz_name ) ); \
- if( index != -1 ) ui.deviceCombo->setCurrentIndex( index );}
-#else
- #define setDrive( psz_name ) {\
- ui.deviceCombo->setEditText( qfu( psz_name ) ); }
-#endif
-
-/* update the buttons according the type of device */
-void DiscOpenPanel::updateButtons()
-{
- if ( ui.dvdRadioButton->isChecked() )
- {
- if( b_firstdvd )
- {
- setDrive( psz_dvddiscpath );
- b_firstdvd = false;
- }
- ui.titleLabel->setText( qtr("Title") );
- ui.chapterLabel->show();
- ui.chapterSpin->show();
- ui.diskOptionBox_2->show();
- }
- else if ( ui.vcdRadioButton->isChecked() )
- {
- if( b_firstvcd )
- {
- setDrive( psz_vcddiscpath );
- b_firstvcd = false;
- }
- ui.titleLabel->setText( qtr("Entry") );
- ui.chapterLabel->hide();
- ui.chapterSpin->hide();
- ui.diskOptionBox_2->show();
- }
- else /* CDDA */
- {
- if( b_firstcdda )
- {
- setDrive( psz_cddadiscpath );
- b_firstcdda = false;
- }
- ui.titleLabel->setText( qtr("Track") );
- ui.chapterLabel->hide();
- ui.chapterSpin->hide();
- ui.diskOptionBox_2->hide();
- }
-
- updateMRL();
-}
-
-/* Update the current MRL */
-void DiscOpenPanel::updateMRL()
-{
- QString mrl = "";
-
- /* CDDAX and VCDX not implemented. FIXME ? */
- /* DVD */
- if( ui.dvdRadioButton->isChecked() ) {
- if( !ui.dvdsimple->isChecked() )
- mrl = "dvd://";
- else
- mrl = "dvdsimple://";
- mrl += ui.deviceCombo->currentText();
- emit methodChanged( "dvdnav-caching" );
-
- if ( ui.titleSpin->value() > 0 ) {
- mrl += QString("@%1").arg( ui.titleSpin->value() );
- if ( ui.chapterSpin->value() > 0 ) {
- mrl+= QString(":%1").arg( ui.chapterSpin->value() );
- }
- }
-
- /* VCD */
- } else if ( ui.vcdRadioButton->isChecked() ) {
- mrl = "vcd://" + ui.deviceCombo->currentText();
- emit methodChanged( "vcd-caching" );
-
- if( ui.titleSpin->value() > 0 ) {
- mrl += QString("@E%1").arg( ui.titleSpin->value() );
- }
-
- /* CDDA */
- } else {
- mrl = "cdda://" + ui.deviceCombo->currentText();
- if( ui.titleSpin->value() > 0 ) {
- QString("@%1").arg( ui.titleSpin->value() );
- }
- }
-
- if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() )
- {
- if ( ui.audioSpin->value() >= 0 ) {
- mrl += " :audio-track=" +
- QString("%1").arg( ui.audioSpin->value() );
- }
- if ( ui.subtitlesSpin->value() >= 0 ) {
- mrl += " :sub-track=" +
- QString("%1").arg( ui.subtitlesSpin->value() );
- }
- }
- emit mrlUpdated( mrl );
-}
-
-void DiscOpenPanel::browseDevice()
-{
- QString dir = QFileDialog::getExistingDirectory( 0,
- qtr("Open a device or a VIDEO_TS directory") );
- if (!dir.isEmpty()) {
- ui.deviceCombo->setEditText( dir );
- }
- updateMRL();
-}
-
-void DiscOpenPanel::accept()
-{}
-
-/**************************************************************************
- * Open Network streams and URL pages *
- **************************************************************************/
-NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
- OpenPanel( _parent, _p_intf )
-{
- ui.setupUi( this );
-
- /* CONNECTs */
- CONNECT( ui.protocolCombo, currentIndexChanged( 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("HTTP", QVariant("http"));
- ui.protocolCombo->addItem("HTTPS", QVariant("https"));
- ui.protocolCombo->addItem("FTP", QVariant("ftp"));
- ui.protocolCombo->addItem("MMS", QVariant("mms"));
- ui.protocolCombo->addItem("RTSP", QVariant("rtsp"));
- ui.protocolCombo->addItem("UDP/RTP (unicast)", QVariant("udp"));
- ui.protocolCombo->addItem("UDP/RTP (multicast)", QVariant("udp"));
-}
-
-NetOpenPanel::~NetOpenPanel()
-{}
-
-void NetOpenPanel::clear()
-{}
-
-/* update the widgets according the type of protocol */
-void NetOpenPanel::updateProtocol( int idx ) {
- QString addr = ui.addressText->text();
- QString proto = ui.protocolCombo->itemData( idx ).toString();
-
- ui.timeShift->setEnabled( idx >= 5 );
- ui.ipv6->setEnabled( idx == 5 );
- ui.addressText->setEnabled( idx != 5 );
- ui.portSpin->setEnabled( idx >= 5 );
-
- /* If we already have a protocol in the address, replace it */
- if( addr.contains( "://")) {
- msg_Err( p_intf, "replace");
- addr.replace( QRegExp("^.*://"), proto + "://");
- ui.addressText->setText( addr );
- }
- updateMRL();
-}
-
-void NetOpenPanel::updateMRL() {
- QString mrl = "";
- QString addr = ui.addressText->text();
- int proto = ui.protocolCombo->currentIndex();
-
- if( addr.contains( "://") && proto != 5 ) {
- mrl = addr;
- } else {
- switch( proto ) {
- case 0:
- mrl = "http://" + addr;
- emit methodChanged("http-caching");
- break;
- case 1:
- mrl = "https://" + addr;
- emit methodChanged("http-caching");
- break;
- case 3:
- mrl = "mms://" + addr;
- emit methodChanged("mms-caching");
- break;
- case 2:
- mrl = "ftp://" + addr;
- emit methodChanged("ftp-caching");
- break;
- case 4: /* RTSP */
- 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 */
- mrl = "udp://@";
- /* Add [] to IPv6 */
- if ( addr.contains(':') && !addr.contains('[') ) {
- mrl += "[" + addr + "]";
- } else mrl += addr;
- mrl += QString(":%1").arg( ui.portSpin->value() );
- emit methodChanged("udp-caching");
- }
- }
- if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) {
- mrl += " :access-filter=timeshift";
- }
- emit mrlUpdated( mrl );
-}
-
-/**************************************************************************
- * Open Capture device ( DVB, PVR, V4L, and similar ) *
- **************************************************************************/
-CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
- OpenPanel( _parent, _p_intf )
-{
- ui.setupUi( this );
-
- /* Create two stacked layouts in the main comboBoxes */
- QStackedLayout *stackedDevLayout = new QStackedLayout;
- ui.cardBox->setLayout( stackedDevLayout );
-
- QStackedLayout *stackedPropLayout = new QStackedLayout;
- ui.optionsBox->setLayout( stackedPropLayout );
-
- /* Creation and connections of the WIdgets in the stacked layout */
-#define addModuleAndLayouts( number, name, label ) \
- QWidget * name ## DevPage = new QWidget( this ); \
- QWidget * name ## PropPage = new QWidget( this ); \
- stackedDevLayout->addWidget( name ## DevPage ); \
- stackedPropLayout->addWidget( name ## PropPage ); \
- QGridLayout * name ## DevLayout = new QGridLayout; \
- QGridLayout * name ## PropLayout = new QGridLayout; \
- name ## DevPage->setLayout( name ## DevLayout ); \
- name ## PropPage->setLayout( name ## PropLayout ); \
- ui.deviceCombo->addItem( qtr( label ), QVariant( number ) );
-
-#define CuMRL( widget, slot ) CONNECT( widget , slot , this, updateMRL() );
-
- /*******
- * V4L *
- *******/
- addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" );
-
- /* V4l Main panel */
- QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
- v4lDevLayout->addWidget( v4lVideoDeviceLabel, 0, 0 );
-
- v4lVideoDevice = new QLineEdit;
- v4lDevLayout->addWidget( v4lVideoDevice, 0, 1 );
-
- QLabel *v4lAudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
- v4lDevLayout->addWidget( v4lAudioDeviceLabel, 1, 0 );
-
- v4lAudioDevice = new QLineEdit;
- v4lDevLayout->addWidget( v4lAudioDevice, 1, 1 );
-
- /* V4l Props panel */
- QLabel *v4lNormLabel = new QLabel( qtr( "Norm" ) );
- v4lPropLayout->addWidget( v4lNormLabel, 0 , 0 );
-
- v4lNormBox = new QComboBox;
- setfillVLCConfigCombo( "v4l-norm", p_intf, v4lNormBox );
- v4lPropLayout->addWidget( v4lNormBox, 0 , 1 );
-
- QLabel *v4lFreqLabel = new QLabel( qtr( "Frequency" ) );
- v4lPropLayout->addWidget( v4lFreqLabel, 1 , 0 );
-
- v4lFreq = new QSpinBox;
- v4lFreq->setAlignment( Qt::AlignRight );
- v4lFreq->setSuffix(" kHz");
- setSpinBoxFreq( v4lFreq );
- v4lPropLayout->addWidget( v4lFreq, 1 , 1 );
- v4lPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
- 2, 0, 2, 1 );
-
- /* v4l CONNECTs */
- CuMRL( v4lVideoDevice, textChanged( QString ) );
- CuMRL( v4lAudioDevice, textChanged( QString ) );
- CuMRL( v4lFreq, valueChanged ( int ) );
- CuMRL( v4lNormBox, currentIndexChanged ( int ) );
-
- /*******
- * V4L2*
- *******/
- addModuleAndLayouts( V4L2_DEVICE, v4l2, "Video for Linux 2" );
-
- /* V4l Main panel */
- QLabel *v4l2VideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
- v4l2DevLayout->addWidget( v4l2VideoDeviceLabel, 0, 0 );
-
- v4l2VideoDevice = new QLineEdit;
- v4l2DevLayout->addWidget( v4l2VideoDevice, 0, 1 );
-
- QLabel *v4l2AudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
- v4l2DevLayout->addWidget( v4l2AudioDeviceLabel, 1, 0 );
-
- v4l2AudioDevice = new QLineEdit;
- v4l2DevLayout->addWidget( v4l2AudioDevice, 1, 1 );
-
- /* v4l2 Props panel */
- QLabel *v4l2StdLabel = new QLabel( qtr( "Standard" ) );
- v4l2PropLayout->addWidget( v4l2StdLabel, 0 , 0 );
-
- v4l2StdBox = new QComboBox;
- setfillVLCConfigCombo( "v4l2-standard", p_intf, v4l2StdBox );
- v4l2PropLayout->addWidget( v4l2StdBox, 0 , 1 );
- v4l2PropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
- 1, 0, 3, 1 );
-
- /* v4l2 CONNECTs */
- CuMRL( v4l2VideoDevice, textChanged( QString ) );
- CuMRL( v4l2AudioDevice, textChanged( QString ) );
- CuMRL( v4l2StdBox, currentIndexChanged ( int ) );
-
- /*******
- * JACK *
- *******/
- addModuleAndLayouts( JACK_DEVICE, jack, "JACK Audio Connection Kit" );
-
- /* Jack Main panel */
- /* Channels */
- QLabel *jackChannelsLabel = new QLabel( qtr( "Channels :" ) );
- jackDevLayout->addWidget( jackChannelsLabel, 1, 0 );
-
- jackChannels = new QSpinBox;
- setSpinBoxFreq( jackChannels );
- jackChannels->setMaximum(255);
- jackChannels->setValue(2);
- jackChannels->setAlignment( Qt::AlignRight );
- jackDevLayout->addWidget( jackChannels, 1, 1 );
-
- /* Jack Props panel */
-
- /* Selected ports */
- QLabel *jackPortsLabel = new QLabel( qtr( "Selected ports :" ) );
- jackPropLayout->addWidget( jackPortsLabel, 0 , 0 );
-
- jackPortsSelected = new QLineEdit( qtr( ".*") );
- jackPortsSelected->setAlignment( Qt::AlignRight );
- jackPropLayout->addWidget( jackPortsSelected, 0, 1 );
-
- /* Caching */
- QLabel *jackCachingLabel = new QLabel( qtr( "Input caching :" ) );
- jackPropLayout->addWidget( jackCachingLabel, 1 , 0 );
- jackCaching = new QSpinBox;
- setSpinBoxFreq( jackCaching );
- jackCaching->setSuffix( " ms" );
- jackCaching->setValue(1000);
- jackCaching->setAlignment( Qt::AlignRight );
- jackPropLayout->addWidget( jackCaching, 1 , 1 );
-
- /* Pace */
- jackPace = new QCheckBox(qtr( "Use VLC pace" ));
- jackPropLayout->addWidget( jackPace, 2, 1 );
-
- /* Auto Connect */
- jackConnect = new QCheckBox( qtr( "Auto connnection" ));
- jackPropLayout->addWidget( jackConnect, 3, 1 );
-
- /* Jack CONNECTs */
- CuMRL( jackChannels, valueChanged( int ) );
- CuMRL( jackCaching, valueChanged( int ) );
- CuMRL( jackPace, stateChanged( int ) );
- CuMRL( jackConnect, stateChanged( int ) );
- CuMRL( jackPortsSelected, textChanged( QString ) );
-
- /************
- * PVR *
- ************/
- addModuleAndLayouts( PVR_DEVICE, pvr, "PVR" );
-
- /* PVR Main panel */
- QLabel *pvrDeviceLabel = new QLabel( qtr( "Device name" ) );
- pvrDevLayout->addWidget( pvrDeviceLabel, 0, 0 );
-
- pvrDevice = new QLineEdit;
- pvrDevLayout->addWidget( pvrDevice, 0, 1 );
-
- QLabel *pvrRadioDeviceLabel = new QLabel( qtr( "Radio device name" ) );
- pvrDevLayout->addWidget( pvrRadioDeviceLabel, 1, 0 );
-
- pvrRadioDevice = new QLineEdit;
- pvrDevLayout->addWidget( pvrRadioDevice, 1, 1 );
-
- /* PVR props panel */
- QLabel *pvrNormLabel = new QLabel( qtr( "Norm" ) );
- pvrPropLayout->addWidget( pvrNormLabel, 0, 0 );
-
- pvrNormBox = new QComboBox;
- setfillVLCConfigCombo( "pvr-norm", p_intf, pvrNormBox );
- pvrPropLayout->addWidget( pvrNormBox, 0, 1 );
-
- QLabel *pvrFreqLabel = new QLabel( qtr( "Frequency" ) );
- pvrPropLayout->addWidget( pvrFreqLabel, 1, 0 );
-
- pvrFreq = new QSpinBox;
- pvrFreq->setAlignment( Qt::AlignRight );
- pvrFreq->setSuffix(" kHz");
- setSpinBoxFreq( pvrFreq );
- pvrPropLayout->addWidget( pvrFreq, 1, 1 );
-
- QLabel *pvrBitrLabel = new QLabel( qtr( "Bitrate" ) );
- pvrPropLayout->addWidget( pvrBitrLabel, 2, 0 );
-
- pvrBitr = new QSpinBox;
- pvrBitr->setAlignment( Qt::AlignRight );
- pvrBitr->setSuffix(" kHz");
- setSpinBoxFreq( pvrBitr );
- pvrPropLayout->addWidget( pvrBitr, 2, 1 );
- pvrPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
- 3, 0, 1, 1 );
-
- /* PVR CONNECTs */
- CuMRL( pvrDevice, textChanged( QString ) );
- CuMRL( pvrRadioDevice, textChanged( QString ) );
-
- CuMRL( pvrFreq, valueChanged ( int ) );
- CuMRL( pvrBitr, valueChanged ( int ) );
- CuMRL( pvrNormBox, currentIndexChanged ( int ) );
-
- /*********************
- * DirectShow Stuffs *
- *********************/
- addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" );
-
- /* dshow Main */
-
- QLabel *dshowVDeviceLabel = new QLabel( qtr( "Video Device Name " ) );
- dshowDevLayout->addWidget( dshowVDeviceLabel, 0, 0 );
-
- QLabel *dshowADeviceLabel = new QLabel( qtr( "Audio Device Name " ) );
- dshowDevLayout->addWidget( dshowADeviceLabel, 1, 0 );
-
- QComboBox *dshowVDevice = new QComboBox;
- dshowDevLayout->addWidget( dshowVDevice, 0, 1 );
-
- QComboBox *dshowADevice = new QComboBox;
- dshowDevLayout->addWidget( dshowADevice, 1, 1 );
-
- QPushButton *dshowVRefresh = new QPushButton( qtr( "Update List" ) );
- dshowDevLayout->addWidget( dshowVRefresh, 0, 2 );
-
- QPushButton *dshowARefresh = new QPushButton( qtr( "Update List" ) );
- dshowDevLayout->addWidget( dshowARefresh, 1, 2 );
-
- QPushButton *dshowVConfig = new QPushButton( qtr( "Configure" ) );
- dshowDevLayout->addWidget( dshowVConfig, 0, 3 );
-
- QPushButton *dshowAConfig = new QPushButton( qtr( "Configure" ) );
- dshowDevLayout->addWidget( dshowAConfig, 1, 3 );
-
- /* dshow Properties */
-
- QLabel *dshowVSizeLabel = new QLabel( qtr( "Video size" ) );
- dshowPropLayout->addWidget( dshowVSizeLabel, 0, 0 );
-
- QLineEdit *dshowVSizeLine = new QLineEdit;
- dshowPropLayout->addWidget( dshowVSizeLine, 0, 1);
- dshowPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
- 1, 0, 3, 1 );
-
- /* dshow CONNECTs */
- CuMRL( dshowVDevice, currentIndexChanged ( int ) );
- CuMRL( dshowADevice, currentIndexChanged ( int ) );
- CuMRL( dshowVSizeLine, textChanged( QString ) );
-
- /**************
- * BDA Stuffs *
- **************/
- addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" );
-
- /* bda Main */
- QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) );
-
- bdas = new QRadioButton( "DVB-S" );
- bdas->setChecked( true );
- bdac = new QRadioButton( "DVB-C" );
- bdat = new QRadioButton( "DVB-T" );
-
- bdaDevLayout->addWidget( bdaTypeLabel, 0, 0 );
- bdaDevLayout->addWidget( bdas, 0, 1 );
- bdaDevLayout->addWidget( bdac, 0, 2 );
- bdaDevLayout->addWidget( bdat, 0, 3 );
-
- /* bda Props */
- QLabel *bdaFreqLabel =
- new QLabel( qtr( "Transponder/multiplex frequency" ) );
- bdaPropLayout->addWidget( bdaFreqLabel, 0, 0 );
-
- bdaFreq = new QSpinBox;
- bdaFreq->setAlignment( Qt::AlignRight );
- bdaFreq->setSuffix(" kHz");
- bdaFreq->setSingleStep( 1000 );
- setSpinBoxFreq( bdaFreq )
- bdaPropLayout->addWidget( bdaFreq, 0, 1 );
-
- bdaSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
- bdaPropLayout->addWidget( bdaSrateLabel, 1, 0 );
-
- bdaSrate = new QSpinBox;
- bdaSrate->setAlignment( Qt::AlignRight );
- bdaSrate->setSuffix(" kHz");
- setSpinBoxFreq( bdaSrate );
- bdaPropLayout->addWidget( bdaSrate, 1, 1 );
-
- bdaBandLabel = new QLabel( qtr( "Bandwidth" ) );
- bdaPropLayout->addWidget( bdaBandLabel, 2, 0 );
-
- bdaBandBox = new QComboBox;
- setfillVLCConfigCombo( "dvb-bandwidth", p_intf, bdaBandBox );
- bdaPropLayout->addWidget( bdaBandBox, 2, 1 );
-
- bdaBandLabel->hide();
- bdaBandBox->hide();
- bdaPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
- 2, 0, 2, 1 );
-
- /* bda CONNECTs */
- CuMRL( bdaFreq, valueChanged ( int ) );
- CuMRL( bdaSrate, valueChanged ( int ) );
- CuMRL( bdaBandBox, currentIndexChanged ( int ) );
- BUTTONACT( bdas, updateButtons() );
- BUTTONACT( bdat, updateButtons() );
- BUTTONACT( bdac, updateButtons() );
- BUTTONACT( bdas, updateMRL() );
- BUTTONACT( bdat, updateMRL() );
- BUTTONACT( bdac, updateMRL() );
-
- /**************
- * DVB Stuffs *
- **************/
- addModuleAndLayouts( DVB_DEVICE, dvb, "DVB" );
-
- /* DVB Main */
- QLabel *dvbDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) );
- QLabel *dvbTypeLabel = new QLabel( qtr( "DVB Type:" ) );
-
- dvbCard = new QSpinBox;
- dvbCard->setAlignment( Qt::AlignRight );
- dvbCard->setPrefix( "/dev/dvb/adapter" );
-
- dvbDevLayout->addWidget( dvbDeviceLabel, 0, 0 );
- dvbDevLayout->addWidget( dvbCard, 0, 2, 1, 2 );
-
- dvbs = new QRadioButton( "DVB-S" );
- dvbs->setChecked( true );
- dvbc = new QRadioButton( "DVB-C" );
- dvbt = new QRadioButton( "DVB-T" );
-
- dvbDevLayout->addWidget( dvbTypeLabel, 1, 0 );
- dvbDevLayout->addWidget( dvbs, 1, 1 );
- dvbDevLayout->addWidget( dvbc, 1, 2 );
- dvbDevLayout->addWidget( dvbt, 1, 3 );
-
- /* DVB Props panel */
- QLabel *dvbFreqLabel =
- new QLabel( qtr( "Transponder/multiplex frequency" ) );
- dvbPropLayout->addWidget( dvbFreqLabel, 0, 0 );
-
- dvbFreq = new QSpinBox;
- dvbFreq->setAlignment( Qt::AlignRight );
- dvbFreq->setSuffix(" kHz");
- setSpinBoxFreq( dvbFreq );
- dvbPropLayout->addWidget( dvbFreq, 0, 1 );
-
- QLabel *dvbSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
- dvbPropLayout->addWidget( dvbSrateLabel, 1, 0 );
-
- dvbSrate = new QSpinBox;
- dvbSrate->setAlignment( Qt::AlignRight );
- dvbSrate->setSuffix(" kHz");
- setSpinBoxFreq( dvbSrate );
- dvbPropLayout->addWidget( dvbSrate, 1, 1 );
- dvbPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
- 2, 0, 2, 1 );
-
- /* DVB CONNECTs */
- CuMRL( dvbCard, valueChanged ( int ) );
- CuMRL( dvbFreq, valueChanged ( int ) );
- CuMRL( dvbSrate, valueChanged ( int ) );
-
- BUTTONACT( dvbs, updateButtons() );
- BUTTONACT( dvbt, updateButtons() );
- BUTTONACT( dvbc, updateButtons() );
-
- /**********
- * Screen *
- **********/
- addModuleAndLayouts( SCREEN_DEVICE, screen, "Desktop" );
- QLabel *screenLabel = new QLabel( "This option will open your own "
- "desktop in order to save or stream it.");
- screenLabel->setWordWrap( true );
- 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 ), this, updateMRL() );
- CONNECT( ui.deviceCombo, activated( int ), this, updateButtons() );
-
-#undef addModule
-}
-
-CaptureOpenPanel::~CaptureOpenPanel()
-{}
-
-void CaptureOpenPanel::clear()
-{}
-
-void CaptureOpenPanel::updateMRL()
-{
- QString mrl = "";
- int i_devicetype = ui.deviceCombo->itemData(
- ui.deviceCombo->currentIndex() ).toInt();
- switch( i_devicetype )
- {
- case V4L_DEVICE:
- mrl = "v4l://";
- mrl += " :v4l-vdev=" + v4lVideoDevice->text();
- mrl += " :v4l-adev=" + v4lAudioDevice->text();
- mrl += " :v4l-norm=" + QString("%1").arg( v4lNormBox->currentIndex() );
- mrl += " :v4l-frequency=" + QString("%1").arg( v4lFreq->value() );
- break;
- case V4L2_DEVICE:
- mrl = "v4l2://";
- mrl += " :v4l2-dev=" + v4l2VideoDevice->text();
- mrl += " :v4l2-adev=" + v4l2AudioDevice->text();
- mrl += " :v4l2-standard=" + QString("%1").arg( v4l2StdBox->currentIndex() );
- break;
- case JACK_DEVICE:
- mrl = "jack://";
- mrl += "channels=" + QString("%1").arg( jackChannels->value() );
- mrl += ":ports=" + jackPortsSelected->text();
- mrl += " --jack-input-caching=" + QString("%1").arg( jackCaching->value() );
- if ( jackPace->isChecked() )
- {
- mrl += " --jack-input-use-vlc-pace";
- }
- if ( jackConnect->isChecked() )
- {
- mrl += " --jack-input-auto-connect";
- }
- break;
- case PVR_DEVICE:
- mrl = "pvr://";
- mrl += " :pvr-device=" + pvrDevice->text();
- mrl += " :pvr-radio-device=" + pvrRadioDevice->text();
- mrl += " :pvr-norm=" + QString("%1").arg( pvrNormBox->currentIndex() );
- if( pvrFreq->value() )
- mrl += " :pvr-frequency=" + QString("%1").arg( pvrFreq->value() );
- if( pvrBitr->value() )
- mrl += " :pvr-bitrate=" + QString("%1").arg( pvrBitr->value() );
- break;
- case DVB_DEVICE:
- mrl = "dvb://";
- mrl += " :dvb-adapter=" + QString("%1").arg( dvbCard->value() );
- mrl += " :dvb-frequency=" + QString("%1").arg( dvbFreq->value() );
- mrl += " :dvb-srate=" + QString("%1").arg( dvbSrate->value() );
- break;
- case BDA_DEVICE:
- if( bdas->isChecked() ) mrl = "dvb-s://";
- else if( bdat->isChecked() ) mrl = "dvb-t://";
- else if( bdac->isChecked() ) mrl = "dvb-c://";
- else return;
- mrl += " :dvb-frequency=" + QString("%1").arg( bdaFreq->value() );
- if( bdas->isChecked() || bdac->isChecked() )
- mrl += " :dvb-srate=" + QString("%1").arg( bdaSrate->value() );
- else
- mrl += " :dvb-bandwidth=" +
- QString("%1").arg( bdaBandBox->itemData(
- bdaBandBox->currentIndex() ).toInt() );
- break;
- case DSHOW_DEVICE:
- break;
- case SCREEN_DEVICE:
- mrl = "screen://";
- updateButtons();
- break;
- }
- emit mrlUpdated( mrl );
-}
-
-/**
- * Update the Buttons (show/hide) for the GUI as all device type don't
- * use the same ui. elements.
- **/
-void CaptureOpenPanel::updateButtons()
-{
- /* Be sure to display the ui Elements in case they were hidden by
- * some Device Type (like Screen://) */
- ui.optionsBox->show();
- ui.advancedButton->show();
- /* Get the current Device Number */
- int i_devicetype = ui.deviceCombo->itemData(
- ui.deviceCombo->currentIndex() ).toInt();
- msg_Dbg( p_intf, "Capture Type: %i", i_devicetype );
- switch( i_devicetype )
- {
- case DVB_DEVICE:
- if( dvbs->isChecked() ) dvbFreq->setSuffix(" kHz");
- if( dvbc->isChecked() || dvbt->isChecked() ) dvbFreq->setSuffix(" Hz");
- break;
- case BDA_DEVICE:
- if( bdas->isChecked() || bdac->isChecked() )
- {
- bdaSrate->show();
- bdaSrateLabel->show();
- bdaBandBox->hide();
- bdaBandLabel->hide();
- }
- else
- {
- bdaSrate->hide();
- bdaSrateLabel->hide();
- bdaBandBox->show();
- bdaBandLabel->show();
- }
- break;
- case SCREEN_DEVICE:
- ui.optionsBox->hide();
- ui.advancedButton->hide();
- break;
- }
-}
+++ /dev/null
-/*****************************************************************************
- * open.hpp : Panels for the open dialogs
- ****************************************************************************
- * Copyright (C) 2006-2007 the VideoLAN team
- * Copyright (C) 2007 Société des arts technologiques
- * Copyright (C) 2007 Savoir-faire Linux
- * $Id$
- *
- * Authors: Clément Stenac <zorglub@videolan.org>
- * Jean-Baptiste Kempf <jb@videolan.org>
- * Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef _OPENPANELS_H_
-#define _OPENPANELS_H_
-
-#include <vlc/vlc.h>
-
-#include <QFileDialog>
-
-#include "ui/open_file.h"
-#include "ui/open_disk.h"
-#include "ui/open_net.h"
-#include "ui/open_capture.h"
-
-#ifdef HAVE_LIMITS_H
-# include <limits.h>
-#endif
-
-#define setSpinBoxFreq( spinbox ){ spinbox->setRange ( 0, INT_MAX ); \
- spinbox->setAccelerated( true ); }
-
-enum
-{
- V4L_DEVICE,
- V4L2_DEVICE,
- PVR_DEVICE,
- DVB_DEVICE,
- BDA_DEVICE,
- DSHOW_DEVICE,
- SCREEN_DEVICE,
- JACK_DEVICE
-};
-
-class QWidget;
-class QLineEdit;
-class QString;
-
-class OpenPanel: public QWidget
-{
- Q_OBJECT;
-public:
- OpenPanel( QWidget *p, intf_thread_t *_p_intf ) : QWidget( p )
- {
- p_intf = _p_intf;
- }
- virtual ~OpenPanel() {};
- virtual void clear() = 0;
-protected:
- intf_thread_t *p_intf;
-public slots:
- virtual void updateMRL() = 0;
-signals:
- void mrlUpdated( QString );
- void methodChanged( QString method );
-};
-
-class FileOpenBox: public QFileDialog
-{
- Q_OBJECT;
-public:
- FileOpenBox( QWidget *parent, const QString &caption,
- const QString &directory, const QString &filter ):
- QFileDialog( parent, caption, directory, filter ) {}
-public slots:
- void accept();
-};
-
-class FileOpenPanel: public OpenPanel
-{
- Q_OBJECT;
-public:
- FileOpenPanel( QWidget *, intf_thread_t * );
- virtual ~FileOpenPanel();
- virtual void clear() ;
- virtual void accept() ;
-private:
- Ui::OpenFile ui;
- QStringList browse( QString );
- FileOpenBox *dialogBox;
- QLineEdit *lineFileEdit;
- QStringList fileCompleteList ;
-public slots:
- virtual void updateMRL();
-private slots:
- void browseFileSub();
- void toggleSubtitleFrame();
-};
-
-class NetOpenPanel: public OpenPanel
-{
- Q_OBJECT;
-public:
- NetOpenPanel( QWidget *, intf_thread_t * );
- virtual ~NetOpenPanel();
- virtual void clear() ;
-private:
- Ui::OpenNetwork ui;
-public slots:
- virtual void updateMRL();
-private slots:
- void updateProtocol( int );
-};
-
-class DiscOpenPanel: public OpenPanel
-{
- Q_OBJECT;
-public:
- DiscOpenPanel( QWidget *, intf_thread_t * );
- virtual ~DiscOpenPanel();
- virtual void clear() ;
- virtual void accept() ;
-private:
- Ui::OpenDisk ui;
- char *psz_dvddiscpath, *psz_vcddiscpath, *psz_cddadiscpath;
- bool b_firstdvd, b_firstvcd, b_firstcdda;
-public slots:
- virtual void updateMRL() ;
-private slots:
- void browseDevice();
- void updateButtons() ;
-};
-
-
-class CaptureOpenPanel: public OpenPanel
-{
- Q_OBJECT;
-public:
- CaptureOpenPanel( QWidget *, intf_thread_t * );
- virtual ~CaptureOpenPanel();
- virtual void clear() ;
-private:
- Ui::OpenCapture ui;
- QRadioButton *dvbs, *dvbt, *dvbc;
- QRadioButton *bdas, *bdat, *bdac;
- QSpinBox *v4lFreq, *pvrFreq, *pvrBitr;
- QLineEdit *v4lVideoDevice, *v4lAudioDevice;
- QLineEdit *v4l2VideoDevice, *v4l2AudioDevice;
- QLineEdit *pvrDevice, *pvrRadioDevice;
- QComboBox *v4lNormBox, *v4l2StdBox, *pvrNormBox, *bdaBandBox;
- QSpinBox *dvbCard, *dvbFreq, *dvbSrate;
- QSpinBox *bdaCard, *bdaFreq, *bdaSrate;
- QSpinBox *jackChannels, *jackCaching;
- QCheckBox *jackPace, *jackConnect;
- QLineEdit *jackPortsSelected;
-
- QLabel *bdaSrateLabel, *bdaBandLabel;
-
-public slots:
- virtual void updateMRL();
-private slots:
- void updateButtons();
-};
-
-#endif
--- /dev/null
+/*****************************************************************************
+ * open.cpp : Panels for the open dialogs
+ ****************************************************************************
+ * Copyright (C) 2006-2007 the VideoLAN team
+ * Copyright (C) 2007 Société des arts technologiques
+ * Copyright (C) 2007 Savoir-faire Linux
+ *
+ * $Id$
+ *
+ * Authors: Clément Stenac <zorglub@videolan.org>
+ * Jean-Baptiste Kempf <jb@videolan.org>
+ * Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+
+#include "qt4.hpp"
+#include "components/open_panels.hpp"
+#include "dialogs/open.hpp"
+#include "dialogs_provider.hpp"
+#include "components/preferences_widgets.hpp"
+
+#include <QFileDialog>
+#include <QDialogButtonBox>
+#include <QLineEdit>
+#include <QStackedLayout>
+#include <QListView>
+#include <QCompleter>
+#include <QDirModel>
+
+/**************************************************************************
+ * Open Files and subtitles *
+ **************************************************************************/
+FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
+ OpenPanel( _parent, _p_intf )
+{
+ /* Classic UI Setup */
+ ui.setupUi( this );
+
+ /** BEGIN QFileDialog tweaking **/
+ /* Use a QFileDialog and customize it because we don't want to
+ rewrite it all. Be careful to your eyes cause there are a few hacks.
+ Be very careful and test correctly when you modify this. */
+
+ /* Set Filters for file selection */
+ QString fileTypes = "";
+ ADD_FILTER_MEDIA( fileTypes );
+ ADD_FILTER_VIDEO( fileTypes );
+ ADD_FILTER_AUDIO( fileTypes );
+ ADD_FILTER_PLAYLIST( fileTypes );
+ ADD_FILTER_ALL( fileTypes );
+ fileTypes.replace( QString(";*"), QString(" *"));
+
+ /* retrieve last known path used in file browsing */
+ char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
+ if( EMPTY_STR( psz_filepath ) )
+ {
+ psz_filepath = p_intf->p_libvlc->psz_homedir;
+ }
+
+ // Make this QFileDialog a child of tempWidget from the ui.
+ dialogBox = new FileOpenBox( ui.tempWidget, NULL,
+ qfu( psz_filepath ), fileTypes );
+ delete psz_filepath;
+
+ dialogBox->setFileMode( QFileDialog::ExistingFiles );
+ dialogBox->setAcceptMode( QFileDialog::AcceptOpen );
+
+ /* 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" ) );
+
+ // But hide the two OK/Cancel buttons. Enable them for debug.
+ QDialogButtonBox *fileDialogAcceptBox =
+ dialogBox->findChildren<QDialogButtonBox*>()[0];
+ fileDialogAcceptBox->hide();
+
+ /* Ugly hacks to get the good Widget */
+ //This lineEdit is the normal line in the fileDialog.
+#if HAS_QT43
+ lineFileEdit = dialogBox->findChildren<QLineEdit*>()[0];
+#else
+ lineFileEdit = dialogBox->findChildren<QLineEdit*>()[1];
+#endif
+ /* Make a list of QLabel inside the QFileDialog to access the good ones */
+ QList<QLabel *> listLabel = dialogBox->findChildren<QLabel*>();
+
+ /* Hide the FileNames one. Enable it for debug */
+ listLabel[1]->setText( qtr( "File names:" ) );
+ /* Change the text that was uncool in the usual box */
+ listLabel[2]->setText( qtr( "Filter:" ) );
+
+ dialogBox->layout()->setMargin( 0 );
+ dialogBox->layout()->setSizeConstraint( QLayout::SetMinimumSize );
+
+ /** END of QFileDialog tweaking **/
+
+ // Add the DialogBox to the layout
+ ui.gridLayout->addWidget( dialogBox, 0, 0, 1, 3 );
+
+ //TODO later: fill the fileCompleteList with previous items played.
+ QCompleter *fileCompleter = new QCompleter( fileCompleteList, this );
+ fileCompleter->setModel( new QDirModel( fileCompleter ) );
+ lineFileEdit->setCompleter( fileCompleter );
+
+ // Hide the subtitles control by default.
+ ui.subFrame->hide();
+
+ /* Build the subs size combo box */
+ setfillVLCConfigCombo( "freetype-rel-fontsize" , p_intf,
+ ui.sizeSubComboBox );
+
+ /* Build the subs align combo box */
+ setfillVLCConfigCombo( "subsdec-align", p_intf, ui.alignSubComboBox );
+
+ /* Connects */
+ BUTTONACT( ui.subBrowseButton, browseFileSub() );
+ BUTTONACT( ui.subCheckBox, toggleSubtitleFrame());
+
+ CONNECT( lineFileEdit, textChanged( QString ), this, updateMRL() );
+ CONNECT( ui.subInput, textChanged( QString ), this, updateMRL() );
+ CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this, updateMRL() );
+ CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this, updateMRL() );
+}
+
+FileOpenPanel::~FileOpenPanel(){}
+
+/* Show a fileBrowser to select a subtitle */
+void FileOpenPanel::browseFileSub()
+{
+ // FIXME Handle selection of more than one subtitles file
+ QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"),
+ EXT_FILTER_SUBTITLE,
+ dialogBox->directory().absolutePath() );
+ if( files.isEmpty() ) return;
+ ui.subInput->setText( files.join(" ") );
+ updateMRL();
+}
+
+/* Update the current MRL */
+void FileOpenPanel::updateMRL()
+{
+ QString mrl = "";
+ foreach( QString file, dialogBox->selectedFiles() ) {
+ mrl += "\"" + file + "\" ";
+ }
+
+ if( ui.subCheckBox->isChecked() ) {
+ mrl.append( " :sub-file=" + ui.subInput->text() );
+ int align = ui.alignSubComboBox->itemData(
+ ui.alignSubComboBox->currentIndex() ).toInt();
+ mrl.append( " :subsdec-align=" + QString().setNum( align ) );
+ int size = ui.sizeSubComboBox->itemData(
+ ui.sizeSubComboBox->currentIndex() ).toInt();
+ mrl.append( " :freetype-rel-fontsize=" + QString().setNum( size ) );
+ }
+
+ emit mrlUpdated( mrl );
+ emit methodChanged( "file-caching" );
+}
+
+/* Function called by Open Dialog when clicke on Play/Enqueue */
+void FileOpenPanel::accept()
+{
+ //TODO set the completer
+ const char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
+ if( ( NULL == psz_filepath )
+ || strcmp( psz_filepath, qtu( dialogBox->directory().absolutePath() )) )
+ {
+ /* set dialog box current directory as last known path */
+ config_PutPsz( p_intf, "qt-filedialog-path",
+ qtu( dialogBox->directory().absolutePath() ) );
+ }
+ delete psz_filepath;
+}
+
+void FileOpenBox::accept()
+{
+ OpenDialog::getInstance( NULL, NULL )->play();
+}
+
+/* Function called by Open Dialog when clicked on cancel */
+void FileOpenPanel::clear()
+{
+ lineFileEdit->clear();
+ ui.subInput->clear();
+}
+
+void FileOpenPanel::toggleSubtitleFrame()
+{
+ TOGGLEV( ui.subFrame );
+
+ /* Update the MRL */
+ updateMRL();
+}
+
+/**************************************************************************
+ * Open Discs ( DVD, CD, VCD and similar devices ) *
+ **************************************************************************/
+DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
+ OpenPanel( _parent, _p_intf )
+{
+ ui.setupUi( this );
+
+ /* Get the default configuration path for the devices */
+ psz_dvddiscpath = config_GetPsz( p_intf, "dvd" );
+ psz_vcddiscpath = config_GetPsz( p_intf, "vcd" );
+ psz_cddadiscpath = config_GetPsz( p_intf, "cd-audio" );
+
+ /* State to avoid overwritting the users changes with the configuration */
+ b_firstdvd = true;
+ b_firstvcd = true;
+ b_firstcdda = true;
+
+#if WIN32 /* Disc drives probing for Windows */
+ char szDrives[512];
+ szDrives[0] = '\0';
+ if( GetLogicalDriveStringsA( sizeof( szDrives ) - 1, szDrives ) )
+ {
+ char *drive = szDrives;
+ UINT oldMode = SetErrorMode( SEM_FAILCRITICALERRORS );
+ while( *drive )
+ {
+ if( GetDriveTypeA(drive) == DRIVE_CDROM )
+ ui.deviceCombo->addItem( drive );
+
+ /* go to next drive */
+ while( *(drive++) );
+ }
+ SetErrorMode(oldMode);
+ }
+#else /* Use a Completer under Linux */
+ QCompleter *discCompleter = new QCompleter( this );
+ discCompleter->setModel( new QDirModel( discCompleter ) );
+ ui.deviceCombo->setCompleter( discCompleter );
+#endif
+
+ /* CONNECTs */
+ BUTTONACT( ui.dvdRadioButton, updateButtons() );
+ BUTTONACT( ui.vcdRadioButton, updateButtons() );
+ BUTTONACT( ui.audioCDRadioButton, updateButtons() );
+ BUTTONACT( ui.dvdsimple, updateButtons() );
+ BUTTONACT( ui.browseDiscButton, browseDevice() );
+
+ CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
+ CONNECT( ui.titleSpin, valueChanged( int ), this, updateMRL());
+ CONNECT( ui.chapterSpin, valueChanged( int ), this, updateMRL());
+ CONNECT( ui.audioSpin, valueChanged( int ), this, updateMRL());
+ CONNECT( ui.subtitlesSpin, valueChanged( int ), this, updateMRL());
+
+ /* Run once the updateButtons function in order to fill correctly the comboBoxes */
+ updateButtons();
+}
+
+DiscOpenPanel::~DiscOpenPanel()
+{
+ delete psz_dvddiscpath;
+ delete psz_vcddiscpath;
+ delete psz_cddadiscpath;
+}
+
+void DiscOpenPanel::clear()
+{
+ ui.titleSpin->setValue( 0 );
+ ui.chapterSpin->setValue( 0 );
+ b_firstcdda = true;
+ b_firstdvd = true;
+ b_firstvcd = true;
+}
+
+#ifdef WIN32
+ #define setDrive( psz_name ) {\
+ int index = ui.deviceCombo->findText( qfu( psz_name ) ); \
+ if( index != -1 ) ui.deviceCombo->setCurrentIndex( index );}
+#else
+ #define setDrive( psz_name ) {\
+ ui.deviceCombo->setEditText( qfu( psz_name ) ); }
+#endif
+
+/* update the buttons according the type of device */
+void DiscOpenPanel::updateButtons()
+{
+ if ( ui.dvdRadioButton->isChecked() )
+ {
+ if( b_firstdvd )
+ {
+ setDrive( psz_dvddiscpath );
+ b_firstdvd = false;
+ }
+ ui.titleLabel->setText( qtr("Title") );
+ ui.chapterLabel->show();
+ ui.chapterSpin->show();
+ ui.diskOptionBox_2->show();
+ }
+ else if ( ui.vcdRadioButton->isChecked() )
+ {
+ if( b_firstvcd )
+ {
+ setDrive( psz_vcddiscpath );
+ b_firstvcd = false;
+ }
+ ui.titleLabel->setText( qtr("Entry") );
+ ui.chapterLabel->hide();
+ ui.chapterSpin->hide();
+ ui.diskOptionBox_2->show();
+ }
+ else /* CDDA */
+ {
+ if( b_firstcdda )
+ {
+ setDrive( psz_cddadiscpath );
+ b_firstcdda = false;
+ }
+ ui.titleLabel->setText( qtr("Track") );
+ ui.chapterLabel->hide();
+ ui.chapterSpin->hide();
+ ui.diskOptionBox_2->hide();
+ }
+
+ updateMRL();
+}
+
+/* Update the current MRL */
+void DiscOpenPanel::updateMRL()
+{
+ QString mrl = "";
+
+ /* CDDAX and VCDX not implemented. FIXME ? */
+ /* DVD */
+ if( ui.dvdRadioButton->isChecked() ) {
+ if( !ui.dvdsimple->isChecked() )
+ mrl = "dvd://";
+ else
+ mrl = "dvdsimple://";
+ mrl += ui.deviceCombo->currentText();
+ emit methodChanged( "dvdnav-caching" );
+
+ if ( ui.titleSpin->value() > 0 ) {
+ mrl += QString("@%1").arg( ui.titleSpin->value() );
+ if ( ui.chapterSpin->value() > 0 ) {
+ mrl+= QString(":%1").arg( ui.chapterSpin->value() );
+ }
+ }
+
+ /* VCD */
+ } else if ( ui.vcdRadioButton->isChecked() ) {
+ mrl = "vcd://" + ui.deviceCombo->currentText();
+ emit methodChanged( "vcd-caching" );
+
+ if( ui.titleSpin->value() > 0 ) {
+ mrl += QString("@E%1").arg( ui.titleSpin->value() );
+ }
+
+ /* CDDA */
+ } else {
+ mrl = "cdda://" + ui.deviceCombo->currentText();
+ if( ui.titleSpin->value() > 0 ) {
+ QString("@%1").arg( ui.titleSpin->value() );
+ }
+ }
+
+ if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() )
+ {
+ if ( ui.audioSpin->value() >= 0 ) {
+ mrl += " :audio-track=" +
+ QString("%1").arg( ui.audioSpin->value() );
+ }
+ if ( ui.subtitlesSpin->value() >= 0 ) {
+ mrl += " :sub-track=" +
+ QString("%1").arg( ui.subtitlesSpin->value() );
+ }
+ }
+ emit mrlUpdated( mrl );
+}
+
+void DiscOpenPanel::browseDevice()
+{
+ QString dir = QFileDialog::getExistingDirectory( 0,
+ qtr("Open a device or a VIDEO_TS directory") );
+ if (!dir.isEmpty()) {
+ ui.deviceCombo->setEditText( dir );
+ }
+ updateMRL();
+}
+
+void DiscOpenPanel::accept()
+{}
+
+/**************************************************************************
+ * Open Network streams and URL pages *
+ **************************************************************************/
+NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
+ OpenPanel( _parent, _p_intf )
+{
+ ui.setupUi( this );
+
+ /* CONNECTs */
+ CONNECT( ui.protocolCombo, currentIndexChanged( 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("HTTP", QVariant("http"));
+ ui.protocolCombo->addItem("HTTPS", QVariant("https"));
+ ui.protocolCombo->addItem("FTP", QVariant("ftp"));
+ ui.protocolCombo->addItem("MMS", QVariant("mms"));
+ ui.protocolCombo->addItem("RTSP", QVariant("rtsp"));
+ ui.protocolCombo->addItem("UDP/RTP (unicast)", QVariant("udp"));
+ ui.protocolCombo->addItem("UDP/RTP (multicast)", QVariant("udp"));
+}
+
+NetOpenPanel::~NetOpenPanel()
+{}
+
+void NetOpenPanel::clear()
+{}
+
+/* update the widgets according the type of protocol */
+void NetOpenPanel::updateProtocol( int idx ) {
+ QString addr = ui.addressText->text();
+ QString proto = ui.protocolCombo->itemData( idx ).toString();
+
+ ui.timeShift->setEnabled( idx >= 5 );
+ ui.ipv6->setEnabled( idx == 5 );
+ ui.addressText->setEnabled( idx != 5 );
+ ui.portSpin->setEnabled( idx >= 5 );
+
+ /* If we already have a protocol in the address, replace it */
+ if( addr.contains( "://")) {
+ msg_Err( p_intf, "replace");
+ addr.replace( QRegExp("^.*://"), proto + "://");
+ ui.addressText->setText( addr );
+ }
+ updateMRL();
+}
+
+void NetOpenPanel::updateMRL() {
+ QString mrl = "";
+ QString addr = ui.addressText->text();
+ int proto = ui.protocolCombo->currentIndex();
+
+ if( addr.contains( "://") && proto != 5 ) {
+ mrl = addr;
+ } else {
+ switch( proto ) {
+ case 0:
+ mrl = "http://" + addr;
+ emit methodChanged("http-caching");
+ break;
+ case 1:
+ mrl = "https://" + addr;
+ emit methodChanged("http-caching");
+ break;
+ case 3:
+ mrl = "mms://" + addr;
+ emit methodChanged("mms-caching");
+ break;
+ case 2:
+ mrl = "ftp://" + addr;
+ emit methodChanged("ftp-caching");
+ break;
+ case 4: /* RTSP */
+ 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 */
+ mrl = "udp://@";
+ /* Add [] to IPv6 */
+ if ( addr.contains(':') && !addr.contains('[') ) {
+ mrl += "[" + addr + "]";
+ } else mrl += addr;
+ mrl += QString(":%1").arg( ui.portSpin->value() );
+ emit methodChanged("udp-caching");
+ }
+ }
+ if( ui.timeShift->isEnabled() && ui.timeShift->isChecked() ) {
+ mrl += " :access-filter=timeshift";
+ }
+ emit mrlUpdated( mrl );
+}
+
+/**************************************************************************
+ * Open Capture device ( DVB, PVR, V4L, and similar ) *
+ **************************************************************************/
+CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
+ OpenPanel( _parent, _p_intf )
+{
+ ui.setupUi( this );
+
+ /* Create two stacked layouts in the main comboBoxes */
+ QStackedLayout *stackedDevLayout = new QStackedLayout;
+ ui.cardBox->setLayout( stackedDevLayout );
+
+ QStackedLayout *stackedPropLayout = new QStackedLayout;
+ ui.optionsBox->setLayout( stackedPropLayout );
+
+ /* Creation and connections of the WIdgets in the stacked layout */
+#define addModuleAndLayouts( number, name, label ) \
+ QWidget * name ## DevPage = new QWidget( this ); \
+ QWidget * name ## PropPage = new QWidget( this ); \
+ stackedDevLayout->addWidget( name ## DevPage ); \
+ stackedPropLayout->addWidget( name ## PropPage ); \
+ QGridLayout * name ## DevLayout = new QGridLayout; \
+ QGridLayout * name ## PropLayout = new QGridLayout; \
+ name ## DevPage->setLayout( name ## DevLayout ); \
+ name ## PropPage->setLayout( name ## PropLayout ); \
+ ui.deviceCombo->addItem( qtr( label ), QVariant( number ) );
+
+#define CuMRL( widget, slot ) CONNECT( widget , slot , this, updateMRL() );
+
+ /*******
+ * V4L *
+ *******/
+ addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" );
+
+ /* V4l Main panel */
+ QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
+ v4lDevLayout->addWidget( v4lVideoDeviceLabel, 0, 0 );
+
+ v4lVideoDevice = new QLineEdit;
+ v4lDevLayout->addWidget( v4lVideoDevice, 0, 1 );
+
+ QLabel *v4lAudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
+ v4lDevLayout->addWidget( v4lAudioDeviceLabel, 1, 0 );
+
+ v4lAudioDevice = new QLineEdit;
+ v4lDevLayout->addWidget( v4lAudioDevice, 1, 1 );
+
+ /* V4l Props panel */
+ QLabel *v4lNormLabel = new QLabel( qtr( "Norm" ) );
+ v4lPropLayout->addWidget( v4lNormLabel, 0 , 0 );
+
+ v4lNormBox = new QComboBox;
+ setfillVLCConfigCombo( "v4l-norm", p_intf, v4lNormBox );
+ v4lPropLayout->addWidget( v4lNormBox, 0 , 1 );
+
+ QLabel *v4lFreqLabel = new QLabel( qtr( "Frequency" ) );
+ v4lPropLayout->addWidget( v4lFreqLabel, 1 , 0 );
+
+ v4lFreq = new QSpinBox;
+ v4lFreq->setAlignment( Qt::AlignRight );
+ v4lFreq->setSuffix(" kHz");
+ setSpinBoxFreq( v4lFreq );
+ v4lPropLayout->addWidget( v4lFreq, 1 , 1 );
+ v4lPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
+ 2, 0, 2, 1 );
+
+ /* v4l CONNECTs */
+ CuMRL( v4lVideoDevice, textChanged( QString ) );
+ CuMRL( v4lAudioDevice, textChanged( QString ) );
+ CuMRL( v4lFreq, valueChanged ( int ) );
+ CuMRL( v4lNormBox, currentIndexChanged ( int ) );
+
+ /*******
+ * V4L2*
+ *******/
+ addModuleAndLayouts( V4L2_DEVICE, v4l2, "Video for Linux 2" );
+
+ /* V4l Main panel */
+ QLabel *v4l2VideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
+ v4l2DevLayout->addWidget( v4l2VideoDeviceLabel, 0, 0 );
+
+ v4l2VideoDevice = new QLineEdit;
+ v4l2DevLayout->addWidget( v4l2VideoDevice, 0, 1 );
+
+ QLabel *v4l2AudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
+ v4l2DevLayout->addWidget( v4l2AudioDeviceLabel, 1, 0 );
+
+ v4l2AudioDevice = new QLineEdit;
+ v4l2DevLayout->addWidget( v4l2AudioDevice, 1, 1 );
+
+ /* v4l2 Props panel */
+ QLabel *v4l2StdLabel = new QLabel( qtr( "Standard" ) );
+ v4l2PropLayout->addWidget( v4l2StdLabel, 0 , 0 );
+
+ v4l2StdBox = new QComboBox;
+ setfillVLCConfigCombo( "v4l2-standard", p_intf, v4l2StdBox );
+ v4l2PropLayout->addWidget( v4l2StdBox, 0 , 1 );
+ v4l2PropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
+ 1, 0, 3, 1 );
+
+ /* v4l2 CONNECTs */
+ CuMRL( v4l2VideoDevice, textChanged( QString ) );
+ CuMRL( v4l2AudioDevice, textChanged( QString ) );
+ CuMRL( v4l2StdBox, currentIndexChanged ( int ) );
+
+ /*******
+ * JACK *
+ *******/
+ addModuleAndLayouts( JACK_DEVICE, jack, "JACK Audio Connection Kit" );
+
+ /* Jack Main panel */
+ /* Channels */
+ QLabel *jackChannelsLabel = new QLabel( qtr( "Channels :" ) );
+ jackDevLayout->addWidget( jackChannelsLabel, 1, 0 );
+
+ jackChannels = new QSpinBox;
+ setSpinBoxFreq( jackChannels );
+ jackChannels->setMaximum(255);
+ jackChannels->setValue(2);
+ jackChannels->setAlignment( Qt::AlignRight );
+ jackDevLayout->addWidget( jackChannels, 1, 1 );
+
+ /* Jack Props panel */
+
+ /* Selected ports */
+ QLabel *jackPortsLabel = new QLabel( qtr( "Selected ports :" ) );
+ jackPropLayout->addWidget( jackPortsLabel, 0 , 0 );
+
+ jackPortsSelected = new QLineEdit( qtr( ".*") );
+ jackPortsSelected->setAlignment( Qt::AlignRight );
+ jackPropLayout->addWidget( jackPortsSelected, 0, 1 );
+
+ /* Caching */
+ QLabel *jackCachingLabel = new QLabel( qtr( "Input caching :" ) );
+ jackPropLayout->addWidget( jackCachingLabel, 1 , 0 );
+ jackCaching = new QSpinBox;
+ setSpinBoxFreq( jackCaching );
+ jackCaching->setSuffix( " ms" );
+ jackCaching->setValue(1000);
+ jackCaching->setAlignment( Qt::AlignRight );
+ jackPropLayout->addWidget( jackCaching, 1 , 1 );
+
+ /* Pace */
+ jackPace = new QCheckBox(qtr( "Use VLC pace" ));
+ jackPropLayout->addWidget( jackPace, 2, 1 );
+
+ /* Auto Connect */
+ jackConnect = new QCheckBox( qtr( "Auto connnection" ));
+ jackPropLayout->addWidget( jackConnect, 3, 1 );
+
+ /* Jack CONNECTs */
+ CuMRL( jackChannels, valueChanged( int ) );
+ CuMRL( jackCaching, valueChanged( int ) );
+ CuMRL( jackPace, stateChanged( int ) );
+ CuMRL( jackConnect, stateChanged( int ) );
+ CuMRL( jackPortsSelected, textChanged( QString ) );
+
+ /************
+ * PVR *
+ ************/
+ addModuleAndLayouts( PVR_DEVICE, pvr, "PVR" );
+
+ /* PVR Main panel */
+ QLabel *pvrDeviceLabel = new QLabel( qtr( "Device name" ) );
+ pvrDevLayout->addWidget( pvrDeviceLabel, 0, 0 );
+
+ pvrDevice = new QLineEdit;
+ pvrDevLayout->addWidget( pvrDevice, 0, 1 );
+
+ QLabel *pvrRadioDeviceLabel = new QLabel( qtr( "Radio device name" ) );
+ pvrDevLayout->addWidget( pvrRadioDeviceLabel, 1, 0 );
+
+ pvrRadioDevice = new QLineEdit;
+ pvrDevLayout->addWidget( pvrRadioDevice, 1, 1 );
+
+ /* PVR props panel */
+ QLabel *pvrNormLabel = new QLabel( qtr( "Norm" ) );
+ pvrPropLayout->addWidget( pvrNormLabel, 0, 0 );
+
+ pvrNormBox = new QComboBox;
+ setfillVLCConfigCombo( "pvr-norm", p_intf, pvrNormBox );
+ pvrPropLayout->addWidget( pvrNormBox, 0, 1 );
+
+ QLabel *pvrFreqLabel = new QLabel( qtr( "Frequency" ) );
+ pvrPropLayout->addWidget( pvrFreqLabel, 1, 0 );
+
+ pvrFreq = new QSpinBox;
+ pvrFreq->setAlignment( Qt::AlignRight );
+ pvrFreq->setSuffix(" kHz");
+ setSpinBoxFreq( pvrFreq );
+ pvrPropLayout->addWidget( pvrFreq, 1, 1 );
+
+ QLabel *pvrBitrLabel = new QLabel( qtr( "Bitrate" ) );
+ pvrPropLayout->addWidget( pvrBitrLabel, 2, 0 );
+
+ pvrBitr = new QSpinBox;
+ pvrBitr->setAlignment( Qt::AlignRight );
+ pvrBitr->setSuffix(" kHz");
+ setSpinBoxFreq( pvrBitr );
+ pvrPropLayout->addWidget( pvrBitr, 2, 1 );
+ pvrPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
+ 3, 0, 1, 1 );
+
+ /* PVR CONNECTs */
+ CuMRL( pvrDevice, textChanged( QString ) );
+ CuMRL( pvrRadioDevice, textChanged( QString ) );
+
+ CuMRL( pvrFreq, valueChanged ( int ) );
+ CuMRL( pvrBitr, valueChanged ( int ) );
+ CuMRL( pvrNormBox, currentIndexChanged ( int ) );
+
+ /*********************
+ * DirectShow Stuffs *
+ *********************/
+ addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" );
+
+ /* dshow Main */
+
+ QLabel *dshowVDeviceLabel = new QLabel( qtr( "Video Device Name " ) );
+ dshowDevLayout->addWidget( dshowVDeviceLabel, 0, 0 );
+
+ QLabel *dshowADeviceLabel = new QLabel( qtr( "Audio Device Name " ) );
+ dshowDevLayout->addWidget( dshowADeviceLabel, 1, 0 );
+
+ QComboBox *dshowVDevice = new QComboBox;
+ dshowDevLayout->addWidget( dshowVDevice, 0, 1 );
+
+ QComboBox *dshowADevice = new QComboBox;
+ dshowDevLayout->addWidget( dshowADevice, 1, 1 );
+
+ QPushButton *dshowVRefresh = new QPushButton( qtr( "Update List" ) );
+ dshowDevLayout->addWidget( dshowVRefresh, 0, 2 );
+
+ QPushButton *dshowARefresh = new QPushButton( qtr( "Update List" ) );
+ dshowDevLayout->addWidget( dshowARefresh, 1, 2 );
+
+ QPushButton *dshowVConfig = new QPushButton( qtr( "Configure" ) );
+ dshowDevLayout->addWidget( dshowVConfig, 0, 3 );
+
+ QPushButton *dshowAConfig = new QPushButton( qtr( "Configure" ) );
+ dshowDevLayout->addWidget( dshowAConfig, 1, 3 );
+
+ /* dshow Properties */
+
+ QLabel *dshowVSizeLabel = new QLabel( qtr( "Video size" ) );
+ dshowPropLayout->addWidget( dshowVSizeLabel, 0, 0 );
+
+ QLineEdit *dshowVSizeLine = new QLineEdit;
+ dshowPropLayout->addWidget( dshowVSizeLine, 0, 1);
+ dshowPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
+ 1, 0, 3, 1 );
+
+ /* dshow CONNECTs */
+ CuMRL( dshowVDevice, currentIndexChanged ( int ) );
+ CuMRL( dshowADevice, currentIndexChanged ( int ) );
+ CuMRL( dshowVSizeLine, textChanged( QString ) );
+
+ /**************
+ * BDA Stuffs *
+ **************/
+ addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" );
+
+ /* bda Main */
+ QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) );
+
+ bdas = new QRadioButton( "DVB-S" );
+ bdas->setChecked( true );
+ bdac = new QRadioButton( "DVB-C" );
+ bdat = new QRadioButton( "DVB-T" );
+
+ bdaDevLayout->addWidget( bdaTypeLabel, 0, 0 );
+ bdaDevLayout->addWidget( bdas, 0, 1 );
+ bdaDevLayout->addWidget( bdac, 0, 2 );
+ bdaDevLayout->addWidget( bdat, 0, 3 );
+
+ /* bda Props */
+ QLabel *bdaFreqLabel =
+ new QLabel( qtr( "Transponder/multiplex frequency" ) );
+ bdaPropLayout->addWidget( bdaFreqLabel, 0, 0 );
+
+ bdaFreq = new QSpinBox;
+ bdaFreq->setAlignment( Qt::AlignRight );
+ bdaFreq->setSuffix(" kHz");
+ bdaFreq->setSingleStep( 1000 );
+ setSpinBoxFreq( bdaFreq )
+ bdaPropLayout->addWidget( bdaFreq, 0, 1 );
+
+ bdaSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
+ bdaPropLayout->addWidget( bdaSrateLabel, 1, 0 );
+
+ bdaSrate = new QSpinBox;
+ bdaSrate->setAlignment( Qt::AlignRight );
+ bdaSrate->setSuffix(" kHz");
+ setSpinBoxFreq( bdaSrate );
+ bdaPropLayout->addWidget( bdaSrate, 1, 1 );
+
+ bdaBandLabel = new QLabel( qtr( "Bandwidth" ) );
+ bdaPropLayout->addWidget( bdaBandLabel, 2, 0 );
+
+ bdaBandBox = new QComboBox;
+ setfillVLCConfigCombo( "dvb-bandwidth", p_intf, bdaBandBox );
+ bdaPropLayout->addWidget( bdaBandBox, 2, 1 );
+
+ bdaBandLabel->hide();
+ bdaBandBox->hide();
+ bdaPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
+ 2, 0, 2, 1 );
+
+ /* bda CONNECTs */
+ CuMRL( bdaFreq, valueChanged ( int ) );
+ CuMRL( bdaSrate, valueChanged ( int ) );
+ CuMRL( bdaBandBox, currentIndexChanged ( int ) );
+ BUTTONACT( bdas, updateButtons() );
+ BUTTONACT( bdat, updateButtons() );
+ BUTTONACT( bdac, updateButtons() );
+ BUTTONACT( bdas, updateMRL() );
+ BUTTONACT( bdat, updateMRL() );
+ BUTTONACT( bdac, updateMRL() );
+
+ /**************
+ * DVB Stuffs *
+ **************/
+ addModuleAndLayouts( DVB_DEVICE, dvb, "DVB" );
+
+ /* DVB Main */
+ QLabel *dvbDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) );
+ QLabel *dvbTypeLabel = new QLabel( qtr( "DVB Type:" ) );
+
+ dvbCard = new QSpinBox;
+ dvbCard->setAlignment( Qt::AlignRight );
+ dvbCard->setPrefix( "/dev/dvb/adapter" );
+
+ dvbDevLayout->addWidget( dvbDeviceLabel, 0, 0 );
+ dvbDevLayout->addWidget( dvbCard, 0, 2, 1, 2 );
+
+ dvbs = new QRadioButton( "DVB-S" );
+ dvbs->setChecked( true );
+ dvbc = new QRadioButton( "DVB-C" );
+ dvbt = new QRadioButton( "DVB-T" );
+
+ dvbDevLayout->addWidget( dvbTypeLabel, 1, 0 );
+ dvbDevLayout->addWidget( dvbs, 1, 1 );
+ dvbDevLayout->addWidget( dvbc, 1, 2 );
+ dvbDevLayout->addWidget( dvbt, 1, 3 );
+
+ /* DVB Props panel */
+ QLabel *dvbFreqLabel =
+ new QLabel( qtr( "Transponder/multiplex frequency" ) );
+ dvbPropLayout->addWidget( dvbFreqLabel, 0, 0 );
+
+ dvbFreq = new QSpinBox;
+ dvbFreq->setAlignment( Qt::AlignRight );
+ dvbFreq->setSuffix(" kHz");
+ setSpinBoxFreq( dvbFreq );
+ dvbPropLayout->addWidget( dvbFreq, 0, 1 );
+
+ QLabel *dvbSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
+ dvbPropLayout->addWidget( dvbSrateLabel, 1, 0 );
+
+ dvbSrate = new QSpinBox;
+ dvbSrate->setAlignment( Qt::AlignRight );
+ dvbSrate->setSuffix(" kHz");
+ setSpinBoxFreq( dvbSrate );
+ dvbPropLayout->addWidget( dvbSrate, 1, 1 );
+ dvbPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
+ 2, 0, 2, 1 );
+
+ /* DVB CONNECTs */
+ CuMRL( dvbCard, valueChanged ( int ) );
+ CuMRL( dvbFreq, valueChanged ( int ) );
+ CuMRL( dvbSrate, valueChanged ( int ) );
+
+ BUTTONACT( dvbs, updateButtons() );
+ BUTTONACT( dvbt, updateButtons() );
+ BUTTONACT( dvbc, updateButtons() );
+
+ /**********
+ * Screen *
+ **********/
+ addModuleAndLayouts( SCREEN_DEVICE, screen, "Desktop" );
+ QLabel *screenLabel = new QLabel( "This option will open your own "
+ "desktop in order to save or stream it.");
+ screenLabel->setWordWrap( true );
+ 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 ), this, updateMRL() );
+ CONNECT( ui.deviceCombo, activated( int ), this, updateButtons() );
+
+#undef addModule
+}
+
+CaptureOpenPanel::~CaptureOpenPanel()
+{}
+
+void CaptureOpenPanel::clear()
+{}
+
+void CaptureOpenPanel::updateMRL()
+{
+ QString mrl = "";
+ int i_devicetype = ui.deviceCombo->itemData(
+ ui.deviceCombo->currentIndex() ).toInt();
+ switch( i_devicetype )
+ {
+ case V4L_DEVICE:
+ mrl = "v4l://";
+ mrl += " :v4l-vdev=" + v4lVideoDevice->text();
+ mrl += " :v4l-adev=" + v4lAudioDevice->text();
+ mrl += " :v4l-norm=" + QString("%1").arg( v4lNormBox->currentIndex() );
+ mrl += " :v4l-frequency=" + QString("%1").arg( v4lFreq->value() );
+ break;
+ case V4L2_DEVICE:
+ mrl = "v4l2://";
+ mrl += " :v4l2-dev=" + v4l2VideoDevice->text();
+ mrl += " :v4l2-adev=" + v4l2AudioDevice->text();
+ mrl += " :v4l2-standard=" + QString("%1").arg( v4l2StdBox->currentIndex() );
+ break;
+ case JACK_DEVICE:
+ mrl = "jack://";
+ mrl += "channels=" + QString("%1").arg( jackChannels->value() );
+ mrl += ":ports=" + jackPortsSelected->text();
+ mrl += " --jack-input-caching=" + QString("%1").arg( jackCaching->value() );
+ if ( jackPace->isChecked() )
+ {
+ mrl += " --jack-input-use-vlc-pace";
+ }
+ if ( jackConnect->isChecked() )
+ {
+ mrl += " --jack-input-auto-connect";
+ }
+ break;
+ case PVR_DEVICE:
+ mrl = "pvr://";
+ mrl += " :pvr-device=" + pvrDevice->text();
+ mrl += " :pvr-radio-device=" + pvrRadioDevice->text();
+ mrl += " :pvr-norm=" + QString("%1").arg( pvrNormBox->currentIndex() );
+ if( pvrFreq->value() )
+ mrl += " :pvr-frequency=" + QString("%1").arg( pvrFreq->value() );
+ if( pvrBitr->value() )
+ mrl += " :pvr-bitrate=" + QString("%1").arg( pvrBitr->value() );
+ break;
+ case DVB_DEVICE:
+ mrl = "dvb://";
+ mrl += " :dvb-adapter=" + QString("%1").arg( dvbCard->value() );
+ mrl += " :dvb-frequency=" + QString("%1").arg( dvbFreq->value() );
+ mrl += " :dvb-srate=" + QString("%1").arg( dvbSrate->value() );
+ break;
+ case BDA_DEVICE:
+ if( bdas->isChecked() ) mrl = "dvb-s://";
+ else if( bdat->isChecked() ) mrl = "dvb-t://";
+ else if( bdac->isChecked() ) mrl = "dvb-c://";
+ else return;
+ mrl += " :dvb-frequency=" + QString("%1").arg( bdaFreq->value() );
+ if( bdas->isChecked() || bdac->isChecked() )
+ mrl += " :dvb-srate=" + QString("%1").arg( bdaSrate->value() );
+ else
+ mrl += " :dvb-bandwidth=" +
+ QString("%1").arg( bdaBandBox->itemData(
+ bdaBandBox->currentIndex() ).toInt() );
+ break;
+ case DSHOW_DEVICE:
+ break;
+ case SCREEN_DEVICE:
+ mrl = "screen://";
+ updateButtons();
+ break;
+ }
+ emit mrlUpdated( mrl );
+}
+
+/**
+ * Update the Buttons (show/hide) for the GUI as all device type don't
+ * use the same ui. elements.
+ **/
+void CaptureOpenPanel::updateButtons()
+{
+ /* Be sure to display the ui Elements in case they were hidden by
+ * some Device Type (like Screen://) */
+ ui.optionsBox->show();
+ ui.advancedButton->show();
+ /* Get the current Device Number */
+ int i_devicetype = ui.deviceCombo->itemData(
+ ui.deviceCombo->currentIndex() ).toInt();
+ msg_Dbg( p_intf, "Capture Type: %i", i_devicetype );
+ switch( i_devicetype )
+ {
+ case DVB_DEVICE:
+ if( dvbs->isChecked() ) dvbFreq->setSuffix(" kHz");
+ if( dvbc->isChecked() || dvbt->isChecked() ) dvbFreq->setSuffix(" Hz");
+ break;
+ case BDA_DEVICE:
+ if( bdas->isChecked() || bdac->isChecked() )
+ {
+ bdaSrate->show();
+ bdaSrateLabel->show();
+ bdaBandBox->hide();
+ bdaBandLabel->hide();
+ }
+ else
+ {
+ bdaSrate->hide();
+ bdaSrateLabel->hide();
+ bdaBandBox->show();
+ bdaBandLabel->show();
+ }
+ break;
+ case SCREEN_DEVICE:
+ ui.optionsBox->hide();
+ ui.advancedButton->hide();
+ break;
+ }
+}
--- /dev/null
+/*****************************************************************************
+ * open.hpp : Panels for the open dialogs
+ ****************************************************************************
+ * Copyright (C) 2006-2007 the VideoLAN team
+ * Copyright (C) 2007 Société des arts technologiques
+ * Copyright (C) 2007 Savoir-faire Linux
+ * $Id$
+ *
+ * Authors: Clément Stenac <zorglub@videolan.org>
+ * Jean-Baptiste Kempf <jb@videolan.org>
+ * Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef _OPENPANELS_H_
+#define _OPENPANELS_H_
+
+#include <vlc/vlc.h>
+
+#include <QFileDialog>
+
+#include "ui/open_file.h"
+#include "ui/open_disk.h"
+#include "ui/open_net.h"
+#include "ui/open_capture.h"
+
+#ifdef HAVE_LIMITS_H
+# include <limits.h>
+#endif
+
+#define setSpinBoxFreq( spinbox ){ spinbox->setRange ( 0, INT_MAX ); \
+ spinbox->setAccelerated( true ); }
+
+enum
+{
+ V4L_DEVICE,
+ V4L2_DEVICE,
+ PVR_DEVICE,
+ DVB_DEVICE,
+ BDA_DEVICE,
+ DSHOW_DEVICE,
+ SCREEN_DEVICE,
+ JACK_DEVICE
+};
+
+class QWidget;
+class QLineEdit;
+class QString;
+
+class OpenPanel: public QWidget
+{
+ Q_OBJECT;
+public:
+ OpenPanel( QWidget *p, intf_thread_t *_p_intf ) : QWidget( p )
+ {
+ p_intf = _p_intf;
+ }
+ virtual ~OpenPanel() {};
+ virtual void clear() = 0;
+protected:
+ intf_thread_t *p_intf;
+public slots:
+ virtual void updateMRL() = 0;
+signals:
+ void mrlUpdated( QString );
+ void methodChanged( QString method );
+};
+
+class FileOpenBox: public QFileDialog
+{
+ Q_OBJECT;
+public:
+ FileOpenBox( QWidget *parent, const QString &caption,
+ const QString &directory, const QString &filter ):
+ QFileDialog( parent, caption, directory, filter ) {}
+public slots:
+ void accept();
+};
+
+class FileOpenPanel: public OpenPanel
+{
+ Q_OBJECT;
+public:
+ FileOpenPanel( QWidget *, intf_thread_t * );
+ virtual ~FileOpenPanel();
+ virtual void clear() ;
+ virtual void accept() ;
+private:
+ Ui::OpenFile ui;
+ QStringList browse( QString );
+ FileOpenBox *dialogBox;
+ QLineEdit *lineFileEdit;
+ QStringList fileCompleteList ;
+public slots:
+ virtual void updateMRL();
+private slots:
+ void browseFileSub();
+ void toggleSubtitleFrame();
+};
+
+class NetOpenPanel: public OpenPanel
+{
+ Q_OBJECT;
+public:
+ NetOpenPanel( QWidget *, intf_thread_t * );
+ virtual ~NetOpenPanel();
+ virtual void clear() ;
+private:
+ Ui::OpenNetwork ui;
+public slots:
+ virtual void updateMRL();
+private slots:
+ void updateProtocol( int );
+};
+
+class DiscOpenPanel: public OpenPanel
+{
+ Q_OBJECT;
+public:
+ DiscOpenPanel( QWidget *, intf_thread_t * );
+ virtual ~DiscOpenPanel();
+ virtual void clear() ;
+ virtual void accept() ;
+private:
+ Ui::OpenDisk ui;
+ char *psz_dvddiscpath, *psz_vcddiscpath, *psz_cddadiscpath;
+ bool b_firstdvd, b_firstvcd, b_firstcdda;
+public slots:
+ virtual void updateMRL() ;
+private slots:
+ void browseDevice();
+ void updateButtons() ;
+};
+
+
+class CaptureOpenPanel: public OpenPanel
+{
+ Q_OBJECT;
+public:
+ CaptureOpenPanel( QWidget *, intf_thread_t * );
+ virtual ~CaptureOpenPanel();
+ virtual void clear() ;
+private:
+ Ui::OpenCapture ui;
+ QRadioButton *dvbs, *dvbt, *dvbc;
+ QRadioButton *bdas, *bdat, *bdac;
+ QSpinBox *v4lFreq, *pvrFreq, *pvrBitr;
+ QLineEdit *v4lVideoDevice, *v4lAudioDevice;
+ QLineEdit *v4l2VideoDevice, *v4l2AudioDevice;
+ QLineEdit *pvrDevice, *pvrRadioDevice;
+ QComboBox *v4lNormBox, *v4l2StdBox, *pvrNormBox, *bdaBandBox;
+ QSpinBox *dvbCard, *dvbFreq, *dvbSrate;
+ QSpinBox *bdaCard, *bdaFreq, *bdaSrate;
+ QSpinBox *jackChannels, *jackCaching;
+ QCheckBox *jackPace, *jackConnect;
+ QLineEdit *jackPortsSelected;
+
+ QLabel *bdaSrateLabel, *bdaBandLabel;
+
+public slots:
+ virtual void updateMRL();
+private slots:
+ void updateButtons();
+};
+
+#endif
#include "input_manager.hpp"
#include "dialogs/open.hpp"
-#include "components/open.hpp"
#include <QTabWidget>
#include <QGridLayout>
#include "util/qvlcframe.hpp"
#include "dialogs_provider.hpp"
#include "ui/open.h"
-#include "components/open.hpp"
+#include "components/open_panels.hpp"
class QString;
class QToolButton;
void DialogsProvider::quit()
{
vlc_object_kill( p_intf );
+ QApplication::closeAllWindows();
QApplication::quit();
}
}
}
+//FIXME break that
void InputManager::update()
{
/// \todo Emit the signals only if it changed
{
val.i_int = 0;
var_Change( p_input, "chapter", VLC_VAR_CHOICESCOUNT, &val, NULL );
- if( val.i_int > 0 )
+ emit navigationChanged( (val.i_int > 0) ? 1 : 2 );
+ /*if( val.i_int > 0 )
{
emit navigationChanged( 1 ); // 1 = chapter, 2 = title, 0 = NO
}
else
{
emit navigationChanged( 2 );
- }
+ }*/
}
else
{
void InputManager::sliderUpdate( float new_pos )
{
- if( hasInput() )
- var_SetFloat( p_input, "position", new_pos );
+ if( hasInput() ) var_SetFloat( p_input, "position", new_pos );
}
void InputManager::togglePlayPause()
{
vlc_value_t state;
var_Get( p_input, "state", &state );
- if( state.i_int != PAUSE_S )
- {
+ state.i_int = ( ( state.i_int != PAUSE_S ) ? PAUSE_S : PLAYING_S );
+ /*{
/* A stream is being played, pause it */
- state.i_int = PAUSE_S;
+ /* state.i_int = PAUSE_S;
}
else
{
/* Stream is paused, resume it */
- state.i_int = PLAYING_S;
- }
+ /*state.i_int = PLAYING_S;
+ }*/
var_Set( p_input, "state", state );
emit statusChanged( state.i_int );
}
bool hasVideo() { return b_has_video; }
bool b_has_audio, b_has_video, b_had_audio, b_had_video;
private:
- intf_thread_t *p_intf;
+ intf_thread_t *p_intf;
input_thread_t *p_input;
- int i_old_playing_status;
- QString old_name;
- int i_rate;
+ int i_old_playing_status;
+ QString old_name;
+ int i_rate;
public slots:
void togglePlayPause();
void update(); ///< Periodic updates
InputManager *getIM() { return im; };
private:
- InputManager *im;
- intf_thread_t *p_intf;
- input_thread_t *p_input;
- static MainInputManager *instance;
MainInputManager( intf_thread_t *);
+
+ InputManager *im;
+ intf_thread_t *p_intf;
+ input_thread_t *p_input;
+ static MainInputManager *instance;
public slots:
void togglePlayPause();
void stop();
void inputChanged( input_thread_t *);
};
-
#endif
MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
{
/* Variables initialisation */
- need_components_update = false;
+ // need_components_update = false;
bgWidget = NULL; videoWidget = NULL; playlistWidget = NULL;
- embeddedPlaylistWasActive = videoIsActive = false;
+ videoIsActive = false;
input_name = "";
/**
if( config_GetInt( p_intf, "privacy-ask") )
{
QList<ConfigControl *> controls;
- privacyDialog( controls );
-
- QList<ConfigControl *>::Iterator i;
- for( i = controls.begin() ; i != controls.end() ; i++ )
+ if( privacyDialog( controls ) == QDialog::Accepted )
{
- ConfigControl *c = qobject_cast<ConfigControl *>(*i);
- c->doApply( p_intf );
- }
+ QList<ConfigControl *>::Iterator i;
+ for( i = controls.begin() ; i != controls.end() ; i++ )
+ {
+ ConfigControl *c = qobject_cast<ConfigControl *>(*i);
+ c->doApply( p_intf );
+ }
- config_PutInt( p_intf, "privacy-ask" , 0 );
- config_SaveConfigFile( p_intf, NULL );
+ config_PutInt( p_intf, "privacy-ask" , 0 );
+ config_SaveConfigFile( p_intf, NULL );
+ }
}
/**
/* Set The Video In emebedded Mode or not */
videoEmbeddedFlag = false;
- if( config_GetInt( p_intf, "embedded-video" ) )
- videoEmbeddedFlag = true;
+ if( config_GetInt( p_intf, "embedded-video" ) ) videoEmbeddedFlag = true;
+ /* Are we in the enhanced always-video mode or not ? */
alwaysVideoFlag = false;
if( videoEmbeddedFlag && config_GetInt( p_intf, "qt-always-video" ) )
alwaysVideoFlag = true;
/* Set the other interface settings */
- visualSelectorEnabled = settings->value( "visual-selector", false ).toBool();
+ //FIXME I don't like that code
+ visualSelectorEnabled = settings->value( "visual-selector", false ).toBool();
notificationEnabled = config_GetInt( p_intf, "qt-notification" )
? true : false;
/* Create a Dock to get the playlist */
dockPL = new QDockWidget( qtr("Playlist"), this );
- dockPL->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::MinimumExpanding );
+ dockPL->setSizePolicy( QSizePolicy::Preferred,
+ QSizePolicy::MinimumExpanding );
dockPL->setFeatures( QDockWidget::AllDockWidgetFeatures );
dockPL->setAllowedAreas( Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
/* Init input manager */
MainInputManager::getInstance( p_intf );
ON_TIMEOUT( updateOnTimer() );
- //ON_TIMEOUT( debug() );
+ //ON_TIMEOUT( debug() ):;
/********************
* Various CONNECTs *
// DEBUG FIXME
hide();
-
updateGeometry();
settings->endGroup();
}
void MainInterface::handleMainUi( QSettings *settings )
{
/* Create the main Widget and the mainLayout */
- QWidget *main = new QWidget( this );
- mainLayout = new QVBoxLayout( main );
+ QWidget *main = new QWidget;
setCentralWidget( main );
+ mainLayout = new QVBoxLayout( main );
/* Margins, spacing */
main->setContentsMargins( 0, 0, 0, 0 );
mainLayout->setMargin( 0 );
/* Create the CONTROLS Widget */
- bool b_shiny = config_GetInt( p_intf, "qt-blingbling" );
- controls = new ControlsWidget( p_intf,
+ /* bool b_shiny = config_GetInt( p_intf, "qt-blingbling" ); */
+ controls = new ControlsWidget( p_intf, this,
settings->value( "adv-controls", false ).toBool(),
- b_shiny );
-
- /* Configure the Controls, the playlist button doesn't trigger THEDP
- but the toggle from this MainInterface */
- BUTTONACT( controls->playlistButton, togglePlaylist() );
+ config_GetInt( p_intf, "qt-blingbling" ) );
/* Add the controls Widget to the main Widget */
- mainLayout->addWidget( controls );
+ mainLayout->insertWidget( 0, controls );
/* Create the Speed Control Widget */
speedControl = new SpeedControlWidget( p_intf );
speedControlMenu = new QMenu( this );
- QWidgetAction *widgetAction = new QWidgetAction( this );
+
+ QWidgetAction *widgetAction = new QWidgetAction( speedControl );
widgetAction->setDefaultWidget( speedControl );
speedControlMenu->addAction( widgetAction );
{
bgWidget = new BackgroundWidget( p_intf );
bgWidget->widgetSize = settings->value( "backgroundSize",
- QSize( 300, 300 ) ).toSize();
+ QSize( 300, 200 ) ).toSize();
bgWidget->resize( bgWidget->widgetSize );
bgWidget->updateGeometry();
mainLayout->insertWidget( 0, bgWidget );
updateGeometry();
}
-void MainInterface::privacyDialog( QList<ConfigControl *> controls )
+int MainInterface::privacyDialog( QList<ConfigControl *> controls )
{
QDialog *privacy = new QDialog( this );
gLayout->addWidget( ok, 2, 2 );
CONNECT( ok, clicked(), privacy, accept() );
- privacy->exec();
+ return privacy->exec();
}
//FIXME remove me at the end...
}
#if 0
-/* This is dead code and need to be removed AT THE END */
+/* FIXME This is dead code and need to be removed AT THE END */
void MainInterface::resizeEvent( QResizeEvent *e )
{
if( videoWidget )
void MainInterface::toggleTimeDisplay()
{
- b_remainingTime = ( b_remainingTime ? false : true );
+ b_remainingTime = !b_remainingTime;
+ //b_remainingTime = ( b_remainingTime ? false : true );
}
void MainInterface::setName( QString name )
speedControl->updateControls( rate );
}
+//FIXME Remove this function at the end...
void MainInterface::updateOnTimer()
{
- /* \todo Make this event-driven */
- if( intf_ShouldDie( p_intf ) )
+ /* if( intf_ShouldDie( p_intf ) )
{
QApplication::closeAllWindows();
QApplication::quit();
- }
+ }*/
#if 0
if( need_components_update )
{
*/
void MainInterface::toggleUpdateSystrayMenu()
{
+ /* If hidden, show it */
if( isHidden() )
{
show();
}
else if( isMinimized() )
{
+ /* Minimized */
showNormal();
activateWindow();
}
else
{
+ /* Visible */
#ifdef WIN32
/* check if any visible window is above vlc in the z-order,
* but ignore the ones always on top */
case QSystemTrayIcon::MiddleClick:
sysTray->showMessage( qtr( "VLC media player" ),
qtr( "Control menu for the player" ),
- QSystemTrayIcon::Information, 4000 );
+ QSystemTrayIcon::Information, 3000 );
break;
}
}
if( notificationEnabled && ( isHidden() || isMinimized() ) )
{
sysTray->showMessage( qtr( "VLC media player" ), name,
- QSystemTrayIcon::NoIcon, 4000 );
+ QSystemTrayIcon::NoIcon, 3000 );
}
}
}
switch( i_status )
{
case 0:
+ case END_S:
{
sysTray->setToolTip( qtr( "VLC media player" ) );
break;
{
hide();
vlc_object_kill( p_intf );
+ QApplication::closeAllWindows();
+ QApplication::quit();
}
/*****************************************************************************
void handleSystray();
void createSystray();
- void privacyDialog( QList<ConfigControl *> controls );
+ int privacyDialog( QList<ConfigControl *> controls );
/* Video */
VideoWidget *videoWidget;
virtual void keyPressEvent( QKeyEvent *);
virtual void wheelEvent( QWheelEvent * );
- bool embeddedPlaylistWasActive;
bool videoIsActive;
QSize savedVideoSize;