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 "main_interface.hpp"
30 #include "components/playlist/playlist.hpp"
31 #include "dialogs_provider.hpp"
35 #include <QHBoxLayout>
36 #include <QSignalMapper>
41 PlaylistDialog *PlaylistDialog::instance = NULL;
43 PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf )
46 QWidget *main = new QWidget( this );
47 setCentralWidget( main );
48 setWindowTitle( qtr( "Playlist" ) );
49 setWindowOpacity( config_GetFloat( p_intf, "qt-opacity" ) );
51 QHBoxLayout *l = new QHBoxLayout( centralWidget() );
53 getSettings()->beginGroup("playlistdialog");
55 playlistWidget = new PlaylistWidget( p_intf, this );
56 l->addWidget( playlistWidget );
58 readSettings( getSettings(), QSize( 600,700 ) );
60 getSettings()->endGroup();
63 PlaylistDialog::~PlaylistDialog()
65 getSettings()->beginGroup("playlistdialog");
67 writeSettings( getSettings() );
68 playlistWidget->savingSettings();
70 getSettings()->endGroup();
73 void PlaylistDialog::dropEvent( QDropEvent *event )
75 const QMimeData *mimeData = event->mimeData();
76 foreach( QUrl url, mimeData->urls() ) {
77 QString s = url.toString();
78 if( s.length() > 0 ) {
79 playlist_Add( THEPL, qtu(s), NULL,
80 PLAYLIST_APPEND, PLAYLIST_END, true, false );
83 event->acceptProposedAction();
85 void PlaylistDialog::dragEnterEvent( QDragEnterEvent *event )
87 event->acceptProposedAction();
89 void PlaylistDialog::dragMoveEvent( QDragMoveEvent *event )
91 event->acceptProposedAction();
93 void PlaylistDialog::dragLeaveEvent( QDragLeaveEvent *event )