Commit 1be77d50 authored by Clément Stenac's avatar Clément Stenac

* Only allow playlist files in open playlist (Refs:#940)

* For the time being, hide simple open. Better three clicks than confusing 
  things :)
parent 952f1805
......@@ -25,8 +25,7 @@
#include "qt4.hpp"
#include "components/open.hpp"
#include <QFileDialog>
#include "dialogs_provider.hpp"
/**************************************************************************
* File open
......@@ -52,7 +51,7 @@ FileOpenPanel::~FileOpenPanel()
QStringList FileOpenPanel::browse(QString help)
{
return QFileDialog::getOpenFileNames( this, help, "", "" );
return THEDP->showSimpleOpen( help );
}
void FileOpenPanel::browseFile()
......
......@@ -38,9 +38,9 @@ OpenDialog *OpenDialog::instance = NULL;
OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal ) :
QVLCDialog( parent, _p_intf )
{
setWindowTitle( qtr("Open" ) );
setModal( modal );
ui.setupUi( this );
setWindowTitle( qtr("Open" ) );
fileOpenPanel = new FileOpenPanel(this , p_intf );
diskOpenPanel = new DiskOpenPanel(this , p_intf );
netOpenPanel = new NetOpenPanel(this , p_intf );
......
......@@ -161,6 +161,10 @@ void DialogsProvider::openDialog()
{
openDialog( 0 );
}
void DialogsProvider::openFileDialog()
{
openDialog( 0 );
}
void DialogsProvider::openDiscDialog()
{
openDialog( 1 );
......@@ -184,30 +188,43 @@ void DialogsProvider::MLAppendDialog()
/**** Simple open ****/
QStringList DialogsProvider::showSimpleOpen()
{
QString FileTypes;
FileTypes = _("Media Files");
FileTypes += " ( ";
FileTypes += EXTENSIONS_MEDIA;
FileTypes += ");;";
FileTypes += _("Video Files");
FileTypes += " ( ";
FileTypes += EXTENSIONS_VIDEO;
FileTypes += ");;";
FileTypes += _("Sound Files");
FileTypes += " ( ";
FileTypes += EXTENSIONS_AUDIO;
FileTypes += ");;";
FileTypes += _("PlayList Files");
FileTypes += " ( ";
FileTypes += EXTENSIONS_PLAYLIST;
FileTypes += ");;";
FileTypes += _("All Files");
FileTypes += " (*.*)";
FileTypes.replace(QString(";*"), QString(" *"));
return QFileDialog::getOpenFileNames( NULL, qfu(I_OP_SEL_FILES ),
p_intf->p_libvlc->psz_homedir, FileTypes );
QStringList DialogsProvider::showSimpleOpen(QString help, bool all,
bool audio, bool video,
bool subs, bool pls)
{
QString fileTypes;
if( all ) {
fileTypes = _("Media Files");
fileTypes += " ( ";
fileTypes += EXTENSIONS_MEDIA;
fileTypes += ");;";
}
if( video ) {
fileTypes += _("Video Files");
fileTypes += " ( ";
fileTypes += EXTENSIONS_VIDEO;
fileTypes += ");;";
}
if( audio ) {
fileTypes += _("Sound Files");
fileTypes += " ( ";
fileTypes += EXTENSIONS_AUDIO;
fileTypes += ");;";
}
if( pls ) {
fileTypes += _("PlayList Files");
fileTypes += " ( ";
fileTypes += EXTENSIONS_PLAYLIST;
fileTypes += ");;";
}
fileTypes += _("All Files");
fileTypes += " (*.*)";
fileTypes.replace(QString(";*"), QString(" *"));
return QFileDialog::getOpenFileNames( NULL,
help.isNull() ?
qfu(I_OP_SEL_FILES ) : help,
p_intf->p_libvlc->psz_homedir,
fileTypes );
}
void DialogsProvider::addFromSimple( bool pl, bool go)
......@@ -244,7 +261,8 @@ void DialogsProvider::simpleOpenDialog()
void DialogsProvider::openPlaylist()
{
QStringList files = showSimpleOpen();
QStringList files = showSimpleOpen( qtr( "Open playlist file" ), false,
false, false, false );
foreach( QString file, files )
{
playlist_Import( THEPL, qtu(file) );
......
......@@ -59,6 +59,10 @@ public:
}
virtual ~DialogsProvider();
QTimer *fixed_timer;
QStringList showSimpleOpen( QString help = QString(), bool all = true,
bool video = true, bool audio = true,
bool subs = true, bool pls = true );
protected:
friend class QVLCMenu;
QSignalMapper *menusMapper;
......@@ -69,7 +73,6 @@ private:
DialogsProvider( intf_thread_t *);
intf_thread_t *p_intf;
static DialogsProvider *instance;
QStringList showSimpleOpen();
void addFromSimple( bool, bool );
public slots:
......@@ -84,6 +87,7 @@ public slots:
void simpleOpenDialog();
void openDialog();
void openDialog(int );
void openFileDialog();
void openNetDialog();
void openDiscDialog();
void PLAppendDialog();
......
......@@ -141,8 +141,8 @@ void QVLCMenu::createMenuBar( MainInterface *mi, intf_thread_t *p_intf,
QMenu *QVLCMenu::FileMenu()
{
QMenu *menu = new QMenu();
DP_SADD( qtr("Quick &Open File...") , "", "", simpleOpenDialog() );
DP_SADD( qtr("&Advanced Open..." ), "", "", openDialog() );
/* DP_SADD( qtr("Quick &Open File...") , "", "", simpleOpenDialog() );*/
DP_SADD( qtr("Open &File..." ), "", "", openFileDialog() );
DP_SADD( qtr("Open &Network..." ), "", "", openNetDialog());
DP_SADD( qtr("Open &Disc..." ), "", "", openDiscDialog());
menu->addSeparator();
......
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