From: Clément Stenac Date: Sat, 23 Dec 2006 10:36:24 +0000 (+0000) Subject: * Only allow playlist files in open playlist (Refs:#940) X-Git-Tag: 0.9.0-test0~8943 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=1be77d50ab47b8e4b17522a12266e935fce04a21;p=vlc * Only allow playlist files in open playlist (Refs:#940) * For the time being, hide simple open. Better three clicks than confusing things :) --- diff --git a/modules/gui/qt4/components/open.cpp b/modules/gui/qt4/components/open.cpp index 1329ff8d3e..c205627d9f 100644 --- a/modules/gui/qt4/components/open.cpp +++ b/modules/gui/qt4/components/open.cpp @@ -25,8 +25,7 @@ #include "qt4.hpp" #include "components/open.hpp" - -#include +#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() diff --git a/modules/gui/qt4/dialogs/open.cpp b/modules/gui/qt4/dialogs/open.cpp index bedce7f107..5e1410ff92 100644 --- a/modules/gui/qt4/dialogs/open.cpp +++ b/modules/gui/qt4/dialogs/open.cpp @@ -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 ); diff --git a/modules/gui/qt4/dialogs_provider.cpp b/modules/gui/qt4/dialogs_provider.cpp index 0c999c2300..09a0581679 100644 --- a/modules/gui/qt4/dialogs_provider.cpp +++ b/modules/gui/qt4/dialogs_provider.cpp @@ -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) ); diff --git a/modules/gui/qt4/dialogs_provider.hpp b/modules/gui/qt4/dialogs_provider.hpp index 817de8c7b1..684172c632 100644 --- a/modules/gui/qt4/dialogs_provider.hpp +++ b/modules/gui/qt4/dialogs_provider.hpp @@ -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(); diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp index 9bfc2e4253..8787e821c6 100644 --- a/modules/gui/qt4/menus.cpp +++ b/modules/gui/qt4/menus.cpp @@ -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();