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

Cosmetics + Enable menu in playlist

parent 6a42cf33
...@@ -32,6 +32,8 @@ PLSelector::PLSelector( QWidget *p, intf_thread_t *_p_intf, ...@@ -32,6 +32,8 @@ PLSelector::PLSelector( QWidget *p, intf_thread_t *_p_intf,
{ {
model = new PLModel( THEPL, THEPL->p_root_category, 1, this ); model = new PLModel( THEPL, THEPL->p_root_category, 1, this );
view = new QTreeView( 0 ); view = new QTreeView( 0 );
view->setIconSize( QSize( 24,24 ) );
view->setAlternatingRowColors( true );
view->setIndentation( 0 ); view->setIndentation( 0 );
view->header()->hide(); view->header()->hide();
view->setModel( model ); view->setModel( model );
......
...@@ -43,6 +43,8 @@ StandardPLPanel::StandardPLPanel( QWidget *_parent, intf_thread_t *_p_intf, ...@@ -43,6 +43,8 @@ StandardPLPanel::StandardPLPanel( QWidget *_parent, intf_thread_t *_p_intf,
model = new PLModel( p_playlist, p_root, -1, this ); model = new PLModel( p_playlist, p_root, -1, this );
view = new QVLCTreeView( 0 ); view = new QVLCTreeView( 0 );
view->setModel(model); view->setModel(model);
view->setIconSize( QSize(20,20) );
view->setAlternatingRowColors( true );
view->header()->resizeSection( 0, 300 ); view->header()->resizeSection( 0, 300 );
view->setSelectionMode( QAbstractItemView::ExtendedSelection ); view->setSelectionMode( QAbstractItemView::ExtendedSelection );
......
...@@ -33,9 +33,9 @@ PlaylistDialog *PlaylistDialog::instance = NULL; ...@@ -33,9 +33,9 @@ PlaylistDialog *PlaylistDialog::instance = NULL;
PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
{ {
setWindowTitle( qtr( "Playlist" ) );
QWidget *main = new QWidget( this ); QWidget *main = new QWidget( this );
setCentralWidget( main ); setCentralWidget( main );
setWindowTitle( qtr( "Playlist" ) );
QVLCMenu::createPlMenuBar( menuBar(), p_intf ); QVLCMenu::createPlMenuBar( menuBar(), p_intf );
selector = new PLSelector( centralWidget(), p_intf, THEPL ); selector = new PLSelector( centralWidget(), p_intf, THEPL );
...@@ -50,7 +50,7 @@ PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -50,7 +50,7 @@ PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
layout->addWidget( selector, 0 ); layout->addWidget( selector, 0 );
layout->addWidget( rightPanel, 10 ); layout->addWidget( rightPanel, 10 );
centralWidget()->setLayout( layout ); centralWidget()->setLayout( layout );
readSettings( "playlist", QSize( 600,300 ) ); readSettings( "playlist", QSize( 600,500 ) );
} }
PlaylistDialog::~PlaylistDialog() PlaylistDialog::~PlaylistDialog()
......
...@@ -173,19 +173,33 @@ void DialogsProvider::menuUpdateAction( QObject *data ) ...@@ -173,19 +173,33 @@ void DialogsProvider::menuUpdateAction( QObject *data )
void DialogsProvider::simpleAppendDialog() void DialogsProvider::simpleAppendDialog()
{ {
QStringList files = showSimpleOpen();
QString file;
foreach( file, files )
{
const char * psz_utf8 = file.toUtf8().data();
playlist_PlaylistAdd( THEPL, psz_utf8, psz_utf8,
PLAYLIST_APPEND | PLAYLIST_PREPARSE, PLAYLIST_END );
}
} }
void DialogsProvider::simpleOpenDialog() void DialogsProvider::simpleOpenDialog()
{ {
playlist_t *p_playlist = QStringList files = showSimpleOpen();
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, QString file;
FIND_ANYWHERE ); for( size_t i = 0 ; i< files.size(); i++ )
if( p_playlist == NULL )
{ {
return; const char * psz_utf8 = files[i].toUtf8().data();
/* Play the first one, parse and enqueue the other ones */
playlist_PlaylistAdd( THEPL, psz_utf8, psz_utf8,
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) |
( i ? PLAYLIST_PREPARSE : 0 ),
PLAYLIST_END );
} }
}
QStringList DialogsProvider::showSimpleOpen()
{
QString FileTypes; QString FileTypes;
FileTypes = "Video Files ( "; FileTypes = "Video Files ( ";
FileTypes += EXTENSIONS_VIDEO; FileTypes += EXTENSIONS_VIDEO;
...@@ -193,27 +207,10 @@ void DialogsProvider::simpleOpenDialog() ...@@ -193,27 +207,10 @@ void DialogsProvider::simpleOpenDialog()
FileTypes += EXTENSIONS_AUDIO; FileTypes += EXTENSIONS_AUDIO;
FileTypes += ");; PlayList Files ( "; FileTypes += ");; PlayList Files ( ";
FileTypes += EXTENSIONS_PLAYLIST; FileTypes += EXTENSIONS_PLAYLIST;
FileTypes += ");; Subtitles Files ( ";
FileTypes += EXTENSIONS_SUBTITLE;
FileTypes += ");; All Files (*.*) " ; FileTypes += ");; All Files (*.*) " ;
FileTypes.replace(QString(";*"), QString(" *")); FileTypes.replace(QString(";*"), QString(" *"));
return QFileDialog::getOpenFileNames( NULL, qfu(I_POP_SEL_FILES ),
QStringList fileList = QFileDialog::getOpenFileNames( p_intf->p_vlc->psz_homedir, FileTypes );
NULL, qfu(I_POP_SEL_FILES ), p_intf->p_vlc->psz_homedir,
FileTypes);
QStringList files = fileList;
for (size_t i = 0; i < files.size(); i++)
{
const char * psz_utf8 = files[i].toUtf8().data();
playlist_PlaylistAdd( p_playlist, psz_utf8, psz_utf8,
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) |
(i ? PLAYLIST_PREPARSE : 0 ),
PLAYLIST_END );
}
vlc_object_release(p_playlist);
} }
void DialogsProvider::bookmarksDialog() void DialogsProvider::bookmarksDialog()
......
...@@ -39,7 +39,7 @@ class DialogsProvider : public QObject ...@@ -39,7 +39,7 @@ class DialogsProvider : public QObject
{ {
Q_OBJECT; Q_OBJECT;
public: public:
static DialogsProvider *getInstance() static DialogsProvider *getInstance()
{ {
assert( instance ); assert( instance );
return instance; return instance;
...@@ -62,6 +62,7 @@ private: ...@@ -62,6 +62,7 @@ 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();
public slots: public slots:
void playlistDialog(); void playlistDialog();
......
...@@ -131,6 +131,7 @@ void QVLCMenu::createMenuBar( QMenuBar *bar, intf_thread_t *p_intf ) ...@@ -131,6 +131,7 @@ void QVLCMenu::createMenuBar( QMenuBar *bar, intf_thread_t *p_intf )
void QVLCMenu::createPlMenuBar( QMenuBar *bar, intf_thread_t *p_intf ) void QVLCMenu::createPlMenuBar( QMenuBar *bar, intf_thread_t *p_intf )
{ {
QMenu *manageMenu = new QMenu(); QMenu *manageMenu = new QMenu();
manageMenu->setTitle( qtr("Operations") );
manageMenu->addAction( "Quick &Add File...", THEDP, manageMenu->addAction( "Quick &Add File...", THEDP,
SLOT( simpleAppendDialog() ) ); SLOT( simpleAppendDialog() ) );
manageMenu->addSeparator(); manageMenu->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