Commit 1be77d50 authored by zorglub's avatar zorglub

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