playlist.cpp 2.6 KB
Newer Older
zorglub's avatar
zorglub committed
1
2
3
/*****************************************************************************
 * playlist.cpp : Playlist dialog
 ****************************************************************************
4
5
 * Copyright (C) 2006 the VideoLAN team
 * $Id$
zorglub's avatar
zorglub committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 *
 * Authors: Clément Stenac <zorglub@videolan.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
zorglub's avatar
zorglub committed
21
22
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 ******************************************************************************/
zorglub's avatar
zorglub committed
23
24

#include "dialogs/playlist.hpp"
25
26

#include "main_interface.hpp"
zorglub's avatar
zorglub committed
27
#include "components/interface_widgets.hpp"
28
#include "dialogs_provider.hpp"
zorglub's avatar
zorglub committed
29
#include "menus.hpp"
30

zorglub's avatar
zorglub committed
31
#include <QUrl>
32
#include <QHBoxLayout>
zorglub's avatar
zorglub committed
33
34
35
36
#include <QSignalMapper>
#include <QMenu>
#include <QAction>
#include <QMenuBar>
zorglub's avatar
zorglub committed
37
38
39

PlaylistDialog *PlaylistDialog::instance = NULL;

40
41
PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf ) 
                : QVLCMW( _p_intf )
zorglub's avatar
zorglub committed
42
{
zorglub's avatar
zorglub committed
43
44
    QWidget *main = new QWidget( this );
    setCentralWidget( main );
zorglub's avatar
zorglub committed
45
    setWindowTitle( qtr( "Playlist" ) );
46
    setWindowOpacity( config_GetFloat( p_intf, "qt-opacity" ) );
zorglub's avatar
zorglub committed
47

zorglub's avatar
zorglub committed
48
    QHBoxLayout *l = new QHBoxLayout( centralWidget() );
49
    PlaylistWidget *plw = new PlaylistWidget( p_intf, NULL );
zorglub's avatar
zorglub committed
50
    l->addWidget( plw );
zorglub's avatar
zorglub committed
51

zorglub's avatar
zorglub committed
52
    readSettings( "playlist", QSize( 600,700 ) );
zorglub's avatar
zorglub committed
53
54
55
56
}

PlaylistDialog::~PlaylistDialog()
{
57
    writeSettings( "playlist" );    
zorglub's avatar
zorglub committed
58
}
zorglub's avatar
zorglub committed
59

zorglub's avatar
zorglub committed
60
61
62
63
64
65
void PlaylistDialog::dropEvent(QDropEvent *event)
{
     const QMimeData *mimeData = event->mimeData();
     foreach( QUrl url, mimeData->urls() ) {
        QString s = url.toString();
        if( s.length() > 0 ) {
66
            playlist_Add( THEPL, qtu(s), NULL,
67
                          PLAYLIST_APPEND, PLAYLIST_END, VLC_TRUE, VLC_FALSE );
zorglub's avatar
zorglub committed
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
        }
     }
     event->acceptProposedAction();
}
void PlaylistDialog::dragEnterEvent(QDragEnterEvent *event)
{
     event->acceptProposedAction();
}
void PlaylistDialog::dragMoveEvent(QDragMoveEvent *event)
{
     event->acceptProposedAction();
}
void PlaylistDialog::dragLeaveEvent(QDragLeaveEvent *event)
{
     event->accept();
}