#include "qt4.hpp"
#include "components/open.hpp"
#include "dialogs_provider.hpp"
+#include "util/customwidgets.hpp"
+
+#include <QFileDialog>
+#include <QDialogButtonBox>
+#include <QLineEdit>
/**************************************************************************
* File open
FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
OpenPanel( _parent, _p_intf )
{
+ /* Classic UI Setup */
ui.setupUi( this );
+ /* 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.
+ dialogBox = new QFileDialog( ui.tempWidget );
+ dialogBox->setFileMode( QFileDialog::ExistingFiles );
+ dialogBox->setDirectory( qfu( p_intf->p_libvlc->psz_homedir ) );
+ /* We don't want to see a grip in the middle of the window, do we? */
+ dialogBox->setSizeGripEnabled( false );
+
+ // Add it to the layout
+ ui.gridLayout->addWidget( dialogBox, 0, 0, 1, 3 );
+
+ // But hide the two OK/Cancel buttons. Enable them for debug.
+ findChild<QDialogButtonBox*>()->hide();
+
+ /* Ugly hacks to get the good Widget */
+ //This lineEdit is the normal line in the fileDialog.
+ lineFileEdit = findChildren<QLineEdit*>()[3];
+ lineFileEdit->hide();
+
+ /* Make a list of QLabel inside the QFileDialog to access the good ones */
+ QList<QLabel *> listLabel = findChildren<QLabel*>();
+
+ /* Hide the FileNames one. Enable it for debug */
+ listLabel[4]->hide();
+ /* Change the text that was uncool in the usual box */
+ listLabel[5]->setText( qtr( "Filter:" ) );
- BUTTONACT( ui.fileBrowseButton, browseFile() );
BUTTONACT( ui.subBrowseButton, browseFileSub() );
BUTTONACT( ui.subGroupBox, updateMRL());
CONNECT( ui.subInput, editTextChanged(QString ), this, updateMRL());
CONNECT( ui.alignSubComboBox, currentIndexChanged(int), this, updateMRL());
CONNECT( ui.sizeSubComboBox, currentIndexChanged(int), this, updateMRL());
+ CONNECT( lineFileEdit, textChanged( QString ), this, browseFile());
}
FileOpenPanel::~FileOpenPanel()
void FileOpenPanel::browseFile()
{
QString fileString = "";
- QStringList files = browse( qtr("Open File") );
- foreach( QString file, files) {
- fileString += "\"" + file + "\" ";
+ foreach( QString file, dialogBox->selectedFiles() ) {
+ fileString += "\"" + file + "\" ";
}
ui.fileInput->setEditText( fileString );
- ui.fileInput->addItem( fileString );
- if ( ui.fileInput->count() > 8 ) ui.fileInput->removeItem(0);
-
updateMRL();
}
mrl.append( " :subsdec-align=" + ui.alignSubComboBox->currentText() );
mrl.append( " :sub-rel-fontsize=" + ui.sizeSubComboBox->currentText() );
}
- emit mrlUpdated(mrl);
+ emit mrlUpdated( mrl );
emit methodChanged( "file-caching" );
}
+
+/* Function called by Open Dialog when clicke on Play/Enqueue */
+void FileOpenPanel::accept()
+{
+ ui.fileInput->addItem(ui.fileInput->currentText());
+ if ( ui.fileInput->count() > 8 ) ui.fileInput->removeItem(0);
+}
+
+
+/* Function called by Open Dialog when clicked on cancel */
void FileOpenPanel::clear()
{
- ui.fileInput->setEditText( "");
- ui.subInput->setEditText( "");
+ ui.fileInput->setEditText( "" );
+ ui.subInput->setEditText( "" );
}
#include "ui/open_net.h"
#include "ui/open_capture.h"
+class QFileDialog;
+class QLineEdit;
+
class OpenPanel: public QWidget
{
Q_OBJECT;
FileOpenPanel( QWidget *, intf_thread_t * );
virtual ~FileOpenPanel();
virtual void clear() ;
+ virtual void accept() ;
private:
Ui::OpenFile ui;
QStringList browse( QString );
+ QFileDialog *dialogBox;
+ QLineEdit *lineFileEdit;
public slots:
virtual void updateMRL();
private slots:
setModal( modal );
ui.setupUi( this );
setWindowTitle( qtr("Open" ) );
+ resize( 500, 300);
fileOpenPanel = new FileOpenPanel( this , p_intf );
diskOpenPanel = new DiskOpenPanel( this , p_intf );
<property name="spacing" >
<number>6</number>
</property>
- <item row="0" column="2" >
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>ms</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" >
- <widget class="QLabel" name="label_2" >
+ <item row="2" column="1" colspan="2" >
+ <widget class="QLineEdit" name="slaveText" >
<property name="enabled" >
<bool>false</bool>
</property>
- <property name="text" >
- <string>Extra media</string>
- </property>
</widget>
</item>
<item row="0" column="0" >
</property>
</widget>
</item>
+ <item row="0" column="2" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>ms</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="advancedLabel" >
+ <property name="text" >
+ <string>Customize</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="label_2" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>Extra media</string>
+ </property>
+ </widget>
+ </item>
<item row="0" column="1" >
<widget class="QSpinBox" name="cacheSpinBox" >
<property name="sizePolicy" >
<verstretch>0</verstretch>
</sizepolicy>
</property>
+ <property name="alignment" >
+ <set>Qt::AlignRight</set>
+ </property>
<property name="maximum" >
<number>999999</number>
</property>
</widget>
</item>
- <item row="3" column="0" >
- <widget class="QLabel" name="advancedLabel" >
+ <item row="2" column="3" >
+ <widget class="QToolButton" name="slaveBrowseButton" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
<property name="text" >
- <string>Customize</string>
+ <string>Browse</string>
</property>
</widget>
</item>
- <item row="3" column="1" colspan="2" >
+ <item row="3" column="1" colspan="3" >
<widget class="QLineEdit" name="advancedLineInput" />
</item>
- <item row="2" column="1" colspan="2" >
- <widget class="QLineEdit" name="slaveText" >
- <property name="enabled" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="0" colspan="3" >
+ <item row="1" column="0" colspan="4" >
<widget class="QCheckBox" name="slaveCheckbox" >
<property name="text" >
<string>Play another media synchronously (extra audio file, ...)</string>
</hint>
</hints>
</connection>
+ <connection>
+ <sender>slaveCheckbox</sender>
+ <signal>clicked(bool)</signal>
+ <receiver>slaveBrowseButton</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>219</x>
+ <y>102</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>386</x>
+ <y>131</y>
+ </hint>
+ </hints>
+ </connection>
</connections>
</ui>
<rect>
<x>0</x>
<y>0</y>
- <width>487</width>
- <height>254</height>
+ <width>539</width>
+ <height>246</height>
</rect>
</property>
<property name="windowTitle" >
<property name="spacing" >
<number>6</number>
</property>
- <item row="1" column="0" >
+ <item row="0" column="4" >
+ <widget class="QRadioButton" name="vcdRadioButton" >
+ <property name="text" >
+ <string>SVCD/VCD</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="5" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0" colspan="2" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Disk device</string>
</property>
</widget>
</item>
- <item row="0" column="1" >
- <widget class="QRadioButton" name="vcdRadioButton" >
+ <item row="0" column="3" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="1" colspan="2" >
+ <widget class="QRadioButton" name="dvdRadioButton" >
+ <property name="layoutDirection" >
+ <enum>Qt::LeftToRight</enum>
+ </property>
<property name="text" >
- <string>SVCD/VCD</string>
+ <string>DVD</string>
+ </property>
+ <property name="checked" >
+ <bool>true</bool>
</property>
</widget>
</item>
- <item row="1" column="1" colspan="2" >
+ <item row="2" column="2" colspan="5" >
<widget class="QComboBox" name="deviceCombo" >
<property name="editable" >
<bool>true</bool>
</property>
</widget>
</item>
- <item row="0" column="2" >
+ <item row="2" column="7" >
+ <widget class="QToolButton" name="toolButton" >
+ <property name="text" >
+ <string>Browse</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="6" >
<widget class="QRadioButton" name="audioCDRadioButton" >
<property name="text" >
<string>Audio CD</string>
</widget>
</item>
<item row="0" column="0" >
- <widget class="QRadioButton" name="dvdRadioButton" >
- <property name="text" >
- <string>DVD</string>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
</property>
- <property name="checked" >
- <bool>true</bool>
+ <property name="sizeHint" >
+ <size>
+ <width>21</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="7" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="1" colspan="6" >
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</item>
<item row="1" column="1" >
<widget class="QSpinBox" name="chapterSpin" >
+ <property name="alignment" >
+ <set>Qt::AlignRight</set>
+ </property>
<property name="suffix" >
<string/>
</property>
<property name="autoFillBackground" >
<bool>false</bool>
</property>
+ <property name="alignment" >
+ <set>Qt::AlignRight</set>
+ </property>
<property name="suffix" >
<string/>
</property>
</property>
<property name="sizeHint" >
<size>
- <width>20</width>
- <height>40</height>
+ <width>469</width>
+ <height>16</height>
</size>
</property>
</spacer>
<rect>
<x>0</x>
<y>0</y>
- <width>487</width>
- <height>181</height>
+ <width>400</width>
+ <height>210</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
- <hsizetype>3</hsizetype>
+ <hsizetype>7</hsizetype>
<vsizetype>3</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle" >
- <string>Form</string>
+ <string>Open File</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<property name="spacing" >
<number>6</number>
</property>
- <item row="2" column="1" >
+ <item row="1" column="0" >
<spacer>
<property name="orientation" >
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
- <width>20</width>
- <height>40</height>
+ <width>3</width>
+ <height>20</height>
</size>
</property>
</spacer>
</item>
- <item row="1" column="0" colspan="3" >
+ <item row="3" column="0" colspan="3" >
<widget class="QGroupBox" name="subGroupBox" >
<property name="sizePolicy" >
<sizepolicy>
</property>
<layout class="QGridLayout" >
<property name="margin" >
- <number>9</number>
+ <number>6</number>
</property>
<property name="spacing" >
- <number>6</number>
+ <number>5</number>
</property>
<item row="0" column="4" >
<widget class="QPushButton" name="subBrowseButton" >
</layout>
</widget>
</item>
- <item row="0" column="0" >
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>File</string>
- </property>
- </widget>
- </item>
- <item row="0" column="2" >
- <widget class="QPushButton" name="fileBrowseButton" >
- <property name="text" >
- <string>Browse</string>
- </property>
- </widget>
+ <item row="0" column="1" colspan="2" >
+ <widget class="QWidget" native="1" name="tempWidget" />
</item>
- <item row="0" column="1" >
+ <item row="1" column="2" >
<widget class="QComboBox" name="fileInput" >
<property name="sizePolicy" >
<sizepolicy>
</property>
</widget>
</item>
+ <item row="1" column="1" >
+ <widget class="QLabel" name="fileLabel" >
+ <property name="text" >
+ <string>File / Directory Names;</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>273</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="1" colspan="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>525</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</widget>
+ <layoutdefault spacing="0" margin="0" />
<resources/>
<connections/>
</ui>
</widget>
</item>
<item row="1" column="1" >
- <widget class="QComboBox" name="encoding" />
+ <widget class="QComboBox" name="encoding" >
+ <property name="maxVisibleItems" >
+ <number>12</number>
+ </property>
+ <property name="frame" >
+ <bool>false</bool>
+ </property>
+ </widget>
</item>
<item row="0" column="1" >
<widget class="QLineEdit" name="preferredLanguage" />