1 /*****************************************************************************
2 * playlist.cpp : Playlist dialog
3 ****************************************************************************
4 * Copyright (C) 2006 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 ******************************************************************************/
27 #include "dialogs/playlist.hpp"
29 #include "components/playlist/playlist.hpp"
31 #include "util/qt_dirs.hpp"
34 #include <QHBoxLayout>
36 PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf )
39 QWidget *main = new QWidget( this );
40 setCentralWidget( main );
41 setWindowTitle( qtr( "Playlist" ) );
42 setWindowRole( "vlc-playlist" );
43 setWindowOpacity( var_InheritFloat( p_intf, "qt-opacity" ) );
45 QHBoxLayout *l = new QHBoxLayout( centralWidget() );
47 getSettings()->beginGroup("playlistdialog");
49 playlistWidget = new PlaylistWidget( p_intf, this );
50 l->addWidget( playlistWidget );
52 readSettings( getSettings(), QSize( 600,700 ) );
54 getSettings()->endGroup();
57 PlaylistDialog::~PlaylistDialog()
59 getSettings()->beginGroup("playlistdialog");
60 writeSettings( getSettings() );
61 getSettings()->endGroup();
64 void PlaylistDialog::dropEvent( QDropEvent *event )
66 const QMimeData *mimeData = event->mimeData();
67 foreach( const QUrl &url, mimeData->urls() ) {
68 QString s = toNativeSeparators( url.toString() );
69 if( s.length() > 0 ) {
70 playlist_Add( THEPL, qtu(s), NULL,
71 PLAYLIST_APPEND, PLAYLIST_END, true, false );
74 event->acceptProposedAction();
76 void PlaylistDialog::dragEnterEvent( QDragEnterEvent *event )
78 event->acceptProposedAction();
80 void PlaylistDialog::dragMoveEvent( QDragMoveEvent *event )
82 event->acceptProposedAction();
84 void PlaylistDialog::dragLeaveEvent( QDragLeaveEvent *event )