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"
35 #include <QHBoxLayout>
37 PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf )
40 setWindowTitle( qtr( "Playlist" ) );
41 setWindowRole( "vlc-playlist" );
42 setWindowOpacity( var_InheritFloat( p_intf, "qt-opacity" ) );
44 playlistWidget = new PlaylistWidget( p_intf, this );
45 setCentralWidget( playlistWidget );
47 readSettings( "playlistdialog", QSize( 600,700 ) );
50 PlaylistWidget *PlaylistDialog::exportPlaylistWidget()
52 Q_ASSERT( playlistWidget );
53 PlaylistWidget *widget = playlistWidget;
54 layout()->removeWidget( playlistWidget );
55 playlistWidget = NULL;
59 void PlaylistDialog::importPlaylistWidget( PlaylistWidget *widget )
61 Q_ASSERT( !playlistWidget );
62 playlistWidget = widget;
63 setCentralWidget( playlistWidget );
64 playlistWidget->show();
67 bool PlaylistDialog::hasPlaylistWidget()
69 return ( !! playlistWidget );
72 void PlaylistDialog::hideEvent( QHideEvent * event )
74 QWidget::hideEvent( event );
75 emit visibilityChanged( false );
78 PlaylistDialog::~PlaylistDialog()
80 writeSettings( "playlistdialog" );
83 void PlaylistDialog::dropEvent( QDropEvent *event )
85 playlistWidget->dropEvent(event);
87 void PlaylistDialog::dragEnterEvent( QDragEnterEvent *event )
89 event->acceptProposedAction();
91 void PlaylistDialog::dragMoveEvent( QDragMoveEvent *event )
93 event->acceptProposedAction();
95 void PlaylistDialog::dragLeaveEvent( QDragLeaveEvent *event )