Commit e7dee28d authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - Set Filters. Regroup filter definitions.

Open Dialog: status. 
- Broken on Windows.... As usual...
- Filters are not correctly set. Why ? I don't understand...
- Alignement will not be better.
- Show/hide advanced panel and subtitles do not work correctly (none of them)
- Additional features will be for next release. There is plenty of things to do left.

/* GOSH I hate QT designer */
parent a8fd6d96
......@@ -51,6 +51,18 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
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 );
dialogBox->setToolTip( qtr( "Select one or multiple files, or a folder" ));
/* 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(" *"));
dialogBox->setFilter( fileTypes );
// Add it to the layout
ui.gridLayout->addWidget( dialogBox, 0, 0, 1, 3 );
......@@ -79,7 +91,7 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
BUTTONACT( ui.subBrowseButton, browseFileSub() );
BUTTONACT( ui.subCheckBox, updateMRL());
BUTTONACT( ui.subCheckBox, toggleSubtitleFrame());
CONNECT( ui.fileInput, editTextChanged(QString ), this, updateMRL());
CONNECT( ui.subInput, editTextChanged(QString ), this, updateMRL());
......@@ -143,7 +155,6 @@ void FileOpenPanel::clear()
bool FileOpenPanel::eventFilter(QObject *object, QEvent *event)
{
printf( "coin\n" );
if ( ( object == dialogBox ) && ( event->type() == QEvent::Hide ) )
{
event->ignore();
......@@ -154,6 +165,23 @@ bool FileOpenPanel::eventFilter(QObject *object, QEvent *event)
return QObject::eventFilter(object, event);
}
void FileOpenPanel::toggleSubtitleFrame()
{
if (ui.subFrame->isVisible())
{
ui.subFrame->hide();
// setMinimumHeight(1);
resize( sizeHint());
}
else
{
ui.subFrame->show();
}
/* Update the MRL */
updateMRL();
}
/**************************************************************************
* Disk open
**************************************************************************/
......
......@@ -74,6 +74,7 @@ public slots:
private slots:
void browseFile();
void browseFileSub();
void toggleSubtitleFrame();
};
......
......@@ -196,33 +196,20 @@ QStringList DialogsProvider::showSimpleOpen(QString help, bool all,
bool audio, bool video,
bool subs, bool pls)
{
QString fileTypes;
QString fileTypes = "";
if( all ) {
fileTypes = _("Media Files");
fileTypes += " ( ";
fileTypes += EXTENSIONS_MEDIA;
fileTypes += ");;";
ADD_FILTER_MEDIA( fileTypes );
}
if( video ) {
fileTypes += _("Video Files");
fileTypes += " ( ";
fileTypes += EXTENSIONS_VIDEO;
fileTypes += ");;";
ADD_FILTER_VIDEO( fileTypes );
}
if( audio ) {
fileTypes += _("Sound Files");
fileTypes += " ( ";
fileTypes += EXTENSIONS_AUDIO;
fileTypes += ");;";
ADD_FILTER_AUDIO( fileTypes );
}
if( pls ) {
fileTypes += _("PlayList Files");
fileTypes += " ( ";
fileTypes += EXTENSIONS_PLAYLIST;
fileTypes += ");;";
ADD_FILTER_PLAYLIST( fileTypes );
}
fileTypes += _("All Files");
fileTypes += " (*.*)";
ADD_FILTER_ALL( fileTypes );
fileTypes.replace(QString(";*"), QString(" *"));
return QFileDialog::getOpenFileNames( NULL,
help.isNull() ?
......
......@@ -33,6 +33,31 @@
#include <vlc/vlc.h>
#include <vlc_interface.h>
#define ADD_FILTER_MEDIA( string ) \
string += _("Media Files"); \
string += " ( "; \
string += EXTENSIONS_MEDIA; \
string += ");;";
#define ADD_FILTER_VIDEO( string ) \
string += _("Video Files"); \
string += " ( "; \
string += EXTENSIONS_VIDEO; \
string += ");;";
#define ADD_FILTER_AUDIO( string ) \
string += _("Audio Files"); \
string += " ( "; \
string += EXTENSIONS_AUDIO; \
string += ");;";
#define ADD_FILTER_PLAYLIST( string )\
string += _("Playlist Files"); \
string += " ( "; \
string += EXTENSIONS_PLAYLIST; \
string += ");;";
#define ADD_FILTER_ALL( string ) \
string += _("All Files"); \
string += " (*.*)";
class QEvent;
class QSignalMapper;
class QVLCMenu;
......
......@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>463</width>
<width>435</width>
<height>249</height>
</rect>
</property>
......@@ -28,6 +28,76 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="1" colspan="2" >
<widget class="QComboBox" name="fileInput" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="editable" >
<bool>true</bool>
</property>
<property name="maxVisibleItems" >
<number>7</number>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="fileLabel" >
<property name="maximumSize" >
<size>
<width>85</width>
<height>16777215</height>
</size>
</property>
<property name="text" >
<string>File Names:</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3" >
<widget class="QWidget" native="1" name="tempWidget" />
</item>
<item row="5" column="0" colspan="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>200</width>
<height>2</height>
</size>
</property>
</spacer>
</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="3" column="0" colspan="2" >
<widget class="QCheckBox" name="subCheckBox" >
<property name="text" >
<string>Use a subtitles file</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3" >
<widget class="QFrame" name="subFrame" >
<property name="sizePolicy" >
......@@ -198,86 +268,6 @@
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<widget class="QCheckBox" name="subCheckBox" >
<property name="text" >
<string>Use a subtitles file</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="1" column="1" >
<widget class="QLabel" name="fileLabel" >
<property name="text" >
<string>File / Directory Names;</string>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QComboBox" name="fileInput" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="editable" >
<bool>true</bool>
</property>
<property name="maxVisibleItems" >
<number>7</number>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>200</width>
<height>2</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1" colspan="2" >
<widget class="QWidget" native="1" name="tempWidget" />
</item>
<item row="1" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>16</width>
<height>26</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault spacing="0" margin="0" />
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment