]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs/playlist.cpp
b7d8f9a81a078dac1889d411d99ef090dd3619eb
[vlc] / modules / gui / qt4 / dialogs / playlist.cpp
1 /*****************************************************************************
2  * playlist.cpp : Playlist dialog
3  ****************************************************************************
4  * Copyright (C) 2006 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *
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.
13  *
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.
18  *
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  ******************************************************************************/
23
24 #include "dialogs/playlist.hpp"
25
26 #include "main_interface.hpp"
27 #include "components/interface_widgets.hpp"
28 #include "dialogs_provider.hpp"
29 #include "menus.hpp"
30
31 #include <QUrl>
32 #include <QHBoxLayout>
33 #include <QSignalMapper>
34 #include <QMenu>
35 #include <QAction>
36 #include <QMenuBar>
37
38 PlaylistDialog *PlaylistDialog::instance = NULL;
39
40 PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf ) 
41                 : QVLCMW( _p_intf )
42 {
43     QWidget *main = new QWidget( this );
44     setCentralWidget( main );
45     setWindowTitle( qtr( "Playlist" ) );
46     setWindowOpacity( config_GetFloat( p_intf, "qt-opacity" ) );
47
48     QHBoxLayout *l = new QHBoxLayout( centralWidget() );
49     PlaylistWidget *plw = new PlaylistWidget( p_intf, NULL );
50     l->addWidget( plw );
51
52     readSettings( "playlist", QSize( 600,700 ) );
53 }
54
55 PlaylistDialog::~PlaylistDialog()
56 {
57     writeSettings( "playlist" );
58 }
59
60 void PlaylistDialog::dropEvent(QDropEvent *event)
61 {
62      const QMimeData *mimeData = event->mimeData();
63      foreach( QUrl url, mimeData->urls() ) {
64         QString s = url.toString();
65         if( s.length() > 0 ) {
66             playlist_Add( THEPL, qtu(s), NULL,
67                           PLAYLIST_APPEND, PLAYLIST_END, VLC_TRUE, VLC_FALSE );
68         }
69      }
70      event->acceptProposedAction();
71 }
72 void PlaylistDialog::dragEnterEvent(QDragEnterEvent *event)
73 {
74      event->acceptProposedAction();
75 }
76 void PlaylistDialog::dragMoveEvent(QDragMoveEvent *event)
77 {
78      event->acceptProposedAction();
79 }
80 void PlaylistDialog::dragLeaveEvent(QDragLeaveEvent *event)
81 {
82      event->accept();
83 }
84