* Open Files and subtitles *
**************************************************************************/
FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
- OpenPanel( _parent, _p_intf )
+ OpenPanel( _parent, _p_intf ), dialogBox( NULL )
{
/* Classic UI Setup */
ui.setupUi( this );
-#if 0
- /** 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 = "";
+/* 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(" *"));
+ fileTypes.replace( QString(";*"), QString(" *")); */
+
+
+/* lineFileEdit = ui.fileEdit;
+ //TODO later: fill the fileCompleteList with previous items played.
+ QCompleter *fileCompleter = new QCompleter( fileCompleteList, this );
+ fileCompleter->setModel( new QDirModel( fileCompleter ) );
+ lineFileEdit->setCompleter( fileCompleter );*/
+ if( config_GetInt( p_intf, "qt-embedded-open" ) )
+ {
+ ui.tempWidget->hide();
+ BuildOldPanel();
+ }
+
+ /* Subtitles */
+ /* Deactivate the subtitles control by default. */
+ ui.subFrame->setEnabled( false );
+ /* 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.fileBrowseButton, browseFile() );
+ BUTTONACT( ui.delFileButton, deleteFile() );
+
+ BUTTONACT( ui.subBrowseButton, browseFileSub() );
+ CONNECT( ui.subCheckBox, toggled( bool ), this, toggleSubtitleFrame( bool ) );
+
+ CONNECT( ui.fileListWidg, itemChanged( QListWidgetItem * ), this, updateMRL() );
+ CONNECT( ui.subInput, textChanged( const QString& ), this, updateMRL() );
+ CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this, updateMRL() );
+ CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this, updateMRL() );
+}
+
+inline void FileOpenPanel::BuildOldPanel()
+{
+ /** 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. */
- // Make this QFileDialog a child of tempWidget from the ui.
+ /* Make this QFileDialog a child of tempWidget from the ui. */
dialogBox = new FileOpenBox( ui.tempWidget, NULL,
- qfu( p_intf->p_sys->psz_filepath ), fileTypes );
+ qfu( p_intf->p_sys->psz_filepath ), "" );
dialogBox->setFileMode( QFileDialog::ExistingFiles );
dialogBox->setAcceptMode( QFileDialog::AcceptOpen );
/* Ugly hacks to get the good Widget */
//This lineEdit is the normal line in the fileDialog.
- lineFileEdit = dialogBox->findChildren<QLineEdit*>()[0];
+ QLineEdit *lineFileEdit = dialogBox->findChildren<QLineEdit*>()[0];
/* Make a list of QLabel inside the QFileDialog to access the good ones */
QList<QLabel *> listLabel = dialogBox->findChildren<QLabel*>();
// Add the DialogBox to the layout
ui.gridLayout->addWidget( dialogBox, 0, 0, 1, 3 );
-#endif
-
-/* lineFileEdit = ui.fileEdit;
- //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->setEnabled( false );
-
- /* 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.fileBrowseButton, browseFile() );
- BUTTONACT( ui.subBrowseButton, browseFileSub() );
- CONNECT( ui.subCheckBox, toggled( bool ), this, toggleSubtitleFrame( bool ) );
-
- CONNECT( ui.fileListWidg, itemChanged( QListWidgetItem * ), this, updateMRL() );
- CONNECT( ui.subInput, textChanged( QString ), this, updateMRL() );
- CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this, updateMRL() );
- CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this, updateMRL() );
+ CONNECT( lineFileEdit, textChanged( const QString& ), this, updateMRL() );
+ dialogBox->installEventFilter( this );
}
FileOpenPanel::~FileOpenPanel()
{
-// getSettings()->setValue( "file-dialog-state", dialogBox->saveState() );
+ if( dialogBox )
+ getSettings()->setValue( "file-dialog-state", dialogBox->saveState() );
}
void FileOpenPanel::browseFile()
updateMRL();
}
+void FileOpenPanel::deleteFile()
+{
+ int i = ui.fileListWidg->currentRow();
+ if( i != -1 )
+ {
+ QListWidgetItem *temp = ui.fileListWidg->takeItem( i );
+ delete temp;
+ }
+
+ updateMRL();
+}
+
/* Show a fileBrowser to select a subtitle */
void FileOpenPanel::browseFileSub()
{
QStringList fileList;
QString mrl;
- for( int i = 0; i < ui.fileListWidg->count(); i++ )
- fileList << ui.fileListWidg->item( i )->text();
+ /* File Listing */
+ if( dialogBox == NULL )
+ for( int i = 0; i < ui.fileListWidg->count(); i++ )
+ {
+ if( !ui.fileListWidg->item( i )->text().isEmpty() )
+ fileList << ui.fileListWidg->item( i )->text();
+ }
+ else
+ fileList = dialogBox->selectedFiles();
+ /* Options */
if( ui.subCheckBox->isChecked() && !ui.subInput->text().isEmpty() ) {
- mrl.append( " :sub-file=\"" + ui.subInput->text() + "\"" );
+ mrl.append( " :sub-file=" + colon_escape( ui.subInput->text() ) );
int align = ui.alignSubComboBox->itemData(
ui.alignSubComboBox->currentIndex() ).toInt();
mrl.append( " :subsdec-align=" + QString().setNum( align ) );
b_firstcdda = true;
ui.browseDiscButton->setToolTip( qtr( I_DEVICE_TOOLTIP ));
- ui.deviceCombo->setToolTip( I_DEVICE_TOOLTIP );
+ ui.deviceCombo->setToolTip( qtr(I_DEVICE_TOOLTIP) );
#ifdef WIN32 /* Disc drives probing for Windows */
char szDrives[512];
} else {
mrl = "cdda://" + ui.deviceCombo->currentText();
if( ui.titleSpin->value() > 0 ) {
- mrl += QString("@%1").arg( ui.titleSpin->value() );
+ mrl += QString(" :cdda-track=%1").arg( ui.titleSpin->value() );
}
}
CONNECT( ui.protocolCombo, activated( int ),
this, updateProtocol( int ) );
CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() );
- CONNECT( ui.addressText, textChanged( QString ), this, updateMRL());
+ CONNECT( ui.addressText, textChanged( const QString& ), this, updateMRL());
ui.protocolCombo->addItem( "" );
ui.protocolCombo->addItem("HTTP", QVariant("http"));
{
assert( mrlList );
QStringList tempL = mrlList->stringList();
- tempL.append( ui.addressText->text() );
+ if( !tempL.contains( ui.addressText->text() ) )
+ tempL.append( ui.addressText->text() );
mrlList->setStringList( tempL );
}
/* dshow CONNECTs */
CuMRL( vdevDshowW->combo, currentIndexChanged ( int ) );
CuMRL( adevDshowW->combo, currentIndexChanged ( int ) );
- CuMRL( dshowVSizeLine, textChanged( QString ) );
+ CuMRL( dshowVSizeLine, textChanged( const QString& ) );
}
/**************
1, 0, 3, 1 );
/* v4l2 CONNECTs */
- CuMRL( v4l2VideoDevice, textChanged( QString ) );
- CuMRL( v4l2AudioDevice, textChanged( QString ) );
+ CuMRL( v4l2VideoDevice, textChanged( const QString& ) );
+ CuMRL( v4l2AudioDevice, textChanged( const QString& ) );
CuMRL( v4l2StdBox, currentIndexChanged ( int ) );
}
2, 0, 2, 1 );
/* v4l CONNECTs */
- CuMRL( v4lVideoDevice, textChanged( QString ) );
- CuMRL( v4lAudioDevice, textChanged( QString ) );
+ CuMRL( v4lVideoDevice, textChanged( const QString& ) );
+ CuMRL( v4lAudioDevice, textChanged( const QString& ) );
CuMRL( v4lFreq, valueChanged ( int ) );
CuMRL( v4lNormBox, currentIndexChanged ( int ) );
}
CuMRL( jackCaching, valueChanged( int ) );
CuMRL( jackPace, stateChanged( int ) );
CuMRL( jackConnect, stateChanged( int ) );
- CuMRL( jackPortsSelected, textChanged( QString ) );
+ CuMRL( jackPortsSelected, textChanged( const QString& ) );
}
/************
3, 0, 1, 1 );
/* PVR CONNECTs */
- CuMRL( pvrDevice, textChanged( QString ) );
- CuMRL( pvrRadioDevice, textChanged( QString ) );
+ CuMRL( pvrDevice, textChanged( const QString& ) );
+ CuMRL( pvrRadioDevice, textChanged( const QString& ) );
CuMRL( pvrFreq, valueChanged ( int ) );
CuMRL( pvrBitr, valueChanged ( int ) );
* Screen *
**********/
addModuleAndLayouts( SCREEN_DEVICE, screen, "Desktop" );
- QLabel *screenLabel = new QLabel( "This option will open your own "
- "desktop in order to save or stream it.");
+ QLabel *screenLabel = new QLabel( "Your display will will be "
+ "opened and played in order to stream or save it." );
screenLabel->setWordWrap( true );
screenDevLayout->addWidget( screenLabel, 0, 0 );
else return;
fileList << mrl; mrl = "";
- mrl += " :dvb-frequency=" + QString("%1").arg( bdaFreq->value() );
+ mrl += " :dvb-frequency=" + QString::number( bdaFreq->value() );
if( bdas->isChecked() || bdac->isChecked() )
- mrl += " :dvb-srate=" + QString("%1").arg( bdaSrate->value() );
+ mrl += " :dvb-srate=" + QString::number( bdaSrate->value() );
else if( bdat->isChecked() )
mrl += " :dvb-bandwidth=" +
- QString("%1").arg( bdaBandBox->itemData(
+ QString::number( bdaBandBox->itemData(
bdaBandBox->currentIndex() ).toInt() );
break;
case DSHOW_DEVICE:
fileList << "dshow://";
- mrl+= " :dshow-vdev=" + QString("%1").arg( vdevDshowW->getValue() );
- mrl+= " :dshow-adev=" + QString("%1").arg( adevDshowW->getValue() );
+ mrl+= " :dshow-vdev=" +
+ colon_escape( QString("%1").arg( vdevDshowW->getValue() ) );
+ mrl+= " :dshow-adev=" +
+ colon_escape( QString("%1").arg( adevDshowW->getValue() ) );
if( dshowVSizeLine->isModified() )
mrl += " :dshow-size=" + dshowVSizeLine->text();
break;
fileList << "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() );
+ mrl += " :v4l-norm=" + QString::number( v4lNormBox->currentIndex() );
+ mrl += " :v4l-frequency=" + QString::number( v4lFreq->value() );
break;
case V4L2_DEVICE:
fileList << "v4l2://";
mrl += " :v4l2-dev=" + v4l2VideoDevice->text();
mrl += " :v4l2-adev=" + v4l2AudioDevice->text();
- mrl += " :v4l2-standard=" + QString("%1").arg( v4l2StdBox->currentIndex() );
+ mrl += " :v4l2-standard=" + QString::number( v4l2StdBox->currentIndex() );
break;
case JACK_DEVICE:
mrl = "jack://";
- mrl += "channels=" + QString("%1").arg( jackChannels->value() );
+ mrl += "channels=" + QString::number( jackChannels->value() );
mrl += ":ports=" + jackPortsSelected->text();
fileList << mrl; mrl = "";
- mrl += " :jack-input-caching=" + QString("%1").arg( jackCaching->value() );
+ mrl += " :jack-input-caching=" + QString::number( jackCaching->value() );
if ( jackPace->isChecked() )
{
mrl += " :jack-input-use-vlc-pace";
fileList << "pvr://";
mrl += " :pvr-device=" + pvrDevice->text();
mrl += " :pvr-radio-device=" + pvrRadioDevice->text();
- mrl += " :pvr-norm=" + QString("%1").arg( pvrNormBox->currentIndex() );
+ mrl += " :pvr-norm=" + QString::number( pvrNormBox->currentIndex() );
if( pvrFreq->value() )
- mrl += " :pvr-frequency=" + QString("%1").arg( pvrFreq->value() );
+ mrl += " :pvr-frequency=" + QString::number( pvrFreq->value() );
if( pvrBitr->value() )
- mrl += " :pvr-bitrate=" + QString("%1").arg( pvrBitr->value() );
+ mrl += " :pvr-bitrate=" + QString::number( pvrBitr->value() );
break;
case DVB_DEVICE:
fileList << "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() );
+ mrl += " :dvb-adapter=" + QString::number( dvbCard->value() );
+ mrl += " :dvb-frequency=" + QString::number( dvbFreq->value() );
+ mrl += " :dvb-srate=" + QString::number( dvbSrate->value() );
break;
#endif
case SCREEN_DEVICE:
fileList << "screen://";
- mrl = " :screen-fps=" + QString("%1").arg( screenFPS->value() );
+ mrl = " :screen-fps=" + QString::number( screenFPS->value() );
updateButtons();
break;
}
case CONFIG_ITEM_FILE:
case CONFIG_ITEM_DIRECTORY:
case CONFIG_ITEM_MODULE:
- tempMRL += QString("=%1").arg( qobject_cast<VStringConfigControl *>(control)->getValue() );
+ tempMRL += colon_escape( QString("=%1").arg( qobject_cast<VStringConfigControl *>(control)->getValue() ) );
break;
case CONFIG_ITEM_INTEGER:
tempMRL += QString("=%1").arg( qobject_cast<VIntConfigControl *>(control)->getValue() );