* $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
+ * Jean-Baptiste Kempf <jb@videolan.org>
*
* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
+
+#include "qt4.hpp"
#include "components/open.hpp"
+#include <QFileDialog>
/**************************************************************************
* Open panel
***************************************************************************/
OpenPanel( _parent, _p_intf )
{
ui.setupUi( this );
+ ui.audioGroupBox->hide();
+
+ BUTTONACT( ui.extraAudioButton, toggleExtraAudio() );
+ BUTTONACT( ui.fileBrowseButton, browseFile() );
+ BUTTONACT( ui.subBrowseButton, browseFileSub() );
+ BUTTONACT( ui.audioBrowseButton, browseFileAudio() );
+ CONNECT( ui.fileInput, editTextChanged(QString ), this, updateMRL());
}
FileOpenPanel::~FileOpenPanel()
void FileOpenPanel::sendUpdate()
{}
+QStringList FileOpenPanel::browse()
+{
+ return QFileDialog::getOpenFileNames( this, qtr("Open File"), "", "" );
+}
+
+void FileOpenPanel::browseFile()
+{
+ //FIXME ! files with spaces
+ QString files = browse().join(" ");
+ ui.fileInput->setEditText( files );
+ ui.fileInput->addItem( files );
+
+ if ( ui.fileInput->count() > 8 ) ui.fileInput->removeItem(0);
+
+ updateMRL();
+}
+
+void FileOpenPanel::browseFileSub()
+{
+ ui.subInput->setEditText( browse().join(" ") );
+
+ updateSubsMRL();
+}
+
+void FileOpenPanel::browseFileAudio()
+{
+ ui.audioFileInput->setEditText( browse().join(" ") );
+}
+
+void FileOpenPanel::updateSubsMRL()
+{
+ QStringList* subsMRL = new QStringList("sub-file=");
+ subsMRL->append( ui.subInput->currentText() );
+ //FIXME !!
+ subsMRL->append( "subsdec-align=" + ui.alignSubComboBox->currentText() );
+ subsMRL->append( "sub-rel-fontsize=" + ui.sizeSubComboBox->currentText() );
+
+ subsMRL->join(" ");
+}
+
+void FileOpenPanel::updateMRL()
+{
+ QString MRL = ui.fileInput->currentText();
+
+ emit(mrlUpdated(MRL));
+}
+
QString FileOpenPanel::getUpdatedMRL()
{
return ui.fileInput->currentText();
}
+void FileOpenPanel::toggleExtraAudio()
+{
+ if (ui.audioGroupBox->isVisible())
+ {
+ ui.audioGroupBox->hide();
+ }
+ else
+ {
+ ui.audioGroupBox->show();
+ }
+}
+
+void FileOpenPanel::clear()
+{
+ ui.fileInput->setEditText( "");
+ ui.subInput->setEditText( "");
+ ui.audioFileInput->setEditText( "");
+}
+
+
+
/**************************************************************************
- * Net open
+ * Disk open
**************************************************************************/
-#if 0
-NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
+DiskOpenPanel::DiskOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
OpenPanel( _parent, _p_intf )
{
ui.setupUi( this );
}
-NetOpenPanel::~NetOpenPanel()
+DiskOpenPanel::~DiskOpenPanel()
{}
-QString NetOpenPanel::getUpdatedMRL( )
+void DiskOpenPanel::sendUpdate()
+{}
+
+QString DiskOpenPanel::getUpdatedMRL()
{
+ //return ui.DiskInput->currentText();
+ return NULL;
+}
+
+
+
+/**************************************************************************
+ * Net open
+ **************************************************************************/
+NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
+ OpenPanel( _parent, _p_intf )
+{
+ ui.setupUi( this );
}
+NetOpenPanel::~NetOpenPanel()
+{}
+
+void NetOpenPanel::sendUpdate()
+{}
+/*
void NetOpenPanel::sendUpdate()
{
QString *mrl = new QString();
QString *cache = new QString();
getUpdatedMRL( mrl, cache );,
emit dataUpdated( mrl, cache );
+}*/
+
+QString NetOpenPanel::getUpdatedMRL()
+{
+// return ui.NetInput->currentText();
+ return NULL;
}
-#endif
+