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 ******************************************************************************/
24 #include "dialogs/playlist.hpp"
27 #include "main_interface.hpp"
28 #include "util/qvlcframe.hpp"
29 #include "components/interface_widgets.hpp"
30 #include "dialogs_provider.hpp"
33 #include <QHBoxLayout>
34 #include <QSignalMapper>
39 PlaylistDialog *PlaylistDialog::instance = NULL;
41 PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
43 QWidget *main = new QWidget( this );
44 setCentralWidget( main );
45 setWindowTitle( qtr( "Playlist" ) );
47 createPlMenuBar( menuBar(), p_intf );
49 QHBoxLayout *l = new QHBoxLayout( centralWidget() );
50 PlaylistWidget *plw = new PlaylistWidget( p_intf );
53 readSettings( "playlist", QSize( 600,700 ) );
56 PlaylistDialog::~PlaylistDialog()
58 writeSettings( "playlist" );
61 void PlaylistDialog::createPlMenuBar( QMenuBar *bar, intf_thread_t *p_intf )
63 QMenu *manageMenu = new QMenu();
64 manageMenu->setTitle( qtr("Manage") );
65 manageMenu->addAction( "Open playlist file", THEDP, SLOT( openPlaylist() ));
66 manageMenu->addSeparator();
67 manageMenu->addAction( "Dock playlist", this, SLOT( dock() ) );
68 bar->addMenu( manageMenu );
69 bar->addMenu( QVLCMenu::SDMenu( p_intf ) );
72 void PlaylistDialog::dock()
75 QEvent *event = new QEvent( (QEvent::Type)(PLDockEvent_Type) );
76 QApplication::postEvent( p_intf->p_sys->p_mi, event );