Commit f787ec76 authored by Clément Stenac's avatar Clément Stenac

open directory and playlist

parent 57e8f47c
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
#include "qt4.hpp" #include "qt4.hpp"
#include <QEvent> #include <QEvent>
#include "dialogs_provider.hpp" #include "dialogs_provider.hpp"
...@@ -218,6 +217,41 @@ void DialogsProvider::simpleOpenDialog() ...@@ -218,6 +217,41 @@ void DialogsProvider::simpleOpenDialog()
} }
} }
void DialogsProvider::openPlaylist()
{
QStringList files = showSimpleOpen();
QString file;
for( size_t i = 0 ; i< files.size(); i++ )
{
const char * psz_utf8 = files[i].toUtf8().data();
/* Play the first one, parse and enqueue the other ones */
playlist_Import( THEPL, psz_utf8, THEPL->p_root_category, VLC_FALSE );
}
}
void DialogsProvider::openDirectory()
{
QString dir = QFileDialog::getExistingDirectory ( 0,
_("Open directory") );
const char *psz_utf8 = dir.toUtf8().data();
input_item_t *p_input = input_ItemNewExt( THEPL, psz_utf8, psz_utf8,
0, NULL, -1 );
playlist_PlaylistAddInput( THEPL, p_input,
PLAYLIST_APPEND, PLAYLIST_END );
input_Read( THEPL, p_input, VLC_FALSE );
}
void DialogsProvider::openMLDirectory()
{
QString dir = QFileDialog::getExistingDirectory ( 0,
_("Open directory") );
const char *psz_utf8 = dir.toUtf8().data();
fprintf( stderr, "%s\n", psz_utf8 );
input_item_t *p_input = input_ItemNewExt( THEPL, psz_utf8, psz_utf8,
0, NULL, -1 );
playlist_MLAddInput( THEPL, p_input, PLAYLIST_APPEND, PLAYLIST_END );
input_Read( THEPL, p_input, VLC_FALSE );
}
QStringList DialogsProvider::showSimpleOpen() QStringList DialogsProvider::showSimpleOpen()
{ {
QString FileTypes; QString FileTypes;
......
...@@ -82,6 +82,9 @@ public slots: ...@@ -82,6 +82,9 @@ public slots:
void menuAction( QObject *); void menuAction( QObject *);
void menuUpdateAction( QObject *); void menuUpdateAction( QObject *);
void streamingDialog(); void streamingDialog();
void openPlaylist();
void openDirectory();
void openMLDirectory();
void quit(); void quit();
}; };
......
...@@ -146,9 +146,11 @@ void QVLCMenu::createPlMenuBar( QMenuBar *bar, intf_thread_t *p_intf ) ...@@ -146,9 +146,11 @@ void QVLCMenu::createPlMenuBar( QMenuBar *bar, intf_thread_t *p_intf )
subML->setTitle( qtr("Add to Media library") ); subML->setTitle( qtr("Add to Media library") );
subML->addAction( "&File...", THEDP, subML->addAction( "&File...", THEDP,
SLOT( simpleMLAppendDialog() ) ); SLOT( simpleMLAppendDialog() ) );
subML->addAction( "Directory", THEDP, SLOT( openMLDirectory() ));
subML->addAction( "&Advanced add...", THEDP, subML->addAction( "&Advanced add...", THEDP,
SLOT( MLAppendDialog() ) ); SLOT( MLAppendDialog() ) );
manageMenu->addMenu( subML ); manageMenu->addMenu( subML );
manageMenu->addAction( "Open playlist file", THEDP, SLOT( openPlaylist() ));
manageMenu->addSeparator(); manageMenu->addSeparator();
// manageMenu->addMenu( SDMenu( p_intf ) ); // manageMenu->addMenu( SDMenu( p_intf ) );
......
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